From b46a8b16cabff0d0f44e026879b31592100147fc Mon Sep 17 00:00:00 2001 From: Ariel A <24759293+aarant@users.noreply.github.com> Date: Tue, 3 May 2022 23:14:00 -0400 Subject: [PATCH] Added time-of-day related follower messages. --- emotions.txt | 5 ----- follower_emotions.py | 2 +- src/event_object_movement.c | 7 +++---- src/follower_helper.c | 23 ++++++++++++++++++++++- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/emotions.txt b/emotions.txt index 590be93530..39857a7cda 100644 --- a/emotions.txt +++ b/emotions.txt @@ -81,9 +81,7 @@ Your pokemon turned to face the other way, showing a defiant expression. Music (Special): Map feature: {STR_VAR_1} is pulling out the grass. -{STR_VAR_1} is happy to see what's out doors! {STR_VAR_1} is listening intently to the sound of the waves. -Your pokemon is staring spellbound at the night sky! Your pokemon seems to be enjoying sliding around! {STR_VAR_1} is steadily observing the flow of the river. {STR_VAR_1} is noticing the scent of the grass. @@ -95,7 +93,6 @@ Misc: {STR_VAR_1} is playing around in the fallen leaves. {STR_VAR_1} is playing around with a leaf. {STR_VAR_1} is playing around, touching the leaves. -Your pokemon is happily gazing at the beautiful, starry sky! {STR_VAR_1} is rolling around in the grass. {STR_VAR_1} seems to want to return to the lab (after you receive the Mystery egg). Your pokemon is staring at the various items. @@ -106,10 +103,8 @@ Your pokemon is staring at the various items. {STR_VAR_1} swayed around, dancing in a strange manner.(Seems to occur more for Bellsprout)(sprout tower). {STR_VAR_1} swayed and danced around as it pleased (Seems to occur more for Bellsprout)(sprout tower). Your Pokemon is playing around and splashing in the water! (Water's edge). -{STR_VAR_1} is looking up at the sky. {STR_VAR_1} is poking at garbage (Goldenrods underground path). Your pokemon is rolling a screw from a bicycle around. -{STR_VAR_1} is looking up at the sky. {STR_VAR_1} is clawing the grass! {STR_VAR_1} is looking around restlessly at the Forest. {STR_VAR_1} is playfully nibbling at the ground. diff --git a/follower_emotions.py b/follower_emotions.py index 5226348031..ff04b048a0 100644 --- a/follower_emotions.py +++ b/follower_emotions.py @@ -47,4 +47,4 @@ def export_messages(infile, outfile, n=None, indent=0, start=0): if __name__ == '__main__': - export_messages('emotions.txt', 'emotions.h', n=1, start=7) + export_messages('emotions.txt', 'emotions.h', n=4, start=42) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 0750e20e51..b48835117f 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1944,9 +1944,6 @@ bool8 ScrFunc_getfolloweraction(struct ScriptContext *ctx) // Essentially a big emotion_weight[FOLLOWER_EMOTION_LOVE] = 30; } // Conditional messages follow - // Weather-related - if (GetCurrentWeather() == WEATHER_SUNNY_CLOUDS) - cond_emotes[n_choices++] = (struct SpecialEmote) {.emotion=FOLLOWER_EMOTION_HAPPY, .index=31}; // Health & status-related multi = mon->hp * 100 / mon->maxHP; if (multi < 20) { @@ -2027,7 +2024,7 @@ bool8 ScrFunc_getfolloweraction(struct ScriptContext *ctx) // Essentially a big } // Match scripted conditional messages // With 50% chance, try to match scripted conditional messages - for (i = (Random() & 1) ? 28 : 0, j = 1; i < 28; i++) { + for (i = (Random() & 1) ? 30 : 0, j = 1; i < 30; i++) { const struct FollowerMsgInfoExtended *info = &gFollowerConditionalMessages[i]; if (info->stFlags == 1 && species != info->st.species) continue; @@ -2045,6 +2042,8 @@ bool8 ScrFunc_getfolloweraction(struct ScriptContext *ctx) // Essentially a big continue; if (info->wtFlags == 2 && GetCurrentMapMusic() != info->wt.song) continue; + if (info->wtFlags == 3 && (!MapHasNaturalLight(gMapHeader.mapType) || gTimeOfDay != info->wt.timeOfDay || GetCurrentWeather() >= WEATHER_RAIN)) + continue; if (info->nearFlags == 1) { if ((multi2 = FindMetatileBehaviorWithinRange(objEvent->currentCoords.x, objEvent->currentCoords.y, info->near.mb.behavior, info->near.mb.distance))) gSpecialVar_Result = multi2; diff --git a/src/follower_helper.c b/src/follower_helper.c index b477f1d1e9..9b0350e0c8 100644 --- a/src/follower_helper.c +++ b/src/follower_helper.c @@ -2,6 +2,7 @@ #include "data.h" #include "event_scripts.h" #include "follower_helper.h" +#include "overworld.h" #include "constants/battle.h" #include "constants/metatile_behaviors.h" #include "constants/pokemon.h" @@ -65,9 +66,15 @@ static const u8 sCondMsg40[] = _("{STR_VAR_1} is gnawing at the ice."); static const u8 sCondMsg41[] = _("{STR_VAR_1} is touching the ice."); static const u8* const sIceTexts[] = {sCondMsg26, sCondMsg40, sCondMsg41, NULL}; static const u8 sCondMsg42[] = _("{STR_VAR_1}'s burn looks painful!"); +static const u8 sCondMsg43[] = _("{STR_VAR_1} is happy to see what's\noutdoors!"); +static const u8 sCondMsg44[] = _("{STR_VAR_1} is looking up at the\nsky."); +static const u8* const sDayTexts[] = {sCondMsg43, sCondMsg44, NULL}; +static const u8 sCondMsg45[] = _("Your POKéMON is staring spellbound\nat the night sky!"); +static const u8 sCondMsg46[] = _("Your POKéMON is happily gazing at\nthe beautiful, starry sky!"); +static const u8* const sNightTexts[] = {sCondMsg45, sCondMsg46, NULL}; // Note that the size of this array must also be correct in event_object_movement -const struct FollowerMsgInfoExtended gFollowerConditionalMessages[28] = { +const struct FollowerMsgInfoExtended gFollowerConditionalMessages[30] = { { .text = (u8*)sCelebiTexts, .textSpread = 1, @@ -266,4 +273,18 @@ const struct FollowerMsgInfoExtended gFollowerConditionalMessages[28] = { .stFlags 3, // STATUS .emotion = FOLLOWER_EMOTION_SAD, }, + { + .text = (u8*)sDayTexts, + .textSpread = 1, + .wt = {.timeOfDay = TIME_OF_DAY_DAY}, + .wtFlags = 3, // time + .emotion = FOLLOWER_EMOTION_MUSIC, + }, + { + .text = (u8*)sNightTexts, + .textSpread = 1, + .wt = {.timeOfDay = TIME_OF_DAY_NIGHT}, + .wtFlags = 3, // time + .emotion = FOLLOWER_EMOTION_MUSIC, + }, };