From ad95f150a92a33100a32d4c367e28df156037f5f Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 16 Jul 2020 01:10:21 -0600 Subject: [PATCH] Expand Pokeball Substructure (#473) * expand ball struct element * remove test case --- include/pokemon.h | 51 +++++++++++++++++++++++++---------------------- src/pokemon.c | 4 ++-- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 69ef7a142..06e286623 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -6,34 +6,37 @@ struct PokemonSubstruct0 { - u16 species; - u16 heldItem; - u32 experience; - u8 ppBonuses; - u8 friendship; -}; + /*0x00*/ u16 species; + /*0x02*/ u16 heldItem; + /*0x04*/ u32 experience; + /*0x08*/ u8 ppBonuses; + /*0x09*/ u8 friendship; + /*0x0A*/ u8 pokeball:5; //31 balls + u8 unused0_A:3; + /*0x0B*/ u8 unused0_B; +}; /* size = 12 */ struct PokemonSubstruct1 { - u16 moves[MAX_MON_MOVES]; - u8 pp[MAX_MON_MOVES]; -}; + /*0x00*/ u16 moves[MAX_MON_MOVES]; + /*0x08*/ u8 pp[MAX_MON_MOVES]; +}; /* size = 12 */ struct PokemonSubstruct2 { - u8 hpEV; - u8 attackEV; - u8 defenseEV; - u8 speedEV; - u8 spAttackEV; - u8 spDefenseEV; - u8 cool; - u8 beauty; - u8 cute; - u8 smart; - u8 tough; - u8 sheen; -}; + /*0x00*/ u8 hpEV; + /*0x01*/ u8 attackEV; + /*0x02*/ u8 defenseEV; + /*0x03*/ u8 speedEV; + /*0x04*/ u8 spAttackEV; + /*0x05*/ u8 spDefenseEV; + /*0x06*/ u8 cool; + /*0x07*/ u8 beauty; + /*0x08*/ u8 cute; + /*0x09*/ u8 smart; + /*0x0A*/ u8 tough; + /*0x0B*/ u8 sheen; +}; /* size = 12 */ struct PokemonSubstruct3 { @@ -42,7 +45,7 @@ struct PokemonSubstruct3 /* 0x02 */ u16 metLevel:7; /* 0x02 */ u16 metGame:4; - /* 0x03 */ u16 pokeball:4; + /* 0x03 */ u16 unused3_3:4; /* 0x03 */ u16 otGender:1; /* 0x04 */ u32 hpIV:5; @@ -73,7 +76,7 @@ struct PokemonSubstruct3 /* 0x0B */ u32 giftRibbon7:1; /* 0x0B */ u32 fatefulEncounter:4; /* 0x0B */ u32 obedient:1; -}; +}; /* size = 12 */ union PokemonSubstruct { diff --git a/src/pokemon.c b/src/pokemon.c index 5d6d00429..af920cbfd 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3853,7 +3853,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) retVal = substruct3->metGame; break; case MON_DATA_POKEBALL: - retVal = substruct3->pokeball; + retVal = substruct0->pokeball; break; case MON_DATA_OT_GENDER: retVal = substruct3->otGender; @@ -4227,7 +4227,7 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) case MON_DATA_POKEBALL: { u8 pokeball = *data; - substruct3->pokeball = pokeball; + substruct0->pokeball = pokeball; break; } case MON_DATA_OT_GENDER: