From 946edb0901dfb12e31071e829a2d3cec8f58776e Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Sat, 23 Dec 2023 11:37:14 -0500 Subject: [PATCH] Make Mario steps use his hitbox height --- src/game/mario_step.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/game/mario_step.c b/src/game/mario_step.c index 0c5c41d99..b84d9d533 100644 --- a/src/game/mario_step.c +++ b/src/game/mario_step.c @@ -146,7 +146,7 @@ u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) { case SURFACE_DEEP_QUICKSAND: case SURFACE_DEEP_MOVING_QUICKSAND: - if ((m->quicksandDepth += sinkingSpeed) >= 160.0f) { + if ((m->quicksandDepth += sinkingSpeed) >= m->marioObj->hitboxHeight) { update_mario_sound_and_camera(m); return drop_and_set_mario_action(m, ACT_QUICKSAND_DEATH, 0); } @@ -311,7 +311,7 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) { } if (nextPos[1] > floorHeight + 100.0f) { - if (nextPos[1] + 160.0f >= ceilHeight) { + if (nextPos[1] + m->marioObj->hitboxHeight >= ceilHeight) { return GROUND_STEP_HIT_WALL_STOP_QSTEPS; } @@ -321,7 +321,7 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) { return GROUND_STEP_LEFT_GROUND; } - if (floorHeight + 160.0f >= ceilHeight) { + if (floorHeight + m->marioObj->hitboxHeight >= ceilHeight) { return GROUND_STEP_HIT_WALL_STOP_QSTEPS; } @@ -417,11 +417,11 @@ u32 check_ledge_grab(struct MarioState *m, struct Surface *wall, Vec3f intendedP return FALSE; } - //! Since the search for floors starts at y + 160, we will sometimes grab + //! Since the search for floors starts at y + m->marioObj->hitboxHeight (160.0f), we will sometimes grab // a higher ledge than expected (glitchy ledge grab) ledgePos[0] = nextPos[0] - wall->normal.x * 60.0f; ledgePos[2] = nextPos[2] - wall->normal.z * 60.0f; - ledgePos[1] = find_floor(ledgePos[0], nextPos[1] + 160.0f, ledgePos[2], &ledgeFloor); + ledgePos[1] = find_floor(ledgePos[0], nextPos[1] + m->marioObj->hitboxHeight, ledgePos[2], &ledgeFloor); if (!ledgeFloor) { return FALSE; } @@ -497,21 +497,21 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr //! This check uses f32, but findFloor uses short (overflow jumps) if (nextPos[1] <= floorHeight) { - if (ceilHeight - floorHeight > 160.0f) { + if (ceilHeight - floorHeight > m->marioObj->hitboxHeight) { m->pos[0] = nextPos[0]; m->pos[2] = nextPos[2]; m->floor = floor; m->floorHeight = floorHeight; } - //! When ceilHeight - floorHeight <= 160, the step result says that + //! When ceilHeight - floorHeight <= m->marioObj->hitboxHeight (160.0f), the step result says that // Mario landed, but his movement is cancelled and his referenced floor // isn't updated (pedro spots) m->pos[1] = floorHeight; return AIR_STEP_LANDED; } - if (nextPos[1] + 160.0f > ceilHeight) { + if (nextPos[1] + m->marioObj->hitboxHeight > ceilHeight) { if (m->vel[1] >= 0.0f) { m->vel[1] = 0.0f;