Scene* File::getScene(string sceneName) { std::vector<File::Block*> sceneBlocks = getBlocksByType(BL_SCENE); for(File::Block* block:sceneBlocks) { Scene* scn = static_cast<Scene*>(parseFileBlock(block)); if(scn->name == sceneName) return scn; } return NULL; }
int decompressFile( char *source, char **dest ) { file_block fb; parseFileBlock( source, &fb); *dest = (char *) malloc ( fb.size_before + SIZE_OF_FILE_BLOCK ); if ( *dest == NULL) RETURN_ERROR("decompressFile: malloc error", -1); int ret = mydecompress( source + SIZE_OF_FILE_BLOCK, *dest , &fb); if (ret != Z_OK) { free( *dest); RETURN_ERROR("decompressFile: decompress error", -1); } return 0; }
Object* File::getObjectByAddress(unsigned long address) { return static_cast<Object*>(parseFileBlock(getBlockByAddress(address))); }
Object* File::getObject(unsigned int index) { return static_cast<Object*>(parseFileBlock(getBlocksByType(BL_OBJECT, index))); }
Scene* File::getScene(unsigned int index) { return static_cast<Scene*>(parseFileBlock(getBlocksByType(BL_SCENE, index))); }
void* File::parseFileBlock(unsigned long adress) { return parseFileBlock(getBlockByAddress(adress)); }