diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-04-01 22:19:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-01 22:19:48 -0400 |
commit | 51970f97b0e48b0bffa8ab9229ac30a94f57512a (patch) | |
tree | 70ec5b040d0732a97049e3b7341e6cc218130ec7 /src | |
parent | 21fd6827b090f6c64924fe88bec7cf80147df3d2 (diff) | |
parent | 691c680908312c883362d0bbc2aad30e986b665a (diff) |
Merge pull request #1393 from GriffinRichards/doc-dewfordtrend
Document Dewford Trend and match_call.c
Diffstat (limited to 'src')
-rw-r--r-- | src/dewford_trend.c | 458 | ||||
-rw-r--r-- | src/easy_chat.c | 37 | ||||
-rw-r--r-- | src/field_specials.c | 2 | ||||
-rw-r--r-- | src/match_call.c | 1343 | ||||
-rwxr-xr-x | src/pokenav_match_call_2.c | 6 | ||||
-rw-r--r-- | src/record_mixing.c | 18 | ||||
-rw-r--r-- | src/tv.c | 92 | ||||
-rw-r--r-- | src/wild_encounter.c | 2 |
8 files changed, 1060 insertions, 898 deletions
diff --git a/src/dewford_trend.c b/src/dewford_trend.c index c60797f86..09a8d2afe 100644 --- a/src/dewford_trend.c +++ b/src/dewford_trend.c @@ -10,311 +10,388 @@ #include "string_util.h" #include "constants/easy_chat.h" -// static functions -static void sub_8122804(struct EasyChatPair *s, u16 b, u8 c); -static bool8 sub_8122A58(struct EasyChatPair *a, struct EasyChatPair *b, u8 c); -static void sub_8122B28(struct EasyChatPair *s); -static bool8 SB1ContainsWords(u16 *a); -static bool8 IsEasyChatPairEqual(u16 *words1, u16 *words2); -static s16 GetEqualEasyChatPairIndex(struct EasyChatPair *s, struct EasyChatPair *a, u16 b); - -// text +/* + ## Overview ## + This file handles the "Dewford Trend", a pair of Easy Chat words + repeated by NPCs around Dewford Hall. + + The NPC outside Dewford Hall will ask what the player thinks of the + current trendy phrase, and the player may submit a new pair of words. + If the NPC thinks the submitted phrase is "trendier" than the + current one (see TrySetTrendyPhrase), it becomes the new phrase. + + ## struct DewfordTrend ## + Information about a Dewford trend is stored in a struct DewfordTrend. + In addition to the two easy chat words that make up the trend's phrase, + each trend has a few randomly generated values associated with it. + - rand: + This is a 16 bit value generated once when the phrase is created. + It's used in calculations for Feebas tiles, Slot Machines, and Match Call. + - trendiness / maxTrendiness: + Initialized as a random value between 30-127 inclusive. This is used to + compare how trendy one phrase is vs another. If a submitted phrase is + less trendy than the current one it won't be accepted. If the trend is + "boring" (see below) it will lose trendiness over time until it reaches 0, + at which point it will stop being boring and gain trendiness until it + reaches maxTrendiness (then it becomes boring again and the cycle repeats). + - gainingTrendiness: + This is a flag that determines whether a phrase should be gaining or losing + trendiness. An NPC in Dewford Hall will comment on whether the current phrase + is "boring" or not, and if it is gaining trendiness (or if it is still trendier + than the last phrase) it is not boring. This field will always be TRUE for any + new phrase submitted after the 1st submission. + + ## Saving trends ## + Each time a potential trendy phrase is submitted, it is saved in gSaveBlock1Ptr->dewfordTrends[]. + Up to SAVED_TRENDS_COUNT (5) trends may be saved at one time. The trends in this array are kept + in sorted order from most trendy to least trendy. The current trendy phrase is always at + gSaveBlock1Ptr->dewfordTrends[0]. If the player mixes records with another player, their own + trends are replaced with their mixing partner's, unless the phrase is the same, in which case + the version with a higher trendiness value is used (see ReceiveDewfordTrendData). + + ## TV Show ## + If a submitted phrase is only trendier than 1 or none of the saved trends, it may trigger a + TV Show called Trend Watcher (see TryPutTrendWatcherOnAir) that, ironically, spends the + show talking about how the submitted phrase was not trendy. + +*/ + +enum { + SORT_MODE_NORMAL, + SORT_MODE_MAX_FIRST, + SORT_MODE_FULL, +}; + +static void SortTrends(struct DewfordTrend *, u16, u8); +static bool8 CompareTrends(struct DewfordTrend *, struct DewfordTrend *, u8); +static void SeedTrendRng(struct DewfordTrend *); +static bool8 IsPhraseInSavedTrends(u16 *); +static bool8 IsEasyChatPairEqual(u16 *, u16 *); +static s16 GetSavedTrendIndex(struct DewfordTrend *, struct DewfordTrend *, u16); + void InitDewfordTrend(void) { u16 i; - for (i = 0; i < 5; i++) + for (i = 0; i < SAVED_TRENDS_COUNT; i++) { - gSaveBlock1Ptr->easyChatPairs[i].words[0] = GetRandomEasyChatWordFromGroup(EC_GROUP_CONDITIONS); + gSaveBlock1Ptr->dewfordTrends[i].words[0] = GetRandomEasyChatWordFromGroup(EC_GROUP_CONDITIONS); if (Random() & 1) - gSaveBlock1Ptr->easyChatPairs[i].words[1] = GetRandomEasyChatWordFromGroup(EC_GROUP_LIFESTYLE); + gSaveBlock1Ptr->dewfordTrends[i].words[1] = GetRandomEasyChatWordFromGroup(EC_GROUP_LIFESTYLE); else - gSaveBlock1Ptr->easyChatPairs[i].words[1] = GetRandomEasyChatWordFromGroup(EC_GROUP_HOBBIES); + gSaveBlock1Ptr->dewfordTrends[i].words[1] = GetRandomEasyChatWordFromGroup(EC_GROUP_HOBBIES); - gSaveBlock1Ptr->easyChatPairs[i].unk1_6 = Random() & 1; - sub_8122B28(&(gSaveBlock1Ptr->easyChatPairs[i])); + gSaveBlock1Ptr->dewfordTrends[i].gainingTrendiness = Random() & 1; + SeedTrendRng(&(gSaveBlock1Ptr->dewfordTrends[i])); } - sub_8122804(gSaveBlock1Ptr->easyChatPairs, 5, 0); + SortTrends(gSaveBlock1Ptr->dewfordTrends, SAVED_TRENDS_COUNT, SORT_MODE_NORMAL); } -void UpdateDewfordTrendPerDay(u16 a) +void UpdateDewfordTrendPerDay(u16 days) { u16 i; - if (a != 0) + if (days != 0) { - u32 sp0 = a * 5; + u32 clockRand = days * 5; - for (i = 0; i < 5; i++) + for (i = 0; i < SAVED_TRENDS_COUNT; i++) { - u32 r4; - u32 r2 = sp0; - struct EasyChatPair *r5 = &(gSaveBlock1Ptr->easyChatPairs[i]); + u32 trendiness; + u32 rand = clockRand; + struct DewfordTrend *trend = &gSaveBlock1Ptr->dewfordTrends[i]; - if (r5->unk1_6 == 0) + if (!trend->gainingTrendiness) { - if (r5->unk0_0 >= (u16)r2) + // This trend is "boring" + // Lose trendiness until it becomes 0 + if (trend->trendiness >= (u16)rand) { - r5->unk0_0 -= r2; - if (r5->unk0_0 == 0) - r5->unk1_6 = 1; + trend->trendiness -= rand; + if (trend->trendiness == 0) + trend->gainingTrendiness = TRUE; continue; } - r2 -= r5->unk0_0; - r5->unk0_0 = 0; - r5->unk1_6 = 1; + rand -= trend->trendiness; + trend->trendiness = 0; + trend->gainingTrendiness = TRUE; } - r4 = r5->unk0_0 + r2; - if ((u16)r4 > r5->unk0_7) + + trendiness = trend->trendiness + rand; + if ((u16)trendiness > trend->maxTrendiness) { - u32 sp4 = r4 % r5->unk0_7; - r4 = r4 / r5->unk0_7; + // Reached limit, reset trendiness + u32 newTrendiness = trendiness % trend->maxTrendiness; + trendiness = trendiness / trend->maxTrendiness; - r5->unk1_6 = r4 ^ 1; - if (r5->unk1_6) - r5->unk0_0 = sp4; + trend->gainingTrendiness = trendiness ^ 1; + if (trend->gainingTrendiness) + trend->trendiness = newTrendiness; else - r5->unk0_0 = r5->unk0_7 - sp4; + trend->trendiness = trend->maxTrendiness - newTrendiness; } else { - r5->unk0_0 = r4; + // Increase trendiness + trend->trendiness = trendiness; - if (r5->unk0_0 == r5->unk0_7) - r5->unk1_6 = 0; + // Trend has reached its max, becoming "boring" and start losing trendiness + if (trend->trendiness == trend->maxTrendiness) + trend->gainingTrendiness = FALSE; } } - sub_8122804(gSaveBlock1Ptr->easyChatPairs, 5, 0); + SortTrends(gSaveBlock1Ptr->dewfordTrends, SAVED_TRENDS_COUNT, SORT_MODE_NORMAL); } } - -bool8 IsPhraseTrendy(u16 *a) +// Returns TRUE if the current trendy phrase was successfully changed to the given phrase +// Returns FALSE otherwise +// Regardless of whether or not the current trendy phrase was changed, the submitted +// phrase is always saved in gSaveBlock1Ptr->dewfordTrends +bool8 TrySetTrendyPhrase(u16 *phrase) { - struct EasyChatPair s = {0}; + struct DewfordTrend trend = {0}; u16 i; - if (!SB1ContainsWords(a)) + if (!IsPhraseInSavedTrends(phrase)) { - if (!FlagGet(FLAG_SYS_POPWORD_INPUT)) + if (!FlagGet(FLAG_SYS_CHANGED_DEWFORD_TREND)) { - FlagSet(FLAG_SYS_POPWORD_INPUT); + FlagSet(FLAG_SYS_CHANGED_DEWFORD_TREND); + + // Make sure player couldn't have received this phrase by mixing records if (!FlagGet(FLAG_SYS_MIX_RECORD)) { - gSaveBlock1Ptr->easyChatPairs[0].words[0] = a[0]; - gSaveBlock1Ptr->easyChatPairs[0].words[1] = a[1]; + // This is the first time submitting a phrase + // No need to check saved phrases or reset rng, just set the new words + gSaveBlock1Ptr->dewfordTrends[0].words[0] = phrase[0]; + gSaveBlock1Ptr->dewfordTrends[0].words[1] = phrase[1]; return TRUE; } } - s.words[0] = a[0]; - s.words[1] = a[1]; - s.unk1_6 = 1; - sub_8122B28(&s); + // Initialize DewfordTrend using given phrase + trend.words[0] = phrase[0]; + trend.words[1] = phrase[1]; + trend.gainingTrendiness = TRUE; + SeedTrendRng(&trend); - for (i = 0; i < 5; i++) + for (i = 0; i < SAVED_TRENDS_COUNT; i++) { - if (sub_8122A58(&s, &(gSaveBlock1Ptr->easyChatPairs[i]), 0)) + if (CompareTrends(&trend, &(gSaveBlock1Ptr->dewfordTrends[i]), SORT_MODE_NORMAL)) { - u16 r3 = 4; - - while (r3 > i) + // New trend is "trendier" than dewfordTrend[i] + // Shift other trends back to insert new trend + u16 j = SAVED_TRENDS_COUNT - 1; + while (j > i) { - gSaveBlock1Ptr->easyChatPairs[r3] = gSaveBlock1Ptr->easyChatPairs[r3 - 1]; - r3--; + gSaveBlock1Ptr->dewfordTrends[j] = gSaveBlock1Ptr->dewfordTrends[j - 1]; + j--; } - gSaveBlock1Ptr->easyChatPairs[i] = s; - if(i == 4) - sub_80EDC60(a); + gSaveBlock1Ptr->dewfordTrends[i] = trend; + + if (i == SAVED_TRENDS_COUNT - 1) + TryPutTrendWatcherOnAir(phrase); + + // If i is 0, the given phrase is the new current phrase return (i == 0); } } - gSaveBlock1Ptr->easyChatPairs[4] = s; - sub_80EDC60(a); + + // New trend is less "trendy" than all other saved trends, put it in last + gSaveBlock1Ptr->dewfordTrends[SAVED_TRENDS_COUNT - 1] = trend; + TryPutTrendWatcherOnAir(phrase); } return FALSE; } -static void sub_8122804(struct EasyChatPair *s, u16 b, u8 c) +static void SortTrends(struct DewfordTrend *trends, u16 numTrends, u8 mode) { - u16 h; - - for (h = 0; h < b; h++) + u16 i; + for (i = 0; i < numTrends; i++) { - u16 i; - - for (i = h + 1; i < b; i++) + u16 j; + for (j = i + 1; j < numTrends; j++) { - if (sub_8122A58(&s[i], &s[h], c)) + if (CompareTrends(&trends[j], &trends[i], mode)) { - struct EasyChatPair temp; - - temp = s[i]; - s[i] = s[h]; - s[h] = temp; + struct DewfordTrend temp; + SWAP(trends[j], trends[i], temp); } } } } -void ReceiveEasyChatPairsData(struct EasyChatPair *a, size_t size, u8 unused) +#define SAVED_TRENDS_SIZE (sizeof(struct DewfordTrend) * SAVED_TRENDS_COUNT) +#define BUFFER_SIZE (SAVED_TRENDS_SIZE * MAX_LINK_PLAYERS > 0x100 ? SAVED_TRENDS_SIZE * MAX_LINK_PLAYERS : 0x100) // More space was allocated than needed + +void ReceiveDewfordTrendData(struct DewfordTrend *linkedTrends, size_t size, u8 unused) { - u16 i, j, r3, players; - struct EasyChatPair *buffer1, *buffer2, *src, *dst, *foo_of_buffer2; + u16 i, j, numTrends, players; + struct DewfordTrend *linkedTrendsBuffer, *savedTrendsBuffer, *src, *dst, *temp; - buffer1 = Alloc(0x100); - if(buffer1 != NULL) + // Exit if alloc fails + if (!(linkedTrendsBuffer = Alloc(BUFFER_SIZE))) + return; + + // Exit if alloc fails + if (!(savedTrendsBuffer = Alloc(BUFFER_SIZE))) { - buffer2 = Alloc(0x100); - if(buffer2 == NULL) - { - Free(buffer1); - } - else + Free(linkedTrendsBuffer); + return; + } + + // Buffer the new trends being received via Record Mixing + players = GetLinkPlayerCount(); + for (i = 0; i < players; i++) + memcpy(&linkedTrendsBuffer[i * SAVED_TRENDS_COUNT], (u8 *)linkedTrends + i * size, SAVED_TRENDS_SIZE); + + // Determine which of the received trends should be saved. + // savedTrendsBuffer starts empty, and when finished will contain + // which of the linked trends to save in the saveblock. + src = linkedTrendsBuffer; + dst = savedTrendsBuffer; + numTrends = 0; + for (i = 0; i < players; i++) + { + for (j = 0; j < SAVED_TRENDS_COUNT; j++) { - players = GetLinkPlayerCount(); - for (i = 0; i < players; i++) - memcpy(&(buffer1[i * 5]), (u8 *)a + i * size, 40); - src = buffer1; - dst = buffer2; - r3 = 0; - for (i = 0; i < players; i++) + s16 idx = GetSavedTrendIndex(savedTrendsBuffer, src, numTrends); + if (idx < 0) { - for (j = 0; j < 5; j++) + // This phrase is not a currently saved trend, save it + *(dst++) = *src; + numTrends++; + } + else + { + // This phrase already exists as a saved phrase + // Only overwrrite it if it's "trendier" + temp = &savedTrendsBuffer[idx]; + if (temp->trendiness < src->trendiness) { - s16 foo = GetEqualEasyChatPairIndex(buffer2, src, r3); - if (foo < 0) - { - *(dst++) = *src; - r3++; - } - else - { - foo_of_buffer2 = (struct EasyChatPair *)((u32)buffer2 + (foo * 8)); //required to do this to reverse the order of register operands in add ASM statement - if (foo_of_buffer2->unk0_0 < src->unk0_0) - { - *foo_of_buffer2 = *src; - } - } - src++; + *temp = *src; } } - sub_8122804(buffer2, r3, 2); - src = buffer2; - dst = gSaveBlock1Ptr->easyChatPairs; - for (i = 0; i < 5; i++) - *(dst++) = *(src++); - Free(buffer1); - Free(buffer2); + src++; } } + SortTrends(savedTrendsBuffer, numTrends, SORT_MODE_FULL); + + // Overwrite current saved trends with new saved trends + src = savedTrendsBuffer; + dst = gSaveBlock1Ptr->dewfordTrends; + for (i = 0; i < SAVED_TRENDS_COUNT; i++) + *(dst++) = *(src++); + + Free(linkedTrendsBuffer); + Free(savedTrendsBuffer); } void BufferTrendyPhraseString(void) { - struct EasyChatPair *s = &gSaveBlock1Ptr->easyChatPairs[gSpecialVar_0x8004]; - - ConvertEasyChatWordsToString(gStringVar1, s->words, 2, 1); + struct DewfordTrend *trend = &gSaveBlock1Ptr->dewfordTrends[gSpecialVar_0x8004]; + ConvertEasyChatWordsToString(gStringVar1, trend->words, 2, 1); } -void TrendyPhraseIsOld(void) +// Returns TRUE if the current trendy phrase is "boring", FALSE otherwise +// This only influences the comment of an NPC inside the Dewford Town Hall +void IsTrendyPhraseBoring(void) { - u16 result = 0; + bool16 result = FALSE; do { - if (gSaveBlock1Ptr->easyChatPairs[0].unk0_0 - gSaveBlock1Ptr->easyChatPairs[1].unk0_0 > 1) + if (gSaveBlock1Ptr->dewfordTrends[0].trendiness - gSaveBlock1Ptr->dewfordTrends[1].trendiness > 1) break; - if (gSaveBlock1Ptr->easyChatPairs[0].unk1_6) + if (gSaveBlock1Ptr->dewfordTrends[0].gainingTrendiness) break; - if (!gSaveBlock1Ptr->easyChatPairs[1].unk1_6) + if (!gSaveBlock1Ptr->dewfordTrends[1].gainingTrendiness) break; - result = 1; + result = TRUE; } while (0); gSpecialVar_Result = result; } +// A painting hangs on the wall of the Dewford Hall +// When interacted with it says "{trendy phrase}'S {name} is the title" +// {name} is one of 8 pre-set words, depending on the current phrase +// See DewfordTown_Hall_EventScript_Painting void GetDewfordHallPaintingNameIndex(void) { - gSpecialVar_Result = (gSaveBlock1Ptr->easyChatPairs[0].words[0] + gSaveBlock1Ptr->easyChatPairs[0].words[1]) & 7; + gSpecialVar_Result = (gSaveBlock1Ptr->dewfordTrends[0].words[0] + gSaveBlock1Ptr->dewfordTrends[0].words[1]) & 7; } -static bool8 sub_8122A58(struct EasyChatPair *a, struct EasyChatPair *b, u8 c) +// Returns TRUE if a > b (a is "trendier" than b), FALSE if a < b (b is "trendier" than a) +// How one trend is compared to the other depends on the mode +// In SORT_MODE_FULL if the trends are equal then TRUE is always returned, otherwise TRUE or FALSE is returned randomly +static bool8 CompareTrends(struct DewfordTrend *a, struct DewfordTrend *b, u8 mode) { - switch (c) + switch (mode) { - case 0: - if (a->unk0_0 > b->unk0_0) - return 1; - if (a->unk0_0 < b->unk0_0) - return 0; - if (a->unk0_7 > b->unk0_7) - return 1; - if (a->unk0_7 < b->unk0_7) - return 0; + case SORT_MODE_NORMAL: + if (a->trendiness > b->trendiness) return TRUE; + if (a->trendiness < b->trendiness) return FALSE; + + if (a->maxTrendiness > b->maxTrendiness) return TRUE; + if (a->maxTrendiness < b->maxTrendiness) return FALSE; break; - case 1: - if (a->unk0_7 > b->unk0_7) - return 1; - if (a->unk0_7 < b->unk0_7) - return 0; - if (a->unk0_0 > b->unk0_0) - return 1; - if (a->unk0_0 < b->unk0_0) - return 0; + case SORT_MODE_MAX_FIRST: // Unused + if (a->maxTrendiness > b->maxTrendiness) return TRUE; + if (a->maxTrendiness < b->maxTrendiness) return FALSE; + + if (a->trendiness > b->trendiness) return TRUE; + if (a->trendiness < b->trendiness) return FALSE; break; - case 2: - if (a->unk0_0 > b->unk0_0) - return 1; - if (a->unk0_0 < b->unk0_0) - return 0; - if (a->unk0_7 > b->unk0_7) - return 1; - if (a->unk0_7 < b->unk0_7) - return 0; - if (a->unk2 > b->unk2) - return 1; - if (a->unk2 < b->unk2) - return 0; - if (a->words[0] > b->words[0]) - return 1; - if (a->words[0] < b->words[0]) - return 0; - if (a->words[1] > b->words[1]) - return 1; - if (a->words[1] < b->words[1]) - return 0; - return 1; + case SORT_MODE_FULL: + if (a->trendiness > b->trendiness) return TRUE; + if (a->trendiness < b->trendiness) return FALSE; + + if (a->maxTrendiness > b->maxTrendiness) return TRUE; + if (a->maxTrendiness < b->maxTrendiness) return FALSE; + + if (a->rand > b->rand) return TRUE; + if (a->rand < b->rand) return FALSE; + + if (a->words[0] > b->words[0]) return TRUE; + if (a->words[0] < b->words[0]) return FALSE; + + if (a->words[1] > b->words[1]) return TRUE; + if (a->words[1] < b->words[1]) return FALSE; + return TRUE; } + + // Invalid mode given, or trends are equal in SORT_MODE_NORMAL or SORT_MODE_MAX_FIRST + // Randomly pick one of the phrases return Random() & 1; } -static void sub_8122B28(struct EasyChatPair *s) +static void SeedTrendRng(struct DewfordTrend *trend) { - u16 r4; + u16 rand; - r4 = Random() % 98; - if (r4 > 50) + rand = Random() % 98; + if (rand > 50) { - r4 = Random() % 98; - if (r4 > 80) - r4 = Random() % 98; + rand = Random() % 98; + if (rand > 80) + rand = Random() % 98; } - s->unk0_7 = r4 + 30; - s->unk0_0 = (Random() % (r4 + 1)) + 30; - s->unk2 = Random(); + trend->maxTrendiness = rand + 30; + trend->trendiness = (Random() % (rand + 1)) + 30; + trend->rand = Random(); } -static bool8 SB1ContainsWords(u16 *a) +static bool8 IsPhraseInSavedTrends(u16 *phrase) { u16 i; - for (i = 0; i < 5; i++) + for (i = 0; i < SAVED_TRENDS_COUNT; i++) { - if (IsEasyChatPairEqual(a, gSaveBlock1Ptr->easyChatPairs[i].words) != 0) + if (IsEasyChatPairEqual(phrase, gSaveBlock1Ptr->dewfordTrends[i].words)) return TRUE; } return FALSE; @@ -332,15 +409,14 @@ static bool8 IsEasyChatPairEqual(u16 *words1, u16 *words2) return TRUE; } -static s16 GetEqualEasyChatPairIndex(struct EasyChatPair*s, struct EasyChatPair *a, u16 b) +static s16 GetSavedTrendIndex(struct DewfordTrend *savedTrends, struct DewfordTrend *trend, u16 numSaved) { s16 i; - - for (i = 0; i < b; i++) + for (i = 0; i < numSaved; i++) { - if (IsEasyChatPairEqual(a->words, s->words)) + if (IsEasyChatPairEqual(trend->words, savedTrends->words)) return i; - s++; + savedTrends++; } return -1; } diff --git a/src/easy_chat.c b/src/easy_chat.c index a27e1780e..13e89c31f 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -230,14 +230,14 @@ static void DoQuizSetQuestionEasyChatScreen(void); #define PALTAG_TRIANGLE_CURSOR 0 #define PALTAG_RECTANGLE_CURSOR 1 #define PALTAG_MISC_UI 2 -#define PALTAG_3 3 +#define PALTAG_RS_INTERVIEW_FRAME 3 #define GFXTAG_TRIANGLE_CURSOR 0 #define GFXTAG_RECTANGLE_CURSOR 1 #define GFXTAG_SCROLL_INDICATOR 2 #define GFXTAG_START_SELECT_BUTTONS 3 #define GFXTAG_MODE_WINDOW 4 -#define GFXTAG_5 5 +#define GFXTAG_RS_INTERVIEW_FRAME 5 #define GFXTAG_BUTTON_WINDOW 6 // State values for sEasyChatScreen->inputState @@ -698,13 +698,16 @@ static const u16 sTriangleCursor_Pal[] = INCBIN_U16("graphics/easy_chat/triangle static const u32 sTriangleCursor_Gfx[] = INCBIN_U32("graphics/easy_chat/triangle_cursor.4bpp"); static const u32 sScrollIndicator_Gfx[] = INCBIN_U32("graphics/easy_chat/scroll_indicator.4bpp"); static const u32 sStartSelectButtons_Gfx[] = INCBIN_U32("graphics/easy_chat/start_select_buttons.4bpp"); -static const u16 sUnknown_085979C0[] = INCBIN_U16("graphics/misc/interview_frame.gbapal"); -static const u32 sUnknown_085979E0[] = INCBIN_U32("graphics/misc/interview_frame.4bpp.lz"); +// In Ruby/Sapphire Easy Chat screens had a black background, and when the player & interviewer were present +// on screen the interview_frame gfx was shown behind them. +// In Emerald all Easy Chat screens have a filled background, so these gfx go unused +static const u16 sRSInterviewFrame_Pal[] = INCBIN_U16("graphics/easy_chat/interview_frame.gbapal"); +static const u32 sRSInterviewFrame_Gfx[] = INCBIN_U32("graphics/easy_chat/interview_frame.4bpp.lz"); static const u16 sTextInputFrameOrange_Pal[] = INCBIN_U16("graphics/easy_chat/text_input_frame_orange.gbapal"); static const u16 sTextInputFrameGreen_Pal[] = INCBIN_U16("graphics/easy_chat/text_input_frame_green.gbapal"); static const u32 sTextInputFrame_Gfx[] = INCBIN_U32("graphics/easy_chat/text_input_frame.4bpp.lz"); -static const u16 sUnknown_08597C1C[] = INCBIN_U16("graphics/misc/8597C1C.gbapal"); -static const u16 sUnknown_08597C24[] = INCBIN_U16("graphics/misc/8597C24.gbapal"); +static const u16 sTitleText_Pal[] = INCBIN_U16("graphics/easy_chat/title_text.gbapal"); +static const u16 sText_Pal[] = INCBIN_U16("graphics/easy_chat/text.gbapal"); static const struct EasyChatPhraseFrameDimensions sPhraseFrameDimensions[] = { [FRAMEID_GENERAL_2x2] = { @@ -895,17 +898,17 @@ static const struct SpritePalette sSpritePalettes[] = { .tag = PALTAG_MISC_UI, // The palette is generated from the button window but used for various parts of the UI }, { - .data = sUnknown_085979C0, - .tag = PALTAG_3, + .data = sRSInterviewFrame_Pal, + .tag = PALTAG_RS_INTERVIEW_FRAME, }, {0} }; static const struct CompressedSpriteSheet sCompressedSpriteSheets[] = { { - .data = sUnknown_085979E0, + .data = sRSInterviewFrame_Gfx, .size = 0x800, - .tag = GFXTAG_5, + .tag = GFXTAG_RS_INTERVIEW_FRAME, }, { .data = gEasyChatRectangleCursor_Gfx, @@ -1477,8 +1480,8 @@ void ShowEasyChatScreen(void) break; case EASY_CHAT_TYPE_TRENDY_PHRASE: words = (u16 *)gStringVar3; - words[0] = gSaveBlock1Ptr->easyChatPairs[0].words[0]; - words[1] = gSaveBlock1Ptr->easyChatPairs[0].words[1]; + words[0] = gSaveBlock1Ptr->dewfordTrends[0].words[0]; + words[1] = gSaveBlock1Ptr->dewfordTrends[0].words[1]; break; case EASY_CHAT_TYPE_GABBY_AND_TY: words = gSaveBlock1Ptr->gabbyAndTyData.quote; @@ -2958,7 +2961,7 @@ static void SetSpecialEasyChatResult(void) break; case EASY_CHAT_TYPE_TRENDY_PHRASE: BufferCurrentPhraseToStringVar2(); - gSpecialVar_0x8004 = IsPhraseTrendy(sEasyChatScreen->currentPhrase); + gSpecialVar_0x8004 = TrySetTrendyPhrase(sEasyChatScreen->currentPhrase); break; case EASY_CHAT_TYPE_GOOD_SAYING: gSpecialVar_0x8004 = DidPlayerInputABerryMasterWifePhrase(); @@ -3914,10 +3917,10 @@ static void LoadEasyChatPalettes(void) LoadPalette(gEasyChatMode_Pal, 0, 32); LoadPalette(sTextInputFrameOrange_Pal, 1 * 16, 32); LoadPalette(sTextInputFrameGreen_Pal, 4 * 16, 32); - LoadPalette(sUnknown_08597C1C, 10 * 16, 8); - LoadPalette(sUnknown_08597C24, 11 * 16, 12); - LoadPalette(sUnknown_08597C24, 15 * 16, 12); - LoadPalette(sUnknown_08597C24, 3 * 16, 12); + LoadPalette(sTitleText_Pal, 10 * 16, 8); + LoadPalette(sText_Pal, 11 * 16, 12); + LoadPalette(sText_Pal, 15 * 16, 12); + LoadPalette(sText_Pal, 3 * 16, 12); } static void PrintTitle(void) diff --git a/src/field_specials.c b/src/field_specials.c index 86be21eda..30503ed8d 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1336,7 +1336,7 @@ u16 GetSlotMachineId(void) static const u8 sSlotMachineIds[] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5}; static const u8 sSlotMachineServiceDayIds[] = {3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5}; - u32 rnd = gSaveBlock1Ptr->easyChatPairs[0].unk0_0 + gSaveBlock1Ptr->easyChatPairs[0].unk2 + sSlotMachineRandomSeeds[gSpecialVar_0x8004]; + u32 rnd = gSaveBlock1Ptr->dewfordTrends[0].trendiness + gSaveBlock1Ptr->dewfordTrends[0].rand + sSlotMachineRandomSeeds[gSpecialVar_0x8004]; if (GetPriceReduction(POKENEWS_GAME_CORNER)) { return sSlotMachineServiceDayIds[rnd % SLOT_MACHINE_COUNT]; diff --git a/src/match_call.c b/src/match_call.c index fb8ebc98c..fd0db630c 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -34,12 +34,62 @@ #include "constants/songs.h" #include "constants/trainers.h" +// Each match call message has variables that can be populated randomly or +// dependent on the trainer. The below are IDs for how to populate the vars +// in a given message. +// Each message may have up to 3 vars in it +enum { + STR_TRAINER_NAME, + STR_MAP_NAME, + STR_SPECIES_IN_ROUTE, + STR_SPECIES_IN_PARTY, + STR_FACILITY_NAME, + STR_FRONTIER_STREAK, + STR_NONE = -1, +}; +#define STRS_NORMAL_MSG {STR_TRAINER_NAME, STR_NONE, STR_NONE} +#define STRS_WILD_BATTLE {STR_TRAINER_NAME, STR_SPECIES_IN_ROUTE, STR_NONE} +#define STRS_BATTLE_NEGATIVE {STR_TRAINER_NAME, STR_NONE, STR_NONE} +#define STRS_BATTLE_POSITIVE {STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE} +#define STRS_BATTLE_REQUEST {STR_TRAINER_NAME, STR_MAP_NAME, STR_NONE} +#define STRS_FRONTIER {STR_TRAINER_NAME, STR_FACILITY_NAME, STR_FRONTIER_STREAK} + +#define NUM_STRVARS_IN_MSG 3 + +// Topic IDs for sMatchCallGeneralTopics +enum { + GEN_TOPIC_PERSONAL = 1, + GEN_TOPIC_STREAK, + GEN_TOPIC_STREAK_RECORD, + GEN_TOPIC_B_DOME, + GEN_TOPIC_B_PIKE, + GEN_TOPIC_B_PYRAMID, +}; + +// Topic IDs for sMatchCallBattleTopics +enum { + B_TOPIC_WILD = 1, + B_TOPIC_NEGATIVE, + B_TOPIC_POSITIVE, +}; + +// Each trainer has a text id for 1 of each of the 3 battle topics +// The msgId is the index into the respective topic's message table +// For all but 2 trainers this index is the same for each topic +#define BATTLE_TEXT_IDS(msgId) {TEXT_ID(B_TOPIC_WILD, (msgId)), TEXT_ID(B_TOPIC_NEGATIVE, (msgId)), TEXT_ID(B_TOPIC_POSITIVE, (msgId))} + +// Topic IDs for sMatchCallBattleRequestTopics +enum { + REQ_TOPIC_SAME_ROUTE = 1, + REQ_TOPIC_DIFF_ROUTE, +}; + struct MatchCallState { u32 minutes; u16 trainerId; u8 stepCounter; - u8 triggeredFromScript; + bool8 triggeredFromScript; }; struct MatchCallTrainerTextInfo @@ -56,7 +106,7 @@ struct MatchCallTrainerTextInfo struct MatchCallText { const u8 *text; - s8 stringVarFuncIds[3]; + s8 stringVarFuncIds[NUM_STRVARS_IN_MSG]; }; struct MultiTrainerMatchCallText @@ -71,8 +121,8 @@ struct BattleFrontierStreakInfo u16 streak; }; -EWRAM_DATA struct MatchCallState gMatchCallState = {0}; -EWRAM_DATA struct BattleFrontierStreakInfo gBattleFrontierStreakInfo = {0}; +static EWRAM_DATA struct MatchCallState sMatchCallState = {0}; +static EWRAM_DATA struct BattleFrontierStreakInfo sBattleFrontierStreakInfo = {0}; static u32 GetCurrentTotalMinutes(struct Time *); static u32 GetNumRegisteredNPCs(void); @@ -82,27 +132,27 @@ static u16 GetRematchTrainerLocation(int); static bool32 TrainerIsEligibleForRematch(int); static void StartMatchCall(void); static void ExecuteMatchCall(u8); -static void DrawMatchCallTextBoxBorder(u32, u32, u32); -static void sub_8196694(u8); +static void DrawMatchCallTextBoxBorder_Internal(u32, u32, u32); +static void Task_SpinPokenavIcon(u8); static void InitMatchCallTextPrinter(int, const u8 *); -static bool32 ExecuteMatchCallTextPrinter(int); +static bool32 RunMatchCallTextPrinter(int); static const struct MatchCallText *GetSameRouteMatchCallText(int, u8 *); static const struct MatchCallText *GetDifferentRouteMatchCallText(int, u8 *); static const struct MatchCallText *GetBattleMatchCallText(int, u8 *); static const struct MatchCallText *GetGeneralMatchCallText(int, u8 *); -static bool32 sub_8196D74(int); +static bool32 ShouldTrainerRequestBattle(int); static void BuildMatchCallString(int, const struct MatchCallText *, u8 *); static u16 GetFrontierStreakInfo(u16, u32 *); static void PopulateMatchCallStringVars(int, const s8 *); static void PopulateMatchCallStringVar(int, int, u8 *); -static bool32 LoadMatchCallWindowGfx(u8); -static bool32 MoveMatchCallWindowToVram(u8); -static bool32 PrintMatchCallIntroEllipsis(u8); -static bool32 sub_81962B0(u8); -static bool32 sub_81962D8(u8); -static bool32 sub_8196330(u8); -static bool32 sub_8196390(u8); -static bool32 sub_81963F0(u8); +static bool32 MatchCall_LoadGfx(u8); +static bool32 MatchCall_DrawWindow(u8); +static bool32 MatchCall_ReadyIntro(u8); +static bool32 MatchCall_SlideWindowIn(u8); +static bool32 MatchCall_PrintIntro(u8); +static bool32 MatchCall_PrintMessage(u8); +static bool32 MatchCall_SlideWindowOut(u8); +static bool32 MatchCall_EndCall(u8); static void PopulateTrainerName(int, u8 *); static void PopulateMapName(int, u8 *); static void PopulateSpeciesFromTrainerLocation(int, u8 *); @@ -117,851 +167,853 @@ static const struct MatchCallTrainerTextInfo sMatchCallTrainers[] = { .trainerId = TRAINER_ROSE_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) }, - .generalTextId = TEXT_ID(1, 3), + .battleTopicTextIds = BATTLE_TEXT_IDS(8), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 3), .battleFrontierRecordStreakTextIndex = 8, - .sameRouteMatchCallTextId = TEXT_ID(1, 8), - .differentRouteMatchCallTextId = TEXT_ID(2, 8), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8), }, { .trainerId = TRAINER_ANDRES_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) }, - .generalTextId = TEXT_ID(1, 62), + .battleTopicTextIds = BATTLE_TEXT_IDS(12), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 62), .battleFrontierRecordStreakTextIndex = 12, - .sameRouteMatchCallTextId = TEXT_ID(1, 12), - .differentRouteMatchCallTextId = TEXT_ID(2, 12), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12), }, { .trainerId = TRAINER_DUSTY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) }, - .generalTextId = TEXT_ID(1, 4), + .battleTopicTextIds = BATTLE_TEXT_IDS(12), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 4), .battleFrontierRecordStreakTextIndex = 12, - .sameRouteMatchCallTextId = TEXT_ID(1, 12), - .differentRouteMatchCallTextId = TEXT_ID(2, 12), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12), }, { .trainerId = TRAINER_LOLA_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) }, - .generalTextId = TEXT_ID(1, 5), + .battleTopicTextIds = BATTLE_TEXT_IDS(2), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 5), .battleFrontierRecordStreakTextIndex = 2, - .sameRouteMatchCallTextId = TEXT_ID(1, 2), - .differentRouteMatchCallTextId = TEXT_ID(2, 2), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2), }, { .trainerId = TRAINER_RICKY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) }, - .generalTextId = TEXT_ID(1, 6), + .battleTopicTextIds = BATTLE_TEXT_IDS(1), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 6), .battleFrontierRecordStreakTextIndex = 1, - .sameRouteMatchCallTextId = TEXT_ID(1, 1), - .differentRouteMatchCallTextId = TEXT_ID(2, 1), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1), }, { .trainerId = TRAINER_LILA_AND_ROY_1, .unused = 4, - .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) }, - .generalTextId = TEXT_ID(1, 61), + .battleTopicTextIds = BATTLE_TEXT_IDS(1), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 61), .battleFrontierRecordStreakTextIndex = 1, - .sameRouteMatchCallTextId = TEXT_ID(1, 1), - .differentRouteMatchCallTextId = TEXT_ID(2, 1), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1), }, { .trainerId = TRAINER_CRISTIN_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 10), TEXT_ID(2, 10), TEXT_ID(3, 10) }, - .generalTextId = TEXT_ID(1, 64), + .battleTopicTextIds = BATTLE_TEXT_IDS(10), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 64), .battleFrontierRecordStreakTextIndex = 10, - .sameRouteMatchCallTextId = TEXT_ID(1, 10), - .differentRouteMatchCallTextId = TEXT_ID(2, 10), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 10), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 10), }, { .trainerId = TRAINER_BROOKE_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) }, - .generalTextId = TEXT_ID(1, 8), + .battleTopicTextIds = BATTLE_TEXT_IDS(9), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 8), .battleFrontierRecordStreakTextIndex = 9, - .sameRouteMatchCallTextId = TEXT_ID(1, 9), - .differentRouteMatchCallTextId = TEXT_ID(2, 9), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9), }, { .trainerId = TRAINER_WILTON_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 6), TEXT_ID(2, 6), TEXT_ID(3, 6) }, - .generalTextId = TEXT_ID(1, 7), + .battleTopicTextIds = BATTLE_TEXT_IDS(6), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 7), .battleFrontierRecordStreakTextIndex = 6, - .sameRouteMatchCallTextId = TEXT_ID(1, 6), - .differentRouteMatchCallTextId = TEXT_ID(2, 6), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 6), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 6), }, { .trainerId = TRAINER_VALERIE_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) }, - .generalTextId = TEXT_ID(1, 9), + .battleTopicTextIds = BATTLE_TEXT_IDS(8), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 9), .battleFrontierRecordStreakTextIndex = 8, - .sameRouteMatchCallTextId = TEXT_ID(1, 8), - .differentRouteMatchCallTextId = TEXT_ID(2, 8), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8), }, { .trainerId = TRAINER_CINDY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) }, - .generalTextId = TEXT_ID(1, 10), + .battleTopicTextIds = BATTLE_TEXT_IDS(8), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 10), .battleFrontierRecordStreakTextIndex = 8, - .sameRouteMatchCallTextId = TEXT_ID(1, 8), - .differentRouteMatchCallTextId = TEXT_ID(2, 8), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8), }, { .trainerId = TRAINER_THALIA_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 10), TEXT_ID(3, 10) }, - .generalTextId = TEXT_ID(1, 14), + // Thalia and Sawyer are the only ones who use different msg ids for their battle topics + .battleTopicTextIds = { TEXT_ID(B_TOPIC_WILD, 8), TEXT_ID(B_TOPIC_NEGATIVE, 10), TEXT_ID(B_TOPIC_POSITIVE, 10) }, + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 14), .battleFrontierRecordStreakTextIndex = 10, - .sameRouteMatchCallTextId = TEXT_ID(1, 8), - .differentRouteMatchCallTextId = TEXT_ID(2, 10), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 10), }, { .trainerId = TRAINER_JESSICA_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 10), TEXT_ID(2, 10), TEXT_ID(3, 10) }, - .generalTextId = TEXT_ID(1, 11), + .battleTopicTextIds = BATTLE_TEXT_IDS(10), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 11), .battleFrontierRecordStreakTextIndex = 10, - .sameRouteMatchCallTextId = TEXT_ID(1, 8), - .differentRouteMatchCallTextId = TEXT_ID(2, 10), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 10), }, { .trainerId = TRAINER_WINSTON_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 4), TEXT_ID(2, 4), TEXT_ID(3, 4) }, - .generalTextId = TEXT_ID(1, 12), + .battleTopicTextIds = BATTLE_TEXT_IDS(4), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 12), .battleFrontierRecordStreakTextIndex = 4, - .sameRouteMatchCallTextId = TEXT_ID(1, 4), - .differentRouteMatchCallTextId = TEXT_ID(2, 4), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 4), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 4), }, { .trainerId = TRAINER_STEVE_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 7), TEXT_ID(2, 7), TEXT_ID(3, 7) }, - .generalTextId = TEXT_ID(1, 13), + .battleTopicTextIds = BATTLE_TEXT_IDS(7), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 13), .battleFrontierRecordStreakTextIndex = 7, - .sameRouteMatchCallTextId = TEXT_ID(1, 7), - .differentRouteMatchCallTextId = TEXT_ID(2, 7), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 7), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 7), }, { .trainerId = TRAINER_TONY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) }, - .generalTextId = TEXT_ID(1, 15), + .battleTopicTextIds = BATTLE_TEXT_IDS(5), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 15), .battleFrontierRecordStreakTextIndex = 5, - .sameRouteMatchCallTextId = TEXT_ID(1, 5), - .differentRouteMatchCallTextId = TEXT_ID(2, 5), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5), }, { .trainerId = TRAINER_NOB_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) }, - .generalTextId = TEXT_ID(1, 16), + .battleTopicTextIds = BATTLE_TEXT_IDS(3), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 16), .battleFrontierRecordStreakTextIndex = 3, - .sameRouteMatchCallTextId = TEXT_ID(1, 3), - .differentRouteMatchCallTextId = TEXT_ID(2, 3), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3), }, { .trainerId = TRAINER_KOJI_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) }, - .generalTextId = TEXT_ID(1, 59), + .battleTopicTextIds = BATTLE_TEXT_IDS(3), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 59), .battleFrontierRecordStreakTextIndex = 3, - .sameRouteMatchCallTextId = TEXT_ID(1, 3), - .differentRouteMatchCallTextId = TEXT_ID(2, 3), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3), }, { .trainerId = TRAINER_FERNANDO_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 6), TEXT_ID(2, 6), TEXT_ID(3, 6) }, - .generalTextId = TEXT_ID(1, 17), + .battleTopicTextIds = BATTLE_TEXT_IDS(6), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 17), .battleFrontierRecordStreakTextIndex = 6, - .sameRouteMatchCallTextId = TEXT_ID(1, 6), - .differentRouteMatchCallTextId = TEXT_ID(2, 6), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 6), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 6), }, { .trainerId = TRAINER_DALTON_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 4), TEXT_ID(2, 4), TEXT_ID(3, 4) }, - .generalTextId = TEXT_ID(1, 18), + .battleTopicTextIds = BATTLE_TEXT_IDS(4), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 18), .battleFrontierRecordStreakTextIndex = 4, - .sameRouteMatchCallTextId = TEXT_ID(1, 4), - .differentRouteMatchCallTextId = TEXT_ID(2, 4), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 4), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 4), }, { .trainerId = TRAINER_BERNIE_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 11), TEXT_ID(2, 11), TEXT_ID(3, 11) }, - .generalTextId = TEXT_ID(1, 19), + .battleTopicTextIds = BATTLE_TEXT_IDS(11), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 19), .battleFrontierRecordStreakTextIndex = 11, - .sameRouteMatchCallTextId = TEXT_ID(1, 11), - .differentRouteMatchCallTextId = TEXT_ID(2, 11), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 11), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 11), }, { .trainerId = TRAINER_ETHAN_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) }, - .generalTextId = TEXT_ID(1, 20), + .battleTopicTextIds = BATTLE_TEXT_IDS(1), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 20), .battleFrontierRecordStreakTextIndex = 1, - .sameRouteMatchCallTextId = TEXT_ID(1, 1), - .differentRouteMatchCallTextId = TEXT_ID(2, 1), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1), }, { .trainerId = TRAINER_JOHN_AND_JAY_1, .unused = 3, - .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) }, - .generalTextId = TEXT_ID(1, 60), + .battleTopicTextIds = BATTLE_TEXT_IDS(12), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 60), .battleFrontierRecordStreakTextIndex = 12, - .sameRouteMatchCallTextId = TEXT_ID(1, 12), - .differentRouteMatchCallTextId = TEXT_ID(2, 12), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12), }, { .trainerId = TRAINER_JEFFREY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 7), TEXT_ID(2, 7), TEXT_ID(3, 7) }, - .generalTextId = TEXT_ID(1, 21), + .battleTopicTextIds = BATTLE_TEXT_IDS(7), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 21), .battleFrontierRecordStreakTextIndex = 7, - .sameRouteMatchCallTextId = TEXT_ID(1, 7), - .differentRouteMatchCallTextId = TEXT_ID(2, 7), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 7), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 7), }, { .trainerId = TRAINER_CAMERON_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 4), TEXT_ID(2, 4), TEXT_ID(3, 4) }, - .generalTextId = TEXT_ID(1, 22), + .battleTopicTextIds = BATTLE_TEXT_IDS(4), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 22), .battleFrontierRecordStreakTextIndex = 1, - .sameRouteMatchCallTextId = TEXT_ID(1, 4), - .differentRouteMatchCallTextId = TEXT_ID(2, 4), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 4), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 4), }, { .trainerId = TRAINER_JACKI_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) }, - .generalTextId = TEXT_ID(1, 23), + .battleTopicTextIds = BATTLE_TEXT_IDS(8), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 23), .battleFrontierRecordStreakTextIndex = 8, - .sameRouteMatchCallTextId = TEXT_ID(1, 8), - .differentRouteMatchCallTextId = TEXT_ID(2, 8), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8), }, { .trainerId = TRAINER_WALTER_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) }, - .generalTextId = TEXT_ID(1, 24), + .battleTopicTextIds = BATTLE_TEXT_IDS(12), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 24), .battleFrontierRecordStreakTextIndex = 12, - .sameRouteMatchCallTextId = TEXT_ID(1, 12), - .differentRouteMatchCallTextId = TEXT_ID(2, 12), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12), }, { .trainerId = TRAINER_KAREN_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) }, - .generalTextId = TEXT_ID(1, 26), + .battleTopicTextIds = BATTLE_TEXT_IDS(2), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 26), .battleFrontierRecordStreakTextIndex = 2, - .sameRouteMatchCallTextId = TEXT_ID(1, 2), - .differentRouteMatchCallTextId = TEXT_ID(2, 2), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2), }, { .trainerId = TRAINER_JERRY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) }, - .generalTextId = TEXT_ID(1, 25), + .battleTopicTextIds = BATTLE_TEXT_IDS(1), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 25), .battleFrontierRecordStreakTextIndex = 1, - .sameRouteMatchCallTextId = TEXT_ID(1, 1), - .differentRouteMatchCallTextId = TEXT_ID(2, 1), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1), }, { .trainerId = TRAINER_ANNA_AND_MEG_1, .unused = 6, - .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) }, - .generalTextId = TEXT_ID(1, 27), + .battleTopicTextIds = BATTLE_TEXT_IDS(9), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 27), .battleFrontierRecordStreakTextIndex = 9, - .sameRouteMatchCallTextId = TEXT_ID(1, 9), - .differentRouteMatchCallTextId = TEXT_ID(2, 9), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9), }, { .trainerId = TRAINER_ISABEL_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 14), TEXT_ID(2, 14), TEXT_ID(3, 14) }, - .generalTextId = TEXT_ID(1, 29), + .battleTopicTextIds = BATTLE_TEXT_IDS(14), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 29), .battleFrontierRecordStreakTextIndex = 14, - .sameRouteMatchCallTextId = TEXT_ID(1, 14), - .differentRouteMatchCallTextId = TEXT_ID(2, 14), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 14), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 14), }, { .trainerId = TRAINER_MIGUEL_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 11), TEXT_ID(2, 11), TEXT_ID(3, 11) }, - .generalTextId = TEXT_ID(1, 28), + .battleTopicTextIds = BATTLE_TEXT_IDS(11), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 28), .battleFrontierRecordStreakTextIndex = 11, - .sameRouteMatchCallTextId = TEXT_ID(1, 11), - .differentRouteMatchCallTextId = TEXT_ID(2, 11), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 11), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 11), }, { .trainerId = TRAINER_TIMOTHY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) }, - .generalTextId = TEXT_ID(1, 30), + .battleTopicTextIds = BATTLE_TEXT_IDS(12), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 30), .battleFrontierRecordStreakTextIndex = 12, - .sameRouteMatchCallTextId = TEXT_ID(1, 12), - .differentRouteMatchCallTextId = TEXT_ID(2, 12), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12), }, { .trainerId = TRAINER_SHELBY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 13), TEXT_ID(2, 13), TEXT_ID(3, 13) }, - .generalTextId = TEXT_ID(1, 31), + .battleTopicTextIds = BATTLE_TEXT_IDS(13), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 31), .battleFrontierRecordStreakTextIndex = 13, - .sameRouteMatchCallTextId = TEXT_ID(1, 13), - .differentRouteMatchCallTextId = TEXT_ID(2, 13), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 13), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 13), }, { .trainerId = TRAINER_CALVIN_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) }, - .generalTextId = TEXT_ID(1, 32), + .battleTopicTextIds = BATTLE_TEXT_IDS(1), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 32), .battleFrontierRecordStreakTextIndex = 1, - .sameRouteMatchCallTextId = TEXT_ID(1, 1), - .differentRouteMatchCallTextId = TEXT_ID(2, 1), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1), }, { .trainerId = TRAINER_ELLIOT_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) }, - .generalTextId = TEXT_ID(1, 33), + .battleTopicTextIds = BATTLE_TEXT_IDS(3), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 33), .battleFrontierRecordStreakTextIndex = 3, - .sameRouteMatchCallTextId = TEXT_ID(1, 3), - .differentRouteMatchCallTextId = TEXT_ID(2, 3), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3), }, { .trainerId = TRAINER_ISAIAH_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) }, - .generalTextId = TEXT_ID(1, 38), + .battleTopicTextIds = BATTLE_TEXT_IDS(5), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 38), .battleFrontierRecordStreakTextIndex = 5, - .sameRouteMatchCallTextId = TEXT_ID(1, 5), - .differentRouteMatchCallTextId = TEXT_ID(2, 5), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5), }, { .trainerId = TRAINER_MARIA_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) }, - .generalTextId = TEXT_ID(1, 37), + .battleTopicTextIds = BATTLE_TEXT_IDS(9), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 37), .battleFrontierRecordStreakTextIndex = 9, - .sameRouteMatchCallTextId = TEXT_ID(1, 9), - .differentRouteMatchCallTextId = TEXT_ID(2, 9), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9), }, { .trainerId = TRAINER_ABIGAIL_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) }, - .generalTextId = TEXT_ID(1, 35), + .battleTopicTextIds = BATTLE_TEXT_IDS(9), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 35), .battleFrontierRecordStreakTextIndex = 9, - .sameRouteMatchCallTextId = TEXT_ID(1, 9), - .differentRouteMatchCallTextId = TEXT_ID(2, 9), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9), }, { .trainerId = TRAINER_DYLAN_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) }, - .generalTextId = TEXT_ID(1, 36), + .battleTopicTextIds = BATTLE_TEXT_IDS(5), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 36), .battleFrontierRecordStreakTextIndex = 5, - .sameRouteMatchCallTextId = TEXT_ID(1, 5), - .differentRouteMatchCallTextId = TEXT_ID(2, 5), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5), }, { .trainerId = TRAINER_KATELYN_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) }, - .generalTextId = TEXT_ID(1, 40), + .battleTopicTextIds = BATTLE_TEXT_IDS(9), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 40), .battleFrontierRecordStreakTextIndex = 9, - .sameRouteMatchCallTextId = TEXT_ID(1, 9), - .differentRouteMatchCallTextId = TEXT_ID(2, 9), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9), }, { .trainerId = TRAINER_BENJAMIN_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) }, - .generalTextId = TEXT_ID(1, 34), + .battleTopicTextIds = BATTLE_TEXT_IDS(5), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 34), .battleFrontierRecordStreakTextIndex = 5, - .sameRouteMatchCallTextId = TEXT_ID(1, 5), - .differentRouteMatchCallTextId = TEXT_ID(2, 5), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5), }, { .trainerId = TRAINER_PABLO_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) }, - .generalTextId = TEXT_ID(1, 39), + .battleTopicTextIds = BATTLE_TEXT_IDS(5), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 39), .battleFrontierRecordStreakTextIndex = 5, - .sameRouteMatchCallTextId = TEXT_ID(1, 5), - .differentRouteMatchCallTextId = TEXT_ID(2, 5), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5), }, { .trainerId = TRAINER_NICOLAS_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 4), TEXT_ID(2, 4), TEXT_ID(3, 4) }, - .generalTextId = TEXT_ID(1, 41), + .battleTopicTextIds = BATTLE_TEXT_IDS(4), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 41), .battleFrontierRecordStreakTextIndex = 4, - .sameRouteMatchCallTextId = TEXT_ID(1, 4), - .differentRouteMatchCallTextId = TEXT_ID(2, 4), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 4), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 4), }, { .trainerId = TRAINER_ROBERT_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 6), TEXT_ID(2, 6), TEXT_ID(3, 6) }, - .generalTextId = TEXT_ID(1, 42), + .battleTopicTextIds = BATTLE_TEXT_IDS(6), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 42), .battleFrontierRecordStreakTextIndex = 6, - .sameRouteMatchCallTextId = TEXT_ID(1, 6), - .differentRouteMatchCallTextId = TEXT_ID(2, 6), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 6), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 6), }, { .trainerId = TRAINER_LAO_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) }, - .generalTextId = TEXT_ID(1, 43), + .battleTopicTextIds = BATTLE_TEXT_IDS(1), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 43), .battleFrontierRecordStreakTextIndex = 1, - .sameRouteMatchCallTextId = TEXT_ID(1, 1), - .differentRouteMatchCallTextId = TEXT_ID(2, 1), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1), }, { .trainerId = TRAINER_CYNDY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) }, - .generalTextId = TEXT_ID(1, 44), + .battleTopicTextIds = BATTLE_TEXT_IDS(9), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 44), .battleFrontierRecordStreakTextIndex = 9, - .sameRouteMatchCallTextId = TEXT_ID(1, 9), - .differentRouteMatchCallTextId = TEXT_ID(2, 9), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9), }, { .trainerId = TRAINER_MADELINE_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) }, - .generalTextId = TEXT_ID(1, 45), + .battleTopicTextIds = BATTLE_TEXT_IDS(8), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 45), .battleFrontierRecordStreakTextIndex = 8, - .sameRouteMatchCallTextId = TEXT_ID(1, 8), - .differentRouteMatchCallTextId = TEXT_ID(2, 8), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8), }, { .trainerId = TRAINER_JENNY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) }, - .generalTextId = TEXT_ID(1, 46), + .battleTopicTextIds = BATTLE_TEXT_IDS(9), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 46), .battleFrontierRecordStreakTextIndex = 9, - .sameRouteMatchCallTextId = TEXT_ID(1, 9), - .differentRouteMatchCallTextId = TEXT_ID(2, 9), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9), }, { .trainerId = TRAINER_DIANA_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) }, - .generalTextId = TEXT_ID(1, 47), + .battleTopicTextIds = BATTLE_TEXT_IDS(2), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 47), .battleFrontierRecordStreakTextIndex = 2, - .sameRouteMatchCallTextId = TEXT_ID(1, 2), - .differentRouteMatchCallTextId = TEXT_ID(2, 2), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2), }, { .trainerId = TRAINER_AMY_AND_LIV_1, .unused = 2, - .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) }, - .generalTextId = TEXT_ID(1, 48), + .battleTopicTextIds = BATTLE_TEXT_IDS(2), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 48), .battleFrontierRecordStreakTextIndex = 1, - .sameRouteMatchCallTextId = TEXT_ID(1, 2), - .differentRouteMatchCallTextId = TEXT_ID(2, 2), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2), }, { .trainerId = TRAINER_ERNEST_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) }, - .generalTextId = TEXT_ID(1, 49), + .battleTopicTextIds = BATTLE_TEXT_IDS(3), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 49), .battleFrontierRecordStreakTextIndex = 3, - .sameRouteMatchCallTextId = TEXT_ID(1, 3), - .differentRouteMatchCallTextId = TEXT_ID(2, 3), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3), }, { .trainerId = TRAINER_CORY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) }, - .generalTextId = TEXT_ID(1, 63), + .battleTopicTextIds = BATTLE_TEXT_IDS(3), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 63), .battleFrontierRecordStreakTextIndex = 3, - .sameRouteMatchCallTextId = TEXT_ID(1, 3), - .differentRouteMatchCallTextId = TEXT_ID(2, 3), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3), }, { .trainerId = TRAINER_EDWIN_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 7), TEXT_ID(2, 7), TEXT_ID(3, 7) }, - .generalTextId = TEXT_ID(1, 50), + .battleTopicTextIds = BATTLE_TEXT_IDS(7), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 50), .battleFrontierRecordStreakTextIndex = 7, - .sameRouteMatchCallTextId = TEXT_ID(1, 7), - .differentRouteMatchCallTextId = TEXT_ID(2, 7), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 7), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 7), }, { .trainerId = TRAINER_LYDIA_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) }, - .generalTextId = TEXT_ID(1, 52), + .battleTopicTextIds = BATTLE_TEXT_IDS(8), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 52), .battleFrontierRecordStreakTextIndex = 8, - .sameRouteMatchCallTextId = TEXT_ID(1, 8), - .differentRouteMatchCallTextId = TEXT_ID(2, 8), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8), }, { .trainerId = TRAINER_ISAAC_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) }, - .generalTextId = TEXT_ID(1, 51), + .battleTopicTextIds = BATTLE_TEXT_IDS(5), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 51), .battleFrontierRecordStreakTextIndex = 5, - .sameRouteMatchCallTextId = TEXT_ID(1, 5), - .differentRouteMatchCallTextId = TEXT_ID(2, 5), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5), }, { .trainerId = TRAINER_GABRIELLE_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) }, - .generalTextId = TEXT_ID(1, 2), + .battleTopicTextIds = BATTLE_TEXT_IDS(8), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 2), .battleFrontierRecordStreakTextIndex = 8, - .sameRouteMatchCallTextId = TEXT_ID(1, 8), - .differentRouteMatchCallTextId = TEXT_ID(2, 8), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8), }, { .trainerId = TRAINER_CATHERINE_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) }, - .generalTextId = TEXT_ID(1, 54), + .battleTopicTextIds = BATTLE_TEXT_IDS(9), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 54), .battleFrontierRecordStreakTextIndex = 9, - .sameRouteMatchCallTextId = TEXT_ID(1, 9), - .differentRouteMatchCallTextId = TEXT_ID(2, 9), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9), }, { .trainerId = TRAINER_JACKSON_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) }, - .generalTextId = TEXT_ID(1, 53), + .battleTopicTextIds = BATTLE_TEXT_IDS(5), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 53), .battleFrontierRecordStreakTextIndex = 5, - .sameRouteMatchCallTextId = TEXT_ID(1, 5), - .differentRouteMatchCallTextId = TEXT_ID(2, 5), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5), }, { .trainerId = TRAINER_HALEY_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) }, - .generalTextId = TEXT_ID(1, 55), + .battleTopicTextIds = BATTLE_TEXT_IDS(2), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 55), .battleFrontierRecordStreakTextIndex = 2, - .sameRouteMatchCallTextId = TEXT_ID(1, 2), - .differentRouteMatchCallTextId = TEXT_ID(2, 2), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2), }, { .trainerId = TRAINER_JAMES_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) }, - .generalTextId = TEXT_ID(1, 56), + .battleTopicTextIds = BATTLE_TEXT_IDS(1), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 56), .battleFrontierRecordStreakTextIndex = 1, - .sameRouteMatchCallTextId = TEXT_ID(1, 1), - .differentRouteMatchCallTextId = TEXT_ID(2, 1), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1), }, { .trainerId = TRAINER_TRENT_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) }, - .generalTextId = TEXT_ID(1, 57), + .battleTopicTextIds = BATTLE_TEXT_IDS(3), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 57), .battleFrontierRecordStreakTextIndex = 3, - .sameRouteMatchCallTextId = TEXT_ID(1, 3), - .differentRouteMatchCallTextId = TEXT_ID(2, 3), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3), }, { .trainerId = TRAINER_SAWYER_1, .unused = 0, - .battleTopicTextIds = { TEXT_ID(1, 15), TEXT_ID(2, 3), TEXT_ID(3, 3) }, - .generalTextId = TEXT_ID(1, 1), + // Thalia and Sawyer are the only ones who use different msg ids for their battle topics + .battleTopicTextIds = { TEXT_ID(B_TOPIC_WILD, 15), TEXT_ID(B_TOPIC_NEGATIVE, 3), TEXT_ID(B_TOPIC_POSITIVE, 3) }, + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 1), .battleFrontierRecordStreakTextIndex = 3, - .sameRouteMatchCallTextId = TEXT_ID(1, 3), - .differentRouteMatchCallTextId = TEXT_ID(2, 3), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3), }, { .trainerId = TRAINER_KIRA_AND_DAN_1, .unused = 1, - .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) }, - .generalTextId = TEXT_ID(1, 58), + .battleTopicTextIds = BATTLE_TEXT_IDS(9), + .generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 58), .battleFrontierRecordStreakTextIndex = 9, - .sameRouteMatchCallTextId = TEXT_ID(1, 9), - .differentRouteMatchCallTextId = TEXT_ID(2, 9), + .sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9), + .differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9), }, }; static const struct MatchCallText sMatchCallWildBattleTexts[] = { - { .text = MatchCall_WildBattleText1, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText2, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText3, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText4, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText5, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText6, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText7, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText8, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText9, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText10, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText11, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText12, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText13, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText14, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_WildBattleText15, .stringVarFuncIds = { 0, 2, -1 } }, + { .text = MatchCall_WildBattleText1, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText2, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText3, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText4, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText5, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText6, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText7, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText8, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText9, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText10, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText11, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText12, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText13, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText14, .stringVarFuncIds = STRS_WILD_BATTLE }, + { .text = MatchCall_WildBattleText15, .stringVarFuncIds = STRS_WILD_BATTLE }, }; - static const struct MatchCallText sMatchCallNegativeBattleTexts[] = - { - { .text = MatchCall_NegativeBattleText1, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText2, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText3, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText4, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText5, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText6, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText7, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText8, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText9, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText10, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText11, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText12, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText13, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_NegativeBattleText14, .stringVarFuncIds = { 0, -1, -1 } }, +static const struct MatchCallText sMatchCallNegativeBattleTexts[] = +{ + { .text = MatchCall_NegativeBattleText1, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText2, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText3, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText4, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText5, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText6, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText7, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText8, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText9, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText10, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText11, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText12, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText13, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, + { .text = MatchCall_NegativeBattleText14, .stringVarFuncIds = STRS_BATTLE_NEGATIVE }, }; static const struct MatchCallText sMatchCallPositiveBattleTexts[] = { - { .text = MatchCall_PositiveBattleText1, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText2, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText3, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText4, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText5, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText6, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText7, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText8, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText9, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText10, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText11, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText12, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText13, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PositiveBattleText14, .stringVarFuncIds = { 0, 3, -1 } }, + { .text = MatchCall_PositiveBattleText1, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText2, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText3, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText4, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText5, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText6, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText7, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText8, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText9, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText10, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText11, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText12, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText13, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, + { .text = MatchCall_PositiveBattleText14, .stringVarFuncIds = STRS_BATTLE_POSITIVE }, }; static const struct MatchCallText sMatchCallSameRouteBattleRequestTexts[] = { - { .text = MatchCall_SameRouteBattleRequestText1, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText2, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText3, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText4, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText5, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText6, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText7, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText8, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText9, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText10, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText11, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText12, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText13, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_SameRouteBattleRequestText14, .stringVarFuncIds = { 0, 1, -1 } }, + { .text = MatchCall_SameRouteBattleRequestText1, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText2, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText3, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText4, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText5, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText6, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText7, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText8, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText9, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText10, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText11, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText12, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText13, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_SameRouteBattleRequestText14, .stringVarFuncIds = STRS_BATTLE_REQUEST }, }; static const struct MatchCallText sMatchCallDifferentRouteBattleRequestTexts[] = { - { .text = MatchCall_DifferentRouteBattleRequestText1, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText2, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText3, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText4, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText5, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText6, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText7, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText8, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText9, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText10, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText11, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText12, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText13, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_DifferentRouteBattleRequestText14, .stringVarFuncIds = { 0, 1, -1 } }, + { .text = MatchCall_DifferentRouteBattleRequestText1, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText2, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText3, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText4, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText5, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText6, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText7, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText8, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText9, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText10, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText11, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText12, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText13, .stringVarFuncIds = STRS_BATTLE_REQUEST }, + { .text = MatchCall_DifferentRouteBattleRequestText14, .stringVarFuncIds = STRS_BATTLE_REQUEST }, }; static const struct MatchCallText sMatchCallPersonalizedTexts[] = { - { .text = MatchCall_PersonalizedText1, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_PersonalizedText2, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText3, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText4, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText5, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText6, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText7, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText8, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText9, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText10, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText11, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText12, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText13, .stringVarFuncIds = { 0, 2, -1 } }, - { .text = MatchCall_PersonalizedText14, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText15, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText16, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText17, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText18, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PersonalizedText19, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText20, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText21, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText22, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText23, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText24, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText25, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText26, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText27, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText28, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PersonalizedText29, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PersonalizedText30, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText31, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText32, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText33, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText34, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText35, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText36, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText37, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText38, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText39, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText40, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText41, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText42, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PersonalizedText43, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText44, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PersonalizedText45, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText46, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText47, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText48, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText49, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText50, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText51, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_PersonalizedText52, .stringVarFuncIds = { 0, 3, -1 } }, - { .text = MatchCall_PersonalizedText53, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText54, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText55, .stringVarFuncIds = { 0, 1, -1 } }, - { .text = MatchCall_PersonalizedText56, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText57, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText58, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText59, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText60, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText61, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText62, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText63, .stringVarFuncIds = { 0, -1, -1 } }, - { .text = MatchCall_PersonalizedText64, .stringVarFuncIds = { 0, -1, -1 } }, + { .text = MatchCall_PersonalizedText1, .stringVarFuncIds = { STR_TRAINER_NAME, STR_MAP_NAME, STR_NONE } }, + { .text = MatchCall_PersonalizedText2, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText3, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText4, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText5, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText6, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText7, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText8, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText9, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText10, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText11, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText12, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText13, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_ROUTE, STR_NONE } }, + { .text = MatchCall_PersonalizedText14, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText15, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText16, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText17, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText18, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } }, + { .text = MatchCall_PersonalizedText19, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText20, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText21, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText22, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText23, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText24, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText25, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText26, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText27, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText28, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } }, + { .text = MatchCall_PersonalizedText29, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } }, + { .text = MatchCall_PersonalizedText30, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText31, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText32, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText33, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText34, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText35, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText36, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText37, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText38, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText39, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText40, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText41, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText42, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } }, + { .text = MatchCall_PersonalizedText43, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText44, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } }, + { .text = MatchCall_PersonalizedText45, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText46, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText47, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText48, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText49, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText50, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText51, .stringVarFuncIds = { STR_TRAINER_NAME, STR_MAP_NAME, STR_NONE } }, + { .text = MatchCall_PersonalizedText52, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } }, + { .text = MatchCall_PersonalizedText53, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText54, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText55, .stringVarFuncIds = { STR_TRAINER_NAME, STR_MAP_NAME, STR_NONE } }, + { .text = MatchCall_PersonalizedText56, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText57, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText58, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText59, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText60, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText61, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText62, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText63, .stringVarFuncIds = STRS_NORMAL_MSG }, + { .text = MatchCall_PersonalizedText64, .stringVarFuncIds = STRS_NORMAL_MSG }, }; static const struct MatchCallText sMatchCallBattleFrontierStreakTexts[] = { - { .text = MatchCall_BattleFrontierStreakText1, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText2, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText3, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText4, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText5, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText6, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText7, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText8, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText9, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText10, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText11, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText12, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText13, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierStreakText14, .stringVarFuncIds = { 0, 4, 5 } }, + { .text = MatchCall_BattleFrontierStreakText1, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText2, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText3, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText4, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText5, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText6, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText7, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText8, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText9, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText10, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText11, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText12, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText13, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierStreakText14, .stringVarFuncIds = STRS_FRONTIER }, }; static const struct MatchCallText sMatchCallBattleFrontierRecordStreakTexts[] = { - { .text = MatchCall_BattleFrontierRecordStreakText1, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText2, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText3, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText4, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText5, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText6, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText7, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText8, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText9, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText10, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText11, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText12, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText13, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleFrontierRecordStreakText14, .stringVarFuncIds = { 0, 4, 5 } }, + { .text = MatchCall_BattleFrontierRecordStreakText1, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText2, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText3, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText4, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText5, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText6, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText7, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText8, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText9, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText10, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText11, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText12, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText13, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleFrontierRecordStreakText14, .stringVarFuncIds = STRS_FRONTIER }, }; static const struct MatchCallText sMatchCallBattleDomeTexts[] = { - { .text = MatchCall_BattleDomeText1, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText2, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText3, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText4, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText5, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText6, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText7, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText8, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText9, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText10, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText11, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText12, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText13, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattleDomeText14, .stringVarFuncIds = { 0, 4, 5 } }, + { .text = MatchCall_BattleDomeText1, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText2, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText3, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText4, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText5, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText6, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText7, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText8, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText9, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText10, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText11, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText12, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText13, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattleDomeText14, .stringVarFuncIds = STRS_FRONTIER }, }; static const struct MatchCallText sMatchCallBattlePikeTexts[] = { - { .text = MatchCall_BattlePikeText1, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText2, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText3, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText4, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText5, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText6, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText7, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText8, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText9, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText10, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText11, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText12, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText13, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePikeText14, .stringVarFuncIds = { 0, 4, 5 } }, + { .text = MatchCall_BattlePikeText1, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText2, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText3, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText4, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText5, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText6, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText7, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText8, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText9, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText10, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText11, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText12, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText13, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePikeText14, .stringVarFuncIds = STRS_FRONTIER }, }; static const struct MatchCallText sMatchCallBattlePyramidTexts[] = { - { .text = MatchCall_BattlePyramidText1, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText2, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText3, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText4, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText5, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText6, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText7, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText8, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText9, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText10, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText11, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText12, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText13, .stringVarFuncIds = { 0, 4, 5 } }, - { .text = MatchCall_BattlePyramidText14, .stringVarFuncIds = { 0, 4, 5 } }, + { .text = MatchCall_BattlePyramidText1, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText2, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText3, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText4, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText5, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText6, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText7, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText8, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText9, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText10, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText11, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText12, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText13, .stringVarFuncIds = STRS_FRONTIER }, + { .text = MatchCall_BattlePyramidText14, .stringVarFuncIds = STRS_FRONTIER }, }; static const struct MatchCallText *const sMatchCallBattleTopics[] = { - sMatchCallWildBattleTexts, - sMatchCallNegativeBattleTexts, - sMatchCallPositiveBattleTexts, + [B_TOPIC_WILD - 1] = sMatchCallWildBattleTexts, + [B_TOPIC_NEGATIVE - 1] = sMatchCallNegativeBattleTexts, + [B_TOPIC_POSITIVE - 1] = sMatchCallPositiveBattleTexts, }; static const struct MatchCallText *const sMatchCallBattleRequestTopics[] = { - sMatchCallSameRouteBattleRequestTexts, - sMatchCallDifferentRouteBattleRequestTexts, + [REQ_TOPIC_SAME_ROUTE - 1] = sMatchCallSameRouteBattleRequestTexts, + [REQ_TOPIC_DIFF_ROUTE - 1] = sMatchCallDifferentRouteBattleRequestTexts, }; static const struct MatchCallText *const sMatchCallGeneralTopics[] = { - sMatchCallPersonalizedTexts, - sMatchCallBattleFrontierStreakTexts, - sMatchCallBattleFrontierRecordStreakTexts, - sMatchCallBattleDomeTexts, - sMatchCallBattlePikeTexts, - sMatchCallBattlePyramidTexts, + [GEN_TOPIC_PERSONAL - 1] = sMatchCallPersonalizedTexts, + [GEN_TOPIC_STREAK - 1] = sMatchCallBattleFrontierStreakTexts, + [GEN_TOPIC_STREAK_RECORD - 1] = sMatchCallBattleFrontierRecordStreakTexts, + [GEN_TOPIC_B_DOME - 1] = sMatchCallBattleDomeTexts, + [GEN_TOPIC_B_PIKE - 1] = sMatchCallBattlePikeTexts, + [GEN_TOPIC_B_PYRAMID - 1] = sMatchCallBattlePyramidTexts, }; extern const u8 gBirchDexRatingText_AreYouCurious[]; @@ -971,13 +1023,13 @@ extern const u8 gBirchDexRatingText_OnANationwideBasis[]; void InitMatchCallCounters(void) { RtcCalcLocalTime(); - gMatchCallState.minutes = GetCurrentTotalMinutes(&gLocalTime) + 10; - gMatchCallState.stepCounter = 0; + sMatchCallState.minutes = GetCurrentTotalMinutes(&gLocalTime) + 10; + sMatchCallState.stepCounter = 0; } static u32 GetCurrentTotalMinutes(struct Time *time) { - return time->days * 1440 + time->hours * 60 + time->minutes; + return time->days * 24 * 60 + time->hours * 60 + time->minutes; } static bool32 UpdateMatchCallMinutesCounter(void) @@ -985,9 +1037,9 @@ static bool32 UpdateMatchCallMinutesCounter(void) int curMinutes; RtcCalcLocalTime(); curMinutes = GetCurrentTotalMinutes(&gLocalTime); - if (gMatchCallState.minutes > curMinutes || curMinutes - gMatchCallState.minutes > 9) + if (sMatchCallState.minutes > curMinutes || curMinutes - sMatchCallState.minutes > 9) { - gMatchCallState.minutes = curMinutes; + sMatchCallState.minutes = curMinutes; return TRUE; } @@ -1026,9 +1078,9 @@ static bool32 MapAllowsMatchCall(void) static bool32 UpdateMatchCallStepCounter(void) { - if (++gMatchCallState.stepCounter >= 10) + if (++sMatchCallState.stepCounter >= 10) { - gMatchCallState.stepCounter = 0; + sMatchCallState.stepCounter = 0; return TRUE; } else @@ -1041,15 +1093,15 @@ static bool32 SelectMatchCallTrainer(void) { u32 matchCallId; u32 numRegistered = GetNumRegisteredNPCs(); - if (!numRegistered) + if (numRegistered == 0) return FALSE; - gMatchCallState.trainerId = GetActiveMatchCallTrainerId(Random() % numRegistered); - gMatchCallState.triggeredFromScript = 0; - if (gMatchCallState.trainerId == REMATCH_TABLE_ENTRIES) + sMatchCallState.trainerId = GetActiveMatchCallTrainerId(Random() % numRegistered); + sMatchCallState.triggeredFromScript = FALSE; + if (sMatchCallState.trainerId == REMATCH_TABLE_ENTRIES) return FALSE; - matchCallId = GetTrainerMatchCallId(gMatchCallState.trainerId); + matchCallId = GetTrainerMatchCallId(sMatchCallState.trainerId); if (GetRematchTrainerLocation(matchCallId) == gMapHeader.regionMapSectionId && !TrainerIsEligibleForRematch(matchCallId)) return FALSE; @@ -1085,10 +1137,23 @@ static u32 GetActiveMatchCallTrainerId(u32 activeMatchCallId) return REMATCH_TABLE_ENTRIES; } +/* + From the function calls below, a call can only be triggered... + - If the player has match call + - Every 10th step + - Every 10 minutes + - 1/3 of the time (or 2/3 of the time, if the lead party Pokémon has Lightning Rod) + - If in a valid outdoor map (not Safari Zone, not underwater, not Mt Chimney with Team Magma, not Sootopolis with legendaries) + - If an eligible trainer to call the player is selected +*/ bool32 TryStartMatchCall(void) { - if (FlagGet(FLAG_HAS_MATCH_CALL) && UpdateMatchCallStepCounter() && UpdateMatchCallMinutesCounter() - && CheckMatchCallChance() && MapAllowsMatchCall() && SelectMatchCallTrainer()) + if (FlagGet(FLAG_HAS_MATCH_CALL) + && UpdateMatchCallStepCounter() + && UpdateMatchCallMinutesCounter() + && CheckMatchCallChance() + && MapAllowsMatchCall() + && SelectMatchCallTrainer()) { StartMatchCall(); return TRUE; @@ -1099,7 +1164,7 @@ bool32 TryStartMatchCall(void) void StartMatchCallFromScript(const u8 *message) { - gMatchCallState.triggeredFromScript = 1; + sMatchCallState.triggeredFromScript = TRUE; StartMatchCall(); } @@ -1110,7 +1175,7 @@ bool32 IsMatchCallTaskActive(void) static void StartMatchCall(void) { - if (!gMatchCallState.triggeredFromScript) + if (!sMatchCallState.triggeredFromScript) { ScriptContext2_Enable(); FreezeObjectEvents(); @@ -1122,33 +1187,37 @@ static void StartMatchCall(void) CreateTask(ExecuteMatchCall, 1); } -static const u16 sUnknown_0860EA4C[] = INCBIN_U16("graphics/unknown/unknown_60EA4C.gbapal"); -static const u8 sUnknown_0860EA6C[] = INCBIN_U8("graphics/interface/menu_border.4bpp"); -static const u16 sPokeNavIconPalette[] = INCBIN_U16("graphics/pokenav/icon.gbapal"); -static const u32 sPokeNavIconGfx[] = INCBIN_U32("graphics/pokenav/icon.4bpp.lz"); +static const u16 sMatchCallWindow_Pal[] = INCBIN_U16("graphics/pokenav/match_call_window.gbapal"); +static const u8 sMatchCallWindow_Gfx[] = INCBIN_U8("graphics/pokenav/match_call_window.4bpp"); +static const u16 sPokenavIcon_Pal[] = INCBIN_U16("graphics/pokenav/icon.gbapal"); +static const u32 sPokenavIcon_Gfx[] = INCBIN_U32("graphics/pokenav/icon.4bpp.lz"); static const u8 sText_PokenavCallEllipsis[] = _("………………\p"); +#define tState data[0] +#define tWindowId data[2] +#define tIconTaskId data[5] + static bool32 (*const sMatchCallTaskFuncs[])(u8) = { - LoadMatchCallWindowGfx, - MoveMatchCallWindowToVram, - PrintMatchCallIntroEllipsis, - sub_81962B0, - sub_81962D8, - sub_8196330, - sub_8196390, - sub_81963F0, + MatchCall_LoadGfx, + MatchCall_DrawWindow, + MatchCall_ReadyIntro, + MatchCall_SlideWindowIn, + MatchCall_PrintIntro, + MatchCall_PrintMessage, + MatchCall_SlideWindowOut, + MatchCall_EndCall, }; static void ExecuteMatchCall(u8 taskId) { - s16 *taskData = gTasks[taskId].data; - if (sMatchCallTaskFuncs[taskData[0]](taskId)) + s16 *data = gTasks[taskId].data; + if (sMatchCallTaskFuncs[tState](taskId)) { - taskData[0]++; - taskData[1] = 0; - if ((u16)taskData[0] > 7) + tState++; + data[1] = 0; // Never read + if ((u16)tState > 7) DestroyTask(taskId); } } @@ -1164,65 +1233,69 @@ static const struct WindowTemplate sMatchCallTextWindow = .baseBlock = 0x200 }; -static bool32 LoadMatchCallWindowGfx(u8 taskId) +#define TILE_MC_WINDOW 0x270 +#define TILE_POKENAV_ICON 0x279 + +static bool32 MatchCall_LoadGfx(u8 taskId) { - s16 *taskData = gTasks[taskId].data; - taskData[2] = AddWindow(&sMatchCallTextWindow); - if (taskData[2] == WINDOW_NONE) + s16 *data = gTasks[taskId].data; + tWindowId = AddWindow(&sMatchCallTextWindow); + if (tWindowId == WINDOW_NONE) { DestroyTask(taskId); return FALSE; } - if (LoadBgTiles(0, sUnknown_0860EA6C, sizeof(sUnknown_0860EA6C), 0x270) == 0xFFFF) + if (LoadBgTiles(0, sMatchCallWindow_Gfx, sizeof(sMatchCallWindow_Gfx), TILE_MC_WINDOW) == 0xFFFF) { - RemoveWindow(taskData[2]); + RemoveWindow(tWindowId); DestroyTask(taskId); return FALSE; } - if (!DecompressAndCopyTileDataToVram(0, sPokeNavIconGfx, 0, 0x279, 0)) + if (!DecompressAndCopyTileDataToVram(0, sPokenavIcon_Gfx, 0, TILE_POKENAV_ICON, 0)) { - RemoveWindow(taskData[2]); + RemoveWindow(tWindowId); DestroyTask(taskId); return FALSE; } - FillWindowPixelBuffer(taskData[2], PIXEL_FILL(8)); - LoadPalette(sUnknown_0860EA4C, 0xE0, 0x20); - LoadPalette(sPokeNavIconPalette, 0xF0, 0x20); + FillWindowPixelBuffer(tWindowId, PIXEL_FILL(8)); + LoadPalette(sMatchCallWindow_Pal, 0xE0, sizeof(sMatchCallWindow_Pal)); + LoadPalette(sPokenavIcon_Pal, 0xF0, sizeof(sPokenavIcon_Pal)); ChangeBgY(0, -0x2000, 0); return TRUE; } -static bool32 MoveMatchCallWindowToVram(u8 taskId) +static bool32 MatchCall_DrawWindow(u8 taskId) { - s16 *taskData = gTasks[taskId].data; + s16 *data = gTasks[taskId].data; if (FreeTempTileDataBuffersIfPossible()) return FALSE; - PutWindowTilemap(taskData[2]); - DrawMatchCallTextBoxBorder(taskData[2], 0x270, 14); - WriteSequenceToBgTilemapBuffer(0, 0xF279, 1, 15, 4, 4, 17, 1); - taskData[5] = CreateTask(sub_8196694, 10); - CopyWindowToVram(taskData[2], 2); + PutWindowTilemap(tWindowId); + DrawMatchCallTextBoxBorder_Internal(tWindowId, TILE_MC_WINDOW, 14); + WriteSequenceToBgTilemapBuffer(0, (0xF << 12) | TILE_POKENAV_ICON, 1, 15, 4, 4, 17, 1); + tIconTaskId = CreateTask(Task_SpinPokenavIcon, 10); + CopyWindowToVram(tWindowId, 2); CopyBgTilemapBufferToVram(0); return TRUE; } -static bool32 PrintMatchCallIntroEllipsis(u8 taskId) +static bool32 MatchCall_ReadyIntro(u8 taskId) { - s16 *taskData = gTasks[taskId].data; + s16 *data = gTasks[taskId].data; if (!IsDma3ManagerBusyWithBgCopy()) { - InitMatchCallTextPrinter(taskData[2], sText_PokenavCallEllipsis); + // Note that "..." is not printed yet, just readied + InitMatchCallTextPrinter(tWindowId, sText_PokenavCallEllipsis); return TRUE; } return FALSE; } -static bool32 sub_81962B0(u8 taskId) +static bool32 MatchCall_SlideWindowIn(u8 taskId) { if (ChangeBgY(0, 0x600, 1) >= 0) { @@ -1233,29 +1306,30 @@ static bool32 sub_81962B0(u8 taskId) return FALSE; } -static bool32 sub_81962D8(u8 taskId) +static bool32 MatchCall_PrintIntro(u8 taskId) { - s16 *taskData = gTasks[taskId].data; - if (!ExecuteMatchCallTextPrinter(taskData[2])) + s16 *data = gTasks[taskId].data; + if (!RunMatchCallTextPrinter(tWindowId)) { - FillWindowPixelBuffer(taskData[2], PIXEL_FILL(8)); - if (!gMatchCallState.triggeredFromScript) - SelectMatchCallMessage(gMatchCallState.trainerId, gStringVar4); - - InitMatchCallTextPrinter(taskData[2], gStringVar4); + FillWindowPixelBuffer(tWindowId, PIXEL_FILL(8)); + + // Ready the message + if (!sMatchCallState.triggeredFromScript) + SelectMatchCallMessage(sMatchCallState.trainerId, gStringVar4); + InitMatchCallTextPrinter(tWindowId, gStringVar4); return TRUE; } return FALSE; } -static bool32 sub_8196330(u8 taskId) +static bool32 MatchCall_PrintMessage(u8 taskId) { - s16 *taskData = gTasks[taskId].data; - if (!ExecuteMatchCallTextPrinter(taskData[2]) && !IsSEPlaying() && JOY_NEW(A_BUTTON | B_BUTTON)) + s16 *data = gTasks[taskId].data; + if (!RunMatchCallTextPrinter(tWindowId) && !IsSEPlaying() && JOY_NEW(A_BUTTON | B_BUTTON)) { - FillWindowPixelBuffer(taskData[2], PIXEL_FILL(8)); - CopyWindowToVram(taskData[2], 2); + FillWindowPixelBuffer(tWindowId, PIXEL_FILL(8)); + CopyWindowToVram(tWindowId, 2); PlaySE(SE_POKENAV_HANG_UP); return TRUE; } @@ -1263,14 +1337,14 @@ static bool32 sub_8196330(u8 taskId) return FALSE; } -static bool32 sub_8196390(u8 taskId) +static bool32 MatchCall_SlideWindowOut(u8 taskId) { - s16 *taskData = gTasks[taskId].data; + s16 *data = gTasks[taskId].data; if (ChangeBgY(0, 0x600, 2) <= -0x2000) { FillBgTilemapBufferRect_Palette0(0, 0, 0, 14, 30, 6); - DestroyTask(taskData[5]); - RemoveWindow(taskData[2]); + DestroyTask(tIconTaskId); + RemoveWindow(tWindowId); CopyBgTilemapBufferToVram(0); return TRUE; } @@ -1278,13 +1352,13 @@ static bool32 sub_8196390(u8 taskId) return FALSE; } -static bool32 sub_81963F0(u8 taskId) +static bool32 MatchCall_EndCall(u8 taskId) { u8 playerObjectId; if (!IsDma3ManagerBusyWithBgCopy() && !IsSEPlaying()) { ChangeBgY(0, 0, 0); - if (!gMatchCallState.triggeredFromScript) + if (!sMatchCallState.triggeredFromScript) { LoadMessageBoxAndBorderGfx(); playerObjectId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0); @@ -1300,7 +1374,7 @@ static bool32 sub_81963F0(u8 taskId) return FALSE; } -static void DrawMatchCallTextBoxBorder(u32 windowId, u32 tileOffset, u32 paletteId) +static void DrawMatchCallTextBoxBorder_Internal(u32 windowId, u32 tileOffset, u32 paletteId) { int bg, x, y, width, height; int tileNum; @@ -1335,40 +1409,48 @@ static void InitMatchCallTextPrinter(int windowId, const u8 *str) printerTemplate.letterSpacing = 0; printerTemplate.lineSpacing = 0; printerTemplate.unk = 0; - printerTemplate.fgColor = 10; - printerTemplate.bgColor = 8; - printerTemplate.shadowColor = 14; - gTextFlags.useAlternateDownArrow = 0; + printerTemplate.fgColor = TEXT_DYNAMIC_COLOR_1; + printerTemplate.bgColor = TEXT_COLOR_BLUE; + printerTemplate.shadowColor = TEXT_DYNAMIC_COLOR_5; + gTextFlags.useAlternateDownArrow = FALSE; AddTextPrinter(&printerTemplate, GetPlayerTextSpeedDelay(), NULL); } -static bool32 ExecuteMatchCallTextPrinter(int windowId) +static bool32 RunMatchCallTextPrinter(int windowId) { if (JOY_HELD(A_BUTTON)) - gTextFlags.canABSpeedUpPrint = 1; + gTextFlags.canABSpeedUpPrint = TRUE; else - gTextFlags.canABSpeedUpPrint = 0; + gTextFlags.canABSpeedUpPrint = FALSE; RunTextPrinters(); return IsTextPrinterActive(windowId); } -static void sub_8196694(u8 taskId) +#define tTimer data[0] +#define tSpinStage data[1] +#define tTileNum data[2] + +static void Task_SpinPokenavIcon(u8 taskId) { - s16 *taskData = gTasks[taskId].data; - if (++taskData[0] > 8) + s16 *data = gTasks[taskId].data; + if (++tTimer > 8) { - taskData[0] = 0; - if (++taskData[1] > 7) - taskData[1] = 0; + tTimer = 0; + if (++tSpinStage > 7) + tSpinStage = 0; - taskData[2] = (taskData[1] * 16) + 0x279; - WriteSequenceToBgTilemapBuffer(0, taskData[2] | ~0xFFF, 1, 15, 4, 4, 17, 1); + tTileNum = (tSpinStage * 16) + TILE_POKENAV_ICON; + WriteSequenceToBgTilemapBuffer(0, tTileNum | ~0xFFF, 1, 15, 4, 4, 17, 1); CopyBgTilemapBufferToVram(0); } } +#undef tTimer +#undef tSpinStage +#undef tTileNum + static bool32 TrainerIsEligibleForRematch(int matchCallId) { return gSaveBlock1Ptr->trainerRematches[matchCallId] > 0; @@ -1392,7 +1474,10 @@ static u32 GetNumRematchTrainersFought(void) return count; } -static u32 sub_8196774(int arg0) +// Look through the rematch table for trainers that have been defeated once before. +// Return the index into the rematch table of the nth defeated trainer, +// or REMATCH_TABLE_ENTRIES if fewer than n rematch trainers have been defeated. +static u32 GetNthRematchTrainerFought(int n) { u32 i, count; @@ -1400,7 +1485,7 @@ static u32 sub_8196774(int arg0) { if (HasTrainerBeenFought(gRematchTable[i].trainerIds[0])) { - if (count == arg0) + if (count == n) return i; count++; @@ -1417,13 +1502,19 @@ bool32 SelectMatchCallMessage(int trainerId, u8 *str) bool32 retVal = FALSE; matchCallId = GetTrainerMatchCallId(trainerId); - gBattleFrontierStreakInfo.facilityId = 0; + sBattleFrontierStreakInfo.facilityId = 0; + + // If the player is on the same route as the trainer + // and they can be rematched, they will always request a battle if (TrainerIsEligibleForRematch(matchCallId) && GetRematchTrainerLocation(matchCallId) == gMapHeader.regionMapSectionId) { matchCallText = GetSameRouteMatchCallText(matchCallId, str); } - else if (sub_8196D74(matchCallId)) + // If the player is not on the same route as the trainer + // and they can be rematched, there is a random chance for + // the trainer to request a battle + else if (ShouldTrainerRequestBattle(matchCallId)) { matchCallText = GetDifferentRouteMatchCallText(matchCallId, str); retVal = TRUE; @@ -1431,10 +1522,12 @@ bool32 SelectMatchCallMessage(int trainerId, u8 *str) } else if (Random() % 3) { + // Message talking about a battle the NPC had matchCallText = GetBattleMatchCallText(matchCallId, str); } else { + // Message talking about something else matchCallText = GetGeneralMatchCallText(matchCallId, str); } @@ -1509,8 +1602,8 @@ static const struct MatchCallText *GetGeneralMatchCallText(int matchCallId, u8 * count = Random() % count; for (i = 0; i < NUM_FRONTIER_FACILITIES; i++) { - gBattleFrontierStreakInfo.streak = GetFrontierStreakInfo(i, &topic); - if (gBattleFrontierStreakInfo.streak < 2) + sBattleFrontierStreakInfo.streak = GetFrontierStreakInfo(i, &topic); + if (sBattleFrontierStreakInfo.streak < 2) continue; if (!count) @@ -1519,7 +1612,7 @@ static const struct MatchCallText *GetGeneralMatchCallText(int matchCallId, u8 * count--; } - gBattleFrontierStreakInfo.facilityId = i; + sBattleFrontierStreakInfo.facilityId = i; id = sMatchCallTrainers[matchCallId].battleFrontierRecordStreakTextIndex - 1; return &sMatchCallGeneralTopics[topic][id]; } @@ -1541,7 +1634,7 @@ static u8 *const sMatchCallTextStringVars[] = { gStringVar1, gStringVar2, gStrin static void PopulateMatchCallStringVars(int matchCallId, const s8 *stringVarFuncIds) { int i; - for (i = 0; i < 3; i++) + for (i = 0; i < NUM_STRVARS_IN_MSG; i++) { if (stringVarFuncIds[i] >= 0) PopulateMatchCallStringVar(matchCallId, stringVarFuncIds[i], sMatchCallTextStringVars[i]); @@ -1550,12 +1643,12 @@ static void PopulateMatchCallStringVars(int matchCallId, const s8 *stringVarFunc static void (*const sPopulateMatchCallStringVarFuncs[])(int, u8 *) = { - PopulateTrainerName, - PopulateMapName, - PopulateSpeciesFromTrainerLocation, - PopulateSpeciesFromTrainerParty, - PopulateBattleFrontierFacilityName, - PopulateBattleFrontierStreak, + [STR_TRAINER_NAME] = PopulateTrainerName, + [STR_MAP_NAME] = PopulateMapName, + [STR_SPECIES_IN_ROUTE] = PopulateSpeciesFromTrainerLocation, + [STR_SPECIES_IN_PARTY] = PopulateSpeciesFromTrainerParty, + [STR_FACILITY_NAME] = PopulateBattleFrontierFacilityName, + [STR_FRONTIER_STREAK] = PopulateBattleFrontierStreak, }; static void PopulateMatchCallStringVar(int matchCallId, int funcId, u8 *destStr) @@ -1577,7 +1670,7 @@ static void PopulateTrainerName(int matchCallId, u8 *destStr) { u32 i; u16 trainerId = sMatchCallTrainers[matchCallId].trainerId; - for (i = 0; i < 6; i++) + for (i = 0; i < ARRAY_COUNT(sMultiTrainerMatchCallTexts); i++) { if (sMultiTrainerMatchCallTexts[i].trainerId == trainerId) { @@ -1728,20 +1821,20 @@ static const u8 *const sBattleFrontierFacilityNames[] = static void PopulateBattleFrontierFacilityName(int matchCallId, u8 *destStr) { - StringCopy(destStr, sBattleFrontierFacilityNames[gBattleFrontierStreakInfo.facilityId]); + StringCopy(destStr, sBattleFrontierFacilityNames[sBattleFrontierStreakInfo.facilityId]); } static void PopulateBattleFrontierStreak(int matchCallId, u8 *destStr) { int i = 0; - int streak = gBattleFrontierStreakInfo.streak; + int streak = sBattleFrontierStreakInfo.streak; while (streak != 0) { streak /= 10; i++; } - ConvertIntToDecimalStringN(destStr, gBattleFrontierStreakInfo.streak, STR_CONV_MODE_LEFT_ALIGN, i); + ConvertIntToDecimalStringN(destStr, sBattleFrontierStreakInfo.streak, STR_CONV_MODE_LEFT_ALIGN, i); } static const u16 sBadgeFlags[NUM_BADGES] = @@ -1769,13 +1862,14 @@ static int GetNumOwnedBadges(void) return i; } -static bool32 sub_8196D74(int matchCallId) +// Whether or not a trainer calling the player from a different route should request a battle +static bool32 ShouldTrainerRequestBattle(int matchCallId) { int dayCount; int otId; - u16 easyChatWord; + u16 dewfordRand; int numRematchTrainersFought; - int var0, var1, var2; + int max, rand, n; if (GetNumOwnedBadges() < 5) return FALSE; @@ -1783,14 +1877,14 @@ static bool32 sub_8196D74(int matchCallId) dayCount = RtcGetLocalDayCount(); otId = GetTrainerId(gSaveBlock2Ptr->playerTrainerId) & 0xFFFF; - easyChatWord = gSaveBlock1Ptr->easyChatPairs[0].unk2; + dewfordRand = gSaveBlock1Ptr->dewfordTrends[0].rand; numRematchTrainersFought = GetNumRematchTrainersFought(); - var0 = (numRematchTrainersFought * 13) / 10; - var1 = ((dayCount ^ easyChatWord) + (easyChatWord ^ GetGameStat(GAME_STAT_TRAINER_BATTLES))) ^ otId; - var2 = var1 % var0; - if (var2 < numRematchTrainersFought) + max = (numRematchTrainersFought * 13) / 10; + rand = ((dayCount ^ dewfordRand) + (dewfordRand ^ GetGameStat(GAME_STAT_TRAINER_BATTLES))) ^ otId; + n = rand % max; + if (n < numRematchTrainersFought) { - if (sub_8196774(var2) == matchCallId) + if (GetNthRematchTrainerFought(n) == matchCallId) return TRUE; } @@ -1814,7 +1908,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) streak = gSaveBlock2Ptr->frontier.domeRecordWinStreaks[i][j]; } } - *topicTextId = 3; + *topicTextId = GEN_TOPIC_B_DOME - 1; break; #ifdef BUGFIX case FRONTIER_FACILITY_PIKE: @@ -1826,7 +1920,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) if (streak < gSaveBlock2Ptr->frontier.pikeRecordStreaks[i]) streak = gSaveBlock2Ptr->frontier.pikeRecordStreaks[i]; } - *topicTextId = 4; + *topicTextId = GEN_TOPIC_B_PIKE - 1; break; case FRONTIER_FACILITY_TOWER: for (i = 0; i < 4; i++) @@ -1837,7 +1931,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) streak = gSaveBlock2Ptr->frontier.towerRecordWinStreaks[i][j]; } } - *topicTextId = 2; + *topicTextId = GEN_TOPIC_STREAK_RECORD - 1; break; case FRONTIER_FACILITY_PALACE: for (i = 0; i < 2; i++) @@ -1848,7 +1942,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) streak = gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[i][j]; } } - *topicTextId = 2; + *topicTextId = GEN_TOPIC_STREAK_RECORD - 1; break; #ifdef BUGFIX case FRONTIER_FACILITY_FACTORY: @@ -1863,7 +1957,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) streak = gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[i][j]; } } - *topicTextId = 2; + *topicTextId = GEN_TOPIC_STREAK_RECORD - 1; break; case FRONTIER_FACILITY_ARENA: for (i = 0; i < 2; i++) @@ -1871,7 +1965,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) if (streak < gSaveBlock2Ptr->frontier.arenaRecordStreaks[i]) streak = gSaveBlock2Ptr->frontier.arenaRecordStreaks[i]; } - *topicTextId = 2; + *topicTextId = GEN_TOPIC_STREAK_RECORD - 1; break; case FRONTIER_FACILITY_PYRAMID: for (i = 0; i < 2; i++) @@ -1879,7 +1973,7 @@ static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId) if (streak < gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i]) streak = gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i]; } - *topicTextId = 5; + *topicTextId = GEN_TOPIC_B_PYRAMID - 1; break; } @@ -1971,7 +2065,7 @@ void BufferPokedexRatingForMatchCall(u8 *destStr) u8 *str; u8 dexRatingLevel; - u8 *buffer = Alloc(0x3E8); + u8 *buffer = Alloc(sizeof(gStringVar4)); if (!buffer) { destStr[0] = EOS; @@ -1984,18 +2078,15 @@ void BufferPokedexRatingForMatchCall(u8 *destStr) ConvertIntToDecimalStringN(gStringVar2, numCaught, STR_CONV_MODE_LEFT_ALIGN, 3); dexRatingLevel = GetPokedexRatingLevel(numCaught); str = StringCopy(buffer, gBirchDexRatingText_AreYouCurious); - str[0] = CHAR_PROMPT_CLEAR; - str++; + *(str++) = CHAR_PROMPT_CLEAR; str = StringCopy(str, gBirchDexRatingText_SoYouveSeenAndCaught); - str[0] = CHAR_PROMPT_CLEAR; - str++; + *(str++) = CHAR_PROMPT_CLEAR; StringCopy(str, sBirchDexRatingTexts[dexRatingLevel]); str = StringExpandPlaceholders(destStr, buffer); if (IsNationalPokedexEnabled()) { - str[0] = CHAR_PROMPT_CLEAR; - str++; + *(str++) = CHAR_PROMPT_CLEAR; numSeen = GetNationalPokedexCount(FLAG_GET_SEEN); numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); ConvertIntToDecimalStringN(gStringVar1, numSeen, STR_CONV_MODE_LEFT_ALIGN, 3); @@ -2006,14 +2097,14 @@ void BufferPokedexRatingForMatchCall(u8 *destStr) Free(buffer); } -void sub_8197184(u32 windowId, u32 destOffset, u32 paletteId) +void LoadMatchCallWindowGfx(u32 windowId, u32 destOffset, u32 paletteId) { u8 bg = GetWindowAttribute(windowId, WINDOW_BG); - LoadBgTiles(bg, sUnknown_0860EA6C, 0x100, destOffset); - LoadPalette(sUnknown_0860EA4C, paletteId << 4, 0x20); + LoadBgTiles(bg, sMatchCallWindow_Gfx, 0x100, destOffset); + LoadPalette(sMatchCallWindow_Pal, paletteId << 4, sizeof(sMatchCallWindow_Pal)); } -void sub_81971C4(u32 windowId, u32 tileOffset, u32 paletteId) +void DrawMatchCallTextBoxBorder(u32 windowId, u32 tileOffset, u32 paletteId) { - DrawMatchCallTextBoxBorder(windowId, tileOffset, paletteId); + DrawMatchCallTextBoxBorder_Internal(windowId, tileOffset, paletteId); } diff --git a/src/pokenav_match_call_2.c b/src/pokenav_match_call_2.c index 593581d0e..398e174d8 100755 --- a/src/pokenav_match_call_2.c +++ b/src/pokenav_match_call_2.c @@ -1061,15 +1061,15 @@ static void UpdateWindowsToShowCheckPage(struct Pokenav4Struct *state) static void sub_81CC034(struct Pokenav4Struct *state) { state->msgBoxWindowId = AddWindow(&sCallMsgBoxWindowTemplate); - sub_8197184(state->msgBoxWindowId, 1, 4); + LoadMatchCallWindowGfx(state->msgBoxWindowId, 1, 4); sub_81C7B40(); } static void DrawMsgBoxForMatchCallMsg(struct Pokenav4Struct *state) { struct Sprite *sprite; - sub_8197184(state->msgBoxWindowId, 1, 4); - sub_81971C4(state->msgBoxWindowId, 1, 4); + LoadMatchCallWindowGfx(state->msgBoxWindowId, 1, 4); + DrawMatchCallTextBoxBorder(state->msgBoxWindowId, 1, 4); FillWindowPixelBuffer(state->msgBoxWindowId, PIXEL_FILL(1)); PutWindowTilemap(state->msgBoxWindowId); CopyWindowToVram(state->msgBoxWindowId, 3); diff --git a/src/record_mixing.c b/src/record_mixing.c index 2028cc647..bb19fad74 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -50,7 +50,7 @@ struct PlayerRecordsRS TVShow tvShows[TV_SHOWS_COUNT]; PokeNews pokeNews[POKE_NEWS_COUNT]; OldMan oldMan; - struct EasyChatPair easyChatPairs[5]; + struct DewfordTrend dewfordTrends[SAVED_TRENDS_COUNT]; struct RecordMixingDayCareMail dayCareMail; struct RSBattleTowerRecord battleTowerRecord; u16 giftItem; @@ -63,7 +63,7 @@ struct PlayerRecordsEmerald /* 0x0c80 */ TVShow tvShows[TV_SHOWS_COUNT]; /* 0x1004 */ PokeNews pokeNews[POKE_NEWS_COUNT]; /* 0x1044 */ OldMan oldMan; - /* 0x1084 */ struct EasyChatPair easyChatPairs[5]; + /* 0x1084 */ struct DewfordTrend dewfordTrends[SAVED_TRENDS_COUNT]; /* 0x10ac */ struct RecordMixingDayCareMail dayCareMail; /* 0x1124 */ struct EmeraldBattleTowerRecord battleTowerRecord; /* 0x1210 */ u16 giftItem; @@ -86,7 +86,7 @@ static struct SecretBase *sSecretBasesSave; static TVShow *sTvShowsSave; static PokeNews *sPokeNewsSave; static OldMan *sOldManSave; -static struct EasyChatPair *sEasyChatPairsSave; +static struct DewfordTrend *sDewfordTrendsSave; static struct RecordMixingDayCareMail *gUnknown_03001148; static void *sBattleTowerSave; static LilycoveLady *sLilycoveLadySave; @@ -179,7 +179,7 @@ static void SetSrcLookupPointers(void) sTvShowsSave = gSaveBlock1Ptr->tvShows; sPokeNewsSave = gSaveBlock1Ptr->pokeNews; sOldManSave = &gSaveBlock1Ptr->oldMan; - sEasyChatPairsSave = gSaveBlock1Ptr->easyChatPairs; + sDewfordTrendsSave = gSaveBlock1Ptr->dewfordTrends; gUnknown_03001148 = &gUnknown_02039F9C; sBattleTowerSave = &gSaveBlock2Ptr->frontier.towerPlayer; sLilycoveLadySave = &gSaveBlock1Ptr->lilycoveLady; @@ -194,7 +194,7 @@ static void PrepareUnknownExchangePacket(struct PlayerRecordsRS *dest) sub_80F14F8(dest->tvShows); memcpy(dest->pokeNews, sPokeNewsSave, sizeof(dest->pokeNews)); memcpy(&dest->oldMan, sOldManSave, sizeof(dest->oldMan)); - memcpy(dest->easyChatPairs, sEasyChatPairsSave, sizeof(dest->easyChatPairs)); + memcpy(dest->dewfordTrends, sDewfordTrendsSave, sizeof(dest->dewfordTrends)); sub_80E89F8(&dest->dayCareMail); EmeraldBattleTowerRecordToRuby(sBattleTowerSave, &dest->battleTowerRecord); @@ -211,7 +211,7 @@ static void PrepareExchangePacketForRubySapphire(struct PlayerRecordsRS *dest) memcpy(dest->pokeNews, sPokeNewsSave, sizeof(dest->pokeNews)); memcpy(&dest->oldMan, sOldManSave, sizeof(dest->oldMan)); sub_8120B70(&dest->oldMan); - memcpy(dest->easyChatPairs, sEasyChatPairsSave, sizeof(dest->easyChatPairs)); + memcpy(dest->dewfordTrends, sDewfordTrendsSave, sizeof(dest->dewfordTrends)); sub_80E89F8(&dest->dayCareMail); SanitizeDayCareMailForRuby(&dest->dayCareMail); EmeraldBattleTowerRecordToRuby(sBattleTowerSave, &dest->battleTowerRecord); @@ -241,7 +241,7 @@ static void PrepareExchangePacket(void) memcpy(sSentRecord->emerald.pokeNews, sPokeNewsSave, sizeof(sSentRecord->emerald.pokeNews)); memcpy(&sSentRecord->emerald.oldMan, sOldManSave, sizeof(sSentRecord->emerald.oldMan)); memcpy(&sSentRecord->emerald.lilycoveLady, sLilycoveLadySave, sizeof(sSentRecord->emerald.lilycoveLady)); - memcpy(sSentRecord->emerald.easyChatPairs, sEasyChatPairsSave, sizeof(sSentRecord->emerald.easyChatPairs)); + memcpy(sSentRecord->emerald.dewfordTrends, sDewfordTrendsSave, sizeof(sSentRecord->emerald.dewfordTrends)); sub_80E89F8(&sSentRecord->emerald.dayCareMail); memcpy(&sSentRecord->emerald.battleTowerRecord, sBattleTowerSave, sizeof(sSentRecord->emerald.battleTowerRecord)); SanitizeEmeraldBattleTowerRecord(&sSentRecord->emerald.battleTowerRecord); @@ -266,7 +266,7 @@ static void ReceiveExchangePacket(u32 which) ReceiveTvShowsData(sReceivedRecords->ruby.tvShows, sizeof(struct PlayerRecordsRS), which); ReceivePokeNewsData(sReceivedRecords->ruby.pokeNews, sizeof(struct PlayerRecordsRS), which); ReceiveOldManData(&sReceivedRecords->ruby.oldMan, sizeof(struct PlayerRecordsRS), which); - ReceiveEasyChatPairsData(sReceivedRecords->ruby.easyChatPairs, sizeof(struct PlayerRecordsRS), which); + ReceiveDewfordTrendData(sReceivedRecords->ruby.dewfordTrends, sizeof(struct PlayerRecordsRS), which); ReceiveGiftItem(&sReceivedRecords->ruby.giftItem, which); } else @@ -277,7 +277,7 @@ static void ReceiveExchangePacket(u32 which) ReceiveTvShowsData(sReceivedRecords->emerald.tvShows, sizeof(struct PlayerRecordsEmerald), which); ReceivePokeNewsData(sReceivedRecords->emerald.pokeNews, sizeof(struct PlayerRecordsEmerald), which); ReceiveOldManData(&sReceivedRecords->emerald.oldMan, sizeof(struct PlayerRecordsEmerald), which); - ReceiveEasyChatPairsData(sReceivedRecords->emerald.easyChatPairs, sizeof(struct PlayerRecordsEmerald), which); + ReceiveDewfordTrendData(sReceivedRecords->emerald.dewfordTrends, sizeof(struct PlayerRecordsEmerald), which); ReceiveDaycareMailData(&sReceivedRecords->emerald.dayCareMail, sizeof(struct PlayerRecordsEmerald), which, sReceivedRecords->emerald.tvShows); ReceiveBattleTowerData(&sReceivedRecords->emerald.battleTowerRecord, sizeof(struct PlayerRecordsEmerald), which); ReceiveGiftItem(&sReceivedRecords->emerald.giftItem, which); @@ -504,13 +504,13 @@ static const u8 *const sTVTodaysRivalTrainerTextGroup[] = { }; static const u8 *const sTVDewfordTrendWatcherNetworkTextGroup[] = { - gTVDewfordTrendWatcherNetworkText00, - gTVDewfordTrendWatcherNetworkText01, - gTVDewfordTrendWatcherNetworkText02, - gTVDewfordTrendWatcherNetworkText03, - gTVDewfordTrendWatcherNetworkText04, - gTVDewfordTrendWatcherNetworkText05, - gTVDewfordTrendWatcherNetworkText06 + [TRENDWATCHER_STATE_INTRO] = TrendWatcher_Text_Intro, + [TRENDWATCHER_STATE_TAUGHT_MALE] = TrendWatcher_Text_MaleTaughtMePhrase, + [TRENDWATCHER_STATE_TAUGHT_FEMALE] = TrendWatcher_Text_FemaleTaughtMePhrase, + [TRENDWATCHER_STATE_PHRASE_HOPELESS] = TrendWatcher_Text_PhraseWasHopeless, + [TRENDWATCHER_STATE_BIGGER_MALE] = TrendWatcher_Text_MaleTellMeBigger, + [TRENDWATCHER_STATE_BIGGER_FEMALE] = TrendWatcher_Text_FemaleTellMeBigger, + [TRENDWATCHER_STATE_OUTRO] = TrendWatcher_Text_Outro }; static const u8 *const sTVHoennTreasureInvestisatorsTextGroup[] = { @@ -1972,7 +1972,7 @@ void TryPutTodaysRivalTrainerOnAir(void) } } -void sub_80EDC60(const u16 *words) +void TryPutTrendWatcherOnAir(const u16 *words) { TVShow *show; @@ -5979,48 +5979,40 @@ static void DoTVShowDewfordTrendWatcherNetwork(void) state = sTVShowState; switch (state) { - case 0: - CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); - CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); - if (show->trendWatcher.gender == MALE) - { - sTVShowState = 1; - } - else - { - sTVShowState = 2; - } - break; - case 1: - case 2: - CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); - CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); - TVShowConvertInternationalString(gStringVar3, show->trendWatcher.playerName, show->trendWatcher.language); - sTVShowState = 3; - break; - case 3: - CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); - CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); - if (show->trendWatcher.gender == MALE) - { - sTVShowState = 4; - } - else - { - sTVShowState = 5; - } - break; - case 4: - case 5: - CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); - CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); - TVShowConvertInternationalString(gStringVar3, show->trendWatcher.playerName, show->trendWatcher.language); - sTVShowState = 6; - break; - case 6: - CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); - CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); - TVShowDone(); + case TRENDWATCHER_STATE_INTRO: + CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); + CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); + if (show->trendWatcher.gender == MALE) + sTVShowState = TRENDWATCHER_STATE_TAUGHT_MALE; + else + sTVShowState = TRENDWATCHER_STATE_TAUGHT_FEMALE; + break; + case TRENDWATCHER_STATE_TAUGHT_MALE: + case TRENDWATCHER_STATE_TAUGHT_FEMALE: + CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); + CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); + TVShowConvertInternationalString(gStringVar3, show->trendWatcher.playerName, show->trendWatcher.language); + sTVShowState = TRENDWATCHER_STATE_PHRASE_HOPELESS; + break; + case TRENDWATCHER_STATE_PHRASE_HOPELESS: + CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); + CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); + if (show->trendWatcher.gender == MALE) + sTVShowState = TRENDWATCHER_STATE_BIGGER_MALE; + else + sTVShowState = TRENDWATCHER_STATE_BIGGER_FEMALE; + break; + case TRENDWATCHER_STATE_BIGGER_MALE: + case TRENDWATCHER_STATE_BIGGER_FEMALE: + CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); + CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); + TVShowConvertInternationalString(gStringVar3, show->trendWatcher.playerName, show->trendWatcher.language); + sTVShowState = TRENDWATCHER_STATE_OUTRO; + break; + case TRENDWATCHER_STATE_OUTRO: + CopyEasyChatWord(gStringVar1, show->trendWatcher.words[0]); + CopyEasyChatWord(gStringVar2, show->trendWatcher.words[1]); + TVShowDone(); } ShowFieldMessage(sTVDewfordTrendWatcherNetworkTextGroup[state]); } diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 9f81a3b3e..767fbe4e7 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -108,7 +108,7 @@ static bool8 CheckFeebas(void) if (Random() % 100 > 49) // 50% chance of encountering Feebas return FALSE; - FeebasSeedRng(gSaveBlock1Ptr->easyChatPairs[0].unk2); + FeebasSeedRng(gSaveBlock1Ptr->dewfordTrends[0].rand); for (i = 0; i != NUM_FEEBAS_SPOTS;) { feebasSpots[i] = FeebasRandom() % 447; |