diff --git a/data/maps/BattleFrontier_BattleTowerBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleTowerBattleRoom/scripts.inc index 029009294..89eaeda50 100644 --- a/data/maps/BattleFrontier_BattleTowerBattleRoom/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerBattleRoom/scripts.inc @@ -45,7 +45,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_OpponentEnter:: @ 8241BC3 BattleFrontier_BattleTower_EventScript_WarpToLobbyLost:: @ 8241C03 frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST tower_set TOWER_DATA_LVL_MODE - setvar VAR_0x8004, 3 + setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER special Script_TryGainNewFanFromCounter goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby @@ -134,7 +134,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_ContinueChallenge:: @ 8241DDC BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobbyWon:: @ 8241DF6 frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_WON tower_set TOWER_DATA_LVL_MODE - setvar VAR_0x8004, 3 + setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER special Script_TryGainNewFanFromCounter goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby diff --git a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc index 3c549a919..754384136 100644 --- a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc @@ -103,7 +103,7 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_DoTowerBattle:: @ 8249069 BattleFrontier_BattleTowerMultiBattleRoom_EventScript_WarpToLobbyLost:: @ 824907E frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST tower_set TOWER_DATA_LVL_MODE - setvar VAR_0x8004, 3 + setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER special Script_TryGainNewFanFromCounter goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby @@ -208,7 +208,7 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_ContinueChallenge:: @ 8249 BattleFrontier_BattleTowerMultiBattleRoom_EventScript_WarpToLobbyWon:: @ 82492AF frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_WON tower_set TOWER_DATA_LVL_MODE - setvar VAR_0x8004, 3 + setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER special Script_TryGainNewFanFromCounter goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby diff --git a/data/maps/EverGrandeCity_DrakesRoom/scripts.inc b/data/maps/EverGrandeCity_DrakesRoom/scripts.inc index 2ae78caad..b9debf676 100644 --- a/data/maps/EverGrandeCity_DrakesRoom/scripts.inc +++ b/data/maps/EverGrandeCity_DrakesRoom/scripts.inc @@ -54,7 +54,7 @@ EverGrandeCity_DrakesRoom_EventScript_PostBattleSpeech:: @ 822871A end EverGrandeCity_DrakesRoom_EventScript_Defeated:: @ 8228724 - setvar VAR_0x8004, 0 + setvar VAR_0x8004, FANCOUNTER_DEFEATED_DRAKE special Script_TryGainNewFanFromCounter setflag FLAG_DEFEATED_ELITE_4_DRAKE call PokemonLeague_EliteFour_SetAdvanceToNextRoomMetatiles diff --git a/data/maps/LilycoveCity_ContestLobby/scripts.inc b/data/maps/LilycoveCity_ContestLobby/scripts.inc index 12b598346..9f63da98c 100644 --- a/data/maps/LilycoveCity_ContestLobby/scripts.inc +++ b/data/maps/LilycoveCity_ContestLobby/scripts.inc @@ -43,7 +43,7 @@ LilycoveCity_ContestLobby_EventScript_ContestArtist:: @ 821A264 msgbox LilycoveCity_ContestLobby_Text_YourPokemonSpurredMeToPaint, MSGBOX_DEFAULT lockall fadescreen FADE_TO_BLACK - showcontestwinner 0 + showcontestwinner CONTEST_WINNER_ARTIST lockall msgbox LilycoveCity_ContestLobby_Text_ShouldITakePaintingToMuseum, MSGBOX_YESNO compare VAR_RESULT, YES @@ -217,7 +217,7 @@ LilycoveCity_ContestLobby_EventScript_LinkContestArtist:: @ 821A436 msgbox LilycoveCity_ContestLobby_Text_YourPokemonSpurredMeToPaint, MSGBOX_DEFAULT lockall fadescreen FADE_TO_BLACK - showcontestwinner 0 + showcontestwinner CONTEST_WINNER_ARTIST msgbox LilycoveCity_ContestLobby_Text_ShouldITakePaintingToMuseum, MSGBOX_YESNO compare VAR_RESULT, YES goto_if_eq LilycoveCity_ContestLobby_EventScript_TakePaintingToMuseumLink @@ -505,42 +505,42 @@ LilycoveCity_ContestLobby_EventScript_NinjaBoy:: @ 821A735 LilycoveCity_ContestLobby_EventScript_ContestWinner1:: @ 821A73E lockall fadescreen FADE_TO_BLACK - showcontestwinner 1 + showcontestwinner CONTEST_WINNER_HALL_1 releaseall end LilycoveCity_ContestLobby_EventScript_ContestWinner2:: @ 821A745 lockall fadescreen FADE_TO_BLACK - showcontestwinner 2 + showcontestwinner CONTEST_WINNER_HALL_2 releaseall end LilycoveCity_ContestLobby_EventScript_ContestWinner3:: @ 821A74C lockall fadescreen FADE_TO_BLACK - showcontestwinner 3 + showcontestwinner CONTEST_WINNER_HALL_3 releaseall end LilycoveCity_ContestLobby_EventScript_ContestWinner4:: @ 821A753 lockall fadescreen FADE_TO_BLACK - showcontestwinner 4 + showcontestwinner CONTEST_WINNER_HALL_4 releaseall end LilycoveCity_ContestLobby_EventScript_ContestWinner5:: @ 821A75A lockall fadescreen FADE_TO_BLACK - showcontestwinner 5 + showcontestwinner CONTEST_WINNER_HALL_5 releaseall end LilycoveCity_ContestLobby_EventScript_ContestWinner6:: @ 821A761 lockall fadescreen FADE_TO_BLACK - showcontestwinner 6 + showcontestwinner CONTEST_WINNER_HALL_6 releaseall end diff --git a/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc b/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc index 5d45ed144..257bdd086 100644 --- a/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc +++ b/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc @@ -183,35 +183,35 @@ LilycoveCity_LilycoveMuseum_2F_EventScript_RichBoy:: @ 821999C LilycoveCity_LilycoveMuseum_2F_EventScript_ShowCoolPainting:: @ 82199A5 msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN fadescreen FADE_TO_BLACK - showcontestwinner 9 + showcontestwinner CONTEST_WINNER_MUSEUM_COOL releaseall end LilycoveCity_LilycoveMuseum_2F_EventScript_ShowBeautyPainting:: @ 82199B3 msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN fadescreen FADE_TO_BLACK - showcontestwinner 10 + showcontestwinner CONTEST_WINNER_MUSEUM_BEAUTY releaseall end LilycoveCity_LilycoveMuseum_2F_EventScript_ShowCutePainting:: @ 82199C1 msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN fadescreen FADE_TO_BLACK - showcontestwinner 11 + showcontestwinner CONTEST_WINNER_MUSEUM_CUTE releaseall end LilycoveCity_LilycoveMuseum_2F_EventScript_ShowSmartPainting:: @ 82199CF msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN fadescreen FADE_TO_BLACK - showcontestwinner 12 + showcontestwinner CONTEST_WINNER_MUSEUM_SMART releaseall end LilycoveCity_LilycoveMuseum_2F_EventScript_ShowToughPainting:: @ 82199DD msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN fadescreen FADE_TO_BLACK - showcontestwinner 13 + showcontestwinner CONTEST_WINNER_MUSEUM_TOUGH releaseall end diff --git a/graphics/contest/clink_tilemap11.bin b/graphics/contest/results_screen.bin similarity index 100% rename from graphics/contest/clink_tilemap11.bin rename to graphics/contest/results_screen.bin diff --git a/graphics/contest/misc_2.pal b/graphics/contest/results_screen.pal similarity index 100% rename from graphics/contest/misc_2.pal rename to graphics/contest/results_screen.pal diff --git a/graphics/contest/misc_2.png b/graphics/contest/results_screen.png similarity index 100% rename from graphics/contest/misc_2.png rename to graphics/contest/results_screen.png diff --git a/graphics/contest/clink_tilemap7.bin b/graphics/contest/results_screen_beauty.bin similarity index 100% rename from graphics/contest/clink_tilemap7.bin rename to graphics/contest/results_screen_beauty.bin diff --git a/graphics/contest/clink_tilemap6.bin b/graphics/contest/results_screen_cool.bin similarity index 100% rename from graphics/contest/clink_tilemap6.bin rename to graphics/contest/results_screen_cool.bin diff --git a/graphics/contest/clink_tilemap8.bin b/graphics/contest/results_screen_cute.bin similarity index 100% rename from graphics/contest/clink_tilemap8.bin rename to graphics/contest/results_screen_cute.bin diff --git a/graphics/contest/clink_tilemap3.bin b/graphics/contest/results_screen_hyper.bin similarity index 100% rename from graphics/contest/clink_tilemap3.bin rename to graphics/contest/results_screen_hyper.bin diff --git a/graphics/contest/clink_tilemap5.bin b/graphics/contest/results_screen_link.bin similarity index 100% rename from graphics/contest/clink_tilemap5.bin rename to graphics/contest/results_screen_link.bin diff --git a/graphics/contest/clink_tilemap4.bin b/graphics/contest/results_screen_master.bin similarity index 100% rename from graphics/contest/clink_tilemap4.bin rename to graphics/contest/results_screen_master.bin diff --git a/graphics/contest/clink_tilemap1.bin b/graphics/contest/results_screen_normal.bin similarity index 100% rename from graphics/contest/clink_tilemap1.bin rename to graphics/contest/results_screen_normal.bin diff --git a/graphics/contest/clink_tilemap9.bin b/graphics/contest/results_screen_smart.bin similarity index 100% rename from graphics/contest/clink_tilemap9.bin rename to graphics/contest/results_screen_smart.bin diff --git a/graphics/contest/clink_tilemap2.bin b/graphics/contest/results_screen_super.bin similarity index 100% rename from graphics/contest/clink_tilemap2.bin rename to graphics/contest/results_screen_super.bin diff --git a/graphics/contest/clink_tilemap10.bin b/graphics/contest/results_screen_tough.bin similarity index 100% rename from graphics/contest/clink_tilemap10.bin rename to graphics/contest/results_screen_tough.bin diff --git a/include/constants/contest.h b/include/constants/contest.h index 186c56e2b..2de2866a3 100644 --- a/include/constants/contest.h +++ b/include/constants/contest.h @@ -29,6 +29,23 @@ #define CONTEST_CATEGORY_TOUGH 4 #define CONTEST_CATEGORIES_COUNT 5 +#define CONTEST_WINNER_ARTIST 0 // Winner shown by the artist, painting not necessarily saved +#define CONTEST_WINNER_HALL_1 1 +#define CONTEST_WINNER_HALL_2 2 +#define CONTEST_WINNER_HALL_3 3 +#define CONTEST_WINNER_HALL_4 4 +#define CONTEST_WINNER_HALL_5 5 +#define CONTEST_WINNER_HALL_6 6 +#define NUM_CONTEST_HALL_WINNERS 6 +#define CONTEST_WINNER_7 7 +#define CONTEST_WINNER_8 8 +#define CONTEST_WINNER_MUSEUM_COOL 9 +#define CONTEST_WINNER_MUSEUM_BEAUTY 10 +#define CONTEST_WINNER_MUSEUM_CUTE 11 +#define CONTEST_WINNER_MUSEUM_SMART 12 +#define CONTEST_WINNER_MUSEUM_TOUGH 13 +// NUM_CONTEST_WINNERS in constants/global.h + #define CANT_ENTER_CONTEST 0 #define CAN_ENTER_CONTEST_EQUAL_RANK 1 #define CAN_ENTER_CONTEST_HIGH_RANK 2 diff --git a/include/constants/field_specials.h b/include/constants/field_specials.h index a2dc117e4..a01151378 100644 --- a/include/constants/field_specials.h +++ b/include/constants/field_specials.h @@ -75,4 +75,9 @@ #define FANCLUB_MEMBER7 14 #define FANCLUB_MEMBER8 15 +#define FANCOUNTER_DEFEATED_DRAKE 0 +#define FANCOUNTER_BATTLED_AT_BASE 1 +#define FANCOUNTER_FINISHED_CONTEST 2 +#define FANCOUNTER_USED_BATTLE_TOWER 3 + #endif // GUARD_CONSTANTS_FIELD_SPECIALS_H diff --git a/include/constants/global.h b/include/constants/global.h index c7063d71c..2f4ede229 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -52,6 +52,7 @@ #define APPRENTICE_COUNT 4 #define APPRENTICE_MAX_QUESTIONS 9 #define MAX_REMATCH_ENTRIES 100 // only REMATCH_TABLE_ENTRIES (78) are used +#define NUM_CONTEST_WINNERS 13 #define PYRAMID_BAG_ITEMS_COUNT 10 #define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode. diff --git a/include/contest.h b/include/contest.h index 00c3191eb..a9b1db9ee 100644 --- a/include/contest.h +++ b/include/contest.h @@ -430,9 +430,9 @@ struct ContestResources extern struct ContestPokemon gContestMons[CONTESTANT_COUNT]; extern s16 gContestMonConditions[CONTESTANT_COUNT]; -extern s16 gUnknown_02039F08[CONTESTANT_COUNT]; +extern s16 gContestMonTotalPoints[CONTESTANT_COUNT]; extern s16 gUnknown_02039F10[CONTESTANT_COUNT]; -extern s16 gUnknown_02039F18[CONTESTANT_COUNT]; +extern s16 gContestMonRound2Points[CONTESTANT_COUNT]; extern u8 gContestFinalStandings[CONTESTANT_COUNT]; extern u8 gContestMonPartyIndex; extern u8 gContestPlayerMonIndex; @@ -448,7 +448,6 @@ extern u8 sContestBgCopyFlags; extern struct ContestWinner gCurContestWinner; extern u8 gUnknown_02039F5C; extern u8 gUnknown_02039F5D; - extern u32 gContestRngValue; // contest.c diff --git a/include/contest_link_80F57C4.h b/include/contest_link_80F57C4.h index add3ae62f..8bbc0f14b 100644 --- a/include/contest_link_80F57C4.h +++ b/include/contest_link_80F57C4.h @@ -5,8 +5,8 @@ void BufferContestantTrainerName(void); void BufferContestantMonNickname(void); void StartContest(void); void BufferContestantMonSpecies(void); -void sub_80F8484(void); -void sub_80F84C4(u8); +void ShowContestResults(void); +void ContestLinkTransfer(u8); void sub_80FC998(u8 taskId); #endif // GUARD_CONTEST_LINK_80F57C4_H diff --git a/include/global.h b/include/global.h index 2b03ebbe1..03b6f47bf 100644 --- a/include/global.h +++ b/include/global.h @@ -960,7 +960,7 @@ struct SaveBlock1 /*0x2E20*/ u8 additionalPhrases[8]; // bitfield for 33 additional phrases in easy chat system /*0x2E28*/ OldMan oldMan; /*0x2e64*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff - /*0x2e90*/ struct ContestWinner contestWinners[13]; // 0 - 5 used in contest hall, 6 - 7 unused?, 8 - 12 museum + /*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_* /*0x3030*/ struct DayCare daycare; /*0x3150*/ struct LinkBattleRecords linkBattleRecords; /*0x31A8*/ u8 giftRibbons[52]; diff --git a/include/graphics.h b/include/graphics.h index 99d396df2..186d381db 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4927,23 +4927,23 @@ extern const u32 gRouletteCreditTiles[]; extern const u32 gRouletteNumbersTiles[]; extern const u32 gRouletteMultiplierTiles[]; -// Contest Link -extern const u32 gUnknown_08C19588[]; +// Contest util +extern const u32 gContestResults_Gfx[]; extern const u32 gUnknown_08C19EEC[]; extern const u32 gUnknown_08C1A000[]; extern const u32 gUnknown_08C1A12C[]; -extern const u32 gUnknown_08C1A2B4[]; -extern const u16 gUnknown_08DC6498[]; -extern const u16 gUnknown_08DC63F8[]; -extern const u16 gUnknown_08DC6420[]; -extern const u16 gUnknown_08DC6448[]; -extern const u16 gUnknown_08DC6470[]; -extern const u16 gUnknown_08DC64AC[]; -extern const u16 gUnknown_08DC64C0[]; -extern const u16 gUnknown_08DC64D4[]; -extern const u16 gUnknown_08DC64E8[]; -extern const u16 gUnknown_08DC64FC[]; -extern const u16 gUnknown_08DC6510[]; +extern const u32 gContestResults_Pal[]; +extern const u16 gLinkContestResults_Tilemap[]; +extern const u16 gNormalContestResults_Tilemap[]; +extern const u16 gSuperContestResults_Tilemap[]; +extern const u16 gHyperContestResults_Tilemap[]; +extern const u16 gMasterContestResults_Tilemap[]; +extern const u16 gCoolContestResults_Tilemap[]; +extern const u16 gBeautyContestResults_Tilemap[]; +extern const u16 gCuteContestResults_Tilemap[]; +extern const u16 gSmartContestResults_Tilemap[]; +extern const u16 gToughContestResults_Tilemap[]; +extern const u16 gContestResults_Tilemap[]; // Trainer Card. extern const u16 gHoennTrainerCard0Star_Pal[]; diff --git a/include/strings.h b/include/strings.h index 5720598ad..408eafbd7 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2494,7 +2494,7 @@ extern const u8 gText_CommunicationStandby[]; extern const u8 gText_AnnouncingResults[]; extern const u8 gText_PreliminaryResults[]; extern const u8 gText_Round2Results[]; -extern const u8 gText_Var1sVar2Won[]; +extern const u8 gText_ContestantsMonWon[]; // Trainer Card extern const u8 gText_LinkCableBattles[]; diff --git a/src/contest.c b/src/contest.c index 58628e35d..a43b87679 100644 --- a/src/contest.c +++ b/src/contest.c @@ -155,7 +155,7 @@ static void Contest_StartTextPrinter(const u8 *, u32); static void ContestBG_FillBoxWithIncrementingTile(u8, u16, u8, u8, u8, u8, u8, s16); static bool32 Contest_RunTextPrinters(void); static void Contest_SetBgCopyFlags(u32 flagIndex); -static void sub_80DBD18(void); +static void CalculateFinalScores(void); static void sub_80DD080(u8); static void sub_80DE9DC(u8); static void sub_80DCBE8(u8, u8); @@ -184,7 +184,7 @@ static void sub_80DC3AC(void); static bool8 sub_80DC3C4(void); static void ContestBG_FillBoxWithTile(u8, u16, u8, u8, u8, u8, u8); static void Contest_PrintTextToBg0WindowStd(u32, const u8 *); -static s16 sub_80DBD34(u8); +static s16 GetContestantRound2Points(u8); static void DetermineFinalStandings(void); static bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *); static void sub_80DC0F4(u8); @@ -221,9 +221,9 @@ static void SwapMoveDescAndContestTilemaps(void); // EWRAM vars. EWRAM_DATA struct ContestPokemon gContestMons[CONTESTANT_COUNT] = {0}; EWRAM_DATA s16 gContestMonConditions[CONTESTANT_COUNT] = {0}; -EWRAM_DATA s16 gUnknown_02039F08[CONTESTANT_COUNT] = {0}; +EWRAM_DATA s16 gContestMonTotalPoints[CONTESTANT_COUNT] = {0}; EWRAM_DATA s16 gUnknown_02039F10[CONTESTANT_COUNT] = {0}; -EWRAM_DATA s16 gUnknown_02039F18[CONTESTANT_COUNT] = {0}; +EWRAM_DATA s16 gContestMonRound2Points[CONTESTANT_COUNT] = {0}; EWRAM_DATA u8 gContestFinalStandings[CONTESTANT_COUNT] = {0}; EWRAM_DATA u8 gContestMonPartyIndex = 0; EWRAM_DATA u8 gContestPlayerMonIndex = 0; @@ -239,7 +239,7 @@ EWRAM_DATA u8 gHighestRibbonRank = 0; EWRAM_DATA struct ContestResources *gContestResources = NULL; EWRAM_DATA u8 sContestBgCopyFlags = 0; EWRAM_DATA struct ContestWinner gCurContestWinner = {0}; -EWRAM_DATA u8 gUnknown_02039F5C = 0; +EWRAM_DATA bool8 gUnknown_02039F5C = 0; EWRAM_DATA u8 gUnknown_02039F5D = 0; // IWRAM common vars. @@ -2490,7 +2490,7 @@ static void sub_80DA5E8(u8 taskId) gBattle_BG2_Y = 0; for (i = 0; i < CONTESTANT_COUNT; i++) gUnknown_02039F10[i] = eContestantStatus[i].pointTotal; - sub_80DBD18(); + CalculateFinalScores(); ContestClearGeneralTextWindow(); if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)) BravoTrainerPokemonProfile_BeforeInterview1(eContestantStatus[gContestPlayerMonIndex].prevMove); @@ -3367,22 +3367,22 @@ bool8 Contest_IsMonsTurnDisabled(u8 a) return FALSE; } -static void sub_80DBCE0(u8 contestant) +static void CalculateTotalPointsForContestant(u8 contestant) { - gUnknown_02039F18[contestant] = sub_80DBD34(contestant); - gUnknown_02039F08[contestant] = gContestMonConditions[contestant] + gUnknown_02039F18[contestant]; + gContestMonRound2Points[contestant] = GetContestantRound2Points(contestant); + gContestMonTotalPoints[contestant] = gContestMonConditions[contestant] + gContestMonRound2Points[contestant]; } -static void sub_80DBD18(void) +static void CalculateFinalScores(void) { s32 i; for (i = 0; i < CONTESTANT_COUNT; i++) - sub_80DBCE0(i); + CalculateTotalPointsForContestant(i); DetermineFinalStandings(); } -static s16 sub_80DBD34(u8 contestant) +static s16 GetContestantRound2Points(u8 contestant) { return gUnknown_02039F10[contestant] * 2; } @@ -3411,7 +3411,7 @@ static void DetermineFinalStandings(void) for (i = 0; i < CONTESTANT_COUNT; i++) { - sp8[i].unk0 = gUnknown_02039F08[i]; + sp8[i].unk0 = gContestMonTotalPoints[i]; sp8[i].unk4 = gContestMonConditions[i]; sp8[i].unk8 = randomOrdering[i]; sp8[i].unkC = i; @@ -5313,22 +5313,22 @@ bool8 sub_80DEDA8(u8 rank) } if (rank != 0xFE) { - u8 r4 = sub_80DEFA8(rank, 1); + u8 id = sub_80DEFA8(rank, 1); - gSaveBlock1Ptr->contestWinners[r4].personality = gContestMons[i].personality; - gSaveBlock1Ptr->contestWinners[r4].species = gContestMons[i].species; - gSaveBlock1Ptr->contestWinners[r4].trainerId = gContestMons[i].otId; - StringCopy(gSaveBlock1Ptr->contestWinners[r4].monName, gContestMons[i].nickname); - StringCopy(gSaveBlock1Ptr->contestWinners[r4].trainerName, gContestMons[i].trainerName); + gSaveBlock1Ptr->contestWinners[id].personality = gContestMons[i].personality; + gSaveBlock1Ptr->contestWinners[id].species = gContestMons[i].species; + gSaveBlock1Ptr->contestWinners[id].trainerId = gContestMons[i].otId; + StringCopy(gSaveBlock1Ptr->contestWinners[id].monName, gContestMons[i].nickname); + StringCopy(gSaveBlock1Ptr->contestWinners[id].trainerName, gContestMons[i].trainerName); if(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) - gSaveBlock1Ptr->contestWinners[r4].contestRank = CONTEST_RANK_LINK; + gSaveBlock1Ptr->contestWinners[id].contestRank = CONTEST_RANK_LINK; else - gSaveBlock1Ptr->contestWinners[r4].contestRank = gSpecialVar_ContestRank; + gSaveBlock1Ptr->contestWinners[id].contestRank = gSpecialVar_ContestRank; if (rank != 0xFF) - gSaveBlock1Ptr->contestWinners[r4].contestCategory = gSpecialVar_ContestCategory; + gSaveBlock1Ptr->contestWinners[id].contestCategory = gSpecialVar_ContestCategory; else - gSaveBlock1Ptr->contestWinners[r4].contestCategory = r7; + gSaveBlock1Ptr->contestWinners[id].contestCategory = r7; } else { @@ -5354,24 +5354,24 @@ u8 sub_80DEFA8(u8 rank, u8 b) case CONTEST_RANK_MASTER: if (b != 0) { - for (i = 5; i >= 1; i--) + for (i = NUM_CONTEST_HALL_WINNERS - 1; i >= 1; i--) memcpy(&gSaveBlock1Ptr->contestWinners[i], &gSaveBlock1Ptr->contestWinners[i - 1], sizeof(struct ContestWinner)); } return 0; - default: // CONTEST_RANK_LINK + default: switch (gSpecialVar_ContestCategory) { case CONTEST_CATEGORY_COOL: - return 8; + return CONTEST_WINNER_MUSEUM_COOL - 1; case CONTEST_CATEGORY_BEAUTY: - return 9; + return CONTEST_WINNER_MUSEUM_BEAUTY - 1; case CONTEST_CATEGORY_CUTE: - return 10; + return CONTEST_WINNER_MUSEUM_CUTE - 1; case CONTEST_CATEGORY_SMART: - return 11; + return CONTEST_WINNER_MUSEUM_SMART - 1; case CONTEST_CATEGORY_TOUGH: default: - return 12; + return CONTEST_WINNER_MUSEUM_TOUGH - 1; } } } @@ -5471,7 +5471,7 @@ static void sub_80DF250(void) gContestResources->field_1c[r1].unkD |= 1; for (i = 0; i < CONTESTANT_COUNT; i++) { - if (i != var_38 && gUnknown_02039F08[var_38] - gUnknown_02039F08[i] <= 50) + if (i != var_38 && gContestMonTotalPoints[var_38] - gContestMonTotalPoints[i] <= 50) gContestResources->field_1c[i].unkD |= 4; if (!gContestResources->field_1c[i].unkE_2) @@ -5491,7 +5491,7 @@ static void sub_80DF250(void) { if (gContestMonConditions[i] > gContestMonConditions[j]) r12 = TRUE; - if (gUnknown_02039F18[i] > gUnknown_02039F18[j]) + if (gContestMonRound2Points[i] > gContestMonRound2Points[j]) r8 = TRUE; } if (!r12 && !r8) @@ -5582,7 +5582,7 @@ static void sub_80DF4F8(void) { if (gContestMonConditions[r7] < gContestMonConditions[i]) r9++; - if (gUnknown_02039F18[r7] < gUnknown_02039F18[i]) + if (gContestMonRound2Points[r7] < gContestMonRound2Points[i]) r10++; } diff --git a/src/contest_link_80F57C4.c b/src/contest_link_80F57C4.c index 65764067c..8434c3eac 100644 --- a/src/contest_link_80F57C4.c +++ b/src/contest_link_80F57C4.c @@ -36,6 +36,7 @@ #include "tv.h" #include "util.h" #include "window.h" +#include "constants/field_specials.h" #include "constants/game_stat.h" #include "constants/rgb.h" #include "constants/songs.h" @@ -43,96 +44,113 @@ #include "constants/vars.h" #include "contest.h" +enum { + SLIDING_TEXT_OFFSCREEN, + SLIDING_TEXT_ENTERING, + SLIDING_TEXT_ARRIVED, + SLIDING_TEXT_EXITING, +}; + +enum { + SLIDING_MON_ENTERED = 1, + SLIDING_MON_EXITED, +}; + +#define GET_CONTEST_WINNER_ID(i) { for ((i) = 0; (i) < CONTESTANT_COUNT && gContestFinalStandings[(i)] != 0; (i)++); } + #define TAG_CONFETTI 3017 -struct ContestLinkUnk0 +#define MAX_BAR_LENGTH 87 + +struct ContestResultsInternal { - u8 unk0; - u8 unk1; - u8 taskId; - u8 unk3; - u8 unk4; - u8 unk5; - u8 unk6; - u8 unk7; - u8 spriteId; - u8 unk9; - u8 unkA; - s16 unkC[4]; - u8 unk14; - u8 filler15[0x3]; + u8 slidingTextBoxSpriteId; + u8 linkTextBoxSpriteId; + u8 showResultsTaskId; + u8 highlightWinnerTaskId; + u8 slidingTextBoxState; + u8 numStandingsPrinted; + u8 winnerMonSlidingState; + u8 confettiCount; + u8 winnerMonSpriteId; + bool8 destroyConfetti; + bool8 pointsFlashing; + s16 unkC[CONTESTANT_COUNT]; + u8 numBarsUpdating; }; -struct ContestLinkUnk14 +struct ContestMonResults { - int unk0; - int unk4; - u32 unk8; - u32 unkC; - u8 unk10; - u8 unk11; - u8 unk12; + int relativePreliminaryPoints; + int relativeRound2Points; + u32 barLengthPreliminary; + u32 barLengthRound2; + bool8 lostPoints; + u8 numStars; + u8 numHearts; }; -struct ContestLink80F57C4 +struct ContestResults { - struct ContestLinkUnk0 *unk0; - struct ContestLinkUnk14 (*unk4)[4]; - u8 *unk8; - u8 *unkC[4]; - u8 *unk1C; + struct ContestResultsInternal *data; + struct ContestMonResults (*monResults)[CONTESTANT_COUNT]; + u8 *unusedBg; // Allocated/freed, never used + u8 *tilemapBuffers[4]; + u8 *unused; // Allocated/freed, never used }; -EWRAM_DATA struct ContestLink80F57C4 *gUnknown_0203A034 = NULL; +static EWRAM_DATA struct ContestResults *sContestResults = NULL; -static void sub_80F6A9C(void); -static void sub_80F71C8(void); -u8 sub_80F7310(u8, u8); -s8 sub_80F7364(u8, u8); -static void sub_80F7ED0(int, u8 *, int); -static void sub_80F7DF4(void); +static void LoadAllContestMonIconPalettes(void); +static void LoadContestResultsTilemaps(void); +static u8 GetNumPreliminaryPoints(u8, bool8); +static s8 GetNumRound2Points(u8, bool8); +static void AddContestTextPrinter(int, u8 *, int); +static void AllocContestResults(void); +static void FreeContestResults(void); static void LoadAllContestMonIcons(u8, u8); -static void sub_80F6DC0(void); -static void sub_80F6AE8(void); -static void sub_80F5CE4(u8); -static void sub_80F5C00(void); -static void sub_80F68B4(u8); -static void sub_80F7880(void); -static void sub_80F5C24(void); -static void sub_80F707C(const u8 *); -static void sub_80F5ED8(u8); +static void LoadContestResultSprites(void); +static void TryCreateWirelessSprites(void); +static void Task_StartShowContestResults(u8 taskId); +static void CB2_StartShowContestResults(void); +static void Task_ShowContestResults(u8); +static void CB2_ShowContestResults(void); +static void VBlankCB_ShowContestResults(void); +static void Task_SlideContestResultsBg(u8); +static void Task_WaitForLinkPartnersBeforeResults(u8); static void sub_80F5F14(u8); static void sub_80F5F30(u8); -static void sub_80F5F74(u8); -static void sub_80F7144(void); -static void sub_80F68F0(u8); -s32 sub_80F6B78(const u8 *, u8); -static void sub_80F6E9C(s16, u16, u16, u16); -static void sub_80F6058(u8); -static void sub_80F7A80(u8, u8); -void sub_80F7CA8(u8); -static void sub_80F6EF4(u16); -static void sub_80F60F0(u8); -static void sub_80F616C(u8); -static void sub_80F6204(u8); -static void sub_80F73DC(u8); -static void sub_80F74BC(u8); -static void sub_80F753C(u8); -static void sub_80F77E0(u8, u8); -static void sub_80F7824(u8); -static void sub_80F6404(u8); -static void sub_80F75A8(struct Sprite *); -static void sub_80F7670(u8); -static void sub_80F7620(struct Sprite *); -static void sub_80F66B4(u8); -static void sub_80F671C(u8); -static void sub_80F677C(u8); -static void sub_80F67C4(u8); -static void sub_80F6820(u8); -static void sub_80F7E64(void); -static void sub_80F6F68(struct Sprite *); -static void sub_80F7014(struct Sprite *); -static void sub_80F6FDC(struct Sprite *); +static void Task_AnnouncePreliminaryResults(u8); +static void Task_FlashStarsAndHearts(u8); +static void Task_ShowPreliminaryResults(u8); +static void Task_AnnounceRound2Results(u8); +static void Task_ShowRound2Results(u8); +static void Task_AnnounceWinner(u8); +static void Task_DrawFinalStandingNumber(u8); +static void Task_StartHighlightWinnersBox(u8); +static void Task_HighlightWinnersBox(u8); +static void Task_ShowWinnerMonBanner(u8); +static void Task_SetSeenWinnerMon(u8); +static void Task_TryDisconnectLinkPartners(u8); +static void Task_WaitForLinkPartnersDisconnect(u8); +static void Task_TrySetContestInterviewData(u8); +static void Task_EndShowContestResults(u8); +static void CalculateContestantsResultData(void); +static void ShowLinkResultsTextBox(const u8 *); +static void HideLinkResultsTextBox(void); +static s32 DrawResultsTextWindow(const u8 *, u8); +static void StartTextBoxSlideIn(s16, u16, u16, u16); +static void UpdateContestResultBars(bool8, u8); +static void Task_UpdateContestResultBar(u8); +static void StartTextBoxSlideOut(u16); +static void BounceMonIconInBox(u8, u8); +static void Task_BounceMonIconInBox(u8); +static void SpriteCB_WinnerMonSlideIn(struct Sprite *); +static void SpriteCB_WinnerMonSlideOut(struct Sprite *); +static void Task_CreateConfetti(u8); +static void SpriteCB_TextBoxSlideIn(struct Sprite *); +static void SpriteCB_TextBoxSlideOut(struct Sprite *); +static void SpriteCB_EndTextBoxSlideIn(struct Sprite *); static void sub_80F8508(u8); static void sub_80F8568(u8); static void sub_80F8584(u8); @@ -235,7 +253,7 @@ static const struct CompressedSpritePalette sSpritePalette_Confetti = .tag = TAG_CONFETTI }; -static const struct BgTemplate sUnknown_0858D888[] = +static const struct BgTemplate sBgTemplates[] = { { .bg = 0, @@ -275,7 +293,7 @@ static const struct BgTemplate sUnknown_0858D888[] = } }; -static const struct WindowTemplate sUnknown_0858D898[] = +static const struct WindowTemplate sWindowTemplates[] = { { .bg = 1, @@ -355,17 +373,17 @@ static const struct SpriteSheet sUnknown_0858D8E0 = static const u8 sContestLinkTextColors[4] = {TEXT_COLOR_WHITE, TEXT_DYNAMIC_COLOR_6, TEXT_DYNAMIC_COLOR_5}; -void sub_80F57C4(void) +static void InitContestResultsDisplay(void) { int i; SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP); ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, sUnknown_0858D888, ARRAY_COUNT(sUnknown_0858D888)); - for (i = 0; i < 4; i++) - SetBgTilemapBuffer(i, gUnknown_0203A034->unkC[i]); + InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); + for (i = 0; i < (int)ARRAY_COUNT(sContestResults->tilemapBuffers); i++) + SetBgTilemapBuffer(i, sContestResults->tilemapBuffers[i]); - InitWindows(sUnknown_0858D898); + InitWindows(sWindowTemplates); DeactivateAllTextPrinters(); SetGpuReg(REG_OFFSET_MOSAIC, 0); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); @@ -400,34 +418,35 @@ void sub_80F57C4(void) gBattle_WIN1V = 0; } -void sub_80F591C(void) +static void LoadContestResultsBgGfx(void) { int i, j; - s8 var0, var1; + s8 numStars, round2Points; u16 tile1, tile2; - LZDecompressVram(gUnknown_08C19588, (void *)BG_CHAR_ADDR(0)); + LZDecompressVram(gContestResults_Gfx, (void *)BG_CHAR_ADDR(0)); CopyToBgTilemapBuffer(3, gUnknown_08C1A12C, 0, 0); CopyToBgTilemapBuffer(2, gUnknown_08C1A000, 0, 0); CopyToBgTilemapBuffer(0, gUnknown_08C19EEC, 0, 0); - sub_80F71C8(); - LoadCompressedPalette(gUnknown_08C1A2B4, 0, 0x200); + LoadContestResultsTilemaps(); + LoadCompressedPalette(gContestResults_Pal, 0, 0x200); LoadPalette(sUnknown_0858D6B0, 0xF0, 0x20); - for (i = 0; i < 4; i++) + for (i = 0; i < CONTESTANT_COUNT; i++) { - var0 = sub_80F7310(i, 1); - var1 = sub_80F7364(i, 1); + numStars = GetNumPreliminaryPoints(i, TRUE); + round2Points = GetNumRound2Points(i, TRUE); for (j = 0; j < 10; j++) { tile1 = 0x60B2; - if (j < var0) + if (j < numStars) tile1 += 2; - if (j < abs(var1)) + // Abs of round2Points is number of hearts + if (j < abs(round2Points)) { tile2 = 0x60A4; - if (var1 < 0) + if (round2Points < 0) tile2 += 2; } else @@ -450,7 +469,7 @@ void sub_80F591C(void) ShowBg(3); } -static void sub_80F5A74(u8 monIndex) +static void LoadContestMonName(u8 monIndex) { struct ContestPokemon *mon = &gContestMons[monIndex]; u8 *str = gDisplayedStringBattle; @@ -458,58 +477,58 @@ static void sub_80F5A74(u8 monIndex) str = StringCopy(gDisplayedStringBattle, gText_ColorDarkGrey); StringCopy(str, mon->nickname); - sub_80F7ED0(monIndex, gDisplayedStringBattle, 0); + AddContestTextPrinter(monIndex, gDisplayedStringBattle, 0); StringCopy(str, gText_Slash); StringAppend(str, mon->trainerName); - sub_80F7ED0(monIndex, gDisplayedStringBattle, 50); + AddContestTextPrinter(monIndex, gDisplayedStringBattle, 50); } -void sub_80F5AE0(void) +static void LoadAllContestMonNames(void) { int i; for (i = 0; i < CONTESTANT_COUNT; i++) - sub_80F5A74(i); + LoadContestMonName(i); CopyBgTilemapBufferToVram(1); } -void sub_80F5B00(void) +static void CB2_StartShowContestResults(void) { - gPaletteFade.bufferTransferDisabled = 1; + gPaletteFade.bufferTransferDisabled = TRUE; SetVBlankCallback(NULL); - sub_80F7DF4(); - sub_80F57C4(); + AllocContestResults(); + InitContestResultsDisplay(); ScanlineEffect_Clear(); ResetPaletteFade(); ResetSpriteData(); ResetTasks(); FreeAllSpritePalettes(); - sub_80F591C(); - sub_80F6A9C(); - LoadAllContestMonIcons(0, 1); - sub_80F5AE0(); - memset(gUnknown_0203A034->unk0, 0, sizeof(*gUnknown_0203A034->unk0)); - memset(gUnknown_0203A034->unk4, 0, sizeof(*gUnknown_0203A034->unk4)); - sub_80F6DC0(); - sub_80F6AE8(); + LoadContestResultsBgGfx(); + LoadAllContestMonIconPalettes(); + LoadAllContestMonIcons(0, TRUE); + LoadAllContestMonNames(); + memset(sContestResults->data, 0, sizeof(*sContestResults->data)); + memset(sContestResults->monResults, 0, sizeof(*sContestResults->monResults)); + LoadContestResultSprites(); + TryCreateWirelessSprites(); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); - gPaletteFade.bufferTransferDisabled = 0; - gUnknown_0203A034->unk0->taskId = CreateTask(sub_80F5CE4, 5); - SetMainCallback2(sub_80F5C00); + gPaletteFade.bufferTransferDisabled = FALSE; + sContestResults->data->showResultsTaskId = CreateTask(Task_ShowContestResults, 5); + SetMainCallback2(CB2_ShowContestResults); gBattle_WIN1H = 0x00F0; gBattle_WIN1V = 0x80A0; - CreateTask(sub_80F68B4, 20); - sub_80F7880(); + CreateTask(Task_SlideContestResultsBg, 20); + CalculateContestantsResultData(); if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS) - gPaletteFade.bufferTransferDisabled = 1; + gPaletteFade.bufferTransferDisabled = TRUE; else PlayBGM(MUS_CON_K); - SetVBlankCallback(sub_80F5C24); + SetVBlankCallback(VBlankCB_ShowContestResults); } -static void sub_80F5C00(void) +static void CB2_ShowContestResults(void) { AnimateSprites(); BuildOamBuffer(); @@ -519,7 +538,7 @@ static void sub_80F5C00(void) CopyBgTilemapBufferToVram(2); } -static void sub_80F5C24(void) +static void VBlankCB_ShowContestResults(void) { SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); @@ -539,29 +558,33 @@ static void sub_80F5C24(void) ScanlineEffect_InitHBlankDmaTransfer(); } -static void sub_80F5CE4(u8 taskId) +#define tState data[0] +#define tTimer data[1] +#define tCounter data[2] + +static void Task_ShowContestResults(u8 taskId) { u16 var; if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) { - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: SaveLinkContestResults(); if (gContestFinalStandings[gContestPlayerMonIndex] == 0) { IncrementGameStat(GAME_STAT_WON_LINK_CONTEST); - gSpecialVar_0x8005 = 8; + gSpecialVar_0x8005 = TVSHOW_CONTEST_LIVE_UPDATES; InterviewBefore(); - if (gSpecialVar_Result != 1) + if (gSpecialVar_Result != TRUE) InterviewAfter(); } - TryGainNewFanFromCounter(2); + TryGainNewFanFromCounter(FANCOUNTER_FINISHED_CONTEST); sub_80DEDA8(gSpecialVar_ContestRank); sub_80DEDA8(0xFE); - gUnknown_02039F5C = 1; + gUnknown_02039F5C = TRUE; gUnknown_02039F5D = sub_80DEFA8(0xFE, 0); var = VarGet(VAR_CONTEST_HALL_STATE); VarSet(VAR_CONTEST_HALL_STATE, 0); @@ -569,26 +592,26 @@ static void sub_80F5CE4(u8 taskId) TrySavingData(SAVE_LINK); ClearContinueGameWarpStatus2(); VarSet(VAR_CONTEST_HALL_STATE, var); - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; break; case 1: - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)) - gTasks[taskId].data[0] = 100; + gTasks[taskId].tState = 100; break; case 2: if (IsLinkTaskFinished()) { sub_800ADF8(); - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } return; case 3: if (IsLinkTaskFinished() == TRUE) { PlayBGM(MUS_CON_K); - gPaletteFade.bufferTransferDisabled = 0; - gTasks[taskId].data[0]++; + gPaletteFade.bufferTransferDisabled = FALSE; + gTasks[taskId].tState++; break; } return; @@ -597,11 +620,11 @@ static void sub_80F5CE4(u8 taskId) if (!gPaletteFade.active) { - gTasks[taskId].data[0] = 0; + gTasks[taskId].tState = 0; if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) { - sub_80F707C(gText_CommunicationStandby); - gTasks[taskId].func = sub_80F5ED8; + ShowLinkResultsTextBox(gText_CommunicationStandby); + gTasks[taskId].func = Task_WaitForLinkPartnersBeforeResults; } else { @@ -611,15 +634,15 @@ static void sub_80F5CE4(u8 taskId) sub_80DEDA8(gSpecialVar_ContestRank); sub_80DEDA8(0xFE); - gUnknown_02039F5C = 1; + gUnknown_02039F5C = TRUE; gUnknown_02039F5D = sub_80DEFA8(0xFE, 0); - TryGainNewFanFromCounter(2); - gTasks[taskId].func = sub_80F5F74; + TryGainNewFanFromCounter(FANCOUNTER_FINISHED_CONTEST); + gTasks[taskId].func = Task_AnnouncePreliminaryResults; } } } -static void sub_80F5ED8(u8 taskId) +static void Task_WaitForLinkPartnersBeforeResults(u8 taskId) { if (gReceivedRemoteLinkPlayers) { @@ -638,194 +661,193 @@ static void sub_80F5F30(u8 taskId) if (IsLinkTaskFinished()) { DestroyTask(taskId); - gTasks[gUnknown_0203A034->unk0->taskId].func = sub_80F5F74; - sub_80F7144(); + gTasks[sContestResults->data->showResultsTaskId].func = Task_AnnouncePreliminaryResults; + HideLinkResultsTextBox(); } } -static void sub_80F5F74(u8 taskId) +static void Task_AnnouncePreliminaryResults(u8 taskId) { - s16 var0; + s16 x; - if (gTasks[taskId].data[0] == 0) + if (gTasks[taskId].tState == 0) { - CreateTask(sub_80F68F0, 20); - var0 = sub_80F6B78(gText_AnnouncingResults, gUnknown_0203A034->unk0->unk0); - sub_80F6E9C(var0, 144, 120, 1088); - gTasks[taskId].data[0]++; + CreateTask(Task_FlashStarsAndHearts, 20); + x = DrawResultsTextWindow(gText_AnnouncingResults, sContestResults->data->slidingTextBoxSpriteId); + StartTextBoxSlideIn(x, 144, 120, 1088); + gTasks[taskId].tState++; } - else if (gTasks[taskId].data[0] == 1) + else if (gTasks[taskId].tState == 1) { - if (gUnknown_0203A034->unk0->unk4 == 0) + // Wait for "Announcing Results" text to leave + if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_OFFSCREEN) { - gTasks[taskId].data[1] = 0; - gTasks[taskId].data[0]++; + gTasks[taskId].tTimer = 0; + gTasks[taskId].tState++; } } - else if (gTasks[taskId].data[0] == 2) + else if (gTasks[taskId].tState == 2) { - if (++gTasks[taskId].data[1] == 21) + if (++gTasks[taskId].tTimer == 21) { - gTasks[taskId].data[1] = 0; - gTasks[taskId].data[0]++; + gTasks[taskId].tTimer = 0; + gTasks[taskId].tState++; } } - else if (gTasks[taskId].data[0] == 3) + else if (gTasks[taskId].tState == 3) { - var0 = sub_80F6B78(gText_PreliminaryResults, gUnknown_0203A034->unk0->unk0); - sub_80F6E9C(var0, 144, -1, 1088); - gTasks[taskId].data[0]++; + x = DrawResultsTextWindow(gText_PreliminaryResults, sContestResults->data->slidingTextBoxSpriteId); + StartTextBoxSlideIn(x, 144, -1, 1088); + gTasks[taskId].tState++; } - else if (gTasks[taskId].data[0] == 4) + else if (gTasks[taskId].tState == 4) { - if (gUnknown_0203A034->unk0->unk4 == 2) + if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_ARRIVED) { - gTasks[taskId].data[0] = 0; - gTasks[taskId].func = sub_80F6058; + gTasks[taskId].tState = 0; + gTasks[taskId].func = Task_ShowPreliminaryResults; } } } -static void sub_80F6058(u8 taskId) +static void Task_ShowPreliminaryResults(u8 taskId) { - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: - if (!gUnknown_0203A034->unk0->unkA) + if (!sContestResults->data->pointsFlashing) { - sub_80F7A80(0, gTasks[taskId].data[2]++); - if (!gUnknown_0203A034->unk0->unk14) - gTasks[taskId].data[0] = 2; + UpdateContestResultBars(FALSE, gTasks[taskId].tCounter++); + if (sContestResults->data->numBarsUpdating == 0) + gTasks[taskId].tState = 2; else - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 1: - if (!gUnknown_0203A034->unk0->unk14) - gTasks[taskId].data[0] = 0; + if (sContestResults->data->numBarsUpdating == 0) + gTasks[taskId].tState = 0; break; case 2: - sub_80F6EF4(1088); - gTasks[taskId].data[0] = 0; - gTasks[taskId].data[2] = 0; - gTasks[taskId].func = sub_80F60F0; + StartTextBoxSlideOut(1088); + gTasks[taskId].tState = 0; + gTasks[taskId].tCounter = 0; + gTasks[taskId].func = Task_AnnounceRound2Results; break; } } -static void sub_80F60F0(u8 taskId) +static void Task_AnnounceRound2Results(u8 taskId) { - s16 var0; + s16 x; - if (gUnknown_0203A034->unk0->unk4 == 0) + if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_OFFSCREEN) { - if (++gTasks[taskId].data[1] == 21) + if (++gTasks[taskId].tTimer == 21) { - gTasks[taskId].data[1] = 0; - var0 = sub_80F6B78(gText_Round2Results, gUnknown_0203A034->unk0->unk0); - sub_80F6E9C(var0, 144, -1, 1088); + gTasks[taskId].tTimer = 0; + x = DrawResultsTextWindow(gText_Round2Results, sContestResults->data->slidingTextBoxSpriteId); + StartTextBoxSlideIn(x, 144, -1, 1088); } } - else if (gUnknown_0203A034->unk0->unk4 == 2) + else if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_ARRIVED) { - gTasks[taskId].func = sub_80F616C; + gTasks[taskId].func = Task_ShowRound2Results; } } -static void sub_80F616C(u8 taskId) +static void Task_ShowRound2Results(u8 taskId) { - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: - if (!gUnknown_0203A034->unk0->unkA) + if (!sContestResults->data->pointsFlashing) { - sub_80F7A80(1, gTasks[taskId].data[2]++); - if (!gUnknown_0203A034->unk0->unk14) - gTasks[taskId].data[0] = 2; + UpdateContestResultBars(TRUE, gTasks[taskId].tCounter++); + if (sContestResults->data->numBarsUpdating == 0) + gTasks[taskId].tState = 2; else - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 1: - if (!gUnknown_0203A034->unk0->unk14) - gTasks[taskId].data[0] = 0; + if (sContestResults->data->numBarsUpdating == 0) + gTasks[taskId].tState = 0; break; case 2: - sub_80F6EF4(1088); - gTasks[taskId].data[0] = 0; - gTasks[taskId].func = sub_80F6204; + StartTextBoxSlideOut(1088); + gTasks[taskId].tState = 0; + gTasks[taskId].func = Task_AnnounceWinner; break; } } -static void sub_80F6204(u8 taskId) +// Task data for Task_DrawFinalStandingNumber +#define tFinalStanding data[0] +#define tMonIndex data[1] + +static void Task_AnnounceWinner(u8 taskId) { int i; - u8 newTaskId; - u8 buffer[100]; - s16 var0; - - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: - if (!gUnknown_0203A034->unk0->unk4) - gTasks[taskId].data[0]++; + if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_OFFSCREEN) + gTasks[taskId].tState++; break; case 1: - if (++gTasks[taskId].data[1] == 31) + if (++gTasks[taskId].tTimer == 31) { - gTasks[taskId].data[1] = 0; - gTasks[taskId].data[0]++; + gTasks[taskId].tTimer = 0; + gTasks[taskId].tState++; } break; case 2: for (i = 0; i < CONTESTANT_COUNT; i++) { - newTaskId = CreateTask(sub_80F73DC, 10); - gTasks[newTaskId].data[0] = gContestFinalStandings[i]; - gTasks[newTaskId].data[1] = i; + u8 newTaskId = CreateTask(Task_DrawFinalStandingNumber, 10); + gTasks[newTaskId].tFinalStanding = gContestFinalStandings[i]; + gTasks[newTaskId].tMonIndex = i; } - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; break; case 3: - if (gUnknown_0203A034->unk0->unk5 == 4) + if (sContestResults->data->numStandingsPrinted == CONTESTANT_COUNT) { - if (++gTasks[taskId].data[1] == 31) + if (++gTasks[taskId].tTimer == 31) { - gTasks[taskId].data[1] = 0; - CreateTask(sub_80F74BC, 10); - gTasks[taskId].data[0]++; - for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++) - ; - - sub_80F77E0(i, 14); + gTasks[taskId].tTimer = 0; + CreateTask(Task_StartHighlightWinnersBox, 10); + gTasks[taskId].tState++; + GET_CONTEST_WINNER_ID(i); + BounceMonIconInBox(i, 14); } } break; case 4: - if (++gTasks[taskId].data[1] == 21) + if (++gTasks[taskId].tTimer == 21) { - gTasks[taskId].data[1] = 0; - for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++) - ; - + u8 winnerTextBuffer[100]; + s16 x; + gTasks[taskId].tTimer = 0; + GET_CONTEST_WINNER_ID(i); StringCopy(gStringVar1, gContestMons[i].trainerName); sub_81DB5AC(gStringVar1); StringCopy(gStringVar2, gContestMons[i].nickname); - StringExpandPlaceholders(buffer, gText_Var1sVar2Won); - var0 = sub_80F6B78(buffer, gUnknown_0203A034->unk0->unk0); - sub_80F6E9C(var0, 144, -1, 1088); - gTasks[taskId].data[0]++; + StringExpandPlaceholders(winnerTextBuffer, gText_ContestantsMonWon); + x = DrawResultsTextWindow(winnerTextBuffer, sContestResults->data->slidingTextBoxSpriteId); + StartTextBoxSlideIn(x, 144, -1, 1088); + gTasks[taskId].tState++; } break; case 5: - gTasks[taskId].data[0] = 0; - gTasks[taskId].func = sub_80F6404; + gTasks[taskId].tState = 0; + gTasks[taskId].func = Task_ShowWinnerMonBanner; break; } } -static void sub_80F6404(u8 taskId) +static void Task_ShowWinnerMonBanner(u8 taskId) { int i; u8 spriteId; @@ -834,14 +856,13 @@ static void sub_80F6404(u8 taskId) u32 personality; const struct CompressedSpritePalette *pokePal; - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: gBattle_WIN0H = 0x00F0; gBattle_WIN0V = 0x5050; - for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++) - ; + GET_CONTEST_WINNER_ID(i); species = gContestMons[i].species; personality = gContestMons[i].personality; otId = gContestMons[i].otId; @@ -869,42 +890,42 @@ static void sub_80F6404(u8 taskId) spriteId = CreateSprite(&gMultiuseSpriteTemplate, 272, 80, 10); gSprites[spriteId].data[1] = species; gSprites[spriteId].oam.priority = 0; - gSprites[spriteId].callback = sub_80F75A8; - gUnknown_0203A034->unk0->spriteId = spriteId; + gSprites[spriteId].callback = SpriteCB_WinnerMonSlideIn; + sContestResults->data->winnerMonSpriteId = spriteId; LoadCompressedSpriteSheet(&sSpriteSheet_Confetti); LoadCompressedSpritePalette(&sSpritePalette_Confetti); - CreateTask(sub_80F7670, 10); - gTasks[taskId].data[0]++; + CreateTask(Task_CreateConfetti, 10); + gTasks[taskId].tState++; break; case 1: if (++gTasks[taskId].data[3] == 1) { u8 counter; gTasks[taskId].data[3] = 0; - gTasks[taskId].data[2] += 2; - if (gTasks[taskId].data[2] > 32) - gTasks[taskId].data[2] = 32; + gTasks[taskId].tCounter += 2; + if (gTasks[taskId].tCounter > 32) + gTasks[taskId].tCounter = 32; - counter = gTasks[taskId].data[2]; + counter = gTasks[taskId].tCounter; gBattle_WIN0V = ((80 - counter) << 8) | (80 + counter); if (counter == 32) - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 2: - if (gUnknown_0203A034->unk0->unk6 == 1) - gTasks[taskId].data[0]++; + if (sContestResults->data->winnerMonSlidingState == SLIDING_MON_ENTERED) + gTasks[taskId].tState++; break; case 3: - if (++gTasks[taskId].data[1] == 121) + if (++gTasks[taskId].tTimer == 121) { - gTasks[taskId].data[1] = 0; - gSprites[gUnknown_0203A034->unk0->spriteId].callback = sub_80F7620; - gTasks[taskId].data[0]++; + gTasks[taskId].tTimer = 0; + gSprites[sContestResults->data->winnerMonSpriteId].callback = SpriteCB_WinnerMonSlideOut; + gTasks[taskId].tState++; } break; case 4: - if (gUnknown_0203A034->unk0->unk6 == 2) + if (sContestResults->data->winnerMonSlidingState == SLIDING_MON_EXITED) { u8 top = (gBattle_WIN0V >> 8); top += 2; @@ -913,25 +934,25 @@ static void sub_80F6404(u8 taskId) gBattle_WIN0V = (top << 8) | (160 - top); if (top == 80) - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 5: - if (gUnknown_0203A034->unk0->unk6 == 2) + if (sContestResults->data->winnerMonSlidingState == SLIDING_MON_EXITED) { - gUnknown_0203A034->unk0->unk9 = 1; - gTasks[taskId].data[0] = 0; - gTasks[taskId].func = sub_80F66B4; + sContestResults->data->destroyConfetti = TRUE; + gTasks[taskId].tState = 0; + gTasks[taskId].func = Task_SetSeenWinnerMon; } break; } } -static void sub_80F66B4(u8 taskId) +static void Task_SetSeenWinnerMon(u8 taskId) { int i, nationalDexNum; - if (gMain.newKeys & A_BUTTON) + if (JOY_NEW(A_BUTTON)) { if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)) { @@ -943,62 +964,62 @@ static void sub_80F66B4(u8 taskId) } gTasks[taskId].data[10] = 0; - gTasks[taskId].func = sub_80F671C; + gTasks[taskId].func = Task_TryDisconnectLinkPartners; } } -static void sub_80F671C(u8 taskId) +static void Task_TryDisconnectLinkPartners(u8 taskId) { if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) { if (!gTasks[taskId].data[10]) { - sub_80F707C(gText_CommunicationStandby); + ShowLinkResultsTextBox(gText_CommunicationStandby); sub_800AC34(); - gTasks[taskId].func = sub_80F677C; + gTasks[taskId].func = Task_WaitForLinkPartnersDisconnect; } } else { - gTasks[taskId].func = sub_80F67C4; + gTasks[taskId].func = Task_TrySetContestInterviewData; } } -static void sub_80F677C(u8 taskId) +static void Task_WaitForLinkPartnersDisconnect(u8 taskId) { if (!gReceivedRemoteLinkPlayers) { if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS) DestroyWirelessStatusIndicatorSprite(); - sub_80F7144(); - gTasks[taskId].func = sub_80F67C4; + HideLinkResultsTextBox(); + gTasks[taskId].func = Task_TrySetContestInterviewData; } } -static void sub_80F67C4(u8 taskId) +static void Task_TrySetContestInterviewData(u8 taskId) { if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)) BravoTrainerPokemonProfile_BeforeInterview2(gContestFinalStandings[gContestPlayerMonIndex]); BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0); - gTasks[taskId].func = sub_80F6820; + gTasks[taskId].func = Task_EndShowContestResults; } -static void sub_80F6820(u8 taskId) +static void Task_EndShowContestResults(u8 taskId) { if (!gPaletteFade.active) { - if (gTasks[taskId].data[1] == 0) + if (gTasks[taskId].tTimer == 0) { - DestroyTask(gUnknown_0203A034->unk0->unk3); + DestroyTask(sContestResults->data->highlightWinnerTaskId); BlendPalettes(0x0000FFFF, 16, RGB_BLACK); - gTasks[taskId].data[1]++; + gTasks[taskId].tTimer++; } - else if (gTasks[taskId].data[1] == 1) + else if (gTasks[taskId].tTimer == 1) { BlendPalettes(0xFFFF0000, 16, RGB_BLACK); - gTasks[taskId].data[1]++; + gTasks[taskId].tTimer++; } else { @@ -1007,12 +1028,16 @@ static void sub_80F6820(u8 taskId) DestroyTask(taskId); FreeAllWindowBuffers(); SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); - sub_80F7E64(); + FreeContestResults(); } } } -static void sub_80F68B4(u8 taskId) +#undef tState +#undef tTimer +#undef tCounter + +static void Task_SlideContestResultsBg(u8 taskId) { gBattle_BG3_X += 2; gBattle_BG3_Y += 1; @@ -1022,33 +1047,37 @@ static void sub_80F68B4(u8 taskId) gBattle_BG3_Y -= 255; } -static void sub_80F68F0(u8 taskId) +#define tDelay data[0] +#define tCoeff data[1] +#define tDecreasing data[2] + +static void Task_FlashStarsAndHearts(u8 taskId) { - if (++gTasks[taskId].data[0] == 2) + if (++gTasks[taskId].tDelay == 2) { - gTasks[taskId].data[0] = 0; - if (gTasks[taskId].data[2] == 0) - gTasks[taskId].data[1]++; + gTasks[taskId].tDelay = 0; + if (!gTasks[taskId].tDecreasing) + gTasks[taskId].tCoeff++; else - gTasks[taskId].data[1]--; + gTasks[taskId].tCoeff--; - if (gTasks[taskId].data[1] == 16) - gTasks[taskId].data[2] = 1; - else if (gTasks[taskId].data[1] == 0) - gTasks[taskId].data[2] = 0; + if (gTasks[taskId].tCoeff == 16) + gTasks[taskId].tDecreasing = TRUE; + else if (gTasks[taskId].tCoeff == 0) + gTasks[taskId].tDecreasing = FALSE; - BlendPalette(0x6B, 1, gTasks[taskId].data[1], RGB(30, 22, 11)); - BlendPalette(0x68, 1, gTasks[taskId].data[1], RGB_WHITE); - BlendPalette(0x6E, 1, gTasks[taskId].data[1], RGB(30, 29, 29)); + BlendPalette(0x6B, 1, gTasks[taskId].tCoeff, RGB(30, 22, 11)); + BlendPalette(0x68, 1, gTasks[taskId].tCoeff, RGB_WHITE); + BlendPalette(0x6E, 1, gTasks[taskId].tCoeff, RGB(30, 29, 29)); } - if (gTasks[taskId].data[1] == 0) - gUnknown_0203A034->unk0->unkA = 0; + if (gTasks[taskId].tCoeff == 0) + sContestResults->data->pointsFlashing = FALSE; else - gUnknown_0203A034->unk0->unkA = 1; + sContestResults->data->pointsFlashing = TRUE; } -void sub_80F69B8(u16 species, u8 monIndex, u8 srcOffset, u8 useDmaNow, u32 personality) +static void LoadContestMonIcon(u16 species, u8 monIndex, u8 srcOffset, u8 useDmaNow, u32 personality) { const u8 *iconPtr; u16 var0, var1, frameNum; @@ -1073,15 +1102,15 @@ void sub_80F69B8(u16 species, u8 monIndex, u8 srcOffset, u8 useDmaNow, u32 perso } } -static void LoadAllContestMonIcons(u8 srcOffset, u8 useDmaNow) +static void LoadAllContestMonIcons(u8 srcOffset, bool8 useDmaNow) { int i; for (i = 0; i < CONTESTANT_COUNT; i++) - sub_80F69B8(gContestMons[i].species, i, srcOffset, useDmaNow, gContestMons[i].personality); + LoadContestMonIcon(gContestMons[i].species, i, srcOffset, useDmaNow, gContestMons[i].personality); } -static void sub_80F6A9C(void) +static void LoadAllContestMonIconPalettes(void) { int i, species; @@ -1092,7 +1121,7 @@ static void sub_80F6A9C(void) } } -static void sub_80F6AE8(void) +static void TryCreateWirelessSprites(void) { u16 sheet; u8 spriteId; @@ -1113,7 +1142,7 @@ static void sub_80F6AE8(void) // src are placed on different stack positions. #ifdef NONMATCHING -s32 sub_80F6B78(const u8 *text, u8 spriteId) +static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId) { u8 *windowTilesPtr; u16 windowId; @@ -1178,7 +1207,7 @@ s32 sub_80F6B78(const u8 *text, u8 spriteId) #else NAKED -s32 sub_80F6B78(const u8 *text, u8 spriteId) +static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId) { asm_unified("\n\ push {r4-r7,lr}\n\ @@ -1453,18 +1482,18 @@ _080F6D3E:\n\ } #endif // NONMATCHING -static void sub_80F6DC0(void) +static void LoadContestResultSprites(void) { int i; struct SpriteTemplate template; - u8 spriteIds[8]; + u8 spriteIds[ARRAY_COUNT(sUnknown_0858D810)]; template = sSpriteTemplate_858D7F8; for (i = 0; i < (int)ARRAY_COUNT(sUnknown_0858D810); i++) LoadSpriteSheet(&sUnknown_0858D810[i]); LoadSpritePalette(&sUnknown_0858D850); - for (i = 0; i < 8; i++) + for (i = 0; i < (int)ARRAY_COUNT(sUnknown_0858D810); i++) { spriteIds[i] = CreateSprite(&template, 272, 144, 10); template.tileTag++; @@ -1478,60 +1507,68 @@ static void sub_80F6DC0(void) gSprites[spriteIds[4]].data[1] = spriteIds[6]; gSprites[spriteIds[4]].data[2] = spriteIds[7]; - gUnknown_0203A034->unk0->unk0 = spriteIds[0]; - gUnknown_0203A034->unk0->unk4 = 0; - gUnknown_0203A034->unk0->unk1 = spriteIds[4]; - sub_80F7144(); + sContestResults->data->slidingTextBoxSpriteId = spriteIds[0]; + sContestResults->data->slidingTextBoxState = SLIDING_TEXT_OFFSCREEN; + sContestResults->data->linkTextBoxSpriteId = spriteIds[4]; + HideLinkResultsTextBox(); } -static void sub_80F6E9C(s16 arg0, u16 y, u16 arg2, u16 arg3) +#define sTargetX data[4] +#define sSlideOutTimer data[5] +#define sSlideIncrement data[6] +#define sDistance data[7] + +// If slideOutTimer is -1, it will not automatically slide out +static void StartTextBoxSlideIn(s16 x, u16 y, u16 slideOutTimer, u16 slideIncrement) { - struct Sprite *sprite = &gSprites[gUnknown_0203A034->unk0->unk0]; + struct Sprite *sprite = &gSprites[sContestResults->data->slidingTextBoxSpriteId]; sprite->pos1.x = 272; sprite->pos1.y = y; sprite->pos2.x = 0; sprite->pos2.y = 0; - sprite->data[4] = arg0 + 32; - sprite->data[5] = arg2; - sprite->data[6] = arg3; - sprite->data[7] = 0; - sprite->callback = sub_80F6F68; - gUnknown_0203A034->unk0->unk4 = 1; + sprite->sTargetX = x + 32; + sprite->sSlideOutTimer = slideOutTimer; + sprite->sSlideIncrement = slideIncrement; + sprite->sDistance = 0; + sprite->callback = SpriteCB_TextBoxSlideIn; + sContestResults->data->slidingTextBoxState = SLIDING_TEXT_ENTERING; } -static void sub_80F6EF4(u16 arg0) +static void StartTextBoxSlideOut(u16 slideIncrement) { - struct Sprite *sprite = &gSprites[gUnknown_0203A034->unk0->unk0]; + struct Sprite *sprite = &gSprites[sContestResults->data->slidingTextBoxSpriteId]; sprite->pos1.x += sprite->pos2.x; sprite->pos1.y += sprite->pos2.y; sprite->pos2.y = 0; sprite->pos2.x = 0; - sprite->data[6] = arg0; - sprite->data[7] = 0; - sprite->callback = sub_80F7014; - gUnknown_0203A034->unk0->unk4 = 3; + sprite->sSlideIncrement = slideIncrement; + sprite->sDistance = 0; + sprite->callback = SpriteCB_TextBoxSlideOut; + sContestResults->data->slidingTextBoxState = SLIDING_TEXT_EXITING; } -static void sub_80F6F40(struct Sprite *sprite) +static void EndTextBoxSlideOut(struct Sprite *sprite) { sprite->pos1.x = 272; sprite->pos1.y = 144; sprite->pos2.y = 0; sprite->pos2.x = 0; sprite->callback = SpriteCallbackDummy; - gUnknown_0203A034->unk0->unk4 = 0; + sContestResults->data->slidingTextBoxState = SLIDING_TEXT_OFFSCREEN; } -static void sub_80F6F68(struct Sprite *sprite) +static void SpriteCB_TextBoxSlideIn(struct Sprite *sprite) { int i; - s16 delta = sprite->data[7] + sprite->data[6]; + s16 delta = sprite->sDistance + sprite->sSlideIncrement; sprite->pos1.x -= delta >> 8; - sprite->data[7] += sprite->data[6]; - sprite->data[7] &= 0xFF; - if (sprite->pos1.x < sprite->data[4]) - sprite->pos1.x = sprite->data[4]; + sprite->sDistance += sprite->sSlideIncrement; + sprite->sDistance &= 0xFF; + + // Prevent overshooting target + if (sprite->pos1.x < sprite->sTargetX) + sprite->pos1.x = sprite->sTargetX; for (i = 0; i < 3; i++) { @@ -1539,29 +1576,29 @@ static void sub_80F6F68(struct Sprite *sprite) sprite2->pos1.x = sprite->pos1.x + sprite->pos2.x + (i + 1) * 64; } - if (sprite->pos1.x == sprite->data[4]) - sprite->callback = sub_80F6FDC; + if (sprite->pos1.x == sprite->sTargetX) + sprite->callback = SpriteCB_EndTextBoxSlideIn; } -static void sub_80F6FDC(struct Sprite *sprite) +static void SpriteCB_EndTextBoxSlideIn(struct Sprite *sprite) { - gUnknown_0203A034->unk0->unk4 = 2; - if ((u16)sprite->data[5] != 0xFFFF) + sContestResults->data->slidingTextBoxState = SLIDING_TEXT_ARRIVED; + if ((u16)sprite->sSlideOutTimer != 0xFFFF) { - if (--sprite->data[5] == -1) - sub_80F6EF4(sprite->data[6]); + if (--sprite->sSlideOutTimer == -1) + StartTextBoxSlideOut(sprite->sSlideIncrement); } } -static void sub_80F7014(struct Sprite *sprite) +static void SpriteCB_TextBoxSlideOut(struct Sprite *sprite) { int i; s16 delta; - delta = sprite->data[7] + sprite->data[6]; + delta = sprite->sDistance + sprite->sSlideIncrement; sprite->pos1.x -= delta >> 8; - sprite->data[7] += sprite->data[6]; - sprite->data[7] &= 0xFF; + sprite->sDistance += sprite->sSlideIncrement; + sprite->sDistance &= 0xFF; for (i = 0; i < 3; i++) { struct Sprite *sprite2 = &gSprites[sprite->data[i]]; @@ -1569,25 +1606,25 @@ static void sub_80F7014(struct Sprite *sprite) } if (sprite->pos1.x + sprite->pos2.x < -224) - sub_80F6F40(sprite); + EndTextBoxSlideOut(sprite); } -static void sub_80F707C(const u8 *text) +static void ShowLinkResultsTextBox(const u8 *text) { int i; u16 x; struct Sprite *sprite; - x = sub_80F6B78(text, gUnknown_0203A034->unk0->unk1); - sprite = &gSprites[gUnknown_0203A034->unk0->unk1]; + x = DrawResultsTextWindow(text, sContestResults->data->linkTextBoxSpriteId); + sprite = &gSprites[sContestResults->data->linkTextBoxSpriteId]; sprite->pos1.x = x + 32; sprite->pos1.y = 80; - sprite->invisible = 0; + sprite->invisible = FALSE; for (i = 0; i < 3; i++) { gSprites[sprite->data[i]].pos1.x = sprite->pos1.x + sprite->pos2.x + (i + 1) * 64; gSprites[sprite->data[i]].pos1.y = sprite->pos1.y; - gSprites[sprite->data[i]].invisible = 0; + gSprites[sprite->data[i]].invisible = FALSE; } gBattle_WIN0H = 0x00F0; @@ -1596,15 +1633,15 @@ static void sub_80F707C(const u8 *text) | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR); } -static void sub_80F7144(void) +static void HideLinkResultsTextBox(void) { int i; struct Sprite *sprite; - sprite = &gSprites[gUnknown_0203A034->unk0->unk1]; - sprite->invisible = 1; + sprite = &gSprites[sContestResults->data->linkTextBoxSpriteId]; + sprite->invisible = TRUE; for (i = 0; i < 3; i++) - gSprites[sprite->data[i]].invisible = 1; + gSprites[sprite->data[i]].invisible = TRUE; gBattle_WIN0H = 0; gBattle_WIN0V = 0; @@ -1614,7 +1651,7 @@ static void sub_80F7144(void) | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); } -static void sub_80F71C8(void) +static void LoadContestResultsTilemaps(void) { u8 palette; int x, y; @@ -1623,147 +1660,153 @@ static void sub_80F71C8(void) y = 1; if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) { - CopyToBgTilemapBufferRect(2, gUnknown_08DC6498, 5, 1, 5, 2); + CopyToBgTilemapBufferRect(2, gLinkContestResults_Tilemap, 5, 1, 5, 2); x = 10; } else if (gSpecialVar_ContestRank == CONTEST_RANK_NORMAL) { - CopyToBgTilemapBufferRect(2, gUnknown_08DC63F8, 5, 1, 10, 2); + CopyToBgTilemapBufferRect(2, gNormalContestResults_Tilemap, 5, 1, 10, 2); x = 15; } else if (gSpecialVar_ContestRank == CONTEST_RANK_SUPER) { - CopyToBgTilemapBufferRect(2, gUnknown_08DC6420, 5, 1, 10, 2); + CopyToBgTilemapBufferRect(2, gSuperContestResults_Tilemap, 5, 1, 10, 2); x = 15; } else if (gSpecialVar_ContestRank == CONTEST_RANK_HYPER) { - CopyToBgTilemapBufferRect(2, gUnknown_08DC6448, 5, 1, 10, 2); + CopyToBgTilemapBufferRect(2, gHyperContestResults_Tilemap, 5, 1, 10, 2); x = 15; } else // CONTEST_RANK_MASTER { - CopyToBgTilemapBufferRect(2, gUnknown_08DC6470, 5, 1, 10, 2); + CopyToBgTilemapBufferRect(2, gMasterContestResults_Tilemap, 5, 1, 10, 2); x = 15; } if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_COOL) { palette = 0; - CopyToBgTilemapBufferRect(2, gUnknown_08DC64AC, x, y, 5, 2); + CopyToBgTilemapBufferRect(2, gCoolContestResults_Tilemap, x, y, 5, 2); } else if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_BEAUTY) { palette = 1; - CopyToBgTilemapBufferRect(2, gUnknown_08DC64C0, x, y, 5, 2); + CopyToBgTilemapBufferRect(2, gBeautyContestResults_Tilemap, x, y, 5, 2); } else if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_CUTE) { palette = 2; - CopyToBgTilemapBufferRect(2, gUnknown_08DC64D4, x, y, 5, 2); + CopyToBgTilemapBufferRect(2, gCuteContestResults_Tilemap, x, y, 5, 2); } else if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_SMART) { palette = 3; - CopyToBgTilemapBufferRect(2, gUnknown_08DC64E8, x, y, 5, 2); + CopyToBgTilemapBufferRect(2, gSmartContestResults_Tilemap, x, y, 5, 2); } else // CONTEST_CATEGORY_TOUGH { palette = 4; - CopyToBgTilemapBufferRect(2, gUnknown_08DC64FC, x, y, 5, 2); + CopyToBgTilemapBufferRect(2, gToughContestResults_Tilemap, x, y, 5, 2); } x += 5; - CopyToBgTilemapBufferRect(2, gUnknown_08DC6510, x, y, 6, 2); - CopyToBgTilemapBufferRect_ChangePalette(2, gUnknown_0203A034->unkC[2], 0, 0, 32, 4, palette); + CopyToBgTilemapBufferRect(2, gContestResults_Tilemap, x, y, 6, 2); + CopyToBgTilemapBufferRect_ChangePalette(2, sContestResults->tilemapBuffers[2], 0, 0, 32, 4, palette); } -u8 sub_80F7310(u8 monIndex, u8 arg1) +// Represented on results board as stars +static u8 GetNumPreliminaryPoints(u8 monIndex, bool8 capPoints) { - u32 var0 = gContestMonConditions[monIndex] << 16; - u32 var1 = var0 / 0x3F; + u32 condition = gContestMonConditions[monIndex] << 16; + u32 numStars = condition / 0x3F; - if (var1 & 0xFFFF) - var1 += 0x10000; + if (numStars & 0xFFFF) + numStars += 0x10000; - var1 >>= 16; - if (var1 == 0 && var0) - var1 = 1; + numStars >>= 16; + if (numStars == 0 && condition) + numStars = 1; - if (arg1 && var1 > 10) - var1 = 10; + if (capPoints && numStars > 10) + numStars = 10; - return var1; + return numStars; } -s8 sub_80F7364(u8 arg0, u8 arg1) +// Represented on results board as hearts +static s8 GetNumRound2Points(u8 monIndex, bool8 capPoints) { - u32 r4, r2; - s16 val; - s8 ret; + u32 r4, numHearts; + s16 results; + s8 points; - val = gUnknown_02039F18[arg0]; - if (val < 0) - r4 = -val << 16; + results = gContestMonRound2Points[monIndex]; + if (results < 0) + r4 = -results << 16; else - r4 = val << 16; + r4 = results << 16; - r2 = r4 / 80; - if (r2 & 0xFFFF) - r2 += 0x10000; + numHearts = r4 / 80; + if (numHearts & 0xFFFF) + numHearts += 0x10000; - r2 >>= 16; - if (r2 == 0 && r4 != 0) - r2 = 1; + numHearts >>= 16; + if (numHearts == 0 && r4 != 0) + numHearts = 1; - if (arg1 != 0 && r2 > 10) - r2 = 10; + if (capPoints && numHearts > 10) + numHearts = 10; - if (gUnknown_02039F18[arg0] < 0) - ret = -r2; + if (gContestMonRound2Points[monIndex] < 0) + points = -numHearts; else - ret = r2; + points = numHearts; - return ret; + return points; } -static void sub_80F73DC(u8 taskId) +#define tState data[10] + +static void Task_DrawFinalStandingNumber(u8 taskId) { u16 firstTileNum; - if (gTasks[taskId].data[10] == 0) + if (gTasks[taskId].tState == 0) { - gTasks[taskId].data[11] = (3 - gTasks[taskId].data[0]) * 40; - gTasks[taskId].data[10]++; + gTasks[taskId].data[11] = (3 - gTasks[taskId].tFinalStanding) * 40; + gTasks[taskId].tState++; } - else if (gTasks[taskId].data[10] == 1) + else if (gTasks[taskId].tState == 1) { if (--gTasks[taskId].data[11] == -1) { - firstTileNum = gTasks[taskId].data[0] * 2 + 0x5043; - WriteSequenceToBgTilemapBuffer(2, firstTileNum, 1, gTasks[taskId].data[1] * 3 + 5, 2, 1, 17, 1); - WriteSequenceToBgTilemapBuffer(2, firstTileNum + 0x10, 1, gTasks[taskId].data[1] * 3 + 6, 2, 1, 17, 1); - gUnknown_0203A034->unk0->unk5++; + firstTileNum = gTasks[taskId].tFinalStanding * 2 + 0x5043; + WriteSequenceToBgTilemapBuffer(2, firstTileNum, 1, gTasks[taskId].tMonIndex * 3 + 5, 2, 1, 17, 1); + WriteSequenceToBgTilemapBuffer(2, firstTileNum + 0x10, 1, gTasks[taskId].tMonIndex * 3 + 6, 2, 1, 17, 1); + sContestResults->data->numStandingsPrinted++; DestroyTask(taskId); PlaySE(SE_JYUNI); } } } -static void sub_80F74BC(u8 taskId) +#undef tFinalStanding +#undef tMonIndex +#undef tState + +static void Task_StartHighlightWinnersBox(u8 taskId) { int i; - for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++) - ; - - CopyToBgTilemapBufferRect_ChangePalette(2, i * 0xC0 + 0x100 + gUnknown_0203A034->unkC[2], 0, i * 3 + 4, 32, 3, 9); + GET_CONTEST_WINNER_ID(i); + CopyToBgTilemapBufferRect_ChangePalette(2, i * 0xC0 + 0x100 + sContestResults->tilemapBuffers[2], 0, i * 3 + 4, 32, 3, 9); gTasks[taskId].data[10] = i; gTasks[taskId].data[12] = 1; - gTasks[taskId].func = sub_80F753C; - gUnknown_0203A034->unk0->unk3 = taskId; + gTasks[taskId].func = Task_HighlightWinnersBox; + sContestResults->data->highlightWinnerTaskId = taskId; } -static void sub_80F753C(u8 taskId) +static void Task_HighlightWinnersBox(u8 taskId) { if (++gTasks[taskId].data[11] == 1) { @@ -1782,7 +1825,7 @@ static void sub_80F753C(u8 taskId) } } -static void sub_80F75A8(struct Sprite *sprite) +static void SpriteCB_WinnerMonSlideIn(struct Sprite *sprite) { if (sprite->data[0] < 10) { @@ -1805,12 +1848,12 @@ static void sub_80F75A8(struct Sprite *sprite) { sprite->callback = SpriteCallbackDummy; sprite->data[1] = 0; - gUnknown_0203A034->unk0->unk6 = 1; + sContestResults->data->winnerMonSlidingState = SLIDING_MON_ENTERED; } } } -static void sub_80F7620(struct Sprite *sprite) +static void SpriteCB_WinnerMonSlideOut(struct Sprite *sprite) { s16 delta = sprite->data[1] + 0x600; sprite->pos1.x -= delta >> 8; @@ -1819,28 +1862,28 @@ static void sub_80F7620(struct Sprite *sprite) if (sprite->pos1.x < -32) { sprite->callback = SpriteCallbackDummy; - sprite->invisible = 1; - gUnknown_0203A034->unk0->unk6 = 2; + sprite->invisible = TRUE; + sContestResults->data->winnerMonSlidingState = SLIDING_MON_EXITED; } } -static void sub_80F7670(u8 taskId) +static void Task_CreateConfetti(u8 taskId) { if (++gTasks[taskId].data[0] == 5) { gTasks[taskId].data[0] = 0; - if (gUnknown_0203A034->unk0->unk7 < 40) + if (sContestResults->data->confettiCount < 40) { u8 spriteId = CreateSprite(&sSpriteTemplate_Confetti, (Random() % 240) - 20, 44, 5); gSprites[spriteId].data[0] = Random() % 512; gSprites[spriteId].data[1] = (Random() % 24) + 16; gSprites[spriteId].data[2] = (Random() % 256) + 48; gSprites[spriteId].oam.tileNum += Random() % 17; - gUnknown_0203A034->unk0->unk7++; + sContestResults->data->confettiCount++; } } - if (gUnknown_0203A034->unk0->unk9) + if (sContestResults->data->destroyConfetti) DestroyTask(taskId); } @@ -1856,219 +1899,235 @@ static void SpriteCB_Confetti(struct Sprite *sprite) sprite->data[4] &= 0xff; sprite->pos1.y++; - if (gUnknown_0203A034->unk0->unk9) - sprite->invisible = 1; + if (sContestResults->data->destroyConfetti) + sprite->invisible = TRUE; if (sprite->pos1.x > 248 || sprite->pos1.y > 116) { DestroySprite(sprite); - gUnknown_0203A034->unk0->unk7--; + sContestResults->data->confettiCount--; } } -static void sub_80F77E0(u8 monIndex, u8 numFrames) +#define tMonIndex data[0] +#define tNumFrames data[1] +#define tSpecies data[2] +#define tTimer data[10] +#define tBounced data[11] + +static void BounceMonIconInBox(u8 monIndex, u8 numFrames) { - u8 taskId = CreateTask(sub_80F7824, 8); - gTasks[taskId].data[0] = monIndex; - gTasks[taskId].data[1] = numFrames; - gTasks[taskId].data[2] = gContestMons[monIndex].species; + u8 taskId = CreateTask(Task_BounceMonIconInBox, 8); + gTasks[taskId].tMonIndex = monIndex; + gTasks[taskId].tNumFrames = numFrames; + gTasks[taskId].tSpecies = gContestMons[monIndex].species; } -static void sub_80F7824(u8 taskId) +static void Task_BounceMonIconInBox(u8 taskId) { - u8 monIndex = gTasks[taskId].data[0]; - if (gTasks[taskId].data[10]++ == gTasks[taskId].data[1]) + u8 monIndex = gTasks[taskId].tMonIndex; + if (gTasks[taskId].tTimer++ == gTasks[taskId].tNumFrames) { - gTasks[taskId].data[10] = 0; - sub_80F69B8(gTasks[taskId].data[2], monIndex, gTasks[taskId].data[11], FALSE, gContestMons[monIndex].personality); - gTasks[taskId].data[11] ^= 1; + gTasks[taskId].tTimer = 0; + LoadContestMonIcon(gTasks[taskId].tSpecies, monIndex, gTasks[taskId].tBounced, FALSE, gContestMons[monIndex].personality); + gTasks[taskId].tBounced ^= 1; } } -static void sub_80F7880(void) -{ - int i, r4; - u32 r1; - s16 r2; - s8 var; +#undef tMonIndex +#undef tNumFrames +#undef tSpecies +#undef tTimer +#undef tBounced - r2 = gUnknown_02039F08[0]; - for (i = 1; i < 4; i++) +static void CalculateContestantsResultData(void) +{ + int i, relativePoints; + u32 barLength; + s16 highestPoints; + s8 round2Points; + + highestPoints = gContestMonTotalPoints[0]; + for (i = 1; i < CONTESTANT_COUNT; i++) { - if (r2 < gUnknown_02039F08[i]) - r2 = gUnknown_02039F08[i]; + if (highestPoints < gContestMonTotalPoints[i]) + highestPoints = gContestMonTotalPoints[i]; } - if (r2 < 0) + if (highestPoints < 0) { - r2 = gUnknown_02039F08[0]; - for (i = 1; i < 4; i++) + highestPoints = gContestMonTotalPoints[0]; + for (i = 1; i < CONTESTANT_COUNT; i++) { - if (r2 > gUnknown_02039F08[i]) - r2 = gUnknown_02039F08[i]; + if (highestPoints > gContestMonTotalPoints[i]) + highestPoints = gContestMonTotalPoints[i]; } } for (i = 0; i < CONTESTANT_COUNT; i++) { - r4 = (gContestMonConditions[i] * 1000) / abs(r2); - if (r4 % 10 > 4) - r4 += 10; - (*gUnknown_0203A034->unk4)[i].unk0 = r4 / 10; + relativePoints = (gContestMonConditions[i] * 1000) / abs(highestPoints); + if (relativePoints % 10 > 4) + relativePoints += 10; + (*sContestResults->monResults)[i].relativePreliminaryPoints = relativePoints / 10; - r4 = (abs(gUnknown_02039F18[i]) * 1000) / abs(r2); - if (r4 % 10 > 4) - r4 += 10; - (*gUnknown_0203A034->unk4)[i].unk4 = r4 / 10; + relativePoints = (abs(gContestMonRound2Points[i]) * 1000) / abs(highestPoints); + if (relativePoints % 10 > 4) + relativePoints += 10; + (*sContestResults->monResults)[i].relativeRound2Points = relativePoints / 10; - if (gUnknown_02039F18[i] < 0) - (*gUnknown_0203A034->unk4)[i].unk10 = 1; + if (gContestMonRound2Points[i] < 0) + (*sContestResults->monResults)[i].lostPoints = TRUE; - r1 = ((*gUnknown_0203A034->unk4)[i].unk0 * 22528) / 100; - if ((r1 & 0xFF) > 0x7F) - r1 += 0x100; - (*gUnknown_0203A034->unk4)[i].unk8 = r1 >> 8; + barLength = ((*sContestResults->monResults)[i].relativePreliminaryPoints * 0x5800) / 100; + if ((barLength & 0xFF) > 0x7F) + barLength += 0x100; + (*sContestResults->monResults)[i].barLengthPreliminary = barLength >> 8; - r1 = ((*gUnknown_0203A034->unk4)[i].unk4 * 22528) / 100; - if ((r1 & 0xFF) > 0x7F) - r1 += 0x100; - (*gUnknown_0203A034->unk4)[i].unkC = r1 >> 8; + barLength = ((*sContestResults->monResults)[i].relativeRound2Points * 0x5800) / 100; + if ((barLength & 0xFF) > 0x7F) + barLength += 0x100; + (*sContestResults->monResults)[i].barLengthRound2 = barLength >> 8; - (*gUnknown_0203A034->unk4)[i].unk11 = sub_80F7310(i, 1); - var = sub_80F7364(i, 1); - (*gUnknown_0203A034->unk4)[i].unk12 = abs(var); + (*sContestResults->monResults)[i].numStars = GetNumPreliminaryPoints(i, TRUE); + round2Points = GetNumRound2Points(i, TRUE); + (*sContestResults->monResults)[i].numHearts = abs(round2Points); if (gContestFinalStandings[i]) { - s16 var1 = (*gUnknown_0203A034->unk4)[i].unk8; - s16 var2 = (*gUnknown_0203A034->unk4)[i].unkC; + s16 barLengthPreliminary = (*sContestResults->monResults)[i].barLengthPreliminary; + s16 barLengthRound2 = (*sContestResults->monResults)[i].barLengthRound2; - if ((*gUnknown_0203A034->unk4)[i].unk10) - var2 *= -1; + if ((*sContestResults->monResults)[i].lostPoints) + barLengthRound2 *= -1; - if (var1 + var2 == 88) + if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH + 1) { - if (var2 > 0) - (*gUnknown_0203A034->unk4)[i].unkC--; - else if (var1 > 0) - (*gUnknown_0203A034->unk4)[i].unk8--; + if (barLengthRound2 > 0) + (*sContestResults->monResults)[i].barLengthRound2--; + else if (barLengthPreliminary > 0) + (*sContestResults->monResults)[i].barLengthPreliminary--; } } } } -static void sub_80F7A80(u8 arg0, u8 arg1) +#define tMonId data[0] +#define tTarget data[1] +#define tDecreasing data[2] + +static void UpdateContestResultBars(bool8 isRound2, u8 numUpdates) { int i, taskId; - u32 var0; - u8 sp8 = 0, spC = 0; + u32 target; + u8 numIncreasing = 0, numDecreasing = 0; - if (!arg0) + if (!isRound2) { - for (i = 0; i < 4; i++) + for (i = 0; i < CONTESTANT_COUNT; i++) { - u8 unk = (*gUnknown_0203A034->unk4)[i].unk11; - if (arg1 < unk) + u8 numStars = (*sContestResults->monResults)[i].numStars; + if (numUpdates < numStars) { - FillBgTilemapBufferRect_Palette0(1, 0x60B3, ((19 + unk) - arg1) - 1, i * 3 + 5, 1, 1); - taskId = CreateTask(sub_80F7CA8, 10); + FillBgTilemapBufferRect_Palette0(1, 0x60B3, ((19 + numStars) - numUpdates) - 1, i * 3 + 5, 1, 1); + taskId = CreateTask(Task_UpdateContestResultBar, 10); - var0 = (((*gUnknown_0203A034->unk4)[i].unk8 << 16) / (*gUnknown_0203A034->unk4)[i].unk11) * (arg1 + 1); - if ((var0 & 0xFFFF) > 0x7FFF) - var0 += 0x10000; + target = (((*sContestResults->monResults)[i].barLengthPreliminary << 16) / (*sContestResults->monResults)[i].numStars) * (numUpdates + 1); + if ((target & 0xFFFF) > 0x7FFF) + target += 0x10000; - gTasks[taskId].data[0] = i; - gTasks[taskId].data[1] = var0 >> 16; - gUnknown_0203A034->unk0->unk14++; - sp8++; + gTasks[taskId].tMonId = i; + gTasks[taskId].tTarget = target >> 16; + sContestResults->data->numBarsUpdating++; + numIncreasing++; } } } else { - for (i = 0; i < 4; i++) + for (i = 0; i < CONTESTANT_COUNT; i++) { - s8 unk = (*gUnknown_0203A034->unk4)[i].unk12; - u32 tile = (*gUnknown_0203A034->unk4)[i].unk10 ? 0x60A5 : 0x60A3; - if (arg1 < unk) + s8 numHearts = (*sContestResults->monResults)[i].numHearts; + u32 tile = (*sContestResults->monResults)[i].lostPoints ? 0x60A5 : 0x60A3; + if (numUpdates < numHearts) { - FillBgTilemapBufferRect_Palette0(1, tile, ((19 + unk) - arg1) - 1, i * 3 + 6, 1, 1); - taskId = CreateTask(sub_80F7CA8, 10); + FillBgTilemapBufferRect_Palette0(1, tile, ((19 + numHearts) - numUpdates) - 1, i * 3 + 6, 1, 1); + taskId = CreateTask(Task_UpdateContestResultBar, 10); - var0 = (((*gUnknown_0203A034->unk4)[i].unkC << 16) / (*gUnknown_0203A034->unk4)[i].unk12) * (arg1 + 1); - if ((var0 & 0xFFFF) > 0x7FFF) - var0 += 0x10000; + target = (((*sContestResults->monResults)[i].barLengthRound2 << 16) / (*sContestResults->monResults)[i].numHearts) * (numUpdates + 1); + if ((target & 0xFFFF) > 0x7FFF) + target += 0x10000; - gTasks[taskId].data[0] = i; - if ((*gUnknown_0203A034->unk4)[i].unk10) + gTasks[taskId].tMonId = i; + if ((*sContestResults->monResults)[i].lostPoints) { - gTasks[taskId].data[2] = 1; - spC++; + gTasks[taskId].tDecreasing = TRUE; + numDecreasing++; } else { - sp8++; + numIncreasing++; } - if ((*gUnknown_0203A034->unk4)[i].unk10) - gTasks[taskId].data[1] = -(var0 >> 16) + (*gUnknown_0203A034->unk4)[i].unk8 ; + if ((*sContestResults->monResults)[i].lostPoints) + gTasks[taskId].tTarget = -(target >> 16) + (*sContestResults->monResults)[i].barLengthPreliminary; else - gTasks[taskId].data[1] = (var0 >> 16) + (*gUnknown_0203A034->unk4)[i].unk8; + gTasks[taskId].tTarget = (target >> 16) + (*sContestResults->monResults)[i].barLengthPreliminary; - gUnknown_0203A034->unk0->unk14++; + sContestResults->data->numBarsUpdating++; } } } - if (spC) + if (numDecreasing) PlaySE(SE_BOO); - if (sp8) + if (numIncreasing) PlaySE(SE_PIN); } -void sub_80F7CA8(u8 taskId) +static void Task_UpdateContestResultBar(u8 taskId) { int i; - u8 var0; - u16 tileNum; - bool32 r4 = FALSE; - bool32 endTask = FALSE; - u8 r6 = gTasks[taskId].data[0]; - s16 r7 = gTasks[taskId].data[1]; - s16 r12 = gTasks[taskId].data[2]; + bool32 minMaxReached = FALSE; + bool32 targetReached = FALSE; + u8 monId = gTasks[taskId].tMonId; + s16 target = gTasks[taskId].tTarget; + s16 decreasing = gTasks[taskId].tDecreasing; - if (r12) + if (decreasing) { - if (gUnknown_0203A034->unk0->unkC[r6] <= 0) - r4 = TRUE; + if (sContestResults->data->unkC[monId] <= 0) + minMaxReached = TRUE; } else { - if (gUnknown_0203A034->unk0->unkC[r6] > 87) - r4 = TRUE; + if (sContestResults->data->unkC[monId] > MAX_BAR_LENGTH) + minMaxReached = TRUE; } - if (gUnknown_0203A034->unk0->unkC[r6] == r7) - endTask = TRUE; + if (sContestResults->data->unkC[monId] == target) + targetReached = TRUE; - if (!endTask) + if (!targetReached) { - if (r4) - gUnknown_0203A034->unk0->unkC[r6] = r7; - else if (r12) - gUnknown_0203A034->unk0->unkC[r6] = gUnknown_0203A034->unk0->unkC[r6] - 1; + if (minMaxReached) + sContestResults->data->unkC[monId] = target; + else if (decreasing) + sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] - 1; else - gUnknown_0203A034->unk0->unkC[r6] = gUnknown_0203A034->unk0->unkC[r6] + 1; + sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] + 1; } - if (!r4 && !endTask) + if (!minMaxReached && !targetReached) { + u8 var0; + u16 tileNum; for (i = 0; i < 11; i++) { - if (gUnknown_0203A034->unk0->unkC[r6] >= (i + 1) * 8) + if (sContestResults->data->unkC[monId] >= (i + 1) * 8) var0 = 8; - else if (gUnknown_0203A034->unk0->unkC[r6] >= i * 8) - var0 = gUnknown_0203A034->unk0->unkC[r6] % 8; + else if (sContestResults->data->unkC[monId] >= i * 8) + var0 = sContestResults->data->unkC[monId] % 8; else var0 = 0; @@ -2077,54 +2136,58 @@ void sub_80F7CA8(u8 taskId) else tileNum = 0x5057 + var0; - FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, r6 * 3 + 6, 1, 1); + FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, monId * 3 + 6, 1, 1); } } - if (endTask) + if (targetReached) { - gUnknown_0203A034->unk0->unk14--; + sContestResults->data->numBarsUpdating--; DestroyTask(taskId); } } -static void sub_80F7DF4(void) +#undef tMonId +#undef tTarget +#undef tDecreasing + +static void AllocContestResults(void) { - gUnknown_0203A034 = AllocZeroed(sizeof(*gUnknown_0203A034)); - gUnknown_0203A034->unk0 = AllocZeroed(sizeof(*gUnknown_0203A034->unk0)); - gUnknown_0203A034->unk4 = AllocZeroed(sizeof(*gUnknown_0203A034->unk4)); - gUnknown_0203A034->unk8 = AllocZeroed(BG_SCREEN_SIZE); - gUnknown_0203A034->unkC[0] = AllocZeroed(BG_SCREEN_SIZE); - gUnknown_0203A034->unkC[1] = AllocZeroed(BG_SCREEN_SIZE); - gUnknown_0203A034->unkC[2] = AllocZeroed(BG_SCREEN_SIZE); - gUnknown_0203A034->unkC[3] = AllocZeroed(BG_SCREEN_SIZE); - gUnknown_0203A034->unk1C = AllocZeroed(0x1000); + sContestResults = AllocZeroed(sizeof(*sContestResults)); + sContestResults->data = AllocZeroed(sizeof(*sContestResults->data)); + sContestResults->monResults = AllocZeroed(sizeof(*sContestResults->monResults)); + sContestResults->unusedBg = AllocZeroed(BG_SCREEN_SIZE); + sContestResults->tilemapBuffers[0] = AllocZeroed(BG_SCREEN_SIZE); + sContestResults->tilemapBuffers[1] = AllocZeroed(BG_SCREEN_SIZE); + sContestResults->tilemapBuffers[2] = AllocZeroed(BG_SCREEN_SIZE); + sContestResults->tilemapBuffers[3] = AllocZeroed(BG_SCREEN_SIZE); + sContestResults->unused = AllocZeroed(0x1000); AllocateMonSpritesGfx(); } -static void sub_80F7E64(void) +static void FreeContestResults(void) { - FREE_AND_SET_NULL(gUnknown_0203A034->unk0); - FREE_AND_SET_NULL(gUnknown_0203A034->unk4); - FREE_AND_SET_NULL(gUnknown_0203A034->unk8); - FREE_AND_SET_NULL(gUnknown_0203A034->unkC[0]); - FREE_AND_SET_NULL(gUnknown_0203A034->unkC[1]); - FREE_AND_SET_NULL(gUnknown_0203A034->unkC[2]); - FREE_AND_SET_NULL(gUnknown_0203A034->unkC[3]); - FREE_AND_SET_NULL(gUnknown_0203A034->unk1C); - FREE_AND_SET_NULL(gUnknown_0203A034); + FREE_AND_SET_NULL(sContestResults->data); + FREE_AND_SET_NULL(sContestResults->monResults); + FREE_AND_SET_NULL(sContestResults->unusedBg); + FREE_AND_SET_NULL(sContestResults->tilemapBuffers[0]); + FREE_AND_SET_NULL(sContestResults->tilemapBuffers[1]); + FREE_AND_SET_NULL(sContestResults->tilemapBuffers[2]); + FREE_AND_SET_NULL(sContestResults->tilemapBuffers[3]); + FREE_AND_SET_NULL(sContestResults->unused); + FREE_AND_SET_NULL(sContestResults); FreeMonSpritesGfx(); } -static void sub_80F7ED0(int windowId, u8 *str, int arg2) +static void AddContestTextPrinter(int windowId, u8 *str, int x) { struct TextPrinterTemplate textPrinter; textPrinter.currentChar = str; textPrinter.windowId = windowId; textPrinter.fontId = 7; - textPrinter.x = arg2; + textPrinter.x = x; textPrinter.y = 2; - textPrinter.currentX = arg2; + textPrinter.currentX = x; textPrinter.currentY = 2; textPrinter.letterSpacing = 0; textPrinter.lineSpacing = 0; @@ -2276,20 +2339,14 @@ void GetContestMonCondition(void) void GetContestWinnerId(void) { u8 i; - - for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++) - ; - + GET_CONTEST_WINNER_ID(i); gSpecialVar_0x8005 = i; } void BufferContestWinnerTrainerName(void) { u8 i; - - for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++) - ; - + GET_CONTEST_WINNER_ID(i); StringCopy(gStringVar3, gContestMons[i].trainerName); sub_81DB5AC(gStringVar3); } @@ -2297,10 +2354,7 @@ void BufferContestWinnerTrainerName(void) void BufferContestWinnerMonName(void) { u8 i; - - for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++) - ; - + GET_CONTEST_WINNER_ID(i); StringCopy(gStringVar1, gContestMons[i].nickname); } @@ -2330,19 +2384,19 @@ void BufferContestantMonSpecies(void) gSpecialVar_0x8004 = gContestMons[gSpecialVar_0x8006].species; } -static void sub_80F8458(u8 taskId) +static void Task_StartShowContestResults(u8 taskId) { if (!gPaletteFade.active) { DestroyTask(taskId); - SetMainCallback2(sub_80F5B00); + SetMainCallback2(CB2_StartShowContestResults); } } -void sub_80F8484(void) +void ShowContestResults(void) { ScriptContext2_Enable(); - CreateTask(sub_80F8458, 10); + CreateTask(Task_StartShowContestResults, 10); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); } @@ -2351,7 +2405,7 @@ void GetContestPlayerId(void) gSpecialVar_0x8004 = gContestPlayerMonIndex; } -void sub_80F84C4(u8 taskId) +void ContestLinkTransfer(u8 taskId) { u8 newTaskId; ScriptContext2_Enable(); diff --git a/src/contest_link_80FC4F4.c b/src/contest_link_80FC4F4.c index d6cfea638..e17f62485 100644 --- a/src/contest_link_80FC4F4.c +++ b/src/contest_link_80FC4F4.c @@ -296,14 +296,14 @@ void sub_80FCACC(u8 taskId) case 0: if (IsLinkTaskFinished()) { - if (sub_80FC4F4(gUnknown_02039F08, sizeof(gUnknown_02039F08)) == 1) + if (sub_80FC4F4(gContestMonTotalPoints, sizeof(gContestMonTotalPoints)) == 1) gTasks[taskId].data[0]++; } break; case 1: if (sub_80FC55C()) { - memcpy(gUnknown_02039F08, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F08)); + memcpy(gContestMonTotalPoints, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonTotalPoints)); gTasks[taskId].data[0]++; } break; @@ -334,14 +334,14 @@ void sub_80FCACC(u8 taskId) case 6: if (IsLinkTaskFinished()) { - if (sub_80FC4F4(gUnknown_02039F18, sizeof(gUnknown_02039F18)) == 1) + if (sub_80FC4F4(gContestMonRound2Points, sizeof(gContestMonRound2Points)) == 1) gTasks[taskId].data[0]++; } break; case 7: if (sub_80FC55C()) { - memcpy(gUnknown_02039F18, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F18)); + memcpy(gContestMonRound2Points, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonRound2Points)); gTasks[taskId].data[0]++; } break; diff --git a/src/contest_painting.c b/src/contest_painting.c index 7f33cac09..5dd4a70a5 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -170,7 +170,7 @@ void SetContestWinnerForPainting(int contestWinnerId) u8 *ptr2 = &gUnknown_02039F5C; gCurContestWinner = gSaveBlock1Ptr->contestWinners[contestWinnerId - 1]; *ptr1 = contestWinnerId - 1; - *ptr2 = 0; + *ptr2 = FALSE; } void CB2_ContestPainting(void) @@ -281,7 +281,7 @@ static void InitContestPaintingWindow(void) ShowBg(1); } -static void PrintContestPaintingCaption(u8 contestType, u8 arg1) +static void PrintContestPaintingCaption(u8 contestType, bool8 arg1) { int x; u8 category; @@ -519,12 +519,14 @@ _081303F8:\n\ } #endif -static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1) +#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)]) + +static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 arg1) { u8 x, y; LoadPalette(gPictureFramePalettes, 0, 0x100); - if (arg1 == 1) + if (arg1 == TRUE) { switch (gContestPaintingWinner->contestCategory / 3) { @@ -550,8 +552,6 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1) break; } -#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)]) - // Set the background for (y = 0; y < 20; y++) { @@ -569,8 +569,6 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1) // Re-set the entire top row to the first top frame part for (x = 0; x < 16; x++) VRAM_PICTURE_DATA(x + 7, 2) = (*gContestMonPixels)[2][7]; - -#undef VRAM_PICTURE_DATA } else if (contestWinnerId < 8) { @@ -605,6 +603,8 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1) } } +#undef VRAM_PICTURE_DATA + static void InitPaintingMonOamData(u8 contestWinnerId) { //Some hacks just to get the asm to match @@ -692,7 +692,7 @@ static void DoContestPaintingImageProcessing(u8 imageEffect) LoadPalette(gContestPaintingMonPalette, 0x100, 0x200); } -static void CreateContestPaintingPicture(u8 contestWinnerId, u8 arg1) +static void CreateContestPaintingPicture(u8 contestWinnerId, bool8 arg1) { AllocPaintingResources(); InitContestMonPixels(gContestPaintingWinner->species, 0); diff --git a/src/field_specials.c b/src/field_specials.c index 818cd70db..e806440f7 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -4095,11 +4095,17 @@ void UpdateTrainerFanClubGameClear(void) } // If the player has < 3 fans, gain a new fan whenever the counter reaches 20+ -// Defeating Drake or participating in a Link Contest increments the counter by 2 +// Defeating Drake or participating in a Contest increments the counter by 2 // Participating at Battle Tower or in a Secret Base battle increments the counter by 1 u8 TryGainNewFanFromCounter(u8 incrementId) { - static const u8 sCounterIncrements[] = { 2, 1, 2, 1 }; + static const u8 sCounterIncrements[] = + { + [FANCOUNTER_DEFEATED_DRAKE] = 2, + [FANCOUNTER_BATTLED_AT_BASE] = 1, + [FANCOUNTER_FINISHED_CONTEST] = 2, + [FANCOUNTER_USED_BATTLE_TOWER] = 1 + }; if (VarGet(VAR_LILYCOVE_FAN_CLUB_STATE) == 2) { diff --git a/src/graphics.c b/src/graphics.c index b3327f4d2..29c6d572e 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -471,13 +471,11 @@ const u8 gTiles_8C19450[] = INCBIN_U8("graphics/contest/heart.4bpp"); const u32 gUnknownGfx_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.4bpp.lz"); const u32 gUnknownPal_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.gbapal.lz"); -const u32 gUnknown_08C19588[] = INCBIN_U32("graphics/contest/misc_2.4bpp.lz"); - +const u32 gContestResults_Gfx[] = INCBIN_U32("graphics/contest/results_screen.4bpp.lz"); const u32 gUnknown_08C19EEC[] = INCBIN_U32("graphics/contest/misc_2_tilemap_1.bin.lz"); const u32 gUnknown_08C1A000[] = INCBIN_U32("graphics/contest/misc_2_tilemap_2.bin.lz"); const u32 gUnknown_08C1A12C[] = INCBIN_U32("graphics/contest/misc_2_tilemap_3.bin.lz"); - -const u32 gUnknown_08C1A2B4[] = INCBIN_U32("graphics/contest/misc_2.gbapal.lz"); +const u32 gContestResults_Pal[] = INCBIN_U32("graphics/contest/results_screen.gbapal.lz"); const u32 gBattleAnimSpriteGfx_Impact[] = INCBIN_U32("graphics/battle_anims/sprites/impact.4bpp.lz"); const u32 gBattleAnimSpritePal_Impact[] = INCBIN_U32("graphics/battle_anims/sprites/impact.gbapal.lz"); @@ -1298,19 +1296,19 @@ const u8 gFireRedMenuElements_Gfx[] = INCBIN_U8("graphics/interface_fr/menu.4bpp const u8 gBagMenuHMIcon_Gfx[] = INCBIN_U8("graphics/interface/hm.4bpp"); -// contest link stuff, appears to be a set of tilemaps +// contest results screen -const u16 gUnknown_08DC63F8[] = INCBIN_U16("graphics/contest/clink_tilemap1.bin"); -const u16 gUnknown_08DC6420[] = INCBIN_U16("graphics/contest/clink_tilemap2.bin"); -const u16 gUnknown_08DC6448[] = INCBIN_U16("graphics/contest/clink_tilemap3.bin"); -const u16 gUnknown_08DC6470[] = INCBIN_U16("graphics/contest/clink_tilemap4.bin"); -const u16 gUnknown_08DC6498[] = INCBIN_U16("graphics/contest/clink_tilemap5.bin"); -const u16 gUnknown_08DC64AC[] = INCBIN_U16("graphics/contest/clink_tilemap6.bin"); -const u16 gUnknown_08DC64C0[] = INCBIN_U16("graphics/contest/clink_tilemap7.bin"); -const u16 gUnknown_08DC64D4[] = INCBIN_U16("graphics/contest/clink_tilemap8.bin"); -const u16 gUnknown_08DC64E8[] = INCBIN_U16("graphics/contest/clink_tilemap9.bin"); -const u16 gUnknown_08DC64FC[] = INCBIN_U16("graphics/contest/clink_tilemap10.bin"); -const u16 gUnknown_08DC6510[] = INCBIN_U16("graphics/contest/clink_tilemap11.bin"); +const u16 gNormalContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_normal.bin"); +const u16 gSuperContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_super.bin"); +const u16 gHyperContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_hyper.bin"); +const u16 gMasterContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_master.bin"); +const u16 gLinkContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_link.bin"); +const u16 gCoolContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_cool.bin"); +const u16 gBeautyContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_beauty.bin"); +const u16 gCuteContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_cute.bin"); +const u16 gSmartContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_smart.bin"); +const u16 gToughContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_tough.bin"); +const u16 gContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen.bin"); // pokenav diff --git a/src/scrcmd.c b/src/scrcmd.c index 9e62c45c5..9c00c3bc8 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1469,7 +1469,9 @@ bool8 ScrCmd_hidemonpic(struct ScriptContext *ctx) bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx) { u8 contestWinnerId = ScriptReadByte(ctx); - if (contestWinnerId) + + // Don't save artist's painting yet + if (contestWinnerId != CONTEST_WINNER_ARTIST) SetContestWinnerForPainting(contestWinnerId); ShowContestWinner(); @@ -1953,14 +1955,14 @@ bool8 ScrCmd_startcontest(struct ScriptContext *ctx) bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx) { - sub_80F8484(); + ShowContestResults(); ScriptContext1_Stop(); return TRUE; } bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx) { - sub_80F84C4(gSpecialVar_ContestCategory); + ContestLinkTransfer(gSpecialVar_ContestCategory); ScriptContext1_Stop(); return TRUE; } diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index 134004fd0..62b445a04 100755 --- a/src/script_pokemon_util_80F87D8.c +++ b/src/script_pokemon_util_80F87D8.c @@ -122,7 +122,7 @@ void ShouldReadyContestArtist(void) { if (gContestFinalStandings[gContestPlayerMonIndex] == 0 && gSpecialVar_ContestRank == CONTEST_RANK_MASTER - && gUnknown_02039F08[gContestPlayerMonIndex] >= 800) + && gContestMonTotalPoints[gContestPlayerMonIndex] >= 800) { gSpecialVar_0x8004 = TRUE; } @@ -304,7 +304,7 @@ u8 GiveMonArtistRibbon(void) if (!hasArtistRibbon && gContestFinalStandings[gContestPlayerMonIndex] == 0 && gSpecialVar_ContestRank == CONTEST_RANK_MASTER - && gUnknown_02039F08[gContestPlayerMonIndex] >= 800) + && gContestMonTotalPoints[gContestPlayerMonIndex] >= 800) { hasArtistRibbon = 1; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_ARTIST_RIBBON, &hasArtistRibbon); diff --git a/src/secret_base.c b/src/secret_base.c index 172568db6..83626710f 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -37,6 +37,7 @@ #include "constants/event_bg.h" #include "constants/decorations.h" #include "constants/event_objects.h" +#include "constants/field_specials.h" #include "constants/items.h" #include "constants/maps.h" #include "constants/map_types.h" @@ -1120,7 +1121,7 @@ const u8 *GetSecretBaseTrainerLoseText(void) void PrepSecretBaseBattleFlags(void) { - TryGainNewFanFromCounter(1); + TryGainNewFanFromCounter(FANCOUNTER_BATTLED_AT_BASE); gTrainerBattleOpponent_A = TRAINER_SECRET_BASE; gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_SECRET_BASE; } diff --git a/src/strings.c b/src/strings.c index 3ca7f693f..d57b600d6 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1236,7 +1236,7 @@ const u8 gText_BDot[] = _("B."); const u8 gText_AnnouncingResults[] = _("Announcing the results!"); const u8 gText_PreliminaryResults[] = _("The preliminary results!"); const u8 gText_Round2Results[] = _("Round 2 results!"); -const u8 gText_Var1sVar2Won[] = _("{STR_VAR_1}'s {STR_VAR_2} won!"); +const u8 gText_ContestantsMonWon[] = _("{STR_VAR_1}'s {STR_VAR_2} won!"); const u8 gText_CommunicationStandby[] = _("Communication standby…"); const u8 gText_ColorDarkGrey[] = _("{COLOR DARK_GREY}"); const u8 gText_ColorDynamic6WhiteDynamic5[] = _("{COLOR_HIGHLIGHT_SHADOW DYNAMIC_COLOR6 WHITE DYNAMIC_COLOR5}"); // Unused