summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/battle_ai_switch_items.c2
-rw-r--r--src/battle_controller_link_opponent.c4
-rw-r--r--src/battle_controller_link_partner.c4
-rw-r--r--src/battle_controller_opponent.c4
-rw-r--r--src/battle_controller_player.c4
-rw-r--r--src/battle_controller_player_partner.c4
-rw-r--r--src/battle_controller_recorded_opponent.c4
-rw-r--r--src/battle_controller_recorded_player.c4
-rw-r--r--src/battle_controller_wally.c4
-rw-r--r--src/battle_dome.c10
-rw-r--r--src/battle_main.c6
-rw-r--r--src/battle_script_commands.c16
-rw-r--r--src/battle_util.c6
-rw-r--r--src/egg_hatch.c6
-rw-r--r--src/field_player_avatar.c2
-rw-r--r--src/field_specials.c22
-rw-r--r--src/hall_of_fame.c20
-rw-r--r--src/lottery_corner.c21
-rw-r--r--src/pokemon_size_record.c8
-rw-r--r--src/post_battle_event_funcs.c2
-rw-r--r--src/scrcmd.c4
21 files changed, 78 insertions, 79 deletions
diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c
index 71d0e8381..ad25b483c 100644
--- a/src/battle_ai_switch_items.c
+++ b/src/battle_ai_switch_items.c
@@ -310,7 +310,7 @@ static bool8 AreStatsRaised(void)
u8 buffedStatsValue = 0;
s32 i;
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
if (gBattleMons[gActiveBattler].statStages[i] > 6)
buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - 6;
diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c
index 2b6a356dd..0bf531c49 100644
--- a/src/battle_controller_link_opponent.c
+++ b/src/battle_controller_link_opponent.c
@@ -558,7 +558,7 @@ static void LinkOpponentHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyLinkOpponentMonData(i, monData + size);
@@ -892,7 +892,7 @@ static void LinkOpponentHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetLinkOpponentMonData(i);
diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c
index 203883c27..d84c1d296 100644
--- a/src/battle_controller_link_partner.c
+++ b/src/battle_controller_link_partner.c
@@ -444,7 +444,7 @@ static void LinkPartnerHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyLinkPartnerMonData(i, monData + size);
@@ -778,7 +778,7 @@ static void LinkPartnerHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetLinkPartnerMonData(i);
diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c
index 54726229d..2daee71db 100644
--- a/src/battle_controller_opponent.c
+++ b/src/battle_controller_opponent.c
@@ -541,7 +541,7 @@ static void OpponentHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += GetOpponentMonData(i, monData + size);
@@ -884,7 +884,7 @@ static void OpponentHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetOpponentMonData(i);
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c
index ad5ae2059..28657901f 100644
--- a/src/battle_controller_player.c
+++ b/src/battle_controller_player.c
@@ -1589,7 +1589,7 @@ static void PlayerHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyPlayerMonData(i, monData + size);
@@ -1932,7 +1932,7 @@ static void PlayerHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetPlayerMonData(i);
diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c
index 3572c1c69..26eb16ed5 100644
--- a/src/battle_controller_player_partner.c
+++ b/src/battle_controller_player_partner.c
@@ -632,7 +632,7 @@ static void PlayerPartnerHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyPlayerPartnerMonData(i, monData + size);
@@ -966,7 +966,7 @@ static void PlayerPartnerHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetPlayerPartnerMonData(i);
diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c
index 72667649f..3de09bb81 100644
--- a/src/battle_controller_recorded_opponent.c
+++ b/src/battle_controller_recorded_opponent.c
@@ -542,7 +542,7 @@ static void RecordedOpponentHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyRecordedOpponentMonData(i, monData + size);
@@ -876,7 +876,7 @@ static void RecordedOpponentHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetRecordedOpponentMonData(i);
diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c
index b74d55cc8..108542269 100644
--- a/src/battle_controller_recorded_player.c
+++ b/src/battle_controller_recorded_player.c
@@ -527,7 +527,7 @@ static void RecordedPlayerHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyRecordedPlayerMonData(i, monData + size);
@@ -861,7 +861,7 @@ static void RecordedPlayerHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetRecordedPlayerMonData(i);
diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c
index f7e9831a7..a82d45fc4 100644
--- a/src/battle_controller_wally.c
+++ b/src/battle_controller_wally.c
@@ -442,7 +442,7 @@ static void WallyHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyWallyMonData(i, monData + size);
@@ -776,7 +776,7 @@ static void WallyHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetWallyMonData(i);
diff --git a/src/battle_dome.c b/src/battle_dome.c
index 2a77da180..f0627e48d 100644
--- a/src/battle_dome.c
+++ b/src/battle_dome.c
@@ -2756,17 +2756,17 @@ static void CalcDomeMonStats(u16 species, s32 level, s32 ivs, u8 evBits, u8 natu
s32 i, count;
u8 bits;
u16 resultingEvs;
- s32 evs[6];
+ s32 evs[NUM_STATS];
count = 0, bits = evBits;
- for (i = 0; i < 6; bits >>= 1, i++)
+ for (i = 0; i < NUM_STATS; bits >>= 1, i++)
{
if (bits & 1)
count++;
}
resultingEvs = MAX_TOTAL_EVS / count;
- for (i = 0; i < 6; bits <<= 1, i++)
+ for (i = 0; i < NUM_STATS; bits <<= 1, i++)
{
evs[i] = 0;
if (evBits & bits)
@@ -4953,7 +4953,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
for (i = 0; i < 3; i++)
{
s32 evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
- for (k = 0, j = 0; j < 6; j++)
+ for (k = 0, j = 0; j < NUM_STATS; j++)
{
allocatedArray[j] = 0;
if (evBits & 1)
@@ -4962,7 +4962,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
}
k = MAX_TOTAL_EVS / k;
evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
- for (j = 0; j < 6; j++)
+ for (j = 0; j < NUM_STATS; j++)
{
if (evBits & 1)
allocatedArray[j] = k;
diff --git a/src/battle_main.c b/src/battle_main.c
index f6c01aee2..4f5540616 100644
--- a/src/battle_main.c
+++ b/src/battle_main.c
@@ -3095,7 +3095,7 @@ void SwitchInClearSetData(void)
if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS)
{
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
gBattleMons[gActiveBattler].statStages[i] = 6;
for (i = 0; i < gBattlersCount; i++)
{
@@ -3204,7 +3204,7 @@ void FaintClearSetData(void)
s32 i;
u8 *ptr;
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
gBattleMons[gActiveBattler].statStages[i] = 6;
gBattleMons[gActiveBattler].status2 = 0;
@@ -3358,7 +3358,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility);
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
*hpOnSwitchout = gBattleMons[gActiveBattler].hp;
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
gBattleMons[gActiveBattler].statStages[i] = 6;
gBattleMons[gActiveBattler].status2 = 0;
}
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 665ee3750..8e084a46c 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -3285,7 +3285,7 @@ static void atk23_getexp(void)
u16 calculatedExp;
s32 viaSentIn;
- for (viaSentIn = 0, i = 0; i < 6; i++)
+ for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
continue;
@@ -3543,7 +3543,7 @@ static void atk24(void)
}
else
{
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostPlayerMons & gBitTable[i])))
@@ -3556,7 +3556,7 @@ static void atk24(void)
if (HP_count == 0)
gBattleOutcome |= B_OUTCOME_LOST;
- for (HP_count = 0, i = 0; i < 6; i++)
+ for (HP_count = 0, i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG)
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i])))
@@ -4952,7 +4952,7 @@ static void atk4D_switchindataupdate(void)
if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS)
{
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
gBattleMons[gActiveBattler].statStages[i] = oldData.statStages[i];
}
@@ -7406,7 +7406,7 @@ static void atk8A_normalisebuffs(void) // haze
for (i = 0; i < gBattlersCount; i++)
{
- for (j = 0; j < BATTLE_STATS_NO; j++)
+ for (j = 0; j < NUM_BATTLE_STATS; j++)
gBattleMons[i].statStages[j] = 6;
}
@@ -9034,7 +9034,7 @@ static void atkBD_copyfoestats(void) // psych up
{
s32 i;
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
gBattleMons[gBattlerAttacker].statStages[i] = gBattleMons[gBattlerTarget].statStages[i];
}
@@ -9868,7 +9868,7 @@ static void atkE5_pickup(void)
if (InBattlePyramid())
{
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
@@ -9891,7 +9891,7 @@ static void atkE5_pickup(void)
}
else
{
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
diff --git a/src/battle_util.c b/src/battle_util.c
index 6fb5f4bdc..251a545c9 100644
--- a/src/battle_util.c
+++ b/src/battle_util.c
@@ -2616,7 +2616,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gBattleStruct->moneyMultiplier = 2;
break;
case HOLD_EFFECT_RESTORE_STATS:
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
if (gBattleMons[battlerId].statStages[i] < 6)
{
@@ -2687,7 +2687,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_RESTORE_STATS:
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
if (gBattleMons[battlerId].statStages[i] < 6)
{
@@ -3163,7 +3163,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_RESTORE_STATS:
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
if (gBattleMons[battlerId].statStages[i] < 6)
{
diff --git a/src/egg_hatch.c b/src/egg_hatch.c
index 43beef442..4b7ee9a61 100644
--- a/src/egg_hatch.c
+++ b/src/egg_hatch.c
@@ -305,7 +305,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
u32 personality, pokerus;
u8 i, friendship, language, gameMet, markings, obedience;
u16 moves[4];
- u32 ivs[6];
+ u32 ivs[NUM_STATS];
species = GetMonData(egg, MON_DATA_SPECIES);
@@ -317,7 +317,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
personality = GetMonData(egg, MON_DATA_PERSONALITY);
- for (i = 0; i < 6; i++)
+ for (i = 0; i < NUM_STATS; i++)
{
ivs[i] = GetMonData(egg, MON_DATA_HP_IV + i);
}
@@ -335,7 +335,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
SetMonData(temp, MON_DATA_MOVE1 + i, &moves[i]);
}
- for (i = 0; i < 6; i++)
+ for (i = 0; i < NUM_STATS; i++)
{
SetMonData(temp, MON_DATA_HP_IV + i, &ivs[i]);
}
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index f0a8da7d7..a5aa23e32 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -1306,7 +1306,7 @@ bool8 PartyHasMonWithSurf(void)
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
{
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
break;
diff --git a/src/field_specials.c b/src/field_specials.c
index 113f46922..562127890 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -2052,26 +2052,26 @@ _08139D7C:\n\
void sub_8139D98(void)
{
u8 i;
- u32 ivStorage[6];
+ u32 ivStorage[NUM_STATS];
- ivStorage[0] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_IV);
- ivStorage[1] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_IV);
- ivStorage[2] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_IV);
- ivStorage[3] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_IV);
- ivStorage[4] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_IV);
- ivStorage[5] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_IV);
+ ivStorage[STAT_HP] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_IV);
+ ivStorage[STAT_ATK] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_IV);
+ ivStorage[STAT_DEF] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_IV);
+ ivStorage[STAT_SPEED] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_IV);
+ ivStorage[STAT_SPATK] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_IV);
+ ivStorage[STAT_SPDEF] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_IV);
gSpecialVar_0x8005 = 0;
- for (i = 0; i < ARRAY_COUNT(ivStorage); i++)
+ for (i = 0; i < NUM_STATS; i++)
{
gSpecialVar_0x8005 += ivStorage[i];
}
gSpecialVar_0x8006 = 0;
- gSpecialVar_0x8007 = ivStorage[0]; // HP IV
+ gSpecialVar_0x8007 = ivStorage[STAT_HP];
- for (i = 1; i < 6; i++)
+ for (i = 1; i < NUM_STATS; i++)
{
if (ivStorage[gSpecialVar_0x8006] < ivStorage[i])
{
@@ -2081,7 +2081,7 @@ void sub_8139D98(void)
else if (ivStorage[gSpecialVar_0x8006] == ivStorage[i])
{
u16 randomNumber = Random();
- if ((randomNumber & 1) != 0)
+ if (randomNumber & 1)
{
gSpecialVar_0x8006 = i;
gSpecialVar_0x8007 = ivStorage[i];
diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c
index 22206405b..12f04092b 100644
--- a/src/hall_of_fame.c
+++ b/src/hall_of_fame.c
@@ -438,7 +438,7 @@ static void Task_Hof_InitMonData(u8 taskId)
gTasks[taskId].tMonNumber = 0; // valid pokes
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
u8 nick[POKEMON_NAME_LENGTH + 2];
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES))
@@ -468,7 +468,7 @@ static void Task_Hof_InitMonData(u8 taskId)
gTasks[taskId].tDisplayedMonId = 0;
gTasks[taskId].tPlayerSpriteID = 0xFF;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
gTasks[taskId].tMonSpriteId(i) = 0xFF;
}
@@ -642,7 +642,7 @@ static void Task_Hof_PaletteFadeAndPrintWelcomeText(u8 taskId)
u16 i;
BeginNormalPaletteFade(0xFFFF0000, 0, 0, 0, 0);
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 0;
@@ -665,7 +665,7 @@ static void sub_8173DC0(u8 taskId)
else
{
u16 i;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1;
@@ -748,7 +748,7 @@ static void Task_Hof_HandleExit(u8 taskId)
{
s32 i;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
u8 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
@@ -844,7 +844,7 @@ void CB2_DoHallOfFamePC(void)
SetGpuReg(REG_OFFSET_BLDY, 0);
taskId = CreateTask(Task_HofPC_CopySaveData, 0);
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
gTasks[taskId].tMonSpriteId(i) = 0xFF;
}
@@ -901,7 +901,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
gTasks[taskId].tCurrMonId = 0;
gTasks[taskId].tMonNo = 0;
- for (i = 0; i < 6; i++, currMon++)
+ for (i = 0; i < PARTY_SIZE; i++, currMon++)
{
if (currMon->species != 0)
gTasks[taskId].tMonNo++;
@@ -909,7 +909,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
currMon = &savedTeams->mon[0];
- for (i = 0; i < 6; i++, currMon++)
+ for (i = 0; i < PARTY_SIZE; i++, currMon++)
{
if (currMon->species != 0)
{
@@ -963,7 +963,7 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
for (i = 0; i < gTasks[taskId].tCurrTeamNo; i++)
savedTeams++;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
@@ -1056,7 +1056,7 @@ static void Task_HofPC_HandleExit(u8 taskId)
{
u8 i;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
diff --git a/src/lottery_corner.c b/src/lottery_corner.c
index 2ded9c943..f04fd0bdd 100644
--- a/src/lottery_corner.c
+++ b/src/lottery_corner.c
@@ -7,6 +7,7 @@
#include "constants/species.h"
#include "string_util.h"
#include "text.h"
+#include "pokemon_storage_system.h"
static EWRAM_DATA u16 sWinNumberDigit = 0;
static EWRAM_DATA u16 sOtIdDigit = 0;
@@ -55,23 +56,23 @@ void PickLotteryCornerTicket(void)
gSpecialVar_0x8004 = 0;
slot = 0;
box = 0;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
- struct Pokemon *pkmn = &gPlayerParty[i];
+ struct Pokemon *mon = &gPlayerParty[i];
// UB: Too few arguments for function GetMonData
- if (GetMonData(pkmn, MON_DATA_SPECIES) != SPECIES_NONE)
+ if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE)
{
// do not calculate ticket values for eggs.
- if (!GetMonData(pkmn, MON_DATA_IS_EGG))
+ if (!GetMonData(mon, MON_DATA_IS_EGG))
{
- u32 otId = GetMonData(pkmn, MON_DATA_OT_ID);
+ u32 otId = GetMonData(mon, MON_DATA_OT_ID);
u8 numMatchingDigits = GetMatchingDigits(gSpecialVar_Result, otId);
if (numMatchingDigits > gSpecialVar_0x8004 && numMatchingDigits > 1)
{
gSpecialVar_0x8004 = numMatchingDigits - 1;
- box = 14;
+ box = TOTAL_BOXES_COUNT;
slot = i;
}
}
@@ -80,11 +81,9 @@ void PickLotteryCornerTicket(void)
break;
}
- // player has 14 boxes.
- for (i = 0; i < 14; i++)
+ for (i = 0; i < TOTAL_BOXES_COUNT; i++)
{
- // player has 30 slots per box.
- for (j = 0; j < 30; j++)
+ for (j = 0; j < IN_BOX_COUNT; j++)
{
if (GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SPECIES) != SPECIES_NONE &&
!GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_IS_EGG))
@@ -106,7 +105,7 @@ void PickLotteryCornerTicket(void)
{
gSpecialVar_0x8005 = sLotteryPrizes[gSpecialVar_0x8004 - 1];
- if (box == 14)
+ if (box == TOTAL_BOXES_COUNT)
{
gSpecialVar_0x8006 = 0;
GetMonData(&gPlayerParty[slot], MON_DATA_NICKNAME, gStringVar1);
diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c
index 473bbee03..2d9a2f08f 100644
--- a/src/pokemon_size_record.c
+++ b/src/pokemon_size_record.c
@@ -206,13 +206,13 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId)
if (index < 11 && ribbonId < 65)
{
gSaveBlock1Ptr->giftRibbons[index] = ribbonId;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
- struct Pokemon *pkmn = &gPlayerParty[i];
+ struct Pokemon *mon = &gPlayerParty[i];
- if (GetMonData(pkmn, MON_DATA_SPECIES) != 0 && GetMonData(pkmn, MON_DATA_SANITY_BIT3) == 0)
+ if (GetMonData(mon, MON_DATA_SPECIES) != 0 && GetMonData(mon, MON_DATA_SANITY_BIT3) == 0)
{
- SetMonData(pkmn, array[index], &data);
+ SetMonData(mon, array[index], &data);
gotRibbon = TRUE;
}
}
diff --git a/src/post_battle_event_funcs.c b/src/post_battle_event_funcs.c
index 9765ef5b6..934972b7c 100644
--- a/src/post_battle_event_funcs.c
+++ b/src/post_battle_event_funcs.c
@@ -43,7 +43,7 @@ int GameClear(void)
ribbonGet = FALSE;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
struct Pokemon *mon = &gPlayerParty[i];
diff --git a/src/scrcmd.c b/src/scrcmd.c
index 127a5ecaa..d2a6c2a17 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -1713,8 +1713,8 @@ bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx)
u8 i;
u16 moveId = ScriptReadHalfword(ctx);
- gSpecialVar_Result = 6;
- for (i = 0; i < 6; i++)
+ gSpecialVar_Result = PARTY_SIZE;
+ for (i = 0; i < PARTY_SIZE; i++)
{
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
if (!species)