Fix HOOK_ON_WARP and document more functions (87.18%)

This commit is contained in:
Agent X 2025-05-01 20:26:04 -04:00
parent 7c33bbf2fa
commit ee7d694940
16 changed files with 502 additions and 145 deletions

View file

@ -4326,46 +4326,55 @@ function first_person_reset()
end
--- @param dialog integer
--- Creates a dialog box with a dialog ID that rotates into view
function create_dialog_box(dialog)
-- ...
end
--- @param dialog integer
--- @param dialogVar integer
--- Creates a dialog box with a dialog variable
function create_dialog_box_with_var(dialog, dialogVar)
-- ...
end
--- @param dialog integer
--- Creates a dialog box with a dialog ID that zooms into view
function create_dialog_inverted_box(dialog)
-- ...
end
--- @param dialog integer
--- Creates a dialog box with a response
function create_dialog_box_with_response(dialog)
-- ...
end
--- Resets the dialog box's state including dialog ID and open state
function reset_dialog_render_state()
-- ...
end
--- @param mode integer
--- Sets the in-game menu state. 0-1 is the courses box with the castle secret stars and 2-3 is the course completion screen.
function set_menu_mode(mode)
-- ...
end
--- @param width integer
--- Dialog box customization: Sets the minimum width for a dialog box
function set_min_dialog_width(width)
-- ...
end
--- @param x integer
--- @param y integer
--- Dialog box customization: Sets the override position for a dialog box
function set_dialog_override_pos(x, y)
-- ...
end
--- Dialog box customization: Resets the override position for a dialog box
function reset_dialog_override_pos()
-- ...
end
@ -4378,15 +4387,18 @@ end
--- @param textG integer
--- @param textB integer
--- @param textA integer
--- Dialog box customization: Sets the override color for a dialog box
function set_dialog_override_color(bgR, bgG, bgB, bgA, textR, textG, textB, textA)
-- ...
end
--- Dialog box customization: Resets the override color for a dialog box
function reset_dialog_override_color()
-- ...
end
--- @param state integer
--- Sets the state for a dialog box (`DIALOG_STATE_*`)
function set_dialog_box_state(state)
-- ...
end
@ -6043,12 +6055,14 @@ end
--- @param m MarioState
--- @return integer
--- Checks for and handles common conditions that would cancel Mario's current idle action.
function check_common_idle_cancels(m)
-- ...
end
--- @param m MarioState
--- @return integer
--- Checks for and handles common conditions that would cancel Mario's current idle holding object action.
function check_common_hold_idle_cancels(m)
-- ...
end
@ -6057,6 +6071,7 @@ end
--- @param actionState integer
--- @param animFrame integer
--- @param sound integer
--- Plays a `sound` if Mario's action state and animation frame match the parameters
function play_anim_sound(m, actionState, animFrame, sound)
-- ...
end
@ -6064,39 +6079,45 @@ end
--- @param m MarioState
--- @param animID integer
--- @param action integer
--- Runs a stationary step, sets the character animation, and changes action if the animation has ended
function stopping_step(m, animID, action)
-- ...
end
--- @param m MarioState
--- @param arg1 integer
--- @param animID integer
--- @param action integer
--- @return integer
function landing_step(m, arg1, action)
--- Runs a stationary step, sets the character animation, and changes action if the animation has ended
function landing_step(m, animID, action)
-- ...
end
--- @param m MarioState
--- @param action integer
--- @return integer
--- Checks for and handles common conditions that would cancel Mario's current landing action.
function check_common_landing_cancels(m, action)
-- ...
end
--- @param m MarioState
--- @return integer
--- Checks for and handles common conditions that would cancel Mario's current stationary action.
function check_common_stationary_cancels(m)
-- ...
end
--- @param m MarioState
--- @return integer
--- Executes Mario's current object action by first checking common stationary cancels, then updating quicksand state. Dispatches to the appropriate action function, such as idle, sleeping, crouching, ect
function mario_execute_stationary_action(m)
-- ...
end
--- @param m MarioState
--- @param particleFlag integer
--- Sets Mario's particle flags if he's at the surface of a water box
function set_swimming_at_surface_particles(m, particleFlag)
-- ...
end
@ -6104,29 +6125,34 @@ end
--- @param m MarioState
--- @param nextPos Vec3f
--- @return integer
--- Performs a full water movement step where ceilings, floors, and walls are handled. Generally, you should use `perform_water_step` for the full step functionality
function perform_water_full_step(m, nextPos)
-- ...
end
--- @param m MarioState
--- @param step Vec3f
--- Calculates a water current and outputs it in `step`
function apply_water_current(m, step)
-- ...
end
--- @param m MarioState
--- @return integer
--- Performs a water step
function perform_water_step(m)
-- ...
end
--- @param m MarioState
--- Controls the bobbing that happens when you swim near the water surface
function float_surface_gfx(m)
-- ...
end
--- @param m MarioState
--- @return integer
--- Executes Mario's current submerged action by first checking common submerged cancels, then setting quicksand depth and head angles to 0. Dispatches to the appropriate action function, such as breaststroke, flutterkick, water punch, ect
function mario_execute_submerged_action(m)
-- ...
end
@ -7200,16 +7226,19 @@ function spawn_orange_number(behParam, relX, relY, relZ)
end
--- @return integer
--- Checks if the current object's rendering is enabled
function obj_is_rendering_enabled()
-- ...
end
--- @return integer
--- Calculates the current object's theoretical pitch from forward velocity and vertical velocity
function obj_get_pitch_from_vel()
-- ...
end
--- @param distFromHome number
--- Sets the current object's position to the home with an additional forward vector multiplied by `distFromHome`
function obj_set_dist_from_home(distFromHome)
-- ...
end
@ -7218,6 +7247,7 @@ end
--- @param maxDist number
--- @param maxAngleDiff integer
--- @return integer
--- Checks if the current object is in `maxDist` to `m` and the angle difference is less than `maxAngleDiff`
function obj_is_near_to_and_facing_mario(m, maxDist, maxAngleDiff)
-- ...
end
@ -7226,62 +7256,72 @@ end
--- @param x number
--- @param y number
--- @param z number
--- Handles the platform on track's trajectory marker ball spawning
function platform_on_track_update_pos_or_spawn_ball(ballIndex, x, y, z)
-- ...
end
--- @param arg0 number
--- @param arg1 number
function cur_obj_spin_all_dimensions(arg0, arg1)
--- @param pitchSpeed number
--- @param rollSpeed number
--- Spins an object in every direction with `pitchSpeed` and `rollSpeed`
function cur_obj_spin_all_dimensions(pitchSpeed, rollSpeed)
-- ...
end
--- @param targetYaw integer
--- @param turnAmount integer
--- Approaches the current object's yaw to `targetYaw` by `turnAmount`
function obj_rotate_yaw_and_bounce_off_walls(targetYaw, turnAmount)
-- ...
end
--- @param latDistToHome number
--- @return integer
--- Gets the current object's theoretical pitch to the home with the lateral distance from it
function obj_get_pitch_to_home(latDistToHome)
-- ...
end
--- @param speed number
--- Computes the current object's forward vel and vertical velocity with the move angle pitch
function obj_compute_vel_from_move_pitch(speed)
-- ...
end
--- @param arg0 integer
function cur_obj_init_anim_extend(arg0)
--- @param animIndex integer
--- Initializes an animation for the current object and loops back around if the animation ends
function cur_obj_init_anim_extend(animIndex)
-- ...
end
--- @param arg0 integer
--- @param animIndex integer
--- @return integer
function cur_obj_init_anim_and_check_if_end(arg0)
--- Initializes an animation for the current object and returns if the animation has ended
function cur_obj_init_anim_and_check_if_end(animIndex)
-- ...
end
--- @param arg0 integer
--- @param arg1 integer
--- @param animIndex integer
--- @param animFrame integer
--- @return integer
function cur_obj_init_anim_check_frame(arg0, arg1)
--- Initializes an animation for the current object and checks if the animation frame is a specific frame
function cur_obj_init_anim_check_frame(animIndex, animFrame)
-- ...
end
--- @param arg0 integer
--- @param animIndex integer
--- @return integer
function cur_obj_set_anim_if_at_end(arg0)
--- Sets the current object's animation to a new animation if the current animation has ended
function cur_obj_set_anim_if_at_end(animIndex)
-- ...
end
--- @param arg0 integer
--- @param arg1 integer
--- @param startFrame integer
--- @param endFrame integer
--- @param sound integer
--- @return integer
function cur_obj_play_sound_at_anim_range(arg0, arg1, sound)
--- Plays a sound when the animation frame is in a range
function cur_obj_play_sound_at_anim_range(startFrame, endFrame, sound)
-- ...
end
@ -7289,6 +7329,7 @@ end
--- @param targetOffsetY number
--- @param turnAmount integer
--- @return integer
--- Turns the current object towards `m` by `turnAmount` and subtracts and adds `targetOffsetY` to the Y position, effectively cancelling any effect out
function obj_turn_pitch_toward_mario(m, targetOffsetY, turnAmount)
-- ...
end
@ -7297,6 +7338,7 @@ end
--- @param target number
--- @param delta number
--- @return integer
--- Approaches a `target` for `px` using `delta`
function approach_f32_ptr(px, target, delta)
-- ...
end
@ -7304,6 +7346,7 @@ end
--- @param target number
--- @param delta number
--- @return integer
--- Approaches a `target` value with the current object's forward velocity using `delta`
function obj_forward_vel_approach(target, delta)
-- ...
end
@ -7311,6 +7354,7 @@ end
--- @param target number
--- @param delta number
--- @return integer
--- Approaches a `target` value with the current object's vertical velocity using `delta`
function obj_y_vel_approach(target, delta)
-- ...
end
@ -7318,6 +7362,7 @@ end
--- @param target integer
--- @param delta integer
--- @return integer
--- Approaches a `target` value with the current object's move pitch using `delta`
function obj_move_pitch_approach(target, delta)
-- ...
end
@ -7325,6 +7370,7 @@ end
--- @param targetPitch integer
--- @param deltaPitch integer
--- @return integer
--- Approaches a `target` value with the current object's facing pitch using `delta`
function obj_face_pitch_approach(targetPitch, deltaPitch)
-- ...
end
@ -7332,6 +7378,7 @@ end
--- @param targetYaw integer
--- @param deltaYaw integer
--- @return integer
--- Approaches a `target` value with the current object's facing yaw using `delta`
function obj_face_yaw_approach(targetYaw, deltaYaw)
-- ...
end
@ -7339,6 +7386,7 @@ end
--- @param targetRoll integer
--- @param deltaRoll integer
--- @return integer
--- Approaches a `target` value with the current object's facing roll using `delta`
function obj_face_roll_approach(targetRoll, deltaRoll)
-- ...
end
@ -7358,6 +7406,7 @@ end
--- @param targetYaw integer
--- @param maxRoll integer
--- @param rollSpeed integer
--- Rolls the current object to the move angle subtracted by `targetYaw`, clamping between negative and positive `maxRoll` and using `rollSpeed`
function obj_roll_to_match_yaw_turn(targetYaw, maxRoll, rollSpeed)
-- ...
end
@ -7365,6 +7414,7 @@ end
--- @param base integer
--- @param range integer
--- @return integer
--- Generates a random offset with a base and range of `base` to `range`
function random_linear_offset(base, range)
-- ...
end
@ -7373,12 +7423,14 @@ end
--- @param step integer
--- @param mod integer
--- @return integer
--- Generates a random offset using step multiplied a value between 0 and `mod` (the random function goes to 65535 but wraps around to 0 at `mod`)
function random_mod_offset(base, step, mod)
-- ...
end
--- @param delta integer
--- @return integer
--- Rotates the current object's move angle yaw using `delta` in either a randomly decided positive or negative direction
function obj_random_fixed_turn(delta)
-- ...
end
@ -7387,6 +7439,7 @@ end
--- @param shootFireScale number
--- @param endScale number
--- @return integer
--- Begin by increasing the current object's scale by `*scaleVel`, and slowly decreasing `scaleVel`. Once the object starts to shrink, wait a bit, and then begin to scale the object toward `endScale`. The first time it reaches below `shootFireScale` during this time, return 1. Return -1 once it's reached endScale
function obj_grow_then_shrink(scaleVel, shootFireScale, endScale)
-- ...
end
@ -7412,12 +7465,14 @@ end
--- @param targetYaw Pointer_integer
--- @return integer
--- Resolves "collisions" with the current object and other objects by offsetting the current object's position
function obj_resolve_object_collisions(targetYaw)
-- ...
end
--- @param targetYaw Pointer_integer
--- @return integer
--- Bounces the current object off of walls, edges, and objects using `*targetYaw`
function obj_bounce_off_walls_edges_objects(targetYaw)
-- ...
end
@ -7425,23 +7480,28 @@ end
--- @param targetYaw integer
--- @param turnSpeed integer
--- @return integer
--- Resolves collisions and turns the current object towards `targetYaw` using `turnSpeed`
function obj_resolve_collisions_and_turn(targetYaw, turnSpeed)
-- ...
end
--- Spawns mist particles, plays a sound (`oDeathSound`,) spawns coins (`oNumLootCoins`,) and hides the object if the health is less than 0 or deletes the object if the health is 0 or higher
function obj_die_if_health_non_positive()
-- ...
end
--- Sets the current object's health to 0 and runs `obj_die_if_health_non_positive()`
function obj_unused_die()
-- ...
end
--- @param attackType integer
--- Sets the current object's action, forward velocity, and vertical velocity to preset values (`OBJ_ACT_*`)
function obj_set_knockback_action(attackType)
-- ...
end
--- Plays `SOUND_OBJ_STOMPED` and sets the current object's action to `OBJ_ACT_SQUISHED`
function obj_set_squished_action()
-- ...
end
@ -7478,12 +7538,14 @@ end
--- @param hitbox ObjectHitbox
--- @param attackedMarioAction integer
--- @return integer
--- Checks the current object's interaction status and sets action to `attackedMarioAction` if Mario has been attacked and runs `obj_die_if_health_non_positive()` if the object is attacked by Mario. Sets the hitbox parameters and resets interaction status to 0
function obj_check_attacks(hitbox, attackedMarioAction)
-- ...
end
--- @param endAction integer
--- @return integer
--- Moves the current object for specifically one second (`oTimer` < 30)
function obj_move_for_one_second(endAction)
-- ...
end
@ -7491,6 +7553,7 @@ end
--- @param threshold number
--- @param distanceToPlayer Pointer_integer
--- @param angleToPlayer Pointer_integer
--- Moves the current object for specifically one second (`oTimer` < 30)
function treat_far_home_as_mario(threshold, distanceToPlayer, angleToPlayer)
-- ...
end
@ -7516,6 +7579,7 @@ function clear_move_flag(bitSet, flag)
end
--- @param room integer
--- Overrides the current room Mario is in. Set to -1 to reset override
function set_room_override(room)
-- ...
end
@ -7755,6 +7819,7 @@ end
--- @param m Mat4
--- @param dst Vec3f
--- @param v Vec3f
--- Overrides the current room Mario is in. Set to -1 to reset override
function linear_mtxf_mul_vec3f(m, dst, v)
-- ...
end
@ -7762,6 +7827,7 @@ end
--- @param m Mat4
--- @param dst Vec3f
--- @param v Vec3f
--- Overrides the current room Mario is in. Set to -1 to reset override
function linear_mtxf_transpose_mul_vec3f(m, dst, v)
-- ...
end
@ -8052,6 +8118,7 @@ function cur_obj_clear_interact_status_flag(flag)
end
--- @param obj Object
--- Overrides the current room Mario is in. Set to -1 to reset override
function obj_mark_for_deletion(obj)
-- ...
end
@ -8391,6 +8458,7 @@ end
--- @param obj Object
--- @param posIndex integer
--- @param localTranslateIndex integer
--- Overrides the current room Mario is in. Set to -1 to reset override
function obj_translate_local(obj, posIndex, localTranslateIndex)
-- ...
end

View file

@ -146,6 +146,8 @@ bool DynOS_Warp_ToCastle(s32 aLevel) {
static void *DynOS_Warp_UpdateWarp(void *aCmd, bool aIsLevelInitDone) {
static s32 sDynosWarpTargetArea = -1;
static WarpDest sBackupWarpDest;
// Phase 1 - Clear the previous level and set up the new level
if (sDynosWarpTargetArea == -1) {
@ -190,6 +192,7 @@ static void *DynOS_Warp_UpdateWarp(void *aCmd, bool aIsLevelInitDone) {
sDynosWarpTargetArea = gCurrAreaIndex;
// Set up new level script
memcpy(&sBackupWarpDest, &sWarpDest, sizeof(WarpDest));
sWarpDest.type = 0;
sWarpDest.levelNum = 0;
sWarpDest.areaIdx = gCurrAreaIndex;
@ -260,7 +263,7 @@ static void *DynOS_Warp_UpdateWarp(void *aCmd, bool aIsLevelInitDone) {
}
// lua hooks
smlua_call_event_hooks_warp_params(HOOK_ON_WARP, sWarpDest.type, sDynosWarpLevelNum, sDynosWarpAreaNum, sDynosWarpNodeNum, sWarpDest.arg);
smlua_call_event_hooks_warp_params(HOOK_ON_WARP, sBackupWarpDest.type, sBackupWarpDest.levelNum, sBackupWarpDest.areaIdx, sBackupWarpDest.nodeId, sBackupWarpDest.arg);
// Reset values
sDynosWarpTargetArea = -1;
@ -309,6 +312,8 @@ static void *DynOS_Warp_UpdateExit(void *aCmd, bool aIsLevelInitDone) {
static s32 sDynosExitTargetArea = -1;
static s16 *sDynosExitTargetWarp = NULL;
static WarpDest sBackupWarpDest;
// Phase 0 - Wait for the Mario head transition to end
if (sDynosExitTargetArea == -1 && DynOS_IsTransitionActive()) {
return NULL;
@ -350,6 +355,7 @@ static void *DynOS_Warp_UpdateExit(void *aCmd, bool aIsLevelInitDone) {
sDynosExitTargetArea = _ExitWarp[8];
// Set up new level script
memcpy(&sBackupWarpDest, &sWarpDest, sizeof(WarpDest));
sWarpDest.type = 0;
sWarpDest.levelNum = 0;
sWarpDest.areaIdx = gCurrAreaIndex;
@ -405,7 +411,7 @@ static void *DynOS_Warp_UpdateExit(void *aCmd, bool aIsLevelInitDone) {
sDynosExitTargetWarp = NULL;
// lua hooks
smlua_call_event_hooks_warp_params(HOOK_ON_WARP, sWarpDest.type, sDynosWarpLevelNum, sDynosWarpAreaNum, sDynosWarpNodeNum, sWarpDest.arg);
smlua_call_event_hooks_warp_params(HOOK_ON_WARP, sBackupWarpDest.type, sBackupWarpDest.levelNum, sBackupWarpDest.areaIdx, sBackupWarpDest.nodeId, sBackupWarpDest.arg);
}
// Phase 4 - Unlock Mario as soon as the second transition is ended

View file

@ -4481,6 +4481,9 @@ Resets first person
## [create_dialog_box](#create_dialog_box)
### Description
Creates a dialog box with a dialog ID that rotates into view
### Lua Example
`create_dialog_box(dialog)`
@ -4501,6 +4504,9 @@ Resets first person
## [create_dialog_box_with_var](#create_dialog_box_with_var)
### Description
Creates a dialog box with a dialog variable
### Lua Example
`create_dialog_box_with_var(dialog, dialogVar)`
@ -4522,6 +4528,9 @@ Resets first person
## [create_dialog_inverted_box](#create_dialog_inverted_box)
### Description
Creates a dialog box with a dialog ID that zooms into view
### Lua Example
`create_dialog_inverted_box(dialog)`
@ -4542,6 +4551,9 @@ Resets first person
## [create_dialog_box_with_response](#create_dialog_box_with_response)
### Description
Creates a dialog box with a response
### Lua Example
`create_dialog_box_with_response(dialog)`
@ -4562,6 +4574,9 @@ Resets first person
## [reset_dialog_render_state](#reset_dialog_render_state)
### Description
Resets the dialog box's state including dialog ID and open state
### Lua Example
`reset_dialog_render_state()`
@ -4580,6 +4595,9 @@ Resets first person
## [set_menu_mode](#set_menu_mode)
### Description
Sets the in-game menu state. 0-1 is the courses box with the castle secret stars and 2-3 is the course completion screen.
### Lua Example
`set_menu_mode(mode)`
@ -4600,6 +4618,9 @@ Resets first person
## [set_min_dialog_width](#set_min_dialog_width)
### Description
Dialog box customization: Sets the minimum width for a dialog box
### Lua Example
`set_min_dialog_width(width)`
@ -4620,6 +4641,9 @@ Resets first person
## [set_dialog_override_pos](#set_dialog_override_pos)
### Description
Dialog box customization: Sets the override position for a dialog box
### Lua Example
`set_dialog_override_pos(x, y)`
@ -4641,6 +4665,9 @@ Resets first person
## [reset_dialog_override_pos](#reset_dialog_override_pos)
### Description
Dialog box customization: Resets the override position for a dialog box
### Lua Example
`reset_dialog_override_pos()`
@ -4659,6 +4686,9 @@ Resets first person
## [set_dialog_override_color](#set_dialog_override_color)
### Description
Dialog box customization: Sets the override color for a dialog box
### Lua Example
`set_dialog_override_color(bgR, bgG, bgB, bgA, textR, textG, textB, textA)`
@ -4686,6 +4716,9 @@ Resets first person
## [reset_dialog_override_color](#reset_dialog_override_color)
### Description
Dialog box customization: Resets the override color for a dialog box
### Lua Example
`reset_dialog_override_color()`
@ -4704,6 +4737,9 @@ Resets first person
## [set_dialog_box_state](#set_dialog_box_state)
### Description
Sets the state for a dialog box (`DIALOG_STATE_*`)
### Lua Example
`set_dialog_box_state(state)`

View file

@ -3336,6 +3336,9 @@ Executes Mario's current object action by first checking common object cancels,
## [check_common_idle_cancels](#check_common_idle_cancels)
### Description
Checks for and handles common conditions that would cancel Mario's current idle action.
### Lua Example
`local integerValue = check_common_idle_cancels(m)`
@ -3356,6 +3359,9 @@ Executes Mario's current object action by first checking common object cancels,
## [check_common_hold_idle_cancels](#check_common_hold_idle_cancels)
### Description
Checks for and handles common conditions that would cancel Mario's current idle holding object action.
### Lua Example
`local integerValue = check_common_hold_idle_cancels(m)`
@ -3376,6 +3382,9 @@ Executes Mario's current object action by first checking common object cancels,
## [play_anim_sound](#play_anim_sound)
### Description
Plays a `sound` if Mario's action state and animation frame match the parameters
### Lua Example
`play_anim_sound(m, actionState, animFrame, sound)`
@ -3399,6 +3408,9 @@ Executes Mario's current object action by first checking common object cancels,
## [stopping_step](#stopping_step)
### Description
Runs a stationary step, sets the character animation, and changes action if the animation has ended
### Lua Example
`stopping_step(m, animID, action)`
@ -3421,21 +3433,24 @@ Executes Mario's current object action by first checking common object cancels,
## [landing_step](#landing_step)
### Description
Runs a stationary step, sets the character animation, and changes action if the animation has ended
### Lua Example
`local integerValue = landing_step(m, arg1, action)`
`local integerValue = landing_step(m, animID, action)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| arg1 | `integer` |
| animID | `integer` |
| action | `integer` |
### Returns
- `integer`
### C Prototype
`s32 landing_step(struct MarioState *m, s32 arg1, u32 action);`
`s32 landing_step(struct MarioState *m, s32 animID, u32 action);`
[:arrow_up_small:](#)
@ -3443,6 +3458,9 @@ Executes Mario's current object action by first checking common object cancels,
## [check_common_landing_cancels](#check_common_landing_cancels)
### Description
Checks for and handles common conditions that would cancel Mario's current landing action.
### Lua Example
`local integerValue = check_common_landing_cancels(m, action)`
@ -3464,6 +3482,9 @@ Executes Mario's current object action by first checking common object cancels,
## [check_common_stationary_cancels](#check_common_stationary_cancels)
### Description
Checks for and handles common conditions that would cancel Mario's current stationary action.
### Lua Example
`local integerValue = check_common_stationary_cancels(m)`
@ -3484,6 +3505,9 @@ Executes Mario's current object action by first checking common object cancels,
## [mario_execute_stationary_action](#mario_execute_stationary_action)
### Description
Executes Mario's current object action by first checking common stationary cancels, then updating quicksand state. Dispatches to the appropriate action function, such as idle, sleeping, crouching, ect
### Lua Example
`local integerValue = mario_execute_stationary_action(m)`
@ -3510,6 +3534,9 @@ Executes Mario's current object action by first checking common object cancels,
## [set_swimming_at_surface_particles](#set_swimming_at_surface_particles)
### Description
Sets Mario's particle flags if he's at the surface of a water box
### Lua Example
`set_swimming_at_surface_particles(m, particleFlag)`
@ -3531,6 +3558,9 @@ Executes Mario's current object action by first checking common object cancels,
## [perform_water_full_step](#perform_water_full_step)
### Description
Performs a full water movement step where ceilings, floors, and walls are handled. Generally, you should use `perform_water_step` for the full step functionality
### Lua Example
`local integerValue = perform_water_full_step(m, nextPos)`
@ -3552,6 +3582,9 @@ Executes Mario's current object action by first checking common object cancels,
## [apply_water_current](#apply_water_current)
### Description
Calculates a water current and outputs it in `step`
### Lua Example
`apply_water_current(m, step)`
@ -3573,6 +3606,9 @@ Executes Mario's current object action by first checking common object cancels,
## [perform_water_step](#perform_water_step)
### Description
Performs a water step
### Lua Example
`local integerValue = perform_water_step(m)`
@ -3593,6 +3629,9 @@ Executes Mario's current object action by first checking common object cancels,
## [float_surface_gfx](#float_surface_gfx)
### Description
Controls the bobbing that happens when you swim near the water surface
### Lua Example
`float_surface_gfx(m)`
@ -3613,6 +3652,9 @@ Executes Mario's current object action by first checking common object cancels,
## [mario_execute_submerged_action](#mario_execute_submerged_action)
### Description
Executes Mario's current submerged action by first checking common submerged cancels, then setting quicksand depth and head angles to 0. Dispatches to the appropriate action function, such as breaststroke, flutterkick, water punch, ect
### Lua Example
`local integerValue = mario_execute_submerged_action(m)`

View file

@ -910,6 +910,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_is_rendering_enabled](#obj_is_rendering_enabled)
### Description
Checks if the current object's rendering is enabled
### Lua Example
`local integerValue = obj_is_rendering_enabled()`
@ -928,6 +931,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_get_pitch_from_vel](#obj_get_pitch_from_vel)
### Description
Calculates the current object's theoretical pitch from forward velocity and vertical velocity
### Lua Example
`local integerValue = obj_get_pitch_from_vel()`
@ -946,6 +952,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_set_dist_from_home](#obj_set_dist_from_home)
### Description
Sets the current object's position to the home with an additional forward vector multiplied by `distFromHome`
### Lua Example
`obj_set_dist_from_home(distFromHome)`
@ -966,6 +975,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_is_near_to_and_facing_mario](#obj_is_near_to_and_facing_mario)
### Description
Checks if the current object is in `maxDist` to `m` and the angle difference is less than `maxAngleDiff`
### Lua Example
`local integerValue = obj_is_near_to_and_facing_mario(m, maxDist, maxAngleDiff)`
@ -988,6 +1000,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [platform_on_track_update_pos_or_spawn_ball](#platform_on_track_update_pos_or_spawn_ball)
### Description
Handles the platform on track's trajectory marker ball spawning
### Lua Example
`platform_on_track_update_pos_or_spawn_ball(ballIndex, x, y, z)`
@ -1011,20 +1026,23 @@ Spawns an orange number object relatively, such as those that count up for secre
## [cur_obj_spin_all_dimensions](#cur_obj_spin_all_dimensions)
### Description
Spins an object in every direction with `pitchSpeed` and `rollSpeed`
### Lua Example
`cur_obj_spin_all_dimensions(arg0, arg1)`
`cur_obj_spin_all_dimensions(pitchSpeed, rollSpeed)`
### Parameters
| Field | Type |
| ----- | ---- |
| arg0 | `number` |
| arg1 | `number` |
| pitchSpeed | `number` |
| rollSpeed | `number` |
### Returns
- None
### C Prototype
`void cur_obj_spin_all_dimensions(f32 arg0, f32 arg1);`
`void cur_obj_spin_all_dimensions(f32 pitchSpeed, f32 rollSpeed);`
[:arrow_up_small:](#)
@ -1032,6 +1050,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_rotate_yaw_and_bounce_off_walls](#obj_rotate_yaw_and_bounce_off_walls)
### Description
Approaches the current object's yaw to `targetYaw` by `turnAmount`
### Lua Example
`obj_rotate_yaw_and_bounce_off_walls(targetYaw, turnAmount)`
@ -1053,6 +1074,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_get_pitch_to_home](#obj_get_pitch_to_home)
### Description
Gets the current object's theoretical pitch to the home with the lateral distance from it
### Lua Example
`local integerValue = obj_get_pitch_to_home(latDistToHome)`
@ -1073,6 +1097,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_compute_vel_from_move_pitch](#obj_compute_vel_from_move_pitch)
### Description
Computes the current object's forward vel and vertical velocity with the move angle pitch
### Lua Example
`obj_compute_vel_from_move_pitch(speed)`
@ -1093,19 +1120,22 @@ Spawns an orange number object relatively, such as those that count up for secre
## [cur_obj_init_anim_extend](#cur_obj_init_anim_extend)
### Description
Initializes an animation for the current object and loops back around if the animation ends
### Lua Example
`cur_obj_init_anim_extend(arg0)`
`cur_obj_init_anim_extend(animIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| arg0 | `integer` |
| animIndex | `integer` |
### Returns
- None
### C Prototype
`void cur_obj_init_anim_extend(s32 arg0);`
`void cur_obj_init_anim_extend(s32 animIndex);`
[:arrow_up_small:](#)
@ -1113,19 +1143,22 @@ Spawns an orange number object relatively, such as those that count up for secre
## [cur_obj_init_anim_and_check_if_end](#cur_obj_init_anim_and_check_if_end)
### Description
Initializes an animation for the current object and returns if the animation has ended
### Lua Example
`local integerValue = cur_obj_init_anim_and_check_if_end(arg0)`
`local integerValue = cur_obj_init_anim_and_check_if_end(animIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| arg0 | `integer` |
| animIndex | `integer` |
### Returns
- `integer`
### C Prototype
`s32 cur_obj_init_anim_and_check_if_end(s32 arg0);`
`s32 cur_obj_init_anim_and_check_if_end(s32 animIndex);`
[:arrow_up_small:](#)
@ -1133,20 +1166,23 @@ Spawns an orange number object relatively, such as those that count up for secre
## [cur_obj_init_anim_check_frame](#cur_obj_init_anim_check_frame)
### Description
Initializes an animation for the current object and checks if the animation frame is a specific frame
### Lua Example
`local integerValue = cur_obj_init_anim_check_frame(arg0, arg1)`
`local integerValue = cur_obj_init_anim_check_frame(animIndex, animFrame)`
### Parameters
| Field | Type |
| ----- | ---- |
| arg0 | `integer` |
| arg1 | `integer` |
| animIndex | `integer` |
| animFrame | `integer` |
### Returns
- `integer`
### C Prototype
`s32 cur_obj_init_anim_check_frame(s32 arg0, s32 arg1);`
`s32 cur_obj_init_anim_check_frame(s32 animIndex, s32 animFrame);`
[:arrow_up_small:](#)
@ -1154,19 +1190,22 @@ Spawns an orange number object relatively, such as those that count up for secre
## [cur_obj_set_anim_if_at_end](#cur_obj_set_anim_if_at_end)
### Description
Sets the current object's animation to a new animation if the current animation has ended
### Lua Example
`local integerValue = cur_obj_set_anim_if_at_end(arg0)`
`local integerValue = cur_obj_set_anim_if_at_end(animIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| arg0 | `integer` |
| animIndex | `integer` |
### Returns
- `integer`
### C Prototype
`s32 cur_obj_set_anim_if_at_end(s32 arg0);`
`s32 cur_obj_set_anim_if_at_end(s32 animIndex);`
[:arrow_up_small:](#)
@ -1174,21 +1213,24 @@ Spawns an orange number object relatively, such as those that count up for secre
## [cur_obj_play_sound_at_anim_range](#cur_obj_play_sound_at_anim_range)
### Description
Plays a sound when the animation frame is in a range
### Lua Example
`local integerValue = cur_obj_play_sound_at_anim_range(arg0, arg1, sound)`
`local integerValue = cur_obj_play_sound_at_anim_range(startFrame, endFrame, sound)`
### Parameters
| Field | Type |
| ----- | ---- |
| arg0 | `integer` |
| arg1 | `integer` |
| startFrame | `integer` |
| endFrame | `integer` |
| sound | `integer` |
### Returns
- `integer`
### C Prototype
`s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound);`
`s32 cur_obj_play_sound_at_anim_range(s8 startFrame, s8 endFrame, u32 sound);`
[:arrow_up_small:](#)
@ -1196,6 +1238,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_turn_pitch_toward_mario](#obj_turn_pitch_toward_mario)
### Description
Turns the current object towards `m` by `turnAmount` and subtracts and adds `targetOffsetY` to the Y position, effectively cancelling any effect out
### Lua Example
`local integerValue = obj_turn_pitch_toward_mario(m, targetOffsetY, turnAmount)`
@ -1218,6 +1263,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [approach_f32_ptr](#approach_f32_ptr)
### Description
Approaches a `target` for `px` using `delta`
### Lua Example
`local integerValue = approach_f32_ptr(px, target, delta)`
@ -1240,6 +1288,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_forward_vel_approach](#obj_forward_vel_approach)
### Description
Approaches a `target` value with the current object's forward velocity using `delta`
### Lua Example
`local integerValue = obj_forward_vel_approach(target, delta)`
@ -1261,6 +1312,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_y_vel_approach](#obj_y_vel_approach)
### Description
Approaches a `target` value with the current object's vertical velocity using `delta`
### Lua Example
`local integerValue = obj_y_vel_approach(target, delta)`
@ -1282,6 +1336,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_move_pitch_approach](#obj_move_pitch_approach)
### Description
Approaches a `target` value with the current object's move pitch using `delta`
### Lua Example
`local integerValue = obj_move_pitch_approach(target, delta)`
@ -1303,6 +1360,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_face_pitch_approach](#obj_face_pitch_approach)
### Description
Approaches a `target` value with the current object's facing pitch using `delta`
### Lua Example
`local integerValue = obj_face_pitch_approach(targetPitch, deltaPitch)`
@ -1324,6 +1384,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_face_yaw_approach](#obj_face_yaw_approach)
### Description
Approaches a `target` value with the current object's facing yaw using `delta`
### Lua Example
`local integerValue = obj_face_yaw_approach(targetYaw, deltaYaw)`
@ -1345,6 +1408,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_face_roll_approach](#obj_face_roll_approach)
### Description
Approaches a `target` value with the current object's facing roll using `delta`
### Lua Example
`local integerValue = obj_face_roll_approach(targetRoll, deltaRoll)`
@ -1392,6 +1458,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_roll_to_match_yaw_turn](#obj_roll_to_match_yaw_turn)
### Description
Rolls the current object to the move angle subtracted by `targetYaw`, clamping between negative and positive `maxRoll` and using `rollSpeed`
### Lua Example
`obj_roll_to_match_yaw_turn(targetYaw, maxRoll, rollSpeed)`
@ -1414,6 +1483,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [random_linear_offset](#random_linear_offset)
### Description
Generates a random offset with a base and range of `base` to `range`
### Lua Example
`local integerValue = random_linear_offset(base, range)`
@ -1435,6 +1507,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [random_mod_offset](#random_mod_offset)
### Description
Generates a random offset using step multiplied a value between 0 and `mod` (the random function goes to 65535 but wraps around to 0 at `mod`)
### Lua Example
`local integerValue = random_mod_offset(base, step, mod)`
@ -1457,6 +1532,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_random_fixed_turn](#obj_random_fixed_turn)
### Description
Rotates the current object's move angle yaw using `delta` in either a randomly decided positive or negative direction
### Lua Example
`local integerValue = obj_random_fixed_turn(delta)`
@ -1477,6 +1555,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_grow_then_shrink](#obj_grow_then_shrink)
### Description
Begin by increasing the current object's scale by `*scaleVel`, and slowly decreasing `scaleVel`. Once the object starts to shrink, wait a bit, and then begin to scale the object toward `endScale`. The first time it reaches below `shootFireScale` during this time, return 1. Return -1 once it's reached endScale
### Lua Example
`local integerValue = obj_grow_then_shrink(scaleVel, shootFireScale, endScale)`
@ -1547,6 +1628,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_resolve_object_collisions](#obj_resolve_object_collisions)
### Description
Resolves "collisions" with the current object and other objects by offsetting the current object's position
### Lua Example
`local integerValue = obj_resolve_object_collisions(targetYaw)`
@ -1567,6 +1651,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_bounce_off_walls_edges_objects](#obj_bounce_off_walls_edges_objects)
### Description
Bounces the current object off of walls, edges, and objects using `*targetYaw`
### Lua Example
`local integerValue = obj_bounce_off_walls_edges_objects(targetYaw)`
@ -1587,6 +1674,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_resolve_collisions_and_turn](#obj_resolve_collisions_and_turn)
### Description
Resolves collisions and turns the current object towards `targetYaw` using `turnSpeed`
### Lua Example
`local integerValue = obj_resolve_collisions_and_turn(targetYaw, turnSpeed)`
@ -1608,6 +1698,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_die_if_health_non_positive](#obj_die_if_health_non_positive)
### Description
Spawns mist particles, plays a sound (`oDeathSound`,) spawns coins (`oNumLootCoins`,) and hides the object if the health is less than 0 or deletes the object if the health is 0 or higher
### Lua Example
`obj_die_if_health_non_positive()`
@ -1626,6 +1719,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_unused_die](#obj_unused_die)
### Description
Sets the current object's health to 0 and runs `obj_die_if_health_non_positive()`
### Lua Example
`obj_unused_die()`
@ -1644,6 +1740,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_set_knockback_action](#obj_set_knockback_action)
### Description
Sets the current object's action, forward velocity, and vertical velocity to preset values (`OBJ_ACT_*`)
### Lua Example
`obj_set_knockback_action(attackType)`
@ -1664,6 +1763,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_set_squished_action](#obj_set_squished_action)
### Description
Plays `SOUND_OBJ_STOMPED` and sets the current object's action to `OBJ_ACT_SQUISHED`
### Lua Example
`obj_set_squished_action()`
@ -1782,6 +1884,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_check_attacks](#obj_check_attacks)
### Description
Checks the current object's interaction status and sets action to `attackedMarioAction` if Mario has been attacked and runs `obj_die_if_health_non_positive()` if the object is attacked by Mario. Sets the hitbox parameters and resets interaction status to 0
### Lua Example
`local integerValue = obj_check_attacks(hitbox, attackedMarioAction)`
@ -1803,6 +1908,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_move_for_one_second](#obj_move_for_one_second)
### Description
Moves the current object for specifically one second (`oTimer` < 30)
### Lua Example
`local integerValue = obj_move_for_one_second(endAction)`
@ -1823,6 +1931,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [treat_far_home_as_mario](#treat_far_home_as_mario)
### Description
Moves the current object for specifically one second (`oTimer` < 30)
### Lua Example
`treat_far_home_as_mario(threshold, distanceToPlayer, angleToPlayer)`
@ -1899,6 +2010,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [set_room_override](#set_room_override)
### Description
Overrides the current room Mario is in. Set to -1 to reset override
### Lua Example
`set_room_override(room)`
@ -2633,6 +2747,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [linear_mtxf_mul_vec3f](#linear_mtxf_mul_vec3f)
### Description
Overrides the current room Mario is in. Set to -1 to reset override
### Lua Example
`linear_mtxf_mul_vec3f(m, dst, v)`
@ -2655,6 +2772,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [linear_mtxf_transpose_mul_vec3f](#linear_mtxf_transpose_mul_vec3f)
### Description
Overrides the current room Mario is in. Set to -1 to reset override
### Lua Example
`linear_mtxf_transpose_mul_vec3f(m, dst, v)`
@ -3693,6 +3813,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_mark_for_deletion](#obj_mark_for_deletion)
### Description
Overrides the current room Mario is in. Set to -1 to reset override
### Lua Example
`obj_mark_for_deletion(obj)`
@ -4888,6 +5011,9 @@ Spawns an orange number object relatively, such as those that count up for secre
## [obj_translate_local](#obj_translate_local)
### Description
Overrides the current room Mario is in. Set to -1 to reset override
### Lua Example
`obj_translate_local(obj, posIndex, localTranslateIndex)`

View file

@ -3526,7 +3526,6 @@ s16 render_course_complete_screen(void) {
return 0;
}
// Only case 1 and 2 are used
s16 render_menus_and_dialogs(void) {
s16 mode = 0;

View file

@ -158,11 +158,19 @@ s16 get_str_x_pos_from_center_scale(s16 centerPos, u8 *str, f32 scale);
void print_hud_my_score_coins(s32 useCourseCoinScore, s8 fileNum, s8 courseNum, s16 x, s16 y);
void int_to_str(s32 num, u8 *dst);
s16 get_dialog_id(void);
/* |description|Creates a dialog box with a dialog ID that rotates into view|descriptionEnd| */
void create_dialog_box(s16 dialog);
/* |description|Creates a dialog box with a dialog variable|descriptionEnd| */
void create_dialog_box_with_var(s16 dialog, s32 dialogVar);
/* |description|Creates a dialog box with a dialog ID that zooms into view|descriptionEnd| */
void create_dialog_inverted_box(s16 dialog);
/* |description|Creates a dialog box with a response|descriptionEnd| */
void create_dialog_box_with_response(s16 dialog);
/* |description|Resets the dialog box's state including dialog ID and open state|descriptionEnd| */
void reset_dialog_render_state(void);
/* |description|
Sets the in-game menu state. 0-1 is the courses box with the castle secret stars and 2-3 is the course completion screen.
|descriptionEnd| */
void set_menu_mode(s16 mode);
void reset_cutscene_msg_fade(void);
void dl_rgba16_begin_cutscene_msg_fade(void);
@ -174,11 +182,17 @@ void render_hud_cannon_reticle(void);
void reset_red_coins_collected(void);
s16 render_menus_and_dialogs(void);
void create_dl_scale_matrix(s8 pushOp, f32 x, f32 y, f32 z);
/* |description|Dialog box customization: Sets the minimum width for a dialog box|descriptionEnd| */
void set_min_dialog_width(s16 width);
/* |description|Dialog box customization: Sets the override position for a dialog box|descriptionEnd| */
void set_dialog_override_pos(s16 x, s16 y);
/* |description|Dialog box customization: Resets the override position for a dialog box|descriptionEnd| */
void reset_dialog_override_pos();
/* |description|Dialog box customization: Sets the override color for a dialog box|descriptionEnd| */
void set_dialog_override_color(u8 bgR, u8 bgG, u8 bgB, u8 bgA, u8 textR, u8 textG, u8 textB, u8 textA);
/* |description|Dialog box customization: Resets the override color for a dialog box|descriptionEnd| */
void reset_dialog_override_color();
/* |description|Sets the state for a dialog box (`DIALOG_STATE_*`)|descriptionEnd| */
void set_dialog_box_state(u8 state);
#endif // INGAME_MENU_H

View file

@ -419,6 +419,7 @@ void init_mario_after_warp(void) {
if (spawnNode == NULL || spawnNode->object == NULL) { return; }
u32 marioSpawnType = get_mario_spawn_type(spawnNode->object);
u8 warpType = sWarpDest.type;
if (gMarioState && gMarioState->action != ACT_UNINITIALIZED) {
for (s32 i = 0; i < MAX_PLAYERS; i++) {
@ -547,7 +548,7 @@ void init_mario_after_warp(void) {
gMarioState->skipWarpInteractionsTimer = 30;
}
smlua_call_event_hooks_warp_params(HOOK_ON_WARP, sWarpDest.type, sWarpDest.levelNum, sWarpDest.areaIdx, sWarpDest.nodeId, sWarpDest.arg);
smlua_call_event_hooks_warp_params(HOOK_ON_WARP, warpType, sWarpDest.levelNum, sWarpDest.areaIdx, sWarpDest.nodeId, sWarpDest.arg);
}
// used for warps inside one level

View file

@ -22,7 +22,9 @@
#include "pc/lua/smlua.h"
#include "hardcoded.h"
/* |description||descriptionEnd| */
/* |description|
Checks for and handles common conditions that would cancel Mario's current idle action.
|descriptionEnd| */
s32 check_common_idle_cancels(struct MarioState *m) {
if (!m) { return 0; }
mario_drop_held_object(m);
@ -66,7 +68,9 @@ s32 check_common_idle_cancels(struct MarioState *m) {
return FALSE;
}
/* |description||descriptionEnd| */
/* |description|
Checks for and handles common conditions that would cancel Mario's current idle holding object action.
|descriptionEnd| */
s32 check_common_hold_idle_cancels(struct MarioState *m) {
if (!m) { return 0; }
if (m->floor && m->floor->normal.y < 0.29237169f) {
@ -188,7 +192,7 @@ s32 act_idle(struct MarioState *m) {
return FALSE;
}
/* |description||descriptionEnd| */
/* |description|Plays a `sound` if Mario's action state and animation frame match the parameters|descriptionEnd| */
void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound) {
if (!m) { return; }
if (!m->marioObj) { return; }
@ -656,7 +660,7 @@ s32 act_hold_panting_unused(struct MarioState *m) {
return FALSE;
}
/* |description||descriptionEnd| */
/* |description|Runs a stationary step, sets the character animation, and changes action if the animation has ended|descriptionEnd| */
void stopping_step(struct MarioState *m, s32 animID, u32 action) {
stationary_ground_step(m);
set_character_animation(m, animID);
@ -880,17 +884,19 @@ s32 act_shockwave_bounce(struct MarioState *m) {
return FALSE;
}
/* |description||descriptionEnd| */
s32 landing_step(struct MarioState *m, s32 arg1, u32 action) {
/* |description|Runs a stationary step, sets the character animation, and changes action if the animation has ended|descriptionEnd| */
s32 landing_step(struct MarioState *m, s32 animID, u32 action) {
stationary_ground_step(m);
set_character_animation(m, arg1);
set_character_animation(m, animID);
if (is_anim_at_end(m)) {
return set_mario_action(m, action, 0);
}
return FALSE;
}
/* |description||descriptionEnd| */
/* |description|
Checks for and handles common conditions that would cancel Mario's current landing action.
|descriptionEnd| */
s32 check_common_landing_cancels(struct MarioState *m, u32 action) {
if (!m) { return 0; }
if (m->input & INPUT_UNKNOWN_10) {
@ -1154,7 +1160,9 @@ s32 act_first_person(struct MarioState *m) {
return FALSE;
}
/* |description||descriptionEnd| */
/* |description|
Checks for and handles common conditions that would cancel Mario's current stationary action.
|descriptionEnd| */
s32 check_common_stationary_cancels(struct MarioState *m) {
if (!m) { return 0; }
if (m->playerIndex != 0) { return FALSE; }
@ -1186,7 +1194,10 @@ s32 check_common_stationary_cancels(struct MarioState *m) {
return FALSE;
}
/* |description||descriptionEnd| */
/* |description|
Executes Mario's current object action by first checking common stationary cancels, then updating quicksand state.
Dispatches to the appropriate action function, such as idle, sleeping, crouching, ect
|descriptionEnd| */
s32 mario_execute_stationary_action(struct MarioState *m) {
if (!m) { return FALSE; }
s32 cancel;

View file

@ -28,7 +28,7 @@ s32 act_stop_crouching(struct MarioState *m);
s32 act_start_crawling(struct MarioState *m);
s32 act_stop_crawling(struct MarioState *m);
s32 act_shockwave_bounce(struct MarioState *m);
s32 landing_step(struct MarioState *m, s32 arg1, u32 action);
s32 landing_step(struct MarioState *m, s32 animID, u32 action);
s32 check_common_landing_cancels(struct MarioState *m, u32 action);
s32 act_jump_land_stop(struct MarioState *m);
s32 act_double_jump_land_stop(struct MarioState *m);

View file

@ -36,10 +36,11 @@ static s16 sSwimStrength[MAX_PLAYERS] = { MIN_SWIM_STRENGTH, MIN_SWIM_STRENGTH,
static s16 sWaterCurrentSpeeds[] = { 28, 12, 8, 4 };
static s16 D_80339FD0;
static s16 D_80339FD2;
static f32 D_80339FD4;
static s16 sBobTimer;
static s16 sBobIncrement;
static f32 sBobHeight;
/* |description|Sets Mario's particle flags if he's at the surface of a water box|descriptionEnd| */
void set_swimming_at_surface_particles(struct MarioState *m, u32 particleFlag) {
if (!m) { return; }
s16 atSurface = m->pos[1] >= m->waterLevel - 130;
@ -83,6 +84,7 @@ static f32 get_buoyancy(struct MarioState *m) {
return buoyancy;
}
/* |description|Performs a full water movement step where ceilings, floors, and walls are handled. Generally, you should use `perform_water_step` for the full step functionality|descriptionEnd| */
u32 perform_water_full_step(struct MarioState *m, Vec3f nextPos) {
if (!m) { return 0; }
struct WallCollisionData wcd = { 0 };
@ -133,6 +135,7 @@ u32 perform_water_full_step(struct MarioState *m, Vec3f nextPos) {
}
}
/* |description|Calculates a water current and outputs it in `step`|descriptionEnd| */
void apply_water_current(struct MarioState *m, Vec3f step) {
if (!m) { return; }
s32 i;
@ -183,6 +186,7 @@ void apply_water_current(struct MarioState *m, Vec3f step) {
}
}
/* |description|Performs a water step|descriptionEnd| */
u32 perform_water_step(struct MarioState *m) {
if (!m) { return 0; }
UNUSED u32 unused;
@ -455,21 +459,22 @@ static s32 act_hold_water_action_end(struct MarioState *m) {
static void reset_float_globals(struct MarioState *m) {
if (!m) { return; }
D_80339FD0 = 0;
D_80339FD2 = 0x800;
D_80339FD4 = m->faceAngle[0] / 256.0f + 20.0f;
sBobTimer = 0;
sBobIncrement = 0x800;
sBobHeight = m->faceAngle[0] / 256.0f + 20.0f;
}
/* |description|Controls the bobbing that happens when you swim near the water surface|descriptionEnd| */
void float_surface_gfx(struct MarioState *m) {
if (!m) { return; }
if (D_80339FD2 != 0 && m->pos[1] > m->waterLevel - 85 && m->faceAngle[0] >= 0) {
if ((D_80339FD0 += D_80339FD2) >= 0) {
m->marioObj->header.gfx.pos[1] += D_80339FD4 * sins(D_80339FD0);
if (sBobIncrement != 0 && m->pos[1] > m->waterLevel - 85 && m->faceAngle[0] >= 0) {
if ((sBobTimer += sBobIncrement) >= 0) {
m->marioObj->header.gfx.pos[1] += sBobHeight * sins(sBobTimer);
return;
}
}
D_80339FD2 = 0;
sBobIncrement = 0;
}
static void common_swimming_step(struct MarioState *m, s16 swimStrength) {
@ -1099,7 +1104,7 @@ static s32 act_water_plunge(struct MarioState *m) {
set_mario_action(m, ACT_HOLD_METAL_WATER_FALLING, 0);
break;
}
D_80339FD2 = 0;
sBobIncrement = 0;
}
switch (stateFlags) {
@ -1649,6 +1654,10 @@ static s32 check_common_submerged_cancels(struct MarioState *m) {
return FALSE;
}
/* |description|
Executes Mario's current submerged action by first checking common submerged cancels, then setting quicksand depth and head angles to 0.
Dispatches to the appropriate action function, such as breaststroke, flutterkick, water punch, ect
|descriptionEnd| */
s32 mario_execute_submerged_action(struct MarioState *m) {
if (!m) { return FALSE; }
s32 cancel;

View file

@ -82,6 +82,7 @@ f32 sObjSavedPosZ;
void wiggler_jumped_on_attack_handler(void);
void huge_goomba_weakly_attacked(void);
/* |description|Checks if the current object's rendering is enabled|descriptionEnd| */
s32 obj_is_rendering_enabled(void) {
if (!o) { return 0; }
if (o->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) {
@ -91,6 +92,7 @@ s32 obj_is_rendering_enabled(void) {
}
}
/* |description|Calculates the current object's theoretical pitch from forward velocity and vertical velocity|descriptionEnd| */
s16 obj_get_pitch_from_vel(void) {
if (!o) { return 0; }
return -atan2s(o->oForwardVel, o->oVelY);
@ -114,12 +116,14 @@ static s32 obj_update_race_proposition_dialog(struct MarioState* m, s16 dialogID
return dialogResponse;
}
/* |description|Sets the current object's position to the home with an additional forward vector multiplied by `distFromHome` |descriptionEnd| */
void obj_set_dist_from_home(f32 distFromHome) {
if (!o) { return; }
o->oPosX = o->oHomeX + distFromHome * coss(o->oMoveAngleYaw);
o->oPosZ = o->oHomeZ + distFromHome * sins(o->oMoveAngleYaw);
}
/* |description|Checks if the current object is in `maxDist` to `m` and the angle difference is less than `maxAngleDiff`|descriptionEnd| */
s32 obj_is_near_to_and_facing_mario(struct MarioState* m, f32 maxDist, s16 maxAngleDiff) {
if (!o || !m) { return 0; }
struct Object* player = m->marioObj;
@ -157,6 +161,7 @@ static BAD_RETURN(u32) obj_perform_position_op(s32 op) {
}
}
/* |description|Handles the platform on track's trajectory marker ball spawning|descriptionEnd| */
void platform_on_track_update_pos_or_spawn_ball(s32 ballIndex, f32 x, f32 y, f32 z) {
if (!o) { return; }
struct Object *trackBall = NULL;
@ -254,62 +259,64 @@ void platform_on_track_update_pos_or_spawn_ball(s32 ballIndex, f32 x, f32 y, f32
}
}
void cur_obj_spin_all_dimensions(f32 arg0, f32 arg1) {
/* |description|Spins an object in every direction with `pitchSpeed` and `rollSpeed`|descriptionEnd| */
void cur_obj_spin_all_dimensions(f32 pitchSpeed, f32 rollSpeed) {
if (!o) { return; }
f32 val24;
f32 val20;
f32 val1C;
f32 c;
f32 s;
f32 val10;
f32 val0C;
f32 val08;
f32 val04;
f32 val00;
f32 roll;
f32 upwardOffset;
f32 pitch;
f32 cosAngle;
f32 sinAngle;
f32 finalOffsetX;
f32 finalOffsetY;
f32 finalOffsetZ;
f32 tempOffsetX;
f32 tempOffsetZ;
if (o->oForwardVel == 0.0f) {
val24 = val20 = val1C = 0.0f;
roll = upwardOffset = pitch = 0.0f;
if (o->oMoveFlags & OBJ_MOVE_IN_AIR) {
val20 = 50.0f;
upwardOffset = 50.0f;
} else {
if (o->oFaceAnglePitch < 0) {
val1C = -arg0;
pitch = -pitchSpeed;
} else if (o->oFaceAnglePitch > 0) {
val1C = arg0;
pitch = pitchSpeed;
}
if (o->oFaceAngleRoll < 0) {
val24 = -arg1;
roll = -rollSpeed;
} else if (o->oFaceAngleRoll > 0) {
val24 = arg1;
roll = rollSpeed;
}
}
c = coss(o->oFaceAnglePitch);
s = sins(o->oFaceAnglePitch);
val08 = val1C * c + val20 * s;
val0C = val20 * c - val1C * s;
cosAngle = coss(o->oFaceAnglePitch);
sinAngle = sins(o->oFaceAnglePitch);
finalOffsetZ = pitch * cosAngle + upwardOffset * sinAngle;
finalOffsetY = upwardOffset * cosAngle - pitch * sinAngle;
c = coss(o->oFaceAngleRoll);
s = sins(o->oFaceAngleRoll);
val04 = val24 * c + val0C * s;
val0C = val0C * c - val24 * s;
cosAngle = coss(o->oFaceAngleRoll);
sinAngle = sins(o->oFaceAngleRoll);
tempOffsetX = roll * cosAngle + finalOffsetY * sinAngle;
finalOffsetY = finalOffsetY * cosAngle - roll * sinAngle;
c = coss(o->oFaceAngleYaw);
s = sins(o->oFaceAngleYaw);
val10 = val04 * c - val08 * s;
val08 = val08 * c + val04 * s;
cosAngle = coss(o->oFaceAngleYaw);
sinAngle = sins(o->oFaceAngleYaw);
finalOffsetX = tempOffsetX * cosAngle - finalOffsetZ * sinAngle;
finalOffsetZ = finalOffsetZ * cosAngle + tempOffsetX * sinAngle;
val04 = val24 * c - val1C * s;
val00 = val1C * c + val24 * s;
tempOffsetX = roll * cosAngle - pitch * sinAngle;
tempOffsetZ = pitch * cosAngle + roll * sinAngle;
o->oPosX = o->oHomeX - val04 + val10;
o->oGraphYOffset = val20 - val0C;
o->oPosZ = o->oHomeZ + val00 - val08;
o->oPosX = o->oHomeX - tempOffsetX + finalOffsetX;
o->oGraphYOffset = upwardOffset - finalOffsetY;
o->oPosZ = o->oHomeZ + tempOffsetZ - finalOffsetZ;
}
}
/* |description|Approaches the current object's yaw to `targetYaw` by `turnAmount`|descriptionEnd| */
void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount) {
if (!o) { return; }
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
@ -318,11 +325,13 @@ void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount) {
cur_obj_rotate_yaw_toward(targetYaw, turnAmount);
}
/* |description|Gets the current object's theoretical pitch to the home with the lateral distance from it|descriptionEnd| */
s16 obj_get_pitch_to_home(f32 latDistToHome) {
if (!o) { return 0; }
return atan2s(latDistToHome, o->oPosY - o->oHomeY);
}
/* |description|Computes the current object's forward vel and vertical velocity with the move angle pitch|descriptionEnd| */
void obj_compute_vel_from_move_pitch(f32 speed) {
if (!o) { return; }
o->oForwardVel = speed * coss(o->oMoveAnglePitch);
@ -353,30 +362,35 @@ static s32 clamp_f32(f32 *value, f32 minimum, f32 maximum) {
return TRUE;
}
void cur_obj_init_anim_extend(s32 arg0) {
cur_obj_init_animation_with_sound(arg0);
/* |description|Initializes an animation for the current object and loops back around if the animation ends|descriptionEnd| */
void cur_obj_init_anim_extend(s32 animIndex) {
cur_obj_init_animation_with_sound(animIndex);
cur_obj_extend_animation_if_at_end();
}
s32 cur_obj_init_anim_and_check_if_end(s32 arg0) {
cur_obj_init_animation_with_sound(arg0);
/* |description|Initializes an animation for the current object and returns if the animation has ended|descriptionEnd| */
s32 cur_obj_init_anim_and_check_if_end(s32 animIndex) {
cur_obj_init_animation_with_sound(animIndex);
return cur_obj_check_if_near_animation_end();
}
s32 cur_obj_init_anim_check_frame(s32 arg0, s32 arg1) {
cur_obj_init_animation_with_sound(arg0);
return cur_obj_check_anim_frame(arg1);
/* |description|Initializes an animation for the current object and checks if the animation frame is a specific frame|descriptionEnd| */
s32 cur_obj_init_anim_check_frame(s32 animIndex, s32 animFrame) {
cur_obj_init_animation_with_sound(animIndex);
return cur_obj_check_anim_frame(animFrame);
}
s32 cur_obj_set_anim_if_at_end(s32 arg0) {
/* |description|Sets the current object's animation to a new animation if the current animation has ended|descriptionEnd| */
s32 cur_obj_set_anim_if_at_end(s32 animIndex) {
if (cur_obj_check_if_at_animation_end()) {
cur_obj_init_animation_with_sound(arg0);
cur_obj_init_animation_with_sound(animIndex);
return TRUE;
}
return FALSE;
}
s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound) {
/* |description|Plays a sound when the animation frame is in a range|descriptionEnd| */
s32 cur_obj_play_sound_at_anim_range(s8 startFrame, s8 endFrame, u32 sound) {
if (!o) { return 0; }
s32 val04;
@ -384,7 +398,7 @@ s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound) {
val04 = 1;
}
if (cur_obj_check_anim_frame_in_range(arg0, val04) || cur_obj_check_anim_frame_in_range(arg1, val04)) {
if (cur_obj_check_anim_frame_in_range(startFrame, val04) || cur_obj_check_anim_frame_in_range(endFrame, val04)) {
cur_obj_play_sound_2(sound);
return TRUE;
}
@ -392,6 +406,7 @@ s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound) {
return FALSE;
}
/* |description|Turns the current object towards `m` by `turnAmount` and subtracts and adds `targetOffsetY` to the Y position, effectively cancelling any effect out|descriptionEnd| */
s16 obj_turn_pitch_toward_mario(struct MarioState* m, f32 targetOffsetY, s16 turnAmount) {
if (!o) { return 0; }
if (!m) { return 0; }
@ -404,6 +419,7 @@ s16 obj_turn_pitch_toward_mario(struct MarioState* m, f32 targetOffsetY, s16 tur
return targetPitch;
}
/* |description|Approaches a `target` for `px` using `delta`|descriptionEnd| */
s32 approach_f32_ptr(f32 *px, f32 target, f32 delta) {
if (!px) { return FALSE; }
if (*px > target) {
@ -419,16 +435,19 @@ s32 approach_f32_ptr(f32 *px, f32 target, f32 delta) {
return FALSE;
}
/* |description|Approaches a `target` value with the current object's forward velocity using `delta`|descriptionEnd| */
s32 obj_forward_vel_approach(f32 target, f32 delta) {
if (!o) { return 0; }
return approach_f32_ptr(&o->oForwardVel, target, delta);
}
/* |description|Approaches a `target` value with the current object's vertical velocity using `delta`|descriptionEnd| */
s32 obj_y_vel_approach(f32 target, f32 delta) {
if (!o) { return 0; }
return approach_f32_ptr(&o->oVelY, target, delta);
}
/* |description|Approaches a `target` value with the current object's move pitch using `delta`|descriptionEnd| */
s32 obj_move_pitch_approach(s16 target, s16 delta) {
if (!o) { return 0; }
o->oMoveAnglePitch = approach_s16_symmetric(o->oMoveAnglePitch, target, delta);
@ -440,6 +459,7 @@ s32 obj_move_pitch_approach(s16 target, s16 delta) {
return FALSE;
}
/* |description|Approaches a `target` value with the current object's facing pitch using `delta`|descriptionEnd| */
s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch) {
if (!o) { return 0; }
o->oFaceAnglePitch = approach_s16_symmetric(o->oFaceAnglePitch, targetPitch, deltaPitch);
@ -451,6 +471,7 @@ s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch) {
return FALSE;
}
/* |description|Approaches a `target` value with the current object's facing yaw using `delta`|descriptionEnd| */
s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw) {
if (!o) { return 0; }
o->oFaceAngleYaw = approach_s16_symmetric(o->oFaceAngleYaw, targetYaw, deltaYaw);
@ -462,6 +483,7 @@ s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw) {
return FALSE;
}
/* |description|Approaches a `target` value with the current object's facing roll using `delta`|descriptionEnd| */
s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll) {
if (!o) { return 0; }
o->oFaceAngleRoll = approach_s16_symmetric(o->oFaceAngleRoll, targetRoll, deltaRoll);
@ -473,6 +495,7 @@ s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll) {
return FALSE;
}
/* |description|Smoothly turns the `angle` integer pointer using parameters, although usage in Lua is difficult due to the amount of pointers needed|descriptionEnd| */
s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion,
s16 accel, s16 minSpeed, s16 maxSpeed) {
s16 currentSpeed;
@ -488,6 +511,7 @@ s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedP
return (s16)(*angle) == targetAngle;
}
/* |description|Rolls the current object to the move angle subtracted by `targetYaw`, clamping between negative and positive `maxRoll` and using `rollSpeed`|descriptionEnd| */
void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed) {
if (!o) { return; }
s16 targetRoll = o->oMoveAngleYaw - targetYaw;
@ -495,27 +519,30 @@ void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed) {
obj_face_roll_approach(targetRoll, rollSpeed);
}
/* |description|Generates a random offset with a base and range of `base` to `range`|descriptionEnd| */
s16 random_linear_offset(s16 base, s16 range) {
return base + (s16)(range * random_float());
}
/* |description|Generates a random offset using step multiplied a value between 0 and `mod` (the random function goes to 65535 but wraps around to 0 at `mod`)|descriptionEnd| */
s16 random_mod_offset(s16 base, s16 step, s16 mod) {
if (!mod) { return 0; }
return base + step * (random_u16() % mod);
}
/* |description|Rotates the current object's move angle yaw using `delta` in either a randomly decided positive or negative direction|descriptionEnd| */
s16 obj_random_fixed_turn(s16 delta) {
if (!o) { return 0; }
return o->oMoveAngleYaw + (s16) random_sign() * delta;
}
/**
* Begin by increasing the object's scale by *scaleVel, and slowly decreasing
* scaleVel. Once the object starts to shrink, wait a bit, and then begin to
* scale the object toward endScale. The first time it reaches below
* shootFireScale during this time, return 1.
* Return -1 once it's reached endScale.
*/
/* |description|
Begin by increasing the current object's scale by `*scaleVel`, and slowly decreasing
`scaleVel`. Once the object starts to shrink, wait a bit, and then begin to
scale the object toward `endScale`. The first time it reaches below
`shootFireScale` during this time, return 1.
Return -1 once it's reached endScale
|descriptionEnd| */
s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale) {
if (!o) { return 0; }
if (o->oTimer < 2) {
@ -536,6 +563,7 @@ s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale) {
return 0;
}
/* |description||descriptionEnd| */
s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel,
f32 slowdown) {
if (value == NULL || vel == NULL) { return FALSE; }
@ -562,6 +590,7 @@ s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 a
return FALSE;
}
/* |description|Update the current object's blinking through `oAnimState`|descriptionEnd| */
void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange,
s16 blinkLength) {
if (!o) { return; }
@ -578,6 +607,7 @@ void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRa
}
}
/* |description|Resolves "collisions" with the current object and other objects by offsetting the current object's position|descriptionEnd| */
s32 obj_resolve_object_collisions(s32 *targetYaw) {
if (!o) { return 0; }
struct Object *otherObject;
@ -625,6 +655,7 @@ s32 obj_resolve_object_collisions(s32 *targetYaw) {
return FALSE;
}
/* |description|Bounces the current object off of walls, edges, and objects using `*targetYaw`|descriptionEnd| */
s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw) {
if (!o) { return 0; }
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
@ -638,6 +669,7 @@ s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw) {
return TRUE;
}
/* |description|Resolves collisions and turns the current object towards `targetYaw` using `turnSpeed`|descriptionEnd| */
s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed) {
obj_resolve_object_collisions(NULL);
@ -648,6 +680,7 @@ s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed) {
}
}
/* |description|Spawns mist particles, plays a sound (`oDeathSound`,) spawns coins (`oNumLootCoins`,) and hides the object if the health is less than 0 or deletes the object if the health is 0 or higher|descriptionEnd| */
void obj_die_if_health_non_positive(void) {
if (!o) { return; }
if (o->oHealth <= 0 || o->oSyncDeath) {
@ -676,12 +709,14 @@ void obj_die_if_health_non_positive(void) {
}
}
/* |description|Sets the current object's health to 0 and runs `obj_die_if_health_non_positive()`|descriptionEnd| */
void obj_unused_die(void) {
if (!o) { return; }
o->oHealth = 0;
obj_die_if_health_non_positive();
}
/* |description|Sets the current object's action, forward velocity, and vertical velocity to preset values (`OBJ_ACT_*`)|descriptionEnd| */
void obj_set_knockback_action(s32 attackType) {
if (!o) { return; }
switch (attackType) {
@ -707,12 +742,14 @@ void obj_set_knockback_action(s32 attackType) {
}
}
/* |description|Plays `SOUND_OBJ_STOMPED` and sets the current object's action to `OBJ_ACT_SQUISHED`|descriptionEnd| */
void obj_set_squished_action(void) {
if (!o) { return; }
cur_obj_play_sound_2(SOUND_OBJ_STOMPED);
o->oAction = OBJ_ACT_SQUISHED;
}
/* |description||descriptionEnd| */
s32 obj_die_if_above_lava_and_health_non_positive(void) {
if (!o) { return 0; }
if (o->oMoveFlags & OBJ_MOVE_UNDERWATER_ON_GROUND) {
@ -863,6 +900,7 @@ s32 obj_update_standard_actions(f32 scale) {
}
}
/* |description|Checks the current object's interaction status and sets action to `attackedMarioAction` if Mario has been attacked and runs `obj_die_if_health_non_positive()` if the object is attacked by Mario. Sets the hitbox parameters and resets interaction status to 0|descriptionEnd| */
s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction) {
if (!o) { return 0; }
s32 attackType;
@ -890,6 +928,7 @@ s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction) {
return 0;
}
/* |description|Moves the current object for specifically one second (`oTimer` < 30)|descriptionEnd| */
s32 obj_move_for_one_second(s32 endAction) {
if (!o) { return 0; }
cur_obj_update_floor_and_walls();

View file

@ -187,6 +187,7 @@ Gfx *geo_switch_anim_state(s32 callContext, struct GraphNode *node) {
s16 gRoomOverride = -1;
/* |description|Overrides the current room Mario is in. Set to -1 to reset override|descriptionEnd| */
void set_room_override(s16 room) {
gRoomOverride = room;
}

View file

@ -275,7 +275,11 @@ static void crash_handler_add_info_str(CrashHandlerText** pTextP, f32 x, f32 y,
static void crash_handler_add_version_str(CrashHandlerText** pTextP, f32 x, f32 y) {
CrashHandlerText* pText = *pTextP;
crash_handler_add_info_str(&pText, x, y, "Version", SM64COOPDX_VERSION);
#ifdef DEVELOPMENT
crash_handler_add_info_str(&pText, x, y, "Dev Build", SM64COOPDX_VERSION);
#else
crash_handler_add_info_str(&pText, x, y, "Release", SM64COOPDX_VERSION);
#endif
crash_handler_add_info_str(&pText, x, y + 8, "Renderer", RAPI_NAME);
*pTextP = pText;
}
@ -706,6 +710,7 @@ struct PcDebug gPcDebug = {
0x0E76DE227D813019,
0x12ABA8362D430002,
0x0BF8F9C076430007,
0x0BFA2492BA430011
},
.id = DEFAULT_ID,
.bhvOffset = /* 0x12 */ 0,

View file

@ -7,7 +7,7 @@
#define MIXER 0x3DCE3B097C30006
struct PcDebug {
u64 tags[17];
u64 tags[18];
u64 id;
u64 bhvOffset;
s64 debugId;

View file

@ -18584,13 +18584,13 @@ int smlua_func_landing_step(lua_State* L) {
if (lua_isnil(L, 1)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "landing_step"); return 0; }
s32 arg1 = smlua_to_integer(L, 2);
s32 animID = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "landing_step"); return 0; }
u32 action = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "landing_step"); return 0; }
extern s32 landing_step(struct MarioState *m, s32 arg1, u32 action);
lua_pushinteger(L, landing_step(m, arg1, action));
extern s32 landing_step(struct MarioState *m, s32 animID, u32 action);
lua_pushinteger(L, landing_step(m, animID, action));
return 1;
}
@ -22164,13 +22164,13 @@ int smlua_func_cur_obj_spin_all_dimensions(lua_State* L) {
return 0;
}
f32 arg0 = smlua_to_number(L, 1);
f32 pitchSpeed = smlua_to_number(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_spin_all_dimensions"); return 0; }
f32 arg1 = smlua_to_number(L, 2);
f32 rollSpeed = smlua_to_number(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_spin_all_dimensions"); return 0; }
extern void cur_obj_spin_all_dimensions(f32 arg0, f32 arg1);
cur_obj_spin_all_dimensions(arg0, arg1);
extern void cur_obj_spin_all_dimensions(f32 pitchSpeed, f32 rollSpeed);
cur_obj_spin_all_dimensions(pitchSpeed, rollSpeed);
return 1;
}
@ -22240,11 +22240,11 @@ int smlua_func_cur_obj_init_anim_extend(lua_State* L) {
return 0;
}
s32 arg0 = smlua_to_integer(L, 1);
s32 animIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_anim_extend"); return 0; }
extern void cur_obj_init_anim_extend(s32 arg0);
cur_obj_init_anim_extend(arg0);
extern void cur_obj_init_anim_extend(s32 animIndex);
cur_obj_init_anim_extend(animIndex);
return 1;
}
@ -22258,11 +22258,11 @@ int smlua_func_cur_obj_init_anim_and_check_if_end(lua_State* L) {
return 0;
}
s32 arg0 = smlua_to_integer(L, 1);
s32 animIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_anim_and_check_if_end"); return 0; }
extern s32 cur_obj_init_anim_and_check_if_end(s32 arg0);
lua_pushinteger(L, cur_obj_init_anim_and_check_if_end(arg0));
extern s32 cur_obj_init_anim_and_check_if_end(s32 animIndex);
lua_pushinteger(L, cur_obj_init_anim_and_check_if_end(animIndex));
return 1;
}
@ -22276,13 +22276,13 @@ int smlua_func_cur_obj_init_anim_check_frame(lua_State* L) {
return 0;
}
s32 arg0 = smlua_to_integer(L, 1);
s32 animIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_anim_check_frame"); return 0; }
s32 arg1 = smlua_to_integer(L, 2);
s32 animFrame = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_init_anim_check_frame"); return 0; }
extern s32 cur_obj_init_anim_check_frame(s32 arg0, s32 arg1);
lua_pushinteger(L, cur_obj_init_anim_check_frame(arg0, arg1));
extern s32 cur_obj_init_anim_check_frame(s32 animIndex, s32 animFrame);
lua_pushinteger(L, cur_obj_init_anim_check_frame(animIndex, animFrame));
return 1;
}
@ -22296,11 +22296,11 @@ int smlua_func_cur_obj_set_anim_if_at_end(lua_State* L) {
return 0;
}
s32 arg0 = smlua_to_integer(L, 1);
s32 animIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_anim_if_at_end"); return 0; }
extern s32 cur_obj_set_anim_if_at_end(s32 arg0);
lua_pushinteger(L, cur_obj_set_anim_if_at_end(arg0));
extern s32 cur_obj_set_anim_if_at_end(s32 animIndex);
lua_pushinteger(L, cur_obj_set_anim_if_at_end(animIndex));
return 1;
}
@ -22314,15 +22314,15 @@ int smlua_func_cur_obj_play_sound_at_anim_range(lua_State* L) {
return 0;
}
s8 arg0 = smlua_to_integer(L, 1);
s8 startFrame = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_play_sound_at_anim_range"); return 0; }
s8 arg1 = smlua_to_integer(L, 2);
s8 endFrame = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_play_sound_at_anim_range"); return 0; }
u32 sound = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_play_sound_at_anim_range"); return 0; }
extern s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound);
lua_pushinteger(L, cur_obj_play_sound_at_anim_range(arg0, arg1, sound));
extern s32 cur_obj_play_sound_at_anim_range(s8 startFrame, s8 endFrame, u32 sound);
lua_pushinteger(L, cur_obj_play_sound_at_anim_range(startFrame, endFrame, sound));
return 1;
}