Walking: Difference between revisions

1,923 bytes added ,  12 August 2023
finish todo
(correct grammar)
(finish todo)
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
|group= Moving
|group= Moving
|id= todo
|id= todo
|into=
|into=common moving cancels: [[Water Plunge]], [[Shockwave Bounce]], [[Squished]], [[Standing Death]], [[Quicksand Death]], non-cancel: [[Begin Sliding]], [[Standing against Wall]], [[Breaking]], [[Decelerating]], (jumps: [[Hold Quicksand Jump Land]], [[Quicksand Jump Land]], [[Steep Jump]], [[Jump]], [[Doube Jump]], [[Flying Triple Jump]], [[Triple Jump]]), [[Dive]], [[Move Punching]], [[Turning Around]], [[Crouch Slide]], [[Freefall]], [[Ledge Climb Down]]
|out of=
|out of=
|animation=
|animation=
|related=
|related=
}}
}}
[[File:Walking.svg|alt=A velocity/time graph of Mario's speed during the first 45 frames (1.5 seconds) of walking|thumb|Mario's speed during the first 45 frames (1.5 seconds) of walking. Note that this depends on the slope of the surface being walked on.]]
[[File:Walking.svg|alt=A velocity/time graph of Mario's speed during the first 45 frames (1.5 seconds) of walking|thumb|Mario's speed during the first 45 frames (1.5 seconds) of walking. Note that this depends on the floor's slope (see [[De facto speed]]).]]
The '''walking''' action occurs when Mario is moving only by using the analog stick. It can also occur when exiting water (except if exiting water through a [[water jump]]).
The '''walking''' action occurs when Mario is moving only by using the analog stick. It can also occur when exiting water (except if exiting water through a [[water jump]]).
== Common moving cancels ==
All actions in the "moving" group check the following cancels before running any behavior script:
# If Mario's y position is lower than 100 units below the water level, do stuff, [[Water Plunge]]
# If Mario's current action does not have the "invulnerable" flag, and input_stomped, dropheldobject stopridingobject [[Shockwave Bounce]]
# If input_squished, dropheldobject stopridingobject [[Squished]]
# If Mario's current action does not have the "invulnerable" flag, and health < 0x100, dropheldobject stopridingobject [[Standing Death]]
# [[Idle#quicksand death|Potentially cancel into Quicksand Death]] (sinkingSpeed = 0.25)
== Set jump from landing ==
# If quicksand depth > 11, if Mario is holding an object, [[Hold Quicksand Jump Land]] else [[Quicksand Jump Land]]
# If on steep floor, update forwardVelocity and facing direction, [[Steep Jump]]
# Else:
## If double jump timer is 0, or squish timer is not 0, [[Jump]]
## Else if the previous action is:
### [[Jump Land]], [[Freefall Land]], or [[Side Flip Land Stop]]: [[Double Jump]]
### [[Double Jump Land]]; then
#### if has wing cap: [[Flying Triple Jump]]
#### if forward velocity > 20: [[Triple Jump]]
#### [[Jump]]
### else: [[Jump]]
# Set double jump timer to 0
== Behavior ==
When walking<ref>https://github.com/n64decomp/sm64/blob/master/src/game/mario_actions_moving.c#L777</ref>:
When walking<ref>https://github.com/n64decomp/sm64/blob/master/src/game/mario_actions_moving.c#L777</ref>:
# mario_drop_held_object
# mario_drop_held_object
Line 22: Line 46:
##if forwardVel >= 16 and m->floor->normal.y >= 0.17364818; [[Braking]]
##if forwardVel >= 16 and m->floor->normal.y >= 0.17364818; [[Braking]]
##else; [[Decelerating]]
##else; [[Decelerating]]
#if INPUT_A_PRESSED; (todo; see ref) <ref>https://github.com/n64decomp/sm64/blob/1372ae1bb7cbedc03df366393188f4f05dcfc422/src/game/mario.c#L1018 set_jump_from_landing</ref>
#if INPUT_A_PRESSED; [[#Set jump from landing]]<ref>https://github.com/n64decomp/sm64/blob/1372ae1bb7cbedc03df366393188f4f05dcfc422/src/game/mario.c#L1018 set_jump_from_landing</ref>
#if INPUT_B_PRESSED;
#if INPUT_B_PRESSED;
##if forwardVel >= 29 and stickMag > 48; yVel=20; [[Dive]]
##if forwardVel >= 29 and stickMag > 48; yVel=20; [[Dive]]
Line 30: Line 54:
#if INPUT_Z_PRESSED; [[Crouch Slide]]
#if INPUT_Z_PRESSED; [[Crouch Slide]]
#update_walking_speed
#update_walking_speed
#case GROUND_STEP_LEFT_GROUND; [[Freefall]]
#switch (perform_ground_step):
#case GROUND_STEP_HIT_WALL; push_or_sidle_wall
##case GROUND_STEP_LEFT_GROUND; [[Freefall]]
##case GROUND_STEP_NONE: if intendedMag - forwardVel > 16, dust
##case GROUND_STEP_HIT_WALL; push_or_sidle_wall
#check_ledge_climb_down (can transition to [[Ledge Climb Down]])
#tilt_body_walking
Here's what update_walking_speed is for convenience:<syntaxhighlight lang="c">
Here's what update_walking_speed is for convenience:<syntaxhighlight lang="c">
void update_walking_speed(struct MarioState *m) {
void update_walking_speed(struct MarioState *m) {
188

edits