Document Interaction.h (68.23%) (#577)

* Document Interaction.h (68.23%)

* Fix caps

* Fix missing bracket

* Make descriptions a little more clear and concise
This commit is contained in:
John S 2024-12-19 22:30:07 -05:00 committed by GitHub
parent e20d704604
commit 8da73663aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 1143 additions and 701 deletions

View file

@ -4279,24 +4279,28 @@ end
--- @param m MarioState --- @param m MarioState
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Determines how Mario interacts with a given object based on his current action, position, and other state variables. Calculates the appropriate interaction type (e.g., punch, kick, ground pound) that should result from Mario's contact with the specified object (`o`). Useful for handling different types of player-object collisions, attacks, and object behaviors
function determine_interaction(m, o) function determine_interaction(m, o)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- @return integer --- @return integer
--- Checks if Mario is currently wearing his normal cap on his head. Returns true if Mario's flag state matches that of having the normal cap equipped on his head, otherwise false. Useful for determining Mario's cap status
function does_mario_have_normal_cap_on_head(m) function does_mario_have_normal_cap_on_head(m)
-- ... -- ...
end end
--- @param door Object --- @param door Object
--- @return integer --- @return integer
--- Retrieves the save file flag associated with a door, based on the number of stars required to open it. Used to check if the player has unlocked certain star doors or progressed far enough to access new areas
function get_door_save_file_flag(door) function get_door_save_file_flag(door)
-- ... -- ...
end end
--- @param capObject Object --- @param capObject Object
--- @return integer --- @return integer
--- Determines the type of cap an object represents. Depending on the object's behavior, it returns a cap type (normal, metal, wing, vanish). Useful for handling the logic of picking up, wearing, or losing different kinds of caps
function get_mario_cap_flag(capObject) function get_mario_cap_flag(capObject)
-- ... -- ...
end end
@ -4305,6 +4309,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles Mario's interaction with the Boo's Big Haunt (BBH) entrance object. When Mario tries to enter the BBH area, this function determines the resulting action (e.g., a jump or spin entrance)
function interact_bbh_entrance(m, interactType, o) function interact_bbh_entrance(m, interactType, o)
-- ... -- ...
end end
@ -4313,6 +4318,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interactions where Mario bounces off the top of an object (e.g., Goombas, Koopas). Checks if Mario attacks the object from above and applies the appropriate knockback, sound effects, and object state changes. Useful for enemy defeat mechanics and platform bouncing
function interact_bounce_top(m, interactType, o) function interact_bounce_top(m, interactType, o)
-- ... -- ...
end end
@ -4321,6 +4327,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interactions with breakable objects (e.g., breakable boxes or bob-ombs). If Mario hits the object with a valid attack (like a punch or kick), the object is destroyed or changes state. Useful for managing collectible items hidden in breakable objects and level progression through destructible blocks or walls
function interact_breakable(m, interactType, o) function interact_breakable(m, interactType, o)
-- ... -- ...
end end
@ -4329,6 +4336,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with Bully enemies. Determines if Mario attacks the Bully or gets knocked back. Updates Mario's velocity and state accordingly, and can defeat the Bully if attacked successfully. Useful for enemy encounters that involve pushing and shoving mechanics rather than just stomping like the bullies
function interact_bully(m, interactType, o) function interact_bully(m, interactType, o)
-- ... -- ...
end end
@ -4337,6 +4345,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction when Mario touches a cannon base. If the cannon is ready, Mario enters the cannon, triggering a special action and camera behavior. Useful for transitioning to cannon-aiming mode and enabling cannon travel within levels
function interact_cannon_base(m, interactType, o) function interact_cannon_base(m, interactType, o)
-- ... -- ...
end end
@ -4345,6 +4354,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction when Mario picks up a cap object. This includes normal caps, wing caps, vanish caps, and metal caps. Updates Mario's state (e.g., cap timers, sound effects) and may initiate putting on the cap animation. Useful for managing cap statuses
function interact_cap(m, interactType, o) function interact_cap(m, interactType, o)
-- ... -- ...
end end
@ -4353,6 +4363,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interactions with objects like Clams or Bubbas, which can damage Mario or, in Bubba's case, eat Mario. If Bubba eats Mario, it triggers a unique "caught" action. Otherwise, it deals damage and knockback if hit by a Clam
function interact_clam_or_bubba(m, interactType, o) function interact_clam_or_bubba(m, interactType, o)
-- ... -- ...
end end
@ -4361,6 +4372,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles Mario's interaction with coins. Collecting a coin increases Mario's coin count and heals him slightly. Useful for score, and coin management
function interact_coin(m, interactType, o) function interact_coin(m, interactType, o)
-- ... -- ...
end end
@ -4369,6 +4381,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles damaging interactions from various objects (e.g., enemies, hazards). If Mario takes damage, it applies knockback and reduces health. Useful for enemy attacks, environmental hazards, and managing damage related behaviors
function interact_damage(m, interactType, o) function interact_damage(m, interactType, o)
-- ... -- ...
end end
@ -4377,6 +4390,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction when Mario touches a door. If Mario meets the star requirement or has the key, he can unlock/open the door. Otherwise, it may display dialog indicating the requirement. Useful for controlling access to locked areas and providing progression gating in the game
function interact_door(m, interactType, o) function interact_door(m, interactType, o)
-- ... -- ...
end end
@ -4385,6 +4399,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with flame objects. If Mario touches a flame and is not invulnerable or protected by certain caps, he takes damage and may be set on fire, causing a burning jump. Useful for simulating fire damage and hazards in levels
function interact_flame(m, interactType, o) function interact_flame(m, interactType, o)
-- ... -- ...
end end
@ -4393,6 +4408,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with grabbable objects (e.g., crates, small enemies, or Bowser). Checks if Mario can pick up the object and initiates the grab action if possible. Useful for course mechanics, throwing items, and bowser
function interact_grabbable(m, interactType, o) function interact_grabbable(m, interactType, o)
-- ... -- ...
end end
@ -4401,6 +4417,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interactions where Mario hits an object from below (e.g., hitting a block from underneath). Determines if Mario damages/destroys the object, or if it damages Mario. Useful for handling upward attacks, hitting coin blocks, or interacting with certain NPCs from below
function interact_hit_from_below(m, interactType, o) function interact_hit_from_below(m, interactType, o)
-- ... -- ...
end end
@ -4409,6 +4426,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with Hoot, the owl. If Mario can grab onto Hoot, this sets Mario onto a riding action, allowing him to fly around the level. Useful for special traversal mechanics and shortcuts within a course
function interact_hoot(m, interactType, o) function interact_hoot(m, interactType, o)
-- ... -- ...
end end
@ -4417,6 +4435,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with the igloo barrier found in Snowman's Land. If Mario runs into the barrier, this function pushes him away and prevents passage without the vanish cap. Useful for enforcing require-caps to access certain areas
function interact_igloo_barrier(m, interactType, o) function interact_igloo_barrier(m, interactType, o)
-- ... -- ...
end end
@ -4425,6 +4444,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction when Mario touches a Koopa Shell. If conditions are met, Mario can hop onto the shell and start riding it, changing his movement mechanics. Useful for implementing Koopa Shell behavior
function interact_koopa_shell(m, interactType, o) function interact_koopa_shell(m, interactType, o)
-- ... -- ...
end end
@ -4433,6 +4453,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with Mr. Blizzard (the snowman enemy) or similar objects. If Mario is attacked or collides with Mr. Blizzard, it applies damage and knockback if not protected or attacking
function interact_mr_blizzard(m, interactType, o) function interact_mr_blizzard(m, interactType, o)
-- ... -- ...
end end
@ -4441,6 +4462,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with another player (in multiplayer scenarios). Checks if Mario and another player collide and resolves any special behavior like bouncing on top. Useful for multiplayer interactions, such as PvP or cooperative gameplay mechanics
function interact_player(m, interactType, o) function interact_player(m, interactType, o)
-- ... -- ...
end end
@ -4449,6 +4471,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with poles (e.g., climbing poles). If Mario runs into a vertical pole, he can grab it and start climbing. Useful for platforming mechanics
function interact_pole(m, interactType, o) function interact_pole(m, interactType, o)
-- ... -- ...
end end
@ -4457,6 +4480,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with shocking objects. If Mario touches an electrified enemy or hazard, he takes damage and may be stunned or shocked. Useful for electric-themed enemies and obstacles
function interact_shock(m, interactType, o) function interact_shock(m, interactType, o)
-- ... -- ...
end end
@ -4465,6 +4489,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with Snufit bullets (projectiles fired by certain enemies). If Mario is not protected, he takes damage. Otherwise, the bullet can be destroyed
function interact_snufit_bullet(m, interactType, o) function interact_snufit_bullet(m, interactType, o)
-- ... -- ...
end end
@ -4473,6 +4498,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with Spiny-walking enemies. If Mario attacks it (e.g., by punching), the enemy is hurt. If he fails to attack properly (say bouncing on top), Mario takes damage and knockback. Useful for enemies that cannot be stomped from above and require direct attacks
function interact_spiny_walking(m, interactType, o) function interact_spiny_walking(m, interactType, o)
-- ... -- ...
end end
@ -4481,6 +4507,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with Stars or Keys. If Mario collects a star or key, it triggers a specific star grab cutscene and progression is updated. Also handles no-exit variants (like the wing cap stage star). Useful for the main progression system of collecting Stars and unlocking new areas
function interact_star_or_key(m, interactType, o) function interact_star_or_key(m, interactType, o)
-- ... -- ...
end end
@ -4489,6 +4516,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with strong wind gusts. These gusts push Mario back, often knocking him off platforms or sending him flying backwards. Useful for environmental wind hazards
function interact_strong_wind(m, interactType, o) function interact_strong_wind(m, interactType, o)
-- ... -- ...
end end
@ -4497,6 +4525,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with signs, NPCs, and other text-bearing objects. If Mario presses the interact button facing them, he enters a dialog reading state. Useful for managing hints, story elements, or gameplay instructions through in-game dialogue
function interact_text(m, interactType, o) function interact_text(m, interactType, o)
-- ... -- ...
end end
@ -4505,6 +4534,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with tornados. If Mario touches a tornado, he enters a spinning twirl action, losing control temporarily. Useful for desert levels or areas where environmental hazards lift Mario into the air
function interact_tornado(m, interactType, o) function interact_tornado(m, interactType, o)
-- ... -- ...
end end
@ -4513,6 +4543,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with warps, including warp pipes and hole warps. If Mario steps onto a warp, he either transitions into another area or level. Useful for connecting different parts of the game world and controlling transitions between levels as well as custom warp areas
function interact_warp(m, interactType, o) function interact_warp(m, interactType, o)
-- ... -- ...
end end
@ -4521,6 +4552,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with warp doors that lead to other areas or require keys. If Mario can open the door (has enough stars or a key), he proceeds. Otherwise, it may show a dialog. Useful for restricting access to certain areas based on progression
function interact_warp_door(m, interactType, o) function interact_warp_door(m, interactType, o)
-- ... -- ...
end end
@ -4529,6 +4561,7 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interactions with water rings that heal Mario. Passing through water rings increases his health counter. Useful for underwater stages
function interact_water_ring(m, interactType, o) function interact_water_ring(m, interactType, o)
-- ... -- ...
end end
@ -4537,23 +4570,27 @@ end
--- @param interactType integer --- @param interactType integer
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles interaction with whirlpools. If Mario gets caught in a whirlpool, he's pulled toward it, resulting in a unique "caught" action. Useful for hazards that trap Mario like whirlpools
function interact_whirlpool(m, interactType, o) function interact_whirlpool(m, interactType, o)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- @param capSpeed number --- @param capSpeed number
--- Makes Mario blow off his normal cap at a given speed. Removes the normal cap from Mario's head and spawns it as a collectible object in the game world. Useful for simulating events where Mario loses his cap due to enemy attacks or environmental forces
function mario_blow_off_cap(m, capSpeed) function mario_blow_off_cap(m, capSpeed)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- @return integer --- @return integer
--- Checks if Mario can grab the currently encountered object (usually triggered when Mario punches or dives). If conditions are met, initiates the grabbing process. Useful for picking up objects, throwing enemies, or grabbing special items
function mario_check_object_grab(m) function mario_check_object_grab(m)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- Causes Mario to drop the object he is currently holding. Sets the held object's state accordingly and places it in front of Mario. Useful for releasing carried objects, such as throwing Bob-ombs or setting down crates
function mario_drop_held_object(m) function mario_drop_held_object(m)
-- ... -- ...
end end
@ -4561,11 +4598,13 @@ end
--- @param m MarioState --- @param m MarioState
--- @param interactType integer --- @param interactType integer
--- @return Object --- @return Object
--- Returns a collided object that matches a given interaction type from Mario's current collision data. Useful for determining which object Mario has come into contact with
function mario_get_collided_object(m, interactType) function mario_get_collided_object(m, interactType)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- Grabs the object currently referenced by Mario's `usedObj` if it's not already being held. Changes the object's state to indicate it is now held by Mario. Useful for handling the moment Mario successfully picks up an object
function mario_grab_used_object(m) function mario_grab_used_object(m)
-- ... -- ...
end end
@ -4573,6 +4612,7 @@ end
--- @param m MarioState --- @param m MarioState
--- @param arg integer --- @param arg integer
--- @return integer --- @return integer
--- Makes Mario lose his normal cap to an enemy, such as Klepto or Ukiki. Updates flags so that the cap is no longer on Mario's head. Returns true if Mario was wearing his normal cap, otherwise false. Useful for scenarios where enemies steal Mario's cap
function mario_lose_cap_to_enemy(m, arg) function mario_lose_cap_to_enemy(m, arg)
-- ... -- ...
end end
@ -4580,26 +4620,31 @@ end
--- @param m MarioState --- @param m MarioState
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Calculates the angle between Mario and a specified object. Used for determining Mario's orientation relative to the object. Useful for deciding directions between Mario and NPCs
function mario_obj_angle_to_object(m, o) function mario_obj_angle_to_object(m, o)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- Retrieves Mario's normal cap if it was previously lost. Removes the cap from Mario's hand state and places it on his head. Useful when Mario recovers his normal cap from enemies, finds it in a level, or if it were to disappear
function mario_retrieve_cap(m) function mario_retrieve_cap(m)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- Causes Mario to stop riding any object (like a shell or Hoot) and also drop any held object. Resets related states to ensure Mario is no longer attached to or holding anything. Useful when changing Mario's state after certain actions, transitions, or to prevent exploits
function mario_stop_riding_and_holding(m) function mario_stop_riding_and_holding(m)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- Stops Mario from riding any currently ridden object (e.g., a Koopa shell or Hoot), updating the object's interaction status and Mario's state. Useful for cleanly dismounting ridden objects
function mario_stop_riding_object(m) function mario_stop_riding_object(m)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- Throws the object Mario is currently holding. The object is placed in front of Mario and given a forward velocity. Useful for attacking enemies with thrown objects, solving puzzles by throwing crates, or interacting with environment items
function mario_throw_held_object(m) function mario_throw_held_object(m)
-- ... -- ...
end end
@ -4607,6 +4652,7 @@ end
--- @param attacker MarioState --- @param attacker MarioState
--- @param victim MarioState --- @param victim MarioState
--- @return integer --- @return integer
--- Checks if the necessary conditions are met for one player to successfully attack another player in a PvP scenario. Considers factors like invincibility, action states, and whether the attack is valid. Useful for multiplayer where players can harm each other
function passes_pvp_interaction_checks(attacker, victim) function passes_pvp_interaction_checks(attacker, victim)
-- ... -- ...
end end
@ -4614,6 +4660,7 @@ end
--- @param m MarioState --- @param m MarioState
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Determines whether Mario should push or pull a door when he interacts with it, based on his orientation and position. Useful for animating door interactions realistically, depending on which side Mario approaches from
function should_push_or_pull_door(m, o) function should_push_or_pull_door(m, o)
-- ... -- ...
end end
@ -4621,6 +4668,7 @@ end
--- @param m MarioState --- @param m MarioState
--- @param o Object --- @param o Object
--- @return integer --- @return integer
--- Handles the logic of Mario taking damage and being knocked back by a damaging object. Decreases Mario's health, sets his knockback state, and triggers appropriate sound and camera effects. Useful for implementing enemy attacks, hazards, and ensuring Mario receives proper feedback upon taking damage
function take_damage_and_knock_back(m, o) function take_damage_and_knock_back(m, o)
-- ... -- ...
end end

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,675 @@
[< prev](functions-3.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | 4 | [5](functions-5.md) | [6](functions-6.md) | [next >](functions-5.md)] [< prev](functions-3.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | 4 | [5](functions-5.md) | [6](functions-6.md) | [next >](functions-5.md)]
---
# functions from mario_actions_airborne.c
<br />
## [check_common_airborne_cancels](#check_common_airborne_cancels)
### Lua Example
`local integerValue = check_common_airborne_cancels(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 check_common_airborne_cancels(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [check_fall_damage](#check_fall_damage)
### Lua Example
`local integerValue = check_fall_damage(m, hardFallAction)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| hardFallAction | `integer` |
### Returns
- `integer`
### C Prototype
`s32 check_fall_damage(struct MarioState *m, u32 hardFallAction);`
[:arrow_up_small:](#)
<br />
## [check_fall_damage_or_get_stuck](#check_fall_damage_or_get_stuck)
### Lua Example
`local integerValue = check_fall_damage_or_get_stuck(m, hardFallAction)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| hardFallAction | `integer` |
### Returns
- `integer`
### C Prototype
`s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction);`
[:arrow_up_small:](#)
<br />
## [check_horizontal_wind](#check_horizontal_wind)
### Lua Example
`local integerValue = check_horizontal_wind(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 check_horizontal_wind(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [check_kick_or_dive_in_air](#check_kick_or_dive_in_air)
### Lua Example
`local integerValue = check_kick_or_dive_in_air(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 check_kick_or_dive_in_air(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [check_wall_kick](#check_wall_kick)
### Lua Example
`local integerValue = check_wall_kick(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 check_wall_kick(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [common_air_action_step](#common_air_action_step)
### Lua Example
`local integerValue = common_air_action_step(m, landAction, animation, stepArg)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| landAction | `integer` |
| animation | `integer` |
| stepArg | `integer` |
### Returns
- `integer`
### C Prototype
`u32 common_air_action_step(struct MarioState *m, u32 landAction, s32 animation, u32 stepArg);`
[:arrow_up_small:](#)
<br />
## [common_air_knockback_step](#common_air_knockback_step)
### Lua Example
`local integerValue = common_air_knockback_step(m, landAction, hardFallAction, animation, speed)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| landAction | `integer` |
| hardFallAction | `integer` |
| animation | `integer` |
| speed | `number` |
### Returns
- `integer`
### C Prototype
`u32 common_air_knockback_step(struct MarioState *m, u32 landAction, u32 hardFallAction, s32 animation, f32 speed);`
[:arrow_up_small:](#)
<br />
## [lava_boost_on_wall](#lava_boost_on_wall)
### Lua Example
`local integerValue = lava_boost_on_wall(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 lava_boost_on_wall(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [mario_execute_airborne_action](#mario_execute_airborne_action)
### Lua Example
`local integerValue = mario_execute_airborne_action(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 mario_execute_airborne_action(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [play_far_fall_sound](#play_far_fall_sound)
### Lua Example
`play_far_fall_sound(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void play_far_fall_sound(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [play_flip_sounds](#play_flip_sounds)
### Lua Example
`play_flip_sounds(m, frame1, frame2, frame3)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| frame1 | `integer` |
| frame2 | `integer` |
| frame3 | `integer` |
### Returns
- None
### C Prototype
`void play_flip_sounds(struct MarioState *m, s16 frame1, s16 frame2, s16 frame3);`
[:arrow_up_small:](#)
<br />
## [play_knockback_sound](#play_knockback_sound)
### Lua Example
`play_knockback_sound(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void play_knockback_sound(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [should_get_stuck_in_ground](#should_get_stuck_in_ground)
### Lua Example
`local integerValue = should_get_stuck_in_ground(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 should_get_stuck_in_ground(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [update_air_with_turn](#update_air_with_turn)
### Lua Example
`update_air_with_turn(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void update_air_with_turn(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [update_air_without_turn](#update_air_without_turn)
### Lua Example
`update_air_without_turn(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void update_air_without_turn(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [update_flying](#update_flying)
### Lua Example
`update_flying(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void update_flying(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [update_flying_pitch](#update_flying_pitch)
### Lua Example
`update_flying_pitch(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void update_flying_pitch(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [update_flying_yaw](#update_flying_yaw)
### Lua Example
`update_flying_yaw(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void update_flying_yaw(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [update_lava_boost_or_twirling](#update_lava_boost_or_twirling)
### Lua Example
`update_lava_boost_or_twirling(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void update_lava_boost_or_twirling(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
---
# functions from mario_actions_automatic.c
<br />
## [add_tree_leaf_particles](#add_tree_leaf_particles)
### Lua Example
`add_tree_leaf_particles(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void add_tree_leaf_particles(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [check_common_automatic_cancels](#check_common_automatic_cancels)
### Lua Example
`local integerValue = check_common_automatic_cancels(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 check_common_automatic_cancels(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [climb_up_ledge](#climb_up_ledge)
### Lua Example
`climb_up_ledge(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void climb_up_ledge(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [let_go_of_ledge](#let_go_of_ledge)
### Lua Example
`local integerValue = let_go_of_ledge(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 let_go_of_ledge(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [mario_execute_automatic_action](#mario_execute_automatic_action)
### Lua Example
`local integerValue = mario_execute_automatic_action(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 mario_execute_automatic_action(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [perform_hanging_step](#perform_hanging_step)
### Lua Example
`local integerValue = perform_hanging_step(m, nextPos)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| nextPos | [Vec3f](structs.md#Vec3f) |
### Returns
- `integer`
### C Prototype
`s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos);`
[:arrow_up_small:](#)
<br />
## [play_climbing_sounds](#play_climbing_sounds)
### Lua Example
`play_climbing_sounds(m, b)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| b | `integer` |
### Returns
- None
### C Prototype
`void play_climbing_sounds(struct MarioState *m, s32 b);`
[:arrow_up_small:](#)
<br />
## [set_pole_position](#set_pole_position)
### Lua Example
`local integerValue = set_pole_position(m, offsetY)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| offsetY | `number` |
### Returns
- `integer`
### C Prototype
`s32 set_pole_position(struct MarioState *m, f32 offsetY);`
[:arrow_up_small:](#)
<br />
## [update_hang_moving](#update_hang_moving)
### Lua Example
`local integerValue = update_hang_moving(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`s32 update_hang_moving(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [update_hang_stationary](#update_hang_stationary)
### Lua Example
`update_hang_stationary(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void update_hang_stationary(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [update_ledge_climb](#update_ledge_climb)
### Lua Example
`update_ledge_climb(m, animation, endAction)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| animation | `integer` |
| endAction | `integer` |
### Returns
- None
### C Prototype
`void update_ledge_climb(struct MarioState *m, s32 animation, u32 endAction);`
[:arrow_up_small:](#)
<br />
## [update_ledge_climb_camera](#update_ledge_climb_camera)
### Lua Example
`update_ledge_climb_camera(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void update_ledge_climb_camera(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
--- ---
# functions from mario_actions_cutscene.c # functions from mario_actions_cutscene.c

View file

@ -998,42 +998,42 @@
<br /> <br />
- mario_actions_airborne.c - mario_actions_airborne.c
- [check_common_airborne_cancels](functions-3.md#check_common_airborne_cancels) - [check_common_airborne_cancels](functions-4.md#check_common_airborne_cancels)
- [check_fall_damage](functions-3.md#check_fall_damage) - [check_fall_damage](functions-4.md#check_fall_damage)
- [check_fall_damage_or_get_stuck](functions-3.md#check_fall_damage_or_get_stuck) - [check_fall_damage_or_get_stuck](functions-4.md#check_fall_damage_or_get_stuck)
- [check_horizontal_wind](functions-3.md#check_horizontal_wind) - [check_horizontal_wind](functions-4.md#check_horizontal_wind)
- [check_kick_or_dive_in_air](functions-3.md#check_kick_or_dive_in_air) - [check_kick_or_dive_in_air](functions-4.md#check_kick_or_dive_in_air)
- [check_wall_kick](functions-3.md#check_wall_kick) - [check_wall_kick](functions-4.md#check_wall_kick)
- [common_air_action_step](functions-3.md#common_air_action_step) - [common_air_action_step](functions-4.md#common_air_action_step)
- [common_air_knockback_step](functions-3.md#common_air_knockback_step) - [common_air_knockback_step](functions-4.md#common_air_knockback_step)
- [lava_boost_on_wall](functions-3.md#lava_boost_on_wall) - [lava_boost_on_wall](functions-4.md#lava_boost_on_wall)
- [mario_execute_airborne_action](functions-3.md#mario_execute_airborne_action) - [mario_execute_airborne_action](functions-4.md#mario_execute_airborne_action)
- [play_far_fall_sound](functions-3.md#play_far_fall_sound) - [play_far_fall_sound](functions-4.md#play_far_fall_sound)
- [play_flip_sounds](functions-3.md#play_flip_sounds) - [play_flip_sounds](functions-4.md#play_flip_sounds)
- [play_knockback_sound](functions-3.md#play_knockback_sound) - [play_knockback_sound](functions-4.md#play_knockback_sound)
- [should_get_stuck_in_ground](functions-3.md#should_get_stuck_in_ground) - [should_get_stuck_in_ground](functions-4.md#should_get_stuck_in_ground)
- [update_air_with_turn](functions-3.md#update_air_with_turn) - [update_air_with_turn](functions-4.md#update_air_with_turn)
- [update_air_without_turn](functions-3.md#update_air_without_turn) - [update_air_without_turn](functions-4.md#update_air_without_turn)
- [update_flying](functions-3.md#update_flying) - [update_flying](functions-4.md#update_flying)
- [update_flying_pitch](functions-3.md#update_flying_pitch) - [update_flying_pitch](functions-4.md#update_flying_pitch)
- [update_flying_yaw](functions-3.md#update_flying_yaw) - [update_flying_yaw](functions-4.md#update_flying_yaw)
- [update_lava_boost_or_twirling](functions-3.md#update_lava_boost_or_twirling) - [update_lava_boost_or_twirling](functions-4.md#update_lava_boost_or_twirling)
<br /> <br />
- mario_actions_automatic.c - mario_actions_automatic.c
- [add_tree_leaf_particles](functions-3.md#add_tree_leaf_particles) - [add_tree_leaf_particles](functions-4.md#add_tree_leaf_particles)
- [check_common_automatic_cancels](functions-3.md#check_common_automatic_cancels) - [check_common_automatic_cancels](functions-4.md#check_common_automatic_cancels)
- [climb_up_ledge](functions-3.md#climb_up_ledge) - [climb_up_ledge](functions-4.md#climb_up_ledge)
- [let_go_of_ledge](functions-3.md#let_go_of_ledge) - [let_go_of_ledge](functions-4.md#let_go_of_ledge)
- [mario_execute_automatic_action](functions-3.md#mario_execute_automatic_action) - [mario_execute_automatic_action](functions-4.md#mario_execute_automatic_action)
- [perform_hanging_step](functions-3.md#perform_hanging_step) - [perform_hanging_step](functions-4.md#perform_hanging_step)
- [play_climbing_sounds](functions-3.md#play_climbing_sounds) - [play_climbing_sounds](functions-4.md#play_climbing_sounds)
- [set_pole_position](functions-3.md#set_pole_position) - [set_pole_position](functions-4.md#set_pole_position)
- [update_hang_moving](functions-3.md#update_hang_moving) - [update_hang_moving](functions-4.md#update_hang_moving)
- [update_hang_stationary](functions-3.md#update_hang_stationary) - [update_hang_stationary](functions-4.md#update_hang_stationary)
- [update_ledge_climb](functions-3.md#update_ledge_climb) - [update_ledge_climb](functions-4.md#update_ledge_climb)
- [update_ledge_climb_camera](functions-3.md#update_ledge_climb_camera) - [update_ledge_climb_camera](functions-4.md#update_ledge_climb_camera)
<br /> <br />

View file

@ -126,57 +126,307 @@ enum InteractionFlag {
extern s16 gInteractionInvulnerable; extern s16 gInteractionInvulnerable;
extern u8 gPssSlideStarted; extern u8 gPssSlideStarted;
/* |description|
Handles Mario's interaction with coins. Collecting a coin increases Mario's coin count and heals him slightly.
Useful for score, and coin management
|descriptionEnd| */
u32 interact_coin(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_coin(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interactions with water rings that heal Mario. Passing through water rings increases his health counter.
Useful for underwater stages
|descriptionEnd| */
u32 interact_water_ring(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_water_ring(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with Stars or Keys. If Mario collects a star or key, it triggers a specific star grab cutscene and progression is updated. Also handles no-exit variants (like the wing cap stage star).
Useful for the main progression system of collecting Stars and unlocking new areas
|descriptionEnd| */
u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles Mario's interaction with the Boo's Big Haunt (BBH) entrance object. When Mario tries to enter the BBH area, this function determines the resulting action (e.g., a jump or spin entrance)
|descriptionEnd| */
u32 interact_bbh_entrance(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_bbh_entrance(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with warps, including warp pipes and hole warps. If Mario steps onto a warp, he either transitions into another area or level.
Useful for connecting different parts of the game world and controlling transitions between levels as well as custom warp areas
|descriptionEnd| */
u32 interact_warp(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_warp(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with warp doors that lead to other areas or require keys. If Mario can open the door (has enough stars or a key), he proceeds. Otherwise, it may show a dialog.
Useful for restricting access to certain areas based on progression
|descriptionEnd| */
u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction when Mario touches a door. If Mario meets the star requirement or has the key, he can unlock/open the door. Otherwise, it may display dialog indicating the requirement.
Useful for controlling access to locked areas and providing progression gating in the game
|descriptionEnd| */
u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction when Mario touches a cannon base. If the cannon is ready, Mario enters the cannon, triggering a special action and camera behavior.
Useful for transitioning to cannon-aiming mode and enabling cannon travel within levels
|descriptionEnd| */
u32 interact_cannon_base(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_cannon_base(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with another player (in multiplayer scenarios).
Checks if Mario and another player collide and resolves any special behavior like bouncing on top.
Useful for multiplayer interactions, such as PvP or cooperative gameplay mechanics
|descriptionEnd| */
u32 interact_player(struct MarioState* m, UNUSED u32 interactType, struct Object* o); u32 interact_player(struct MarioState* m, UNUSED u32 interactType, struct Object* o);
/* |description|
Handles interaction with the igloo barrier found in Snowman's Land. If Mario runs into the barrier, this function pushes him away and prevents passage without the vanish cap.
Useful for enforcing require-caps to access certain areas
|descriptionEnd| */
u32 interact_igloo_barrier(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_igloo_barrier(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with tornados. If Mario touches a tornado, he enters a spinning twirl action, losing control temporarily.
Useful for desert levels or areas where environmental hazards lift Mario into the air
|descriptionEnd| */
u32 interact_tornado(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_tornado(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with whirlpools. If Mario gets caught in a whirlpool, he's pulled toward it, resulting in a unique "caught" action.
Useful for hazards that trap Mario like whirlpools
|descriptionEnd| */
u32 interact_whirlpool(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_whirlpool(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with strong wind gusts. These gusts push Mario back, often knocking him off platforms or sending him flying backwards.
Useful for environmental wind hazards
|descriptionEnd| */
u32 interact_strong_wind(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_strong_wind(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with flame objects. If Mario touches a flame and is not invulnerable or protected by certain caps, he takes damage and may be set on fire, causing a burning jump.
Useful for simulating fire damage and hazards in levels
|descriptionEnd| */
u32 interact_flame(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_flame(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with Snufit bullets (projectiles fired by certain enemies). If Mario is not protected, he takes damage. Otherwise, the bullet can be destroyed
|descriptionEnd| */
u32 interact_snufit_bullet(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_snufit_bullet(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interactions with objects like Clams or Bubbas, which can damage Mario or, in Bubba's case, eat Mario.
If Bubba eats Mario, it triggers a unique "caught" action. Otherwise, it deals damage and knockback if hit by a Clam
|descriptionEnd| */
u32 interact_clam_or_bubba(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_clam_or_bubba(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with Bully enemies. Determines if Mario attacks the Bully or gets knocked back. Updates Mario's velocity and state accordingly, and can defeat the Bully if attacked successfully.
Useful for enemy encounters that involve pushing and shoving mechanics rather than just stomping like the bullies
|descriptionEnd| */
u32 interact_bully(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_bully(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with shocking objects. If Mario touches an electrified enemy or hazard, he takes damage and may be stunned or shocked.
Useful for electric-themed enemies and obstacles
|descriptionEnd| */
u32 interact_shock(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_shock(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with Mr. Blizzard (the snowman enemy) or similar objects.
If Mario is attacked or collides with Mr. Blizzard, it applies damage and knockback if not protected or attacking
|descriptionEnd| */
u32 interact_mr_blizzard(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_mr_blizzard(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interactions where Mario hits an object from below (e.g., hitting a block from underneath). Determines if Mario damages/destroys the object, or if it damages Mario.
Useful for handling upward attacks, hitting coin blocks, or interacting with certain NPCs from below
|descriptionEnd| */
u32 interact_hit_from_below(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_hit_from_below(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interactions where Mario bounces off the top of an object (e.g., Goombas, Koopas).
Checks if Mario attacks the object from above and applies the appropriate knockback, sound effects, and object state changes.
Useful for enemy defeat mechanics and platform bouncing
|descriptionEnd| */
u32 interact_bounce_top(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_bounce_top(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with Spiny-walking enemies. If Mario attacks it (e.g., by punching), the enemy is hurt. If he fails to attack properly (say bouncing on top), Mario takes damage and knockback.
Useful for enemies that cannot be stomped from above and require direct attacks
|descriptionEnd| */
u32 interact_spiny_walking(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_spiny_walking(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles damaging interactions from various objects (e.g., enemies, hazards). If Mario takes damage, it applies knockback and reduces health.
Useful for enemy attacks, environmental hazards, and managing damage related behaviors
|descriptionEnd| */
u32 interact_damage(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_damage(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interactions with breakable objects (e.g., breakable boxes or bob-ombs). If Mario hits the object with a valid attack (like a punch or kick), the object is destroyed or changes state.
Useful for managing collectible items hidden in breakable objects and level progression through destructible blocks or walls
|descriptionEnd| */
u32 interact_breakable(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_breakable(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction when Mario touches a Koopa Shell. If conditions are met, Mario can hop onto the shell and start riding it, changing his movement mechanics.
Useful for implementing Koopa Shell behavior
|descriptionEnd| */
u32 interact_koopa_shell(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_koopa_shell(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with poles (e.g., climbing poles). If Mario runs into a vertical pole, he can grab it and start climbing.
Useful for platforming mechanics
|descriptionEnd| */
u32 interact_pole(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_pole(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with Hoot, the owl. If Mario can grab onto Hoot, this sets Mario onto a riding action, allowing him to fly around the level.
Useful for special traversal mechanics and shortcuts within a course
|descriptionEnd| */
u32 interact_hoot(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_hoot(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction when Mario picks up a cap object. This includes normal caps, wing caps, vanish caps, and metal caps.
Updates Mario's state (e.g., cap timers, sound effects) and may initiate putting on the cap animation.
Useful for managing cap statuses
|descriptionEnd| */
u32 interact_cap(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_cap(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Handles interaction with grabbable objects (e.g., crates, small enemies, or Bowser). Checks if Mario can pick up the object and initiates the grab action if possible.
Useful for course mechanics, throwing items, and bowser
|descriptionEnd| */
u32 interact_grabbable(struct MarioState *m, u32 interactType, struct Object *o); u32 interact_grabbable(struct MarioState *m, u32 interactType, struct Object *o);
/* |description|
Handles interaction with signs, NPCs, and other text-bearing objects. If Mario presses the interact button facing them, he enters a dialog reading state.
Useful for managing hints, story elements, or gameplay instructions through in-game dialogue
|descriptionEnd| */
u32 interact_text(struct MarioState *m, UNUSED u32 interactType, struct Object *o); u32 interact_text(struct MarioState *m, UNUSED u32 interactType, struct Object *o);
/* |description|
Calculates the angle between Mario and a specified object. Used for determining Mario's orientation relative to the object.
Useful for deciding directions between Mario and NPCs
|descriptionEnd| */
s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o); s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o);
/* |description|
Stops Mario from riding any currently ridden object (e.g., a Koopa shell or Hoot), updating the object's interaction status and Mario's state.
Useful for cleanly dismounting ridden objects
|descriptionEnd| */
void mario_stop_riding_object(struct MarioState *m); void mario_stop_riding_object(struct MarioState *m);
/* |description|
Grabs the object currently referenced by Mario's `usedObj` if it's not already being held.
Changes the object's state to indicate it is now held by Mario.
Useful for handling the moment Mario successfully picks up an object
|descriptionEnd| */
void mario_grab_used_object(struct MarioState *m); void mario_grab_used_object(struct MarioState *m);
/* |description|
Causes Mario to drop the object he is currently holding. Sets the held object's state accordingly and places it in front of Mario.
Useful for releasing carried objects, such as throwing Bob-ombs or setting down crates
|descriptionEnd| */
void mario_drop_held_object(struct MarioState *m); void mario_drop_held_object(struct MarioState *m);
/* |description|
Throws the object Mario is currently holding. The object is placed in front of Mario and given a forward velocity.
Useful for attacking enemies with thrown objects, solving puzzles by throwing crates, or interacting with environment items
|descriptionEnd| */
void mario_throw_held_object(struct MarioState *m); void mario_throw_held_object(struct MarioState *m);
/* |description|
Causes Mario to stop riding any object (like a shell or Hoot) and also drop any held object.
Resets related states to ensure Mario is no longer attached to or holding anything.
Useful when changing Mario's state after certain actions, transitions, or to prevent exploits
|descriptionEnd| */
void mario_stop_riding_and_holding(struct MarioState *m); void mario_stop_riding_and_holding(struct MarioState *m);
/* |description|
Checks if Mario is currently wearing his normal cap on his head.
Returns true if Mario's flag state matches that of having the normal cap equipped on his head, otherwise false.
Useful for determining Mario's cap status
|descriptionEnd| */
u32 does_mario_have_normal_cap_on_head(struct MarioState *m); u32 does_mario_have_normal_cap_on_head(struct MarioState *m);
/* |description|
Makes Mario blow off his normal cap at a given speed.
Removes the normal cap from Mario's head and spawns it as a collectible object in the game world.
Useful for simulating events where Mario loses his cap due to enemy attacks or environmental forces
|descriptionEnd| */
void mario_blow_off_cap(struct MarioState *m, f32 capSpeed); void mario_blow_off_cap(struct MarioState *m, f32 capSpeed);
/* |description|
Makes Mario lose his normal cap to an enemy, such as Klepto or Ukiki. Updates flags so that the cap is no longer on Mario's head.
Returns true if Mario was wearing his normal cap, otherwise false.
Useful for scenarios where enemies steal Mario's cap
|descriptionEnd| */
u32 mario_lose_cap_to_enemy(struct MarioState* m, u32 arg); u32 mario_lose_cap_to_enemy(struct MarioState* m, u32 arg);
/* |description|
Retrieves Mario's normal cap if it was previously lost.
Removes the cap from Mario's hand state and places it on his head.
Useful when Mario recovers his normal cap from enemies, finds it in a level, or if it were to disappear
|descriptionEnd| */
void mario_retrieve_cap(struct MarioState* m); void mario_retrieve_cap(struct MarioState* m);
/* |description|
Returns a collided object that matches a given interaction type from Mario's current collision data.
Useful for determining which object Mario has come into contact with
|descriptionEnd| */
struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType); struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType);
/* |description|
Checks if Mario can grab the currently encountered object (usually triggered when Mario punches or dives). If conditions are met, initiates the grabbing process.
Useful for picking up objects, throwing enemies, or grabbing special items
|descriptionEnd| */
u32 mario_check_object_grab(struct MarioState *m); u32 mario_check_object_grab(struct MarioState *m);
/* |description|
Retrieves the save file flag associated with a door, based on the number of stars required to open it.
Used to check if the player has unlocked certain star doors or progressed far enough to access new areas
|descriptionEnd| */
u32 get_door_save_file_flag(struct Object *door); u32 get_door_save_file_flag(struct Object *door);
void mario_process_interactions(struct MarioState *m); void mario_process_interactions(struct MarioState *m);
void mario_handle_special_floors(struct MarioState *m); void mario_handle_special_floors(struct MarioState *m);
/* |description|
Checks if the necessary conditions are met for one player to successfully attack another player in a PvP scenario.
Considers factors like invincibility, action states, and whether the attack is valid.
Useful for multiplayer where players can harm each other
|descriptionEnd| */
u8 passes_pvp_interaction_checks(struct MarioState* attacker, struct MarioState* victim); u8 passes_pvp_interaction_checks(struct MarioState* attacker, struct MarioState* victim);
/* |description|
Determines whether Mario should push or pull a door when he interacts with it, based on his orientation and position.
Useful for animating door interactions realistically, depending on which side Mario approaches from
|descriptionEnd| */
u32 should_push_or_pull_door(struct MarioState *m, struct Object *o); u32 should_push_or_pull_door(struct MarioState *m, struct Object *o);
/* |description|
Handles the logic of Mario taking damage and being knocked back by a damaging object.
Decreases Mario's health, sets his knockback state, and triggers appropriate sound and camera effects.
Useful for implementing enemy attacks, hazards, and ensuring Mario receives proper feedback upon taking damage
|descriptionEnd| */
u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o); u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o);
/* |description|
Determines the type of cap an object represents. Depending on the object's behavior, it returns a cap type (normal, metal, wing, vanish).
Useful for handling the logic of picking up, wearing, or losing different kinds of caps
|descriptionEnd| */
u32 get_mario_cap_flag(struct Object *capObject); u32 get_mario_cap_flag(struct Object *capObject);
/* |description|
Determines how Mario interacts with a given object based on his current action, position, and other state variables.
Calculates the appropriate interaction type (e.g., punch, kick, ground pound) that should result from Mario's contact with the specified object (`o`).
Useful for handling different types of player-object collisions, attacks, and object behaviors
|descriptionEnd| */
u32 determine_interaction(struct MarioState *m, struct Object *o); u32 determine_interaction(struct MarioState *m, struct Object *o);
u32 process_interaction(struct MarioState *m, u32 interactType, struct Object *o, u32 (*interact_function)(struct MarioState *, u32 interactType, struct Object *)); u32 process_interaction(struct MarioState *m, u32 interactType, struct Object *o, u32 (*interact_function)(struct MarioState *, u32 interactType, struct Object *));
#endif // INTERACTION_H #endif // INTERACTION_H