Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Walk Speed Input Polling #765

Open
wants to merge 9 commits into
base: develop/2.4.0
Choose a base branch
from
8 changes: 8 additions & 0 deletions src/game/mario_actions_moving.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,14 @@ void update_walking_speed(struct MarioState *m) {
// Slow down if moving backwards
m->forwardVel += 1.1f;
} else if (m->forwardVel <= targetSpeed) {

// When starting a walk, make a few checks and set Mario's speed to 8 on the first frame.
// This ensures Mario's speed is set consistently when starting a walk from ACT_IDLE.
if (m->forwardVel <= 8.f && m->prevAction == ACT_IDLE
&& !mario_floor_is_steep(m)) {
m->forwardVel = MIN(m->intendedMag, 8.f); // same fix as melee dashback
}

// If accelerating
m->forwardVel += 1.1f - m->forwardVel / 43.0f;
} else if (m->floor->normal.y >= 0.95f) {
Expand Down