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
14 changes: 14 additions & 0 deletions src/game/mario_actions_moving.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,19 @@ 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.
// We use m->actionArg here since it's a global variable that gets initalized to 0 elsewhere.
if (m->forwardVel <= 8.f && !m->actionArg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably makes more sense to use actionTimer for this instead of actionArg. actionTimer would need to be incremented somewhere (probably this function) rather than hardset to 1, and would need a conditional to cap it.

This is still a movement change so I'm hesitant to merge this without some sort of define for this, even if it's ultimately not inside a config file. Seems like this isn't even useful for framewalking thanks to the steep slope check, so idk how much benefit this offers anyway (Kaze seems to think it's noticeable though).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WE ARE NOT MAKING THIS A DEFINE!!!!!!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I did say it'd need to be housed outside of the config file...

&& !mario_floor_is_steep(m)) {
if (m->heldObj != NULL) {
m->forwardVel = MIN(m->intendedMag, 4.f); // Half as much when holding object, 5.0 forwardVel on first frame
} else {
m->forwardVel = MIN(m->intendedMag, 8.f); // same fix as melee dashback, 8.9 forwardVel on first frame
}
}

// If accelerating
m->forwardVel += 1.1f - m->forwardVel / 43.0f;
} else if (m->floor->normal.y >= 0.95f) {
Expand Down Expand Up @@ -465,6 +478,7 @@ void update_walking_speed(struct MarioState *m) {
m->faceAngle[1] =
m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
#endif
m->actionArg = 1; // Increment this so speed is only set to 8 on first frame of walking.
apply_slope_accel(m);
}

Expand Down