Action: Difference between revisions

411 bytes added ,  26 February 2023
actions can transition within a frame
(actions can transition within a frame)
Line 6: Line 6:
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.


These IDs are divided into seven ranges, called action groups. These roughly categorize the behavior of each action, but are primarily used for organizational purposes in the code.
These IDs are divided into seven ranges, called action groups. These roughly categorize the behavior of each action, but are primarily used for organizational purposes in the code.
{| class="wikitable"
{| class="wikitable"
! Name !! Range start !! Range end !! Number of actions !! Description
! Name !! Range start !! Range end !! Number of actions !! Description
Line 29: Line 28:
| object || 0x180 || 0x1BF || 10 || relating to picking up or releasing objects
| object || 0x180 || 0x1BF || 10 || relating to picking up or releasing objects
|}
|}
The "uninitialized" action with ID 0x000 is not considered to be a part of any group. Despite being a valid action, it overrides much of Mario's behavior and is implemented differently than regular actions.
The "uninitialized" action with ID 0x000 is not considered to be a part of any group. Despite being a valid action, it overrides much of Mario's behavior and is implemented differently than regular actions.


Action groups, while largely used for organization, do sometimes define shared properties of the actions contained in them. For example, the code for dying in quicksand is shared among the stationary, moving, and object action groups, so it is impossible to die from quicksand while in one of the other action groups.
Action groups, while largely used for organization, do sometimes define shared properties of the actions contained in them. For example, the code for dying in quicksand is shared among the stationary, moving, and object action groups, so it is impossible to die from quicksand while in one of the other action groups.
== Action flags ==
== Action flags ==
Most properties of actions are defined by action flags, which make up the remaining bits of the 32-bit action value. While there are 23 bits left after excluding the 9-bit ID, bit 30 is both unused by the game and unset by any action, so there are effectively only 22 action flags.
Most properties of actions are defined by action flags, which make up the remaining bits of the 32-bit action value. While there are 23 bits left after excluding the 9-bit ID, bit 30 is both unused by the game and unset by any action, so there are effectively only 22 action flags.
{| class="wikitable"
{| class="wikitable"
! Bit !! Name !! Example properties
! Bit !! Name !! Example properties
Line 85: Line 80:
| 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 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>
== References ==
== References ==
<references/>
<references/>
{{actions}}
{{actions}}
[[Category:Action Mechanics]]
[[Category:Action Mechanics]]
188

edits