From 8be2c5d60b54347c9df22410d97255d836d9fc9d Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 2 Apr 2021 01:49:38 -0400 Subject: [PATCH] Document Contest Lady TV Show --- data/text/tv.inc | 8 +-- include/constants/lilycove_lady.h | 10 +++- include/constants/tv.h | 8 ++- include/event_scripts.h | 8 +-- include/global.tv.h | 4 +- include/lilycove_lady.h | 2 +- src/lilycove_lady.c | 19 ++----- src/tv.c | 90 +++++++++++++++---------------- 8 files changed, 76 insertions(+), 73 deletions(-) diff --git a/data/text/tv.inc b/data/text/tv.inc index 72d391034..287ce7f00 100644 --- a/data/text/tv.inc +++ b/data/text/tv.inc @@ -2925,7 +2925,7 @@ gTVInSearchOfTrainersText08:: @ 0828C011 .string "That's all for today!\n" .string "See you again on our next broadcast!$" -gTVPokemonContestLiveUpdates2Text00:: @ 0828C137 +ContestLadyShow_Text_Intro:: @ 0828C137 .string "“POKéMON CONTEST LIVE UPDATES!”\p" .string "MC: Sorry to interrupt the regular\n" .string "programming, and thanks for joining us!\p" @@ -2940,7 +2940,7 @@ gTVPokemonContestLiveUpdates2Text00:: @ 0828C137 .string "Spectators: ?!!!!\n" .string "?!!!!$" -gTVPokemonContestLiveUpdates2Text01:: @ 0828C28C +ContestLadyShow_Text_Won:: @ 0828C28C .string "MC: Excuse me!\n" .string "Thanks for joining us on live TV!\p" .string "May I congratulate you on your win?\p" @@ -2959,7 +2959,7 @@ gTVPokemonContestLiveUpdates2Text01:: @ 0828C28C .string "We did it!\l" .string "Thank you!$" -gTVPokemonContestLiveUpdates2Text02:: @ 0828C45B +ContestLadyShow_Text_Lost:: @ 0828C45B .string "MC: Excuse me!\n" .string "Thanks for joining us on live TV!\p" .string "You must be disappointed by that turn\n" @@ -2979,7 +2979,7 @@ gTVPokemonContestLiveUpdates2Text02:: @ 0828C45B .string "Uh… That's all the time we have today!\n" .string "Thanks for tuning in!$" -gTVPokemonContestLiveUpdates2Text03:: @ 0828C662 +ContestLadyShow_Text_LostBadly:: @ 0828C662 .string "MC: Excuse me!\n" .string "Thanks for joining us on live TV!\p" .string "How did your CONTEST appearance go?\p" diff --git a/include/constants/lilycove_lady.h b/include/constants/lilycove_lady.h index 01f60ccf4..11b9b31e9 100644 --- a/include/constants/lilycove_lady.h +++ b/include/constants/lilycove_lady.h @@ -21,6 +21,12 @@ #define QUIZ_AUTHOR_NAME_PLAYER 1 #define QUIZ_AUTHOR_NAME_OTHER_PLAYER 2 -#define QUIZ_QUESTION_LEN 9 +#define QUIZ_QUESTION_LEN 9 -#endif +// Constants for how many good Pokéblocks the Contest Lady was given +// This determines how her performance is described when her TV show comes on +#define CONTEST_LADY_NORMAL 0 +#define CONTEST_LADY_GOOD 1 +#define CONTEST_LADY_BAD 2 + +#endif // GUARD_LILYCOVE_LADY_CONSTANTS_H diff --git a/include/constants/tv.h b/include/constants/tv.h index 57da9837b..f7b091f49 100644 --- a/include/constants/tv.h +++ b/include/constants/tv.h @@ -19,7 +19,7 @@ #define TVSHOW_3_CHEERS_FOR_POKEBLOCKS 9 #define TVSHOW_BATTLE_UPDATE 10 #define TVSHOW_FAN_CLUB_SPECIAL 11 -#define TVSHOW_CONTEST_LIVE_UPDATES_2 12 +#define TVSHOW_LILYCOVE_CONTEST_LADY 12 // // #define TVSHOW_POKEMON_TODAY_CAUGHT 21 #define TVSHOW_SMART_SHOPPER 22 @@ -215,4 +215,10 @@ #define TRENDWATCHER_STATE_BIGGER_FEMALE 5 #define TRENDWATCHER_STATE_OUTRO 6 +// TV Show states for the Contest Lady's Live Updates show +#define CONTESTLADYLIVE_STATE_INTRO 0 +#define CONTESTLADYLIVE_STATE_WON 1 +#define CONTESTLADYLIVE_STATE_LOST 2 +#define CONTESTLADYLIVE_STATE_LOST_BADLY 3 + #endif //GUARD_CONSTANTS_TV_H diff --git a/include/event_scripts.h b/include/event_scripts.h index ecb40c266..122af54cc 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -344,10 +344,10 @@ extern const u8 gTVInSearchOfTrainersText05[]; extern const u8 gTVInSearchOfTrainersText06[]; extern const u8 gTVInSearchOfTrainersText07[]; extern const u8 gTVInSearchOfTrainersText08[]; -extern const u8 gTVPokemonContestLiveUpdates2Text00[]; -extern const u8 gTVPokemonContestLiveUpdates2Text01[]; -extern const u8 gTVPokemonContestLiveUpdates2Text02[]; -extern const u8 gTVPokemonContestLiveUpdates2Text03[]; +extern const u8 ContestLadyShow_Text_Intro[]; +extern const u8 ContestLadyShow_Text_Won[]; +extern const u8 ContestLadyShow_Text_Lost[]; +extern const u8 ContestLadyShow_Text_LostBadly[]; extern const u8 gPokeNewsTextSlateport_Upcoming[]; extern const u8 gPokeNewsTextSlateport_Ongoing[]; extern const u8 gPokeNewsTextSlateport_Ending[]; diff --git a/include/global.tv.h b/include/global.tv.h index 8e1a898b6..64e6a984e 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -179,7 +179,7 @@ typedef union // size = 0x24 /*0x18*/ u8 idolNameLanguage; } fanClubSpecial; - // TVSHOW_CONTEST_LIVE_UPDATES_2 + // TVSHOW_LILYCOVE_CONTEST_LADY struct { /*0x00*/ u8 kind; /*0x01*/ bool8 active; @@ -189,7 +189,7 @@ typedef union // size = 0x24 /*0x16*/ u8 pokeblockState; /*0x17*/ u8 language; /*0x18*/ u8 pokemonNameLanguage; - } contestLiveUpdates2; + } contestLady; // Record Mixing Shows // TVSHOW_POKEMON_TODAY_CAUGHT diff --git a/include/lilycove_lady.h b/include/lilycove_lady.h index 1ec327be9..d3cce4ca8 100644 --- a/include/lilycove_lady.h +++ b/include/lilycove_lady.h @@ -12,6 +12,6 @@ void BufferContestLadyMonName(u8 *dest1, u8 *dest2); void BufferContestLadyPlayerName(u8 *dest); void BufferContestLadyLanguage(u8 *dest); void BufferContestName(u8 *dest, u8 category); -u8 sub_818E880(void); +u8 GetContestLadyPokeblockState(void); #endif //GUARD_LILYCOVE_LADY_H diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c index 5bad07420..22155ffd5 100644 --- a/src/lilycove_lady.c +++ b/src/lilycove_lady.c @@ -762,25 +762,16 @@ void BufferContestName(u8 *dest, u8 category) StringCopy(dest, sContestNames[category]); } -// used in tv.c to determine sTVShowState for Contest Lady show -// if return val is 1, sTVShowState is 1 -// if return val is 2, sTVShowState is 3 -// if return val is 0, sTVShowState is 2 -u8 sub_818E880(void) +// Used by the Contest Lady's TV show to determine how well she performed +u8 GetContestLadyPokeblockState(void) { sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest; if (sContestLadyPtr->numGoodPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD) - { - return 1; - } + return CONTEST_LADY_GOOD; else if (sContestLadyPtr->numGoodPokeblocksGiven == 0) - { - return 2; - } + return CONTEST_LADY_BAD; else - { - return 0; - } + return CONTEST_LADY_NORMAL; } diff --git a/src/tv.c b/src/tv.c index 691b343d8..0466ee713 100644 --- a/src/tv.c +++ b/src/tv.c @@ -38,6 +38,7 @@ #include "constants/contest.h" #include "constants/items.h" #include "constants/layouts.h" +#include "constants/lilycove_lady.h" #include "constants/maps.h" #include "constants/metatile_behaviors.h" #include "constants/moves.h" @@ -179,7 +180,7 @@ static void DoTVShowPokemonNewsBattleFrontier(void); static void DoTVShowWhatsNo1InHoennToday(void); static void DoTVShowSecretBaseSecrets(void); static void DoTVShowSafariFanClub(void); -static void DoTVShowPokemonContestLiveUpdates2(void); +static void DoTVShowLilycoveContestLady(void); // .rodata @@ -461,11 +462,11 @@ static const u8 *const sTVNameRaterTextGroup[] = { gTVNameRaterText18 }; -static const u8 *const sTVPokemonContestLiveUpdates2TextGroup[] = { - gTVPokemonContestLiveUpdates2Text00, - gTVPokemonContestLiveUpdates2Text01, - gTVPokemonContestLiveUpdates2Text02, - gTVPokemonContestLiveUpdates2Text03 +static const u8 *const sTVLilycoveContestLadyTextGroup[] = { + [CONTESTLADYLIVE_STATE_INTRO] = ContestLadyShow_Text_Intro, + [CONTESTLADYLIVE_STATE_WON] = ContestLadyShow_Text_Won, + [CONTESTLADYLIVE_STATE_LOST] = ContestLadyShow_Text_Lost, + [CONTESTLADYLIVE_STATE_LOST_BADLY] = ContestLadyShow_Text_LostBadly }; static const u8 *const sTVPokemonTodayFailedTextGroup[] = { @@ -1661,13 +1662,13 @@ void PutLilycoveContestLadyShowOnTheAir(void) if (gSpecialVar_Result != TRUE) { show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot]; - BufferContestLadyLanguage(&show->contestLiveUpdates2.language); - show->contestLiveUpdates2.pokemonNameLanguage = GAME_LANGUAGE; - show->contestLiveUpdates2.kind = TVSHOW_CONTEST_LIVE_UPDATES_2; - show->contestLiveUpdates2.active = TRUE; - BufferContestLadyPlayerName(show->contestLiveUpdates2.playerName); - BufferContestLadyMonName(&show->contestLiveUpdates2.contestCategory, show->contestLiveUpdates2.nickname); - show->contestLiveUpdates2.pokeblockState = sub_818E880(); + BufferContestLadyLanguage(&show->contestLady.language); + show->contestLady.pokemonNameLanguage = GAME_LANGUAGE; + show->contestLady.kind = TVSHOW_LILYCOVE_CONTEST_LADY; + show->contestLady.active = TRUE; + BufferContestLadyPlayerName(show->contestLady.playerName); + BufferContestLadyMonName(&show->contestLady.contestCategory, show->contestLady.nickname); + show->contestLady.pokeblockState = GetContestLadyPokeblockState(); tv_store_id_2x(show); } } @@ -3812,9 +3813,8 @@ static void sub_80F0708(void) // FIXME: register allocation shenanigans break; case TVSHOW_FAN_CLUB_SPECIAL: break; - case TVSHOW_CONTEST_LIVE_UPDATES_2: + case TVSHOW_LILYCOVE_CONTEST_LADY: break; - case TVSHOW_OFF_AIR: break; case TVSHOW_FAN_CLUB_LETTER: @@ -4308,11 +4308,10 @@ static void sub_80F12A4(TVShow *shows) curShow->fanClubSpecial.language = TV_GetStringLanguage(curShow->fanClubSpecial.playerName); curShow->fanClubSpecial.idolNameLanguage = TV_GetStringLanguage(curShow->fanClubSpecial.idolName); break; - case TVSHOW_CONTEST_LIVE_UPDATES_2: - curShow->contestLiveUpdates2.language = TV_GetStringLanguage(curShow->contestLiveUpdates2.playerName); - curShow->contestLiveUpdates2.pokemonNameLanguage = TV_GetStringLanguage(curShow->contestLiveUpdates2.nickname); + case TVSHOW_LILYCOVE_CONTEST_LADY: + curShow->contestLady.language = TV_GetStringLanguage(curShow->contestLady.playerName); + curShow->contestLady.pokemonNameLanguage = TV_GetStringLanguage(curShow->contestLady.nickname); break; - case TVSHOW_POKEMON_TODAY_CAUGHT: curShow->pokemonToday.language = TV_GetStringLanguage(curShow->pokemonToday.playerName); curShow->pokemonToday.language2 = TV_GetStringLanguage(curShow->pokemonToday.nickname); @@ -4492,8 +4491,8 @@ void DoTVShow(void) case TVSHOW_SAFARI_FAN_CLUB: DoTVShowSafariFanClub(); break; - case TVSHOW_CONTEST_LIVE_UPDATES_2: - DoTVShowPokemonContestLiveUpdates2(); + case TVSHOW_LILYCOVE_CONTEST_LADY: + DoTVShowLilycoveContestLady(); break; } } @@ -7174,7 +7173,8 @@ static void DoTVShowSafariFanClub(void) ShowFieldMessage(sTVSafariFanClubTextGroup[state]); } -static void DoTVShowPokemonContestLiveUpdates2(void) +// This show is a version of Contest Live Updates for the Lilycove Contest Lady +static void DoTVShowLilycoveContestLady(void) { TVShow *show; u8 state; @@ -7184,30 +7184,30 @@ static void DoTVShowPokemonContestLiveUpdates2(void) state = sTVShowState; switch (state) { - case 0: - BufferContestName(gStringVar1, show->contestLiveUpdates2.contestCategory); - if (show->contestLiveUpdates2.pokeblockState == 1) - { - sTVShowState = 1; - } - else if (show->contestLiveUpdates2.pokeblockState == 0) - { - sTVShowState = 2; - } - else - { - sTVShowState = 3; - } - break; - case 1: - case 2: - TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates2.playerName, show->contestLiveUpdates2.language); - case 3: - TVShowConvertInternationalString(gStringVar2, show->contestLiveUpdates2.nickname, show->contestLiveUpdates2.pokemonNameLanguage); - TVShowDone(); - break; + case CONTESTLADYLIVE_STATE_INTRO: + BufferContestName(gStringVar1, show->contestLady.contestCategory); + if (show->contestLady.pokeblockState == CONTEST_LADY_GOOD) + { + sTVShowState = CONTESTLADYLIVE_STATE_WON; + } + else if (show->contestLady.pokeblockState == CONTEST_LADY_NORMAL) + { + sTVShowState = CONTESTLADYLIVE_STATE_LOST; + } + else // CONTEST_LADY_BAD + { + sTVShowState = CONTESTLADYLIVE_STATE_LOST_BADLY; + } + break; + case CONTESTLADYLIVE_STATE_WON: + case CONTESTLADYLIVE_STATE_LOST: + TVShowConvertInternationalString(gStringVar3, show->contestLady.playerName, show->contestLady.language); + case CONTESTLADYLIVE_STATE_LOST_BADLY: + TVShowConvertInternationalString(gStringVar2, show->contestLady.nickname, show->contestLady.pokemonNameLanguage); + TVShowDone(); + break; } - ShowFieldMessage(sTVPokemonContestLiveUpdates2TextGroup[state]); + ShowFieldMessage(sTVLilycoveContestLadyTextGroup[state]); } void TVShowDone(void)