Document some easy chat specials

This commit is contained in:
GriffinR 2020-01-08 15:26:14 -05:00 committed by huderlem
parent c27a4778ee
commit e736c2d2fd
7 changed files with 26 additions and 25 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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]));

View File

@ -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;

View File

@ -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]);
}
}
}