From 0ceb445c255f18df91dd5e8e1529d0e334f0a121 Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Wed, 18 Sep 2024 19:35:14 -0700 Subject: [PATCH] rebase updates --- include/code_8069D4C.h | 9 +++------ include/moves.h | 6 +++--- include/structs/dungeon_entity.h | 9 +++++++-- include/structs/str_pokemon.h | 6 +++--- src/code_8048480.c | 2 +- src/code_8069D4C.c | 4 ++-- src/code_806FDF4.c | 2 +- src/code_8077274_1.c | 8 ++++---- src/code_807CD9C.c | 4 ++-- src/dungeon_ai_attack.c | 26 +++++++++++++------------- src/dungeon_ai_item_weight.c | 4 ++-- src/dungeon_ai_leader.c | 6 +++--- src/dungeon_pokemon_attributes.c | 2 +- src/friend_rescue.c | 6 +++--- src/move_actions.c | 16 ++++++++-------- src/move_checks.c | 8 ++++---- src/move_util.c | 10 +++++----- src/moves.c | 12 ++++++------ src/pokemon_mid.c | 7 +++---- src/status.c | 6 +++--- src/status_actions.c | 2 +- src/status_checks.c | 6 +++--- src/status_checks_1.c | 2 +- src/trap.c | 6 +++--- src/trap_1.c | 10 +++++----- src/wonder_mail.c | 2 +- src/wonder_mail_5.c | 2 +- 27 files changed, 92 insertions(+), 91 deletions(-) diff --git a/include/code_8069D4C.h b/include/code_8069D4C.h index bb653ea57..9687a386e 100644 --- a/include/code_8069D4C.h +++ b/include/code_8069D4C.h @@ -6,17 +6,14 @@ struct unkStruct_8069D4C s16 id; Position pos; s16 HP; - u8 atk; - u8 spAtk; - u8 def; - u8 spDef; + /* 0x0 */ u8 att[2]; // Atk, SpAtk + /* 0x2 */ u8 def[2]; // Def, SpDef u16 level; u32 exp; FixedPoint belly; FixedPoint maxBelly; Item heldItem; - Move moves[MAX_MON_MOVES]; - u32 unk40; // strugglemoveFlags? + Moves moves; HiddenPower hiddenPower; }; diff --git a/include/moves.h b/include/moves.h index ca21c661a..f8cb09d1c 100644 --- a/include/moves.h +++ b/include/moves.h @@ -86,7 +86,7 @@ bool8 sub_8093318(s32, Move *moves); bool8 sub_809333C(s32, Move *moves); s32 sub_80935B8(Move *moves, s32 index); void sub_8094060(Move *srcMoves, Move *destMoves); -void sub_8094184(struct unkStruct_8094924 *, struct unkStruct_8094184 *); -void sub_80941FC(struct unkStruct_8094924 *, struct unkStruct_8094184 *); +void sub_8094184(struct unkStruct_8094924 *, struct Moves *); +void sub_80941FC(struct unkStruct_8094924 *, struct Moves *); -#endif // GUARD_MOVES_H \ No newline at end of file +#endif // GUARD_MOVES_H diff --git a/include/structs/dungeon_entity.h b/include/structs/dungeon_entity.h index 91da6a214..f7c59105d 100644 --- a/include/structs/dungeon_entity.h +++ b/include/structs/dungeon_entity.h @@ -168,6 +168,12 @@ typedef struct Unk_Entity_x184 /* 0x19e - 0x1a */ u8 unk1A; } Unk_Entity_x184 ; +typedef struct Moves +{ + /* 0x118 */ Move moves[MAX_MON_MOVES]; + /* 0x138 */ u8 struggleMoveFlags; +} Moves; + // size: 0x208 typedef struct EntityInfo { @@ -272,8 +278,7 @@ typedef struct EntityInfo // When non-zero, an AI Pokémon will move in a random direction every turn when it is a room. // There is a chance of this flag being set when a wild Pokémon spawns. The chance depends on the dungeon's randomMovementChance. /* 0x114 */ u32 moveRandomly; - /* 0x118 */ Move moves[MAX_MON_MOVES]; - /* 0x138 */ u8 struggleMoveFlags; + /* 0x118 */ Moves moves; /* 0x13C */ FixedPoint belly; /* 0x140 */ FixedPoint maxBelly; /* 0x144 */ bool8 aiNextToTarget; // True if an AI Pokémon is following another Pokémon and is already adjacent to them. diff --git a/include/structs/str_pokemon.h b/include/structs/str_pokemon.h index 92560d2ed..aa01421aa 100644 --- a/include/structs/str_pokemon.h +++ b/include/structs/str_pokemon.h @@ -69,10 +69,10 @@ typedef struct PokemonStruct2 u16 unk12; // pokeHP /* 0x14 */ Offense offense; // offense (other offset) /* 0x18 */ u32 currExp; - /* 0x1C */ unkStruct_8094184 moves; + /* 0x1C */ Moves moves; /* 0x40 */ Item itemSlot; // heldItem - u32 belly; // some struct - u32 maxBelly; // some struct (same type as 44) + FixedPoint belly; // some struct + FixedPoint maxBelly; // some struct (same type as 44) /* 0x4C */ u32 IQSkills; // unk20 /* 0x50 */ u8 tacticIndex; /* 0x54 */ HiddenPower hiddenPower; diff --git a/src/code_8048480.c b/src/code_8048480.c index 606dea9f1..3045ad7b8 100644 --- a/src/code_8048480.c +++ b/src/code_8048480.c @@ -652,7 +652,7 @@ void GinsengItemAction(Entity *pokemon, Entity * target) if (DungeonRandInt(100) < gUnknown_80F4F46) moveBoost = 3; if (entityInfo->isTeamLeader) { - for(moveIndex = 0, movePtr1 = &entityInfo->moves[0], movePtr2 = movePtr1; moveIndex < MAX_MON_MOVES; movePtr1++, movePtr2++, moveIndex++) + for(moveIndex = 0, movePtr1 = &entityInfo->moves.moves[0], movePtr2 = movePtr1; moveIndex < MAX_MON_MOVES; movePtr1++, movePtr2++, moveIndex++) { if((movePtr1->moveFlags & MOVE_FLAG_EXISTS) && (movePtr1->moveFlags & MOVE_FLAG_SET)) { diff --git a/src/code_8069D4C.c b/src/code_8069D4C.c index f95d71c63..d72280641 100644 --- a/src/code_8069D4C.c +++ b/src/code_8069D4C.c @@ -1,7 +1,7 @@ #include "global.h" #include "pokemon_mid.h" #include "dungeon_util.h" -#include "structs/struct_8069D4C.h" +#include "code_8069D4C.h" u32 sub_8069D18(Position *pos,Entity *entity) { @@ -38,7 +38,7 @@ void sub_8069D4C(struct unkStruct_8069D4C *r0, Entity *target) r0->def[0] = info->def; r0->def[1] = info->spDef; r0->heldItem = info->heldItem; - memcpy(r0->moves.moves, info->moves, sizeof(r0->moves)); + memcpy(r0->moves.moves, info->moves.moves, sizeof(r0->moves)); r0->belly = info->belly; r0->maxBelly = info->maxBelly; r0->hiddenPower = info->hiddenPower; diff --git a/src/code_806FDF4.c b/src/code_806FDF4.c index ff93b117f..22ea36afb 100644 --- a/src/code_806FDF4.c +++ b/src/code_806FDF4.c @@ -1,6 +1,6 @@ #include "global.h" #include "structs/str_pokemon.h" -#include "structs/struct_8069D4C.h" +#include "code_8069D4C.h" #include "code_80118A4.h" #include "code_803E668.h" #include "code_8045A00.h" diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index 90a5b7018..e0bab1df4 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -476,7 +476,7 @@ void RestorePPTarget(Entity * pokemon,Entity * target, s32 param_3) for(index = 0; index < MAX_MON_MOVES; index++) { - movePtr = &entityInfo->moves[index]; + movePtr = &entityInfo->moves.moves[index]; movePtr1 = movePtr; if ((movePtr->moveFlags & MOVE_FLAG_EXISTS)) { PP = movePtr->PP; @@ -689,7 +689,7 @@ void SetChargeStatusTarget(Entity *pokemon, Entity *target, u8 newStatus, Move * for(index = 0; index < MAX_MON_MOVES; index++) { - movePtr = &entityInfo->moves[index]; + movePtr = &entityInfo->moves.moves[index]; if(movePtr == move) { entityInfo->charging.chargingStatusMoveIndex = index; @@ -1118,7 +1118,7 @@ void sub_8079F20(Entity * pokemon, Entity * target, u8 param_3, u8 param_4) for(index = 0; index < MAX_MON_MOVES; index++) { - move = &entityInfo->moves[index]; + move = &entityInfo->moves.moves[index]; if ((move->moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags2 & MOVE_FLAG_EXISTS)) { bVar8 = TRUE; moveUnsealed = TRUE; @@ -1155,7 +1155,7 @@ void sub_807A0CC(Entity * pokemon, Entity * target) for(index = 0; index < MAX_MON_MOVES; index++) { - move = &entityInfo->moves[index]; + move = &entityInfo->moves.moves[index]; if ((move->moveFlags & MOVE_FLAG_EXISTS)) { move->moveFlags2 &= ~(MOVE_FLAG_EXISTS); } diff --git a/src/code_807CD9C.c b/src/code_807CD9C.c index aef238e8a..f9f3c7e60 100644 --- a/src/code_807CD9C.c +++ b/src/code_807CD9C.c @@ -134,7 +134,7 @@ void sub_807CD9C(Entity *pokemon, Entity *target, u32 direction) if (sp_0x28 != NULL) { InitPokemonMove(&move,0x163); if (!sub_80571F0(sp_0x28,&move)) { - sub_807A96C(pokemon,sp_0x28); + TrySendImmobilizeSleepEndMsg(pokemon,sp_0x28); sub_806F370(pokemon,sp_0x28,gUnknown_80F4F90,0,0,0,0x21a,0,0,0); } } @@ -248,7 +248,7 @@ void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, Position *pos) } sub_80522F4(pokemon,target,*gUnknown_80FC584); // $m0 warped! - sub_807A96C(target,target); + TrySendImmobilizeSleepEndMsg(target,target); sub_80421AC(pokemon,target); if (sub_8045888(target)) { direction = (info->action).direction; diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index d7eefec8c..88e260294 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -95,18 +95,18 @@ void DecideAttack(Entity *pokemon) { for (i = 0; i < MAX_MON_MOVES; i++) { - if (pokemonInfo->moves[i].moveFlags & MOVE_FLAG_EXISTS && - MoveMatchesChargingStatus(pokemon, &pokemonInfo->moves[i]) && + if (pokemonInfo->moves.moves[i].moveFlags & MOVE_FLAG_EXISTS && + MoveMatchesChargingStatus(pokemon, &pokemonInfo->moves.moves[i]) && pokemonInfo->charging.chargingStatusMoveIndex == i) { s32 chosenMoveIndex; SetMonsterActionFields(&pokemonInfo->action, ACTION_USE_MOVE_AI); chosenMoveIndex = i; - if (i > 0 && pokemonInfo->moves[i].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN) + if (i > 0 && pokemonInfo->moves.moves[i].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN) { while (--chosenMoveIndex > 0) { - if (!(pokemonInfo->moves[chosenMoveIndex].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) + if (!(pokemonInfo->moves.moves[chosenMoveIndex].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { break; } @@ -122,10 +122,10 @@ void DecideAttack(Entity *pokemon) numUsableMoves = 0; for (i = 0; i < MAX_MON_MOVES; i++) { - Move *move = &pokemonInfo->moves[i]; - if (pokemonInfo->moves[i].moveFlags & MOVE_FLAG_EXISTS) + Move *move = &pokemonInfo->moves.moves[i]; + if (pokemonInfo->moves.moves[i].moveFlags & MOVE_FLAG_EXISTS) { - if (pokemonInfo->moves[i].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) + if (pokemonInfo->moves.moves[i].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) { numUsableMoves++; } @@ -161,7 +161,7 @@ void DecideAttack(Entity *pokemon) // This requires a separate check from the 0-PP check used for unlinked moves. for (i = 0; i < MAX_MON_MOVES; i++) { - Move *move = &pokemonInfo->moves[i]; + Move *move = &pokemonInfo->moves.moves[i]; if (!(move->moveFlags & MOVE_FLAG_EXISTS)) { break; @@ -202,7 +202,7 @@ void DecideAttack(Entity *pokemon) { Move *move; aiPossibleMove[i].canBeUsed = FALSE; - move = &pokemonInfo->moves[i]; + move = &pokemonInfo->moves.moves[i]; if (move->moveFlags & MOVE_FLAG_EXISTS && willNotUnlinkMove[i] && CanAIUseMove(pokemon, i, hasPPChecker) && @@ -319,17 +319,17 @@ void DecideAttack(Entity *pokemon) } else { - AIConsiderMove(&aiPossibleMove[i], pokemon, &pokemonInfo->moves[i]); + AIConsiderMove(&aiPossibleMove[i], pokemon, &pokemonInfo->moves.moves[i]); if (aiPossibleMove[i].canBeUsed) { s32 chosenMoveIndex; SetMonsterActionFields(&pokemonInfo->action, ACTION_USE_MOVE_AI); chosenMoveIndex = i; - if (i > 0 && pokemonInfo->moves[i].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN) + if (i > 0 && pokemonInfo->moves.moves[i].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN) { while (--chosenMoveIndex > 0) { - if (!(pokemonInfo->moves[chosenMoveIndex].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) + if (!(pokemonInfo->moves.moves[chosenMoveIndex].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { break; } @@ -1012,7 +1012,7 @@ void HandleUseOrbAction(Entity *pokemon) if (!entityInfo->isTeamLeader) { sp28.canBeUsed = r8; sp28.weight = 10; - AIConsiderMove(&sp28, pokemon, entityInfo->moves); + AIConsiderMove(&sp28, pokemon, entityInfo->moves.moves); if (sp28.canBeUsed) { entityInfo->action.direction = sp28.direction & 7; diff --git a/src/dungeon_ai_item_weight.c b/src/dungeon_ai_item_weight.c index 8e2c57d05..4a8a0af5e 100644 --- a/src/dungeon_ai_item_weight.c +++ b/src/dungeon_ai_item_weight.c @@ -79,7 +79,7 @@ u32 GetAIUseItemProbability(Entity *targetPokemon, Item *item, u32 itemTargetFla break; case ITEM_MAX_ELIXIR: itemWeight = 0; - move = pokemonInfo->moves; + move = pokemonInfo->moves.moves; move2 = move; for (i = 0; i < MAX_MON_MOVES; move++, move2++, i++) { @@ -427,7 +427,7 @@ u32 GetAIUseItemProbability(Entity *targetPokemon, Item *item, u32 itemTargetFla itemWeight = 30; break; case ITEM_ROLLCALL_ORB: - move = pokemonInfo->moves; // Fixes a regswap. + move = pokemonInfo->moves.moves; // Fixes a regswap. if (targetOther) { itemWeight = 0; diff --git a/src/dungeon_ai_leader.c b/src/dungeon_ai_leader.c index 3d3c33f5e..62c6e3beb 100644 --- a/src/dungeon_ai_leader.c +++ b/src/dungeon_ai_leader.c @@ -139,7 +139,7 @@ bool8 sub_8072CF4(Entity *entity) for(index = 0; index < MAX_MON_MOVES; index++) { - move = &info->moves[index]; + move = &info->moves.moves[index]; if ((move->moveFlags & MOVE_FLAG_EXISTS)) { move->moveFlags2 &= ~(MOVE_FLAG2_UNK4); } @@ -334,8 +334,8 @@ bool8 sub_8072CF4(Entity *entity) for(index = 0; index < MAX_MON_MOVES; index++) { - move = &info->moves[index]; - if ((info->moves[index].moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_LAST_USED)) { + move = &info->moves.moves[index]; + if ((info->moves.moves[index].moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_LAST_USED)) { move->PP = 0; bVar4 = TRUE; } diff --git a/src/dungeon_pokemon_attributes.c b/src/dungeon_pokemon_attributes.c index 62cae8eb9..721506820 100644 --- a/src/dungeon_pokemon_attributes.c +++ b/src/dungeon_pokemon_attributes.c @@ -79,7 +79,7 @@ bool8 sub_80717A4(Entity *pokemon, u16 moveID) Move *pokeMove2; // some reason uses another pointer to same struct - for(index = 0, pokeMove = entityInfo->moves, pokeMove2 = pokeMove; index < MAX_MON_MOVES; pokeMove++, pokeMove2++, index++) + for(index = 0, pokeMove = entityInfo->moves.moves, pokeMove2 = pokeMove; index < MAX_MON_MOVES; pokeMove++, pokeMove2++, index++) { if (((pokeMove->moveFlags & MOVE_FLAG_EXISTS)) && (entityInfo->isTeamLeader || ((pokeMove->moveFlags & MOVE_FLAG_ENABLED_FOR_AI)))) if((sub_805744C(pokemon, pokeMove2, TRUE) != 0) && (pokeMove->PP != 0)) diff --git a/src/friend_rescue.c b/src/friend_rescue.c index 86024ccd2..a6fa8840b 100644 --- a/src/friend_rescue.c +++ b/src/friend_rescue.c @@ -824,7 +824,7 @@ void sub_8032828(void) case 0x32: if (sub_8030894() == 0) { ResetUnusedInputStruct(); - sub_800641C(NULL, TRUE, TRUE); + xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE); sub_80306A8(WONDER_MAIL_TYPE_SOS, 0, NULL, 6); } break; @@ -921,7 +921,7 @@ void sub_8032828(void) case 0x1D: if (sub_8030894() == 0) { ResetUnusedInputStruct(); - sub_800641C(NULL, TRUE, TRUE); + xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE); sub_80306A8(WONDER_MAIL_TYPE_AOK, 0, NULL, 6); } break; @@ -1028,7 +1028,7 @@ void sub_8032828(void) if (sub_8030894() != 0) break; ResetUnusedInputStruct(); - sub_800641C(NULL, TRUE, TRUE); + xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE); sub_80306A8(WONDER_MAIL_TYPE_SOS, 0, NULL, 6); break; case 0x15: diff --git a/src/move_actions.c b/src/move_actions.c index 713ecaa9f..311e039c8 100644 --- a/src/move_actions.c +++ b/src/move_actions.c @@ -308,7 +308,7 @@ void sub_8057588(Entity * pokemon, u8 param_2) entityInfo = pokemon->info; for(index = 0; index < MAX_MON_MOVES; index++) { - move = &entityInfo->moves[index]; + move = &entityInfo->moves.moves[index]; if ((move->moveFlags & MOVE_FLAG_EXISTS)) { PPtoRemove = 1; if ((move->moveFlags2 & MOVE_FLAG_LAST_USED)) { @@ -556,7 +556,7 @@ bool8 TormentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 for(iVar4 = 0; iVar4 < MAX_MON_MOVES; iVar4++) { - movePtr = &entityInfo->moves[iVar4]; + movePtr = &entityInfo->moves.moves[iVar4]; if ((movePtr->moveFlags & MOVE_FLAG_EXISTS) != 0) { if ((movePtr->moveFlags & MOVE_FLAG_DISABLED) == 0) { if ((movePtr->moveFlags & MOVE_FLAG_LAST_USED) != 0) { @@ -573,18 +573,18 @@ bool8 TormentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 } }; - if ((entityInfo->struggleMoveFlags & MOVE_FLAG_DISABLED) == 0) { - if ((entityInfo->struggleMoveFlags & MOVE_FLAG_LAST_USED) != 0) { + if ((entityInfo->moves.struggleMoveFlags & MOVE_FLAG_DISABLED) == 0) { + if ((entityInfo->moves.struggleMoveFlags & MOVE_FLAG_LAST_USED) != 0) { InitPokemonMove(&struggleMove, MOVE_STRUGGLE); - entityInfo->struggleMoveFlags |= MOVE_FLAG_DISABLED; + entityInfo->moves.struggleMoveFlags |= MOVE_FLAG_DISABLED; isTormented = TRUE; sub_80928C0(gFormatItems,&struggleMove,0); // $i0 was tormented sub_80522F4(pokemon,target,*gUnknown_80FCFBC); } } - else if ((entityInfo->struggleMoveFlags & MOVE_FLAG_LAST_USED) == 0) { - entityInfo->struggleMoveFlags &= ~(MOVE_FLAG_DISABLED); + else if ((entityInfo->moves.struggleMoveFlags & MOVE_FLAG_LAST_USED) == 0) { + entityInfo->moves.struggleMoveFlags &= ~(MOVE_FLAG_DISABLED); } if (isTormented) { @@ -2321,7 +2321,7 @@ bool8 ConversionMoveAction(Entity * pokemon,Entity * target,Move * move,u32 para { for(index = 0; index < MAX_MON_MOVES; index++) { - movePtr = &info->moves[index]; + movePtr = &info->moves.moves[index]; if (((movePtr->moveFlags & MOVE_FLAG_EXISTS)) && (GetMoveTypeForMonster(target,movePtr) != TYPE_NONE)) { moveStack[counter] = movePtr; counter++; diff --git a/src/move_checks.c b/src/move_checks.c index 1f857e105..34390b1eb 100644 --- a/src/move_checks.c +++ b/src/move_checks.c @@ -596,7 +596,7 @@ bool8 CanUseOnTargetWithStatusChecker(Entity *user, Entity *target, Move *move) { return FALSE; } - if (!HasLastUsedMove(targetData->moves)) + if (!HasLastUsedMove(targetData->moves.moves)) { return FALSE; } @@ -614,7 +614,7 @@ bool8 CanUseOnTargetWithStatusChecker(Entity *user, Entity *target, Move *move) } break; case MOVE_TORMENT: - if (HasDisabledMove(targetData->moves) || !HasLastUsedMove(targetData->moves)) + if (HasDisabledMove(targetData->moves.moves) || !HasLastUsedMove(targetData->moves.moves)) { return FALSE; } @@ -640,7 +640,7 @@ bool8 CanUseOnTargetWithStatusChecker(Entity *user, Entity *target, Move *move) } break; case MOVE_SPITE: - if (LastUsedMoveOutOfPP(targetData->moves)) + if (LastUsedMoveOutOfPP(targetData->moves.moves)) { return FALSE; } @@ -850,7 +850,7 @@ bool8 CanUseOnTargetWithStatusChecker(Entity *user, Entity *target, Move *move) break; case MOVE_MIMIC: case MOVE_SKETCH: - if (!HasLastUsedMove(targetData->moves)) + if (!HasLastUsedMove(targetData->moves.moves)) { return FALSE; } diff --git a/src/move_util.c b/src/move_util.c index 663bf49d8..a42e27534 100644 --- a/src/move_util.c +++ b/src/move_util.c @@ -35,7 +35,7 @@ u32 sub_8057144(Entity * pokemon) { Entity *dungeonMon = gDungeon->allPokemon[i]; if (EntityExists(dungeonMon)) { - Move *moves = dungeonMon->info->moves; + Move *moves = dungeonMon->info->moves.moves; for (j = 0; j < MAX_MON_MOVES; j++) { if (moves[j].moveFlags & MOVE_FLAG_EXISTS @@ -141,7 +141,7 @@ bool8 sub_8057308(Entity *pokemon, s32 chance) bool8 CanAIUseMove(Entity *pokemon, s32 moveIndex, bool8 hasPPChecker) { EntityInfo *pokemonInfo = pokemon->info; - Move *move = &pokemonInfo->moves[moveIndex]; + Move *move = &pokemonInfo->moves.moves[moveIndex]; s32 i; if (!(move->moveFlags & MOVE_FLAG_EXISTS)) { @@ -174,7 +174,7 @@ bool8 CanAIUseMove(Entity *pokemon, s32 moveIndex, bool8 hasPPChecker) goto returnTrue; } move++; - if ((u32) move >= (u32) &pokemonInfo->struggleMoveFlags || !(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) + if ((u32) move >= (u32) &pokemonInfo->moves.struggleMoveFlags || !(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { return FALSE; } @@ -206,7 +206,7 @@ bool8 CanMonsterUseMove(Entity *pokemon, Move *move, bool8 hasPPChecker) { if (move->id == MOVE_STRUGGLE) { - if (!(pokemonInfo->struggleMoveFlags & MOVE_FLAG_LAST_USED)) + if (!(pokemonInfo->moves.struggleMoveFlags & MOVE_FLAG_LAST_USED)) { return FALSE; } @@ -233,7 +233,7 @@ bool8 sub_805744C(Entity * pokemon, Move *move, bool8 param_3) if ((entityInfo->volatileStatus.volatileStatus == STATUS_TAUNTED) && (!MoveIgnoresTaunted(move))) return FALSE; if (entityInfo->volatileStatus.volatileStatus == STATUS_ENCORE) { if (move->id == MOVE_STRUGGLE) { - if((entityInfo->struggleMoveFlags & MOVE_FLAG_LAST_USED) == 0) return FALSE; + if((entityInfo->moves.struggleMoveFlags & MOVE_FLAG_LAST_USED) == 0) return FALSE; } else { if((move->moveFlags & MOVE_FLAG_LAST_USED) == 0) return FALSE; diff --git a/src/moves.c b/src/moves.c index df83ceafc..9efc729be 100644 --- a/src/moves.c +++ b/src/moves.c @@ -1595,14 +1595,14 @@ static void sub_8094148(struct unkStruct_8094924 *r0, Move *move) SaveIntegerBits(r0, &move->ginseng, 7); } -void sub_8094184(struct unkStruct_8094924 *r0, struct unkStruct_8094184 *r1) +void sub_8094184(struct unkStruct_8094924 *r0, struct Moves *r1) { s32 i; for (i = 0; i < MAX_MON_MOVES; i++) sub_8094148(r0, &r1->moves[i]); - SaveIntegerBits(r0, &r1->unk20, 8); + SaveIntegerBits(r0, &r1->struggleMoveFlags, 8); } static void sub_80941B0(struct unkStruct_8094924 *r0, Move *move) @@ -1615,15 +1615,15 @@ static void sub_80941B0(struct unkStruct_8094924 *r0, Move *move) RestoreIntegerBits(r0, &move->ginseng, 7); } -void sub_80941FC(struct unkStruct_8094924 *r0, struct unkStruct_8094184 *r1) +void sub_80941FC(struct unkStruct_8094924 *r0, struct Moves*r1) { s32 i; for (i = 0; i < MAX_MON_MOVES; i++) sub_80941B0(r0, &r1->moves[i]); - r1->unk20 = 0; - RestoreIntegerBits(r0, &r1->unk20, 8); + r1->struggleMoveFlags= 0; + RestoreIntegerBits(r0, &r1->struggleMoveFlags, 8); } bool8 DoesMoveCharge(u16 move) @@ -1639,4 +1639,4 @@ bool8 DoesMoveCharge(u16 move) if (move == MOVE_DIG) return TRUE; return FALSE; -} \ No newline at end of file +} diff --git a/src/pokemon_mid.c b/src/pokemon_mid.c index b0255d806..9ed0c8b31 100644 --- a/src/pokemon_mid.c +++ b/src/pokemon_mid.c @@ -654,10 +654,9 @@ void xxx_pokemonstruct_to_pokemon2_808DE50(PokemonStruct2 * a1, PokemonStruct1 * slot->quantity = 0; slot->flags = 0; } - sub_80943A0(&somestruct_80943A0, 100); - a1->belly = somestruct_80943A0; - sub_80943A0(&somestruct2_80943A0, 100); - a1->maxBelly = somestruct2_80943A0; + + a1->belly = IntToFixedPoint(100); + a1->maxBelly = IntToFixedPoint(100); } void xxx_pokemon2_to_pokemonstruct_index_808DF2C(s32 a1, PokemonStruct2* a2) diff --git a/src/status.c b/src/status.c index c5dc01239..4be7b775d 100644 --- a/src/status.c +++ b/src/status.c @@ -1211,10 +1211,10 @@ void EncoreStatusTarget(Entity *pokemon,Entity *target) if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon,target,TRUE))) { for(index = 0; index < MAX_MON_MOVES; index++) { - movePtr = &EntityInfo->moves[index]; - if ((EntityInfo->moves[index].moveFlags & MOVE_FLAG_EXISTS) && (movePtr->moveFlags & MOVE_FLAG_LAST_USED)) break; + movePtr = &EntityInfo->moves.moves[index]; + if ((EntityInfo->moves.moves[index].moveFlags & MOVE_FLAG_EXISTS) && (movePtr->moveFlags & MOVE_FLAG_LAST_USED)) break; } - if ((index == MAX_MON_MOVES) && ((EntityInfo->struggleMoveFlags & MOVE_FLAG_LAST_USED) == 0)) { + if ((index == MAX_MON_MOVES) && ((EntityInfo->moves.struggleMoveFlags & MOVE_FLAG_LAST_USED) == 0)) { SetMessageArgument(gAvailablePokemonNames,target,0); sub_80522F4(pokemon,target,*gUnknown_80FBBD4); } diff --git a/src/status_actions.c b/src/status_actions.c index d4c05ec85..6c041b424 100644 --- a/src/status_actions.c +++ b/src/status_actions.c @@ -458,7 +458,7 @@ bool8 MimicMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4 for(moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { - movePtr = &targetEntityInfo->moves[moveIndex]; + movePtr = &targetEntityInfo->moves.moves[moveIndex]; if (((movePtr->moveFlags & MOVE_FLAG_EXISTS)) && !sub_805755C(pokemon,movePtr->id)) { if ((movePtr->id != MOVE_MIMIC) && (movePtr->id != MOVE_ASSIST) && (movePtr->id != MOVE_SKETCH) && (movePtr->id != MOVE_MIRROR_MOVE) && (movePtr->id != MOVE_ENCORE) && ((movePtr->moveFlags & MOVE_FLAG_LAST_USED))) { diff --git a/src/status_checks.c b/src/status_checks.c index 76f7128f8..c97bfc2d4 100644 --- a/src/status_checks.c +++ b/src/status_checks.c @@ -168,7 +168,7 @@ bool8 sub_80701A4(Entity *pokemon) SendMessage(pokemon,*gPtrMoveInterruptedMessage); } else { - for(index = 0, move = pokemonInfo->moves; index < MAX_MON_MOVES; move++, index++) { + for(index = 0, move = pokemonInfo->moves.moves; index < MAX_MON_MOVES; move++, index++) { if ((move->moveFlags & MOVE_FLAG_EXISTS) && (MoveMatchesChargingStatus(pokemon,move)) && (pokemonInfo->charging.chargingStatusMoveIndex == index)) { @@ -178,10 +178,10 @@ bool8 sub_80701A4(Entity *pokemon) if((index > 0) && (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { do { - move2 = &pokemonInfo->moves[index_1 + 1]; + move2 = &pokemonInfo->moves.moves[index_1 + 1]; move2--, index_1--; if(index_1 <= 0) break; - if(!(pokemonInfo->moves[index_1].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) + if(!(pokemonInfo->moves.moves[index_1].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { break; } diff --git a/src/status_checks_1.c b/src/status_checks_1.c index 2d081ab88..ee73ea556 100644 --- a/src/status_checks_1.c +++ b/src/status_checks_1.c @@ -150,7 +150,7 @@ bool8 HasNegativeStatus(Entity *pokemon) } for (i = 0; i < MAX_MON_MOVES; i++) { - Move *moves = pokemonInfo->moves; + Move *moves = pokemonInfo->moves.moves; if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].moveFlags2 & MOVE_FLAG_SEALED) { return TRUE; diff --git a/src/trap.c b/src/trap.c index e05697734..e195af20d 100644 --- a/src/trap.c +++ b/src/trap.c @@ -655,7 +655,7 @@ void HandlePPZeroTrap(Entity *param_1,Entity *param_2) counter = 0; for(i = 0; i < MAX_MON_MOVES; move++, i++) { - move = &info->moves[i]; + move = &info->moves.moves[i]; if (((move->moveFlags & MOVE_FLAG_EXISTS) != 0) && (move->PP != 0)) { moveStack[counter] = move; indexStack[counter] = i; @@ -697,7 +697,7 @@ void HandleSealTrap(Entity *param_1,Entity *param_2) counter = 0; for(i = 0; i < MAX_MON_MOVES;i++) { - move = &info->moves[i]; + move = &info->moves.moves[i]; if ((move->moveFlags & MOVE_FLAG_EXISTS) && !(move->moveFlags2 & MOVE_FLAG_SEALED)) { moveStack[counter] = move; counter++; @@ -706,7 +706,7 @@ void HandleSealTrap(Entity *param_1,Entity *param_2) if (counter != 0) { moveIndex = DungeonRandInt(counter); moveStack[moveIndex]->moveFlags2 |= MOVE_FLAG_SEALED; - sub_80928C0(gUnknown_202DE58,moveStack[moveIndex], NULL); + sub_80928C0(gFormatItems,moveStack[moveIndex], NULL); flag = TRUE; } if(flag) diff --git a/src/trap_1.c b/src/trap_1.c index e930b16fe..fa8f2bd33 100644 --- a/src/trap_1.c +++ b/src/trap_1.c @@ -44,7 +44,7 @@ void sub_8083048(unkStruct_8094924 *param_1, u32); void sub_80818C8(unkStruct_8094924 *param_1, JoinedAt *param_2); void SaveActionContainer(unkStruct_8094924 *param_1, ActionContainer *param_2); void sub_8081B34(unkStruct_8094924 *r0, s16 *r1); -void SaveEntityMoves(unkStruct_8094924 *r0, Move *move); +void SaveEntityMoves(unkStruct_8094924 *r0, Moves *move); void sub_8081824(unkStruct_8094924 *param_1, u32 param_2); void sub_80817B0(unkStruct_8094924 *param_1, u32 param_2); void SavePosition(void*, Position *); @@ -442,7 +442,7 @@ void SaveEntity(unkStruct_8094924 *param_1, Entity *param_2) sub_8083060(param_1,info->stockpileStage); sub_8083060(param_1,info->unk113); sub_8083060(param_1,(u8)info->moveRandomly); - SaveEntityMoves(param_1,info->moves); + SaveEntityMoves(param_1,&info->moves); sub_8081B34(param_1,(s16 *)&info->belly); sub_8081B34(param_1,(s16 *)&info->maxBelly); sub_80830B4(param_1,info->aiNextToTarget); @@ -743,14 +743,14 @@ void SaveEntityMove(unkStruct_8094924 *r0, Move *r1) sub_8083060(r0, r1->ginseng); } -void SaveEntityMoves(unkStruct_8094924 *r0, Move *move) +void SaveEntityMoves(unkStruct_8094924 *r0, Moves *move) { s32 index; for(index = 0; index < MAX_MON_MOVES; index++) { - SaveEntityMove(r0, &move[index]); + SaveEntityMove(r0, &move->moves[index]); } - sub_8083060(r0, *(u8 *)(move + 0x4)); // Struggle Move flags? + sub_8083060(r0, move->struggleMoveFlags); // Struggle Move flags? } void sub_8081B34(unkStruct_8094924 *r0, s16 *r1) diff --git a/src/wonder_mail.c b/src/wonder_mail.c index 5dd4fa0dc..11a76ffdf 100644 --- a/src/wonder_mail.c +++ b/src/wonder_mail.c @@ -1385,7 +1385,7 @@ void sub_80293F4(void) sub_8095274(mail.unk10.unk10); mail.mailType = 2; sub_80951BC(&mail); - sub_80141B4(gWonderMailAOKMailReceivedText, 0, &sUnknown_203B2C0->faceFile, 0x101); + xxx_info_box_80141B4(gWonderMailAOKMailReceivedText, 0, &sUnknown_203B2C0->faceFile, 0x101); SetFriendRescueCounterState(RECEIVED_FRIEND_SOS_MAIL); break; case 23: diff --git a/src/wonder_mail_5.c b/src/wonder_mail_5.c index 2f7133a0e..081ae3a27 100644 --- a/src/wonder_mail_5.c +++ b/src/wonder_mail_5.c @@ -65,7 +65,7 @@ bool8 sub_8030D40(u8 mailIndex, s32 windowID) sub_801317C(&gUnknown_203B324->unk0); gUnknown_203B324->windowID = windowID; gUnknown_203B324->unk14 = &gUnknown_203B324->unk18[windowID]; - sub_8006518(gUnknown_203B324->unk18); + RestoreUnkTextStruct_8006518(gUnknown_203B324->unk18); gUnknown_203B324->unk18[gUnknown_203B324->windowID] = gUnknown_80E091C; sub_8030DD4(); return TRUE;