Example #1
0
eolKeychain *eol_level_build_backgrounds_keychain(GList *backgrounds)
{
  eolKeychain *bgList = NULL;
  eolKeychain *bgItem;
  GList *l;
  eolBackground *bg;
  if (!backgrounds)return NULL;
  bgList = eol_keychain_new_list();
  if (!bgList)return NULL;
  for (l = backgrounds;l != NULL;l = l->next)
  {
    if (l->data)
    {
      bg = (eolBackground*)l->data;
      bgItem = eol_keychain_new_hash();
      if (!bgItem)continue;
      eol_keychain_hash_insert(bgItem,"ori",eol_keychain_new_orientation(bg->ori));
      eol_keychain_hash_insert(bgItem,"hidden",eol_keychain_new_bool(bg->hidden));
      eol_keychain_hash_insert(bgItem,"useAsClip",eol_keychain_new_bool(bg->useAsClip));
      eol_keychain_hash_insert(bgItem,"modelFile",eol_keychain_new_string(bg->modelFile));
      eol_keychain_hash_insert(bgItem,"followCam",eol_keychain_new_float(bg->followCam));
      eol_keychain_list_append(bgList,bgItem);
    }
  }
  return bgList;
}
Example #2
0
eolKeychain *eol_spawn_build_keychain(eolSpawn *spawn)
{
  eolKeychain * spawnKey = NULL;
  if (!spawn)return NULL;
  spawnKey = eol_keychain_new_hash();
  if (!spawnKey)return NULL;
  eol_keychain_hash_insert(spawnKey,"type",eol_keychain_new_string(spawn->type));
  eol_keychain_hash_insert(spawnKey,"id",eol_keychain_new_uint(spawn->id));
  eol_keychain_hash_insert(spawnKey,"ori",eol_keychain_new_orientation(spawn->ori));
  eol_keychain_hash_insert(spawnKey,"keys",eol_keychain_clone(spawn->keys));
  return spawnKey;
}
Example #3
0
eolKeychain *eol_level_build_layer_keychain(eolLevelLayer *layer)
{
  eolKeychain *keys;
  eolKeychain *key;
  if (!layer)return NULL;
  keys = eol_keychain_new_hash();
  if (!keys)return NULL;
  eol_keychain_hash_insert(keys,"idName",eol_keychain_new_string(layer->idName));
  eol_keychain_hash_insert(keys,"ori",eol_keychain_new_orientation(layer->ori));
  eol_keychain_hash_insert(keys,"bounds",eol_keychain_new_rectf(layer->bounds));
  eol_keychain_hash_insert(keys,"hidden",eol_keychain_new_bool(layer->hidden));
  eol_keychain_hash_insert(keys,"usesClipMesh",eol_keychain_new_bool(layer->usesClipMesh));
  eol_keychain_hash_insert(keys,"usesTileMap",eol_keychain_new_bool(layer->usesTileMap));
  /*pack other extensible parts of the level*/
  key = eol_keychain_clone(layer->keys);
  if (key != NULL)
  { 
    eol_keychain_hash_insert(keys,"keys",key);
  }

  key = eol_tile_map_build_keychain(layer->tileMap);
  if (key != NULL)
  {
    eol_keychain_hash_insert(keys,"tileMap",key);
  }
  key = eol_level_build_backgrounds_keychain(layer->backgrounds);
  if (key != NULL)
  {
    eol_keychain_hash_insert(keys,"backgrounds",key);
  }
  key = eol_level_build_spawn_list(layer->spawnList);
  if (key != NULL)
  {
    eol_keychain_hash_insert(keys,"spawnList",key);
  }

  return keys;
}