From fa29ff98a342f4f434b96d4e04f47e25ca865512 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 18 Aug 2020 11:38:50 -0400 Subject: [PATCH] Add condition mod constants --- include/contest.h | 7 +++++++ src/contest.c | 16 ++++++++-------- src/contest_effect.c | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/contest.h b/include/contest.h index 9a4b3425d..d008b8fce 100644 --- a/include/contest.h +++ b/include/contest.h @@ -77,6 +77,13 @@ enum { CONTEST_FILTER_ONLY_POSTGAME }; +// Constants for changing in-contest Condition (the stars that appear during appeals) +enum { + CONDITION_NO_CHANGE, + CONDITION_GAIN, + CONDITION_LOSE, +}; + struct ContestPokemon { u16 species; diff --git a/src/contest.c b/src/contest.c index de0001831..a015c5bab 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1935,7 +1935,7 @@ static void Task_DoAppeals(u8 taskId) gTasks[taskId].tState = APPEALSTATE_TRY_JUDGE_STAR; return; case APPEALSTATE_TRY_JUDGE_STAR: - if (eContestantStatus[contestant].conditionMod == 1) + if (eContestantStatus[contestant].conditionMod == CONDITION_GAIN) DoJudgeSpeechBubble(JUDGE_SYMBOL_STAR); gTasks[taskId].tState = APPEALSTATE_WAIT_JUDGE_STAR; return; @@ -3270,26 +3270,26 @@ static bool8 UpdateConditionStars(u8 contestantIdx, bool8 resetMod) u8 contestantOffset; s32 numStars; - if (eContestantStatus[contestantIdx].conditionMod == 0) + if (eContestantStatus[contestantIdx].conditionMod == CONDITION_NO_CHANGE) return FALSE; contestantOffset = gContestantTurnOrder[contestantIdx] * 5 + 2; numStars = eContestantStatus[contestantIdx].condition / 10; - if (eContestantStatus[contestantIdx].conditionMod == 1) + if (eContestantStatus[contestantIdx].conditionMod == CONDITION_GAIN) { ContestBG_FillBoxWithTile(0, GetStarTileOffset(), 19, contestantOffset, 1, numStars, 17); if (resetMod) { PlaySE(SE_EXPMAX); - eContestantStatus[contestantIdx].conditionMod = 0; + eContestantStatus[contestantIdx].conditionMod = CONDITION_NO_CHANGE; } } - else + else // CONDITION_LOSE { ContestBG_FillBoxWithTile(0, 0, 19, contestantOffset + numStars, 1, 3 - numStars, 17); if (resetMod) { PlaySE(SE_FU_ZAKU2); - eContestantStatus[contestantIdx].conditionMod = 0; + eContestantStatus[contestantIdx].conditionMod = CONDITION_NO_CHANGE; } } return TRUE; @@ -3510,7 +3510,7 @@ static void ResetContestantStatuses(void) eContestantStatus[i].nervous = FALSE; eContestantStatus[i].effectStringId = CONTEST_STRING_NONE; eContestantStatus[i].effectStringId2 = CONTEST_STRING_NONE; - eContestantStatus[i].conditionMod = 0; + eContestantStatus[i].conditionMod = CONDITION_NO_CHANGE; eContestantStatus[i].repeatedPrevMove = eContestantStatus[i].repeatedMove; eContestantStatus[i].repeatedMove = FALSE; eContestantStatus[i].turnOrderModAction = 0; @@ -4464,7 +4464,7 @@ static void CalculateAppealMoveImpact(u8 contestant) gContestEffectFuncs[effect](); - if (eContestantStatus[contestant].conditionMod == 1) + if (eContestantStatus[contestant].conditionMod == CONDITION_GAIN) eContestantStatus[contestant].appeal += eContestantStatus[contestant].condition - 10; else if (eContestantStatus[contestant].appealTripleCondition) eContestantStatus[contestant].appeal += eContestantStatus[contestant].condition * 3; diff --git a/src/contest_effect.c b/src/contest_effect.c index 037da5e11..8d1bbb298 100644 --- a/src/contest_effect.c +++ b/src/contest_effect.c @@ -478,7 +478,7 @@ static void ContestEffect_WorsenConditionOfPrevMons(void) CanUnnerveContestant(i)) { eContestantStatus[i].condition = 0; - eContestantStatus[i].conditionMod = 2; + eContestantStatus[i].conditionMod = CONDITION_LOSE; SetContestantEffectStringID(i, CONTEST_STRING_REGAINED_FORM); numHit++; } @@ -724,7 +724,7 @@ static void ContestEffect_ImproveConditionPreventNervousness(void) if (eContestantStatus[eContestAppealResults.contestant].condition < 30) { eContestantStatus[eContestAppealResults.contestant].condition += 10; - eContestantStatus[eContestAppealResults.contestant].conditionMod = 1; + eContestantStatus[eContestAppealResults.contestant].conditionMod = CONDITION_GAIN; SetContestantEffectStringID(eContestAppealResults.contestant, CONTEST_STRING_CONDITION_ROSE); } else