Movement steps: Difference between revisions

(add stationary step)
(→‎Quarter-Frame Checks: forgot "color:")
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:


Steps are also responsible for detecting collision with [[surfaces]], updating Mario's [[referenced surfaces]], and updating Mario's [[Water|water level]]. However, quarter steps don't detect object collisions or warps.
Steps are also responsible for detecting collision with [[surfaces]], updating Mario's [[referenced surfaces]], and updating Mario's [[Water|water level]]. However, quarter steps don't detect object collisions or warps.
== Stationary Step ==
== Stationary Step ==
https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/mario_step.c#L236
https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/mario_step.c#L236
# Mario's x and z forward velocity and sliding velocity is set to 0
# Mario's x and z forward velocity and sliding velocity is set to 0
# mario_update_moving_sand
# mario_update_moving_sand
Line 11: Line 9:
# If updated by moving sand or windy ground, return perform_ground_step
# If updated by moving sand or windy ground, return perform_ground_step
# Else, set Mario's y position to the floor, (possibly causing a [[downwarp]]), and update graphics. Return GROUND_STEP_NONE.
# Else, set Mario's y position to the floor, (possibly causing a [[downwarp]]), and update graphics. Return GROUND_STEP_NONE.
 
Also see [[Idle#stationary ground step]]
== Air Step ==
== Air Step ==
''Certain things here are more explained on their individual pages. If something lacks detail, check the link for more information.''
''Certain things here are more explained on their individual pages. If something lacks detail, check the link for more information.''
Line 21: Line 19:
## If the position is above OOB but below Mario's current floor height, Mario's height is changed to the floor height and he '''lands'''.
## If the position is above OOB but below Mario's current floor height, Mario's height is changed to the floor height and he '''lands'''.
## If the position is above OOB but not below Mario's current floor height, Mario's height is set to the new height and he '''hits a wall'''.
## If the position is above OOB but not below Mario's current floor height, Mario's height is set to the new height and he '''hits a wall'''.
## If the action has the "riding shell" flag and the water level at the position is above the position's floor (up to 78 units above the position):
## If the action has the <span style="color:green;">"riding shell" flag</span> and the water level at the position is above the position's floor (up to 78 units above the position):
##* The floor height from here on is the water height.
##* The floor height from here on is the water height.
##* The floor from this point on is a "fake" floor on the surface of the water.
##* The floor from this point on is a "fake" floor on the surface of the water.
Line 35: Line 33:
## If the position's height is 160 units under, at, or above a ceiling and his vertical velocity is positive or zero:
## If the position's height is 160 units under, at, or above a ceiling and his vertical velocity is positive or zero:
##* Mario's vertical velocity is set to zero.
##* Mario's vertical velocity is set to zero.
##* If the ceiling above Mario is hangable and the air step has the "check hang" flag, Mario '''hangs'''. (Since this did not use the new position's ceiling/location, this is potentially a [[Hangable Ceiling Upwarp|hangable-ceiling upwarp.]])
##* If the ceiling above Mario is hangable and the air step has the <span style="color:green;">"check hang" flag</span>, Mario '''hangs'''. (Since this did not use the new position's ceiling/location, this is potentially a [[Hangable Ceiling Upwarp|hangable-ceiling upwarp.]])
##* Otherwise, '''nothing happens'''.
##* Otherwise, '''nothing happens'''.
## If the position's height is 160 units under, at, or above a ceiling and his vertical velocity is negative:
## If the position's height is 160 units under, at, or above a ceiling and his vertical velocity is negative:
##* If the position's height is at or below Mario's floor height, Mario's height is set to the floor height, and he '''lands'''.
##* If the position's height is at or below Mario's floor height, Mario's height is set to the floor height, and he '''lands'''.
##* Otherwise, Mario's height is set to the new height and he '''hits a wall'''.
##* Otherwise, Mario's height is set to the new height and he '''hits a wall'''.
## If there is a wall 30 units above the position but not 150 units above the position and the air step has the "check ledge grab" flag:
## If there is a wall 30 units above the position but not 150 units above the position and the air step has the <span style="color:green;">"check ledge grab" flag</span>:
##* If Mario's velocity is positive, Mario is pushed by the wall opposite the velocity direction, and there is a floor 60 units behind the wall within 238 units upward, Mario '''ledge grabs'''. (Potentially a [[GLG]])
##* If Mario's velocity is positive, Mario is pushed by the wall opposite the velocity direction, and there is a floor 60 units behind the wall within 238 units upward, Mario '''ledge grabs'''. (Potentially a [[GLG]])
##* Otherwise Mario's position is set to the new position, his floor and floor height are updated, and '''nothing happens'''.
##* Otherwise Mario's position is set to the new position, his floor and floor height are updated, and '''nothing happens'''.
Line 49: Line 47:
# This repeats until Mario encounters something besides '''nothing happens''', up to four times including the initial time.
# This repeats until Mario encounters something besides '''nothing happens''', up to four times including the initial time.
# Mario tracks his "exit", with '''nothing happens''' being tracked if the whole process completed four times.
# Mario tracks his "exit", with '''nothing happens''' being tracked if the whole process completed four times.
With the outcome selected and the movement mostly done, a series of things happen.
 
* If Mario's velocity is not negative, his "peak height" is updated.
=== Perform Air Step ===
* Mario's step noise is updated based on his floor.
 
* If Mario is not flying, [[Gravity#Mario|gravity]] is applied.
# Set Mario's wall to null
* [[Vertical Wind|Vertical wind]] is now applied/accounted for.
# (this is a loop) Do 4 times:
* Mario's visual position is updated to Mario's position.
## Let the next intended position be Mario's position plus velocity/4
* Mario's yaw is updated to match the in-game angle.
## Perform an air quarter step, where "new position" means "next intended position" btw, as shown above
## If nothing happens, continue loop, else exit loop
# Let stepResult be the result of the last air quarter step performed
# If Mario's y velocity is positive, set peak height to Mario's y position (the peak height field is used for things like fall damage)
# Mario's step noise is updated based on his floor.
# If Mario is not flying, [[Gravity#Mario|gravity]] is applied.
#[[Vertical Wind|Vertical wind]] is now applied/accounted for.
# Mario's visual position is updated to Mario's position.
# Mario's yaw is updated to match the in-game angle.
# Return stepResult
 
=== Common Air Step Results ===
=== Common Air Step Results ===
If doing a common air step, Mario now decides what to do based off the "exit" from the quarter-frame checks before. Here is what he does for each exit:
If doing a common air step, Mario now decides what to do based off the "exit" from Perform Air Step. Here is what he does for each exit:
* '''Nothing Happens''':
* '''Nothing Happens''':
** Mario's animation is now applied.
** Mario's animation is now applied.
188

edits