Add some battle frontier constant usage

This commit is contained in:
GriffinR
2022-06-06 15:15:46 -04:00
parent 78b0c20738
commit 7143865f6f
21 changed files with 189 additions and 143 deletions
+12 -12
View File
@@ -684,7 +684,7 @@ static void SetBattlePikeData(void)
static void IsNextRoomFinal(void)
{
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum > 14)
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum > NUM_PIKE_ROOMS)
gSpecialVar_Result = TRUE;
else
gSpecialVar_Result = FALSE;
@@ -1117,20 +1117,20 @@ bool32 TryGenerateBattlePikeWildMon(bool8 checkKeenEyeIntimidate)
if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50)
{
monLevel = GetHighestLevelInPlayerParty();
if (monLevel < 60)
if (monLevel < FRONTIER_MIN_LEVEL_OPEN)
{
monLevel = 60;
monLevel = FRONTIER_MIN_LEVEL_OPEN;
}
else
{
monLevel -= wildMons[headerId][pikeMonId].levelDelta;
if (monLevel < 60)
monLevel = 60;
if (monLevel < FRONTIER_MIN_LEVEL_OPEN)
monLevel = FRONTIER_MIN_LEVEL_OPEN;
}
}
else
{
monLevel = 50 - wildMons[headerId][pikeMonId].levelDelta;
monLevel = FRONTIER_MAX_LEVEL_50 - wildMons[headerId][pikeMonId].levelDelta;
}
if (checkKeenEyeIntimidate == TRUE && !CanEncounterWildMon(monLevel))
@@ -1395,7 +1395,7 @@ static void PrepareOneTrainer(bool8 difficult)
battleNum = 6;
lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / 14;
challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / NUM_PIKE_ROOMS;
do
{
trainerId = GetRandomScaledFrontierTrainerId(challengeNum, battleNum);
@@ -1409,7 +1409,7 @@ static void PrepareOneTrainer(bool8 difficult)
gTrainerBattleOpponent_A = trainerId;
gFacilityTrainers = gBattleFrontierTrainers;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 14)
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < NUM_PIKE_ROOMS)
gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1] = gTrainerBattleOpponent_A;
}
@@ -1418,7 +1418,7 @@ static void PrepareTwoTrainers(void)
int i;
u16 trainerId;
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u16 challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / 14;
u16 challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / NUM_PIKE_ROOMS;
gFacilityTrainers = gBattleFrontierTrainers;
do
@@ -1433,7 +1433,7 @@ static void PrepareTwoTrainers(void)
gTrainerBattleOpponent_A = trainerId;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum <= 14)
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum <= NUM_PIKE_ROOMS)
gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1] = gTrainerBattleOpponent_A;
do
@@ -1448,7 +1448,7 @@ static void PrepareTwoTrainers(void)
gTrainerBattleOpponent_B = trainerId;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_B, 1);
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 14)
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < NUM_PIKE_ROOMS)
gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 2] = gTrainerBattleOpponent_B;
}
@@ -1456,7 +1456,7 @@ static void ClearPikeTrainerIds(void)
{
u8 i;
for (i = 0; i < 14; i++)
for (i = 0; i < NUM_PIKE_ROOMS; i++)
gSaveBlock2Ptr->frontier.trainerIds[i] = 0xFFFF;
}