Action/Example
Example | |
Properties | |
Official Name | ((Canon name of action)) |
Hex | 0x???????? |
Action Flags | a, b, c ((Use commas not vertical bars for technical wikisyntax reasons)) |
Action Group | Airborne |
ID | 0x??? |
Transitions | |
Into | ((this action transitions into ??)) |
Out of | ((?? transitions into this action)) |
Other | |
Animation | ((MARIO_ANIM_AMPLE_EX = 0x123 becomes...)) Ample Ex (0x123) |
Related Actions | |
Related | (none) |
Example is an example action that does not actually exist; rather, it is used to explain how the action pages work. This introduction or lead paragraph generally explains intuitively high level what the action is or does.
Other
This example page just explains some standard headings, but other information like RTA advice or overall use is also valuable.
Interactions
Being in an action may affect how Mario interacts with objects. And, interactions can cause Mario to enter an action. Such details are explained in this section.
Entering (example action)
Describes how the action is entered, if explaining all the ways is complicated enough. Usually a single sentence in the lead or just the "Out of" from the infobox (the rectangle of data in the top right) is enough.
Sometimes the action argument is also noted: The action argument is a number that is sent to the action, which allows the action to change behavior based on how it was entered.
For example, Flying starts off with the Fly from cannon animation if it came from a cannon shot. Or it runs the Forward spinning flip animation if it came from a flying triple jump or level spawn.
Usually the action argument is unused, so it won't be mentioned. In such cases the code itself probably just sends 0 as the argument.
Transition In
To understand this section, first know of the action loop (also described at Action#Frame).
Each action has associated code (which will be described in the Behavior section), which can return (i.e. exit) with TRUE or FALSE. The action loop runs Mario's current action (which changes during the loop) until the code for the (final) action returns FALSE.
set_mario_action(action, action argument) sets Mario's action and action argument while also possibily doing side effects, and then returns TRUE. (Two separate topics of note:)
- This section "Transition In" describes these very side effects of set_mario_action, which happen right when the action is set, before any cancels or behavior can happen.
- An action can return set_mario_action, and since set_mario_action results in TRUE, this becomes return TRUE, continuing the action loop. As such the action loop can do an arbitrary amount of actions within a frame, although no infinite loop has been found. If the code does just set_mario_action by itself (not returning) then it simply changes the action, with the possibility of doing more code overriding to a different action instead (often a bug), or just returning FALSE which ends the action loop, leaving the other action to be run in the next frame.
To be more specific, this section "Transition In" generally describes only the first step of set_mario_action: other steps are shared by all actions:[1]
- set_mario_group_action
- Mario's voice clip played flag is reset, allowing all sound types to be played again.
- Another flag (UNKNOWN_18) is reset as long as the action doesn't have the Air flag.
- The previous action is set to the current action (which is not yet the jump action).
- The current action is set.
- The action argument is set.
- The action state is set to 0.
- The action timer is set to 0.
- Return TRUE
Airborne cancels
But we are not done yet! After Transition In (set_mario_action), the action loop does not actually run the action's code/behavior. Instead, it runs... execute_mario_group_action, which first runs code shared between all actions in the same group, and then runs the behavior code.
So we have set_mario_action, then (if the code returned FALSE, exiting the action loop, then in the next frame object interactions and such can happen before the action loop is entered, and we continue with:) execute_mario_group_action, then behavior. But in practice, execute_mario_group_action is generally used for common group cancels: If certain conditions apply, then we enter a different action and don't run the behavior at all!
This Example action is in the Airborne group as indicated by the infobox. So execute_mario_airborne_action is run. Typically, since these are shared, this section is replaced with a link to another article. So here we include from Jump:
A variety of "cancels" are checked prior to actually performing any airborne action. These are as follows:
- If Mario's height is lower than 100 units below the water height: Water Plunge
- ...
Note that the link is short for "change to this action and continue the action loop":
- If Mario's height is lower than 100 units below the water height: Return set_mario_action(Water Plunge, 0)
If the argument is nonzero or it is not a return, it can be indicated as follows:
- If Mario's height is lower than 100 units below the water height: Water Plunge (argument 1) (no exit!)
Behavior
Finally, we have the actual behavior, the references, and the {{actions}} template.
- If Mario is below y = 10, set y to 1000
perform_air_step(m, 1)
- Triple Jump
Gravity
When doing perform_air_step
, different actions have different gravity. For example:
Falling speed accelerates by 3.14, with minimum y = -75