Action: Difference between revisions

Jump to navigation Jump to search
1,246 bytes added ,  26 February 2023
Describe what happens when execute_mario_action is done as a sanity check for the Idle page
(actions can transition within a frame)
(Describe what happens when execute_mario_action is done as a sanity check for the Idle page)
Line 5: Line 5:


If Mario's current action is hacked to be an invalid action value, the game will either freeze or softlock, since such an action lacks associated code. There are 230 valid actions in the game, but some of these are accessible only through hacking. In addition to these, there are two "pseudo-actions", 0x050 and 0x051, that immediately transition to another action. Specifically, they are "begin sliding" actions, and they transition into either butt slide or stomach slide, depending on whether Mario is facing uphill or downhill. There is evidence of one action, action 0x00E, that was defined but whose code was never implemented.
If Mario's current action is hacked to be an invalid action value, the game will either freeze or softlock, since such an action lacks associated code. There are 230 valid actions in the game, but some of these are accessible only through hacking. In addition to these, there are two "pseudo-actions", 0x050 and 0x051, that immediately transition to another action. Specifically, they are "begin sliding" actions, and they transition into either butt slide or stomach slide, depending on whether Mario is facing uphill or downhill. There is evidence of one action, action 0x00E, that was defined but whose code was never implemented.
Actions can transition to other actions within a frame. Whenever an action changes to another through returning a call to <code>set_mario_action</code>, it returns `TRUE` which continues a loop. Theoretically, this could cause an infinite loop, however such a transition sequence has not been found.<ref>https://github.com/n64decomp/sm64/blob/66018e9f3caaa67399218971d61366cb3f7ba7d7/src/game/mario.c#L1717-L1747</ref>
== Action groups ==
== Action groups ==
An action is represented as a 32-bit value. The lowest nine bits are a unique ID for the action, ranging in value from 0x000 to 0x192. Not all action IDs in this range are used by an action.
An action is represented as a 32-bit value. The lowest nine bits are a unique ID for the action, ranging in value from 0x000 to 0x192. Not all action IDs in this range are used by an action.
Line 40: Line 38:
| 10 || moving || affects buoyancy in water, push speed of horizontal wind
| 10 || moving || affects buoyancy in water, push speed of horizontal wind
|-
|-
| 11 || airborne || allows stomping on enemies, affects knockback behavior, disallows lava boost
| 11 || airborne || allows stomping on enemies, affects knockback behavior, disallows [[Lava Boost|lava boost]]
|-
|-
| 12 || intangible || disallows object interaction
| 12 || intangible || disallows object interaction
Line 80: Line 78:
| 31 || throwing || something to do with particle effects; details not yet known
| 31 || throwing || something to do with particle effects; details not yet known
|}
|}
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 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 ==
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.
# 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.
# If Mario's floor type is a warp, check warps.
# 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 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.
## Damage if not wearing metal cap, and set action to [[Lava Boost]].
# <code>mario_process_interactions</code>
# '''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.
 
== References ==
== References ==
<references/>
<references/>
{{actions}}
{{actions}}
[[Category:Action Mechanics]]
[[Category:Action Mechanics]]
188

edits

Navigation menu