Action: Difference between revisions

Jump to navigation Jump to search
40 bytes added ,  26 February 2023
note that Mario can only be in one action at a time, just in case
(Describe what happens when execute_mario_action is done as a sanity check for the Idle page)
(note that Mario can only be in one action at a time, just in case)
Line 1: Line 1:


An '''action''' is a particular state that Mario can be in. [[Long Jump|Long jumping]], [[crouching]], and [[walking]] are examples of actions. Each action has code controlling high-level behavior such as Mario's movement while in the action, as well as transitions to other actions.
An '''action''' is a particular state that Mario can be in. [[Long Jump|Long jumping]], [[crouching]], and [[walking]] are examples of actions. Each action has code controlling high-level behavior such as Mario's movement while in the action, as well as transitions to other actions. Mario can only be in one action at a time.


It is likely the game developers referred to actions as "states", as evidenced by the "STA" label on one of the debug menus. The name "action" was chosen by the community as a less ambiguous alternative.
It is likely the game developers referred to actions as "states", as evidenced by the "STA" label on one of the debug menus. The name "action" was chosen by the community as a less ambiguous alternative.
Line 79: Line 79:
|}
|}
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", 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.
Line 93: Line 91:
# '''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.
# 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.
== References ==
== References ==
<references/>
<references/>
{{actions}}
{{actions}}
[[Category:Action Mechanics]]
[[Category:Action Mechanics]]
188

edits

Navigation menu