From d9f3ce15fbfaba389e8f9504f08a421f15a310e1 Mon Sep 17 00:00:00 2001 From: "Lucas S. Vieira" Date: Tue, 15 Apr 2025 22:40:50 -0300 Subject: [PATCH] Fix a bug where Knuckles could clamber at negative Y position --- src/player.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/player.c b/src/player.c index f0dfe35..640c517 100644 --- a/src/player.c +++ b/src/player.c @@ -356,9 +356,16 @@ _player_update_collision_lr(Player *player) player->ev_climbdrop = linecast(&leveldata, &map128, &map16, anchorx, drop_anchory, dir, radius, CDIR_FLOOR); - player->ev_clamber = linecast(&leveldata, &map128, &map16, - anchorx, clamber_anchory, - dir, radius, CDIR_FLOOR); + + // If the clamber Y anchor is negative, always return the collision + // as true. This prevents the player from climbing over ledges that + // are offscreen + if(clamber_anchory <= 0) player->ev_clamber.collided = 1; + else { + player->ev_clamber = linecast(&leveldata, &map128, &map16, + anchorx, clamber_anchory, + dir, radius, CDIR_FLOOR); + } return; }