Esempio n. 1
0
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;
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
Object* File::getObjectByAddress(unsigned long address) {
	return static_cast<Object*>(parseFileBlock(getBlockByAddress(address)));
}
Esempio n. 4
0
Object* File::getObject(unsigned int index) {
	return static_cast<Object*>(parseFileBlock(getBlocksByType(BL_OBJECT, index)));
}
Esempio n. 5
0
Scene* File::getScene(unsigned int index) {
	return static_cast<Scene*>(parseFileBlock(getBlocksByType(BL_SCENE, index)));
}
Esempio n. 6
0
void* File::parseFileBlock(unsigned long adress) {
	return parseFileBlock(getBlockByAddress(adress));
}