#include #include #include "fileload.h" struct AnimDef_Header { u32 magic; u32 entryCount; }; struct AnimDef_Entry { u16 texNameOffset; u16 frameDelayOffset; u16 tileNum; u8 tilesetNum; u8 reverse; }; FileHandle fh; void DoTiles(void* self) { //OSReport("fucker\n"); AnimDef_Header *header; header = (AnimDef_Header*)LoadFile(&fh, "/NewerRes/AnimTiles.bin"); if (!header) { OSReport("anim load fail\n"); return; } if (header->magic != 'NWRa') { OSReport("anim info incorrect\n"); FreeFile(&fh); return; } AnimDef_Entry *entries = (AnimDef_Entry*)(header+1); OSReport("Loading animated tiles\n"); for (int i = 0; i < header->entryCount; i++) { AnimDef_Entry *entry = &entries[i]; char *name = (char*)fh.filePtr+entry->texNameOffset; char *frameDelays = (char*)fh.filePtr+entry->frameDelayOffset; char realName[0x40]; snprintf(realName, 0x40, "BG_tex/%s", name); void *blah = BgTexMng__LoadAnimTile(self, entry->tilesetNum, entry->tileNum, realName, frameDelays, entry->reverse); OSReport("[%d] %s %08x\n", i, name, blah); //OSReport("Returned: %08x\n", blah); } OSReport("Animated tiles complete\n"); } void DestroyTiles(void *self) { FreeFile(&fh); }