From 7842a8305a56ca4b0828f8feb5e1aa78e15b8473 Mon Sep 17 00:00:00 2001 From: Ariel A <24759293+aarant@users.noreply.github.com> Date: Sun, 29 Oct 2023 16:39:49 -0400 Subject: [PATCH] Fixed follower elevation/subpriority issues when player crosses elevations. --- src/event_object_movement.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 7c3163b686..615e5ecee7 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -8834,7 +8834,13 @@ static void UpdateObjectEventElevationAndPriority(struct ObjectEvent *objEvent, // keep subspriteMode synced with player's // so that it disappears under bridges when they do sprite->subspriteMode |= gSprites[gPlayerAvatar.spriteId].subspriteMode & SUBSPRITES_IGNORE_PRIORITY; + if (!objEvent->currentElevation) + objEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; } + #else + // if transitioning between elevations, use the player's elevation + if (!objEvent->currentElevation && objEvent->localId == OBJ_EVENT_ID_FOLLOWER) + objEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; #endif sprite->subspriteTableNum = sElevationToSubspriteTableNum[objEvent->previousElevation]; @@ -8888,6 +8894,10 @@ static void ObjectEventUpdateSubpriority(struct ObjectEvent *objEvent, struct Sp if (objEvent->fixedPriority) return; + // If transitioning between elevations, use the player's elevation + if (!objEvent->currentElevation && objEvent->localId == OBJ_EVENT_ID_FOLLOWER) + objEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; + SetObjectSubpriorityByElevation(objEvent->previousElevation, sprite, 1); }