summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGriffinR <griffin.richards@comcast.net>2019-09-08 11:53:48 -0400
committerhuderlem <huderlem@gmail.com>2019-09-16 19:21:23 -0500
commit85d97542cdb269278aad3cc3735c29845f9d8738 (patch)
tree73ed7b2dd004aff52c7f6816ac5e7bb2652c9a7f /src
parent258784f263d7834696db552a1b47cf6bd1dfd6b4 (diff)
Use MAX_MON_MOVES constants
Diffstat (limited to 'src')
-rw-r--r--src/apprentice.c8
-rw-r--r--src/battle_ai_script_commands.c18
-rw-r--r--src/battle_controller_player.c2
-rw-r--r--src/battle_pike.c2
-rw-r--r--src/battle_pyramid.c2
-rw-r--r--src/battle_tower.c8
-rw-r--r--src/daycare.c6
-rw-r--r--src/egg_hatch.c6
-rw-r--r--src/move_relearner.c2
-rw-r--r--src/pokemon.c22
-rw-r--r--src/pokemon_summary_screen.c4
-rw-r--r--src/recorded_battle.c14
-rw-r--r--src/secret_base.c6
-rw-r--r--src/trade.c10
-rw-r--r--src/tv.c4
15 files changed, 57 insertions, 57 deletions
diff --git a/src/apprentice.c b/src/apprentice.c
index 4ad295e1a..76962807e 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 3c07cc227..6a8163b96 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 b73bfc36f..1be5def47 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 8846e2d1a..4e2be23e4 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 cc722da8d..4d35f4244 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 8ef848e39..c55180965 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 2d05035d7..dc44b4887 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 5e16f1479..4fba8578c 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 0b0b4a5aa..867c6c995 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 074ee2d19..a393759d3 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 79aac4b5e..932ed5b08 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 9e03d57f6..432c5dbe6 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 12cb8cd61..861a987e2 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 d95e4ebf5..c29fe54c3 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 ef826a4af..1c014d103 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])
{