From 8ba99b09d78b5b54b1420e8133f613c232415b80 Mon Sep 17 00:00:00 2001 From: FosterProgramming Date: Sat, 22 Nov 2025 07:11:22 +0100 Subject: [PATCH] Fix game freeze when trainers try to walk on sideway stairs (#8316) --- src/trainer_see.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/trainer_see.c b/src/trainer_see.c index 348ec14c2d..4ac9c513b2 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -522,6 +522,9 @@ static u8 GetTrainerApproachDistance(struct ObjectEvent *trainerObj) PlayerGetDestCoords(&x, &y); if (trainerObj->trainerType == TRAINER_TYPE_NORMAL) // can only see in one direction { + // Disable trainer approach while moving diagonally (usually moving on sideway stairs) + if (trainerObj->facingDirection > DIR_EAST) + return 0; approachDistance = sDirectionalApproachDistanceFuncs[trainerObj->facingDirection - 1](trainerObj, trainerObj->trainerRange_berryTreeId, x, y); return CheckPathBetweenTrainerAndPlayer(trainerObj, approachDistance, trainerObj->facingDirection); }