diff options
author | Seth Barberee <seth.barberee@gmail.com> | 2020-10-01 13:32:53 -0500 |
---|---|---|
committer | Seth Barberee <seth.barberee@gmail.com> | 2020-10-01 13:32:53 -0500 |
commit | 96fdd3aae0ba1d923b358128012979a9a1a0eb38 (patch) | |
tree | ea50555b95a9848794c7464174a9d3ed53990e45 | |
parent | 70c644dfdd82dd31038faf1e2ca37b833ee8c328 (diff) |
successful decomp of one pokemon data func and struct.. making headway
-rw-r--r-- | asm/pokemon.s | 19 | ||||
-rw-r--r-- | include/pokemon.h | 37 | ||||
-rwxr-xr-x | ld_script.txt | 1 | ||||
-rw-r--r-- | src/event_flag.c | 7 | ||||
-rw-r--r-- | src/pokemon.c | 3 | ||||
-rw-r--r-- | src/pokemon_1.c | 31 |
6 files changed, 75 insertions, 23 deletions
diff --git a/asm/pokemon.s b/asm/pokemon.s index edb5334..bf33395 100644 --- a/asm/pokemon.s +++ b/asm/pokemon.s @@ -2309,23 +2309,4 @@ _0808DE0A: bx r1 thumb_func_end sub_808DDD0 - thumb_func_start sub_808DE10 -sub_808DE10: - lsls r0, 16 - asrs r0, 16 - ldr r2, _0808DE2C - ldr r3, [r2] - lsls r2, r0, 3 - adds r2, r0 - lsls r2, 3 - adds r2, r3 - ldrh r0, [r2, 0x10] - asrs r0, r1 - movs r1, 0x1 - ands r0, r1 - bx lr - .align 2, 0 -_0808DE2C: .4byte gMonsterParameters - thumb_func_end sub_808DE10 - .align 2,0 diff --git a/include/pokemon.h b/include/pokemon.h index fba7199..68164ef 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -3,7 +3,42 @@ struct gPokemon { - /* 0x0 */ u8* unk0; + /* 0x0 */ u8* species; // verified + /* 0x4 */ u8* category; + /* 0x8 */ u8 overworld_sprite; // verified + /* 0x9 */ u8 size; + /* 0x9 */ u8 unkA; + /* 0xB */ u8 unkB; + /* 0xC */ s32 move_speed; + /* 0x10 */ u16 dialogue_sprites; // verified + /* 0x12 */ u8 unk12; //verified + /* 0x13 */ u8 type_1; + /* 0x14 */ u8 type_2; + /* 0x15 */ u8 walkable_tiles; + /* 0x16 */ u8 friend_area; // verified + /* 0x16 */ u8 ability_1; + /* 0x18 */ u8 ability_2; + /* 0x19 */ u8 shadow_size; + /* 0x1A */ u8 unk1A; + /* 0x1B */ u16 unk1B; + /* 0x1D */ u8 unk1D; + /* 0x1E */ u16 base_hp; + /* 0x20 */ u16 base_exp; // verified + /* 0x22 */ u16 unk22; // verified + /* 0x24 */ u16 base_att; + /* 0x26 */ u16 base_spatt; + /* 0x28 */ u16 base_def; + /* 0x2A */ u16 base_spdef; + /* 0x2C */ u16 lowkick_dmg; + /* 0x2E */ u16 sizeorb_dmg; + /* 0x30 */ u16 unk30; + /* 0x32 */ u16 unk32; + /* 0x34 */ u16 unk34; //verified + /* 0x36 */ u16 evolve_type; + /* 0x38 */ u32 evolve_need1; // verified + /* 0x3C */ u16 unk3C; + /* 0x3E */ s16 unk3E; // verified + /* 0x40 */ s16 base_recruit; // verified }; #endif // POKEMON_H diff --git a/ld_script.txt b/ld_script.txt index 34c6db7..9d72159 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -87,6 +87,7 @@ SECTIONS { asm/code_80521D0.o(.text); src/pokemon.o(.text); asm/pokemon.o(.text); + src/pokemon_1.o(.text); src/code_808DAB4.o(.text); asm/code_808DAB4.o(.text); src/dungeon.o(.text); diff --git a/src/event_flag.c b/src/event_flag.c index 1a4afc1..501b1af 100644 --- a/src/event_flag.c +++ b/src/event_flag.c @@ -13,7 +13,9 @@ struct UnkEventStruct struct UnkEventStruct2 { /* 0x0 */ u32 unk0; - /* 0x4 */ u32 unk4; + /* 0x4 */ u32 *unk4; + /* 0x8 */ u16 unk8; + /* 0xA */ s16 unkA; }; extern void sub_800226C(u8 r0, u8 r1, u32* r2, u8 u3); @@ -22,6 +24,7 @@ extern void sub_800160C(struct UnkEventStruct2 *r0, u32 r1, u32 r2); extern u8 gUnknown_2000A88; +// TODO fix stack allocation from 0xC to 0x8 to make this match //u8 sub_8002718(struct UnkEventStruct *r0) //{ // struct UnkEventStruct2 temp; @@ -29,7 +32,7 @@ extern u8 gUnknown_2000A88; // MemoryCopy8(&gUnknown_2000A88, (u8 *)r0, (0x80 << 3)); // // // TODO fix this comparison to make it match -// if(r0->unkA != temp.unk4) +// if(temp.unkA != *(temp.unk4)) // return 0; // return 1; //} diff --git a/src/pokemon.c b/src/pokemon.c index ae2b801..55316d6 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -14,7 +14,8 @@ void LoadMonsterParameters(void) { gUnknown_203B45C = &gUnknown_202F400; gMonsterParametersFile = OpenFileAndGetFileDataPtr(&gUnknown_81075F4, &gUnknown_8300500); - gMonsterParameters.unk0 = gMonsterParametersFile->data; + // TODO verify this... other parts imply this is an array + gMonsterParameters.species = gMonsterParametersFile->data; gUnknown_20384E8 = 0; } diff --git a/src/pokemon_1.c b/src/pokemon_1.c new file mode 100644 index 0000000..6d4cf75 --- /dev/null +++ b/src/pokemon_1.c @@ -0,0 +1,31 @@ +#include "global.h" +#include "pokemon.h" +#include "file_system.h" + +extern int sprintf(char *, const char *, ...); + +extern struct gPokemon *gMonsterParameters; +extern struct FileArchive gUnknown_8510000; +extern const char gUnknown_8107684; + +//u8 sub_808DDD0(s16 r0) +//{ +// // Looks like this loads the dialogue sprite for the pokemon +// +// // TODO stack is being added instead of being substracted +// // Else this matches +// char buffer[0xC]; +// if(gMonsterParameters[r0].dialogue_sprites != 0) +// { +// sprintf(buffer, &gUnknown_8107684); +// OpenFileAndGetFileDataPtr(buffer, &gUnknown_8510000); +// return; +// } +// return 0; +//} + +bool8 sub_808DE10(s16 r0, s32 r1) +{ + // checking to see if dialogue sprite is available?? + return (gMonsterParameters[r0].dialogue_sprites >> r1) & 1; +} |