Action: Difference between revisions

→‎Frame: add OOB step
(Expand on interactions)
(→‎Frame: add OOB step)
 
Line 80: Line 80:
Note that the first three flags have the same name as the first three action groups. While most actions in these groups have the corresponding flag set, the converse is typically not true. Actions in the cutscene group, for example, may have the airborne flag set if they take place while Mario is in the air. There also exist unintuitive cases, such as action 0x036, [[Air Throw Land|air throw landing]], which has the airborne flag set despite being a grounded stationary action, leading to strange behavior in some circumstances.<ref>[https://www.youtube.com/watch?v=c8iD58RQ1nw "Air Throw Landing (Commentated)" by bad_boot]</ref>
Note that the first three flags have the same name as the first three action groups. While most actions in these groups have the corresponding flag set, the converse is typically not true. Actions in the cutscene group, for example, may have the airborne flag set if they take place while Mario is in the air. There also exist unintuitive cases, such as action 0x036, [[Air Throw Land|air throw landing]], which has the airborne flag set despite being a grounded stationary action, leading to strange behavior in some circumstances.<ref>[https://www.youtube.com/watch?v=c8iD58RQ1nw "Air Throw Landing (Commentated)" by bad_boot]</ref>
== Frame ==
== Frame ==
Whenever within a frame, <code>execute_mario_action</code> is called, and Mario's action is not "uninitialized", the following happens:
Whenever within a frame, <code>execute_mario_action</code> is called, and Mario's action is not uninitialized (i.e. 0), the following happens:
# Reset Mario's model. The model animation will be updated within the action.
# '''Reset Mario's model'''. The model animation will be updated within the action.
# Why is so <code>update_mario_inputs</code> so complicated? Not even going into that.
# Why is so <code>update_mario_inputs</code> so complicated? Not even going into that.
# If Mario's floor type is the death plane or... vertical wind, check warps, play SOUND_MARIO_WAAAOOOW.
# '''Special floors:'''
# If Mario's floor type is a warp, check warps.
## If Mario's floor type is the death plane or... vertical wind, check warps, play SOUND_MARIO_WAAAOOOW.
# If Mario's floor type is the [[The Princess's Secret Slide|PSS]] start or end tiles, start or end the timer.
## If Mario's floor type is a warp, check warps.
# If Mario's action does not have the (11) air or (13) swimming flags, the floor is SURFACE_BURNING (lava?), and Mario is not riding a shell and mario's is less than 10 units above the floor.
## If Mario's floor type is the [[The Princess's Secret Slide|PSS]] start or end tiles, start or end the timer.
## Damage if not wearing metal cap, and set action to [[Lava Boost]].
## If Mario's action does not have the (11) air or (13) swimming flags, the floor is SURFACE_BURNING (lava?), and Mario is not riding a shell and mario's is less than 10 units above the floor.
# <code>mario_process_interactions</code> '''This can change mario's action'''.
### Damage if not wearing metal cap, and set action to [[Lava Boost]].
#If Mario's floor type is null ('''OOB'''), exit.
# <code>mario_process_interactions</code> ('''Interact with objects'''). '''This can change mario's action'''.
## First, loop over every object's interaction handlers.
## First, loop over every object's interaction handlers.
### If the interactType of the handler is one of the types Mario can currently collide with...
### If the interactType of the handler is one of the types Mario can currently collide with...
Line 99: Line 101:
## If (not interacting with warp) sJustTeleported = FALSE
## If (not interacting with warp) sJustTeleported = FALSE
# '''Loop: Call the function that executes Mario's current action'''. Each action has associated code as stated above. Whenever the function is called, it can return <code>TRUE</code>, continuing the loop. Actions often call <code>set_mario_action</code>, which returns TRUE and processes yet another action. Theoretically, this could cause an infinite loop, however such a subframe transition sequence has not been found.<ref>https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/mario.c#L1717-L1747</ref>
# '''Loop: Call the function that executes Mario's current action'''. Each action has associated code as stated above. Whenever the function is called, it can return <code>TRUE</code>, continuing the loop. Actions often call <code>set_mario_action</code>, which returns TRUE and processes yet another action. Theoretically, this could cause an infinite loop, however such a subframe transition sequence has not been found.<ref>https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/mario.c#L1717-L1747</ref>
# Adjust Mario's model for quicksand and squishing, adjust the camera, when submerged adjust the camera and spawn bubbles, update health, update cap hitbox and model, process wind and infinite stairs music.
## To be more accurate, each action ''group'' has a function. That function is called. That group-action function may do behaviour shared across all actions of the group before calling the action function.
# '''Update Mario's model''' for quicksand and squishing, adjust the '''camera''', when submerged adjust the camera and spawn '''bubbles''', update '''health''', update '''cap''' hitbox and model, process wind and infinite stairs '''music'''.
# Set <code>oInteractionStatus</code> to 0.
# Set <code>oInteractionStatus</code> to 0.
<code>execute_mario_action</code> is only called by <code>bhv_mario_update</code>, which after all of this is also responsible for spawning particles.<ref>https://github.com/n64decomp/sm64/blob/master/src/game/object_list_processor.c#L267</ref>
== References ==
== References ==
<references/>
<references/>
{{actions}}
{{actions}}
[[Category:Action Mechanics]]
[[Category:Action Mechanics]]
192

edits