follower attaches to riding player
This commit is contained in:
parent
529709b5ec
commit
8f5bef1ec5
@ -117,4 +117,6 @@
|
||||
#define DIR_NORTHWEST 7
|
||||
#define DIR_NORTHEAST 8
|
||||
|
||||
#define FOLLOW_ME_IMPLEMENTED FALSE
|
||||
|
||||
#endif // GUARD_CONSTANTS_GLOBAL_H
|
||||
|
||||
@ -245,6 +245,10 @@ static bool8 RockClimb_WaitStopRockClimb(struct Task *task, struct ObjectEvent *
|
||||
static bool8 RockClimb_StopRockClimbInit(struct Task *task, struct ObjectEvent *objectEvent);
|
||||
// Static RAM declarations
|
||||
|
||||
#if FOLLOW_ME_IMPLEMENTED
|
||||
static void TryAttachFollowerToPlayer(void);
|
||||
#endif
|
||||
|
||||
static u8 sActiveList[32];
|
||||
|
||||
// External declarations
|
||||
@ -1882,6 +1886,10 @@ static bool8 WaterfallFieldEffect_ContinueRideOrEnd(struct Task *task, struct Ob
|
||||
{
|
||||
if (!ObjectEventClearHeldMovementIfFinished(objectEvent))
|
||||
return FALSE;
|
||||
|
||||
#if FOLLOW_ME_IMPLEMENTED
|
||||
TryAttachFollowerToPlayer();
|
||||
#endif
|
||||
|
||||
if (MetatileBehavior_IsWaterfall(objectEvent->currentMetatileBehavior))
|
||||
{
|
||||
@ -4085,6 +4093,10 @@ static bool8 RockClimb_ContinueRideOrEnd(struct Task *task, struct ObjectEvent *
|
||||
if (!ObjectEventClearHeldMovementIfFinished(objectEvent))
|
||||
return FALSE;
|
||||
|
||||
#if FOLLOW_ME_IMPLEMENTED
|
||||
TryAttachFollowerToPlayer();
|
||||
#endif
|
||||
|
||||
PlayerGetDestCoords(&task->tDestX, &task->tDestY);
|
||||
MoveCoords(objectEvent->movementDirection, &task->tDestX, &task->tDestY);
|
||||
if (MetatileBehavior_IsRockClimbable(MapGridGetMetatileBehaviorAt(task->tDestX, task->tDestY)))
|
||||
@ -4140,6 +4152,19 @@ bool8 IsRockClimbActive(void)
|
||||
}
|
||||
|
||||
|
||||
#if FOLLOW_ME_IMPLEMENTED
|
||||
static void TryAttachFollowerToPlayer(void)
|
||||
{
|
||||
if (gFollowerState.inProgress)
|
||||
{
|
||||
//Keep the follow close by while its hidden to prevent it from going too far out of view
|
||||
struct ObjectEvent* player = &gObjectEvents[gPlayerAvatar.eventObjectId];
|
||||
struct ObjectEvent* follower = &gObjectEvents[GetFollowerMapObjId()];
|
||||
MoveObjectEventToMapCoords(follower, player->currentCoords.x, player->currentCoords.y);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef tState
|
||||
#undef tDestX
|
||||
#undef tDestY
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user