int CIwGameFile::getFileSize() { if (File == NULL) return -1; return s3eFileGetSize(File); }
unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize) { IW_CALLSTACK("CCFileUtils::getFileData"); s3eFile* pFile = s3eFileOpen(pszFileName, pszMode); if (! pFile && getIsPopupNotify()) { IwAssertMsg(GAME, pFile, ("Open file %s Failed. s3eFileError Code : %i", pszFileName, s3eFileGetError())); } if (! pFile) { *pSize = 0; return 0; } int32 fileSize = s3eFileGetSize(pFile); *pSize=fileSize; static int32* pDataToBeReadBinary; pDataToBeReadBinary = (int32*)s3eMallocBase(fileSize); memset(pDataToBeReadBinary, 0, fileSize); s3eFileRead(pDataToBeReadBinary, fileSize, 1, pFile); s3eFileClose(pFile); return (unsigned char*)pDataToBeReadBinary; }
void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath) { s3eFile *fileHandle = s3eFileOpen(pszFilePath, "rb"); IwAssertMsg(GAME, fileHandle, ("Open file %s Failed. s3eFileError Code : %i", pszFilePath, s3eFileGetError())); g_AudioFileSize = s3eFileGetSize(fileHandle); g_AudioBuffer = (int16*)malloc(g_AudioFileSize); memset(g_AudioBuffer, 0, g_AudioFileSize); s3eFileRead(g_AudioBuffer, g_AudioFileSize, 1, fileHandle); s3eFileClose(fileHandle); }
void Map::ReadJsonFile(char * filename) { cJSON *root; char * jsonContent; s3eFile* fileHandler; fileHandler=s3eFileOpen(filename, "rb"); if (fileHandler != NULL) { // Allocate buffer to be filled with the files contents int32 fileSize = s3eFileGetSize(fileHandler); jsonContent = (char*)s3eMallocBase(fileSize+1); // Read data from file if (s3eFileRead(&jsonContent[0], fileSize+1, 1, fileHandler) != 1) { // An kError has occurred, retrieve information for display std::cout<<s3eFileGetErrorString()<<std::endl; } else { // Data reading has been successful jsonContent[fileSize] = '\0'; } } else { // Something went wrong during opening of the file retrieve error for display std::cout<<s3eFileGetErrorString()<<std::endl; } if (fileHandler) s3eFileClose(fileHandler); root = cJSON_Parse(jsonContent); s3eFileFlush(fileHandler); _height=cJSON_GetObjectItem(root,"height")->valueint; cJSON *layers = cJSON_GetObjectItem(root,"layers"); _tileHeight=cJSON_GetObjectItem(root,"tileheight")->valueint; _tileWidth=cJSON_GetObjectItem(root,"tilewidth")->valueint; _width=cJSON_GetObjectItem(root,"width")->valueint; _layer_base->Init(cJSON_GetArrayItem(layers,0)); _layer_middle->Init(cJSON_GetArrayItem(layers,1)); _layer_maze->Init(cJSON_GetArrayItem(layers,2)); cJSON *tilesets = cJSON_GetObjectItem(root,"tilesets"); _tileset_map->Init(cJSON_GetArrayItem(tilesets,0)); _tileset_maze->Init(cJSON_GetArrayItem(tilesets,1)); _total=_height*_width; _size=CIwSVec2(_width*_tileWidth,_height*_tileHeight); }
void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath) { // Changing file path to full path std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath); s3eFile *fileHandle = s3eFileOpen(fullPath.c_str(), "rb"); IwAssertMsg(GAME, fileHandle, ("Open file %s Failed. s3eFileError Code : %i", fullPath.c_str(), s3eFileGetError())); g_AudioFileSize = s3eFileGetSize(fileHandle); g_AudioBuffer = (int16*)malloc(g_AudioFileSize); memset(g_AudioBuffer, 0, g_AudioFileSize); s3eFileRead(g_AudioBuffer, g_AudioFileSize, 1, fileHandle); s3eFileClose(fileHandle); }
Sounds::Sound* Sounds::loadSound(const char* filename) { Sounds::Sound* sound = new Sounds::Sound(); s3eFile *fileHandle = s3eFileOpen(filename, "rb"); if (fileHandle) { strcpy(sound->fileName, filename); sound->fileSize = s3eFileGetSize(fileHandle); sound->buffer = (int16*)s3eMallocBase(sound->fileSize); memset(sound->buffer, 0, sound->fileSize); s3eFileRead(sound->buffer, sound->fileSize, 1, fileHandle); s3eFileClose(fileHandle); } else fprintf(stderr, "Error loading sound file: %s.\n", filename); return sound; }
Buffer loadFile(const char * fname) { s3eFile * file = s3eFileOpen(fname, "rb"); if(file) { size_t size = s3eFileGetSize(file); Buffer result(size); s3eFileRead(result.data(), 1, size, file); s3eFileClose(file); return result; } else { IwAssertMsg(AUDIO_UTILS, false, ("failed to open: %s", fname)); return Buffer(); } }
void SimpleAudioEngine::preloadEffect(const char* pszFilePath) { SoundFxMap::iterator it = g_pSoundFxMap->find(pszFilePath) ; if( it==g_pSoundFxMap->end() ) { s3eFile *fileHandle = s3eFileOpen(pszFilePath, "rb"); IwAssertMsg(GAME, fileHandle, ("Open file %s Failed. s3eFileError Code : %i", pszFilePath, s3eFileGetError())); int32 fileSize = s3eFileGetSize(fileHandle); int16* buff = (int16*)malloc(fileSize); (*g_pSoundFxMap)[pszFilePath] = SoundFx(buff,fileSize) ; memset(buff, 0, fileSize); s3eFileRead(buff, fileSize, 1, fileHandle); s3eFileClose(fileHandle); } }
void SimpleAudioEngine::preloadEffect(const char* pszFilePath) { // Changing file path to full path std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath); SoundFxMap::iterator it = g_pSoundFxMap->find(fullPath) ; if( it==g_pSoundFxMap->end() ) { s3eFile *fileHandle = s3eFileOpen(fullPath.c_str(), "rb"); IwAssertMsg(GAME, fileHandle, ("Open file %s Failed. s3eFileError Code : %i", fullPath.c_str(), s3eFileGetError())); int32 fileSize = s3eFileGetSize(fileHandle); int16* buff = (int16*)malloc(fileSize); (*g_pSoundFxMap)[fullPath] = SoundFx(buff,fileSize) ; memset(buff, 0, fileSize); s3eFileRead(buff, fileSize, 1, fileHandle); s3eFileClose(fileHandle); } }
void SimpleAudioEngine::preloadEffect(const char* pszFilePath) { SoundFxMap::iterator it = g_pSoundFxMap->find(pszFilePath) ; if( it==g_pSoundFxMap->end() ) { #if 0 CIwResHandlerWAV * wav_handler = new CIwResHandlerWAV(); class OpenSoundData: public CIwSoundData { public: int16 * GetBuffer() { return (int16*)m_Samples; } }; OpenSoundData * res = (OpenSoundData*)dynamic_cast<CIwSoundData*>(wav_handler->Build(pszFilePath)); int32 data_size = res->GetBufferSize(); int16* buff = (int16*)malloc(data_size); memcpy(buff, res->GetBuffer(), data_size); (*g_pSoundFxMap)[pszFilePath] = SoundFx(buff, data_size); delete res; delete wav_handler; #else s3eFile *fileHandle = s3eFileOpen(pszFilePath, "rb"); IwAssertMsg(GAME, fileHandle, ("Open file %s Failed. s3eFileError Code : %i", pszFilePath, s3eFileGetError())); int32 fileSize = s3eFileGetSize(fileHandle); int16* buff = (int16*)malloc(fileSize); (*g_pSoundFxMap)[pszFilePath] = SoundFx(buff,fileSize) ; memset(buff, 0, fileSize); s3eFileRead(buff, fileSize, 1, fileHandle); s3eFileClose(fileHandle); #endif } }
AKRESULT s3eIOHook::Open(const AkOSChar* in_pszFileName, AkOpenMode in_eOpenMode, AkFileSystemFlags *in_pFlags, bool &io_bSyncOpen, AkFileDesc &out_fileDesc) { io_bSyncOpen = true; const char *mode; switch ( in_eOpenMode ) { case AK_OpenModeRead: mode = "r"; break; case AK_OpenModeWrite: mode = "w"; break; case AK_OpenModeWriteOvrwr: mode = "w+"; break; case AK_OpenModeReadWrite: mode = "a"; break; default: AKASSERT( !"Invalid open mode" ); return AK_InvalidParameter; break; } s3eFile *file = s3eFileOpen(in_pszFileName, mode); if ( file != NULL ) { out_fileDesc.iFileSize = s3eFileGetSize(file); out_fileDesc.uSector = 0; out_fileDesc.deviceID = m_deviceID; out_fileDesc.pCustomParam = NULL; out_fileDesc.uCustomParamSize = 0; out_fileDesc.hFile = (AkFileHandle)file; return AK_Success; } return AK_Fail; }
void MapBackground::CreateMapTileImage2(MapTile* pMapTile, char* szPath, bool isJpg) { if (!IsTileVisible(pMapTile)) { return; } CIwImage image; if (!isJpg) { image.LoadFromFile(szPath); if (image.GetWidth()) { pMapTile->pTexture = new CIwTexture; pMapTile->pTexture->CopyFromImage(&image); pMapTile->pTexture->Upload(); } } else { s3eFile* pFile = s3eFileOpen(szPath, "r"); if (pFile) { uint32 gResultLen = s3eFileGetSize(pFile); void* gResult = (void*)s3eMalloc(gResultLen + 1); uint32 test = s3eFileRead(gResult, sizeof(char), gResultLen, pFile); gResultLen = test; s3eFileClose(pFile); JPEGImage(gResult, gResultLen, image); pMapTile->pTexture = new CIwTexture; pMapTile->pTexture->CopyFromImage(&image); pMapTile->pTexture->Upload(); delete gResult; } } }
uint32 ResourceManager::RegisterAudio(std::string audioName) { s3eFile *fileHandle = s3eFileOpen(audioName.c_str(), "rb"); if(fileHandle == null) { std::string errMsg = "Unknown audio resource requested: '"; errMsg += audioName + "'"; s3eDebugAssertShow(S3E_MESSAGE_CONTINUE, errMsg.c_str()); return 0; } int soundSize = s3eFileGetSize(fileHandle); int16 *soundData = (int16*)s3eMallocBase(soundSize); memset(soundData, 0, soundSize); s3eFileRead(soundData, soundSize, 1, fileHandle); s3eFileClose(fileHandle); int handle = audioData->size(); audioData->push_back(soundData); audioSizes->push_back(soundSize); return handle; }
void Map::ReadJsonFile(char * filename) { m_filename=filename; cJSON *root; char * jsonContent; s3eFile* fileHandler; fileHandler=s3eFileOpen(filename, "rb"); if (fileHandler != NULL) { // Allocate buffer to be filled with the files contents int32 fileSize = s3eFileGetSize(fileHandler); jsonContent = (char*)s3eMallocBase(fileSize+1); // Read data from file if (s3eFileRead(&jsonContent[0], fileSize+1, 1, fileHandler) != 1) { // An kError has occurred, retrieve information for display std::cout<<s3eFileGetErrorString()<<std::endl; } else { // Data reading has been successful jsonContent[fileSize] = '\0'; } } else { // Something went wrong during opening of the file retrieve error for display std::cout<<s3eFileGetErrorString()<<std::endl; } if (fileHandler) s3eFileClose(fileHandler); root = cJSON_Parse(jsonContent); s3eFileFlush(fileHandler); _height=cJSON_GetObjectItem(root,"height")->valueint; cJSON *layers = cJSON_GetObjectItem(root,"layers"); _tileHeight=cJSON_GetObjectItem(root,"tileheight")->valueint; _tileWidth=cJSON_GetObjectItem(root,"tilewidth")->valueint; _width=cJSON_GetObjectItem(root,"width")->valueint; _layer_base->Init(cJSON_GetArrayItem(layers,0)); _layer_middle->Init(cJSON_GetArrayItem(layers,1)); _layer_maze->Init(cJSON_GetArrayItem(layers,2)); cJSON *tilesets = cJSON_GetObjectItem(root,"tilesets"); _tileset_map->Init(cJSON_GetArrayItem(tilesets,0)); _tileset_maze->Init(cJSON_GetArrayItem(tilesets,1)); cJSON * properties=cJSON_GetObjectItem(root,"properties"); int propSize=cJSON_GetArraySize(properties); for(int i=propSize-1;i!=-1;i--) { cJSON * prop=cJSON_GetArrayItem(properties,i); char* propString=prop->valuestring; char* name=prop->string; char* chars_array = strtok(propString, ","); if(CharCMP(name,"Block",sizeof("Block"))) { while(chars_array) { _EventBlock.append(atoi(chars_array)); chars_array = strtok(NULL, ","); } } else if(CharCMP(name,"BG",sizeof("BG"))) { _BGImage=Iw2DCreateImageResource(propString); } else if(CharCMP(name,"Door",sizeof("Door"))) { while(chars_array) { m_doors.append(atoi(chars_array)); chars_array = strtok(NULL, ","); } } else if(CharCMP(name,"EndPoint",sizeof("EndPoint"))) { _EndPos[0]=atoi(chars_array); chars_array = strtok(NULL, ","); _EndPos[1]=atoi(chars_array); } else if(CharCMP(name,"StartPoint",sizeof("StartPoint"))) { _StartPos[0]=atoi(chars_array); chars_array = strtok(NULL, ","); _StartPos[1]=atoi(chars_array); } else if(CharCMP(name,"emaze",sizeof("emaze"))) { while(chars_array) { mapEndIndex.append(atoi(chars_array)); chars_array = strtok(NULL, ","); } } else if(CharCMP(name,"etmaze",sizeof("etmaze"))) { while(chars_array) { mazeEndIndex.append(atoi(chars_array)); chars_array = strtok(NULL, ","); } } else if(CharCMP(name,"smaze",sizeof("smaze"))) { while(chars_array) { mapStartIndex.append(atoi(chars_array)); chars_array = strtok(NULL, ","); } } else if(CharCMP(name,"stmaze",sizeof("stmaze"))) { while(chars_array) { mazeStartIndex.append(atoi(chars_array)); chars_array = strtok(NULL, ","); } } } _total=_height*_width; _size=CIwSVec2(_width*_tileWidth,_height*_tileHeight); }
//------------------------------------------------------------------------- CIwSoundData* CIwSoundWAV::Create(const CIwStringL& pathname, void* buffer, u_int file_size) { IW_CALLSTACK("CIwSoundWAV::Create") CIwSoundData* pData = NULL; // Object to return // Open file s3eFile* pFile = NULL; if (buffer != NULL) pFile = s3eFileOpenFromMemory(buffer, file_size); else pFile = IwFileOpenPrefixed(pathname.c_str(), "rb"); IwAssertMsg(SOUND, pFile, ("Could not load file %s", pathname.c_str())); if (!pFile) return NULL; // Read RIFF header - Gives the file size and checks that this is a WAVE // file as expected IwRIFFHeader riffHeader; if ((s3eFileRead(&riffHeader, sizeof(IwRIFFHeader), 1, pFile) != 1) || (strncmp(riffHeader.typeID, "RIFF", 4) != 0) || (strncmp(riffHeader.subTypeID, "WAVE", 4) != 0)) { IwAssertMsg(SOUND, false, ("Invalid header in %s (RIFF Header)", pathname.c_str())); s3eFileClose(pFile); return NULL; } // Read in RIFF chunks until we reach the end of the file // Read the RIFF chunk header. This tells us what type of chunk follows. IwRIFFChunkHeader chunkHeader; bool readData = false; uint32 fileSize = s3eFileGetSize(pFile); while (ReadChunkHeader(chunkHeader, *(s3eFile*)pFile)) { uint32 chunkStartPos = s3eFileTell(pFile); // Next action depends on chunk type. The order of this is important and we may fail // if an unexpected chunk type is found if (!strncmp(chunkHeader.typeID, "fmt ", 4)) { // Read WAVE info chunk if (!ReadChunkFormat(pathname, chunkHeader, pData, *(s3eFile*)pFile)) { s3eFileClose(pFile); return NULL; } } else if (!strncmp(chunkHeader.typeID, "data", 4)) { if (!ReadChunkData(pathname, chunkHeader, pData, *(s3eFile*)pFile)) { s3eFileClose(pFile); return NULL; } readData = true; } else if (!strncmp(chunkHeader.typeID, "fact", 4)) { if (!ReadChunkFact(pathname, chunkHeader, pData, *(s3eFile*)pFile)) { s3eFileClose(pFile); return NULL; } } else { // Unknown chunk type // Make a proper string from the chunk type info char typeID[5]; strncpy(typeID, chunkHeader.typeID, 4); typeID[4] = 0; // Terminate const char* g_IgnoreTypes = "LIST" //LIST is just copyright info etc. "DISP"; //DISP seems to be info about what package exported it IwAssertMsg(SOUND, strstr(g_IgnoreTypes, typeID), ("Unhandled chunk type '%s' in %s. Ignoring this data.", typeID, pathname.c_str())); } // Exit if at end of file if (chunkStartPos + chunkHeader.length >= fileSize) break; // Move to next chunk s3eFileSeek(pFile, chunkStartPos + chunkHeader.length, S3E_FILESEEK_SET); } // Check that we have read the sample data IwAssertMsg(SOUND, readData, ("No data chunk read in %s", pathname.c_str())); s3eFileClose(pFile); return pData; }
int CIwGamePlatformFileMarm::getSize(CxFile file) { return s3eFileGetSize((s3eFile*)file); }
int main() { // Initialise the 2D graphics system Iw2DInit(); // Create an image from a PNG file CIw2DImage* image = Iw2DCreateImage("textures/Tiles.png"); //Avatar bits AnimationData testData; testData.animationName = "Up"; testData.animationPosition = 0; testData.frameHeight = 64; testData.frameWidth = 32; testData.numberOfFrames = 4; AnimationData testData2; testData2.animationName = "Right"; testData2.animationPosition = 64; testData2.frameHeight = 64; testData2.frameWidth = 32; testData2.numberOfFrames = 4; Animation* animation = new Animation("textures/AvatarTest.png",testData); Animation* animation2 = new Animation("textures/AvatarTest.png",testData2); s3eFile* file = s3eFileOpen("tilemaps/tilemapdemo.json", "rb"); int len = s3eFileGetSize(file); char* rawTileJSON = new char[len]; if (file != NULL) { if (s3eFileRead(rawTileJSON, len, 1, file) != 1) { s3eFileGetError(); s3eDebugOutputString(s3eFileGetErrorString()); } s3eFileClose(file); } else { s3eFileGetError(); s3eDebugOutputString(s3eFileGetErrorString()); } cJSON *root = cJSON_Parse(rawTileJSON); int gridHeight = cJSON_GetObjectItem(root,"height")->valueint; int gridWidth = cJSON_GetObjectItem(root,"width")->valueint; int tileWidth = cJSON_GetObjectItem(root,"tileheight")->valueint; int tileHeight = cJSON_GetObjectItem(root,"tilewidth")->valueint; cJSON *layers = cJSON_GetObjectItem(root,"layers"); cJSON *tileData; int i; for (i = 0; i<cJSON_GetArraySize(layers); i++) { cJSON *layer = cJSON_GetArrayItem(layers,i); tileData = cJSON_GetObjectItem(layer,"data"); } // Loop forever, until the user or the OS performs some action to quit the app while (!s3eDeviceCheckQuitRequest()) { // Clear the drawing surface Iw2DSurfaceClear(0xff000000); int x,y,tileIndex,tileType; for( y = 0; y < gridHeight; y++) { for(x = 0; x < gridWidth; x++) { tileIndex = (y * gridWidth) + x; tileType = cJSON_GetArrayItem(tileData,tileIndex)->valueint -1; // Draw an image Iw2DDrawImageRegion(image, CIwFVec2(x*tileWidth,y*tileHeight),CIwFVec2(tileWidth,tileHeight),CIwFVec2(tileType*tileWidth,0),CIwFVec2(tileWidth,tileHeight)); } } animation->render(50,50); animation2->render(150,200); // Show the drawing surface Iw2DSurfaceShow(); // Yield to the OS s3eDeviceYield(0); } cJSON_Delete(root); // Clean-up delete rawTileJSON; delete image; delete animation; delete animation2; Iw2DTerminate(); return 0; }
bool GAFAsset::initWithImageData(const std::string& jsonPath) { if (!s3eFileCheckExists(jsonPath.c_str())) { GAFLOGERROR("CAN NOT create GAFAsset : %s does not exists", jsonPath.c_str()); return false; } GAFData aConfigData; //std::string fp = CCFileUtils::sharedFileUtils()->fullPathForFilename(jsonPath.c_str()); std::string fp = jsonPath; s3eFile * file = s3eFileOpen (fp.c_str(), "rb"); if (!file) { GAFLOGERROR("CAN NOT create GAFAsset : can not open %s.", fp.c_str()); return false; } aConfigData.setSize(s3eFileGetSize(file)); aConfigData.setBytes(new unsigned char[aConfigData.size()]); s3eFileRead(aConfigData.bytes(), aConfigData.size(), 1, file); s3eFileClose(file); aConfigData.setDeleteData(true); if (!aConfigData.bytes()) { GAFLOGERROR("Can not get data from json file : %s", jsonPath.c_str()); return NULL; } if (!aConfigData.bytes()) { GAFLOGWARN("can not init GAFAsset - invalid anImageData"); return false; } CCDictionary* configDictionary = CCJSONConverter::sharedConverter()->dictionaryFrom( (const char *)aConfigData.bytes()); CCString *versionNode = (CCString*)configDictionary->objectForKey(kVersionKey); if (!isAssetVersionPlayable(versionNode->getCString())) { return false; } CCArray *animationConfigFrames = (CCArray *)configDictionary->objectForKey(kAnimationConfigFramesKey); CCArray *interactionObjectNodes = (CCArray *)configDictionary->objectForKey(kInteractionObjectsKey); CCArray *standObjectsNodes = (CCArray *)configDictionary->objectForKey(kStandObjectsKey); CCArray *textureAtlasNode = (CCArray *)configDictionary->objectForKey(kTextureAtlasKey); CCArray *animationSequences = (CCArray *)configDictionary->objectForKey(kAnimationSequencesKey); CCDictionary *objectNodes = (CCDictionary *)configDictionary->objectForKey(kAnimationObjectsKey); CCDictionary *masksNodes = (CCDictionary *)configDictionary->objectForKey(kAnimationMasksKey); CCDictionary *namedPartsNodes = (CCDictionary *)configDictionary->objectForKey(kAnimationNamedPartsKey); if (!animationConfigFrames || !textureAtlasNode|| !objectNodes) { GAFLOGERROR("Error while creating GAFAsset. Required subnodes in dictionary are missing."); return false; } CC_SAFE_RELEASE(_textureAtlas); if (!textureAtlasNode->count()) { return false; } CCDictionary * atlasDictionary = (CCDictionary *)textureAtlasNode->objectAtIndex(0); float atlasScale = atlasScaleFromAtlasConfig(atlasDictionary); for (int i = 1; i < textureAtlasNode->count(); ++i) { CCDictionary * a = (CCDictionary *)textureAtlasNode->objectAtIndex(i); float as = atlasScaleFromAtlasConfig(a); if ( fabs(atlasScale - _currentDeviceScale) > fabs(as - _currentDeviceScale)) { atlasDictionary = a; atlasScale = as; } } _usedAtlasContentScaleFactor = atlasScale; CCArray * atlasesInfo = (CCArray *)atlasDictionary->objectForKey(kAtlasInfoKey); if (!atlasesInfo) { GAFLOGERROR("Error while creating GAFAsset.atlasesInfo subnode is missing in atlasDictionary."); return false; } _textureAtlas = GAFTextureAtlas::create(fp.c_str(), atlasDictionary); if (!_textureAtlas) { GAFLOGERROR("Failed to initialize GAFAsset. GAFTextureAtlas could not be created."); return false; } CC_SAFE_RETAIN(_textureAtlas); if (_objects != objectNodes) { CC_SAFE_RELEASE(_objects); _objects = objectNodes; CC_SAFE_RETAIN(_objects); } if (_masks != masksNodes) { CC_SAFE_RELEASE(_masks); _masks = masksNodes; CC_SAFE_RETAIN(_masks); } if (_namedParts != namedPartsNodes) { CC_SAFE_RELEASE(_namedParts); _namedParts = namedPartsNodes; CC_SAFE_RETAIN(_namedParts); } if (interactionObjectNodes) { CC_SAFE_RELEASE(_interactionObjects); _interactionObjects = CCArray::create(); CC_SAFE_RETAIN(_interactionObjects); for (unsigned int i = 0; i < interactionObjectNodes->count(); ++i) { CCDictionary * dict = (CCDictionary*)interactionObjectNodes->objectAtIndex(i); GAFInteractionObject * interObject = GAFInteractionObject::create(dict); if (interObject) { _interactionObjects->addObject(interObject); } } } if (standObjectsNodes) { CC_SAFE_RELEASE(_standObjects); _standObjects = CCArray::create(); CC_SAFE_RETAIN(_standObjects); for (unsigned int i = 0; i < standObjectsNodes->count(); ++i) { CCDictionary * dict = (CCDictionary*)standObjectsNodes->objectAtIndex(i); GAFActionObject * interObject = GAFActionObject::create(dict); if (interObject) { _standObjects->addObject(interObject); } } } loadFramesFromConfigDictionary(configDictionary); if (animationSequences) { loadAnimationSequences(animationSequences); } configDictionary->removeAllObjects(); return true; }