From e98e4652fd252edfde79155d21ee55a80a1f94ce Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 16 Aug 2020 05:07:44 -0400 Subject: [PATCH] Document contest live updates --- data/text/tv.inc | 66 ++-- include/constants/tv.h | 54 +++ include/contest.h | 27 +- include/event_scripts.h | 66 ++-- include/global.tv.h | 20 +- include/tv.h | 10 +- src/contest.c | 418 ++++++++++++----------- src/tv.c | 729 ++++++++++++++++++++-------------------- 8 files changed, 732 insertions(+), 658 deletions(-) diff --git a/data/text/tv.inc b/data/text/tv.inc index 63a1eff65..6f678d824 100644 --- a/data/text/tv.inc +++ b/data/text/tv.inc @@ -2436,7 +2436,7 @@ gTVSafariFanClubText10:: @ 08289D33 .string "and make the challenge yourself!\p" .string "Until next time, cheerio!$" -gTVContestLiveUpdatesText00:: @ 08289DD6 +ContestLiveUpdates_Text_Intro:: @ 08289DD6 .string "“POKéMON CONTEST LIVE UPDATES!”\p" .string "MC: Thanks for joining us!\p" .string "We're live from the just-ended\n" @@ -2455,117 +2455,117 @@ gTVContestLiveUpdatesText00:: @ 08289DD6 .string "MC: Let's hear what the fans have\n" .string "to say about this CONTEST.$" -gTVContestLiveUpdatesText01:: @ 08289F53 +ContestLiveUpdates_Text_WonBothRounds:: @ 08289F53 .string "Spectator: The {STR_VAR_2} was tops in\n" .string "both primary and secondary judging!\p" .string "That {STR_VAR_2} will keep winning!$" -gTVContestLiveUpdatesText02:: @ 08289FB0 +ContestLiveUpdates_Text_BetterRound2:: @ 08289FB0 .string "Spectator: The {STR_VAR_2} didn't do\n" .string "well in the primary judging, but it\l" .string "cleaned up in the secondary judging!\p" .string "It was a miraculous comeback\n" .string "for that {STR_VAR_2}. Yippee!$" -gTVContestLiveUpdatesText03:: @ 0828A047 +ContestLiveUpdates_Text_EqualRounds:: @ 0828A047 .string "Spectator: The {STR_VAR_2} remained\n" .string "consistent throughout both primary\l" .string "and secondary judging.\p" .string "{STR_VAR_3} and the {STR_VAR_2},\n" .string "they're no ordinary combo!$" -gTVContestLiveUpdatesText04:: @ 0828A0C6 +ContestLiveUpdates_Text_BetterRound1:: @ 0828A0C6 .string "Spectator: In terms of being {STR_VAR_1},\n" .string "that {STR_VAR_2} was outstanding.\p" .string "I hope it makes better appeals\n" .string "next time, though.$" -gTVContestLiveUpdatesText05:: @ 0828A132 +ContestLiveUpdates_Text_GotNervous:: @ 0828A132 .string "Spectator: When the {STR_VAR_2} got\n" .string "nervous, I couldn't stop myself from\l" .string "shouting encouragement.\p" .string "I'd like to say this to that\n" .string "{STR_VAR_2}, “Congratulations!”$" -gTVContestLiveUpdatesText06:: @ 0828A1BE +ContestLiveUpdates_Text_StartledFoes:: @ 0828A1BE .string "Spectator: That {STR_VAR_2}'s appeal\n" .string "startled even me!\p" .string "{STR_VAR_2}, you were awesome!$" -gTVContestLiveUpdatesText07:: @ 0828A202 +ContestLiveUpdates_Text_UsedCombo:: @ 0828A202 .string "Spectator: That {STR_VAR_2}'s combo\n" .string "appeal was stunning!\p" .string "It's shaken me to the core!$" -gTVContestLiveUpdatesText08:: @ 0828A24E +ContestLiveUpdates_Text_ExcitingAppeal:: @ 0828A24E .string "Spectator: The winning {STR_VAR_2}'s\n" .string "appeal got my heart pounding!$" -gTVContestLiveUpdatesText09:: @ 0828A288 +ContestLiveUpdates_Text_WasCool:: @ 0828A288 .string "{STR_VAR_2}!\n" .string "You were cool!$" -gTVContestLiveUpdatesText10:: @ 0828A29B +ContestLiveUpdates_Text_WasBeautiful:: @ 0828A29B .string "{STR_VAR_2}!\n" .string "You were beautiful!$" -gTVContestLiveUpdatesText11:: @ 0828A2B3 +ContestLiveUpdates_Text_WasCute:: @ 0828A2B3 .string "{STR_VAR_2}!\n" .string "You were cute!$" -gTVContestLiveUpdatesText12:: @ 0828A2C6 +ContestLiveUpdates_Text_WasSmart:: @ 0828A2C6 .string "{STR_VAR_2}!\n" .string "You were smart!$" -gTVContestLiveUpdatesText13:: @ 0828A2DA +ContestLiveUpdates_Text_WasTough:: @ 0828A2DA .string "{STR_VAR_2}!\n" .string "You were tough!$" -gTVContestLiveUpdatesText14:: @ 0828A2EE +ContestLiveUpdates_Text_VeryExcitingAppeal:: @ 0828A2EE .string "Spectator: The winning {STR_VAR_2}'s\n" .string "appeal still has my heart pounding!$" -gTVContestLiveUpdatesText15:: @ 0828A32E +ContestLiveUpdates_Text_VeryCool:: @ 0828A32E .string "{STR_VAR_2}!\n" .string "You're the last word in cool!$" -gTVContestLiveUpdatesText16:: @ 0828A350 +ContestLiveUpdates_Text_VeryBeautiful:: @ 0828A350 .string "{STR_VAR_2}!\n" .string "You're the most beautiful!$" -gTVContestLiveUpdatesText17:: @ 0828A36F +ContestLiveUpdates_Text_VeryCute:: @ 0828A36F .string "{STR_VAR_2}!\n" .string "You're simply the cutest!$" -gTVContestLiveUpdatesText18:: @ 0828A38D +ContestLiveUpdates_Text_VerySmart:: @ 0828A38D .string "{STR_VAR_2}!\n" .string "You're the smartest among the smart!$" -gTVContestLiveUpdatesText19:: @ 0828A3B6 +ContestLiveUpdates_Text_VeryTough:: @ 0828A3B6 .string "{STR_VAR_2}!\n" .string "You're the toughest of the tough!$" -gTVContestLiveUpdatesText20:: @ 0828A3DC +ContestLiveUpdates_Text_TookBreak:: @ 0828A3DC .string "Spectator: Even when the {STR_VAR_2}\n" .string "took a break from making appeals,\l" .string "I couldn't take my eyes off it.\p" .string "I'm captivated by that {STR_VAR_2}.$" -gTVContestLiveUpdatesText21:: @ 0828A455 +ContestLiveUpdates_Text_GotStartled:: @ 0828A455 .string "Spectator: When the {STR_VAR_2} was\n" .string "startled by another POKéMON's appeal,\l" .string "I was close to tears.\p" .string "{STR_VAR_2}, you were resilient!\n" .string "Way to go!$" -gTVContestLiveUpdatesText22:: @ 0828A4CF +ContestLiveUpdates_Text_MoveWonderful:: @ 0828A4CF .string "Spectator: Oh…\n" .string "That {STR_VAR_2}'s {STR_VAR_3}!\l" .string "{STR_VAR_2}'s {STR_VAR_3}!\l" .string "{STR_VAR_2}'s {STR_VAR_3}!\l" .string "How could it be so wonderful?$" -gTVContestLiveUpdatesText23:: @ 0828A51C +ContestLiveUpdates_Text_TalkAboutAnotherMon:: @ 0828A51C .string "MC: Well, there you have it. This place\n" .string "is full of the {STR_VAR_1}'s fans!\p" .string "I should also mention that another\n" @@ -2573,20 +2573,20 @@ gTVContestLiveUpdatesText23:: @ 0828A51C .string "caught my eye.\p" .string "{STR_VAR_2}'s {STR_VAR_3}…$" -gTVContestLiveUpdatesText24:: @ 0828A5AC +ContestLiveUpdates_Text_FailedToAppeal:: @ 0828A5AC .string "It failed to make a single appeal during\n" .string "secondary judging out of nervousness.\p" .string "Next time, I would like to see this\n" .string "{STR_VAR_1} make even one appeal.$" -gTVContestLiveUpdatesText25:: @ 0828A638 +ContestLiveUpdates_Text_LastInBothRounds:: @ 0828A638 .string "It came dead last in both primary\n" .string "and secondary judging.\p" .string "I hope that {STR_VAR_1} will retrain this\n" .string "{STR_VAR_2} and erase the shame of\l" .string "this undisputed last-place finish.$" -gTVContestLiveUpdatesText26:: @ 0828A6CF +ContestLiveUpdates_Text_NotExcitingEnough:: @ 0828A6CF .string "It failed to take advantage of\n" .string "the audience's excitement and make\l" .string "an appropriate appeal.\p" @@ -2594,7 +2594,7 @@ gTVContestLiveUpdatesText26:: @ 0828A6CF .string "a feel for the audience and whip their\l" .string "excitement to a fever pitch next time.$" -gTVContestLiveUpdatesText27:: @ 0828A797 +ContestLiveUpdates_Text_LostAfterWinningRound1:: @ 0828A797 .string "While finishing first in the primary\n" .string "judging, its appeals in the secondary\l" .string "judging failed to click.\p" @@ -2603,14 +2603,14 @@ gTVContestLiveUpdatesText27:: @ 0828A797 .string "I'm sure {STR_VAR_1} is studying how to\n" .string "make more effective appeals now.$" -gTVContestLiveUpdatesText28:: @ 0828A86D +ContestLiveUpdates_Text_NeverExciting:: @ 0828A86D .string "The audience never got excited by its\n" .string "appeals during the secondary judging.\p" .string "We hope it will stop worrying about\n" .string "other POKéMON and learn to pitch\l" .string "its appeals to the audience more.$" -gTVContestLiveUpdatesText29:: @ 0828A920 +ContestLiveUpdates_Text_LostBySmallMargin:: @ 0828A920 .string "It lost to {STR_VAR_1}'s {STR_VAR_2}\n" .string "by only a small margin.\p" .string "It must be heartbreaking to come\n" @@ -2618,7 +2618,7 @@ gTVContestLiveUpdatesText29:: @ 0828A920 .string "I wouldn't be surprised if {STR_VAR_3}\n" .string "were weeping over this outcome.$" -gTVContestLiveUpdatesText30:: @ 0828A9CC +ContestLiveUpdates_Text_RepeatedAppeals:: @ 0828A9CC .string "It disappointed the JUDGE by\n" .string "repeating the same appeals.\p" .string "It's an unforgivable error in any\n" @@ -2626,14 +2626,14 @@ gTVContestLiveUpdatesText30:: @ 0828A9CC .string "{STR_VAR_1} should feel guilty for\n" .string "this sorry showing.$" -gTVContestLiveUpdatesText31:: @ 0828AA74 +ContestLiveUpdates_Text_ValiantEffortButLost:: @ 0828AA74 .string "{STR_VAR_1} turned in a valiant effort,\n" .string "but…\p" .string "It was all for naught, finishing last.\p" .string "{STR_VAR_1} should learn from this loss\n" .string "and put the knowledge to good use.$" -gTVContestLiveUpdatesText32:: @ 0828AB01 +ContestLiveUpdates_Text_Outro:: @ 0828AB01 .string "I'd like to end this program with our\n" .string "usual farewell to the winners.\p" .string "This time, it's {STR_VAR_1} and\n" diff --git a/include/constants/tv.h b/include/constants/tv.h index 6f686f727..4b5f9115b 100644 --- a/include/constants/tv.h +++ b/include/constants/tv.h @@ -133,5 +133,59 @@ #define NUM_SECRET_BASE_FLAGS 32 // by definition, bitfield of 2 u16s +// TV Show states for Pokemon Contest Live Updates +#define CONTESTLIVE_STATE_INTRO 0 +#define CONTESTLIVE_STATE_WON_BOTH_ROUNDS 1 +#define CONTESTLIVE_STATE_BETTER_ROUND2 2 +#define CONTESTLIVE_STATE_EQUAL_ROUNDS 3 +#define CONTESTLIVE_STATE_BETTER_ROUND1 4 +#define CONTESTLIVE_STATE_GOT_NERVOUS 5 +#define CONTESTLIVE_STATE_STARTLED_OTHER 6 +#define CONTESTLIVE_STATE_USED_COMBO 7 +#define CONTESTLIVE_STATE_EXCITING_APPEAL 8 +#define CONTESTLIVE_STATE_COOL 9 +#define CONTESTLIVE_STATE_BEAUTIFUL 10 +#define CONTESTLIVE_STATE_CUTE 11 +#define CONTESTLIVE_STATE_SMART 12 +#define CONTESTLIVE_STATE_TOUGH 13 +#define CONTESTLIVE_STATE_VERY_EXCITING_APPEAL 14 +#define CONTESTLIVE_STATE_VERY_COOL 15 +#define CONTESTLIVE_STATE_VERY_BEAUTIFUL 16 +#define CONTESTLIVE_STATE_VERY_CUTE 17 +#define CONTESTLIVE_STATE_VERY_SMART 18 +#define CONTESTLIVE_STATE_VERY_TOUGH 19 +#define CONTESTLIVE_STATE_TOOK_BREAK 20 +#define CONTESTLIVE_STATE_GOT_STARTLED 21 +#define CONTESTLIVE_STATE_USED_MOVE 22 +#define CONTESTLIVE_STATE_TALK_ABOUT_LOSER 23 +#define CONTESTLIVE_STATE_NO_APPEALS 24 +#define CONTESTLIVE_STATE_LAST_BOTH 25 +#define CONTESTLIVE_STATE_NOT_EXCITING_ENOUGH 26 +#define CONTESTLIVE_STATE_LOST_AFTER_ROUND1_WIN 27 +#define CONTESTLIVE_STATE_NO_EXCITING_APPEALS 28 +#define CONTESTLIVE_STATE_LOST_SMALL_MARGIN 29 +#define CONTESTLIVE_STATE_REPEATED_APPEALS 30 +#define CONTESTLIVE_STATE_LOST 31 +#define CONTESTLIVE_STATE_OUTRO 32 + +// Flags used to comment on winner +#define CONTESTLIVE_FLAG_EXCITING_APPEAL (1 << 0) +#define CONTESTLIVE_FLAG_GOT_NERVOUS (1 << 1) +#define CONTESTLIVE_FLAG_MAXED_EXCITEMENT (1 << 2) +#define CONTESTLIVE_FLAG_USED_COMBO (1 << 3) +#define CONTESTLIVE_FLAG_STARTLED_OTHER (1 << 4) +#define CONTESTLIVE_FLAG_SKIPPED_TURN (1 << 5) +#define CONTESTLIVE_FLAG_GOT_STARTLED (1 << 6) +#define CONTESTLIVE_FLAG_MADE_APPEAL (1 << 7) + +// Flags used to comment on loser +#define CONTESTLIVE_FLAG_LOST (1 << 0) +#define CONTESTLIVE_FLAG_REPEATED_MOVE (1 << 1) +#define CONTESTLIVE_FLAG_LOST_SMALL_MARGIN (1 << 2) +#define CONTESTLIVE_FLAG_NO_EXCITEMENT (1 << 3) +#define CONTESTLIVE_FLAG_BLEW_LEAD (1 << 4) +#define CONTESTLIVE_FLAG_MISSED_EXCITEMENT (1 << 5) +#define CONTESTLIVE_FLAG_LAST_BOTH_ROUNDS (1 << 6) +#define CONTESTLIVE_FLAG_NO_APPEALS (1 << 7) #endif //GUARD_CONSTANTS_TV_H diff --git a/include/contest.h b/include/contest.h index 208604f4a..834aba402 100644 --- a/include/contest.h +++ b/include/contest.h @@ -4,17 +4,6 @@ #include "palette.h" #include "constants/contest.h" -enum -{ - CONTEST_DEBUG_MODE_OFF, - // Prints the totalPoints value for each contestant. - CONTEST_DEBUG_MODE_PRINT_POINT_TOTAL, - // Prints the ContestTV::unk_C value as a bitstring for each contestant. - CONTEST_DEBUG_MODE_PRINT_UNK_C, - // Prints the ContestTV::unk_D value as a bitstring for each contestant. - CONTEST_DEBUG_MODE_PRINT_UNK_D -}; - enum { CONTEST_STRING_MORE_CONSCIOUS, @@ -153,7 +142,7 @@ struct Contest u8 mainTaskId; u8 unk1920D[4]; u8 judgeAttentionTaskId; - u8 unk19212; + u8 blendTaskId; u8 filler19213; u8 turnNumber; u8 currentContestant; @@ -211,7 +200,7 @@ struct ContestantStatus bool8 usedComboMove:1; bool8 completedCombo; u8 comboAppealBonus; - u8 unk18; + u8 repeatJam; u8 nextTurnOrder; // turn position u8 attentionLevel; // How much the Pokemon "stood out" u8 contestantAnimTarget; @@ -271,12 +260,12 @@ struct ContestFinalStandings struct ContestTV { - u16 unk0[5]; - s16 unkA; - u8 unkC; - u8 unkD; - u8 unkE_1:1; - u8 unkE_2:1; + u16 appeals[CONTEST_NUM_APPEALS]; + s16 move; + u8 winnerFlags; + u8 loserFlags; + u8 madeAppeal:1; + u8 madeExcitingAppeal:1; }; struct ContestUnused diff --git a/include/event_scripts.h b/include/event_scripts.h index d147dd4f1..6ec9107a7 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -294,39 +294,39 @@ extern const u8 gTVSafariFanClubText07[]; extern const u8 gTVSafariFanClubText08[]; extern const u8 gTVSafariFanClubText09[]; extern const u8 gTVSafariFanClubText10[]; -extern const u8 gTVContestLiveUpdatesText00[]; -extern const u8 gTVContestLiveUpdatesText01[]; -extern const u8 gTVContestLiveUpdatesText02[]; -extern const u8 gTVContestLiveUpdatesText03[]; -extern const u8 gTVContestLiveUpdatesText04[]; -extern const u8 gTVContestLiveUpdatesText05[]; -extern const u8 gTVContestLiveUpdatesText06[]; -extern const u8 gTVContestLiveUpdatesText07[]; -extern const u8 gTVContestLiveUpdatesText08[]; -extern const u8 gTVContestLiveUpdatesText09[]; -extern const u8 gTVContestLiveUpdatesText10[]; -extern const u8 gTVContestLiveUpdatesText11[]; -extern const u8 gTVContestLiveUpdatesText12[]; -extern const u8 gTVContestLiveUpdatesText13[]; -extern const u8 gTVContestLiveUpdatesText14[]; -extern const u8 gTVContestLiveUpdatesText15[]; -extern const u8 gTVContestLiveUpdatesText16[]; -extern const u8 gTVContestLiveUpdatesText17[]; -extern const u8 gTVContestLiveUpdatesText18[]; -extern const u8 gTVContestLiveUpdatesText19[]; -extern const u8 gTVContestLiveUpdatesText20[]; -extern const u8 gTVContestLiveUpdatesText21[]; -extern const u8 gTVContestLiveUpdatesText22[]; -extern const u8 gTVContestLiveUpdatesText23[]; -extern const u8 gTVContestLiveUpdatesText24[]; -extern const u8 gTVContestLiveUpdatesText25[]; -extern const u8 gTVContestLiveUpdatesText26[]; -extern const u8 gTVContestLiveUpdatesText27[]; -extern const u8 gTVContestLiveUpdatesText28[]; -extern const u8 gTVContestLiveUpdatesText29[]; -extern const u8 gTVContestLiveUpdatesText30[]; -extern const u8 gTVContestLiveUpdatesText31[]; -extern const u8 gTVContestLiveUpdatesText32[]; +extern const u8 ContestLiveUpdates_Text_Intro[]; +extern const u8 ContestLiveUpdates_Text_WonBothRounds[]; +extern const u8 ContestLiveUpdates_Text_BetterRound2[]; +extern const u8 ContestLiveUpdates_Text_EqualRounds[]; +extern const u8 ContestLiveUpdates_Text_BetterRound1[]; +extern const u8 ContestLiveUpdates_Text_GotNervous[]; +extern const u8 ContestLiveUpdates_Text_StartledFoes[]; +extern const u8 ContestLiveUpdates_Text_UsedCombo[]; +extern const u8 ContestLiveUpdates_Text_ExcitingAppeal[]; +extern const u8 ContestLiveUpdates_Text_WasCool[]; +extern const u8 ContestLiveUpdates_Text_WasBeautiful[]; +extern const u8 ContestLiveUpdates_Text_WasCute[]; +extern const u8 ContestLiveUpdates_Text_WasSmart[]; +extern const u8 ContestLiveUpdates_Text_WasTough[]; +extern const u8 ContestLiveUpdates_Text_VeryExcitingAppeal[]; +extern const u8 ContestLiveUpdates_Text_VeryCool[]; +extern const u8 ContestLiveUpdates_Text_VeryBeautiful[]; +extern const u8 ContestLiveUpdates_Text_VeryCute[]; +extern const u8 ContestLiveUpdates_Text_VerySmart[]; +extern const u8 ContestLiveUpdates_Text_VeryTough[]; +extern const u8 ContestLiveUpdates_Text_TookBreak[]; +extern const u8 ContestLiveUpdates_Text_GotStartled[]; +extern const u8 ContestLiveUpdates_Text_MoveWonderful[]; +extern const u8 ContestLiveUpdates_Text_TalkAboutAnotherMon[]; +extern const u8 ContestLiveUpdates_Text_FailedToAppeal[]; +extern const u8 ContestLiveUpdates_Text_LastInBothRounds[]; +extern const u8 ContestLiveUpdates_Text_NotExcitingEnough[]; +extern const u8 ContestLiveUpdates_Text_LostAfterWinningRound1[]; +extern const u8 ContestLiveUpdates_Text_NeverExciting[]; +extern const u8 ContestLiveUpdates_Text_LostBySmallMargin[]; +extern const u8 ContestLiveUpdates_Text_RepeatedAppeals[]; +extern const u8 ContestLiveUpdates_Text_ValiantEffortButLost[]; +extern const u8 ContestLiveUpdates_Text_Outro[]; extern const u8 gTVPokemonBattleUpdateText00[]; extern const u8 gTVPokemonBattleUpdateText01[]; extern const u8 gTVPokemonBattleUpdateText02[]; diff --git a/include/global.tv.h b/include/global.tv.h index ba1c3c37e..b211052e0 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -124,18 +124,18 @@ typedef union // size = 0x24 struct { /*0x00*/ u8 kind; /*0x01*/ bool8 active; - /*0x02*/ u16 winningSpecies; - /*0x04*/ u8 winningTrainerName[8]; - /*0x0C*/ u8 appealFlags2; - /*0x0D*/ u8 round1Rank; - /*0x0e*/ u8 round2Rank; - /*0x0f*/ u8 appealFlags1; + /*0x02*/ u16 losingSpecies; + /*0x04*/ u8 losingTrainerName[8]; + /*0x0C*/ u8 loserAppealFlag; + /*0x0D*/ u8 round1Placing; + /*0x0e*/ u8 round2Placing; + /*0x0f*/ u8 winnerAppealFlag; /*0x10*/ u16 move; - /*0x12*/ u16 species; - /*0x14*/ u8 playerName[8]; + /*0x12*/ u16 winningSpecies; + /*0x14*/ u8 winningTrainerName[8]; /*0x1C*/ u8 category; - /*0x1D*/ u8 language; - /*0x1E*/ u8 winningTrainerLanguage; + /*0x1D*/ u8 winningTrainerLanguage; + /*0x1E*/ u8 losingTrainerLanguage; } contestLiveUpdates; // TVSHOW_3_CHEERS_FOR_POKEBLOCKS diff --git a/include/tv.h b/include/tv.h index 8e9233c2b..4b5aceb55 100644 --- a/include/tv.h +++ b/include/tv.h @@ -59,11 +59,11 @@ void SaveRecordedItemPurchasesForTVShow(void); bool8 ShouldAirFrontierTVShow(void); void sub_80EE8C8(u16 winStreak, u8 facilityAndMode); void BravoTrainerPokemonProfile_BeforeInterview2(u8 contestStandingPlace); -void ContestLiveUpdates_BeforeInterview_1(u8 a0); -void ContestLiveUpdates_BeforeInterview_2(u8 a0); -void ContestLiveUpdates_BeforeInterview_3(u8 a0); -void ContestLiveUpdates_BeforeInterview_4(u16 a0); -void ContestLiveUpdates_BeforeInterview_5(u8 a0, u8 a1); +void ContestLiveUpdates_Init(u8 round1Placing); +void ContestLiveUpdates_SetRound2Placing(u8 round2Placing); +void ContestLiveUpdates_SetWinnerAppealFlag(u8 flag); +void ContestLiveUpdates_SetWinnerMoveUsed(u16 move); +void ContestLiveUpdates_SetLoserData(u8 flag, u8 loser); void ResetGabbyAndTy(void); #endif //GUARD_TV_H diff --git a/src/contest.c b/src/contest.c index 49b408a1a..d734b9eb4 100644 --- a/src/contest.c +++ b/src/contest.c @@ -2,12 +2,6 @@ #include "gpu_regs.h" #include "bg.h" #include "malloc.h" -#include "constants/items.h" -#include "constants/event_objects.h" -#include "constants/moves.h" -#include "constants/songs.h" -#include "constants/species.h" -#include "constants/flags.h" #include "battle.h" #include "battle_anim.h" #include "contest.h" @@ -42,8 +36,15 @@ #include "contest_link.h" #include "international_string_util.h" #include "data.h" -#include "constants/rgb.h" #include "contest_ai.h" +#include "constants/event_objects.h" +#include "constants/flags.h" +#include "constants/items.h" +#include "constants/moves.h" +#include "constants/rgb.h" +#include "constants/songs.h" +#include "constants/species.h" +#include "constants/tv.h" // This file's functions. static void LoadContestPalettes(void); @@ -113,7 +114,7 @@ static void SetBottomSliderHeartsInvisibility(bool8); static void CreateNextTurnSprites(void); static void CreateApplauseMeterSprite(void); static void CreateJudgeAttentionEyeTask(void); -static void sub_80DC7EC(void); +static void CreateUnusedBlendTask(void); static void ContestDebugDoPrint(void); static void DrawContestantWindows(void); static void ApplyNextTurnOrder(void); @@ -164,9 +165,9 @@ static void Task_UpdateAppealHearts(u8); static void SpriteCB_UpdateHeartSlider(struct Sprite *); static void Task_FlashJudgeAttentionEye(u8); static void Task_StopFlashJudgeAttentionEye(u8); -static void sub_80DC8D0(u8); -static void sub_80DC81C(u8); -static void sub_80DC87C(u8); +static void Task_UnusedBlend(u8); +static void InitUnusedBlendTaskData(u8); +static void UpdateBlendTaskContestantData(u8); static void SpriteCB_BlinkContestantBox(struct Sprite *); static void SpriteCB_EndBlinkContestantBox(struct Sprite *sprite); static u8 StartApplauseOverflowAnimation(void); @@ -183,9 +184,9 @@ static void Task_WaitRaiseCurtainAtRoundEnd(u8); static void Task_StartRaiseCurtainAtRoundEnd(u8); static void Task_WaitForSliderHeartAnim(u8); static void SetBattleTargetSpritePosition(void); -static void sub_80DF250(void); -static void sub_80DF4F8(void); -static void sub_80DF080(u8); +static void CalculateContestLiveUpdateData(void); +static void SetConestLiveUpdateTVData(void); +static void SetContestLiveUpdateFlags(u8); static void ContestDebugPrintBitStrings(void); static void StripPlayerNameForLinkContest(u8 *); static void StripMonNameForLinkContest(u8 *, s32); @@ -233,6 +234,13 @@ enum { STAT_SYMBOL_SQUARE, }; +enum { + CONTEST_DEBUG_MODE_OFF, + CONTEST_DEBUG_MODE_PRINT_POINT_TOTAL, + CONTEST_DEBUG_MODE_PRINT_WINNER_FLAGS, + CONTEST_DEBUG_MODE_PRINT_LOSER_FLAGS +}; + #define MOVE_WINDOWS_START WIN_MOVE0 #define TAG_CONTEST_SYMBOLS_PAL 0xABE0 @@ -964,9 +972,9 @@ void LoadContestBgAfterMoveAnim(void) LoadContestPalettes(); for (i = 0; i < CONTESTANT_COUNT; i++) { - u32 contestantWindowId = MOVE_WINDOWS_START + i; + u32 contestantWindowId = 5 + i; - LoadPalette(eUnknownHeap1A004.cachedWindowPalettes[contestantWindowId], 16 * (MOVE_WINDOWS_START + gContestantTurnOrder[i]), sizeof((eUnknownHeap1A004.cachedWindowPalettes[contestantWindowId]))); + LoadPalette(eUnknownHeap1A004.cachedWindowPalettes[contestantWindowId], 16 * (5 + gContestantTurnOrder[i]), sizeof((eUnknownHeap1A004.cachedWindowPalettes[contestantWindowId]))); } } @@ -1257,9 +1265,9 @@ static bool8 SetupContestGraphics(u8 *stateVar) case 5: LoadCompressedPalette(gOldContestPalette, 0, 0x200); CpuCopy32(gPlttBufferUnfaded + 128, tempPalette1, 16 * sizeof(u16)); - CpuCopy32(gPlttBufferUnfaded + (MOVE_WINDOWS_START + gContestPlayerMonIndex) * 16, tempPalette2, 16 * sizeof(u16)); + CpuCopy32(gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, tempPalette2, 16 * sizeof(u16)); CpuCopy32(tempPalette2, gPlttBufferUnfaded + 128, 16 * sizeof(u16)); - CpuCopy32(tempPalette1, gPlttBufferUnfaded + (MOVE_WINDOWS_START + gContestPlayerMonIndex) * 16, 16 * sizeof(u16)); + CpuCopy32(tempPalette1, gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, 16 * sizeof(u16)); DmaCopy32Defvars(3, gPlttBufferUnfaded, eUnknownHeap1A004.cachedWindowPalettes, sizeof(eUnknownHeap1A004.cachedWindowPalettes)); LoadContestPalettes(); break; @@ -1272,7 +1280,7 @@ static bool8 SetupContestGraphics(u8 *stateVar) CreateNextTurnSprites(); CreateApplauseMeterSprite(); CreateJudgeAttentionEyeTask(); - sub_80DC7EC(); + CreateUnusedBlendTask(); gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT; @@ -1591,7 +1599,7 @@ static void Task_HideMoveSelectScreen(u8 taskId) gBattle_BG2_Y = 0; SetBottomSliderHeartsInvisibility(FALSE); - for (i = 0; i < CONTESTANT_COUNT; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { FillWindowPixelBuffer(MOVE_WINDOWS_START + i, PIXEL_FILL(0)); PutWindowTilemap(MOVE_WINDOWS_START + i); @@ -1751,7 +1759,7 @@ static void Task_DoAppeals(u8 taskId) gTasks[taskId].tState = APPEALSTATE_2; return; case APPEALSTATE_2: - sub_80DF080(contestant); + SetContestLiveUpdateFlags(contestant); ContestDebugPrintBitStrings(); if (eContestantStatus[contestant].numTurnsSkipped != 0 || eContestantStatus[contestant].noMoreTurns) @@ -2170,8 +2178,8 @@ static void Task_DoAppeals(u8 taskId) case APPEALSTATE_UPDATE_HEARTS_FROM_REPEAT: if (!Contest_RunTextPrinters()) { - UpdateAppealHearts(eContestantStatus[contestant].appeal2, -eContestantStatus[contestant].unk18, contestant); - eContestantStatus[contestant].appeal2 -= eContestantStatus[contestant].unk18; + UpdateAppealHearts(eContestantStatus[contestant].appeal2, -eContestantStatus[contestant].repeatJam, contestant); + eContestantStatus[contestant].appeal2 -= eContestantStatus[contestant].repeatJam; gTasks[taskId].tState = APPEALSTATE_WAIT_HEARTS_FROM_REPEAT; } return; @@ -2659,8 +2667,8 @@ static void Task_EndAppeals(u8 taskId) BravoTrainerPokemonProfile_BeforeInterview1(eContestantStatus[gContestPlayerMonIndex].prevMove); else { - sub_80DF250(); - sub_80DF4F8(); + CalculateContestLiveUpdateData(); + SetConestLiveUpdateTVData(); ContestDebugPrintBitStrings(); } gContestRngValue = gRngValue; @@ -3990,7 +3998,7 @@ static void Task_StopFlashJudgeAttentionEye(u8 taskId) { gTasks[eContest.judgeAttentionTaskId].data[contestant * 4 + 0] = 0xFF; gTasks[eContest.judgeAttentionTaskId].data[contestant * 4 + 1] = 0; - BlendPalette((eContest.prevTurnOrder[contestant] + MOVE_WINDOWS_START) * 16 + 6, 2, 0, RGB(31, 31, 18)); + BlendPalette((eContest.prevTurnOrder[contestant] + 5) * 16 + 6, 2, 0, RGB(31, 31, 18)); DestroyTask(taskId); } } @@ -4014,58 +4022,62 @@ static void Task_FlashJudgeAttentionEye(u8 taskId) || gTasks[taskId].data[offset + 0] == 0) gTasks[taskId].data[offset + 1] ^= 1; - BlendPalette( - (eContest.prevTurnOrder[i] + MOVE_WINDOWS_START) * 16 + 6, - 2, - gTasks[taskId].data[offset + 0], - RGB(31, 31, 18)); + BlendPalette((eContest.prevTurnOrder[i] + 5) * 16 + 6, 2, gTasks[taskId].data[offset + 0], RGB(31, 31, 18)); } } } -static void sub_80DC7EC(void) +// Note: While the below task is run for the entire Appeals portion of the contest, +// because data[i * 4] is always 0xFF it never does anything +// If turned on by setting that data between 0 and 16, it blends +// an odd selection of palette colors (e.g. the text box, the appeal hearts +// for only one contestant, the heart outlines in the move selection box, etc) +// Given the similarities, it's possible this was an incorrect attempt +// at something similar to what CreateJudgeAttentionEyeTask does +static void CreateUnusedBlendTask(void) { s32 i; - eContest.unk19212 = CreateTask(sub_80DC8D0, 30); + eContest.blendTaskId = CreateTask(Task_UnusedBlend, 30); for (i = 0; i < CONTESTANT_COUNT; i++) - sub_80DC81C(i); + InitUnusedBlendTaskData(i); } -static void sub_80DC81C(u8 contestant) +static void InitUnusedBlendTaskData(u8 contestant) { - gTasks[eContest.unk19212].data[contestant * 4 + 0] = 0xFF; - gTasks[eContest.unk19212].data[contestant * 4 + 1] = 0; + gTasks[eContest.blendTaskId].data[contestant * 4] = 0xFF; + gTasks[eContest.blendTaskId].data[contestant * 4 + 1] = 0; } -static void sub_80DC864(void) +static void UpdateBlendTaskContestantsData(void) { s32 i; for (i = 0; i < CONTESTANT_COUNT; i++) - sub_80DC87C(i); + UpdateBlendTaskContestantData(i); } -static void sub_80DC87C(u8 contestant) +static void UpdateBlendTaskContestantData(u8 contestant) { - u32 windowId1; - u32 windowId2; + u32 palOffset1; + u32 palOffset2; - sub_80DC81C(contestant); + InitUnusedBlendTaskData(contestant); - windowId1 = contestant + MOVE_WINDOWS_START; + palOffset1 = contestant + 5; DmaCopy16Defvars(3, - gPlttBufferUnfaded + windowId1 * 16 + 10, - gPlttBufferFaded + windowId1 * 16 + 10, + gPlttBufferUnfaded + palOffset1 * 16 + 10, + gPlttBufferFaded + palOffset1 * 16 + 10, 2); - windowId2 = (contestant + MOVE_WINDOWS_START) * 16 + 12 + contestant; + palOffset2 = (contestant + 5) * 16 + 12 + contestant; DmaCopy16Defvars(3, - gPlttBufferUnfaded + windowId2, - gPlttBufferFaded + windowId2, + gPlttBufferUnfaded + palOffset2, + gPlttBufferFaded + palOffset2, 2); } -static void sub_80DC8D0(u8 taskId) +// See comments on CreateUnusedBlendTask +static void Task_UnusedBlend(u8 taskId) { u8 i; @@ -4073,23 +4085,24 @@ static void sub_80DC8D0(u8 taskId) { u8 idx = i * 4; - if (gTasks[taskId].data[idx + 0] != 0xFF) + // Below is never true + if (gTasks[taskId].data[idx] != 0xFF) { if (++gTasks[taskId].data[idx + 2] > 2) { gTasks[taskId].data[idx + 2] = 0; if (gTasks[taskId].data[idx + 1] == 0) - gTasks[taskId].data[idx + 0]++; + gTasks[taskId].data[idx]++; else - gTasks[taskId].data[idx + 0]--; + gTasks[taskId].data[idx]--; - if (gTasks[taskId].data[idx + 0] == 16 - || gTasks[taskId].data[idx + 0] == 0) + if (gTasks[taskId].data[idx] == 16 + || gTasks[taskId].data[idx] == 0) gTasks[taskId].data[idx + 1] ^= 1; - BlendPalette((i + MOVE_WINDOWS_START) * 16 + 10, 1, gTasks[taskId].data[idx + 0], RGB(31, 31, 18)); - BlendPalette((i + MOVE_WINDOWS_START) * 16 + 12 + i, 1, gTasks[taskId].data[idx + 0], RGB(31, 31, 18)); + BlendPalette((i + 5) * 16 + 10, 1, gTasks[taskId].data[idx + 0], RGB(31, 31, 18)); + BlendPalette((i + 5) * 16 + 12 + i, 1, gTasks[taskId].data[idx + 0], RGB(31, 31, 18)); } } } @@ -4241,8 +4254,8 @@ static void ContestDebugDoPrint(void) { case CONTEST_DEBUG_MODE_OFF: break; - case CONTEST_DEBUG_MODE_PRINT_UNK_C: - case CONTEST_DEBUG_MODE_PRINT_UNK_D: + case CONTEST_DEBUG_MODE_PRINT_WINNER_FLAGS: + case CONTEST_DEBUG_MODE_PRINT_LOSER_FLAGS: ContestDebugPrintBitStrings(); break; // The only other possible value is 1, which is only set by ContestDebugTogglePointTotal. @@ -4401,8 +4414,8 @@ static void DrawContestantWindows(void) for (i = 0; i < CONTESTANT_COUNT; i++) { - s32 windowId = i + MOVE_WINDOWS_START; - LoadPalette(eUnknownHeap1A004.cachedWindowPalettes[windowId], (gContestantTurnOrder[i] + MOVE_WINDOWS_START) * 16, sizeof(eUnknownHeap1A004.cachedWindowPalettes[0])); + s32 windowId = i + 5; + LoadPalette(eUnknownHeap1A004.cachedWindowPalettes[windowId], (gContestantTurnOrder[i] + 5) * 16, sizeof(eUnknownHeap1A004.cachedWindowPalettes[0])); } DrawContestantWindowText(); } @@ -4486,7 +4499,7 @@ static void CalculateAppealMoveImpact(u8 contestant) } } if (eContestantStatus[contestant].repeatedMove) - eContestantStatus[contestant].unk18 = (eContestantStatus[contestant].moveRepeatCount + 1) * 10; + eContestantStatus[contestant].repeatJam = (eContestantStatus[contestant].moveRepeatCount + 1) * 10; if (eContestantStatus[contestant].nervous) { @@ -5145,7 +5158,7 @@ static void Task_ResetForNextRound(u8 taskId) for (i = 0; i < CONTESTANT_COUNT; i++) eContest.prevTurnOrder[i] = gContestantTurnOrder[i]; FillContestantWindowBgs(); - sub_80DC864(); + UpdateBlendTaskContestantsData(); DrawConditionStars(); DrawContestantWindows(); ShowHideNextTurnGfx(TRUE); @@ -5393,12 +5406,12 @@ static void SetMoveTargetPosition(u16 move) } } -static void Contest_PrintTextToBg0WindowStd(u32 a, const u8 *b) +static void Contest_PrintTextToBg0WindowStd(u32 windowId, const u8 *b) { struct TextPrinterTemplate printerTemplate; printerTemplate.currentChar = b; - printerTemplate.windowId = a; + printerTemplate.windowId = windowId; printerTemplate.fontId = 1; printerTemplate.x = 0; printerTemplate.y = 1; @@ -5412,7 +5425,7 @@ static void Contest_PrintTextToBg0WindowStd(u32 a, const u8 *b) printerTemplate.shadowColor = 8; AddTextPrinter(&printerTemplate, 0, 0); - PutWindowTilemap(a); + PutWindowTilemap(windowId); Contest_SetBgCopyFlags(0); } @@ -5610,8 +5623,7 @@ void ClearContestWinnerPicsInContestHall(void) gSaveBlock1Ptr->contestWinners[i] = gUnknown_08587FA4[i]; } -// The functions below are probably related to Contests in TV. -static void sub_80DF080(u8 contestant) +static void SetContestLiveUpdateFlags(u8 contestant) { s32 i; @@ -5619,278 +5631,292 @@ static void sub_80DF080(u8 contestant) && eContestExcitement.moveExcitement > 0 && !eContestantStatus[contestant].repeatedMove) { - gContestResources->tv[contestant].unkC |= 1; - gContestResources->tv[contestant].unkE_2 = 1; + gContestResources->tv[contestant].winnerFlags |= CONTESTLIVE_FLAG_EXCITING_APPEAL; + gContestResources->tv[contestant].madeExcitingAppeal = TRUE; } if (eContestantStatus[contestant].nervous) - gContestResources->tv[contestant].unkC |= 2; + gContestResources->tv[contestant].winnerFlags |= CONTESTLIVE_FLAG_GOT_NERVOUS; if (!eContestExcitement.frozen && eContestExcitement.moveExcitement != 0 && eContestExcitement.excitementAppealBonus == 60) { - gContestResources->tv[contestant].unkC |= 4; + gContestResources->tv[contestant].winnerFlags |= CONTESTLIVE_FLAG_MAXED_EXCITEMENT; } if (eContestantStatus[contestant].usedComboMove && eContestantStatus[contestant].completedCombo) { - gContestResources->tv[contestant].unkC |= 8; + gContestResources->tv[contestant].winnerFlags |= CONTESTLIVE_FLAG_USED_COMBO; } for (i = 0; i < CONTESTANT_COUNT; i++) { if (i != contestant && eContestantStatus[i].jam != 0) { - gContestResources->tv[contestant].unkC |= 0x10; - gContestResources->tv[i].unkC |= 0x40; + gContestResources->tv[contestant].winnerFlags |= CONTESTLIVE_FLAG_STARTLED_OTHER; + gContestResources->tv[i].winnerFlags |= CONTESTLIVE_FLAG_GOT_STARTLED; } } if (eContestantStatus[contestant].numTurnsSkipped != 0 || eContestantStatus[contestant].noMoreTurns) { - gContestResources->tv[contestant].unkC |= 0x20; + gContestResources->tv[contestant].winnerFlags |= CONTESTLIVE_FLAG_SKIPPED_TURN; } else if (!eContestantStatus[contestant].nervous) { - gContestResources->tv[contestant].unkC |= 0x80; - gContestResources->tv[contestant].unkE_1 = 1; - gContestResources->tv[contestant].unk0[eContest.appealNumber] = eContestantStatus[contestant].currMove; + gContestResources->tv[contestant].winnerFlags |= CONTESTLIVE_FLAG_MADE_APPEAL; + gContestResources->tv[contestant].madeAppeal = TRUE; + gContestResources->tv[contestant].appeals[eContest.appealNumber] = eContestantStatus[contestant].currMove; } if (eContestantStatus[contestant].repeatedMove) - gContestResources->tv[contestant].unkD |= 2; + gContestResources->tv[contestant].loserFlags |= CONTESTLIVE_FLAG_REPEATED_MOVE; if (eContest.applauseLevel == 4 && !eContestExcitement.frozen && eContestExcitement.moveExcitement < 0) { - gContestResources->tv[contestant].unkD |= 0x20; + gContestResources->tv[contestant].loserFlags |= CONTESTLIVE_FLAG_MISSED_EXCITEMENT; } } -static void sub_80DF250(void) +static void CalculateContestLiveUpdateData(void) { - u8 r1; + u8 loser; s32 i, j; - bool32 r12, r8; - u16 sp0[6]; - u8 spC[6]; - u16 sp14[5]; - u8 var_38; - u8 r3; - u8 count; + bool32 notLastInRound1, notLastInRound2; + u16 appealMoves[CONTEST_NUM_APPEALS + 1]; + u8 numMoveUses[CONTEST_NUM_APPEALS + 1]; + u16 moveCandidates[CONTEST_NUM_APPEALS]; + u8 winner; + u8 mostUses; + u8 numMoveCandidates; - r1 = 0; - var_38 = 0; + loser = 0; + winner = 0; + // Get loser/winner ids for (i = 0; i < CONTESTANT_COUNT; i++) { if (gContestFinalStandings[i] == 0) - var_38 = i; - else if (gContestFinalStandings[i] == 3) - r1 = i; + winner = i; + else if (gContestFinalStandings[i] == CONTESTANT_COUNT - 1) + loser = i; } - gContestResources->tv[r1].unkD |= 1; + // Set flags for commenting on loser + gContestResources->tv[loser].loserFlags |= CONTESTLIVE_FLAG_LOST; for (i = 0; i < CONTESTANT_COUNT; i++) { - if (i != var_38 && gContestMonTotalPoints[var_38] - gContestMonTotalPoints[i] <= 50) - gContestResources->tv[i].unkD |= 4; + if (i != winner && gContestMonTotalPoints[winner] - gContestMonTotalPoints[i] <= 50) + gContestResources->tv[i].loserFlags |= CONTESTLIVE_FLAG_LOST_SMALL_MARGIN; - if (!gContestResources->tv[i].unkE_2) - gContestResources->tv[i].unkD |= 8; + if (!gContestResources->tv[i].madeExcitingAppeal) + gContestResources->tv[i].loserFlags |= CONTESTLIVE_FLAG_NO_EXCITEMENT; for (j = 0; j < CONTESTANT_COUNT; j++) { if (gContestMonRound1Points[i] < gContestMonRound1Points[j]) break; } - if (j == 4 && gContestFinalStandings[i] != 0) - gContestResources->tv[i].unkD |= 0x10; + if (j == CONTESTANT_COUNT && gContestFinalStandings[i] != 0) + gContestResources->tv[i].loserFlags |= CONTESTLIVE_FLAG_BLEW_LEAD; - r12 = FALSE; - r8 = FALSE; + notLastInRound1 = FALSE; + notLastInRound2 = FALSE; for (j = 0; j < CONTESTANT_COUNT; j++) { if (gContestMonRound1Points[i] > gContestMonRound1Points[j]) - r12 = TRUE; + notLastInRound1 = TRUE; if (gContestMonRound2Points[i] > gContestMonRound2Points[j]) - r8 = TRUE; + notLastInRound2 = TRUE; } - if (!r12 && !r8) - gContestResources->tv[i].unkD |= 0x40; + if (!notLastInRound1 && !notLastInRound2) + gContestResources->tv[i].loserFlags |= CONTESTLIVE_FLAG_LAST_BOTH_ROUNDS; - if (!gContestResources->tv[i].unkE_1) - gContestResources->tv[i].unkD |= 0x80; + if (!gContestResources->tv[i].madeAppeal) + gContestResources->tv[i].loserFlags |= CONTESTLIVE_FLAG_NO_APPEALS; } - for (i = 0; i < 5; i++) + // Get what moves the winner used and how many times they used them + for (i = 0; i < CONTEST_NUM_APPEALS; i++) { - sp0[i] = 0; - spC[i] = 0; + appealMoves[i] = MOVE_NONE; + numMoveUses[i] = 0; } - sp0[5] = 0xFFFF; - spC[5] = 0; + appealMoves[CONTEST_NUM_APPEALS] = 0xFFFF; + numMoveUses[CONTEST_NUM_APPEALS] = 0; - for (i = 0; i < 5; i++) + for (i = 0; i < CONTEST_NUM_APPEALS; i++) { - if (gContestResources->tv[var_38].unk0[i] != 0) + if (gContestResources->tv[winner].appeals[i] != MOVE_NONE) { - for (j = 0; j < 5; j++) + for (j = 0; j < CONTEST_NUM_APPEALS; j++) { - if (gContestResources->tv[var_38].unk0[i] != sp0[j]) + if (gContestResources->tv[winner].appeals[i] != appealMoves[j]) { - if (sp0[j] == 0) + if (appealMoves[j] == MOVE_NONE) { - sp0[j] = gContestResources->tv[var_38].unk0[i]; - spC[j]++; + appealMoves[j] = gContestResources->tv[winner].appeals[i]; + numMoveUses[j]++; } } else { - spC[j]++; + numMoveUses[j]++; } } } } - sp14[0] = sp0[0]; - r3 = spC[0]; - count = 0; - for (i = 1; sp0[i] != 0xFFFF; i++) + // Choose an appeal move to comment on for the winner (most commonly used) + moveCandidates[0] = appealMoves[0]; + mostUses = numMoveUses[0]; + numMoveCandidates = 0; + for (i = 1; appealMoves[i] != 0xFFFF; i++) { - if (r3 < spC[i]) + if (mostUses < numMoveUses[i]) { - sp14[0] = sp0[i]; - r3 = spC[i]; - count = 1; + moveCandidates[0] = appealMoves[i]; + mostUses = numMoveUses[i]; + numMoveCandidates = 1; } - else if (r3 == spC[i]) + else if (mostUses == numMoveUses[i]) { - sp14[count] = sp0[i]; - count++; + moveCandidates[numMoveCandidates] = appealMoves[i]; + numMoveCandidates++; } } - gContestResources->tv[var_38].unkA = sp14[Random() % count]; + gContestResources->tv[winner].move = moveCandidates[Random() % numMoveCandidates]; } -static void sub_80DF4F8(void) +static void SetConestLiveUpdateTVData(void) { s32 i; - u32 bits; - u8 r7; - u8 r9, r10; + u32 flags; + u8 winner; + u8 round1Placing, round2Placing; u8 count; - u8 r5; - u8 r2; - u16 var; - u8 r4; - u8 r6; - u8 sp0[4]; + u8 randAction; + u8 numLoserCandidates; + u8 flagId; + u16 winnerFlag; + u8 loserFlag; + u8 loser; + u8 loserCandidates[CONTESTANT_COUNT - 1]; + // Players mon didn't win, don't generate show if (gContestFinalStandings[gContestPlayerMonIndex] != 0) return; - r7 = 0; + // Get winner id (unnecessary, we now know it's gContestPlayerMonIndex) + winner = 0; for (i = 0; i < CONTESTANT_COUNT; i++) { if (gContestFinalStandings[i] == 0) - r7 = i; + winner = i; } - r9 = 0; - r10 = 0; + // Get winner's placement in Round 1 and 2 + round1Placing = 0; + round2Placing = 0; for (i = 0; i < CONTESTANT_COUNT; i++) { - if (gContestMonRound1Points[r7] < gContestMonRound1Points[i]) - r9++; - if (gContestMonRound2Points[r7] < gContestMonRound2Points[i]) - r10++; + if (gContestMonRound1Points[winner] < gContestMonRound1Points[i]) + round1Placing++; + if (gContestMonRound2Points[winner] < gContestMonRound2Points[i]) + round2Placing++; } - bits = gContestResources->tv[r7].unkC; + // Count how many TV comment-worthy actions the winner took + flags = gContestResources->tv[winner].winnerFlags; count = 0; - for (i = 0; i < 8; bits >>= 1, i++) + for (i = 0; i < 8; flags >>= 1, i++) { - if (bits & 1) + if (flags & 1) count++; } - r5 = Random() % count; - bits = gContestResources->tv[r7].unkC; + // Randomly choose one of these actions to comment on + randAction = Random() % count; + flags = gContestResources->tv[winner].winnerFlags; count = 0; - r2 = 0; - for (i = 0; i < 8; bits >>= 1, r2++, i++) + flagId = 0; + for (i = 0; i < 8; flags >>= 1, flagId++, i++) { - if (!(bits & 1)) + if (!(flags & 1)) continue; - if (r5 == count) + if (randAction == count) break; count++; } + winnerFlag = 1 << flagId; - var = 1 << r2; - if (r7 == 0) + // Pick a losing player with the highest severity of bad actions to comment on + if (winner == 0) { - sp0[0] = 1; - r4 = gContestResources->tv[1].unkD; + loserCandidates[0] = 1; + loserFlag = gContestResources->tv[1].loserFlags; i = 2; } else { - sp0[0] = 0; - r4 = gContestResources->tv[0].unkD; + loserCandidates[0] = 0; + loserFlag = gContestResources->tv[0].loserFlags; i = 1; } - r5 = 1; + numLoserCandidates = 1; for (; i < CONTESTANT_COUNT; i++) { - if (i != r7) + if (i != winner) { - if (r4 < gContestResources->tv[i].unkD) + if (loserFlag < gContestResources->tv[i].loserFlags) { - sp0[0] = i; - r4 = gContestResources->tv[i].unkD; - r5 = 1; + // Losing player currently has the worst (highest) set of flags, only candidate + loserCandidates[0] = i; + loserFlag = gContestResources->tv[i].loserFlags; + numLoserCandidates = 1; } - else if (r4 == gContestResources->tv[i].unkD) + else if (loserFlag == gContestResources->tv[i].loserFlags) { - sp0[r5] = i; - r5++; + // Tie, increment number of loser candidates + loserCandidates[numLoserCandidates] = i; + numLoserCandidates++; } } } + loser = loserCandidates[Random() % numLoserCandidates]; - r6 = sp0[Random() % r5]; - r2 = 0x80; - for (i = 0; i < 8; r2 >>= 1, i++) + // Choose the "worst" action to comment on (flag with highest value) + flagId = CONTESTLIVE_FLAG_NO_APPEALS; + for (i = 0; i < 8; flagId >>= 1, i++) { - r4 = gContestResources->tv[r6].unkD & r2; - if (r4) + loserFlag = gContestResources->tv[loser].loserFlags & flagId; + if (loserFlag) break; } - ContestLiveUpdates_BeforeInterview_1(r9); - ContestLiveUpdates_BeforeInterview_2(r10); - ContestLiveUpdates_BeforeInterview_3(var); - ContestLiveUpdates_BeforeInterview_4(gContestResources->tv[r7].unkA); - ContestLiveUpdates_BeforeInterview_5(r4, r6); + ContestLiveUpdates_Init(round1Placing); + ContestLiveUpdates_SetRound2Placing(round2Placing); + ContestLiveUpdates_SetWinnerAppealFlag(winnerFlag); + ContestLiveUpdates_SetWinnerMoveUsed(gContestResources->tv[winner].move); + ContestLiveUpdates_SetLoserData(loserFlag, loser); } // Unused -void ContestDebugToggleBitfields(bool8 showUnkD) +void ContestDebugToggleBitfields(bool8 loserFlags) { if (eContestDebugMode == CONTEST_DEBUG_MODE_OFF) { - if (!showUnkD) - eContestDebugMode = CONTEST_DEBUG_MODE_PRINT_UNK_C; + if (!loserFlags) + eContestDebugMode = CONTEST_DEBUG_MODE_PRINT_WINNER_FLAGS; else - eContestDebugMode = CONTEST_DEBUG_MODE_PRINT_UNK_D; + eContestDebugMode = CONTEST_DEBUG_MODE_PRINT_LOSER_FLAGS; } else { @@ -5920,19 +5946,19 @@ static void ContestDebugPrintBitStrings(void) if (!gEnableContestDebugging) return; - if (eContestDebugMode != CONTEST_DEBUG_MODE_PRINT_UNK_C && eContestDebugMode != CONTEST_DEBUG_MODE_PRINT_UNK_D) + if (eContestDebugMode != CONTEST_DEBUG_MODE_PRINT_WINNER_FLAGS && eContestDebugMode != CONTEST_DEBUG_MODE_PRINT_LOSER_FLAGS) return; for (i = 0; i < CONTESTANT_COUNT; i++) FillWindowPixelBuffer(i, PIXEL_FILL(0)); - if (eContestDebugMode == CONTEST_DEBUG_MODE_PRINT_UNK_C) + if (eContestDebugMode == CONTEST_DEBUG_MODE_PRINT_WINNER_FLAGS) { for (i = 0; i < CONTESTANT_COUNT; i++) { txtPtr = StringCopy(text1, gText_CDot); Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text1, 5, 1, 7); - bits = gContestResources->tv[i].unkC; + bits = gContestResources->tv[i].winnerFlags; for (j = 7; j > -1; j--) // Weird loop. { txtPtr = ConvertIntToDecimalStringN(txtPtr, bits & 1, STR_CONV_MODE_LEFT_ALIGN, 1); @@ -5947,12 +5973,12 @@ static void ContestDebugPrintBitStrings(void) Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[i], text1 + j, 55, 1, 7); } } - else + else // CONTEST_DEBUG_MODE_PRINT_LOSER_FLAGS { for (i = 0; i < CONTESTANT_COUNT; i++) { StringCopy(text1, gText_BDot); - bits = gContestResources->tv[i].unkD; + bits = gContestResources->tv[i].loserFlags; txtPtr = &text1[2]; for (j = 7; j > -1; j--) // Weird loop. { diff --git a/src/tv.c b/src/tv.c index b3722e87a..a3458b72f 100644 --- a/src/tv.c +++ b/src/tv.c @@ -387,39 +387,39 @@ static const u8 *const sTVBravoTrainerBattleTowerTextGroup[] = { }; static const u8 *const sTVContestLiveUpdatesTextGroup[] = { - gTVContestLiveUpdatesText00, - gTVContestLiveUpdatesText01, - gTVContestLiveUpdatesText02, - gTVContestLiveUpdatesText03, - gTVContestLiveUpdatesText04, - gTVContestLiveUpdatesText05, - gTVContestLiveUpdatesText06, - gTVContestLiveUpdatesText07, - gTVContestLiveUpdatesText08, - gTVContestLiveUpdatesText09, - gTVContestLiveUpdatesText10, - gTVContestLiveUpdatesText11, - gTVContestLiveUpdatesText12, - gTVContestLiveUpdatesText13, - gTVContestLiveUpdatesText14, - gTVContestLiveUpdatesText15, - gTVContestLiveUpdatesText16, - gTVContestLiveUpdatesText17, - gTVContestLiveUpdatesText18, - gTVContestLiveUpdatesText19, - gTVContestLiveUpdatesText20, - gTVContestLiveUpdatesText21, - gTVContestLiveUpdatesText22, - gTVContestLiveUpdatesText23, - gTVContestLiveUpdatesText24, - gTVContestLiveUpdatesText25, - gTVContestLiveUpdatesText26, - gTVContestLiveUpdatesText27, - gTVContestLiveUpdatesText28, - gTVContestLiveUpdatesText29, - gTVContestLiveUpdatesText30, - gTVContestLiveUpdatesText31, - gTVContestLiveUpdatesText32 + [CONTESTLIVE_STATE_INTRO] = ContestLiveUpdates_Text_Intro, + [CONTESTLIVE_STATE_WON_BOTH_ROUNDS] = ContestLiveUpdates_Text_WonBothRounds, + [CONTESTLIVE_STATE_BETTER_ROUND2] = ContestLiveUpdates_Text_BetterRound2, + [CONTESTLIVE_STATE_EQUAL_ROUNDS] = ContestLiveUpdates_Text_EqualRounds, + [CONTESTLIVE_STATE_BETTER_ROUND1] = ContestLiveUpdates_Text_BetterRound1, + [CONTESTLIVE_STATE_GOT_NERVOUS] = ContestLiveUpdates_Text_GotNervous, + [CONTESTLIVE_STATE_STARTLED_OTHER] = ContestLiveUpdates_Text_StartledFoes, + [CONTESTLIVE_STATE_USED_COMBO] = ContestLiveUpdates_Text_UsedCombo, + [CONTESTLIVE_STATE_EXCITING_APPEAL] = ContestLiveUpdates_Text_ExcitingAppeal, + [CONTESTLIVE_STATE_COOL] = ContestLiveUpdates_Text_WasCool, + [CONTESTLIVE_STATE_BEAUTIFUL] = ContestLiveUpdates_Text_WasBeautiful, + [CONTESTLIVE_STATE_CUTE] = ContestLiveUpdates_Text_WasCute, + [CONTESTLIVE_STATE_SMART] = ContestLiveUpdates_Text_WasSmart, + [CONTESTLIVE_STATE_TOUGH] = ContestLiveUpdates_Text_WasTough, + [CONTESTLIVE_STATE_VERY_EXCITING_APPEAL] = ContestLiveUpdates_Text_VeryExcitingAppeal, + [CONTESTLIVE_STATE_VERY_COOL] = ContestLiveUpdates_Text_VeryCool, + [CONTESTLIVE_STATE_VERY_BEAUTIFUL] = ContestLiveUpdates_Text_VeryBeautiful, + [CONTESTLIVE_STATE_VERY_CUTE] = ContestLiveUpdates_Text_VeryCute, + [CONTESTLIVE_STATE_VERY_SMART] = ContestLiveUpdates_Text_VerySmart, + [CONTESTLIVE_STATE_VERY_TOUGH] = ContestLiveUpdates_Text_VeryTough, + [CONTESTLIVE_STATE_TOOK_BREAK] = ContestLiveUpdates_Text_TookBreak, + [CONTESTLIVE_STATE_GOT_STARTLED] = ContestLiveUpdates_Text_GotStartled, + [CONTESTLIVE_STATE_USED_MOVE] = ContestLiveUpdates_Text_MoveWonderful, + [CONTESTLIVE_STATE_TALK_ABOUT_LOSER] = ContestLiveUpdates_Text_TalkAboutAnotherMon, + [CONTESTLIVE_STATE_NO_APPEALS] = ContestLiveUpdates_Text_FailedToAppeal, + [CONTESTLIVE_STATE_LAST_BOTH] = ContestLiveUpdates_Text_LastInBothRounds, + [CONTESTLIVE_STATE_NOT_EXCITING_ENOUGH] = ContestLiveUpdates_Text_NotExcitingEnough, + [CONTESTLIVE_STATE_LOST_AFTER_ROUND1_WIN] = ContestLiveUpdates_Text_LostAfterWinningRound1, + [CONTESTLIVE_STATE_NO_EXCITING_APPEALS] = ContestLiveUpdates_Text_NeverExciting, + [CONTESTLIVE_STATE_LOST_SMALL_MARGIN] = ContestLiveUpdates_Text_LostBySmallMargin, + [CONTESTLIVE_STATE_REPEATED_APPEALS] = ContestLiveUpdates_Text_RepeatedAppeals, + [CONTESTLIVE_STATE_LOST] = ContestLiveUpdates_Text_ValiantEffortButLost, + [CONTESTLIVE_STATE_OUTRO] = ContestLiveUpdates_Text_Outro }; static const u8 *const sTVPokemonBattleUpdateTextGroup[] = { @@ -1268,19 +1268,19 @@ static void InterviewAfter_ContestLiveUpdates(void) show2 = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot]; show2->contestLiveUpdates.kind = TVSHOW_CONTEST_LIVE_UPDATES; show2->contestLiveUpdates.active = TRUE; - StringCopy(show2->contestLiveUpdates.playerName, gSaveBlock2Ptr->playerName); + StringCopy(show2->contestLiveUpdates.winningTrainerName, gSaveBlock2Ptr->playerName); // Show only begins running if player won, so always load players name show2->contestLiveUpdates.category = gSpecialVar_ContestCategory; - show2->contestLiveUpdates.species = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SPECIES, NULL); - show2->contestLiveUpdates.winningSpecies = show->contestLiveUpdates.winningSpecies; - show2->contestLiveUpdates.appealFlags2 = show->contestLiveUpdates.appealFlags2; - show2->contestLiveUpdates.round1Rank = show->contestLiveUpdates.round1Rank; - show2->contestLiveUpdates.round2Rank = show->contestLiveUpdates.round2Rank; + show2->contestLiveUpdates.winningSpecies = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SPECIES, NULL); + show2->contestLiveUpdates.losingSpecies = show->contestLiveUpdates.losingSpecies; + show2->contestLiveUpdates.loserAppealFlag = show->contestLiveUpdates.loserAppealFlag; + show2->contestLiveUpdates.round1Placing = show->contestLiveUpdates.round1Placing; + show2->contestLiveUpdates.round2Placing = show->contestLiveUpdates.round2Placing; show2->contestLiveUpdates.move = show->contestLiveUpdates.move; - show2->contestLiveUpdates.appealFlags1 = show->contestLiveUpdates.appealFlags1; - StringCopy(show2->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerName); + show2->contestLiveUpdates.winnerAppealFlag = show->contestLiveUpdates.winnerAppealFlag; + StringCopy(show2->contestLiveUpdates.losingTrainerName, show->contestLiveUpdates.losingTrainerName); tv_store_id_2x(show2); - show2->contestLiveUpdates.language = gGameLanguage; - show2->contestLiveUpdates.winningTrainerLanguage = show->contestLiveUpdates.winningTrainerLanguage; + show2->contestLiveUpdates.winningTrainerLanguage = gGameLanguage; + show2->contestLiveUpdates.losingTrainerLanguage = show->contestLiveUpdates.losingTrainerLanguage; DeleteTVShowInArrayByIdx(gSaveBlock1Ptr->tvShows, LAST_TVSHOW_IDX); } } @@ -1399,7 +1399,7 @@ void PutFanClubSpecialOnTheAir(void) } } -void ContestLiveUpdates_BeforeInterview_1(u8 a0) +void ContestLiveUpdates_Init(u8 round1Placing) { TVShow *show; @@ -1408,12 +1408,12 @@ void ContestLiveUpdates_BeforeInterview_1(u8 a0) if (sCurTVShowSlot != -1) { show = &gSaveBlock1Ptr->tvShows[LAST_TVSHOW_IDX]; - show->contestLiveUpdates.round1Rank = a0; + show->contestLiveUpdates.round1Placing = round1Placing; show->contestLiveUpdates.kind = TVSHOW_CONTEST_LIVE_UPDATES; } } -void ContestLiveUpdates_BeforeInterview_2(u8 a0) +void ContestLiveUpdates_SetRound2Placing(u8 round2Placing) { TVShow *show; @@ -1421,11 +1421,11 @@ void ContestLiveUpdates_BeforeInterview_2(u8 a0) sCurTVShowSlot = FindEmptyTVSlotWithinFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows); if (sCurTVShowSlot != -1) { - show->contestLiveUpdates.round2Rank = a0; + show->contestLiveUpdates.round2Placing = round2Placing; } } -void ContestLiveUpdates_BeforeInterview_3(u8 a0) +void ContestLiveUpdates_SetWinnerAppealFlag(u8 flag) { TVShow *show; @@ -1433,11 +1433,11 @@ void ContestLiveUpdates_BeforeInterview_3(u8 a0) sCurTVShowSlot = FindEmptyTVSlotWithinFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows); if (sCurTVShowSlot != -1) { - show->contestLiveUpdates.appealFlags1 = a0; + show->contestLiveUpdates.winnerAppealFlag = flag; } } -void ContestLiveUpdates_BeforeInterview_4(u16 a0) +void ContestLiveUpdates_SetWinnerMoveUsed(u16 move) { TVShow *show; @@ -1445,11 +1445,11 @@ void ContestLiveUpdates_BeforeInterview_4(u16 a0) sCurTVShowSlot = FindEmptyTVSlotWithinFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows); if (sCurTVShowSlot != -1) { - show->contestLiveUpdates.move = a0; + show->contestLiveUpdates.move = move; } } -void ContestLiveUpdates_BeforeInterview_5(u8 a0, u8 a1) +void ContestLiveUpdates_SetLoserData(u8 flag, u8 loser) { TVShow *show; @@ -1457,21 +1457,21 @@ void ContestLiveUpdates_BeforeInterview_5(u8 a0, u8 a1) sCurTVShowSlot = FindEmptyTVSlotWithinFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows); if (sCurTVShowSlot != -1) { - show->contestLiveUpdates.winningSpecies = gContestMons[a1].species; - StringCopy(show->contestLiveUpdates.winningTrainerName, gContestMons[a1].trainerName); - StripExtCtrlCodes(show->contestLiveUpdates.winningTrainerName); - show->contestLiveUpdates.appealFlags2 = a0; - if (a1 + 1 > gNumLinkContestPlayers) + show->contestLiveUpdates.losingSpecies = gContestMons[loser].species; + StringCopy(show->contestLiveUpdates.losingTrainerName, gContestMons[loser].trainerName); + StripExtCtrlCodes(show->contestLiveUpdates.losingTrainerName); + show->contestLiveUpdates.loserAppealFlag = flag; + if (loser + 1 > gNumLinkContestPlayers) { - show->contestLiveUpdates.winningTrainerLanguage = gLinkPlayers[0].language; + show->contestLiveUpdates.losingTrainerLanguage = gLinkPlayers[0].language; } - else if (gGameLanguage == LANGUAGE_JAPANESE || gLinkPlayers[a1].language == LANGUAGE_JAPANESE) + else if (gGameLanguage == LANGUAGE_JAPANESE || gLinkPlayers[loser].language == LANGUAGE_JAPANESE) { - show->contestLiveUpdates.winningTrainerLanguage = LANGUAGE_JAPANESE; + show->contestLiveUpdates.losingTrainerLanguage = LANGUAGE_JAPANESE; } else { - show->contestLiveUpdates.winningTrainerLanguage = gLinkPlayers[a1].language; + show->contestLiveUpdates.losingTrainerLanguage = gLinkPlayers[loser].language; } } } @@ -3810,10 +3810,10 @@ static void sub_80F0708(void) // FIXME: register allocation shenanigans switch (gSaveBlock1Ptr->tvShows[i].common.kind) { case TVSHOW_CONTEST_LIVE_UPDATES: - j = (&gSaveBlock1Ptr->tvShows[i])->contestLiveUpdates.species; - sub_80F0B24(j, i); j = (&gSaveBlock1Ptr->tvShows[i])->contestLiveUpdates.winningSpecies; sub_80F0B24(j, i); + j = (&gSaveBlock1Ptr->tvShows[i])->contestLiveUpdates.losingSpecies; + sub_80F0B24(j, i); break; case TVSHOW_3_CHEERS_FOR_POKEBLOCKS: break; @@ -4307,8 +4307,8 @@ static void sub_80F12A4(TVShow *shows) curShow->bravoTrainerTower.pokemonNameLanguage = TV_GetStringLanguage(curShow->bravoTrainerTower.pokemonName); break; case TVSHOW_CONTEST_LIVE_UPDATES: - curShow->contestLiveUpdates.language = TV_GetStringLanguage(curShow->contestLiveUpdates.playerName); curShow->contestLiveUpdates.winningTrainerLanguage = TV_GetStringLanguage(curShow->contestLiveUpdates.winningTrainerName); + curShow->contestLiveUpdates.losingTrainerLanguage = TV_GetStringLanguage(curShow->contestLiveUpdates.losingTrainerName); break; case TVSHOW_3_CHEERS_FOR_POKEBLOCKS: curShow->threeCheers.language = TV_GetStringLanguage(curShow->threeCheers.playerName); @@ -5173,6 +5173,12 @@ static void DoTVShowPokemonNewsMassOutbreak(void) ShowFieldMessage(sTVMassOutbreakTextGroup[sTVShowState]); } +// TV Show that plays after a Link Contest. +// First talks about the winner and something they did, then about a losing player and something they did +// The show is only generated when the player wins, but can be record mixed to other games +// Each state buffers any needed data for a message to print from sTVContestLiveUpdatesTextGroup +// Many cases in this function are identical, and its size can be reduced a good deal by collapsing them +// Can't get this to match while collapsing them though static void DoTVShowPokemonContestLiveUpdates(void) { TVShow *show; @@ -5183,339 +5189,338 @@ static void DoTVShowPokemonContestLiveUpdates(void) state = sTVShowState; switch (state) { - case 0: - BufferContestName(gStringVar1, show->contestLiveUpdates.category); - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates.playerName, show->contestLiveUpdates.language); - if (show->contestLiveUpdates.round1Rank == show->contestLiveUpdates.round2Rank) + case CONTESTLIVE_STATE_INTRO: + BufferContestName(gStringVar1, show->contestLiveUpdates.category); + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); + if (show->contestLiveUpdates.round1Placing == show->contestLiveUpdates.round2Placing) + { + if (show->contestLiveUpdates.round1Placing == 0) { - if (show->contestLiveUpdates.round1Rank == 0) - { - sTVShowState = 1; - } - else - { - sTVShowState = 3; - } - } - else if (show->contestLiveUpdates.round1Rank > show->contestLiveUpdates.round2Rank) - { - sTVShowState = 2; + sTVShowState = CONTESTLIVE_STATE_WON_BOTH_ROUNDS; } else { - sTVShowState = 4; + sTVShowState = CONTESTLIVE_STATE_EQUAL_ROUNDS; } + } + else if (show->contestLiveUpdates.round1Placing > show->contestLiveUpdates.round2Placing) + { + sTVShowState = CONTESTLIVE_STATE_BETTER_ROUND2; + } + else + { + sTVShowState = CONTESTLIVE_STATE_BETTER_ROUND1; + } + break; + case CONTESTLIVE_STATE_WON_BOTH_ROUNDS: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + switch (show->contestLiveUpdates.winnerAppealFlag) + { + case CONTESTLIVE_FLAG_EXCITING_APPEAL: + sTVShowState = CONTESTLIVE_STATE_EXCITING_APPEAL; break; - case 1: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - switch (show->contestLiveUpdates.appealFlags1) - { - case 0x01: - sTVShowState = 8; - break; - case 0x02: - sTVShowState = 5; - break; - case 0x04: - sTVShowState = 14; - break; - case 0x08: - sTVShowState = 7; - break; - case 0x10: - sTVShowState = 6; - break; - case 0x20: - sTVShowState = 20; - break; - case 0x40: - sTVShowState = 21; - break; - case 0x80: - sTVShowState = 22; - break; - } + case CONTESTLIVE_FLAG_GOT_NERVOUS: + sTVShowState = CONTESTLIVE_STATE_GOT_NERVOUS; break; - case 2: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - switch (show->contestLiveUpdates.appealFlags1) - { - case 0x01: - sTVShowState = 8; - break; - case 0x02: - sTVShowState = 5; - break; - case 0x04: - sTVShowState = 14; - break; - case 0x08: - sTVShowState = 7; - break; - case 0x10: - sTVShowState = 6; - break; - case 0x20: - sTVShowState = 20; - break; - case 0x40: - sTVShowState = 21; - break; - case 0x80: - sTVShowState = 22; - break; - } + case CONTESTLIVE_FLAG_MAXED_EXCITEMENT: + sTVShowState = CONTESTLIVE_STATE_VERY_EXCITING_APPEAL; break; - case 3: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates.playerName, show->contestLiveUpdates.language); - switch (show->contestLiveUpdates.appealFlags1) - { - case 0x01: - sTVShowState = 8; - break; - case 0x02: - sTVShowState = 5; - break; - case 0x04: - sTVShowState = 14; - break; - case 0x08: - sTVShowState = 7; - break; - case 0x10: - sTVShowState = 6; - break; - case 0x20: - sTVShowState = 20; - break; - case 0x40: - sTVShowState = 21; - break; - case 0x80: - sTVShowState = 22; - break; - } + case CONTESTLIVE_FLAG_USED_COMBO: + sTVShowState = CONTESTLIVE_STATE_USED_COMBO; break; - case 4: - switch (show->contestLiveUpdates.category) - { - case 0: - StringCopy(gStringVar1, gText_Cool); - break; - case 1: - StringCopy(gStringVar1, gText_Beauty); - break; - case 2: - StringCopy(gStringVar1, gText_Cute); - break; - case 3: - StringCopy(gStringVar1, gText_Smart); - break; - case 4: - StringCopy(gStringVar1, gText_Tough); - break; - } - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - switch (show->contestLiveUpdates.appealFlags1) - { - case 0x01: - sTVShowState = 8; - break; - case 0x02: - sTVShowState = 5; - break; - case 0x04: - sTVShowState = 14; - break; - case 0x08: - sTVShowState = 7; - break; - case 0x10: - sTVShowState = 6; - break; - case 0x20: - sTVShowState = 20; - break; - case 0x40: - sTVShowState = 21; - break; - case 0x80: - sTVShowState = 22; - break; - } + case CONTESTLIVE_FLAG_STARTLED_OTHER: + sTVShowState = CONTESTLIVE_STATE_STARTLED_OTHER; break; - case 5: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_SKIPPED_TURN: + sTVShowState = CONTESTLIVE_STATE_TOOK_BREAK; break; - case 6: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_GOT_STARTLED: + sTVShowState = CONTESTLIVE_STATE_GOT_STARTLED; break; - case 7: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_MADE_APPEAL: + sTVShowState = CONTESTLIVE_STATE_USED_MOVE; break; - case 8: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - switch (show->contestLiveUpdates.category) - { - case 0: - sTVShowState = 9; - break; - case 1: - sTVShowState = 10; - break; - case 2: - sTVShowState = 11; - break; - case 3: - sTVShowState = 12; - break; - case 4: - sTVShowState = 13; - break; - } + } + break; + case CONTESTLIVE_STATE_BETTER_ROUND2: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + switch (show->contestLiveUpdates.winnerAppealFlag) + { + case CONTESTLIVE_FLAG_EXCITING_APPEAL: + sTVShowState = CONTESTLIVE_STATE_EXCITING_APPEAL; break; - case 9: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_GOT_NERVOUS: + sTVShowState = CONTESTLIVE_STATE_GOT_NERVOUS; break; - case 10: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_MAXED_EXCITEMENT: + sTVShowState = CONTESTLIVE_STATE_VERY_EXCITING_APPEAL; break; - case 11: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_USED_COMBO: + sTVShowState = CONTESTLIVE_STATE_USED_COMBO; break; - case 12: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_STARTLED_OTHER: + sTVShowState = CONTESTLIVE_STATE_STARTLED_OTHER; break; - case 13: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_SKIPPED_TURN: + sTVShowState = CONTESTLIVE_STATE_TOOK_BREAK; break; - case 14: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - switch (show->contestLiveUpdates.category) - { - case 0: - sTVShowState = 15; - break; - case 1: - sTVShowState = 16; - break; - case 2: - sTVShowState = 17; - break; - case 3: - sTVShowState = 18; - break; - case 4: - sTVShowState = 19; - break; - } + case CONTESTLIVE_FLAG_GOT_STARTLED: + sTVShowState = CONTESTLIVE_STATE_GOT_STARTLED; break; - case 15: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_MADE_APPEAL: + sTVShowState = CONTESTLIVE_STATE_USED_MOVE; break; - case 16: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + } + break; + case CONTESTLIVE_STATE_EQUAL_ROUNDS: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); + switch (show->contestLiveUpdates.winnerAppealFlag) + { + case CONTESTLIVE_FLAG_EXCITING_APPEAL: + sTVShowState = CONTESTLIVE_STATE_EXCITING_APPEAL; break; - case 17: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_GOT_NERVOUS: + sTVShowState = CONTESTLIVE_STATE_GOT_NERVOUS; break; - case 18: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_MAXED_EXCITEMENT: + sTVShowState = CONTESTLIVE_STATE_VERY_EXCITING_APPEAL; break; - case 19: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_USED_COMBO: + sTVShowState = CONTESTLIVE_STATE_USED_COMBO; break; - case 20: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_STARTLED_OTHER: + sTVShowState = CONTESTLIVE_STATE_STARTLED_OTHER; break; - case 21: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_SKIPPED_TURN: + sTVShowState = CONTESTLIVE_STATE_TOOK_BREAK; break; - case 22: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - StringCopy(gStringVar3, gMoveNames[show->contestLiveUpdates.move]); - sTVShowState = 23; + case CONTESTLIVE_FLAG_GOT_STARTLED: + sTVShowState = CONTESTLIVE_STATE_GOT_STARTLED; break; - case 23: - StringCopy(gStringVar1, gSpeciesNames[show->contestLiveUpdates.species]); - TVShowConvertInternationalString(gStringVar2, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); - StringCopy(gStringVar3, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); - switch (show->contestLiveUpdates.appealFlags2) - { - case 0x01: - sTVShowState = 31; - break; - case 0x02: - sTVShowState = 30; - break; - case 0x04: - sTVShowState = 29; - break; - case 0x08: - sTVShowState = 28; - break; - case 0x10: - sTVShowState = 27; - break; - case 0x20: - sTVShowState = 26; - break; - case 0x40: - sTVShowState = 25; - break; - case 0x80: - sTVShowState = 24; - break; - } + case CONTESTLIVE_FLAG_MADE_APPEAL: + sTVShowState = CONTESTLIVE_STATE_USED_MOVE; break; - case 24: - StringCopy(gStringVar1, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); - sTVShowState = 32; + } + break; + case CONTESTLIVE_STATE_BETTER_ROUND1: + switch (show->contestLiveUpdates.category) + { + case CONTEST_CATEGORY_COOL: + StringCopy(gStringVar1, gText_Cool); break; - case 25: - TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); - sTVShowState = 32; + case CONTEST_CATEGORY_BEAUTY: + StringCopy(gStringVar1, gText_Beauty); break; - case 28: - sTVShowState = 32; + case CONTEST_CATEGORY_CUTE: + StringCopy(gStringVar1, gText_Cute); break; - case 29: - TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.playerName, show->contestLiveUpdates.language); - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); - sTVShowState = 32; + case CONTEST_CATEGORY_SMART: + StringCopy(gStringVar1, gText_Smart); break; - case 26: - case 27: - case 30: - case 31: - TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); - sTVShowState = 32; + case CONTEST_CATEGORY_TOUGH: + StringCopy(gStringVar1, gText_Tough); break; - case 32: - - TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.playerName, show->contestLiveUpdates.language); - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.species]); - TVShowDone(); + } + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + switch (show->contestLiveUpdates.winnerAppealFlag) + { + case CONTESTLIVE_FLAG_EXCITING_APPEAL: + sTVShowState = CONTESTLIVE_STATE_EXCITING_APPEAL; break; + case CONTESTLIVE_FLAG_GOT_NERVOUS: + sTVShowState = CONTESTLIVE_STATE_GOT_NERVOUS; + break; + case CONTESTLIVE_FLAG_MAXED_EXCITEMENT: + sTVShowState = CONTESTLIVE_STATE_VERY_EXCITING_APPEAL; + break; + case CONTESTLIVE_FLAG_USED_COMBO: + sTVShowState = CONTESTLIVE_STATE_USED_COMBO; + break; + case CONTESTLIVE_FLAG_STARTLED_OTHER: + sTVShowState = CONTESTLIVE_STATE_STARTLED_OTHER; + break; + case CONTESTLIVE_FLAG_SKIPPED_TURN: + sTVShowState = CONTESTLIVE_STATE_TOOK_BREAK; + break; + case CONTESTLIVE_FLAG_GOT_STARTLED: + sTVShowState = CONTESTLIVE_STATE_GOT_STARTLED; + break; + case CONTESTLIVE_FLAG_MADE_APPEAL: + sTVShowState = CONTESTLIVE_STATE_USED_MOVE; + break; + } + break; + case CONTESTLIVE_STATE_GOT_NERVOUS: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_STARTLED_OTHER: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_USED_COMBO: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_EXCITING_APPEAL: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + switch (show->contestLiveUpdates.category) + { + case CONTEST_CATEGORY_COOL: + sTVShowState = CONTESTLIVE_STATE_COOL; + break; + case CONTEST_CATEGORY_BEAUTY: + sTVShowState = CONTESTLIVE_STATE_BEAUTIFUL; + break; + case CONTEST_CATEGORY_CUTE: + sTVShowState = CONTESTLIVE_STATE_CUTE; + break; + case CONTEST_CATEGORY_SMART: + sTVShowState = CONTESTLIVE_STATE_SMART; + break; + case CONTEST_CATEGORY_TOUGH: + sTVShowState = CONTESTLIVE_STATE_TOUGH; + break; + } + break; + case CONTESTLIVE_STATE_COOL: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_BEAUTIFUL: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_CUTE: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_SMART: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_TOUGH: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_VERY_EXCITING_APPEAL: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + switch (show->contestLiveUpdates.category) + { + case CONTEST_CATEGORY_COOL: + sTVShowState = CONTESTLIVE_STATE_VERY_COOL; + break; + case CONTEST_CATEGORY_BEAUTY: + sTVShowState = CONTESTLIVE_STATE_VERY_BEAUTIFUL; + break; + case CONTEST_CATEGORY_CUTE: + sTVShowState = CONTESTLIVE_STATE_VERY_CUTE; + break; + case CONTEST_CATEGORY_SMART: + sTVShowState = CONTESTLIVE_STATE_VERY_SMART; + break; + case CONTEST_CATEGORY_TOUGH: + sTVShowState = CONTESTLIVE_STATE_VERY_TOUGH; + break; + } + break; + case CONTESTLIVE_STATE_VERY_COOL: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_VERY_BEAUTIFUL: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_VERY_CUTE: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_VERY_SMART: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_VERY_TOUGH: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_TOOK_BREAK: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_GOT_STARTLED: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_USED_MOVE: + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar3, gMoveNames[show->contestLiveUpdates.move]); + sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; + break; + case CONTESTLIVE_STATE_TALK_ABOUT_LOSER: + StringCopy(gStringVar1, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + TVShowConvertInternationalString(gStringVar2, show->contestLiveUpdates.losingTrainerName, show->contestLiveUpdates.losingTrainerLanguage); + StringCopy(gStringVar3, gSpeciesNames[show->contestLiveUpdates.losingSpecies]); + switch (show->contestLiveUpdates.loserAppealFlag) + { + case CONTESTLIVE_FLAG_LOST: + sTVShowState = CONTESTLIVE_STATE_LOST; + break; + case CONTESTLIVE_FLAG_REPEATED_MOVE: + sTVShowState = CONTESTLIVE_STATE_REPEATED_APPEALS; + break; + case CONTESTLIVE_FLAG_LOST_SMALL_MARGIN: + sTVShowState = CONTESTLIVE_STATE_LOST_SMALL_MARGIN; + break; + case CONTESTLIVE_FLAG_NO_EXCITEMENT: + sTVShowState = CONTESTLIVE_STATE_NO_EXCITING_APPEALS; + break; + case CONTESTLIVE_FLAG_BLEW_LEAD: + sTVShowState = CONTESTLIVE_STATE_LOST_AFTER_ROUND1_WIN; + break; + case CONTESTLIVE_FLAG_MISSED_EXCITEMENT: + sTVShowState = CONTESTLIVE_STATE_NOT_EXCITING_ENOUGH; + break; + case CONTESTLIVE_FLAG_LAST_BOTH_ROUNDS: + sTVShowState = CONTESTLIVE_STATE_LAST_BOTH; + break; + case CONTESTLIVE_FLAG_NO_APPEALS: + sTVShowState = CONTESTLIVE_STATE_NO_APPEALS; + break; + } + break; + case CONTESTLIVE_STATE_NO_APPEALS: + StringCopy(gStringVar1, gSpeciesNames[show->contestLiveUpdates.losingSpecies]); + sTVShowState = CONTESTLIVE_STATE_OUTRO; + break; + case CONTESTLIVE_STATE_LAST_BOTH: + TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.losingTrainerName, show->contestLiveUpdates.losingTrainerLanguage); + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.losingSpecies]); + sTVShowState = CONTESTLIVE_STATE_OUTRO; + break; + case CONTESTLIVE_STATE_NO_EXCITING_APPEALS: + sTVShowState = CONTESTLIVE_STATE_OUTRO; + break; + case CONTESTLIVE_STATE_LOST_SMALL_MARGIN: + TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates.losingTrainerName, show->contestLiveUpdates.losingTrainerLanguage); + sTVShowState = CONTESTLIVE_STATE_OUTRO; + break; + case CONTESTLIVE_STATE_NOT_EXCITING_ENOUGH: + case CONTESTLIVE_STATE_LOST_AFTER_ROUND1_WIN: + case CONTESTLIVE_STATE_REPEATED_APPEALS: + case CONTESTLIVE_STATE_LOST: + TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.losingTrainerName, show->contestLiveUpdates.losingTrainerLanguage); + sTVShowState = CONTESTLIVE_STATE_OUTRO; + break; + case CONTESTLIVE_STATE_OUTRO: + TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); + StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + TVShowDone(); + break; } ShowFieldMessage(sTVContestLiveUpdatesTextGroup[state]); }