1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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);
}
|