Fixed follower behavior when seen by trainers.

This commit is contained in:
Ariel Antonitis 2020-07-11 04:46:08 -04:00
parent 676261a0e0
commit 9952a47a64
2 changed files with 3 additions and 11 deletions

View file

@ -147,6 +147,7 @@ static void Task_FreezeObjectAndPlayer(u8 taskId)
void FreezeForApproachingTrainers(void)
{
u8 trainerObjectId1, trainerObjectId2, taskId;
struct ObjectEvent *followerObj = GetFollowerObject();
trainerObjectId1 = GetChosenApproachingTrainerObjectEventId(0);
if (gNoOfApproachingTrainers == 2)
@ -184,6 +185,8 @@ void FreezeForApproachingTrainers(void)
gTasks[taskId].tObjectFrozen = TRUE;
}
}
if (followerObj) // Unfreeze follower so it can move behind player
UnfreezeObjectEvent(followerObj);
}
bool8 IsFreezeObjectAndPlayerFinished(void)

View file

@ -462,22 +462,11 @@ static bool8 TrainerSeeIdle(u8 taskId, struct Task *task, struct ObjectEvent *tr
static bool8 TrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
{
u8 direction;
struct ObjectEvent *followerObj = GetFollowerObject();
ObjectEventGetLocalIdAndMap(trainerObj, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON);
direction = GetFaceDirectionMovementAction(trainerObj->facingDirection);
ObjectEventSetHeldMovement(trainerObj, direction);
if (followerObj) {
struct ObjectEvent *playerObj = &gObjectEvents[gPlayerAvatar.objectEventId];
s16 x = playerObj->currentCoords.x;
s16 y = playerObj->currentCoords.y;
// Move back player's location by facing direction
MoveCoords(GetOppositeDirection(playerObj->facingDirection), &x, &y);
direction = GetDirectionToFace(followerObj->previousCoords.x, followerObj->previousCoords.y, x, y);
followerObj->singleMovementActive = FALSE;
ObjectEventSetHeldMovement(followerObj, GetWalkNormalMovementAction(direction));
}
task->tFuncId++;
return TRUE;
}