Fixed follower behavior when seen by trainers.

This commit is contained in:
Ariel Antonitis 2020-06-24 21:16:49 -04:00
parent 65515f58a6
commit 92b76a98cb
2 changed files with 13 additions and 1 deletions

View file

@ -97,6 +97,7 @@ struct Pokemon * GetFirstLiveMon(void);
void UpdateFollowingPokemon(void);
void RemoveFollowingPokemon(void);
struct ObjectEvent * GetFollowerObject(void);
u8 GetDirectionToFace(s16, s16, s16, s16);
void TrySpawnObjectEvents(s16, s16);
u8 CreateObjectSprite(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction);
u8 AddPseudoObjectEvent(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority);

View file

@ -462,12 +462,23 @@ 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);
task->tFuncId++; // TRSEE_EXCLAMATION_WAIT
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;
}