Misc missing constant use

This commit is contained in:
GriffinR
2023-08-10 01:21:38 -04:00
parent da238562f0
commit 18319e8da3
22 changed files with 254 additions and 218 deletions

View File

@@ -1112,10 +1112,10 @@ static void InitContestResources(void)
for (i = 0; i < CONTESTANT_COUNT; i++)
{
eContestantStatus[i].nextTurnOrder = 0xFF;
eContestantStatus[i].nextTurnOrder = CONTESTANT_NONE;
eContest.prevTurnOrder[i] = gContestantTurnOrder[i];
}
// Calling this here while all the nextTurnOrder values are 0xFF will actually
// Calling this here while all the nextTurnOrder values are CONTESTANT_NONE will actually
// just reverse the turn order.
ApplyNextTurnOrder();
memset(gContestResources->tv, 0, sizeof(*gContestResources->tv) * CONTESTANT_COUNT);
@@ -2891,7 +2891,7 @@ void SetContestants(u8 contestType, u8 rank)
opponents[opponentsCount++] = i;
}
}
opponents[opponentsCount] = 0xFF;
opponents[opponentsCount] = CONTESTANT_NONE;
// Choose three random opponents from the list
for (i = 0; i < CONTESTANT_COUNT - 1; i++)
@@ -2900,7 +2900,7 @@ void SetContestants(u8 contestType, u8 rank)
s32 j;
gContestMons[i] = gContestOpponents[opponents[rnd]];
for (j = rnd; opponents[j] != 0xFF; j++)
for (j = rnd; opponents[j] != CONTESTANT_NONE; j++)
opponents[j] = opponents[j + 1];
opponentsCount--;
}
@@ -2940,7 +2940,7 @@ void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame)
|| (contestType == CONTEST_CATEGORY_TOUGH && gContestOpponents[i].aiPool_Tough))
opponents[opponentsCount++] = i;
}
opponents[opponentsCount] = 0xFF;
opponents[opponentsCount] = CONTESTANT_NONE;
// Fill remaining contestant slots with random AI opponents from the list
for (i = 0; i < CONTESTANT_COUNT - gNumLinkContestPlayers; i++)
@@ -2950,7 +2950,7 @@ void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame)
gContestMons[gNumLinkContestPlayers + i] = gContestOpponents[opponents[rnd]];
StripPlayerNameForLinkContest(gContestMons[gNumLinkContestPlayers + i].trainerName);
StripMonNameForLinkContest(gContestMons[gNumLinkContestPlayers + i].nickname, GAME_LANGUAGE);
for (j = rnd; opponents[j] != 0xFF; j++)
for (j = rnd; opponents[j] != CONTESTANT_NONE; j++)
opponents[j] = opponents[j + 1];
opponentsCount--;
}
@@ -4370,7 +4370,7 @@ void SortContestants(bool8 useRanking)
// Note that ranking is calculated so that shared places still take up a ranking
// space. A ranking like [1, 2, 2, 3] is not possible; it would be [1, 2, 2, 4]
// instead.
memset(scratch, 0xFF, sizeof(scratch));
memset(scratch, CONTESTANT_NONE, sizeof(scratch));
for (i = 0; i < CONTESTANT_COUNT; i++)
{
u8 j = eContestantStatus[i].ranking;
@@ -4378,7 +4378,7 @@ void SortContestants(bool8 useRanking)
while (1)
{
u8 *ptr = &scratch[j];
if (*ptr == 0xFF)
if (*ptr == CONTESTANT_NONE)
{
*ptr = i;
gContestantTurnOrder[i] = j;
@@ -4636,7 +4636,7 @@ static void ApplyNextTurnOrder(void)
// First, look for the first unassigned contestant.
for (j = 0; j < CONTESTANT_COUNT; j++)
{
if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == 0xFF)
if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == CONTESTANT_NONE)
{
nextContestant = j;
j++;
@@ -4647,7 +4647,7 @@ static void ApplyNextTurnOrder(void)
// Then, look for a better candidate, with a higher turn order.
for (; j < CONTESTANT_COUNT; j++)
{
if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == 0xFF
if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == CONTESTANT_NONE
&& gContestantTurnOrder[nextContestant] > gContestantTurnOrder[j])
nextContestant = j;
}
@@ -4661,7 +4661,7 @@ static void ApplyNextTurnOrder(void)
for (i = 0; i < CONTESTANT_COUNT; i++)
{
eContestAppealResults.turnOrder[i] = newTurnOrder[i];
eContestantStatus[i].nextTurnOrder = 0xFF;
eContestantStatus[i].nextTurnOrder = CONTESTANT_NONE;
eContestantStatus[i].turnOrderMod = 0;
gContestantTurnOrder[i] = newTurnOrder[i];
}