diff --git a/src/game/interaction.c b/src/game/interaction.c index 9bced36e..a3bf70e0 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -418,6 +418,8 @@ u32 mario_check_object_grab(struct MarioState *m) { if (facingDYaw >= -0x5555 && facingDYaw <= 0x5555) { m->faceAngle[1] = m->interactObj->oMoveAngleYaw; m->usedObj = m->interactObj; + m->pos[1] = m->floorHeight; + m->vel[1] = 0.0f; result = set_mario_action(m, ACT_PICKING_UP_BOWSER, 0); } } else { diff --git a/src/game/mario_step.c b/src/game/mario_step.c index 028d4962..9b43b9ca 100644 --- a/src/game/mario_step.c +++ b/src/game/mario_step.c @@ -242,8 +242,10 @@ void stop_and_set_height_to_floor(struct MarioState *m) { mario_set_forward_vel(m, 0.0f); m->vel[1] = 0.0f; - //! This is responsible for some downwarps. - m->pos[1] = m->floorHeight; + // HackerSM64 2.1: This check fixes the ledgegrab downwarp after being pushed off a ledge. + if (m->pos[1] <= m->floorHeight + 160.0f) { + m->pos[1] = m->floorHeight; + } vec3f_copy(marioObj->header.gfx.pos, m->pos); vec3s_set(marioObj->header.gfx.angle, 0, m->faceAngle[1], 0); @@ -259,9 +261,10 @@ s32 stationary_ground_step(struct MarioState *m) { if (takeStep) { stepResult = perform_ground_step(m); } else { - //! TODO - This is responsible for many stationary downwarps but is - // important for stuff like catching Bowser in midair, figure out a good way to fix - m->pos[1] = m->floorHeight; + // HackerSM64 2.1: This check prevents the downwarps that plagued stationary actions. + if (m->pos[1] <= m->floorHeight + 160.0f) { + m->pos[1] = m->floorHeight; + } vec3f_copy(marioObj->header.gfx.pos, m->pos); vec3s_set(marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);