From 15362a977274a8c2a953eae281d53bca57ff70cd Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Fri, 4 Oct 2024 08:43:51 -0700 Subject: [PATCH] address more review comments --- include/code_8069D4C.h | 12 +++++++++--- src/code_8069D4C.c | 8 ++++---- src/code_806FDF4.c | 30 +++++++++++++++--------------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/include/code_8069D4C.h b/include/code_8069D4C.h index a2872dd70..d42f3c05e 100644 --- a/include/code_8069D4C.h +++ b/include/code_8069D4C.h @@ -1,14 +1,20 @@ #ifndef GUARD_CODE_8069D4C_H #define GUARD_CODE_8069D4C_H +// NOTE: basically Offense struct but packed to match +struct unkStruct_8069D4C_sub +{ + + u8 att[2]; // Atk, SpAtk + u8 def[2]; // Def, SpDef +} __attribute__((packed)); + struct unkStruct_8069D4C { s16 id; Position pos; s16 HP; - // NOTE: cannot re-use offense struct as it pads. - u8 att[2]; // Atk, SpAtk - u8 def[2]; // Def, SpDef + struct unkStruct_8069D4C_sub offense; u16 level; u32 exp; FixedPoint belly; diff --git a/src/code_8069D4C.c b/src/code_8069D4C.c index d72280641..528823965 100644 --- a/src/code_8069D4C.c +++ b/src/code_8069D4C.c @@ -33,10 +33,10 @@ void sub_8069D4C(struct unkStruct_8069D4C *r0, Entity *target) GetPokemonLevelData(&leveldata, info->id, info->level); r0->exp = leveldata.expRequired; - r0->att[0] = info->atk; - r0->att[1] = info->spAtk; - r0->def[0] = info->def; - r0->def[1] = info->spDef; + r0->offense.att[0] = info->atk; + r0->offense.att[1] = info->spAtk; + r0->offense.def[0] = info->def; + r0->offense.def[1] = info->spDef; r0->heldItem = info->heldItem; memcpy(r0->moves.moves, info->moves.moves, sizeof(r0->moves)); r0->belly = info->belly; diff --git a/src/code_806FDF4.c b/src/code_806FDF4.c index 2818e7588..90b948bf8 100644 --- a/src/code_806FDF4.c +++ b/src/code_806FDF4.c @@ -226,17 +226,17 @@ bool8 sub_806F660(Entity *pokemon,Entity *target) { if ((( (2 < (u16)(targetInfo->id - 0x90)) && - (targetInfo->id != 0x10d) && - (targetInfo->id != 0x10c) && - (targetInfo->id != 0x10e) && - (targetInfo->id != 0x198) && - (targetInfo->id != 0x199) && - (targetInfo->id != 0x19d) && - (targetInfo->id != 0x19c) && - (targetInfo->id != 0x19e) && - (targetInfo->id != 0x195) && - (targetInfo->id != 0x196) && - (targetInfo->id != 0x197)) || (HasRecruitedMon(targetInfo->id) == 0)) && + (targetInfo->id != MONSTER_RAIKOU) && + (targetInfo->id != MONSTER_ENTEI) && + (targetInfo->id != MONSTER_SUICUNE) && + (targetInfo->id != MONSTER_LATIAS) && + (targetInfo->id != MONSTER_LATIOS) && + (targetInfo->id != MONSTER_JIRACHI) && + (targetInfo->id != MONSTER_RAYQUAZA) && + (targetInfo->id != MONSTER_DEOXYS_NORMAL) && + (targetInfo->id != 0MONSTER_REGIROCK && + (targetInfo->id != MONSTER_REGICE) && + (targetInfo->id != MONSTER_REGISTEEL)) || (HasRecruitedMon(targetInfo->id) == 0)) && (sub_806F9BC(targetInfo->id) != 0)) { iVar5 = (pokemon->pos).x - (target->pos).x; if (iVar5 < 0) { @@ -792,8 +792,8 @@ bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *pa for(iVar2 = 0; iVar2 < 2; iVar2++) { - pokeStruct2->offense.att[iVar2] = param_3->att[iVar2]; - pokeStruct2->offense.def[iVar2] = param_3->def[iVar2]; + pokeStruct2->offense.att[iVar2] = param_3->offense.att[iVar2]; + pokeStruct2->offense.def[iVar2] = param_3->offense.def[iVar2]; } pokeStruct2->currExp = param_3->exp; @@ -1052,8 +1052,8 @@ bool8 sub_806FDF4(Entity *entity1,Entity *entity2,Entity **entityPtr) for(index2 = 0; index2 < 2; index2++) { - pokeStruct2->offense.att[index2] = local_74.att[index2]; - pokeStruct2->offense.def[index2] = local_74.def[index2]; + pokeStruct2->offense.att[index2] = local_74.offense.att[index2]; + pokeStruct2->offense.def[index2] = local_74.offense.def[index2]; } pokeStruct2->currExp = local_74.exp;