From 85d97542cdb269278aad3cc3735c29845f9d8738 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 8 Sep 2019 11:53:48 -0400 Subject: [PATCH] Use MAX_MON_MOVES constants --- include/battle.h | 9 ++++----- include/battle_controllers.h | 10 +++++----- include/battle_tower.h | 4 ++-- include/constants/global.h | 1 + include/contest.h | 2 +- include/data.h | 4 ++-- include/global.h | 8 ++++---- include/global.tv.h | 2 +- include/pokemon.h | 8 ++++---- src/apprentice.c | 8 ++++---- src/battle_ai_script_commands.c | 18 +++++++++--------- src/battle_controller_player.c | 2 +- src/battle_pike.c | 2 +- src/battle_pyramid.c | 2 +- src/battle_tower.c | 8 ++++---- src/daycare.c | 6 +++--- src/egg_hatch.c | 6 +++--- src/move_relearner.c | 2 +- src/pokemon.c | 22 +++++++++++----------- src/pokemon_summary_screen.c | 4 ++-- src/recorded_battle.c | 14 +++++++------- src/secret_base.c | 6 +++--- src/trade.c | 10 +++++----- src/tv.c | 4 ++-- 24 files changed, 81 insertions(+), 81 deletions(-) diff --git a/include/battle.h b/include/battle.h index 0f4087c90b..32eabc6de0 100644 --- a/include/battle.h +++ b/include/battle.h @@ -37,7 +37,6 @@ #define B_ACTION_NONE 0xFF #define MAX_TRAINER_ITEMS 4 -#define MAX_MON_MOVES 4 // array entries for battle communication #define MULTIUSE_STATE 0x0 @@ -180,19 +179,19 @@ struct AI_ThinkingStruct u8 aiState; u8 movesetIndex; u16 moveConsidered; - s8 score[4]; + s8 score[MAX_MON_MOVES]; u32 funcResult; u32 aiFlags; u8 aiAction; u8 aiLogicId; u8 filler12[6]; - u8 simulatedRNG[4]; + u8 simulatedRNG[MAX_MON_MOVES]; }; struct UsedMoves { - u16 moves[MAX_BATTLERS_COUNT]; - u16 unknown[MAX_BATTLERS_COUNT]; + u16 moves[MAX_MON_MOVES]; + u16 unknown[MAX_MON_MOVES]; }; struct BattleHistory diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 9449f19865..365229fda8 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -97,16 +97,16 @@ struct HpAndStatus struct MovePpInfo { - u16 moves[4]; - u8 pp[4]; + u16 moves[MAX_MON_MOVES]; + u8 pp[MAX_MON_MOVES]; u8 ppBonuses; }; struct ChooseMoveStruct { - u16 moves[4]; - u8 currentPp[4]; - u8 maxPp[4]; + u16 moves[MAX_MON_MOVES]; + u8 currentPp[MAX_MON_MOVES]; + u8 maxPp[MAX_MON_MOVES]; u16 species; u8 monType1; u8 monType2; diff --git a/include/battle_tower.h b/include/battle_tower.h index 12d6d2e9eb..8bc6e65549 100644 --- a/include/battle_tower.h +++ b/include/battle_tower.h @@ -7,7 +7,7 @@ struct RSBattleTowerRecord /*0x01*/ u8 facilityClass; /*0x02*/ u16 winStreak; /*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1]; - /*0x0C*/ u8 trainerId[4]; + /*0x0C*/ u8 trainerId[TRAINER_ID_LENGTH]; /*0x10*/ u16 greeting[6]; /*0x1C*/ struct BattleTowerPokemon party[3]; /*0xA0*/ u32 checksum; @@ -27,7 +27,7 @@ struct BattleFrontierTrainer struct FacilityMon { u16 species; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; u8 itemTableId; u8 evSpread; u8 nature; diff --git a/include/constants/global.h b/include/constants/global.h index a862ecad21..ba06ff721a 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -51,6 +51,7 @@ #define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode. #define TRAINER_ID_LENGTH 4 +#define MAX_MON_MOVES 4 // string lengths #define ITEM_NAME_LENGTH 14 diff --git a/include/contest.h b/include/contest.h index 8ef208aea3..2b1b95af5f 100644 --- a/include/contest.h +++ b/include/contest.h @@ -227,7 +227,7 @@ struct ContestPokemon u8 aiPool_Cute:1; // 0x10 u8 aiPool_Smart:1; // 0x20 u8 aiPool_Tough:1; // 0x40 - /*0x1E*/ u16 moves[4]; // moves + /*0x1E*/ u16 moves[MAX_MON_MOVES]; // moves /*0x26*/ u8 cool; // cool /*0x27*/ u8 beauty; // beauty /*0x28*/ u8 cute; // cute diff --git a/include/data.h b/include/data.h index f1a4caa6a9..49b98663ac 100644 --- a/include/data.h +++ b/include/data.h @@ -34,7 +34,7 @@ struct TrainerMonNoItemCustomMoves u16 iv; u8 lvl; u16 species; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; }; struct TrainerMonItemCustomMoves @@ -43,7 +43,7 @@ struct TrainerMonItemCustomMoves u8 lvl; u16 species; u16 heldItem; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; }; union TrainerMonPtr diff --git a/include/global.h b/include/global.h index 1fbc70e238..fa8fe8eb3d 100644 --- a/include/global.h +++ b/include/global.h @@ -212,7 +212,7 @@ struct BerryCrush struct ApprenticeMon { u16 species; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; u16 item; }; @@ -234,7 +234,7 @@ struct BattleTowerPokemon { u16 species; u16 heldItem; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; u8 level; u8 ppBonuses; u8 hpEV; @@ -290,7 +290,7 @@ struct BattleTowerEReaderTrainer struct FrontierMonData { - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; u8 evs[6]; u8 nature; }; @@ -946,7 +946,7 @@ struct SaveBlock1 /*0x2B94*/ u8 outbreakPokemonLevel; /*0x2B95*/ u8 outbreakUnk1; /*0x2B96*/ u16 outbreakUnk2; - /*0x2B98*/ u16 outbreakPokemonMoves[4]; + /*0x2B98*/ u16 outbreakPokemonMoves[MAX_MON_MOVES]; /*0x2BA0*/ u8 outbreakUnk4; /*0x2BA1*/ u8 outbreakPokemonProbability; /*0x2BA2*/ u16 outbreakDaysLeft; diff --git a/include/global.tv.h b/include/global.tv.h index aa151a75c8..abb01d4717 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -482,7 +482,7 @@ typedef union // size = 0x24 /*0x01*/ bool8 active; /*0x02*/ u8 var02; /*0x03*/ u8 var03; - /*0x04*/ u16 moves[4]; + /*0x04*/ u16 moves[MAX_MON_MOVES]; /*0x0C*/ u16 species; /*0x0E*/ u16 var0E; /*0x10*/ u8 locationMapNum; diff --git a/include/pokemon.h b/include/pokemon.h index ec125573c1..2931f4428b 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -145,8 +145,8 @@ struct PokemonSubstruct0 struct PokemonSubstruct1 { - u16 moves[4]; - u8 pp[4]; + u16 moves[MAX_MON_MOVES]; + u8 pp[MAX_MON_MOVES]; }; struct PokemonSubstruct2 @@ -273,7 +273,7 @@ struct BattlePokemon /*0x06*/ u16 speed; /*0x08*/ u16 spAttack; /*0x0A*/ u16 spDefense; - /*0x0C*/ u16 moves[4]; + /*0x0C*/ u16 moves[MAX_MON_MOVES]; /*0x14*/ u32 hpIV:5; /*0x14*/ u32 attackIV:5; /*0x15*/ u32 defenseIV:5; @@ -287,7 +287,7 @@ struct BattlePokemon /*0x21*/ u8 type1; /*0x22*/ u8 type2; /*0x23*/ u8 unknown; - /*0x24*/ u8 pp[4]; + /*0x24*/ u8 pp[MAX_MON_MOVES]; /*0x28*/ u16 hp; /*0x2A*/ u8 level; /*0x2B*/ u8 friendship; diff --git a/src/apprentice.c b/src/apprentice.c index 4ad295e1aa..76962807eb 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -1100,7 +1100,7 @@ void ResetAllApprenticeData(void) gSaveBlock2Ptr->apprentices[i].lvlMode = 0; gSaveBlock2Ptr->apprentices[i].number = 0; gSaveBlock2Ptr->apprentices[i].field_1 = 0; - for (j = 0; j < 4; j++) + for (j = 0; j < TRAINER_ID_LENGTH; j++) gSaveBlock2Ptr->apprentices[i].playerId[j] = 0; gSaveBlock2Ptr->apprentices[i].language = gGameLanguage; gSaveBlock2Ptr->apprentices[i].checksum = 0; @@ -1410,7 +1410,7 @@ static void GetLatestLearnedMoves(u16 species, u16 *moves) static u16 sub_81A0284(u8 arg0, u8 speciesTableId, u8 arg2) { - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; u8 i, count; if (PLAYER_APPRENTICE.field_B1_1 < 3) @@ -2063,7 +2063,7 @@ static void sub_81A1370(void) r10 = 0xFFFF; r9 = -1; - for (i = 1; i < 4; i++) + for (i = 1; i < TRAINER_ID_LENGTH; i++) { if (GetTrainerId(gSaveBlock2Ptr->apprentices[i].playerId) == GetTrainerId(gSaveBlock2Ptr->playerTrainerId) && gSaveBlock2Ptr->apprentices[i].number < r10) @@ -2092,7 +2092,7 @@ static void sub_81A1438(void) gSaveBlock2Ptr->apprentices[0].number++; sub_81A0390(gSaveBlock2Ptr->apprentices[0].field_1); - for (i = 0; i < 4; i++) + for (i = 0; i < TRAINER_ID_LENGTH; i++) gSaveBlock2Ptr->apprentices[0].playerId[i] = gSaveBlock2Ptr->playerTrainerId[i]; StringCopy(gSaveBlock2Ptr->apprentices[0].playerName, gSaveBlock2Ptr->playerName); diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 3c07cc2278..6a8163b964 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -397,8 +397,8 @@ u8 BattleAI_ChooseMoveOrAction(void) static u8 ChooseMoveOrAction_Singles(void) { - u8 currentMoveArray[4]; - u8 consideredMoveArray[4]; + u8 currentMoveArray[MAX_MON_MOVES]; + u8 consideredMoveArray[MAX_MON_MOVES]; u8 numOfBestMoves; s32 i; @@ -452,11 +452,11 @@ static u8 ChooseMoveOrAction_Doubles(void) s32 i; s32 j; s32 scriptsToRun; - s16 bestMovePointsForTarget[4]; - s8 mostViableTargetsArray[4]; - u8 actionOrMoveIndex[4]; - u8 mostViableMovesScores[4]; - u8 mostViableMovesIndices[4]; + s16 bestMovePointsForTarget[MAX_BATTLERS_COUNT]; + s8 mostViableTargetsArray[MAX_BATTLERS_COUNT]; + u8 actionOrMoveIndex[MAX_BATTLERS_COUNT]; + u8 mostViableMovesScores[MAX_MON_MOVES]; + u8 mostViableMovesIndices[MAX_MON_MOVES]; s32 mostViableTargetsNo; s32 mostViableMovesNo; s16 mostMovePoints; @@ -543,7 +543,7 @@ static u8 ChooseMoveOrAction_Doubles(void) mostViableTargetsArray[0] = 0; mostViableTargetsNo = 1; - for (i = 1; i < MAX_MON_MOVES; i++) + for (i = 1; i < MAX_BATTLERS_COUNT; i++) { if (mostMovePoints == bestMovePointsForTarget[i]) { @@ -1167,7 +1167,7 @@ static void BattleAICmd_get_considered_move_power(void) static void BattleAICmd_get_how_powerful_move_is(void) { s32 i, checkedMove; - s32 moveDmgs[4]; + s32 moveDmgs[MAX_MON_MOVES]; for (i = 0; sDiscouragedPowerfulMoveEffects[i] != 0xFFFF; i++) { diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index b73bfc36f4..1be5def470 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -664,7 +664,7 @@ u32 sub_8057FBC(void) // unused static void HandleMoveSwitching(void) { - u8 perMovePPBonuses[4]; + u8 perMovePPBonuses[MAX_MON_MOVES]; struct ChooseMoveStruct moveStruct; u8 totalPPBonuses; diff --git a/src/battle_pike.c b/src/battle_pike.c index 8846e2d1a8..4e2be23e41 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -49,7 +49,7 @@ struct PikeWildMon { u16 species; u8 levelDelta; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; }; // IWRAM bss diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index cc722da8d4..4d35f42444 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -77,7 +77,7 @@ struct PyramidWildMon u16 species; u8 lvl; u8 abilityNum; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; }; struct PyramidFloorTemplate diff --git a/src/battle_tower.c b/src/battle_tower.c index 8ef848e39c..c551809659 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -1019,7 +1019,7 @@ struct u8 level; u8 nature; u8 evs[6]; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; } const sStevenMons[3] = { { @@ -1561,7 +1561,7 @@ void PutNewBattleTowerRecord(struct EmeraldBattleTowerRecord *newRecordEm) for (i = 0; i < 5; i++) { k = 0; - for (j = 0; j < 4; j++) + for (j = 0; j < TRAINER_ID_LENGTH; j++) { if (gSaveBlock2Ptr->frontier.towerRecords[i].trainerId[j] != newRecord->trainerId[j]) break; @@ -3308,7 +3308,7 @@ bool32 RubyBattleTowerRecordToEmerald(struct RSBattleTowerRecord *src, struct Em for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) dst->name[i] = src->name[i]; - for (i = 0; i < 4; i++) + for (i = 0; i < TRAINER_ID_LENGTH; i++) dst->trainerId[i] = src->trainerId[i]; for (i = 0; i < 6; i++) dst->greeting[i] = src->greeting[i]; @@ -3357,7 +3357,7 @@ bool32 EmeraldBattleTowerRecordToRuby(struct EmeraldBattleTowerRecord *src, stru for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) dst->name[i] = src->name[i]; - for (i = 0; i < 4; i++) + for (i = 0; i < TRAINER_ID_LENGTH; i++) dst->trainerId[i] = src->trainerId[i]; for (i = 0; i < 6; i++) dst->greeting[i] = src->greeting[i]; diff --git a/src/daycare.c b/src/daycare.c index 2d05035d7a..dc44b48877 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -34,10 +34,10 @@ static void DaycarePrintMonInfo(u8 windowId, s32 daycareSlotId, u8 y); // RAM buffers used to assist with BuildEggMoveset() EWRAM_DATA static u16 sHatchedEggLevelUpMoves[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0}; -EWRAM_DATA static u16 sHatchedEggFatherMoves[4] = {0}; -EWRAM_DATA static u16 sHatchedEggFinalMoves[4] = {0}; +EWRAM_DATA static u16 sHatchedEggFatherMoves[MAX_MON_MOVES] = {0}; +EWRAM_DATA static u16 sHatchedEggFinalMoves[MAX_MON_MOVES] = {0}; EWRAM_DATA static u16 sHatchedEggEggMoves[EGG_MOVES_ARRAY_COUNT] = {0}; -EWRAM_DATA static u16 sHatchedEggMotherMoves[4] = {0}; +EWRAM_DATA static u16 sHatchedEggMotherMoves[MAX_MON_MOVES] = {0}; #include "data/pokemon/egg_moves.h" diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 5e16f1479b..4fba8578ce 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -298,13 +298,13 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp) u16 species; u32 personality, pokerus; u8 i, friendship, language, gameMet, markings, obedience; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; u32 ivs[NUM_STATS]; species = GetMonData(egg, MON_DATA_SPECIES); - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { moves[i] = GetMonData(egg, MON_DATA_MOVE1 + i); } @@ -324,7 +324,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp) CreateMon(temp, species, EGG_HATCH_LEVEL, 32, TRUE, personality, OT_ID_PLAYER_ID, 0); - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { SetMonData(temp, MON_DATA_MOVE1 + i, &moves[i]); } diff --git a/src/move_relearner.c b/src/move_relearner.c index 0b0b4a5aa5..867c6c9958 100644 --- a/src/move_relearner.c +++ b/src/move_relearner.c @@ -154,7 +154,7 @@ static EWRAM_DATA struct { u8 state; u8 heartSpriteIds[16]; /*0x001*/ - u16 movesToLearn[4]; /*0x012*/ + u16 movesToLearn[MAX_MON_MOVES]; /*0x012*/ u8 filler1A[0x44 - 0x1A]; /*0x01A*/ u8 partyMon; /*0x044*/ u8 moveSlot; /*0x045*/ diff --git a/src/pokemon.c b/src/pokemon.c index 074ee2d19a..a393759d39 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2989,11 +2989,11 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove) void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move) { s32 i; - u16 moves[4]; - u8 pp[4]; + u16 moves[MAX_MON_MOVES]; + u8 pp[MAX_MON_MOVES]; u8 ppBonuses; - for (i = 0; i < 3; i++) + for (i = 0; i < MAX_MON_MOVES - 1; i++) { moves[i] = GetMonData(mon, MON_DATA_MOVE2 + i, NULL); pp[i] = GetMonData(mon, MON_DATA_PP2 + i, NULL); @@ -3016,11 +3016,11 @@ void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move) void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move) { s32 i; - u16 moves[4]; - u8 pp[4]; + u16 moves[MAX_MON_MOVES]; + u8 pp[MAX_MON_MOVES]; u8 ppBonuses; - for (i = 0; i < 3; i++) + for (i = 0; i < MAX_MON_MOVES - 1; i++) { moves[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2 + i, NULL); pp[i] = GetBoxMonData(boxMon, MON_DATA_PP2 + i, NULL); @@ -3304,21 +3304,21 @@ u8 CountAliveMonsInBattle(u8 caseId) switch (caseId) { case BATTLE_ALIVE_EXCEPT_ACTIVE: - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_BATTLERS_COUNT; i++) { if (i != gActiveBattler && !(gAbsentBattlerFlags & gBitTable[i])) retVal++; } break; case BATTLE_ALIVE_ATK_SIDE: - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_BATTLERS_COUNT; i++) { if (GetBattlerSide(i) == GetBattlerSide(gBattlerAttacker) && !(gAbsentBattlerFlags & gBitTable[i])) retVal++; } break; case BATTLE_ALIVE_DEF_SIDE: - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_BATTLERS_COUNT; i++) { if (GetBattlerSide(i) == GetBattlerSide(gBattlerTarget) && !(gAbsentBattlerFlags & gBitTable[i])) retVal++; @@ -6096,7 +6096,7 @@ u32 CanSpeciesLearnTMHM(u16 species, u8 tm) u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves) { - u16 learnedMoves[4]; + u16 learnedMoves[MAX_MON_MOVES]; u8 numMoves = 0; u16 species = GetMonData(mon, MON_DATA_SPECIES, 0); u8 level = GetMonData(mon, MON_DATA_LEVEL, 0); @@ -6146,7 +6146,7 @@ u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves) u8 GetNumberOfRelearnableMoves(struct Pokemon *mon) { - u16 learnedMoves[4]; + u16 learnedMoves[MAX_MON_MOVES]; u16 moves[20]; u8 numMoves = 0; u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 79aac4b5e6..932ed5b088 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -121,8 +121,8 @@ static EWRAM_DATA struct PokemonSummaryScreenData u8 metGame; // 0xB u32 pid; // 0xC u32 exp; // 0x10 - u16 moves[4]; // 0x14 - u8 pp[4]; // 0x1C + u16 moves[MAX_MON_MOVES]; // 0x14 + u8 pp[MAX_MON_MOVES]; // 0x1C u16 currentHP; // 0x20 u16 maxHP; // 0x22 u16 atk; // 0x24 diff --git a/src/recorded_battle.c b/src/recorded_battle.c index 9e03d57f67..432c5dbe69 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -37,8 +37,8 @@ struct PlayerInfo struct MovePp { - u16 moves[4]; - u8 pp[4]; + u16 moves[MAX_MON_MOVES]; + u8 pp[MAX_MON_MOVES]; }; struct RecordedBattleSave @@ -91,7 +91,7 @@ EWRAM_DATA static u32 sBattleFlags = 0; EWRAM_DATA static u32 sAI_Scripts = 0; EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0}; EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0}; -EWRAM_DATA static u16 sPlayerMonMoves[2][4] = {0}; +EWRAM_DATA static u16 sPlayerMonMoves[2][MAX_MON_MOVES] = {0}; EWRAM_DATA static struct PlayerInfo sPlayers[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA static u8 sUnknown_0203CCD0 = 0; EWRAM_DATA static u8 sRecordMixFriendName[PLAYER_NAME_LENGTH + 1] = {0}; @@ -766,11 +766,11 @@ void sub_818603C(u8 arg0) { if (sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] == ACTION_MOVE_CHANGE) { - u8 ppBonuses[4]; - u8 array1[4]; - u8 array2[4]; + u8 ppBonuses[MAX_MON_MOVES]; + u8 array1[MAX_MON_MOVES]; + u8 array2[MAX_MON_MOVES]; struct MovePp movePp; - u8 array3[8]; + u8 array3[(MAX_MON_MOVES * 2)]; u8 var; RecordedBattle_GetBattlerAction(battlerId); diff --git a/src/secret_base.c b/src/secret_base.c index 12cb8cd61a..861a987e2f 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -349,7 +349,7 @@ void SetPlayerSecretBase(void) u16 i; gSaveBlock1Ptr->secretBases[0].secretBaseId = sCurSecretBaseId; - for (i = 0; i < 4; i++) + for (i = 0; i < TRAINER_ID_LENGTH; i++) gSaveBlock1Ptr->secretBases[0].trainerId[i] = gSaveBlock2Ptr->playerTrainerId[i]; VarSet(VAR_CURRENT_SECRET_BASE, 0); @@ -1291,7 +1291,7 @@ static void SetSecretBaseDataAndLanguage(u8 secretBaseId, struct SecretBase *sec static bool8 SecretBasesHaveSameTrainerId(struct SecretBase *secretBase1, struct SecretBase *secretBase2) { u8 i; - for (i = 0; i < 4; i++) + for (i = 0; i < TRAINER_ID_LENGTH; i++) { if (secretBase1->trainerId[i] != secretBase2->trainerId[i]) return FALSE; @@ -1445,7 +1445,7 @@ bool8 SecretBaseBelongsToPlayer(struct SecretBase *secretBase) return FALSE; // Check if the player's trainer Id matches the secret base's id. - for (i = 0; i < 4; i++) + for (i = 0; i < TRAINER_ID_LENGTH; i++) { if (secretBase->trainerId[i] != gSaveBlock2Ptr->playerTrainerId[i]) return FALSE; diff --git a/src/trade.c b/src/trade.c index d95e4ebf58..c29fe54c36 100644 --- a/src/trade.c +++ b/src/trade.c @@ -3032,7 +3032,7 @@ static u8 sub_8079A3C(u8 *str, u8 whichParty, u8 monIdx) static void sub_8079AA4(u8 *a0, u8 a1, u8 a2) { - u16 arr[4]; + u16 moves[MAX_MON_MOVES]; u16 i; if (!gUnknown_0203229C->unk_51[a1][a2]) @@ -3041,11 +3041,11 @@ static void sub_8079AA4(u8 *a0, u8 a1, u8 a2) { if (!a1) { - arr[i] = GetMonData(&gPlayerParty[a2], i + MON_DATA_MOVE1, NULL); + moves[i] = GetMonData(&gPlayerParty[a2], i + MON_DATA_MOVE1, NULL); } else { - arr[i] = GetMonData(&gEnemyParty[a2], i + MON_DATA_MOVE1, NULL); + moves[i] = GetMonData(&gEnemyParty[a2], i + MON_DATA_MOVE1, NULL); } } @@ -3053,9 +3053,9 @@ static void sub_8079AA4(u8 *a0, u8 a1, u8 a2) for (i = 0; i < MAX_MON_MOVES; i++) { - if (arr[i] != MOVE_NONE) + if (moves[i] != MOVE_NONE) { - StringAppend(a0, gMoveNames[arr[i]]); + StringAppend(a0, gMoveNames[moves[i]]); } StringAppend(a0, gText_NewLine3); diff --git a/src/tv.c b/src/tv.c index ef826a4afd..1c014d103b 100644 --- a/src/tv.c +++ b/src/tv.c @@ -182,7 +182,7 @@ static void DoTVShowPokemonContestLiveUpdates2(void); static const struct { u16 species; - u16 moves[4]; + u16 moves[MAX_MON_MOVES]; u8 level; u8 location; } sPokeOutbreakSpeciesList[] = { @@ -2329,7 +2329,7 @@ void sub_80EE35C(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u1 show->battleSeminar.foeSpecies = foeSpecies; show->battleSeminar.species = species; show->battleSeminar.move = movePtr[moveIdx]; - for (i = 0, j = 0; i < 4; i ++) + for (i = 0, j = 0; i < MAX_MON_MOVES; i ++) { if (i != moveIdx && movePtr[i]) {