diff options
Diffstat (limited to 'src/animtiles.cpp')
-rw-r--r-- | src/animtiles.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/animtiles.cpp b/src/animtiles.cpp new file mode 100644 index 0000000..26cdbf8 --- /dev/null +++ b/src/animtiles.cpp @@ -0,0 +1,61 @@ +#include <common.h>
+#include <game.h>
+#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);
+}
|