From e736c2d2fd7bfb7cbc722a4bdf2e8c7d6bb4376d Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 8 Jan 2020 15:26:14 -0500 Subject: [PATCH] Document some easy chat specials --- data/maps/DewfordTown_Hall/scripts.inc | 2 +- data/scripts/mystery_event_club.inc | 2 +- data/specials.inc | 4 ++-- include/easy_chat.h | 4 ++-- src/dewford_trend.c | 6 ++--- src/easy_chat.c | 31 +++++++++++++------------- src/mauville_old_man.c | 2 +- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/data/maps/DewfordTown_Hall/scripts.inc b/data/maps/DewfordTown_Hall/scripts.inc index 971dd2321..9f9a36d99 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 6687bbd47..16e9a657f 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 95a0ac5d3..a001462a0 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 221cbd1da..f2ef066d4 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 57a97d8f3..9c5e69d99 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 6bb1d9c86..86349cbd6 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 add48efd8..8fe233fc1 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]); } } }