From 8f43d1ebebfec0dd021fb2476d39979c2a77ce3c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 2 Jul 2021 01:45:23 -0400 Subject: [PATCH] Document smart shopper TV show --- data/text/tv.inc | 26 +++++------ include/constants/tv.h | 15 +++++++ include/event_scripts.h | 26 +++++------ src/tv.c | 99 ++++++++++++++++++++++------------------- 4 files changed, 94 insertions(+), 72 deletions(-) diff --git a/data/text/tv.inc b/data/text/tv.inc index 287ce7f00..311f2ddd2 100644 --- a/data/text/tv.inc +++ b/data/text/tv.inc @@ -1027,7 +1027,7 @@ gTVPokemonTodaySuccessfulText11:: @ 08283A5F .string "BIG BRO: Remember, it could be your\n" .string "POKéMON in the spotlight next time!$" -gTVTodaysSmartShopperText00:: @ 08283B05 +SmartShopper_Text_Intro:: @ 08283B05 .string "Hello!\p" .string "It's time for TODAY'S SMART SHOPPER.\p" .string "INTERVIEWER: How are you, viewers?\p" @@ -1036,7 +1036,7 @@ gTVTodaysSmartShopperText00:: @ 08283B05 .string "Let's check on what the hot sellers\n" .string "have been recently.$" -gTVTodaysSmartShopperText01:: @ 08283BAF +SmartShopper_Text_ClerkNormal:: @ 08283BAF .string "Let's interview the clerk to get the\n" .string "lowdown.\p" .string "Hi, how's your business?\p" @@ -1046,7 +1046,7 @@ gTVTodaysSmartShopperText01:: @ 08283BAF .string "Why, just the other day a TRAINER\n" .string "named {STR_VAR_1} bought {STR_VAR_3}.$" -gTVTodaysSmartShopperText02:: @ 08283C81 +SmartShopper_Text_RandomComment1:: @ 08283C81 .string "INTERVIEWER: The TRAINER bought\n" .string "{STR_VAR_3} {STR_VAR_2}S? That's a haul!\p" .string "If I may say so, {STR_VAR_1} must have\n" @@ -1055,13 +1055,13 @@ gTVTodaysSmartShopperText02:: @ 08283C81 .string "For traveling, {STR_VAR_2}S are so\n" .string "important!$" -gTVTodaysSmartShopperText03:: @ 08283D32 +SmartShopper_Text_RandomComment2:: @ 08283D32 .string "INTERVIEWER: Speaking of the item\n" .string "{STR_VAR_2}, I just bought {STR_VAR_3} of\l" .string "them recently.\p" .string "After all, {STR_VAR_2}'s a great item!$" -gTVTodaysSmartShopperText04:: @ 08283D99 +SmartShopper_Text_RandomComment3:: @ 08283D99 .string "INTERVIEWER: {STR_VAR_2}?!\n" .string "But {STR_VAR_3} of them?!\p" .string "I didn't think there would be anyone\n" @@ -1069,7 +1069,7 @@ gTVTodaysSmartShopperText04:: @ 08283D99 .string "My goodness, I can only afford one or\n" .string "two at a time…$" -gTVTodaysSmartShopperText05:: @ 08283E28 +SmartShopper_Text_RandomComment4:: @ 08283E28 .string "INTERVIEWER: One time, I bought\n" .string "a whole lot of the item {STR_VAR_2}.\p" .string "But it turned out to be too many.\n" @@ -1079,21 +1079,21 @@ gTVTodaysSmartShopperText05:: @ 08283E28 .string "Oops!\p" .string "There's no point talking about me!$" -gTVTodaysSmartShopperText06:: @ 08283F01 +SmartShopper_Text_SecondItem:: @ 08283F01 .string "CLERK: {STR_VAR_1} also bought the item\n" .string "{STR_VAR_2} in bulk, taking {STR_VAR_3}.\p" .string "INTERVIEWER: Oh, that's smart.\n" .string "{STR_VAR_2}'s a very good item, too.$" -gTVTodaysSmartShopperText07:: @ 08283F72 +SmartShopper_Text_ThirdItem:: @ 08283F72 .string "CLERK: And, the TRAINER also bought\n" .string "{STR_VAR_3} of the item {STR_VAR_2}.$" -gTVTodaysSmartShopperText08:: @ 08283FA9 +SmartShopper_Text_DuringSale:: @ 08283FA9 .string "CLERK: Plus, it was during a big sale.\n" .string "That's smart shopping.$" -gTVTodaysSmartShopperText09:: @ 08283FE7 +SmartShopper_Text_OutroNormal:: @ 08283FE7 .string "INTERVIEWER: Hmm… {STR_VAR_1} sounds like\n" .string "quite the shrewd bargain hunter!\p" .string "In total, {STR_VAR_1}'s purchases came to…\p" @@ -1102,11 +1102,11 @@ gTVTodaysSmartShopperText09:: @ 08283FE7 .string "Oops! We're out of time!\n" .string "See you on our next broadcast!$" -gTVTodaysSmartShopperText10:: @ 0828409E +SmartShopper_Text_IsVIP:: @ 0828409E .string "CLERK: {STR_VAR_1} is a VIP customer,\n" .string "no doubt about it.$" -gTVTodaysSmartShopperText11:: @ 082840CE +SmartShopper_Text_ClerkMax:: @ 082840CE .string "Let's interview the clerk to get the\n" .string "lowdown.\p" .string "Hi, how's your business?\p" @@ -1127,7 +1127,7 @@ gTVTodaysSmartShopperText11:: @ 082840CE .string "CLERK: {STR_VAR_1} is a VIP customer,\n" .string "no doubt about it.$" -gTVTodaysSmartShopperText12:: @ 082842E6 +SmartShopper_Text_OutroMax:: @ 082842E6 .string "INTERVIEWER: Hmm…\n" .string "That is amazing.\p" .string "But why would the TRAINER need to buy\n" diff --git a/include/constants/tv.h b/include/constants/tv.h index 1b28f6e6e..095a6ddca 100644 --- a/include/constants/tv.h +++ b/include/constants/tv.h @@ -249,6 +249,21 @@ #define CONTESTLADYLIVE_STATE_LOST 2 #define CONTESTLADYLIVE_STATE_LOST_BADLY 3 +// TV Show states for Smart Shopper +#define SMARTSHOPPER_STATE_INTRO 0 +#define SMARTSHOPPER_STATE_CLERK_NORMAL 1 +#define SMARTSHOPPER_STATE_RAND_COMMENT_1 2 +#define SMARTSHOPPER_STATE_RAND_COMMENT_2 3 +#define SMARTSHOPPER_STATE_RAND_COMMENT_3 4 +#define SMARTSHOPPER_STATE_RAND_COMMENT_4 5 +#define SMARTSHOPPER_STATE_SECOND_ITEM 6 +#define SMARTSHOPPER_STATE_THIRD_ITEM 7 +#define SMARTSHOPPER_STATE_DURING_SALE 8 +#define SMARTSHOPPER_STATE_OUTRO_NORMAL 9 +#define SMARTSHOPPER_STATE_IS_VIP 10 +#define SMARTSHOPPER_STATE_CLERK_MAX 11 +#define SMARTSHOPPER_STATE_OUTRO_MAX 12 + #define SMARTSHOPPER_NUM_ITEMS 3 #endif //GUARD_CONSTANTS_TV_H diff --git a/include/event_scripts.h b/include/event_scripts.h index 925b4389d..3340da6f5 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -108,19 +108,19 @@ extern const u8 gTVPokemonTodaySuccessfulText08[]; extern const u8 gTVPokemonTodaySuccessfulText09[]; extern const u8 gTVPokemonTodaySuccessfulText10[]; extern const u8 gTVPokemonTodaySuccessfulText11[]; -extern const u8 gTVTodaysSmartShopperText00[]; -extern const u8 gTVTodaysSmartShopperText01[]; -extern const u8 gTVTodaysSmartShopperText02[]; -extern const u8 gTVTodaysSmartShopperText03[]; -extern const u8 gTVTodaysSmartShopperText04[]; -extern const u8 gTVTodaysSmartShopperText05[]; -extern const u8 gTVTodaysSmartShopperText06[]; -extern const u8 gTVTodaysSmartShopperText07[]; -extern const u8 gTVTodaysSmartShopperText08[]; -extern const u8 gTVTodaysSmartShopperText09[]; -extern const u8 gTVTodaysSmartShopperText10[]; -extern const u8 gTVTodaysSmartShopperText11[]; -extern const u8 gTVTodaysSmartShopperText12[]; +extern const u8 SmartShopper_Text_Intro[]; +extern const u8 SmartShopper_Text_ClerkNormal[]; +extern const u8 SmartShopper_Text_RandomComment1[]; +extern const u8 SmartShopper_Text_RandomComment2[]; +extern const u8 SmartShopper_Text_RandomComment3[]; +extern const u8 SmartShopper_Text_RandomComment4[]; +extern const u8 SmartShopper_Text_SecondItem[]; +extern const u8 SmartShopper_Text_ThirdItem[]; +extern const u8 SmartShopper_Text_DuringSale[]; +extern const u8 SmartShopper_Text_OutroNormal[]; +extern const u8 SmartShopper_Text_IsVIP[]; +extern const u8 SmartShopper_Text_ClerkMax[]; +extern const u8 SmartShopper_Text_OutroMax[]; extern const u8 gTVWorldOfMastersText00[]; extern const u8 gTVWorldOfMastersText01[]; extern const u8 gTVWorldOfMastersText02[]; diff --git a/src/tv.c b/src/tv.c index 50adde3f4..b7b490aa3 100644 --- a/src/tv.c +++ b/src/tv.c @@ -335,19 +335,19 @@ static const u8 *const sTVPokemonTodaySuccessfulTextGroup[] = { }; static const u8 *const sTVTodaysSmartShopperTextGroup[] = { - gTVTodaysSmartShopperText00, - gTVTodaysSmartShopperText01, - gTVTodaysSmartShopperText02, - gTVTodaysSmartShopperText03, - gTVTodaysSmartShopperText04, - gTVTodaysSmartShopperText05, - gTVTodaysSmartShopperText06, - gTVTodaysSmartShopperText07, - gTVTodaysSmartShopperText08, - gTVTodaysSmartShopperText09, - gTVTodaysSmartShopperText10, - gTVTodaysSmartShopperText11, - gTVTodaysSmartShopperText12 + [SMARTSHOPPER_STATE_INTRO] = SmartShopper_Text_Intro, + [SMARTSHOPPER_STATE_CLERK_NORMAL] = SmartShopper_Text_ClerkNormal, + [SMARTSHOPPER_STATE_RAND_COMMENT_1] = SmartShopper_Text_RandomComment1, + [SMARTSHOPPER_STATE_RAND_COMMENT_2] = SmartShopper_Text_RandomComment2, + [SMARTSHOPPER_STATE_RAND_COMMENT_3] = SmartShopper_Text_RandomComment3, + [SMARTSHOPPER_STATE_RAND_COMMENT_4] = SmartShopper_Text_RandomComment4, + [SMARTSHOPPER_STATE_SECOND_ITEM] = SmartShopper_Text_SecondItem, + [SMARTSHOPPER_STATE_THIRD_ITEM] = SmartShopper_Text_ThirdItem, + [SMARTSHOPPER_STATE_DURING_SALE] = SmartShopper_Text_DuringSale, + [SMARTSHOPPER_STATE_OUTRO_NORMAL] = SmartShopper_Text_OutroNormal, + [SMARTSHOPPER_STATE_IS_VIP] = SmartShopper_Text_IsVIP, + [SMARTSHOPPER_STATE_CLERK_MAX] = SmartShopper_Text_ClerkMax, + [SMARTSHOPPER_STATE_OUTRO_MAX] = SmartShopper_Text_OutroMax }; static const u8 *const sTVBravoTrainerTextGroup[] = { @@ -2785,7 +2785,7 @@ size_t CountDigits(int value) return 1; } -static void sub_80EF40C(u8 varIdx, TVShow *show) +static void SmartShopper_BufferPurchaseTotal(u8 varIdx, TVShow *show) { u8 i; int price; @@ -4460,78 +4460,85 @@ static void DoTVShowTodaysSmartShopper(void) state = sTVShowState; switch(state) { - case 0: + case SMARTSHOPPER_STATE_INTRO: TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language); GetMapName(gStringVar2, show->smartshopperShow.shopLocation, 0); if (show->smartshopperShow.itemAmounts[0] >= 255) - sTVShowState = 11; + sTVShowState = SMARTSHOPPER_STATE_CLERK_MAX; else - sTVShowState = 1; + sTVShowState = SMARTSHOPPER_STATE_CLERK_NORMAL; break; - case 1: + case SMARTSHOPPER_STATE_CLERK_NORMAL: TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language); StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[0])); ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[0]); - sTVShowState += 1 + (Random() % 4); + // Pick a random comment (SMARTSHOPPER_STATE_RAND_COMMENT_#) + sTVShowState += SMARTSHOPPER_STATE_CLERK_NORMAL + (Random() % (SMARTSHOPPER_STATE_RAND_COMMENT_4 - SMARTSHOPPER_STATE_RAND_COMMENT_1 + 1)); break; - case 2: - case 4: - case 5: + case SMARTSHOPPER_STATE_RAND_COMMENT_1: + case SMARTSHOPPER_STATE_RAND_COMMENT_3: + case SMARTSHOPPER_STATE_RAND_COMMENT_4: if (show->smartshopperShow.itemIds[1] != ITEM_NONE) - sTVShowState = 6; + sTVShowState = SMARTSHOPPER_STATE_SECOND_ITEM; else - sTVShowState = 10; + sTVShowState = SMARTSHOPPER_STATE_IS_VIP; break; - case 3: + case SMARTSHOPPER_STATE_RAND_COMMENT_2: ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[0] + 1); if (show->smartshopperShow.itemIds[1] != ITEM_NONE) - sTVShowState = 6; + sTVShowState = SMARTSHOPPER_STATE_SECOND_ITEM; else - sTVShowState = 10; + sTVShowState = SMARTSHOPPER_STATE_IS_VIP; break; - case 6: + case SMARTSHOPPER_STATE_SECOND_ITEM: + // Clerk describes 2nd type of item player purchased StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[1])); ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[1]); if (show->smartshopperShow.itemIds[2] != ITEM_NONE) - sTVShowState = 7; + sTVShowState = SMARTSHOPPER_STATE_THIRD_ITEM; else if (show->smartshopperShow.priceReduced == TRUE) - sTVShowState = 8; + sTVShowState = SMARTSHOPPER_STATE_DURING_SALE; else - sTVShowState = 9; + sTVShowState = SMARTSHOPPER_STATE_OUTRO_NORMAL; break; - case 7: + case SMARTSHOPPER_STATE_THIRD_ITEM: + // Clerk describes 3rd type of item player purchased StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[2])); ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[2]); if (show->smartshopperShow.priceReduced == TRUE) - sTVShowState = 8; + sTVShowState = SMARTSHOPPER_STATE_DURING_SALE; else - sTVShowState = 9; + sTVShowState = SMARTSHOPPER_STATE_OUTRO_NORMAL; break; - case 8: + case SMARTSHOPPER_STATE_DURING_SALE: if (show->smartshopperShow.itemAmounts[0] >= 255) - sTVShowState = 12; + sTVShowState = SMARTSHOPPER_STATE_OUTRO_MAX; else - sTVShowState = 9; + sTVShowState = SMARTSHOPPER_STATE_OUTRO_NORMAL; break; - case 9: - sub_80EF40C(1, show); + case SMARTSHOPPER_STATE_OUTRO_NORMAL: + SmartShopper_BufferPurchaseTotal(1, show); TVShowDone(); break; - case 10: + case SMARTSHOPPER_STATE_IS_VIP: + // Clerk says customer is a VIP + // Said if player only purchased one type of item if (show->smartshopperShow.priceReduced == TRUE) - sTVShowState = 8; + sTVShowState = SMARTSHOPPER_STATE_DURING_SALE; else - sTVShowState = 9; + sTVShowState = SMARTSHOPPER_STATE_OUTRO_NORMAL; break; - case 11: + case SMARTSHOPPER_STATE_CLERK_MAX: + // Clerk's comments if player purchased maximum number of 1st item TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language); StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[0])); if (show->smartshopperShow.priceReduced == TRUE) - sTVShowState = 8; + sTVShowState = SMARTSHOPPER_STATE_DURING_SALE; else - sTVShowState = 12; + sTVShowState = SMARTSHOPPER_STATE_OUTRO_MAX; break; - case 12: + case SMARTSHOPPER_STATE_OUTRO_MAX: + // Outro comments if player purchased maximum number of 1st item TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language); TVShowDone(); break;