diff --git a/include/code_805D8C8.h b/include/code_805D8C8.h index 5543c1ccb..075b7ea08 100644 --- a/include/code_805D8C8.h +++ b/include/code_805D8C8.h @@ -3,11 +3,11 @@ #include "sprite.h" -extern struct Dungeon_ax *sub_80687D0(s16); -/*struct Dungeon_ax *sub_80687D0(s16 species) +extern struct OpenedFile *sub_80687D0(s16); +/*struct OpenedFile *sub_80687D0(s16 species) { s32 species32 = species; - return gDungeon->sub17B44[species32]; + return gDungeon->sprites[species32]; }*/ #endif // GUARD_CODE_805D8C8_H \ No newline at end of file diff --git a/include/dungeon_entity.h b/include/dungeon_entity.h index 479cba39b..450e53f96 100644 --- a/include/dungeon_entity.h +++ b/include/dungeon_entity.h @@ -272,7 +272,7 @@ struct Entity // gets assigned the current counter value as its spawn index. /* 0x26 */ u16 spawnGenID; /* 0x28*/ struct EntitySpriteInfo spriteInfo; - struct Dungeon_ax *unk64; + struct OpenedFile *unk64; s16 unk68; u8 unk6A; u8 unk6B; diff --git a/include/dungeon_global_data.h b/include/dungeon_global_data.h index b8d3a1a70..b4b3c0161 100644 --- a/include/dungeon_global_data.h +++ b/include/dungeon_global_data.h @@ -1,9 +1,10 @@ #ifndef GUARD_DUNGEON_DATA_H #define GUARD_DUNGEON_DATA_H +#include "global.h" #include "constants/monster.h" #include "dungeon_entity.h" -#include "global.h" +#include "file_system.h" #include "map.h" #include "position.h" #include "sprite.h" @@ -199,8 +200,8 @@ struct Dungeon /* 0x17B38 */ u32 unk17B38; /* 0x17B3C */ u32 unk17B3C; u8 fill17B40[0x17B44 - 0x17B40]; - struct Dungeon_ax *sub17B44[MONSTER_MAX]; // Assuming MONSTER_MAX since the highest value I've seen read is MONSTER_DECOY - u8 fill181E0[0x181E8 - 0x181E0]; + /* 0x17B44 */ struct OpenedFile *sprites[MONSTER_MAX + 1]; + u8 fill181E4[0x181E8 - 0x181E4]; /* 0x181E8 */ struct Position cameraPos; /* 0x181EC */ struct Position cameraPosMirror; /* 0x181F0 */ struct Position cameraPixelPos; diff --git a/include/file_system.h b/include/file_system.h index 83b7c5d61..8ce24a15e 100644 --- a/include/file_system.h +++ b/include/file_system.h @@ -1,35 +1,40 @@ #ifndef GUARD_FILE_SYSTEM_H #define GUARD_FILE_SYSTEM_H +// size: 0x8 struct File { - char *name; - u8 *data; + /* 0x0 */ char *name; + /* 0x4 */ u8 *data; }; +// size: 0x8 struct OpenedFile { - struct File *file; - u8 *data; + /* 0x0 */ struct File *file; + /* 0x4 */ u8 *data; }; +// size: 0x10 struct FileArchive { - char magic[8]; - s32 count; - struct File *entries; + /* 0x0 */ char magic[8]; + /* 0x8 */ s32 count; + /* 0xC */ struct File *entries; }; +// size: 0x8 struct SiroArchive { - u32 magic; - u8 *data; + /* 0x0 */ u32 magic; + /* 0x4 */ u8 *data; }; +// size: 0x8 struct UnkFileStruct1 { - /* 0x0 */ u32 unk0; - /* 0x4 */ u32 unk4; + u32 unk0; + u32 unk4; }; void InitFileSystem(void); diff --git a/include/sprite.h b/include/sprite.h index 349965629..1e217b36e 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -65,7 +65,7 @@ struct EntitySpriteInfo }; // size: ? -struct Dungeon_ax_Sub4 +struct Dungeon_ax { u32 unk0; u32 **unk4; @@ -74,13 +74,6 @@ struct Dungeon_ax_Sub4 u32 unk10; }; -// size: ? -struct Dungeon_ax -{ - u8 fill0[0x4 - 0x0]; - struct Dungeon_ax_Sub4 *unk4; -}; - void AddSprite(struct SpriteOAM *, s32, struct UnkSpriteMem *, struct unkStruct_2039DB0 *); void BlinkSavingIcon(void); void CopySpritesToOam(void); @@ -90,9 +83,9 @@ void SetSavingIconCoords(struct Position *); void sub_8004E8C(struct unkStruct_2039DB0 *); void sub_8005180(void); void sub_8005304(void); -void sub_80053AC(struct EntitySpriteInfo *, struct Dungeon_ax *, u32, u32, u32, u32, bool8); -void sub_80053D0(struct EntitySpriteInfo *, struct Dungeon_ax_Sub4 *, u32, u32, u32, u32, bool8); -void sub_800543C(struct EntitySpriteInfo *, struct Dungeon_ax *, u32, u32, u32, bool8); +void sub_80053AC(struct EntitySpriteInfo *, struct OpenedFile *, u32, u32, u32, u32, bool8); +void sub_80053D0(struct EntitySpriteInfo *, struct Dungeon_ax *, u32, u32, u32, u32, bool8); +void sub_800543C(struct EntitySpriteInfo *, struct OpenedFile *, u32, u32, u32, bool8); void sub_80054BC(struct axPokemon *); #endif // GUARD_SPRITE_H \ No newline at end of file diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index 77bbbffa7..358133b1c 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -244,7 +244,7 @@ void sub_8078E18(struct Entity * pokemon, struct Entity * target) s16 apparentID_s16; s32 index; struct EntityInfo *entityInfo; - struct Dungeon_ax *iVar9; + struct OpenedFile *iVar9; struct PokemonStruct *auStack544[128]; if (!EntityExists(target)) diff --git a/src/sprite.c b/src/sprite.c index 676d7eb1b..e80999b93 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -20,7 +20,7 @@ extern struct unkStruct_20266B0 *gUnknown_203B074; extern void nullsub_3(s32, s32); void RegisterSpriteParts_80052BC(struct UnkSpriteMem *); -void sub_800545C(struct EntitySpriteInfo *, struct Dungeon_ax_Sub4 *, u32, u32, u32, bool8); +void sub_800545C(struct EntitySpriteInfo *, struct Dungeon_ax *, u32, u32, u32, bool8); void InitSprites(void) { @@ -886,12 +886,12 @@ void sub_800533C(struct ax_pose **a0, struct UnkSpriteMem **a1, struct axdata1 * } } -void sub_80053AC(struct EntitySpriteInfo *a0, struct Dungeon_ax *a1, u32 a2, u32 a3, u32 a4, u32 spriteAnimIndex, bool8 a6) +void sub_80053AC(struct EntitySpriteInfo *a0, struct OpenedFile *a1, u32 a2, u32 a3, u32 a4, u32 spriteAnimIndex, bool8 a6) { - sub_80053D0(a0, a1->unk4, a2, a3, a4, spriteAnimIndex, a6); + sub_80053D0(a0, (struct Dungeon_ax *)a1->data, a2, a3, a4, spriteAnimIndex, a6); } -void sub_80053D0(struct EntitySpriteInfo *a0, struct Dungeon_ax_Sub4 *a1, u32 a2, u32 direction, u32 a4, u32 spriteAnimIndex, bool8 a6) +void sub_80053D0(struct EntitySpriteInfo *a0, struct Dungeon_ax *a1, u32 a2, u32 direction, u32 a4, u32 spriteAnimIndex, bool8 a6) { a0->unk0 = 0x8000; if (a6) @@ -914,12 +914,12 @@ void sub_80053D0(struct EntitySpriteInfo *a0, struct Dungeon_ax_Sub4 *a1, u32 a2 a0->unk30 = a1->unk10; } -void sub_800543C(struct EntitySpriteInfo *a0, struct Dungeon_ax *a1, u32 a2, u32 a3, u32 spriteAnimIndex, bool8 a5) +void sub_800543C(struct EntitySpriteInfo *a0, struct OpenedFile *a1, u32 a2, u32 a3, u32 spriteAnimIndex, bool8 a5) { - sub_800545C(a0, a1->unk4, a2, a3, spriteAnimIndex, a5); + sub_800545C(a0, (struct Dungeon_ax *)a1->data, a2, a3, spriteAnimIndex, a5); } -void sub_800545C(struct EntitySpriteInfo *a0, struct Dungeon_ax_Sub4 *a1, u32 a2, u32 a3, u32 spriteAnimIndex, bool8 a5) +void sub_800545C(struct EntitySpriteInfo *a0, struct Dungeon_ax *a1, u32 a2, u32 a3, u32 spriteAnimIndex, bool8 a5) { a0->unk0 = 0x8000; if (a5)