summaryrefslogtreecommitdiff
path: root/src/animtiles.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-03-12 23:17:12 +0100
committerTreeki <treeki@gmail.com>2011-03-12 23:17:12 +0100
commit7d4e4c0b34a613dd3c0220475ae4e448197522c1 (patch)
tree4f5cee367de3fdef4f9a7c84af59ffe76a2bb1c3 /src/animtiles.cpp
downloadkamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.tar.gz
kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.zip
initial commit. now I can start playing with stuff!
Diffstat (limited to 'src/animtiles.cpp')
-rw-r--r--src/animtiles.cpp61
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);
+}