diff --git a/data/maps/DewfordTown_Hall/scripts.inc b/data/maps/DewfordTown_Hall/scripts.inc index 971dd23215..9f9a36d993 100644 --- a/data/maps/DewfordTown_Hall/scripts.inc +++ b/data/maps/DewfordTown_Hall/scripts.inc @@ -29,7 +29,7 @@ DewfordTown_Hall_EventScript_Man:: @ 81FD50A lock faceplayer call Common_EventScript_BufferTrendyPhrase - special sub_811EF6C + special BufferDeepLinkPhrase msgbox DewfordTown_Hall_Text_DeepLinkBetweenXAndY, MSGBOX_YESNO compare VAR_RESULT, YES goto_if_eq DewfordTown_Hall_EventScript_ConfirmTrendLink diff --git a/data/scripts/mystery_event_club.inc b/data/scripts/mystery_event_club.inc index 6687bbd476..16e9a657f2 100644 --- a/data/scripts/mystery_event_club.inc +++ b/data/scripts/mystery_event_club.inc @@ -41,7 +41,7 @@ MysteryEventClub_EventScript_CancelShowProfile:: @ 82915CB MysteryEventClub_EventScript_ShowProfile:: @ 82915D5 setvar VAR_0x8004, 0 - special sub_811EECC + special ShowEasyChatProfile waitmessage delay 80 msgbox MysteryEventClub_Text_FantasticProfile, MSGBOX_DEFAULT diff --git a/data/specials.inc b/data/specials.inc index 95a0ac5d37..a001462a0c 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -107,7 +107,7 @@ gSpecials:: @ 81DBA64 def_special SaveGame def_special DoWateringBerryTreeAnim def_special ShowEasyChatScreen - def_special sub_811EECC + def_special ShowEasyChatProfile def_special ScrSpecial_GetCurrentMauvilleMan def_special ScrSpecial_HasBardSongBeenChanged def_special ScrSpecial_SaveBardSongLyrics @@ -139,7 +139,7 @@ gSpecials:: @ 81DBA64 def_special IsMonOTIDNotPlayers def_special BufferTrendyPhraseString def_special TrendyPhraseIsOld - def_special sub_811EF6C + def_special BufferDeepLinkPhrase def_special GetDewfordHallPaintingNameIndex def_special SwapRegisteredBike def_special CalculatePlayerPartyCount diff --git a/include/easy_chat.h b/include/easy_chat.h index 221cbd1da4..f2ef066d42 100644 --- a/include/easy_chat.h +++ b/include/easy_chat.h @@ -128,10 +128,10 @@ bool32 sub_811F8D8(int word); void InitializeEasyChatWordArray(u16 *words, u16 length); u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows); bool8 ECWord_CheckIfOutsideOfValidRange(u16 word); -u16 sub_811EE38(u16 group); +u16 GetRandomEasyChatWordFromGroup(u16 group); u16 GetNewHipsterPhraseToTeach(void); u16 EasyChat_GetNumWordsInGroup(u8); -u16 sub_811EE90(u16); +u16 GetRandomEasyChatWordFromUnlockedGroup(u16); void DoEasyChatScreen(u8 type, u16 *words, MainCallback callback, u8 displayedPersonType); void sub_811F8BC(void); void UnlockAdditionalPhrase(u8 additionalPhraseId); diff --git a/src/dewford_trend.c b/src/dewford_trend.c index 57a97d8f3c..9c5e69d993 100644 --- a/src/dewford_trend.c +++ b/src/dewford_trend.c @@ -25,12 +25,12 @@ void InitDewfordTrend(void) for (i = 0; i < 5; i++) { - gSaveBlock1Ptr->easyChatPairs[i].words[0] = sub_811EE38(EC_GROUP_CONDITIONS); + gSaveBlock1Ptr->easyChatPairs[i].words[0] = GetRandomEasyChatWordFromGroup(EC_GROUP_CONDITIONS); if (Random() & 1) - gSaveBlock1Ptr->easyChatPairs[i].words[1] = sub_811EE38(EC_GROUP_LIFESTYLE); + gSaveBlock1Ptr->easyChatPairs[i].words[1] = GetRandomEasyChatWordFromGroup(EC_GROUP_LIFESTYLE); else - gSaveBlock1Ptr->easyChatPairs[i].words[1] = sub_811EE38(EC_GROUP_HOBBIES); + gSaveBlock1Ptr->easyChatPairs[i].words[1] = GetRandomEasyChatWordFromGroup(EC_GROUP_HOBBIES); gSaveBlock1Ptr->easyChatPairs[i].unk1_6 = Random() & 1; sub_8122B28(&(gSaveBlock1Ptr->easyChatPairs[i])); diff --git a/src/easy_chat.c b/src/easy_chat.c index 6bb1d9c862..86349cbd61 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -222,7 +222,7 @@ static void sub_811E1A4(s8, s8); static void sub_811E2DC(struct Sprite *); static void sub_811E34C(u8, u8); static bool8 EasyChatIsNationalPokedexEnabled(void); -static u16 sub_811F108(void); +static u16 GetRandomUnlockedEasyChatPokemon(void); static void sub_811F2D4(void); static void sub_811F46C(void); static u8 *CopyEasyChatWordPadded(u8 *, u16, u16); @@ -5039,24 +5039,24 @@ static u16 GetEasyChatWordStringLength(u16 easyChatWord) } } -bool8 sub_811EDC4(const u16 *easyChatWords, u8 arg1, u8 arg2, u16 arg3) +static bool8 CanPhraseFitInXRowsYCols(const u16 *easyChatWords, u8 numRows, u8 numColumns, u16 maxLength) { u8 i, j; - for (i = 0; i < arg2; i++) + for (i = 0; i < numColumns; i++) { - u16 totalLength = arg1 - 1; - for (j = 0; j < arg1; j++) + u16 totalLength = numRows - 1; + for (j = 0; j < numRows; j++) totalLength += GetEasyChatWordStringLength(*(easyChatWords++)); - if (totalLength > arg3) + if (totalLength > maxLength) return TRUE; } return FALSE; } -u16 sub_811EE38(u16 groupId) +u16 GetRandomEasyChatWordFromGroup(u16 groupId) { u16 index = Random() % gEasyChatGroups[groupId].numWords; if (groupId == EC_GROUP_POKEMON @@ -5070,18 +5070,18 @@ u16 sub_811EE38(u16 groupId) return EC_WORD(groupId, index); } -u16 sub_811EE90(u16 groupId) +u16 GetRandomEasyChatWordFromUnlockedGroup(u16 groupId) { if (!IsEasyChatGroupUnlocked(groupId)) return 0xFFFF; if (groupId == EC_GROUP_POKEMON) - return sub_811F108(); + return GetRandomUnlockedEasyChatPokemon(); - return sub_811EE38(groupId); + return GetRandomEasyChatWordFromGroup(groupId); } -void sub_811EECC(void) +void ShowEasyChatProfile(void) { u16 *easyChatWords; int columns, rows; @@ -5094,7 +5094,7 @@ void sub_811EECC(void) break; case 1: easyChatWords = gSaveBlock1Ptr->easyChatBattleStart; - if (sub_811EDC4(gSaveBlock1Ptr->easyChatBattleStart, 3, 2, 18)) + if (CanPhraseFitInXRowsYCols(gSaveBlock1Ptr->easyChatBattleStart, 3, 2, 18)) { columns = 2; rows = 3; @@ -5123,10 +5123,11 @@ void sub_811EECC(void) ShowFieldAutoScrollMessage(gStringVar4); } -void sub_811EF6C(void) +// The phrase that a man in Dewford Hall suggests has a "deep link" to the current trendy phrase +void BufferDeepLinkPhrase(void) { int groupId = Random() & 1 ? EC_GROUP_HOBBIES : EC_GROUP_LIFESTYLE; - u16 easyChatWord = sub_811EE90(groupId); + u16 easyChatWord = GetRandomEasyChatWordFromUnlockedGroup(groupId); CopyEasyChatWord(gStringVar2, easyChatWord); } @@ -5217,7 +5218,7 @@ static bool8 EasyChatIsNationalPokedexEnabled(void) return IsNationalPokedexEnabled(); } -static u16 sub_811F108(void) +static u16 GetRandomUnlockedEasyChatPokemon(void) { u16 i; u16 numWords; diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index add48efd86..8fe233fc1c 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -360,7 +360,7 @@ static void InitGiddyTaleList(void) break; if (r1 == 6) r1 = 0; - giddy->randomWords[i] = sub_811EE90(arr[r1][0]); + giddy->randomWords[i] = GetRandomEasyChatWordFromUnlockedGroup(arr[r1][0]); } } }