From 65515f58a6ab64676d34c116656a0ede669b3ba0 Mon Sep 17 00:00:00 2001 From: Ariel Antonitis Date: Wed, 24 Jun 2020 20:28:54 -0400 Subject: [PATCH] Added additional follower messages. --- data/scripts/follower.inc | 61 +++++++++++++++++++++++++++++++------ include/event_scripts.h | 5 +++ src/event_object_movement.c | 30 ++++++++++++++++-- 3 files changed, 83 insertions(+), 13 deletions(-) diff --git a/data/scripts/follower.inc b/data/scripts/follower.inc index 8779831122..f071ed93be 100644 --- a/data/scripts/follower.inc +++ b/data/scripts/follower.inc @@ -16,6 +16,18 @@ gText_FollowerSplashesAround:: gText_WantsToFly:: .string "{STR_VAR_1} looks up at the\nsky restlessly.\pWould you like to use FLY?$" +gText_FollowerUnhappyFace:: + .string "{STR_VAR_1} is making an unhappy face...$" + +gText_FollowerHappyRain:: + .string "{STR_VAR_1} seems to be happy\nabout the rain!$" + +gText_FollowerMetLocation:: + .string "{STR_VAR_1} is looking around fondly.\pIt seems familiar with this place.$" + +gText_FollowerSkeptical:: + .string "{STR_VAR_1} gives you a skeptical look...\pWhat could it mean?$" + .macro playfirstmoncry callfunc ScrFunc_playfirstmoncry .endm @@ -25,7 +37,6 @@ callfunc ScrFunc_bufferlivemonspeciesname .byte \out .endm - EventScript_Follower:: lock faceplayer @@ -45,6 +56,36 @@ EventScript_FollowerEnd:: release end +EventScript_FollowerSkeptical:: + bufferlivemonspeciesname 0 + playfirstmoncry + msgbox gText_FollowerSkeptical, MSGBOX_DEFAULT + waitmoncry + return + +EventScript_FollowerMetLocation:: + bufferlivemonspeciesname 0 + playfirstmoncry + applymovement 0xFE Common_Movement_QuestionMark + waitmoncry + waitmovement 0xFE + msgbox gText_FollowerMetLocation, MSGBOX_DEFAULT + return + +EventScript_FollowerUnhappyFace:: + bufferlivemonspeciesname 0 + playfirstmoncry + msgbox gText_FollowerUnhappyFace, MSGBOX_DEFAULT + waitmoncry + return + +EventScript_FollowerHappyRain:: + bufferlivemonspeciesname 0 + playfirstmoncry + msgbox gText_FollowerHappyRain, MSGBOX_DEFAULT + waitmoncry + return + EventScript_FollowerHasWetFeet:: bufferlivemonspeciesname 0 playfirstmoncry @@ -60,6 +101,15 @@ EventScript_FollowerSplashesAbout:: msgbox gText_FollowerSplashesAround, MSGBOX_DEFAULT return +EventScript_FollowerLovesYou:: + playfirstmoncry + applymovement 0xFE ContestHall_Movement_Heart + waitmovement 0xFE + waitmoncry + bufferlivemonspeciesname 0 + msgbox gText_FollowerLovesYou, MSGBOX_DEFAULT + return + EnterPokeballMovement:: .byte 0x9F @ EnterPokeball step_end @@ -69,12 +119,3 @@ FollowerSplashMovement:: jump_in_place_left_right face_player step_end - -EventScript_FollowerLovesYou:: - playfirstmoncry - applymovement 0xFE ContestHall_Movement_Heart - waitmovement 0xFE - waitmoncry - bufferlivemonspeciesname 0 - msgbox gText_FollowerLovesYou, MSGBOX_DEFAULT - return diff --git a/include/event_scripts.h b/include/event_scripts.h index 5640830293..66b481b922 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -5,6 +5,11 @@ extern const u8 EventScript_Follower[]; extern const u8 EventScript_FollowerHasWetFeet[]; extern const u8 EventScript_FollowerSplashesAbout[]; extern const u8 EventScript_FollowerLovesYou[]; +extern const u8 EventScript_FollowerUnhappyFace[]; +extern const u8 EventScript_FollowerHappyRain[]; +extern const u8 EventScript_FollowerMetLocation[]; +extern const u8 EventScript_FollowerEnd[]; +extern const u8 EventScript_FollowerSkeptical[]; extern const u8 EnterPokeballMovement[]; extern const u8 EventScript_TestSignpostMsg[]; diff --git a/src/event_object_movement.c b/src/event_object_movement.c index b7f02d2d39..a9726ce17e 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1691,21 +1691,29 @@ static bool8 IsFollowerVisible(void) { // Determine whether follower *should* be || MetatileBehavior_IsForcedMovementTile(gObjectEvents[gPlayerAvatar.objectEventId].previousMetatileBehavior)); } +static bool8 SpeciesHasType(u16 species, u8 type) { + return gBaseStats[species].type1 == type || gBaseStats[species].type2 == type; +} + bool8 ScrFunc_getfolloweraction(struct ScriptContext *ctx) // Essentially a big switch for follower messages { u16 value; u16 species; u32 behavior; + u8 friendship; struct ObjectEvent *objEvent = GetFollowerObject(); struct Pokemon *mon = GetFirstLiveMon(); if (mon == NULL) { ScriptCall(ctx, EventScript_FollowerLovesYou); return FALSE; } + if (!Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType)) // only return to flying if map type is relevant + ScriptJump(ctx, EventScript_FollowerEnd); behavior = MapGridGetMetatileBehaviorAt(objEvent->currentCoords.x, objEvent->currentCoords.y); species = GetMonData(mon, MON_DATA_SPECIES); + // Puddle splash or wet feet if (MetatileBehavior_IsPuddle(behavior) || MetatileBehavior_IsShallowFlowingWater(behavior)) { - if (gBaseStats[species].type1 == TYPE_FIRE || gBaseStats[species].type2 == TYPE_FIRE) { + if (SpeciesHasType(species, TYPE_FIRE)) { ScriptCall(ctx, EventScript_FollowerHasWetFeet); return FALSE; } else if (SpeciesToGraphicsInfo(species, 0)->tracks) { // if follower is grounded @@ -1713,10 +1721,26 @@ bool8 ScrFunc_getfolloweraction(struct ScriptContext *ctx) // Essentially a big return FALSE; } } + // Weather-based messages if (GetCurrentWeather() == WEATHER_RAIN || GetCurrentWeather() == WEATHER_RAIN_THUNDERSTORM) { - ScriptCall(ctx, EventScript_FollowerLovesYou); + if (SpeciesHasType(species, TYPE_FIRE)) { + ScriptCall(ctx, EventScript_FollowerUnhappyFace); + return FALSE; + } else if (SpeciesHasType(species, TYPE_WATER) || SpeciesHasType(species, TYPE_GRASS)) { + ScriptCall(ctx, EventScript_FollowerHappyRain); + return FALSE; + } } - ScriptCall(ctx, EventScript_FollowerLovesYou); + // Location-based messages + if (GetMonData(mon, MON_DATA_MET_LOCATION) == GetCurrentRegionMapSectionId()) { + ScriptCall(ctx, EventScript_FollowerMetLocation); + return FALSE; + } + friendship = GetMonData(mon, MON_DATA_FRIENDSHIP); + if (friendship < 25) + ScriptCall(ctx, EventScript_FollowerSkeptical); + else if (friendship == 255) + ScriptCall(ctx, EventScript_FollowerLovesYou); return FALSE; }