Document more functions! (83%)
Some checks failed
Build coop / build-ubuntu (push) Has been cancelled
Build coop / build-windows (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled

This commit is contained in:
Agent X 2025-04-25 17:02:46 -04:00
parent 29f9e7cfcb
commit 5d5147cb0e
33 changed files with 2847 additions and 2711 deletions

View file

@ -87,7 +87,7 @@ override_allowed_functions = {
"src/game/platform_displacement.h": [ "apply_platform_displacement" ], "src/game/platform_displacement.h": [ "apply_platform_displacement" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*", "geo_get_.*_state" ], "src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*", "geo_get_.*_state" ],
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running", "fade_into_special_warp", "get_instant_warp" ], "src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running", "fade_into_special_warp", "get_instant_warp" ],
"src/game/area.h": [ "area_get_warp_node" ], "src/game/area.h": [ "get_mario_spawn_type", "area_get_warp_node", "area_get_any_warp_node", "play_transition" ],
"src/engine/level_script.h": [ "area_create_warp_node" ], "src/engine/level_script.h": [ "area_create_warp_node" ],
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color", "set_menu_mode", "create_dialog_box", "create_dialog_box_with_var", "create_dialog_inverted_box", "create_dialog_box_with_response", "reset_dialog_render_state", "set_dialog_box_state", ], "src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color", "set_menu_mode", "create_dialog_box", "create_dialog_box_with_var", "create_dialog_inverted_box", "create_dialog_box_with_response", "reset_dialog_render_state", "set_dialog_box_state", ],
"src/audio/seqplayer.h": [ "sequence_player_set_tempo", "sequence_player_set_tempo_acc", "sequence_player_set_transposition", "sequence_player_get_tempo", "sequence_player_get_tempo_acc", "sequence_player_get_transposition", "sequence_player_get_volume", "sequence_player_get_fade_volume", "sequence_player_get_mute_volume_scale" ] "src/audio/seqplayer.h": [ "sequence_player_set_tempo", "sequence_player_set_tempo_acc", "sequence_player_set_transposition", "sequence_player_get_tempo", "sequence_player_get_tempo_acc", "sequence_player_get_transposition", "sequence_player_get_volume", "sequence_player_get_fade_volume", "sequence_player_get_mute_volume_scale" ]
@ -96,7 +96,7 @@ override_allowed_functions = {
override_disallowed_functions = { override_disallowed_functions = {
"src/audio/external.h": [ " func_" ], "src/audio/external.h": [ " func_" ],
"src/engine/math_util.h": [ "atan2f", "vec3s_sub" ], "src/engine/math_util.h": [ "atan2f", "vec3s_sub" ],
"src/engine/surface_load.h": [ "alloc_surface_pools", "clear_dynamic_surfaces" ], "src/engine/surface_load.h": [ "load_area_terrain", "alloc_surface_pools", "clear_dynamic_surfaces", "get_area_terrain_size" ],
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ], "src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ], "src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ], "src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
@ -114,8 +114,9 @@ override_disallowed_functions = {
"src/pc/network/network_utils.h": [ "network_get_player_text_color[^_]" ], "src/pc/network/network_utils.h": [ "network_get_player_text_color[^_]" ],
"src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update", "construct_player_popup", "network_player_name_valid" ], "src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update", "construct_player_popup", "network_player_name_valid" ],
"src/game/object_helpers.c": [ "spawn_obj", "^bhv_", "abs[fi]", "^bit_shift", "_debug$", "^stub_", "_set_model", "cur_obj_set_direction_table", "cur_obj_progress_direction_table" ], "src/game/object_helpers.c": [ "spawn_obj", "^bhv_", "abs[fi]", "^bit_shift", "_debug$", "^stub_", "_set_model", "cur_obj_set_direction_table", "cur_obj_progress_direction_table" ],
"src/game/obj_behaviors.c": [ "debug_" ], "src/game/obj_behaviors.c": [ "debug_", "turn_obj_away_from_surface" ],
"src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ], "src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ],
"src/game/spawn_sound.h": [ "exec_anim_sound_state" ],
"src/game/level_info.h": [ "_name_table" ], "src/game/level_info.h": [ "_name_table" ],
"src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ], "src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ],
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline", "romhack_camera_init_settings", "romhack_camera_reset_settings" ], "src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline", "romhack_camera_init_settings", "romhack_camera_reset_settings" ],
@ -1003,6 +1004,8 @@ def build_function(function, do_extern):
if function['description'] != "": if function['description'] != "":
global total_doc_functions global total_doc_functions
total_doc_functions += 1 total_doc_functions += 1
else:
print(function['filename'] + ": " + function['line'])
return s + "\n" return s + "\n"

View file

@ -1,5 +1,12 @@
-- AUTOGENERATED FOR CODE EDITORS -- -- AUTOGENERATED FOR CODE EDITORS --
--- @param o Object
--- @return MarioSpawnType
--- Derives a `MARIO_SPAWN_*` constant from `o`
function get_mario_spawn_type(o)
-- ...
end
--- @param id integer --- @param id integer
--- @return ObjectWarpNode --- @return ObjectWarpNode
--- Finds a warp node in the current area by its ID. The warp node must exist in the list of warp nodes for the current area. Useful for locating a specific warp point in the level, such as teleportation zones or connections to other areas --- Finds a warp node in the current area by its ID. The warp node must exist in the list of warp nodes for the current area. Useful for locating a specific warp point in the level, such as teleportation zones or connections to other areas
@ -7,6 +14,12 @@ function area_get_warp_node(id)
-- ... -- ...
end end
--- @return ObjectWarpNode
--- Gets the first warp node found in the area, otherwise returns nil
function area_get_any_warp_node()
-- ...
end
--- @param o Object --- @param o Object
--- @return ObjectWarpNode --- @return ObjectWarpNode
--- Finds a warp node in the current area using parameters from the provided object. The object's behavior parameters are used to determine the warp node ID. Useful for associating an object (like a door or warp pipe) with its corresponding warp node in the area --- Finds a warp node in the current area using parameters from the provided object. The object's behavior parameters are used to determine the warp node ID. Useful for associating an object (like a door or warp pipe) with its corresponding warp node in the area
@ -14,6 +27,27 @@ function area_get_warp_node_from_params(o)
-- ... -- ...
end end
--- @param transType integer
--- @param time integer
--- @param red integer
--- @param green integer
--- @param blue integer
--- Plays a screen transition
function play_transition(transType, time, red, green, blue)
-- ...
end
--- @param transType integer
--- @param time integer
--- @param red integer
--- @param green integer
--- @param blue integer
--- @param delay integer
--- Plays a screen transition after a `delay` in frames
function play_transition_after_delay(transType, time, red, green, blue, delay)
-- ...
end
--- @param count integer --- @param count integer
--- @param offsetY integer --- @param offsetY integer
--- @param size number --- @param size number
@ -3563,6 +3597,7 @@ function next_lakitu_state(newPos, newFoc, curPos, curFoc, oldPos, oldFoc, yaw)
end end
--- @param preset integer --- @param preset integer
--- Set the fixed camera base pos depending on the current level area
function set_fixed_cam_axis_sa_lobby(preset) function set_fixed_cam_axis_sa_lobby(preset)
-- ... -- ...
end end
@ -3713,6 +3748,7 @@ end
--- @param m MarioState --- @param m MarioState
--- @return Character --- @return Character
--- Gets a Character struct from `m`
function get_character(m) function get_character(m)
-- ... -- ...
end end
@ -4238,12 +4274,14 @@ function play_toads_jingle()
end end
--- @param seqId integer --- @param seqId integer
--- Resets a sequence's (`seqId`) volume back to the default volume
function sound_reset_background_music_default_volume(seqId) function sound_reset_background_music_default_volume(seqId)
-- ... -- ...
end end
--- @param seqId integer --- @param seqId integer
--- @param volume integer --- @param volume integer
--- Sets a sequence's (`seqId`) volume to `volume`
function sound_set_background_music_default_volume(seqId, volume) function sound_set_background_music_default_volume(seqId, volume)
-- ... -- ...
end end
@ -4251,12 +4289,14 @@ end
--- @param x number --- @param x number
--- @param z number --- @param z number
--- @return number --- @return number
--- Gets a sound left/right pan using `x` and `z`
function get_sound_pan(x, z) function get_sound_pan(x, z)
-- ... -- ...
end end
--- @param distance number --- @param distance number
--- @return number --- @return number
--- Gets a sound level intensity based on `distance`
function sound_get_level_intensity(distance) function sound_get_level_intensity(distance)
-- ... -- ...
end end
@ -4787,6 +4827,7 @@ end
--- @param areaIndex integer --- @param areaIndex integer
--- @param charCase integer --- @param charCase integer
--- @return Pointer_integer --- @return Pointer_integer
--- Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an SM64 encoded string. This function should not be used in Lua mods. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
function get_level_name_sm64(courseNum, levelNum, areaIndex, charCase) function get_level_name_sm64(courseNum, levelNum, areaIndex, charCase)
-- ... -- ...
end end
@ -4813,6 +4854,7 @@ end
--- @param starNum integer --- @param starNum integer
--- @param charCase integer --- @param charCase integer
--- @return Pointer_integer --- @return Pointer_integer
--- Returns the name of the star corresponding to `courseNum` and `starNum` as an SM64 encoded string. This function should not be used in Lua mods. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
function get_star_name_sm64(courseNum, starNum, charCase) function get_star_name_sm64(courseNum, starNum, charCase)
-- ... -- ...
end end
@ -5683,6 +5725,7 @@ end
--- @param target2 integer --- @param target2 integer
--- @param target3 integer --- @param target3 integer
--- @param endAction integer --- @param endAction integer
--- Handles the cutscene and animation sequence for when Mario is stuck in the ground (head, butt, or feet). Plays a designated `animation`, checks specific frames (`unstuckFrame`, `target2`, `target3`) for sound effects or transitions, and frees Mario to the `endAction` once the animation completes
function stuck_in_ground_handler(m, animation, unstuckFrame, target2, target3, endAction) function stuck_in_ground_handler(m, animation, unstuckFrame, target2, target3, endAction)
-- ... -- ...
end end
@ -6506,6 +6549,7 @@ end
--- @param dist number --- @param dist number
--- @param pitch integer --- @param pitch integer
--- @param yaw integer --- @param yaw integer
--- Positions the point `to` at a given `dist`, `pitch`, and `yaw` relative to the point `from`. This can be used to place objects around a reference point at specific angles and distances
function vec3f_set_dist_and_angle(from, to, dist, pitch, yaw) function vec3f_set_dist_and_angle(from, to, dist, pitch, yaw)
-- ... -- ...
end end
@ -6728,6 +6772,7 @@ function mod_storage_clear()
end end
--- @return integer --- @return integer
--- Gets the amount of players connected
function network_player_connected_count() function network_player_connected_count()
-- ... -- ...
end end
@ -6738,18 +6783,21 @@ end
--- @param g integer --- @param g integer
--- @param b integer --- @param b integer
--- @param a integer --- @param a integer
--- Sets the description field of `np`
function network_player_set_description(np, description, r, g, b, a) function network_player_set_description(np, description, r, g, b, a)
-- ... -- ...
end end
--- @param np NetworkPlayer --- @param np NetworkPlayer
--- @param location string --- @param location string
--- Overrides the location of `np`
function network_player_set_override_location(np, location) function network_player_set_override_location(np, location)
-- ... -- ...
end end
--- @param globalIndex integer --- @param globalIndex integer
--- @return NetworkPlayer --- @return NetworkPlayer
--- Gets a network player from `globalIndex`
function network_player_from_global_index(globalIndex) function network_player_from_global_index(globalIndex)
-- ... -- ...
end end
@ -6758,6 +6806,7 @@ end
--- @param actNum integer --- @param actNum integer
--- @param levelNum integer --- @param levelNum integer
--- @return NetworkPlayer --- @return NetworkPlayer
--- Gets the first network player whose information matches `courseNum`, `actNum`, and `levelNum`
function get_network_player_from_level(courseNum, actNum, levelNum) function get_network_player_from_level(courseNum, actNum, levelNum)
-- ... -- ...
end end
@ -6767,11 +6816,13 @@ end
--- @param levelNum integer --- @param levelNum integer
--- @param areaIndex integer --- @param areaIndex integer
--- @return NetworkPlayer --- @return NetworkPlayer
--- Gets the first network player whose information matches `courseNum`, `actNum`, `levelNum`, and `areaIndex`
function get_network_player_from_area(courseNum, actNum, levelNum, areaIndex) function get_network_player_from_area(courseNum, actNum, levelNum, areaIndex)
-- ... -- ...
end end
--- @return NetworkPlayer --- @return NetworkPlayer
--- Gets the active network player with the smallest global index. Useful for assigning one player to "own" some kind of functionality or object
function get_network_player_smallest_global() function get_network_player_smallest_global()
-- ... -- ...
end end
@ -6780,6 +6831,7 @@ end
--- @param part PlayerPart --- @param part PlayerPart
--- @param index integer --- @param index integer
--- @return integer --- @return integer
--- Gets a red, green, or blue value from a part in `np`'s color palette
function network_player_get_palette_color_channel(np, part, index) function network_player_get_palette_color_channel(np, part, index)
-- ... -- ...
end end
@ -6788,6 +6840,7 @@ end
--- @param part PlayerPart --- @param part PlayerPart
--- @param index integer --- @param index integer
--- @return integer --- @return integer
--- Gets a red, green, or blue value from a part in `np`'s override color palette
function network_player_get_override_palette_color_channel(np, part, index) function network_player_get_override_palette_color_channel(np, part, index)
-- ... -- ...
end end
@ -6795,17 +6848,20 @@ end
--- @param np NetworkPlayer --- @param np NetworkPlayer
--- @param part PlayerPart --- @param part PlayerPart
--- @param color Color --- @param color Color
--- Sets the `part in `np`'s override color palette`
function network_player_set_override_palette_color(np, part, color) function network_player_set_override_palette_color(np, part, color)
-- ... -- ...
end end
--- @param np NetworkPlayer --- @param np NetworkPlayer
--- Resets `np`'s override color palette
function network_player_reset_override_palette(np) function network_player_reset_override_palette(np)
-- ... -- ...
end end
--- @param np NetworkPlayer --- @param np NetworkPlayer
--- @return boolean --- @return boolean
--- Checks if `np`'s override color palette is identical to the regular color palette
function network_player_is_override_palette_same(np) function network_player_is_override_palette_same(np)
-- ... -- ...
end end
@ -6856,33 +6912,25 @@ function network_discord_id_from_local_index(localIndex)
-- ... -- ...
end end
--- Resets Yoshi as being alive
function set_yoshi_as_not_dead() function set_yoshi_as_not_dead()
-- ... -- ...
end end
--- @param f number --- @param f number
--- @return number --- @return number
--- An absolute value (always positive) function.
function absf_2(f) function absf_2(f)
-- ... -- ...
end end
--- @param velX number
--- @param velZ number
--- @param nX number
--- @param nY number
--- @param nZ number
--- @param objYawX Pointer_number
--- @param objYawZ Pointer_number
function turn_obj_away_from_surface(velX, velZ, nX, nY, nZ, objYawX, objYawZ)
-- ...
end
--- @param objNewX number --- @param objNewX number
--- @param objY number --- @param objY number
--- @param objNewZ number --- @param objNewZ number
--- @param objVelX number --- @param objVelX number
--- @param objVelZ number --- @param objVelZ number
--- @return integer --- @return integer
--- Finds any wall collisions, applies them, and turns away from the surface.
function obj_find_wall(objNewX, objY, objNewZ, objVelX, objVelZ) function obj_find_wall(objNewX, objY, objNewZ, objVelX, objVelZ)
-- ... -- ...
end end
@ -6892,6 +6940,7 @@ end
--- @param objVelX number --- @param objVelX number
--- @param objVelZ number --- @param objVelZ number
--- @return integer --- @return integer
--- Turns an object away from steep floors, similarly to walls.
function turn_obj_away_from_steep_floor(objFloor, floorY, objVelX, objVelZ) function turn_obj_away_from_steep_floor(objFloor, floorY, objVelX, objVelZ)
-- ... -- ...
end end
@ -6900,12 +6949,14 @@ end
--- @param normalX number --- @param normalX number
--- @param normalY number --- @param normalY number
--- @param normalZ number --- @param normalZ number
--- Orients an object with the given normals, typically the surface under the object.
function obj_orient_graph(obj, normalX, normalY, normalZ) function obj_orient_graph(obj, normalX, normalY, normalZ)
-- ... -- ...
end end
--- @param objFriction Pointer_number --- @param objFriction Pointer_number
--- @param floor_nY number --- @param floor_nY number
--- Orients an object with the given normals, typically the surface under the object.
function calc_obj_friction(objFriction, floor_nY) function calc_obj_friction(objFriction, floor_nY)
-- ... -- ...
end end
@ -6914,6 +6965,7 @@ end
--- @param objFloorY number --- @param objFloorY number
--- @param objVelX number --- @param objVelX number
--- @param objVelZ number --- @param objVelZ number
--- Updates an objects speed for gravity and updates Y position.
function calc_new_obj_vel_and_pos_y(objFloor, objFloorY, objVelX, objVelZ) function calc_new_obj_vel_and_pos_y(objFloor, objFloorY, objVelX, objVelZ)
-- ... -- ...
end end
@ -6923,31 +6975,37 @@ end
--- @param objVelX number --- @param objVelX number
--- @param objVelZ number --- @param objVelZ number
--- @param waterY number --- @param waterY number
--- Adjusts the current object's veloicty and y position for being underwater
function calc_new_obj_vel_and_pos_y_underwater(objFloor, floorY, objVelX, objVelZ, waterY) function calc_new_obj_vel_and_pos_y_underwater(objFloor, floorY, objVelX, objVelZ, waterY)
-- ... -- ...
end end
--- Updates an objects position from oForwardVel and oMoveAngleYaw.
function obj_update_pos_vel_xz() function obj_update_pos_vel_xz()
-- ... -- ...
end end
--- @param waterY integer --- @param waterY integer
--- @param objY integer --- @param objY integer
--- Generates splashes if at surface of water, entering water, or bubbles if underwater
function obj_splash(waterY, objY) function obj_splash(waterY, objY)
-- ... -- ...
end end
--- @return integer --- @return integer
--- Generic object move function. Handles walls, water, floors, and gravity. Returns flags for certain interactions
function object_step() function object_step()
-- ... -- ...
end end
--- @return integer --- @return integer
--- Takes an object step but does not orient with the object's floor. Used for boulders, falling pillars, and the rolling snowman body
function object_step_without_floor_orient() function object_step_without_floor_orient()
-- ... -- ...
end end
--- @param obj Object --- @param obj Object
--- Don't use this function outside of of a context where the current object and `obj` are the same. Moves `obj` based on a seemingly random mix of using either the current obj or `obj`'s fields
function obj_move_xyz_using_fvel_and_yaw(obj) function obj_move_xyz_using_fvel_and_yaw(obj)
-- ... -- ...
end end
@ -6957,6 +7015,7 @@ end
--- @param z number --- @param z number
--- @param dist integer --- @param dist integer
--- @return integer --- @return integer
--- Checks if a point is within distance from any active Mario visible to enemies' graphical position
function is_point_within_radius_of_mario(x, y, z, dist) function is_point_within_radius_of_mario(x, y, z, dist)
-- ... -- ...
end end
@ -6966,53 +7025,62 @@ end
--- @param z number --- @param z number
--- @param dist integer --- @param dist integer
--- @return integer --- @return integer
--- Checks if a point is within distance from any active Mario's graphical position
function is_point_within_radius_of_any_player(x, y, z, dist) function is_point_within_radius_of_any_player(x, y, z, dist)
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- @return integer --- @return integer
--- Checks if `m` is in the current course/act/level/area and isn't bubbled
function is_player_active(m) function is_player_active(m)
-- ... -- ...
end end
--- @return integer --- @return integer
--- Checks if any player besides the local player is in the current course/act/level/area
function is_other_player_active() function is_other_player_active()
-- ... -- ...
end end
--- @param m MarioState --- @param m MarioState
--- @return integer --- @return integer
--- Checks if `m` is in the current course/act/level/area
function is_player_in_local_area(m) function is_player_in_local_area(m)
-- ... -- ...
end end
--- @param obj Object --- @param obj Object
--- @return MarioState --- @return MarioState
--- Gets the nearest active Mario who isn't bubbled to `obj`
function nearest_mario_state_to_object(obj) function nearest_mario_state_to_object(obj)
-- ... -- ...
end end
--- @param obj Object --- @param obj Object
--- @return MarioState --- @return MarioState
--- Gets the nearest possible Mario to `obj` despite anything like bubbled state or enemy visibility
function nearest_possible_mario_state_to_object(obj) function nearest_possible_mario_state_to_object(obj)
-- ... -- ...
end end
--- @param obj Object --- @param obj Object
--- @return Object --- @return Object
--- Gets the nearest player (Mario Object) to `obj`
function nearest_player_to_object(obj) function nearest_player_to_object(obj)
-- ... -- ...
end end
--- @param obj Object --- @param obj Object
--- @return MarioState --- @return MarioState
--- Gets the nearest interacting Mario to `obj`
function nearest_interacting_mario_state_to_object(obj) function nearest_interacting_mario_state_to_object(obj)
-- ... -- ...
end end
--- @param obj Object --- @param obj Object
--- @return Object --- @return Object
--- Gets the nearest interacting player (Mario Object) to `obj`
function nearest_interacting_player_to_object(obj) function nearest_interacting_player_to_object(obj)
-- ... -- ...
end end
@ -7020,6 +7088,7 @@ end
--- @param m MarioState --- @param m MarioState
--- @param obj Object --- @param obj Object
--- @return integer --- @return integer
--- Checks if `m` is the nearest Mario to `obj`
function is_nearest_mario_state_to_object(m, obj) function is_nearest_mario_state_to_object(m, obj)
-- ... -- ...
end end
@ -7027,6 +7096,7 @@ end
--- @param m Object --- @param m Object
--- @param obj Object --- @param obj Object
--- @return integer --- @return integer
--- Checks if `m` is the nearest player (Mario Object) to `obj`
function is_nearest_player_to_object(m, obj) function is_nearest_player_to_object(m, obj)
-- ... -- ...
end end
@ -7037,12 +7107,14 @@ end
--- @param z number --- @param z number
--- @param dist integer --- @param dist integer
--- @return integer --- @return integer
--- Checks if a point is within `dist` of `obj`
function is_point_close_to_object(obj, x, y, z, dist) function is_point_close_to_object(obj, x, y, z, dist)
-- ... -- ...
end end
--- @param obj Object --- @param obj Object
--- @param dist integer --- @param dist integer
--- Sets an object as visible if within a certain distance of Mario's graphical position
function set_object_visibility(obj, dist) function set_object_visibility(obj, dist)
-- ... -- ...
end end
@ -7053,6 +7125,7 @@ end
--- @param homeZ number --- @param homeZ number
--- @param dist integer --- @param dist integer
--- @return integer --- @return integer
--- Turns an object towards home if Mario is not near to it
function obj_return_home_if_safe(obj, homeX, y, homeZ, dist) function obj_return_home_if_safe(obj, homeX, y, homeZ, dist)
-- ... -- ...
end end
@ -7062,6 +7135,7 @@ end
--- @param homeY number --- @param homeY number
--- @param homeZ number --- @param homeZ number
--- @param baseDisp integer --- @param baseDisp integer
--- Randomly displaces an objects home if RNG says to, and turns the object towards its home
function obj_return_and_displace_home(obj, homeX, homeY, homeZ, baseDisp) function obj_return_and_displace_home(obj, homeX, homeY, homeZ, baseDisp)
-- ... -- ...
end end
@ -7070,6 +7144,7 @@ end
--- @param goal integer --- @param goal integer
--- @param range integer --- @param range integer
--- @return integer --- @return integer
--- A series of checks using sin and cos to see if a given angle is facing in the same direction of a given angle, within a certain range
function obj_check_if_facing_toward_angle(base, goal, range) function obj_check_if_facing_toward_angle(base, goal, range)
-- ... -- ...
end end
@ -7080,12 +7155,14 @@ end
--- @param z number --- @param z number
--- @param radius number --- @param radius number
--- @return integer --- @return integer
--- Finds any wall collisions and returns what the displacement vector would be.
function obj_find_wall_displacement(dist, x, y, z, radius) function obj_find_wall_displacement(dist, x, y, z, radius)
-- ... -- ...
end end
--- @param obj Object --- @param obj Object
--- @param nCoins integer --- @param nCoins integer
--- Spawns a number of coins at the location of an object with a random forward velocity, y velocity, and direction
function obj_spawn_yellow_coins(obj, nCoins) function obj_spawn_yellow_coins(obj, nCoins)
-- ... -- ...
end end
@ -7093,23 +7170,27 @@ end
--- @param obj Object --- @param obj Object
--- @param lifeSpan integer --- @param lifeSpan integer
--- @return integer --- @return integer
--- Controls whether certain objects should flicker/when to despawn
function obj_flicker_and_disappear(obj, lifeSpan) function obj_flicker_and_disappear(obj, lifeSpan)
-- ... -- ...
end end
--- @param room integer --- @param room integer
--- @return integer --- @return integer
--- Checks if a given room is Mario's current room, even if on an object
function current_mario_room_check(room) function current_mario_room_check(room)
-- ... -- ...
end end
--- @param collisionFlags integer --- @param collisionFlags integer
--- @param floor Surface --- @param floor Surface
--- Checks if `floor`'s type is burning or death plane and if so change the current object's action accordingly
function obj_check_floor_death(collisionFlags, floor) function obj_check_floor_death(collisionFlags, floor)
-- ... -- ...
end end
--- @return integer --- @return integer
--- Controls an object dying in lava by creating smoke, sinking the object, playing audio, and eventually despawning it. Returns TRUE when the obj is dead
function obj_lava_death() function obj_lava_death()
-- ... -- ...
end end
@ -7118,6 +7199,7 @@ end
--- @param relX integer --- @param relX integer
--- @param relY integer --- @param relY integer
--- @param relZ integer --- @param relZ integer
--- Spawns an orange number object relatively, such as those that count up for secrets.
function spawn_orange_number(behParam, relX, relY, relZ) function spawn_orange_number(behParam, relX, relY, relZ)
-- ... -- ...
end end
@ -8724,12 +8806,14 @@ function cur_obj_spawn_star_at_y_offset(targetX, targetY, targetZ, offsetY)
-- ... -- ...
end end
--- Sets the current object's home only the first time it's called
function cur_obj_set_home_once() function cur_obj_set_home_once()
-- ... -- ...
end end
--- @param trajectory Pointer_Trajectory --- @param trajectory Pointer_Trajectory
--- @return integer --- @return integer
--- Gets a trajectory's length
function get_trajectory_length(trajectory) function get_trajectory_length(trajectory)
-- ... -- ...
end end
@ -9016,6 +9100,7 @@ function smlua_anim_util_get_current_animation_name(obj)
-- ... -- ...
end end
--- Resets all custom sequences back to vanilla
function smlua_audio_utils_reset_all() function smlua_audio_utils_reset_all()
-- ... -- ...
end end
@ -9024,6 +9109,7 @@ end
--- @param bankId integer --- @param bankId integer
--- @param defaultVolume integer --- @param defaultVolume integer
--- @param m64Name string --- @param m64Name string
--- Replaces the sequence corresponding to `sequenceId` with one called `m64Name`.m64 with `bankId` and `defaultVolume`
function smlua_audio_utils_replace_sequence(sequenceId, bankId, defaultVolume, m64Name) function smlua_audio_utils_replace_sequence(sequenceId, bankId, defaultVolume, m64Name)
-- ... -- ...
end end
@ -9063,14 +9149,14 @@ end
--- @param audio ModAudio --- @param audio ModAudio
--- @return number --- @return number
--- Gets the position of an `audio` stream --- Gets the position of an `audio` stream in seconds
function audio_stream_get_position(audio) function audio_stream_get_position(audio)
-- ... -- ...
end end
--- @param audio ModAudio --- @param audio ModAudio
--- @param pos number --- @param pos number
--- Sets the position of an `audio` stream --- Sets the position of an `audio` stream in seconds
function audio_stream_set_position(audio, pos) function audio_stream_set_position(audio, pos)
-- ... -- ...
end end
@ -9092,7 +9178,7 @@ end
--- @param audio ModAudio --- @param audio ModAudio
--- @param loopStart integer --- @param loopStart integer
--- @param loopEnd integer --- @param loopEnd integer
--- Sets an `audio` stream's loop points (samples) --- Sets an `audio` stream's loop points in samples
function audio_stream_set_loop_points(audio, loopStart, loopEnd) function audio_stream_set_loop_points(audio, loopStart, loopEnd)
-- ... -- ...
end end
@ -9330,26 +9416,31 @@ function camera_config_is_y_inverted()
end end
--- @return integer --- @return integer
--- Gets camera X sensitivity
function camera_config_get_x_sensitivity() function camera_config_get_x_sensitivity()
-- ... -- ...
end end
--- @return integer --- @return integer
--- Gets camera Y sensitivity
function camera_config_get_y_sensitivity() function camera_config_get_y_sensitivity()
-- ... -- ...
end end
--- @return integer --- @return integer
--- Gets camera aggression
function camera_config_get_aggression() function camera_config_get_aggression()
-- ... -- ...
end end
--- @return integer --- @return integer
--- Gets camera pan level
function camera_config_get_pan_level() function camera_config_get_pan_level()
-- ... -- ...
end end
--- @return integer --- @return integer
--- Gets camera deceleration
function camera_config_get_deceleration() function camera_config_get_deceleration()
-- ... -- ...
end end
@ -9469,6 +9560,7 @@ function collision_find_ceil(x, y, z)
end end
--- @return Surface --- @return Surface
--- Gets the generated water floor surface used when riding a shell
function get_water_surface_pseudo_floor() function get_water_surface_pseudo_floor()
-- ... -- ...
end end
@ -10187,6 +10279,7 @@ end
--- @param type HudDisplayValue --- @param type HudDisplayValue
--- @return integer --- @return integer
--- Gets a HUD display value
function hud_get_value(type) function hud_get_value(type)
-- ... -- ...
end end
@ -10319,16 +10412,6 @@ function set_water_level(index, height, sync)
-- ... -- ...
end end
--- @param transType integer
--- @param time integer
--- @param red integer
--- @param green integer
--- @param blue integer
--- Plays a screen transition
function play_transition(transType, time, red, green, blue)
-- ...
end
--- @param courseNum integer --- @param courseNum integer
--- @return boolean --- @return boolean
--- Checks if a course is a main course and not the castle or secret levels --- Checks if a course is a main course and not the castle or secret levels
@ -10446,7 +10529,7 @@ function set_volume_env(volume)
end end
--- @param index integer --- @param index integer
--- @return number --- @return integer
--- Gets an environment region (gas/water boxes) height value --- Gets an environment region (gas/water boxes) height value
function get_environment_region(index) function get_environment_region(index)
-- ... -- ...
@ -11088,12 +11171,6 @@ function stop_cap_music()
-- ... -- ...
end end
--- @param soundStates SoundState
--- @param maxSoundStates integer
function exec_anim_sound_state(soundStates, maxSoundStates)
-- ...
end
--- @param soundMagic integer --- @param soundMagic integer
--- Plays a sound if the current object is visible --- Plays a sound if the current object is visible
function cur_obj_play_sound_1(soundMagic) function cur_obj_play_sound_1(soundMagic)
@ -11175,20 +11252,6 @@ function set_find_wall_direction(dir, active, airborne)
-- ... -- ...
end end
--- @param data Pointer_integer
--- @return integer
function get_area_terrain_size(data)
-- ...
end
--- @param index integer
--- @param data Pointer_integer
--- @param surfaceRooms Pointer_integer
--- @param macroObjects Pointer_integer
function load_area_terrain(index, data, surfaceRooms, macroObjects)
-- ...
end
--- Loads the object's collision data into dynamic collision. You must run this every frame in your object's behavior loop for it to have collision --- Loads the object's collision data into dynamic collision. You must run this every frame in your object's behavior loop for it to have collision
function load_object_collision_model() function load_object_collision_model()
-- ... -- ...
@ -11204,6 +11267,7 @@ end
--- @param surfaceType integer --- @param surfaceType integer
--- @return boolean --- @return boolean
--- Checks if a surface has force
function surface_has_force(surfaceType) function surface_has_force(surfaceType)
-- ... -- ...
end end

View file

@ -2292,10 +2292,6 @@
--- @field public dialog5 integer --- @field public dialog5 integer
--- @field public dialog6 integer --- @field public dialog6 integer
--- @class Struct802A272C
--- @field public vecF Vec3f
--- @field public vecS Vec3s
--- @class Surface --- @class Surface
--- @field public flags integer --- @field public flags integer
--- @field public force integer --- @field public force integer
@ -2409,10 +2405,6 @@
--- @field public pos Vec3s --- @field public pos Vec3s
--- @field public strength integer --- @field public strength integer
--- @class struct802A1230
--- @field public unk00 integer
--- @field public unk02 integer
--- @class Vec2f --- @class Vec2f
--- @field public x number --- @field public x number
--- @field public y number --- @field public y number

View file

@ -1955,6 +1955,9 @@ Transitions the camera to the next Lakitu state, updating position and focus. Th
## [set_fixed_cam_axis_sa_lobby](#set_fixed_cam_axis_sa_lobby) ## [set_fixed_cam_axis_sa_lobby](#set_fixed_cam_axis_sa_lobby)
### Description
Set the fixed camera base pos depending on the current level area
### Lua Example ### Lua Example
`set_fixed_cam_axis_sa_lobby(preset)` `set_fixed_cam_axis_sa_lobby(preset)`
@ -2438,6 +2441,9 @@ Centers the ROM hack camera. This function is designed for non-standard level la
## [get_character](#get_character) ## [get_character](#get_character)
### Description
Gets a Character struct from `m`
### Lua Example ### Lua Example
`local CharacterValue = get_character(m)` `local CharacterValue = get_character(m)`
@ -4281,6 +4287,9 @@ Plays Toad's jingle
## [sound_reset_background_music_default_volume](#sound_reset_background_music_default_volume) ## [sound_reset_background_music_default_volume](#sound_reset_background_music_default_volume)
### Description
Resets a sequence's (`seqId`) volume back to the default volume
### Lua Example ### Lua Example
`sound_reset_background_music_default_volume(seqId)` `sound_reset_background_music_default_volume(seqId)`
@ -4301,6 +4310,9 @@ Plays Toad's jingle
## [sound_set_background_music_default_volume](#sound_set_background_music_default_volume) ## [sound_set_background_music_default_volume](#sound_set_background_music_default_volume)
### Description
Sets a sequence's (`seqId`) volume to `volume`
### Lua Example ### Lua Example
`sound_set_background_music_default_volume(seqId, volume)` `sound_set_background_music_default_volume(seqId, volume)`
@ -4322,6 +4334,9 @@ Plays Toad's jingle
## [get_sound_pan](#get_sound_pan) ## [get_sound_pan](#get_sound_pan)
### Description
Gets a sound left/right pan using `x` and `z`
### Lua Example ### Lua Example
`local numberValue = get_sound_pan(x, z)` `local numberValue = get_sound_pan(x, z)`
@ -4343,6 +4358,9 @@ Plays Toad's jingle
## [sound_get_level_intensity](#sound_get_level_intensity) ## [sound_get_level_intensity](#sound_get_level_intensity)
### Description
Gets a sound level intensity based on `distance`
### Lua Example ### Lua Example
`local numberValue = sound_get_level_intensity(distance)` `local numberValue = sound_get_level_intensity(distance)`
@ -6008,6 +6026,9 @@ Returns the name of the level corresponding to `courseNum`, `levelNum` and `area
## [get_level_name_sm64](#get_level_name_sm64) ## [get_level_name_sm64](#get_level_name_sm64)
### Description
Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an SM64 encoded string. This function should not be used in Lua mods. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
### Lua Example ### Lua Example
`local PointerValue = get_level_name_sm64(courseNum, levelNum, areaIndex, charCase)` `local PointerValue = get_level_name_sm64(courseNum, levelNum, areaIndex, charCase)`
@ -6081,6 +6102,9 @@ Returns the name of the star corresponding to `courseNum` and `starNum` as an AS
## [get_star_name_sm64](#get_star_name_sm64) ## [get_star_name_sm64](#get_star_name_sm64)
### Description
Returns the name of the star corresponding to `courseNum` and `starNum` as an SM64 encoded string. This function should not be used in Lua mods. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
### Lua Example ### Lua Example
`local PointerValue = get_star_name_sm64(courseNum, starNum, charCase)` `local PointerValue = get_star_name_sm64(courseNum, starNum, charCase)`

View file

@ -2328,6 +2328,9 @@ Launches Mario forward with a given velocity (`forwardVel`) and sets his animati
## [stuck_in_ground_handler](#stuck_in_ground_handler) ## [stuck_in_ground_handler](#stuck_in_ground_handler)
### Description
Handles the cutscene and animation sequence for when Mario is stuck in the ground (head, butt, or feet). Plays a designated `animation`, checks specific frames (`unstuckFrame`, `target2`, `target3`) for sound effects or transitions, and frees Mario to the `endAction` once the animation completes
### Lua Example ### Lua Example
`stuck_in_ground_handler(m, animation, unstuckFrame, target2, target3, endAction)` `stuck_in_ground_handler(m, animation, unstuckFrame, target2, target3, endAction)`
@ -4952,6 +4955,9 @@ Calculates the distance between two points in 3D space (`from` and `to`), as wel
## [vec3f_set_dist_and_angle](#vec3f_set_dist_and_angle) ## [vec3f_set_dist_and_angle](#vec3f_set_dist_and_angle)
### Description
Positions the point `to` at a given `dist`, `pitch`, and `yaw` relative to the point `from`. This can be used to place objects around a reference point at specific angles and distances
### Lua Example ### Lua Example
`vec3f_set_dist_and_angle(from, to, dist, pitch, yaw)` `vec3f_set_dist_and_angle(from, to, dist, pitch, yaw)`
@ -5660,6 +5666,9 @@ Clears the mod's data from mod storage
## [network_player_connected_count](#network_player_connected_count) ## [network_player_connected_count](#network_player_connected_count)
### Description
Gets the amount of players connected
### Lua Example ### Lua Example
`local integerValue = network_player_connected_count()` `local integerValue = network_player_connected_count()`
@ -5678,6 +5687,9 @@ Clears the mod's data from mod storage
## [network_player_set_description](#network_player_set_description) ## [network_player_set_description](#network_player_set_description)
### Description
Sets the description field of `np`
### Lua Example ### Lua Example
`network_player_set_description(np, description, r, g, b, a)` `network_player_set_description(np, description, r, g, b, a)`
@ -5703,6 +5715,9 @@ Clears the mod's data from mod storage
## [network_player_set_override_location](#network_player_set_override_location) ## [network_player_set_override_location](#network_player_set_override_location)
### Description
Overrides the location of `np`
### Lua Example ### Lua Example
`network_player_set_override_location(np, location)` `network_player_set_override_location(np, location)`
@ -5724,6 +5739,9 @@ Clears the mod's data from mod storage
## [network_player_from_global_index](#network_player_from_global_index) ## [network_player_from_global_index](#network_player_from_global_index)
### Description
Gets a network player from `globalIndex`
### Lua Example ### Lua Example
`local NetworkPlayerValue = network_player_from_global_index(globalIndex)` `local NetworkPlayerValue = network_player_from_global_index(globalIndex)`
@ -5744,6 +5762,9 @@ Clears the mod's data from mod storage
## [get_network_player_from_level](#get_network_player_from_level) ## [get_network_player_from_level](#get_network_player_from_level)
### Description
Gets the first network player whose information matches `courseNum`, `actNum`, and `levelNum`
### Lua Example ### Lua Example
`local NetworkPlayerValue = get_network_player_from_level(courseNum, actNum, levelNum)` `local NetworkPlayerValue = get_network_player_from_level(courseNum, actNum, levelNum)`
@ -5766,6 +5787,9 @@ Clears the mod's data from mod storage
## [get_network_player_from_area](#get_network_player_from_area) ## [get_network_player_from_area](#get_network_player_from_area)
### Description
Gets the first network player whose information matches `courseNum`, `actNum`, `levelNum`, and `areaIndex`
### Lua Example ### Lua Example
`local NetworkPlayerValue = get_network_player_from_area(courseNum, actNum, levelNum, areaIndex)` `local NetworkPlayerValue = get_network_player_from_area(courseNum, actNum, levelNum, areaIndex)`
@ -5789,6 +5813,9 @@ Clears the mod's data from mod storage
## [get_network_player_smallest_global](#get_network_player_smallest_global) ## [get_network_player_smallest_global](#get_network_player_smallest_global)
### Description
Gets the active network player with the smallest global index. Useful for assigning one player to "own" some kind of functionality or object
### Lua Example ### Lua Example
`local NetworkPlayerValue = get_network_player_smallest_global()` `local NetworkPlayerValue = get_network_player_smallest_global()`
@ -5807,6 +5834,9 @@ Clears the mod's data from mod storage
## [network_player_set_override_palette_color](#network_player_set_override_palette_color) ## [network_player_set_override_palette_color](#network_player_set_override_palette_color)
### Description
Sets the `part in `np`'s override color palette`
### Lua Example ### Lua Example
`network_player_set_override_palette_color(np, part, color)` `network_player_set_override_palette_color(np, part, color)`
@ -5829,6 +5859,9 @@ Clears the mod's data from mod storage
## [network_player_reset_override_palette](#network_player_reset_override_palette) ## [network_player_reset_override_palette](#network_player_reset_override_palette)
### Description
Resets `np`'s override color palette
### Lua Example ### Lua Example
`network_player_reset_override_palette(np)` `network_player_reset_override_palette(np)`
@ -5849,6 +5882,9 @@ Clears the mod's data from mod storage
## [network_player_is_override_palette_same](#network_player_is_override_palette_same) ## [network_player_is_override_palette_same](#network_player_is_override_palette_same)
### Description
Checks if `np`'s override color palette is identical to the regular color palette
### Lua Example ### Lua Example
`local booleanValue = network_player_is_override_palette_same(np)` `local booleanValue = network_player_is_override_palette_same(np)`
@ -6026,818 +6062,6 @@ Gets a Discord ID corresponding to the network player with `localIndex`
[:arrow_up_small:](#) [:arrow_up_small:](#)
<br />
---
# functions from obj_behaviors.c
<br />
## [set_yoshi_as_not_dead](#set_yoshi_as_not_dead)
### Lua Example
`set_yoshi_as_not_dead()`
### Parameters
- None
### Returns
- None
### C Prototype
`void set_yoshi_as_not_dead(void);`
[:arrow_up_small:](#)
<br />
## [absf_2](#absf_2)
### Lua Example
`local numberValue = absf_2(f)`
### Parameters
| Field | Type |
| ----- | ---- |
| f | `number` |
### Returns
- `number`
### C Prototype
`f32 absf_2(f32 f);`
[:arrow_up_small:](#)
<br />
## [turn_obj_away_from_surface](#turn_obj_away_from_surface)
### Lua Example
`turn_obj_away_from_surface(velX, velZ, nX, nY, nZ, objYawX, objYawZ)`
### Parameters
| Field | Type |
| ----- | ---- |
| velX | `number` |
| velZ | `number` |
| nX | `number` |
| nY | `number` |
| nZ | `number` |
| objYawX | `Pointer` <`number`> |
| objYawZ | `Pointer` <`number`> |
### Returns
- None
### C Prototype
`void turn_obj_away_from_surface(f32 velX, f32 velZ, f32 nX, UNUSED f32 nY, f32 nZ, f32 *objYawX, f32 *objYawZ);`
[:arrow_up_small:](#)
<br />
## [obj_find_wall](#obj_find_wall)
### Lua Example
`local integerValue = obj_find_wall(objNewX, objY, objNewZ, objVelX, objVelZ)`
### Parameters
| Field | Type |
| ----- | ---- |
| objNewX | `number` |
| objY | `number` |
| objNewZ | `number` |
| objVelX | `number` |
| objVelZ | `number` |
### Returns
- `integer`
### C Prototype
`s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ);`
[:arrow_up_small:](#)
<br />
## [turn_obj_away_from_steep_floor](#turn_obj_away_from_steep_floor)
### Lua Example
`local integerValue = turn_obj_away_from_steep_floor(objFloor, floorY, objVelX, objVelZ)`
### Parameters
| Field | Type |
| ----- | ---- |
| objFloor | [Surface](structs.md#Surface) |
| floorY | `number` |
| objVelX | `number` |
| objVelZ | `number` |
### Returns
- `integer`
### C Prototype
`s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ);`
[:arrow_up_small:](#)
<br />
## [obj_orient_graph](#obj_orient_graph)
### Lua Example
`obj_orient_graph(obj, normalX, normalY, normalZ)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| normalX | `number` |
| normalY | `number` |
| normalZ | `number` |
### Returns
- None
### C Prototype
`void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ);`
[:arrow_up_small:](#)
<br />
## [calc_obj_friction](#calc_obj_friction)
### Lua Example
`calc_obj_friction(objFriction, floor_nY)`
### Parameters
| Field | Type |
| ----- | ---- |
| objFriction | `Pointer` <`number`> |
| floor_nY | `number` |
### Returns
- None
### C Prototype
`void calc_obj_friction(f32 *objFriction, f32 floor_nY);`
[:arrow_up_small:](#)
<br />
## [calc_new_obj_vel_and_pos_y](#calc_new_obj_vel_and_pos_y)
### Lua Example
`calc_new_obj_vel_and_pos_y(objFloor, objFloorY, objVelX, objVelZ)`
### Parameters
| Field | Type |
| ----- | ---- |
| objFloor | [Surface](structs.md#Surface) |
| objFloorY | `number` |
| objVelX | `number` |
| objVelZ | `number` |
### Returns
- None
### C Prototype
`void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ);`
[:arrow_up_small:](#)
<br />
## [calc_new_obj_vel_and_pos_y_underwater](#calc_new_obj_vel_and_pos_y_underwater)
### Lua Example
`calc_new_obj_vel_and_pos_y_underwater(objFloor, floorY, objVelX, objVelZ, waterY)`
### Parameters
| Field | Type |
| ----- | ---- |
| objFloor | [Surface](structs.md#Surface) |
| floorY | `number` |
| objVelX | `number` |
| objVelZ | `number` |
| waterY | `number` |
### Returns
- None
### C Prototype
`void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, f32 waterY);`
[:arrow_up_small:](#)
<br />
## [obj_update_pos_vel_xz](#obj_update_pos_vel_xz)
### Lua Example
`obj_update_pos_vel_xz()`
### Parameters
- None
### Returns
- None
### C Prototype
`void obj_update_pos_vel_xz(void);`
[:arrow_up_small:](#)
<br />
## [obj_splash](#obj_splash)
### Lua Example
`obj_splash(waterY, objY)`
### Parameters
| Field | Type |
| ----- | ---- |
| waterY | `integer` |
| objY | `integer` |
### Returns
- None
### C Prototype
`void obj_splash(s32 waterY, s32 objY);`
[:arrow_up_small:](#)
<br />
## [object_step](#object_step)
### Lua Example
`local integerValue = object_step()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`s16 object_step(void);`
[:arrow_up_small:](#)
<br />
## [object_step_without_floor_orient](#object_step_without_floor_orient)
### Lua Example
`local integerValue = object_step_without_floor_orient()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`s16 object_step_without_floor_orient(void);`
[:arrow_up_small:](#)
<br />
## [obj_move_xyz_using_fvel_and_yaw](#obj_move_xyz_using_fvel_and_yaw)
### Lua Example
`obj_move_xyz_using_fvel_and_yaw(obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
### Returns
- None
### C Prototype
`void obj_move_xyz_using_fvel_and_yaw(struct Object *obj);`
[:arrow_up_small:](#)
<br />
## [is_point_within_radius_of_mario](#is_point_within_radius_of_mario)
### Lua Example
`local integerValue = is_point_within_radius_of_mario(x, y, z, dist)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| y | `number` |
| z | `number` |
| dist | `integer` |
### Returns
- `integer`
### C Prototype
`s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist);`
[:arrow_up_small:](#)
<br />
## [is_point_within_radius_of_any_player](#is_point_within_radius_of_any_player)
### Lua Example
`local integerValue = is_point_within_radius_of_any_player(x, y, z, dist)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| y | `number` |
| z | `number` |
| dist | `integer` |
### Returns
- `integer`
### C Prototype
`s8 is_point_within_radius_of_any_player(f32 x, f32 y, f32 z, s32 dist);`
[:arrow_up_small:](#)
<br />
## [is_player_active](#is_player_active)
### Lua Example
`local integerValue = is_player_active(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`u8 is_player_active(struct MarioState* m);`
[:arrow_up_small:](#)
<br />
## [is_other_player_active](#is_other_player_active)
### Lua Example
`local integerValue = is_other_player_active()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`u8 is_other_player_active(void);`
[:arrow_up_small:](#)
<br />
## [is_player_in_local_area](#is_player_in_local_area)
### Lua Example
`local integerValue = is_player_in_local_area(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- `integer`
### C Prototype
`u8 is_player_in_local_area(struct MarioState* m);`
[:arrow_up_small:](#)
<br />
## [nearest_mario_state_to_object](#nearest_mario_state_to_object)
### Lua Example
`local MarioStateValue = nearest_mario_state_to_object(obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
### Returns
[MarioState](structs.md#MarioState)
### C Prototype
`struct MarioState* nearest_mario_state_to_object(struct Object *obj);`
[:arrow_up_small:](#)
<br />
## [nearest_possible_mario_state_to_object](#nearest_possible_mario_state_to_object)
### Lua Example
`local MarioStateValue = nearest_possible_mario_state_to_object(obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
### Returns
[MarioState](structs.md#MarioState)
### C Prototype
`struct MarioState* nearest_possible_mario_state_to_object(struct Object *obj);`
[:arrow_up_small:](#)
<br />
## [nearest_player_to_object](#nearest_player_to_object)
### Lua Example
`local ObjectValue = nearest_player_to_object(obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object* nearest_player_to_object(struct Object *obj);`
[:arrow_up_small:](#)
<br />
## [nearest_interacting_mario_state_to_object](#nearest_interacting_mario_state_to_object)
### Lua Example
`local MarioStateValue = nearest_interacting_mario_state_to_object(obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
### Returns
[MarioState](structs.md#MarioState)
### C Prototype
`struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj);`
[:arrow_up_small:](#)
<br />
## [nearest_interacting_player_to_object](#nearest_interacting_player_to_object)
### Lua Example
`local ObjectValue = nearest_interacting_player_to_object(obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *nearest_interacting_player_to_object(struct Object *obj);`
[:arrow_up_small:](#)
<br />
## [is_nearest_mario_state_to_object](#is_nearest_mario_state_to_object)
### Lua Example
`local integerValue = is_nearest_mario_state_to_object(m, obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| obj | [Object](structs.md#Object) |
### Returns
- `integer`
### C Prototype
`u8 is_nearest_mario_state_to_object(struct MarioState *m, struct Object *obj);`
[:arrow_up_small:](#)
<br />
## [is_nearest_player_to_object](#is_nearest_player_to_object)
### Lua Example
`local integerValue = is_nearest_player_to_object(m, obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [Object](structs.md#Object) |
| obj | [Object](structs.md#Object) |
### Returns
- `integer`
### C Prototype
`u8 is_nearest_player_to_object(struct Object *m, struct Object *obj);`
[:arrow_up_small:](#)
<br />
## [is_point_close_to_object](#is_point_close_to_object)
### Lua Example
`local integerValue = is_point_close_to_object(obj, x, y, z, dist)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| x | `number` |
| y | `number` |
| z | `number` |
| dist | `integer` |
### Returns
- `integer`
### C Prototype
`s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist);`
[:arrow_up_small:](#)
<br />
## [set_object_visibility](#set_object_visibility)
### Lua Example
`set_object_visibility(obj, dist)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| dist | `integer` |
### Returns
- None
### C Prototype
`void set_object_visibility(struct Object *obj, s32 dist);`
[:arrow_up_small:](#)
<br />
## [obj_return_home_if_safe](#obj_return_home_if_safe)
### Lua Example
`local integerValue = obj_return_home_if_safe(obj, homeX, y, homeZ, dist)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| homeX | `number` |
| y | `number` |
| homeZ | `number` |
| dist | `integer` |
### Returns
- `integer`
### C Prototype
`s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist);`
[:arrow_up_small:](#)
<br />
## [obj_return_and_displace_home](#obj_return_and_displace_home)
### Lua Example
`obj_return_and_displace_home(obj, homeX, homeY, homeZ, baseDisp)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| homeX | `number` |
| homeY | `number` |
| homeZ | `number` |
| baseDisp | `integer` |
### Returns
- None
### C Prototype
`void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp);`
[:arrow_up_small:](#)
<br />
## [obj_check_if_facing_toward_angle](#obj_check_if_facing_toward_angle)
### Lua Example
`local integerValue = obj_check_if_facing_toward_angle(base, goal, range)`
### Parameters
| Field | Type |
| ----- | ---- |
| base | `integer` |
| goal | `integer` |
| range | `integer` |
### Returns
- `integer`
### C Prototype
`s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range);`
[:arrow_up_small:](#)
<br />
## [obj_find_wall_displacement](#obj_find_wall_displacement)
### Lua Example
`local integerValue = obj_find_wall_displacement(dist, x, y, z, radius)`
### Parameters
| Field | Type |
| ----- | ---- |
| dist | [Vec3f](structs.md#Vec3f) |
| x | `number` |
| y | `number` |
| z | `number` |
| radius | `number` |
### Returns
- `integer`
### C Prototype
`s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius);`
[:arrow_up_small:](#)
<br />
## [obj_spawn_yellow_coins](#obj_spawn_yellow_coins)
### Lua Example
`obj_spawn_yellow_coins(obj, nCoins)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| nCoins | `integer` |
### Returns
- None
### C Prototype
`void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins);`
[:arrow_up_small:](#)
<br />
## [obj_flicker_and_disappear](#obj_flicker_and_disappear)
### Lua Example
`local integerValue = obj_flicker_and_disappear(obj, lifeSpan)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| lifeSpan | `integer` |
### Returns
- `integer`
### C Prototype
`s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan);`
[:arrow_up_small:](#)
<br />
## [current_mario_room_check](#current_mario_room_check)
### Lua Example
`local integerValue = current_mario_room_check(room)`
### Parameters
| Field | Type |
| ----- | ---- |
| room | `integer` |
### Returns
- `integer`
### C Prototype
`s8 current_mario_room_check(s16 room);`
[:arrow_up_small:](#)
<br />
## [obj_check_floor_death](#obj_check_floor_death)
### Lua Example
`obj_check_floor_death(collisionFlags, floor)`
### Parameters
| Field | Type |
| ----- | ---- |
| collisionFlags | `integer` |
| floor | [Surface](structs.md#Surface) |
### Returns
- None
### C Prototype
`void obj_check_floor_death(s16 collisionFlags, struct Surface *floor);`
[:arrow_up_small:](#)
<br />
## [obj_lava_death](#obj_lava_death)
### Lua Example
`local integerValue = obj_lava_death()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`s8 obj_lava_death(void);`
[:arrow_up_small:](#)
<br />
## [spawn_orange_number](#spawn_orange_number)
### Lua Example
`spawn_orange_number(behParam, relX, relY, relZ)`
### Parameters
| Field | Type |
| ----- | ---- |
| behParam | `integer` |
| relX | `integer` |
| relY | `integer` |
| relZ | `integer` |
### Returns
- None
### C Prototype
`void spawn_orange_number(s8 behParam, s16 relX, s16 relY, s16 relZ);`
[:arrow_up_small:](#)
<br /> <br />
--- ---

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -33,8 +33,12 @@
<br /> <br />
- area.h - area.h
- [get_mario_spawn_type](functions.md#get_mario_spawn_type)
- [area_get_warp_node](functions.md#area_get_warp_node) - [area_get_warp_node](functions.md#area_get_warp_node)
- [area_get_any_warp_node](functions.md#area_get_any_warp_node)
- [area_get_warp_node_from_params](functions.md#area_get_warp_node_from_params) - [area_get_warp_node_from_params](functions.md#area_get_warp_node_from_params)
- [play_transition](functions.md#play_transition)
- [play_transition_after_delay](functions.md#play_transition_after_delay)
<br /> <br />
@ -1284,44 +1288,43 @@
<br /> <br />
- obj_behaviors.c - obj_behaviors.c
- [set_yoshi_as_not_dead](functions-4.md#set_yoshi_as_not_dead) - [set_yoshi_as_not_dead](functions-5.md#set_yoshi_as_not_dead)
- [absf_2](functions-4.md#absf_2) - [absf_2](functions-5.md#absf_2)
- [turn_obj_away_from_surface](functions-4.md#turn_obj_away_from_surface) - [obj_find_wall](functions-5.md#obj_find_wall)
- [obj_find_wall](functions-4.md#obj_find_wall) - [turn_obj_away_from_steep_floor](functions-5.md#turn_obj_away_from_steep_floor)
- [turn_obj_away_from_steep_floor](functions-4.md#turn_obj_away_from_steep_floor) - [obj_orient_graph](functions-5.md#obj_orient_graph)
- [obj_orient_graph](functions-4.md#obj_orient_graph) - [calc_obj_friction](functions-5.md#calc_obj_friction)
- [calc_obj_friction](functions-4.md#calc_obj_friction) - [calc_new_obj_vel_and_pos_y](functions-5.md#calc_new_obj_vel_and_pos_y)
- [calc_new_obj_vel_and_pos_y](functions-4.md#calc_new_obj_vel_and_pos_y) - [calc_new_obj_vel_and_pos_y_underwater](functions-5.md#calc_new_obj_vel_and_pos_y_underwater)
- [calc_new_obj_vel_and_pos_y_underwater](functions-4.md#calc_new_obj_vel_and_pos_y_underwater) - [obj_update_pos_vel_xz](functions-5.md#obj_update_pos_vel_xz)
- [obj_update_pos_vel_xz](functions-4.md#obj_update_pos_vel_xz) - [obj_splash](functions-5.md#obj_splash)
- [obj_splash](functions-4.md#obj_splash) - [object_step](functions-5.md#object_step)
- [object_step](functions-4.md#object_step) - [object_step_without_floor_orient](functions-5.md#object_step_without_floor_orient)
- [object_step_without_floor_orient](functions-4.md#object_step_without_floor_orient) - [obj_move_xyz_using_fvel_and_yaw](functions-5.md#obj_move_xyz_using_fvel_and_yaw)
- [obj_move_xyz_using_fvel_and_yaw](functions-4.md#obj_move_xyz_using_fvel_and_yaw) - [is_point_within_radius_of_mario](functions-5.md#is_point_within_radius_of_mario)
- [is_point_within_radius_of_mario](functions-4.md#is_point_within_radius_of_mario) - [is_point_within_radius_of_any_player](functions-5.md#is_point_within_radius_of_any_player)
- [is_point_within_radius_of_any_player](functions-4.md#is_point_within_radius_of_any_player) - [is_player_active](functions-5.md#is_player_active)
- [is_player_active](functions-4.md#is_player_active) - [is_other_player_active](functions-5.md#is_other_player_active)
- [is_other_player_active](functions-4.md#is_other_player_active) - [is_player_in_local_area](functions-5.md#is_player_in_local_area)
- [is_player_in_local_area](functions-4.md#is_player_in_local_area) - [nearest_mario_state_to_object](functions-5.md#nearest_mario_state_to_object)
- [nearest_mario_state_to_object](functions-4.md#nearest_mario_state_to_object) - [nearest_possible_mario_state_to_object](functions-5.md#nearest_possible_mario_state_to_object)
- [nearest_possible_mario_state_to_object](functions-4.md#nearest_possible_mario_state_to_object) - [nearest_player_to_object](functions-5.md#nearest_player_to_object)
- [nearest_player_to_object](functions-4.md#nearest_player_to_object) - [nearest_interacting_mario_state_to_object](functions-5.md#nearest_interacting_mario_state_to_object)
- [nearest_interacting_mario_state_to_object](functions-4.md#nearest_interacting_mario_state_to_object) - [nearest_interacting_player_to_object](functions-5.md#nearest_interacting_player_to_object)
- [nearest_interacting_player_to_object](functions-4.md#nearest_interacting_player_to_object) - [is_nearest_mario_state_to_object](functions-5.md#is_nearest_mario_state_to_object)
- [is_nearest_mario_state_to_object](functions-4.md#is_nearest_mario_state_to_object) - [is_nearest_player_to_object](functions-5.md#is_nearest_player_to_object)
- [is_nearest_player_to_object](functions-4.md#is_nearest_player_to_object) - [is_point_close_to_object](functions-5.md#is_point_close_to_object)
- [is_point_close_to_object](functions-4.md#is_point_close_to_object) - [set_object_visibility](functions-5.md#set_object_visibility)
- [set_object_visibility](functions-4.md#set_object_visibility) - [obj_return_home_if_safe](functions-5.md#obj_return_home_if_safe)
- [obj_return_home_if_safe](functions-4.md#obj_return_home_if_safe) - [obj_return_and_displace_home](functions-5.md#obj_return_and_displace_home)
- [obj_return_and_displace_home](functions-4.md#obj_return_and_displace_home) - [obj_check_if_facing_toward_angle](functions-5.md#obj_check_if_facing_toward_angle)
- [obj_check_if_facing_toward_angle](functions-4.md#obj_check_if_facing_toward_angle) - [obj_find_wall_displacement](functions-5.md#obj_find_wall_displacement)
- [obj_find_wall_displacement](functions-4.md#obj_find_wall_displacement) - [obj_spawn_yellow_coins](functions-5.md#obj_spawn_yellow_coins)
- [obj_spawn_yellow_coins](functions-4.md#obj_spawn_yellow_coins) - [obj_flicker_and_disappear](functions-5.md#obj_flicker_and_disappear)
- [obj_flicker_and_disappear](functions-4.md#obj_flicker_and_disappear) - [current_mario_room_check](functions-5.md#current_mario_room_check)
- [current_mario_room_check](functions-4.md#current_mario_room_check) - [obj_check_floor_death](functions-5.md#obj_check_floor_death)
- [obj_check_floor_death](functions-4.md#obj_check_floor_death) - [obj_lava_death](functions-5.md#obj_lava_death)
- [obj_lava_death](functions-4.md#obj_lava_death) - [spawn_orange_number](functions-5.md#spawn_orange_number)
- [spawn_orange_number](functions-4.md#spawn_orange_number)
<br /> <br />
@ -1693,70 +1696,70 @@
<br /> <br />
- smlua_camera_utils.h - smlua_camera_utils.h
- [camera_reset_overrides](functions-5.md#camera_reset_overrides) - [camera_reset_overrides](functions-6.md#camera_reset_overrides)
- [camera_freeze](functions-5.md#camera_freeze) - [camera_freeze](functions-6.md#camera_freeze)
- [camera_unfreeze](functions-5.md#camera_unfreeze) - [camera_unfreeze](functions-6.md#camera_unfreeze)
- [camera_is_frozen](functions-5.md#camera_is_frozen) - [camera_is_frozen](functions-6.md#camera_is_frozen)
- [camera_romhack_allow_only_mods](functions-5.md#camera_romhack_allow_only_mods) - [camera_romhack_allow_only_mods](functions-6.md#camera_romhack_allow_only_mods)
- [camera_set_romhack_override](functions-5.md#camera_set_romhack_override) - [camera_set_romhack_override](functions-6.md#camera_set_romhack_override)
- [camera_romhack_allow_centering](functions-5.md#camera_romhack_allow_centering) - [camera_romhack_allow_centering](functions-6.md#camera_romhack_allow_centering)
- [camera_allow_toxic_gas_camera](functions-5.md#camera_allow_toxic_gas_camera) - [camera_allow_toxic_gas_camera](functions-6.md#camera_allow_toxic_gas_camera)
- [camera_romhack_allow_dpad_usage](functions-5.md#camera_romhack_allow_dpad_usage) - [camera_romhack_allow_dpad_usage](functions-6.md#camera_romhack_allow_dpad_usage)
- [rom_hack_cam_set_collisions](functions-5.md#rom_hack_cam_set_collisions) - [rom_hack_cam_set_collisions](functions-6.md#rom_hack_cam_set_collisions)
- [camera_romhack_set_zoomed_in_dist](functions-5.md#camera_romhack_set_zoomed_in_dist) - [camera_romhack_set_zoomed_in_dist](functions-6.md#camera_romhack_set_zoomed_in_dist)
- [camera_romhack_set_zoomed_out_dist](functions-5.md#camera_romhack_set_zoomed_out_dist) - [camera_romhack_set_zoomed_out_dist](functions-6.md#camera_romhack_set_zoomed_out_dist)
- [camera_romhack_set_zoomed_in_height](functions-5.md#camera_romhack_set_zoomed_in_height) - [camera_romhack_set_zoomed_in_height](functions-6.md#camera_romhack_set_zoomed_in_height)
- [camera_romhack_set_zoomed_out_height](functions-5.md#camera_romhack_set_zoomed_out_height) - [camera_romhack_set_zoomed_out_height](functions-6.md#camera_romhack_set_zoomed_out_height)
- [camera_romhack_get_zoomed_in_dist](functions-5.md#camera_romhack_get_zoomed_in_dist) - [camera_romhack_get_zoomed_in_dist](functions-6.md#camera_romhack_get_zoomed_in_dist)
- [camera_romhack_get_zoomed_out_dist](functions-5.md#camera_romhack_get_zoomed_out_dist) - [camera_romhack_get_zoomed_out_dist](functions-6.md#camera_romhack_get_zoomed_out_dist)
- [camera_romhack_get_zoomed_in_height](functions-5.md#camera_romhack_get_zoomed_in_height) - [camera_romhack_get_zoomed_in_height](functions-6.md#camera_romhack_get_zoomed_in_height)
- [camera_romhack_get_zoomed_out_height](functions-5.md#camera_romhack_get_zoomed_out_height) - [camera_romhack_get_zoomed_out_height](functions-6.md#camera_romhack_get_zoomed_out_height)
- [camera_get_romhack_override](functions-5.md#camera_get_romhack_override) - [camera_get_romhack_override](functions-6.md#camera_get_romhack_override)
- [camera_romhack_get_allow_centering](functions-5.md#camera_romhack_get_allow_centering) - [camera_romhack_get_allow_centering](functions-6.md#camera_romhack_get_allow_centering)
- [camera_get_allow_toxic_gas_camera](functions-5.md#camera_get_allow_toxic_gas_camera) - [camera_get_allow_toxic_gas_camera](functions-6.md#camera_get_allow_toxic_gas_camera)
- [camera_romhack_get_allow_dpad_usage](functions-5.md#camera_romhack_get_allow_dpad_usage) - [camera_romhack_get_allow_dpad_usage](functions-6.md#camera_romhack_get_allow_dpad_usage)
- [camera_romhack_get_collisions](functions-5.md#camera_romhack_get_collisions) - [camera_romhack_get_collisions](functions-6.md#camera_romhack_get_collisions)
- [camera_config_is_free_cam_enabled](functions-5.md#camera_config_is_free_cam_enabled) - [camera_config_is_free_cam_enabled](functions-6.md#camera_config_is_free_cam_enabled)
- [camera_config_is_analog_cam_enabled](functions-5.md#camera_config_is_analog_cam_enabled) - [camera_config_is_analog_cam_enabled](functions-6.md#camera_config_is_analog_cam_enabled)
- [camera_config_is_dpad_enabled](functions-5.md#camera_config_is_dpad_enabled) - [camera_config_is_dpad_enabled](functions-6.md#camera_config_is_dpad_enabled)
- [camera_config_is_collision_enabled](functions-5.md#camera_config_is_collision_enabled) - [camera_config_is_collision_enabled](functions-6.md#camera_config_is_collision_enabled)
- [camera_config_is_mouse_look_enabled](functions-5.md#camera_config_is_mouse_look_enabled) - [camera_config_is_mouse_look_enabled](functions-6.md#camera_config_is_mouse_look_enabled)
- [camera_config_is_x_inverted](functions-5.md#camera_config_is_x_inverted) - [camera_config_is_x_inverted](functions-6.md#camera_config_is_x_inverted)
- [camera_config_is_y_inverted](functions-5.md#camera_config_is_y_inverted) - [camera_config_is_y_inverted](functions-6.md#camera_config_is_y_inverted)
- [camera_config_get_x_sensitivity](functions-5.md#camera_config_get_x_sensitivity) - [camera_config_get_x_sensitivity](functions-6.md#camera_config_get_x_sensitivity)
- [camera_config_get_y_sensitivity](functions-5.md#camera_config_get_y_sensitivity) - [camera_config_get_y_sensitivity](functions-6.md#camera_config_get_y_sensitivity)
- [camera_config_get_aggression](functions-5.md#camera_config_get_aggression) - [camera_config_get_aggression](functions-6.md#camera_config_get_aggression)
- [camera_config_get_pan_level](functions-5.md#camera_config_get_pan_level) - [camera_config_get_pan_level](functions-6.md#camera_config_get_pan_level)
- [camera_config_get_deceleration](functions-5.md#camera_config_get_deceleration) - [camera_config_get_deceleration](functions-6.md#camera_config_get_deceleration)
- [camera_config_get_centering](functions-5.md#camera_config_get_centering) - [camera_config_get_centering](functions-6.md#camera_config_get_centering)
- [camera_config_enable_free_cam](functions-5.md#camera_config_enable_free_cam) - [camera_config_enable_free_cam](functions-6.md#camera_config_enable_free_cam)
- [camera_config_enable_analog_cam](functions-5.md#camera_config_enable_analog_cam) - [camera_config_enable_analog_cam](functions-6.md#camera_config_enable_analog_cam)
- [camera_config_enable_centering](functions-5.md#camera_config_enable_centering) - [camera_config_enable_centering](functions-6.md#camera_config_enable_centering)
- [camera_config_enable_dpad](functions-5.md#camera_config_enable_dpad) - [camera_config_enable_dpad](functions-6.md#camera_config_enable_dpad)
- [camera_config_enable_collisions](functions-5.md#camera_config_enable_collisions) - [camera_config_enable_collisions](functions-6.md#camera_config_enable_collisions)
- [camera_config_enable_mouse_look](functions-5.md#camera_config_enable_mouse_look) - [camera_config_enable_mouse_look](functions-6.md#camera_config_enable_mouse_look)
- [camera_config_invert_x](functions-5.md#camera_config_invert_x) - [camera_config_invert_x](functions-6.md#camera_config_invert_x)
- [camera_config_invert_y](functions-5.md#camera_config_invert_y) - [camera_config_invert_y](functions-6.md#camera_config_invert_y)
- [camera_config_set_x_sensitivity](functions-5.md#camera_config_set_x_sensitivity) - [camera_config_set_x_sensitivity](functions-6.md#camera_config_set_x_sensitivity)
- [camera_config_set_y_sensitivity](functions-5.md#camera_config_set_y_sensitivity) - [camera_config_set_y_sensitivity](functions-6.md#camera_config_set_y_sensitivity)
- [camera_config_set_aggression](functions-5.md#camera_config_set_aggression) - [camera_config_set_aggression](functions-6.md#camera_config_set_aggression)
- [camera_config_set_pan_level](functions-5.md#camera_config_set_pan_level) - [camera_config_set_pan_level](functions-6.md#camera_config_set_pan_level)
- [camera_config_set_deceleration](functions-5.md#camera_config_set_deceleration) - [camera_config_set_deceleration](functions-6.md#camera_config_set_deceleration)
- [camera_get_checking_surfaces](functions-5.md#camera_get_checking_surfaces) - [camera_get_checking_surfaces](functions-6.md#camera_get_checking_surfaces)
- [camera_set_checking_surfaces](functions-5.md#camera_set_checking_surfaces) - [camera_set_checking_surfaces](functions-6.md#camera_set_checking_surfaces)
<br /> <br />
- smlua_collision_utils.h - smlua_collision_utils.h
- [collision_find_floor](functions-5.md#collision_find_floor) - [collision_find_floor](functions-6.md#collision_find_floor)
- [collision_find_ceil](functions-5.md#collision_find_ceil) - [collision_find_ceil](functions-6.md#collision_find_ceil)
- [get_water_surface_pseudo_floor](functions-5.md#get_water_surface_pseudo_floor) - [get_water_surface_pseudo_floor](functions-6.md#get_water_surface_pseudo_floor)
- [smlua_collision_util_get](functions-5.md#smlua_collision_util_get) - [smlua_collision_util_get](functions-6.md#smlua_collision_util_get)
- [collision_get_temp_wall_collision_data](functions-5.md#collision_get_temp_wall_collision_data) - [collision_get_temp_wall_collision_data](functions-6.md#collision_get_temp_wall_collision_data)
- [get_surface_from_wcd_index](functions-5.md#get_surface_from_wcd_index) - [get_surface_from_wcd_index](functions-6.md#get_surface_from_wcd_index)
- [smlua_collision_util_get_current_terrain_collision](functions-5.md#smlua_collision_util_get_current_terrain_collision) - [smlua_collision_util_get_current_terrain_collision](functions-6.md#smlua_collision_util_get_current_terrain_collision)
- [smlua_collision_util_get_level_collision](functions-5.md#smlua_collision_util_get_level_collision) - [smlua_collision_util_get_level_collision](functions-6.md#smlua_collision_util_get_level_collision)
- [smlua_collision_util_find_surface_types](functions-5.md#smlua_collision_util_find_surface_types) - [smlua_collision_util_find_surface_types](functions-6.md#smlua_collision_util_find_surface_types)
<br /> <br />
@ -1886,7 +1889,6 @@
- [movtexqc_register](functions-6.md#movtexqc_register) - [movtexqc_register](functions-6.md#movtexqc_register)
- [get_water_level](functions-6.md#get_water_level) - [get_water_level](functions-6.md#get_water_level)
- [set_water_level](functions-6.md#set_water_level) - [set_water_level](functions-6.md#set_water_level)
- [play_transition](functions-6.md#play_transition)
- [course_is_main_course](functions-6.md#course_is_main_course) - [course_is_main_course](functions-6.md#course_is_main_course)
- [get_ttc_speed_setting](functions-6.md#get_ttc_speed_setting) - [get_ttc_speed_setting](functions-6.md#get_ttc_speed_setting)
- [set_ttc_speed_setting](functions-6.md#set_ttc_speed_setting) - [set_ttc_speed_setting](functions-6.md#set_ttc_speed_setting)
@ -2015,7 +2017,6 @@
<br /> <br />
- spawn_sound.h - spawn_sound.h
- [exec_anim_sound_state](functions-6.md#exec_anim_sound_state)
- [cur_obj_play_sound_1](functions-6.md#cur_obj_play_sound_1) - [cur_obj_play_sound_1](functions-6.md#cur_obj_play_sound_1)
- [cur_obj_play_sound_2](functions-6.md#cur_obj_play_sound_2) - [cur_obj_play_sound_2](functions-6.md#cur_obj_play_sound_2)
- [create_sound_spawner](functions-6.md#create_sound_spawner) - [create_sound_spawner](functions-6.md#create_sound_spawner)
@ -2035,8 +2036,6 @@
<br /> <br />
- surface_load.h - surface_load.h
- [get_area_terrain_size](functions-6.md#get_area_terrain_size)
- [load_area_terrain](functions-6.md#load_area_terrain)
- [load_object_collision_model](functions-6.md#load_object_collision_model) - [load_object_collision_model](functions-6.md#load_object_collision_model)
- [obj_get_surface_from_index](functions-6.md#obj_get_surface_from_index) - [obj_get_surface_from_index](functions-6.md#obj_get_surface_from_index)
- [surface_has_force](functions-6.md#surface_has_force) - [surface_has_force](functions-6.md#surface_has_force)
@ -2629,6 +2628,29 @@ N/A
<br /> <br />
## [get_mario_spawn_type](#get_mario_spawn_type)
### Description
Derives a `MARIO_SPAWN_*` constant from `o`
### Lua Example
`local enumValue = get_mario_spawn_type(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
[enum MarioSpawnType](constants.md#enum-MarioSpawnType)
### C Prototype
`enum MarioSpawnType get_mario_spawn_type(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [area_get_warp_node](#area_get_warp_node) ## [area_get_warp_node](#area_get_warp_node)
### Description ### Description
@ -2652,6 +2674,27 @@ Finds a warp node in the current area by its ID. The warp node must exist in the
<br /> <br />
## [area_get_any_warp_node](#area_get_any_warp_node)
### Description
Gets the first warp node found in the area, otherwise returns nil
### Lua Example
`local ObjectWarpNodeValue = area_get_any_warp_node()`
### Parameters
- None
### Returns
[ObjectWarpNode](structs.md#ObjectWarpNode)
### C Prototype
`struct ObjectWarpNode *area_get_any_warp_node(void);`
[:arrow_up_small:](#)
<br />
## [area_get_warp_node_from_params](#area_get_warp_node_from_params) ## [area_get_warp_node_from_params](#area_get_warp_node_from_params)
### Description ### Description
@ -2673,6 +2716,61 @@ Finds a warp node in the current area using parameters from the provided object.
[:arrow_up_small:](#) [:arrow_up_small:](#)
<br />
## [play_transition](#play_transition)
### Description
Plays a screen transition
### Lua Example
`play_transition(transType, time, red, green, blue)`
### Parameters
| Field | Type |
| ----- | ---- |
| transType | `integer` |
| time | `integer` |
| red | `integer` |
| green | `integer` |
| blue | `integer` |
### Returns
- None
### C Prototype
`void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue);`
[:arrow_up_small:](#)
<br />
## [play_transition_after_delay](#play_transition_after_delay)
### Description
Plays a screen transition after a `delay` in frames
### Lua Example
`play_transition_after_delay(transType, time, red, green, blue, delay)`
### Parameters
| Field | Type |
| ----- | ---- |
| transType | `integer` |
| time | `integer` |
| red | `integer` |
| green | `integer` |
| blue | `integer` |
| delay | `integer` |
### Returns
- None
### C Prototype
`void play_transition_after_delay(s16 transType, s16 time, u8 red, u8 green, u8 blue, s16 delay);`
[:arrow_up_small:](#)
<br /> <br />
--- ---

View file

@ -146,7 +146,7 @@ The lua functions sent to `hook_event()` will be automatically called by SM64 wh
| HOOK_MARIO_OVERRIDE_GEOMETRY_INPUTS | Called before running Mario's geometry input logic, return `false` to not run it. | [MarioState](../structs.md) m | | HOOK_MARIO_OVERRIDE_GEOMETRY_INPUTS | Called before running Mario's geometry input logic, return `false` to not run it. | [MarioState](../structs.md) m |
| HOOK_ON_INTERACTIONS | Called when the Mario interactions are processed | [MarioState](../structs.md#MarioState) mario | | HOOK_ON_INTERACTIONS | Called when the Mario interactions are processed | [MarioState](../structs.md#MarioState) mario |
| HOOK_ALLOW_FORCE_WATER_ACTION | Called when executing a non-water action while under the water's surface, or vice versa. Return `false` to prevent the player from being forced out of the action at the water's surface | [MarioState](../structs.md#MarioState) mario, `boolean` isInWaterAction | | HOOK_ALLOW_FORCE_WATER_ACTION | Called when executing a non-water action while under the water's surface, or vice versa. Return `false` to prevent the player from being forced out of the action at the water's surface | [MarioState](../structs.md#MarioState) mario, `boolean` isInWaterAction |
| HOOK_BEFORE_WARP | Called before the local player warps. Return a table with `destLevel`, `destArea`, `destAreaWarpNode`, and `arg` to override the warp | `integer` destLevel, `integer` destArea, `integer` destAreaWarpNode, `integer` arg | | HOOK_BEFORE_WARP | Called before the local player warps. Return a table with `destLevel`, `destArea`, `destWarpNode`, and `arg` to override the warp | `integer` destLevel, `integer` destArea, `integer` destWarpNode, `integer` arg |
### Parameters ### Parameters

View file

@ -100,7 +100,6 @@
- [SpawnParticlesInfo](#SpawnParticlesInfo) - [SpawnParticlesInfo](#SpawnParticlesInfo)
- [StarPositions](#StarPositions) - [StarPositions](#StarPositions)
- [StarsNeededForDialog](#StarsNeededForDialog) - [StarsNeededForDialog](#StarsNeededForDialog)
- [Struct802A272C](#Struct802A272C)
- [Surface](#Surface) - [Surface](#Surface)
- [TextureInfo](#TextureInfo) - [TextureInfo](#TextureInfo)
- [TransitionInfo](#TransitionInfo) - [TransitionInfo](#TransitionInfo)
@ -120,7 +119,6 @@
- [WaterDropletParams](#WaterDropletParams) - [WaterDropletParams](#WaterDropletParams)
- [Waypoint](#Waypoint) - [Waypoint](#Waypoint)
- [Whirlpool](#Whirlpool) - [Whirlpool](#Whirlpool)
- [struct802A1230](#struct802A1230)
<br /> <br />
@ -3116,17 +3114,6 @@
<br /> <br />
## [Struct802A272C](#Struct802A272C)
| Field | Type | Access |
| ----- | ---- | ------ |
| vecF | [Vec3f](structs.md#Vec3f) | read-only |
| vecS | [Vec3s](structs.md#Vec3s) | read-only |
[:arrow_up_small:](#)
<br />
## [Surface](#Surface) ## [Surface](#Surface)
| Field | Type | Access | | Field | Type | Access |
@ -3385,14 +3372,3 @@
<br /> <br />
## [struct802A1230](#struct802A1230)
| Field | Type | Access |
| ----- | ---- | ------ |
| unk00 | `integer` | |
| unk02 | `integer` | |
[:arrow_up_small:](#)
<br />

View file

@ -133,9 +133,9 @@ void audio_set_sound_mode(u8 arg0);
void audio_init(void); // in load.c void audio_init(void); // in load.c
/* |description||descriptionEnd| */ /* |description|Resets a sequence's (`seqId`) volume back to the default volume|descriptionEnd| */
void sound_reset_background_music_default_volume(u8 seqId); void sound_reset_background_music_default_volume(u8 seqId);
/* |description||descriptionEnd| */ /* |description|Sets a sequence's (`seqId`) volume to `volume`|descriptionEnd| */
void sound_set_background_music_default_volume(u8 seqId, u8 volume); void sound_set_background_music_default_volume(u8 seqId, u8 volume);
#if defined(VERSION_EU) || defined(VERSION_SH) #if defined(VERSION_EU) || defined(VERSION_SH)
@ -143,7 +143,9 @@ struct SPTask *unused_80321460();
struct SPTask *unused_80321460(void); struct SPTask *unused_80321460(void);
#endif #endif
/* |description|Gets a sound left/right pan using `x` and `z`|descriptionEnd| */
f32 get_sound_pan(f32 x, f32 z); f32 get_sound_pan(f32 x, f32 z);
/* |description|Gets a sound level intensity based on `distance`|descriptionEnd| */
f32 sound_get_level_intensity(f32 distance); f32 sound_get_level_intensity(f32 distance);
#endif // AUDIO_EXTERNAL_H #endif // AUDIO_EXTERNAL_H

View file

@ -40,7 +40,7 @@ You must run this every frame in your object's behavior loop for it to have coll
void load_object_collision_model(void); void load_object_collision_model(void);
/* |description|Gets a surface corresponding to `index` from the surface pool buffer|descriptionEnd| */ /* |description|Gets a surface corresponding to `index` from the surface pool buffer|descriptionEnd| */
struct Surface *obj_get_surface_from_index(struct Object *o, u32 index); struct Surface *obj_get_surface_from_index(struct Object *o, u32 index);
/* |description||descriptionEnd| */ /* |description|Checks if a surface has force|descriptionEnd| */
bool surface_has_force(s16 surfaceType); bool surface_has_force(s16 surfaceType);
#endif // SURFACE_LOAD_H #endif // SURFACE_LOAD_H

View file

@ -147,18 +147,18 @@ void print_intro_text(void) {
} }
} }
u32 get_mario_spawn_type(struct Object *o) { enum MarioSpawnType get_mario_spawn_type(struct Object *o) {
if (o == NULL || o->behavior == NULL) { return 0; } if (o == NULL || o->behavior == NULL) { return MARIO_SPAWN_NONE; }
const BehaviorScript *behavior = virtual_to_segmented(0x13, o->behavior); const BehaviorScript *behavior = virtual_to_segmented(0x13, o->behavior);
if (behavior == NULL) { return 0; } if (behavior == NULL) { return MARIO_SPAWN_NONE; }
for (s32 i = 0; i < 20; i++) { for (s32 i = 0; i < 20; i++) {
if (sWarpBhvSpawnTable[i] == behavior) { if (sWarpBhvSpawnTable[i] == smlua_override_behavior(behavior)) {
return sSpawnTypeFromWarpBhv[i]; return sSpawnTypeFromWarpBhv[i];
} }
} }
return 0; return MARIO_SPAWN_NONE;
} }
struct ObjectWarpNode *area_get_warp_node(u8 id) { struct ObjectWarpNode *area_get_warp_node(u8 id) {

View file

@ -157,13 +157,15 @@ extern u8 gSpawnedStarHiddenCount;
void override_viewport_and_clip(Vp *a, Vp *b, u8 c, u8 d, u8 e); void override_viewport_and_clip(Vp *a, Vp *b, u8 c, u8 d, u8 e);
void print_intro_text(void); void print_intro_text(void);
u32 get_mario_spawn_type(struct Object *o); /* |description|Derives a `MARIO_SPAWN_*` constant from `o`|descriptionEnd| */
enum MarioSpawnType get_mario_spawn_type(struct Object *o);
/* |description| /* |description|
Finds a warp node in the current area by its ID. The warp node must exist in the list of warp nodes for the current area. Finds a warp node in the current area by its ID. The warp node must exist in the list of warp nodes for the current area.
Useful for locating a specific warp point in the level, such as teleportation zones or connections to other areas Useful for locating a specific warp point in the level, such as teleportation zones or connections to other areas
|descriptionEnd| */ |descriptionEnd| */
struct ObjectWarpNode *area_get_warp_node(u8 id); struct ObjectWarpNode *area_get_warp_node(u8 id);
/* |description|Gets the first warp node found in the area, otherwise returns nil|descriptionEnd| */
struct ObjectWarpNode *area_get_any_warp_node(void); struct ObjectWarpNode *area_get_any_warp_node(void);
/* |description| /* |description|
@ -179,7 +181,9 @@ void load_mario_area(void);
void unload_mario_area(void); void unload_mario_area(void);
void change_area(s32 index); void change_area(s32 index);
void area_update_objects(void); void area_update_objects(void);
/* |description|Plays a screen transition|descriptionEnd| */
void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue); void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue);
/* |description|Plays a screen transition after a `delay` in frames|descriptionEnd| */
void play_transition_after_delay(s16 transType, s16 time, u8 red, u8 green, u8 blue, s16 delay); void play_transition_after_delay(s16 transType, s16 time, u8 red, u8 green, u8 blue, s16 delay);
void render_game(void); void render_game(void);

View file

@ -1152,6 +1152,7 @@ This function handles smooth transitions between different gameplay scenarios
|descriptionEnd| */ |descriptionEnd| */
s16 next_lakitu_state(Vec3f newPos, Vec3f newFoc, Vec3f curPos, Vec3f curFoc, Vec3f oldPos, Vec3f oldFoc, s16 yaw); s16 next_lakitu_state(Vec3f newPos, Vec3f newFoc, Vec3f curPos, Vec3f curFoc, Vec3f oldPos, Vec3f oldFoc, s16 yaw);
/* |description|Set the fixed camera base pos depending on the current level area|descriptionEnd| */
void set_fixed_cam_axis_sa_lobby(UNUSED s16 preset); void set_fixed_cam_axis_sa_lobby(UNUSED s16 preset);
/* |description| /* |description|
Processes course-specific camera settings, such as predefined positions or modes. Processes course-specific camera settings, such as predefined positions or modes.

View file

@ -357,6 +357,7 @@ struct Character {
struct MarioState; struct MarioState;
extern struct Character gCharacters[]; extern struct Character gCharacters[];
/* |description|Gets a Character struct from `m`|descriptionEnd| */
struct Character* get_character(struct MarioState* m); struct Character* get_character(struct MarioState* m);
/* |description| /* |description|

View file

@ -419,7 +419,7 @@ void init_mario_after_warp(void) {
if (spawnNode == NULL || spawnNode->object == NULL) { spawnNode = area_get_any_warp_node(); } if (spawnNode == NULL || spawnNode->object == NULL) { spawnNode = area_get_any_warp_node(); }
if (spawnNode == NULL || spawnNode->object == NULL) { return; } if (spawnNode == NULL || spawnNode->object == NULL) { return; }
u32 marioSpawnType = get_mario_spawn_type(spawnNode->object); enum MarioSpawnType marioSpawnType = get_mario_spawn_type(spawnNode->object);
if (gMarioState && gMarioState->action != ACT_UNINITIALIZED) { if (gMarioState && gMarioState->action != ACT_UNINITIALIZED) {
for (s32 i = 0; i < MAX_PLAYERS; i++) { for (s32 i = 0; i < MAX_PLAYERS; i++) {

View file

@ -1944,8 +1944,7 @@ s32 act_taking_off_cap(struct MarioState *m) {
/* |description| /* |description|
Handles the cutscene and animation sequence for when Mario is stuck in the ground (head, butt, or feet). Plays a designated `animation`, checks specific frames (`unstuckFrame`, `target2`, `target3`) for sound effects or transitions, and frees Mario to the `endAction` once the animation completes Handles the cutscene and animation sequence for when Mario is stuck in the ground (head, butt, or feet). Plays a designated `animation`, checks specific frames (`unstuckFrame`, `target2`, `target3`) for sound effects or transitions, and frees Mario to the `endAction` once the animation completes
|descriptionEnd| */ |descriptionEnd| */
void stuck_in_ground_handler(struct MarioState *m, s32 animation, s32 unstuckFrame, s32 target2, void stuck_in_ground_handler(struct MarioState *m, s32 animation, s32 unstuckFrame, s32 target2, s32 target3, s32 endAction) {
s32 target3, s32 endAction) {
if (!m) { return; } if (!m) { return; }
s32 animFrame = set_character_animation(m, animation); s32 animFrame = set_character_animation(m, animation);

View file

@ -24,8 +24,8 @@ void stub_mario_step_2(void);
/* |description|Reflects Mario off a wall if he is colliding with one and flips forward velocity if `negateSpeed` is TRUE |descriptionEnd| */ /* |description|Reflects Mario off a wall if he is colliding with one and flips forward velocity if `negateSpeed` is TRUE |descriptionEnd| */
void mario_bonk_reflection(struct MarioState *m, u8 negateSpeed); void mario_bonk_reflection(struct MarioState *m, u8 negateSpeed);
void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollisionData *obj2); void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollisionData *obj2);
BAD_RETURN(s32) init_bully_collision_data(struct BullyCollisionData *data, f32 posX, f32 posZ, /* |description|Sets the values of `data` for bully "collision"|descriptionEnd| */
f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius); BAD_RETURN(s32) init_bully_collision_data(struct BullyCollisionData *data, f32 posX, f32 posZ, f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius);
/* |description|Updates Mario's state in quicksand, sinks him at `sinkingSpeed` if he's in non instant quicksand|descriptionEnd| */ /* |description|Updates Mario's state in quicksand, sinks him at `sinkingSpeed` if he's in non instant quicksand|descriptionEnd| */
u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed); u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed);
/* |description|Pushes Mario off a steep floor and sets his action to `action` with `actionArg`|descriptionEnd| */ /* |description|Pushes Mario off a steep floor and sets his action to `action` with `actionArg`|descriptionEnd| */

View file

@ -77,10 +77,7 @@ s16 sPrevCheckMarioRoom = 0;
*/ */
s8 sYoshiDead = FALSE; s8 sYoshiDead = FALSE;
/** /* |description|Resets Yoshi as being alive|descriptionEnd| */
* Resets yoshi as spawned/despawned upon new file select.
* Possibly a function with stubbed code.
*/
void set_yoshi_as_not_dead(void) { void set_yoshi_as_not_dead(void) {
sYoshiDead = FALSE; sYoshiDead = FALSE;
} }
@ -128,9 +125,7 @@ Gfx UNUSED *geo_obj_transparency_something(s32 callContext, struct GraphNode *no
return gfxHead; return gfxHead;
} }
/** /* |description|An absolute value (always positive) function.|descriptionEnd| */
* An absolute value function.
*/
f32 absf_2(f32 f) { f32 absf_2(f32 f) {
if (f < 0) { if (f < 0) {
f *= -1.0f; f *= -1.0f;
@ -153,9 +148,7 @@ void turn_obj_away_from_surface(f32 velX, f32 velZ, f32 nX, UNUSED f32 nY, f32 n
if (isnan(*objYawZ)) { *objYawZ = 0; } if (isnan(*objYawZ)) { *objYawZ = 0; }
} }
/** /* |description|Finds any wall collisions, applies them, and turns away from the surface.|descriptionEnd| */
* Finds any wall collisions, applies them, and turns away from the surface.
*/
s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ) { s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ) {
if (!o) { return 0; } if (!o) { return 0; }
struct WallCollisionData hitbox = { 0 }; struct WallCollisionData hitbox = { 0 };
@ -195,9 +188,7 @@ s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ) {
return TRUE; return TRUE;
} }
/** /* |description|Turns an object away from steep floors, similarly to walls.|descriptionEnd| */
* Turns an object away from steep floors, similarly to walls.
*/
s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ) { s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ) {
if (!o) { return 0; } if (!o) { return 0; }
f32 floor_nX, floor_nY, floor_nZ, objVelXCopy, objVelZCopy, objYawX, objYawZ; f32 floor_nX, floor_nY, floor_nZ, objVelXCopy, objVelZCopy, objYawX, objYawZ;
@ -225,9 +216,7 @@ s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objV
return TRUE; return TRUE;
} }
/** /* |description|Orients an object with the given normals, typically the surface under the object.|descriptionEnd| */
* Orients an object with the given normals, typically the surface under the object.
*/
void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ) { void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ) {
if (!obj) { return; } if (!obj) { return; }
Vec3f objVisualPosition, surfaceNormals; Vec3f objVisualPosition, surfaceNormals;
@ -275,9 +264,7 @@ void calc_obj_friction(f32 *objFriction, f32 floor_nY) {
} }
} }
/** /* |description|Updates an objects speed for gravity and updates Y position.|descriptionEnd| */
* Updates an objects speed for gravity and updates Y position.
*/
void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ) { void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ) {
if (!o) { return; } if (!o) { return; }
if (!objFloor) { return; } if (!objFloor) { return; }
@ -337,8 +324,8 @@ void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 obj
} }
} }
void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, /* |description|Adjusts the current object's veloicty and y position for being underwater|descriptionEnd| */
f32 waterY) { void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, f32 waterY) {
if (!o) { return; } if (!o) { return; }
if (!objFloor) { return; } if (!objFloor) { return; }
f32 floor_nX = objFloor->normal.x; f32 floor_nX = objFloor->normal.x;
@ -406,9 +393,7 @@ void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY,
o->oVelY *= 0.8; o->oVelY *= 0.8;
} }
/** /* |description|Updates an objects position from oForwardVel and oMoveAngleYaw.|descriptionEnd| */
* Updates an objects position from oForwardVel and oMoveAngleYaw.
*/
void obj_update_pos_vel_xz(void) { void obj_update_pos_vel_xz(void) {
if (!o) { return; } if (!o) { return; }
f32 xVel = o->oForwardVel * sins(o->oMoveAngleYaw); f32 xVel = o->oForwardVel * sins(o->oMoveAngleYaw);
@ -418,10 +403,7 @@ void obj_update_pos_vel_xz(void) {
o->oPosZ += zVel; o->oPosZ += zVel;
} }
/** /* |description|Generates splashes if at surface of water, entering water, or bubbles if underwater|descriptionEnd| */
* Generates splashes if at surface of water, entering water, or bubbles
* if underwater.
*/
void obj_splash(s32 waterY, s32 objY) { void obj_splash(s32 waterY, s32 objY) {
if (!o) { return; } if (!o) { return; }
u32 globalTimer = gGlobalTimer; u32 globalTimer = gGlobalTimer;
@ -441,10 +423,10 @@ void obj_splash(s32 waterY, s32 objY) {
} }
} }
/** /* |description|
* Generic object move function. Handles walls, water, floors, and gravity. Generic object move function. Handles walls, water, floors, and gravity.
* Returns flags for certain interactions. Returns flags for certain interactions
*/ |descriptionEnd| */
s16 object_step(void) { s16 object_step(void) {
if (!o) { return 0; } if (!o) { return 0; }
f32 objX = o->oPosX; f32 objX = o->oPosX;
@ -493,10 +475,10 @@ s16 object_step(void) {
return collisionFlags; return collisionFlags;
} }
/** /* |description|
* Takes an object step but does not orient with the object's floor. Takes an object step but does not orient with the object's floor.
* Used for boulders, falling pillars, and the rolling snowman body. Used for boulders, falling pillars, and the rolling snowman body
*/ |descriptionEnd| */
s16 object_step_without_floor_orient(void) { s16 object_step_without_floor_orient(void) {
s16 collisionFlags = 0; s16 collisionFlags = 0;
sOrientObjWithFloor = FALSE; sOrientObjWithFloor = FALSE;
@ -506,13 +488,10 @@ s16 object_step_without_floor_orient(void) {
return collisionFlags; return collisionFlags;
} }
/** /* |description|
* Uses an object's forward velocity and yaw to move its X, Y, and Z positions. Don't use this function outside of of a context where the current object and `obj` are the same.
* This does accept an object as an argument, though it is always called with `o`. Moves `obj` based on a seemingly random mix of using either the current obj or `obj`'s fields
* If it wasn't called with `o`, it would modify `o`'s X and Z velocities based on |descriptionEnd| */
* `obj`'s forward velocity and yaw instead of `o`'s, and wouldn't update `o`'s
* position.
*/
void obj_move_xyz_using_fvel_and_yaw(struct Object *obj) { void obj_move_xyz_using_fvel_and_yaw(struct Object *obj) {
if (!o || !obj) { return; } if (!o || !obj) { return; }
o->oVelX = obj->oForwardVel * sins(obj->oMoveAngleYaw); o->oVelX = obj->oForwardVel * sins(obj->oMoveAngleYaw);
@ -523,9 +502,7 @@ void obj_move_xyz_using_fvel_and_yaw(struct Object *obj) {
obj->oPosZ += o->oVelZ; obj->oPosZ += o->oVelZ;
} }
/** /* |description|Checks if a point is within distance from any active Mario visible to enemies' graphical position|descriptionEnd| */
* Checks if a point is within distance from Mario's graphical position. Test is exclusive.
*/
s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist) { s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist) {
for (s32 i = 0; i < MAX_PLAYERS; i++) { for (s32 i = 0; i < MAX_PLAYERS; i++) {
if (!is_player_active(&gMarioStates[i])) { continue; } if (!is_player_active(&gMarioStates[i])) { continue; }
@ -545,6 +522,7 @@ s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist) {
return FALSE; return FALSE;
} }
/* |description|Checks if a point is within distance from any active Mario's graphical position|descriptionEnd| */
s8 is_point_within_radius_of_any_player(f32 x, f32 y, f32 z, s32 dist) { s8 is_point_within_radius_of_any_player(f32 x, f32 y, f32 z, s32 dist) {
for (s32 i = 0; i < MAX_PLAYERS; i++) { for (s32 i = 0; i < MAX_PLAYERS; i++) {
if (!is_player_active(&gMarioStates[i])) { continue; } if (!is_player_active(&gMarioStates[i])) { continue; }
@ -563,6 +541,7 @@ s8 is_point_within_radius_of_any_player(f32 x, f32 y, f32 z, s32 dist) {
return FALSE; return FALSE;
} }
/* |description|Checks if `m` is in the current course/act/level/area and isn't bubbled|descriptionEnd| */
u8 is_player_active(struct MarioState* m) { u8 is_player_active(struct MarioState* m) {
if (!m) { return FALSE; } if (!m) { return FALSE; }
if (gNetworkType == NT_NONE && m == &gMarioStates[0]) { return TRUE; } if (gNetworkType == NT_NONE && m == &gMarioStates[0]) { return TRUE; }
@ -582,6 +561,7 @@ u8 is_player_active(struct MarioState* m) {
return TRUE; return TRUE;
} }
/* |description|Checks if any player besides the local player is in the current course/act/level/area|descriptionEnd| */
u8 is_other_player_active(void) { u8 is_other_player_active(void) {
for (s32 i = 1; i < MAX_PLAYERS; i++) { for (s32 i = 1; i < MAX_PLAYERS; i++) {
struct MarioState *m = &gMarioStates[i]; struct MarioState *m = &gMarioStates[i];
@ -590,6 +570,7 @@ u8 is_other_player_active(void) {
return FALSE; return FALSE;
} }
/* |description|Checks if `m` is in the current course/act/level/area|descriptionEnd| */
u8 is_player_in_local_area(struct MarioState* m) { u8 is_player_in_local_area(struct MarioState* m) {
if (!m) { return FALSE; } if (!m) { return FALSE; }
if (gNetworkType == NT_NONE && m == &gMarioStates[0]) { return TRUE; } if (gNetworkType == NT_NONE && m == &gMarioStates[0]) { return TRUE; }
@ -608,9 +589,7 @@ u8 is_player_in_local_area(struct MarioState* m) {
return TRUE; return TRUE;
} }
/** /* |description|Gets the nearest active Mario who isn't bubbled to `obj`|descriptionEnd| */
* Returns closest MarioState
*/
struct MarioState* nearest_mario_state_to_object(struct Object *obj) { struct MarioState* nearest_mario_state_to_object(struct Object *obj) {
if (!obj) { return NULL; } if (!obj) { return NULL; }
struct MarioState* nearest = NULL; struct MarioState* nearest = NULL;
@ -630,6 +609,7 @@ struct MarioState* nearest_mario_state_to_object(struct Object *obj) {
return nearest; return nearest;
} }
/* |description|Gets the nearest possible Mario to `obj` despite anything like bubbled state or enemy visibility|descriptionEnd| */
struct MarioState* nearest_possible_mario_state_to_object(struct Object *obj) { struct MarioState* nearest_possible_mario_state_to_object(struct Object *obj) {
if (!obj) { return NULL; } if (!obj) { return NULL; }
struct MarioState* nearest = NULL; struct MarioState* nearest = NULL;
@ -648,9 +628,7 @@ struct MarioState* nearest_possible_mario_state_to_object(struct Object *obj) {
return nearest; return nearest;
} }
/** /* |description|Gets the nearest player (Mario Object) to `obj`|descriptionEnd| */
* Returns closest marioObj
*/
struct Object* nearest_player_to_object(struct Object *obj) { struct Object* nearest_player_to_object(struct Object *obj) {
if (!obj) { return NULL; } if (!obj) { return NULL; }
struct MarioState* nearest = nearest_mario_state_to_object(obj); struct MarioState* nearest = nearest_mario_state_to_object(obj);
@ -658,9 +636,7 @@ struct Object* nearest_player_to_object(struct Object *obj) {
return nearest->marioObj; return nearest->marioObj;
} }
/** /* |description|Gets the nearest interacting Mario to `obj`|descriptionEnd| */
* Returns closest MarioState that's interacting with the object.
*/
struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj) { struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj) {
if (!obj) { return NULL; } if (!obj) { return NULL; }
struct MarioState *nearest = NULL; struct MarioState *nearest = NULL;
@ -686,9 +662,7 @@ struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj)
return nearest; return nearest;
} }
/** /* |description|Gets the nearest interacting player (Mario Object) to `obj`|descriptionEnd| */
* Returns closest marioObj that's interacting with the object.
*/
struct Object *nearest_interacting_player_to_object(struct Object *obj) { struct Object *nearest_interacting_player_to_object(struct Object *obj) {
if (!obj) { return NULL; } if (!obj) { return NULL; }
struct MarioState *nearest = nearest_interacting_mario_state_to_object(obj); struct MarioState *nearest = nearest_interacting_mario_state_to_object(obj);
@ -696,20 +670,14 @@ struct Object *nearest_interacting_player_to_object(struct Object *obj) {
return nearest->marioObj; return nearest->marioObj;
} }
/** /* |description|Checks if `m` is the nearest Mario to `obj`|descriptionEnd| */
* Returns whether or not the MarioState is the closet MarioState
* to the object.
*/
u8 is_nearest_mario_state_to_object(struct MarioState *m, struct Object *obj) { u8 is_nearest_mario_state_to_object(struct MarioState *m, struct Object *obj) {
if (m == NULL || obj == NULL) { return FALSE; } if (m == NULL || obj == NULL) { return FALSE; }
struct MarioState *nearest = nearest_mario_state_to_object(obj); struct MarioState *nearest = nearest_mario_state_to_object(obj);
return m == nearest; return m == nearest;
} }
/** /* |description|Checks if `m` is the nearest player (Mario Object) to `obj` |descriptionEnd| */
* Returns whether or not the player is the closet player
* to the object.
*/
u8 is_nearest_player_to_object(struct Object *m, struct Object *obj) { u8 is_nearest_player_to_object(struct Object *m, struct Object *obj) {
if (m == NULL || obj == NULL) { return FALSE; } if (m == NULL || obj == NULL) { return FALSE; }
struct MarioState *nearest = nearest_mario_state_to_object(obj); struct MarioState *nearest = nearest_mario_state_to_object(obj);
@ -717,9 +685,7 @@ u8 is_nearest_player_to_object(struct Object *m, struct Object *obj) {
return m == nearest->marioObj; return m == nearest->marioObj;
} }
/** /* |description|Checks if a point is within `dist` of `obj`|descriptionEnd|*/
* Checks whether a point is within distance of a given point. Test is exclusive.
*/
s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist) { s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist) {
if (!obj) { return FALSE; } if (!obj) { return FALSE; }
f32 objX = obj->oPosX; f32 objX = obj->oPosX;
@ -734,9 +700,7 @@ s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist) {
return FALSE; return FALSE;
} }
/** /* |description|Sets an object as visible if within a certain distance of Mario's graphical position|descriptionEnd| */
* Sets an object as visible if within a certain distance of Mario's graphical position.
*/
void set_object_visibility(struct Object *obj, s32 dist) { void set_object_visibility(struct Object *obj, s32 dist) {
if (!obj) { return; } if (!obj) { return; }
s32 distanceToPlayer = dist_between_objects(obj, gMarioStates[0].marioObj); s32 distanceToPlayer = dist_between_objects(obj, gMarioStates[0].marioObj);
@ -747,9 +711,7 @@ void set_object_visibility(struct Object *obj, s32 dist) {
} }
} }
/** /* |description|Turns an object towards home if Mario is not near to it|descriptionEnd| */
* Turns an object towards home if Mario is not near to it.
*/
s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist) { s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist) {
if (!obj) { return FALSE; } if (!obj) { return FALSE; }
f32 homeDistX = homeX - obj->oPosX; f32 homeDistX = homeX - obj->oPosX;
@ -765,9 +727,7 @@ s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32
return FALSE; return FALSE;
} }
/** /* |description|Randomly displaces an objects home if RNG says to, and turns the object towards its home|descriptionEnd| */
* Randomly displaces an objects home if RNG says to, and turns the object towards its home.
*/
void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp) { void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp) {
if (!obj) { return; } if (!obj) { return; }
s16 angleToNewHome; s16 angleToNewHome;
@ -784,10 +744,10 @@ void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 home
obj->oMoveAngleYaw = approach_s16_symmetric(obj->oMoveAngleYaw, angleToNewHome, 320); obj->oMoveAngleYaw = approach_s16_symmetric(obj->oMoveAngleYaw, angleToNewHome, 320);
} }
/** /* |description|
* A series of checks using sin and cos to see if a given angle is facing in the same direction A series of checks using sin and cos to see if a given angle is facing in the same direction
* of a given angle, within a certain range. of a given angle, within a certain range
*/ |descriptionEnd|*/
s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range) { s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range) {
s16 dAngle = (u16) goal - (u16) base; s16 dAngle = (u16) goal - (u16) base;
@ -799,9 +759,7 @@ s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range) {
return FALSE; return FALSE;
} }
/** /* |description|Finds any wall collisions and returns what the displacement vector would be.|descriptionEnd| */
* Finds any wall collisions and returns what the displacement vector would be.
*/
s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius) { s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius) {
struct WallCollisionData hitbox; struct WallCollisionData hitbox;
UNUSED u8 filler[0x20]; UNUSED u8 filler[0x20];
@ -822,10 +780,9 @@ s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius) {
} }
} }
/** /* |description|
* Spawns a number of coins at the location of an object Spawns a number of coins at the location of an object with a random forward velocity, y velocity, and direction
* with a random forward velocity, y velocity, and direction. |descriptionEnd| */
*/
void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins) { void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins) {
if (!o) { return; } if (!o) { return; }
if (!obj) { return; } if (!obj) { return; }
@ -844,9 +801,7 @@ void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins) {
rng_position_finish(); rng_position_finish();
} }
/** /* |description|Controls whether certain objects should flicker/when to despawn|descriptionEnd| */
* Controls whether certain objects should flicker/when to despawn.
*/
s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan) { s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan) {
if (!obj) { return FALSE; } if (!obj) { return FALSE; }
if (obj->oTimer < lifeSpan) { if (obj->oTimer < lifeSpan) {
@ -867,9 +822,7 @@ s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan) {
return FALSE; return FALSE;
} }
/** /* |description|Checks if a given room is Mario's current room, even if on an object|descriptionEnd| */
* Checks if a given room is Mario's current room, even if on an object.
*/
s8 current_mario_room_check(s16 room) { s8 current_mario_room_check(s16 room) {
s16 result; s16 result;
@ -924,9 +877,10 @@ s16 trigger_obj_dialog_when_facing(struct MarioState* m, s32 *inDialog, s16 dial
return 0; return 0;
} }
/** /* |description|
*Checks if a floor is one that should cause an object to "die". Checks if `floor`'s type is burning or death plane and if so change the
*/ current object's action accordingly
|descriptionEnd| */
void obj_check_floor_death(s16 collisionFlags, struct Surface *floor) { void obj_check_floor_death(s16 collisionFlags, struct Surface *floor) {
if (!o) { return; } if (!o) { return; }
if (floor == NULL) { return; } if (floor == NULL) { return; }
@ -946,10 +900,10 @@ void obj_check_floor_death(s16 collisionFlags, struct Surface *floor) {
} }
} }
/** /* |description|
* Controls an object dying in lava by creating smoke, sinking the object, playing Controls an object dying in lava by creating smoke, sinking the object, playing
* audio, and eventually despawning it. Returns TRUE when the obj is dead. audio, and eventually despawning it. Returns TRUE when the obj is dead
*/ |descriptionEnd| */
s8 obj_lava_death(void) { s8 obj_lava_death(void) {
if (!o) { return 0; } if (!o) { return 0; }
struct Object *deathSmoke; struct Object *deathSmoke;
@ -976,9 +930,7 @@ s8 obj_lava_death(void) {
return FALSE; return FALSE;
} }
/** /* |description|Spawns an orange number object relatively, such as those that count up for secrets.|descriptionEnd| */
* Spawns an orange number object relatively, such as those that count up for secrets.
*/
void spawn_orange_number(s8 behParam, s16 relX, s16 relY, s16 relZ) { void spawn_orange_number(s8 behParam, s16 relX, s16 relY, s16 relZ) {
struct Object *orangeNumber; struct Object *orangeNumber;
orangeNumber = spawn_object_relative(behParam, relX, relY, relZ, o, MODEL_NUMBER, bhvOrangeNumber); orangeNumber = spawn_object_relative(behParam, relX, relY, relZ, o, MODEL_NUMBER, bhvOrangeNumber);

View file

@ -3476,6 +3476,7 @@ void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 o
} }
#endif #endif
/* |description|Sets the current object's home only the first time it's called|descriptionEnd| */
void cur_obj_set_home_once(void) { void cur_obj_set_home_once(void) {
if (!o) { return; } if (!o) { return; }
if (o->setHome) { return; } if (o->setHome) { return; }
@ -3485,6 +3486,8 @@ void cur_obj_set_home_once(void) {
o->oHomeZ = o->oPosZ; o->oHomeZ = o->oPosZ;
} }
/* |description|Gets a trajectory's length|descriptionEnd| */
s32 get_trajectory_length(Trajectory* trajectory) { s32 get_trajectory_length(Trajectory* trajectory) {
if (!trajectory) { return 0; } if (!trajectory) { return 0; }
s32 count = 0; s32 count = 0;

View file

@ -40,16 +40,6 @@ struct WaterDropletParams
f32 randSizeScale; f32 randSizeScale;
}; };
struct struct802A1230 {
/*0x00*/ s16 unk00;
/*0x02*/ s16 unk02;
};
struct Struct802A272C {
Vec3f vecF;
Vec3s vecS;
};
// TODO: Field names // TODO: Field names
struct SpawnParticlesInfo struct SpawnParticlesInfo
{ {

View file

@ -2655,12 +2655,6 @@ static struct LuaObjectField sStarsNeededForDialogFields[LUA_STARS_NEEDED_FOR_DI
{ "dialog6", LVT_U16, offsetof(struct StarsNeededForDialog, dialog6), false, LOT_NONE, 1, sizeof(u16) }, { "dialog6", LVT_U16, offsetof(struct StarsNeededForDialog, dialog6), false, LOT_NONE, 1, sizeof(u16) },
}; };
#define LUA_STRUCT802_A272_C_FIELD_COUNT 2
static struct LuaObjectField sStruct802A272CFields[LUA_STRUCT802_A272_C_FIELD_COUNT] = {
{ "vecF", LVT_COBJECT, offsetof(struct Struct802A272C, vecF), true, LOT_VEC3F, 1, sizeof(Vec3f) },
{ "vecS", LVT_COBJECT, offsetof(struct Struct802A272C, vecS), true, LOT_VEC3S, 1, sizeof(Vec3s) },
};
#define LUA_SURFACE_FIELD_COUNT 16 #define LUA_SURFACE_FIELD_COUNT 16
static struct LuaObjectField sSurfaceFields[LUA_SURFACE_FIELD_COUNT] = { static struct LuaObjectField sSurfaceFields[LUA_SURFACE_FIELD_COUNT] = {
{ "flags", LVT_S8, offsetof(struct Surface, flags), false, LOT_NONE, 1, sizeof(s8) }, { "flags", LVT_S8, offsetof(struct Surface, flags), false, LOT_NONE, 1, sizeof(s8) },
@ -2798,12 +2792,6 @@ static struct LuaObjectField sWhirlpoolFields[LUA_WHIRLPOOL_FIELD_COUNT] = {
{ "strength", LVT_S16, offsetof(struct Whirlpool, strength), false, LOT_NONE, 1, sizeof(s16) }, { "strength", LVT_S16, offsetof(struct Whirlpool, strength), false, LOT_NONE, 1, sizeof(s16) },
}; };
#define LUA_STRUCT802_A1230_FIELD_COUNT 2
static struct LuaObjectField sstruct802A1230Fields[LUA_STRUCT802_A1230_FIELD_COUNT] = {
{ "unk00", LVT_S16, offsetof(struct struct802A1230, unk00), false, LOT_NONE, 1, sizeof(s16) },
{ "unk02", LVT_S16, offsetof(struct struct802A1230, unk02), false, LOT_NONE, 1, sizeof(s16) },
};
struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN] = { struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN] = {
{ LOT_ANIMINFO, sAnimInfoFields, LUA_ANIM_INFO_FIELD_COUNT }, { LOT_ANIMINFO, sAnimInfoFields, LUA_ANIM_INFO_FIELD_COUNT },
{ LOT_ANIMATION, sAnimationFields, LUA_ANIMATION_FIELD_COUNT }, { LOT_ANIMATION, sAnimationFields, LUA_ANIMATION_FIELD_COUNT },
@ -2899,7 +2887,6 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN]
{ LOT_SPAWNPARTICLESINFO, sSpawnParticlesInfoFields, LUA_SPAWN_PARTICLES_INFO_FIELD_COUNT }, { LOT_SPAWNPARTICLESINFO, sSpawnParticlesInfoFields, LUA_SPAWN_PARTICLES_INFO_FIELD_COUNT },
{ LOT_STARPOSITIONS, sStarPositionsFields, LUA_STAR_POSITIONS_FIELD_COUNT }, { LOT_STARPOSITIONS, sStarPositionsFields, LUA_STAR_POSITIONS_FIELD_COUNT },
{ LOT_STARSNEEDEDFORDIALOG, sStarsNeededForDialogFields, LUA_STARS_NEEDED_FOR_DIALOG_FIELD_COUNT }, { LOT_STARSNEEDEDFORDIALOG, sStarsNeededForDialogFields, LUA_STARS_NEEDED_FOR_DIALOG_FIELD_COUNT },
{ LOT_STRUCT802A272C, sStruct802A272CFields, LUA_STRUCT802_A272_C_FIELD_COUNT },
{ LOT_SURFACE, sSurfaceFields, LUA_SURFACE_FIELD_COUNT }, { LOT_SURFACE, sSurfaceFields, LUA_SURFACE_FIELD_COUNT },
{ LOT_TEXTUREINFO, sTextureInfoFields, LUA_TEXTURE_INFO_FIELD_COUNT }, { LOT_TEXTUREINFO, sTextureInfoFields, LUA_TEXTURE_INFO_FIELD_COUNT },
{ LOT_TRANSITIONINFO, sTransitionInfoFields, LUA_TRANSITION_INFO_FIELD_COUNT }, { LOT_TRANSITIONINFO, sTransitionInfoFields, LUA_TRANSITION_INFO_FIELD_COUNT },
@ -2912,7 +2899,6 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN]
{ LOT_WATERDROPLETPARAMS, sWaterDropletParamsFields, LUA_WATER_DROPLET_PARAMS_FIELD_COUNT }, { LOT_WATERDROPLETPARAMS, sWaterDropletParamsFields, LUA_WATER_DROPLET_PARAMS_FIELD_COUNT },
{ LOT_WAYPOINT, sWaypointFields, LUA_WAYPOINT_FIELD_COUNT }, { LOT_WAYPOINT, sWaypointFields, LUA_WAYPOINT_FIELD_COUNT },
{ LOT_WHIRLPOOL, sWhirlpoolFields, LUA_WHIRLPOOL_FIELD_COUNT }, { LOT_WHIRLPOOL, sWhirlpoolFields, LUA_WHIRLPOOL_FIELD_COUNT },
{ LOT_STRUCT802A1230, sstruct802A1230Fields, LUA_STRUCT802_A1230_FIELD_COUNT },
}; };
const char *sLuaLotNames[] = { const char *sLuaLotNames[] = {
@ -3021,7 +3007,6 @@ const char *sLuaLotNames[] = {
[LOT_SPAWNPARTICLESINFO] = "SpawnParticlesInfo", [LOT_SPAWNPARTICLESINFO] = "SpawnParticlesInfo",
[LOT_STARPOSITIONS] = "StarPositions", [LOT_STARPOSITIONS] = "StarPositions",
[LOT_STARSNEEDEDFORDIALOG] = "StarsNeededForDialog", [LOT_STARSNEEDEDFORDIALOG] = "StarsNeededForDialog",
[LOT_STRUCT802A272C] = "Struct802A272C",
[LOT_SURFACE] = "Surface", [LOT_SURFACE] = "Surface",
[LOT_TEXTUREINFO] = "TextureInfo", [LOT_TEXTUREINFO] = "TextureInfo",
[LOT_TRANSITIONINFO] = "TransitionInfo", [LOT_TRANSITIONINFO] = "TransitionInfo",
@ -3034,7 +3019,6 @@ const char *sLuaLotNames[] = {
[LOT_WATERDROPLETPARAMS] = "WaterDropletParams", [LOT_WATERDROPLETPARAMS] = "WaterDropletParams",
[LOT_WAYPOINT] = "Waypoint", [LOT_WAYPOINT] = "Waypoint",
[LOT_WHIRLPOOL] = "Whirlpool", [LOT_WHIRLPOOL] = "Whirlpool",
[LOT_STRUCT802A1230] = "struct802A1230",
}; };
const char *smlua_get_lot_name(u16 lot) { const char *smlua_get_lot_name(u16 lot) {

View file

@ -113,7 +113,6 @@ enum LuaObjectAutogenType {
LOT_SPAWNPARTICLESINFO, LOT_SPAWNPARTICLESINFO,
LOT_STARPOSITIONS, LOT_STARPOSITIONS,
LOT_STARSNEEDEDFORDIALOG, LOT_STARSNEEDEDFORDIALOG,
LOT_STRUCT802A272C,
LOT_SURFACE, LOT_SURFACE,
LOT_TEXTUREINFO, LOT_TEXTUREINFO,
LOT_TRANSITIONINFO, LOT_TRANSITIONINFO,
@ -126,7 +125,6 @@ enum LuaObjectAutogenType {
LOT_WATERDROPLETPARAMS, LOT_WATERDROPLETPARAMS,
LOT_WAYPOINT, LOT_WAYPOINT,
LOT_WHIRLPOOL, LOT_WHIRLPOOL,
LOT_STRUCT802A1230,
LOT_AUTOGEN_MAX, LOT_AUTOGEN_MAX,
}; };

View file

@ -193,6 +193,24 @@ static void smlua_push_color(Color src, int index) {
// area.h // // area.h //
//////////// ////////////
int smlua_func_get_mario_spawn_type(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 1) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_mario_spawn_type", 1, top);
return 0;
}
if (lua_isnil(L, 1)) { return 0; }
struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_mario_spawn_type"); return 0; }
lua_pushinteger(L, get_mario_spawn_type(o));
return 1;
}
int smlua_func_area_get_warp_node(lua_State* L) { int smlua_func_area_get_warp_node(lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -210,6 +228,21 @@ int smlua_func_area_get_warp_node(lua_State* L) {
return 1; return 1;
} }
int smlua_func_area_get_any_warp_node(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "area_get_any_warp_node", 0, top);
return 0;
}
smlua_push_object(L, LOT_OBJECTWARPNODE, area_get_any_warp_node(), NULL);
return 1;
}
int smlua_func_area_get_warp_node_from_params(lua_State* L) { int smlua_func_area_get_warp_node_from_params(lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -228,6 +261,58 @@ int smlua_func_area_get_warp_node_from_params(lua_State* L) {
return 1; return 1;
} }
int smlua_func_play_transition(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 5) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_transition", 5, top);
return 0;
}
s16 transType = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_transition"); return 0; }
s16 time = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_transition"); return 0; }
u8 red = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_transition"); return 0; }
u8 green = smlua_to_integer(L, 4);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "play_transition"); return 0; }
u8 blue = smlua_to_integer(L, 5);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "play_transition"); return 0; }
play_transition(transType, time, red, green, blue);
return 1;
}
int smlua_func_play_transition_after_delay(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 6) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_transition_after_delay", 6, top);
return 0;
}
s16 transType = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_transition_after_delay"); return 0; }
s16 time = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_transition_after_delay"); return 0; }
u8 red = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_transition_after_delay"); return 0; }
u8 green = smlua_to_integer(L, 4);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "play_transition_after_delay"); return 0; }
u8 blue = smlua_to_integer(L, 5);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "play_transition_after_delay"); return 0; }
s16 delay = smlua_to_integer(L, 6);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "play_transition_after_delay"); return 0; }
play_transition_after_delay(transType, time, red, green, blue, delay);
return 1;
}
//////////////////////// ////////////////////////
// behavior_actions.h // // behavior_actions.h //
//////////////////////// ////////////////////////
@ -21200,36 +21285,6 @@ int smlua_func_absf_2(lua_State* L) {
return 1; return 1;
} }
int smlua_func_turn_obj_away_from_surface(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 7) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "turn_obj_away_from_surface", 7, top);
return 0;
}
f32 velX = smlua_to_number(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "turn_obj_away_from_surface"); return 0; }
f32 velZ = smlua_to_number(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "turn_obj_away_from_surface"); return 0; }
f32 nX = smlua_to_number(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "turn_obj_away_from_surface"); return 0; }
f32 nY = smlua_to_number(L, 4);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "turn_obj_away_from_surface"); return 0; }
f32 nZ = smlua_to_number(L, 5);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "turn_obj_away_from_surface"); return 0; }
f32 * objYawX = (f32 *)smlua_to_cpointer(L, 6, LVT_F32_P);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "turn_obj_away_from_surface"); return 0; }
f32 * objYawZ = (f32 *)smlua_to_cpointer(L, 7, LVT_F32_P);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "turn_obj_away_from_surface"); return 0; }
extern void turn_obj_away_from_surface(f32 velX, f32 velZ, f32 nX, UNUSED f32 nY, f32 nZ, f32 *objYawX, f32 *objYawZ);
turn_obj_away_from_surface(velX, velZ, nX, nY, nZ, objYawX, objYawZ);
return 1;
}
int smlua_func_obj_find_wall(lua_State* L) { int smlua_func_obj_find_wall(lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -31731,31 +31786,6 @@ int smlua_func_set_water_level(lua_State* L) {
return 1; return 1;
} }
int smlua_func_play_transition(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 5) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_transition", 5, top);
return 0;
}
s16 transType = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_transition"); return 0; }
s16 time = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_transition"); return 0; }
u8 red = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_transition"); return 0; }
u8 green = smlua_to_integer(L, 4);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "play_transition"); return 0; }
u8 blue = smlua_to_integer(L, 5);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "play_transition"); return 0; }
play_transition(transType, time, red, green, blue);
return 1;
}
int smlua_func_course_is_main_course(lua_State* L) { int smlua_func_course_is_main_course(lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -32069,7 +32099,7 @@ int smlua_func_get_environment_region(lua_State* L) {
u8 index = smlua_to_integer(L, 1); u8 index = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_environment_region"); return 0; } if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_environment_region"); return 0; }
lua_pushnumber(L, get_environment_region(index)); lua_pushinteger(L, get_environment_region(index));
return 1; return 1;
} }
@ -32085,7 +32115,7 @@ int smlua_func_set_environment_region(lua_State* L) {
u8 index = smlua_to_integer(L, 1); u8 index = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_environment_region"); return 0; } if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_environment_region"); return 0; }
s32 value = smlua_to_integer(L, 2); s16 value = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_environment_region"); return 0; } if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_environment_region"); return 0; }
set_environment_region(index, value); set_environment_region(index, value);
@ -33740,26 +33770,6 @@ int smlua_func_stop_cap_music(UNUSED lua_State* L) {
// spawn_sound.h // // spawn_sound.h //
/////////////////// ///////////////////
int smlua_func_exec_anim_sound_state(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 2) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "exec_anim_sound_state", 2, top);
return 0;
}
if (lua_isnil(L, 1)) { return 0; }
struct SoundState* soundStates = (struct SoundState*)smlua_to_cobject(L, 1, LOT_SOUNDSTATE);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "exec_anim_sound_state"); return 0; }
u16 maxSoundStates = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "exec_anim_sound_state"); return 0; }
exec_anim_sound_state(soundStates, maxSoundStates);
return 1;
}
int smlua_func_cur_obj_play_sound_1(lua_State* L) { int smlua_func_cur_obj_play_sound_1(lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -34094,46 +34104,6 @@ int smlua_func_set_find_wall_direction(lua_State* L) {
// surface_load.h // // surface_load.h //
//////////////////// ////////////////////
int smlua_func_get_area_terrain_size(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 1) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_area_terrain_size", 1, top);
return 0;
}
s16 * data = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_area_terrain_size"); return 0; }
lua_pushinteger(L, get_area_terrain_size(data));
return 1;
}
int smlua_func_load_area_terrain(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 4) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "load_area_terrain", 4, top);
return 0;
}
s16 index = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "load_area_terrain"); return 0; }
s16 * data = (s16 *)smlua_to_cpointer(L, 2, LVT_S16_P);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "load_area_terrain"); return 0; }
s8 * surfaceRooms = (s8 *)smlua_to_cpointer(L, 3, LVT_S8_P);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "load_area_terrain"); return 0; }
s16 * macroObjects = (s16 *)smlua_to_cpointer(L, 4, LVT_S16_P);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "load_area_terrain"); return 0; }
load_area_terrain(index, data, surfaceRooms, macroObjects);
return 1;
}
int smlua_func_load_object_collision_model(UNUSED lua_State* L) { int smlua_func_load_object_collision_model(UNUSED lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -34192,8 +34162,12 @@ void smlua_bind_functions_autogen(void) {
lua_State* L = gLuaState; lua_State* L = gLuaState;
// area.h // area.h
smlua_bind_function(L, "get_mario_spawn_type", smlua_func_get_mario_spawn_type);
smlua_bind_function(L, "area_get_warp_node", smlua_func_area_get_warp_node); smlua_bind_function(L, "area_get_warp_node", smlua_func_area_get_warp_node);
smlua_bind_function(L, "area_get_any_warp_node", smlua_func_area_get_any_warp_node);
smlua_bind_function(L, "area_get_warp_node_from_params", smlua_func_area_get_warp_node_from_params); smlua_bind_function(L, "area_get_warp_node_from_params", smlua_func_area_get_warp_node_from_params);
smlua_bind_function(L, "play_transition", smlua_func_play_transition);
smlua_bind_function(L, "play_transition_after_delay", smlua_func_play_transition_after_delay);
// behavior_actions.h // behavior_actions.h
smlua_bind_function(L, "spawn_mist_particles_variable", smlua_func_spawn_mist_particles_variable); smlua_bind_function(L, "spawn_mist_particles_variable", smlua_func_spawn_mist_particles_variable);
@ -35397,7 +35371,6 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "set_yoshi_as_not_dead", smlua_func_set_yoshi_as_not_dead); smlua_bind_function(L, "set_yoshi_as_not_dead", smlua_func_set_yoshi_as_not_dead);
//smlua_bind_function(L, "geo_obj_transparency_something", smlua_func_geo_obj_transparency_something); <--- UNIMPLEMENTED //smlua_bind_function(L, "geo_obj_transparency_something", smlua_func_geo_obj_transparency_something); <--- UNIMPLEMENTED
smlua_bind_function(L, "absf_2", smlua_func_absf_2); smlua_bind_function(L, "absf_2", smlua_func_absf_2);
smlua_bind_function(L, "turn_obj_away_from_surface", smlua_func_turn_obj_away_from_surface);
smlua_bind_function(L, "obj_find_wall", smlua_func_obj_find_wall); smlua_bind_function(L, "obj_find_wall", smlua_func_obj_find_wall);
smlua_bind_function(L, "turn_obj_away_from_steep_floor", smlua_func_turn_obj_away_from_steep_floor); smlua_bind_function(L, "turn_obj_away_from_steep_floor", smlua_func_turn_obj_away_from_steep_floor);
smlua_bind_function(L, "obj_orient_graph", smlua_func_obj_orient_graph); smlua_bind_function(L, "obj_orient_graph", smlua_func_obj_orient_graph);
@ -35981,7 +35954,6 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "movtexqc_register", smlua_func_movtexqc_register); smlua_bind_function(L, "movtexqc_register", smlua_func_movtexqc_register);
smlua_bind_function(L, "get_water_level", smlua_func_get_water_level); smlua_bind_function(L, "get_water_level", smlua_func_get_water_level);
smlua_bind_function(L, "set_water_level", smlua_func_set_water_level); smlua_bind_function(L, "set_water_level", smlua_func_set_water_level);
smlua_bind_function(L, "play_transition", smlua_func_play_transition);
smlua_bind_function(L, "course_is_main_course", smlua_func_course_is_main_course); smlua_bind_function(L, "course_is_main_course", smlua_func_course_is_main_course);
smlua_bind_function(L, "get_ttc_speed_setting", smlua_func_get_ttc_speed_setting); smlua_bind_function(L, "get_ttc_speed_setting", smlua_func_get_ttc_speed_setting);
smlua_bind_function(L, "set_ttc_speed_setting", smlua_func_set_ttc_speed_setting); smlua_bind_function(L, "set_ttc_speed_setting", smlua_func_set_ttc_speed_setting);
@ -36100,7 +36072,6 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "stop_cap_music", smlua_func_stop_cap_music); smlua_bind_function(L, "stop_cap_music", smlua_func_stop_cap_music);
// spawn_sound.h // spawn_sound.h
smlua_bind_function(L, "exec_anim_sound_state", smlua_func_exec_anim_sound_state);
smlua_bind_function(L, "cur_obj_play_sound_1", smlua_func_cur_obj_play_sound_1); smlua_bind_function(L, "cur_obj_play_sound_1", smlua_func_cur_obj_play_sound_1);
smlua_bind_function(L, "cur_obj_play_sound_2", smlua_func_cur_obj_play_sound_2); smlua_bind_function(L, "cur_obj_play_sound_2", smlua_func_cur_obj_play_sound_2);
smlua_bind_function(L, "create_sound_spawner", smlua_func_create_sound_spawner); smlua_bind_function(L, "create_sound_spawner", smlua_func_create_sound_spawner);
@ -36120,8 +36091,6 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "set_find_wall_direction", smlua_func_set_find_wall_direction); smlua_bind_function(L, "set_find_wall_direction", smlua_func_set_find_wall_direction);
// surface_load.h // surface_load.h
smlua_bind_function(L, "get_area_terrain_size", smlua_func_get_area_terrain_size);
smlua_bind_function(L, "load_area_terrain", smlua_func_load_area_terrain);
smlua_bind_function(L, "load_object_collision_model", smlua_func_load_object_collision_model); smlua_bind_function(L, "load_object_collision_model", smlua_func_load_object_collision_model);
smlua_bind_function(L, "obj_get_surface_from_index", smlua_func_obj_get_surface_from_index); smlua_bind_function(L, "obj_get_surface_from_index", smlua_func_obj_get_surface_from_index);
smlua_bind_function(L, "surface_has_force", smlua_func_surface_has_force); smlua_bind_function(L, "surface_has_force", smlua_func_surface_has_force);

View file

@ -3,8 +3,10 @@
#include "pc/utils/miniaudio.h" #include "pc/utils/miniaudio.h"
/* |description|Resets all custom sequences back to vanilla|descriptionEnd| */
void smlua_audio_utils_reset_all(void); void smlua_audio_utils_reset_all(void);
bool smlua_audio_utils_override(u8 sequenceId, s32* bankId, void** seqData); bool smlua_audio_utils_override(u8 sequenceId, s32* bankId, void** seqData);
/* |description|Replaces the sequence corresponding to `sequenceId` with one called `m64Name`.m64 with `bankId` and `defaultVolume`|descriptionEnd| */
void smlua_audio_utils_replace_sequence(u8 sequenceId, u8 bankId, u8 defaultVolume, const char* m64Name); void smlua_audio_utils_replace_sequence(u8 sequenceId, u8 bankId, u8 defaultVolume, const char* m64Name);
//////////////// ////////////////
@ -41,15 +43,15 @@ void audio_stream_play(struct ModAudio* audio, bool restart, f32 volume);
void audio_stream_pause(struct ModAudio* audio); void audio_stream_pause(struct ModAudio* audio);
/* |description|Stops an `audio` stream|descriptionEnd| */ /* |description|Stops an `audio` stream|descriptionEnd| */
void audio_stream_stop(struct ModAudio* audio); void audio_stream_stop(struct ModAudio* audio);
/* |description|Gets the position of an `audio` stream|descriptionEnd| */ /* |description|Gets the position of an `audio` stream in seconds|descriptionEnd| */
f32 audio_stream_get_position(struct ModAudio* audio); f32 audio_stream_get_position(struct ModAudio* audio);
/* |description|Sets the position of an `audio` stream|descriptionEnd| */ /* |description|Sets the position of an `audio` stream in seconds|descriptionEnd| */
void audio_stream_set_position(struct ModAudio* audio, f32 pos); void audio_stream_set_position(struct ModAudio* audio, f32 pos);
/* |description|Gets if an `audio` stream is looping or not|descriptionEnd| */ /* |description|Gets if an `audio` stream is looping or not|descriptionEnd| */
bool audio_stream_get_looping(struct ModAudio* audio); bool audio_stream_get_looping(struct ModAudio* audio);
/* |description|Sets if an `audio` stream is looping or not|descriptionEnd| */ /* |description|Sets if an `audio` stream is looping or not|descriptionEnd| */
void audio_stream_set_looping(struct ModAudio* audio, bool looping); void audio_stream_set_looping(struct ModAudio* audio, bool looping);
/* |description|Sets an `audio` stream's loop points (samples)|descriptionEnd| */ /* |description|Sets an `audio` stream's loop points in samples|descriptionEnd| */
void audio_stream_set_loop_points(struct ModAudio* audio, s64 loopStart, s64 loopEnd); void audio_stream_set_loop_points(struct ModAudio* audio, s64 loopStart, s64 loopEnd);
/* |description|Gets the frequency of an `audio` stream|descriptionEnd| */ /* |description|Gets the frequency of an `audio` stream|descriptionEnd| */
f32 audio_stream_get_frequency(struct ModAudio* audio); f32 audio_stream_get_frequency(struct ModAudio* audio);
@ -71,9 +73,7 @@ void audio_sample_stop(struct ModAudio* audio);
void audio_sample_play(struct ModAudio* audio, Vec3f position, f32 volume); void audio_sample_play(struct ModAudio* audio, Vec3f position, f32 volume);
void audio_custom_update_volume(void); void audio_custom_update_volume(void);
void audio_custom_shutdown(void); void audio_custom_shutdown(void);
void smlua_audio_custom_deinit(void); void smlua_audio_custom_deinit(void);
#endif #endif

View file

@ -121,6 +121,7 @@ struct Surface* collision_find_floor(f32 x, f32 y, f32 z);
/* |description|Finds a potential ceiling at the given `x`, `y`, and `z` values|descriptionEnd| */ /* |description|Finds a potential ceiling at the given `x`, `y`, and `z` values|descriptionEnd| */
struct Surface* collision_find_ceil(f32 x, f32 y, f32 z); struct Surface* collision_find_ceil(f32 x, f32 y, f32 z);
/* |description|Gets the generated water floor surface used when riding a shell|descriptionEnd| */
struct Surface* get_water_surface_pseudo_floor(void); struct Surface* get_water_surface_pseudo_floor(void);
/* |description|Gets the `Collision` with `name`|descriptionEnd| */ /* |description|Gets the `Collision` with `name`|descriptionEnd| */

View file

@ -484,16 +484,16 @@ void set_volume_env(f32 volume) {
/// ///
f32 get_environment_region(u8 index) { s16 get_environment_region(u8 index) {
s32 idx = 6 * index; u8 idx = 6 * index;
if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) { if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) {
return gEnvironmentRegions[idx]; return gEnvironmentRegions[idx];
} }
return gLevelValues.floorLowerLimit; return gLevelValues.floorLowerLimit;
} }
void set_environment_region(u8 index, s32 value) { void set_environment_region(u8 index, s16 value) {
s32 idx = 6 * index; u8 idx = 6 * index;
if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) { if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) {
gEnvironmentRegions[idx] = value; gEnvironmentRegions[idx] = value;
} }

View file

@ -143,9 +143,6 @@ s16 get_water_level(u8 index);
/* |description|Sets the water level in an area corresponding to `index` (0-indexed)|descriptionEnd| */ /* |description|Sets the water level in an area corresponding to `index` (0-indexed)|descriptionEnd| */
void set_water_level(u8 index, s16 height, bool sync); void set_water_level(u8 index, s16 height, bool sync);
/* |description|Plays a screen transition|descriptionEnd| */
void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue);
/* |description|Checks if a course is a main course and not the castle or secret levels|descriptionEnd| */ /* |description|Checks if a course is a main course and not the castle or secret levels|descriptionEnd| */
bool course_is_main_course(u16 courseNum); bool course_is_main_course(u16 courseNum);
@ -193,9 +190,9 @@ void set_volume_sfx(f32 volume);
void set_volume_env(f32 volume); void set_volume_env(f32 volume);
/* |description|Gets an environment region (gas/water boxes) height value|descriptionEnd| */ /* |description|Gets an environment region (gas/water boxes) height value|descriptionEnd| */
f32 get_environment_region(u8 index); s16 get_environment_region(u8 index);
/* |description|Sets an environment region (gas/water boxes) height value|descriptionEnd| */ /* |description|Sets an environment region (gas/water boxes) height value|descriptionEnd| */
void set_environment_region(u8 index, s32 value); void set_environment_region(u8 index, s16 value);
/* |description|Checks if a file exists inside of a mod|descriptionEnd| */ /* |description|Checks if a file exists inside of a mod|descriptionEnd| */
bool mod_file_exists(const char* filename); bool mod_file_exists(const char* filename);

View file

@ -77,19 +77,31 @@ bool network_player_name_valid(char* buffer);
void network_player_init(void); void network_player_init(void);
void network_player_update_model(u8 localIndex); void network_player_update_model(u8 localIndex);
bool network_player_any_connected(void); bool network_player_any_connected(void);
/* |description|Gets the amount of players connected|descriptionEnd| */
u8 network_player_connected_count(void); u8 network_player_connected_count(void);
/* |description|Sets the description field of `np`|descriptionEnd| */
void network_player_set_description(struct NetworkPlayer* np, const char* description, u8 r, u8 g, u8 b, u8 a); void network_player_set_description(struct NetworkPlayer* np, const char* description, u8 r, u8 g, u8 b, u8 a);
/* |description|Overrides the location of `np`|descriptionEnd| */
void network_player_set_override_location(struct NetworkPlayer *np, const char *location); void network_player_set_override_location(struct NetworkPlayer *np, const char *location);
/* |description|Gets a network player from `globalIndex`|descriptionEnd| */
struct NetworkPlayer* network_player_from_global_index(u8 globalIndex); struct NetworkPlayer* network_player_from_global_index(u8 globalIndex);
/* |description|Gets the first network player whose information matches `courseNum`, `actNum`, and `levelNum`|descriptionEnd| */
struct NetworkPlayer* get_network_player_from_level(s16 courseNum, s16 actNum, s16 levelNum); struct NetworkPlayer* get_network_player_from_level(s16 courseNum, s16 actNum, s16 levelNum);
/* |description|Gets the first network player whose information matches `courseNum`, `actNum`, `levelNum`, and `areaIndex`|descriptionEnd| */
struct NetworkPlayer* get_network_player_from_area(s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex); struct NetworkPlayer* get_network_player_from_area(s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex);
/* |description|Gets the active network player with the smallest global index. Useful for assigning one player to "own" some kind of functionality or object|descriptionEnd| */
struct NetworkPlayer* get_network_player_smallest_global(void); struct NetworkPlayer* get_network_player_smallest_global(void);
/* |description|Gets a red, green, or blue value from a part in `np`'s color palette|descriptionEnd| */
u8 network_player_get_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index); u8 network_player_get_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index);
/* |description|Gets a red, green, or blue value from a part in `np`'s override color palette|descriptionEnd| */
u8 network_player_get_override_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index); u8 network_player_get_override_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index);
/* |description|Sets the `part in `np`'s override color palette`|descriptionEnd| */
void network_player_set_override_palette_color(struct NetworkPlayer *np, enum PlayerPart part, Color color); void network_player_set_override_palette_color(struct NetworkPlayer *np, enum PlayerPart part, Color color);
/* |description|Resets `np`'s override color palette|descriptionEnd| */
void network_player_reset_override_palette(struct NetworkPlayer *np); void network_player_reset_override_palette(struct NetworkPlayer *np);
/* |description|Checks if `np`'s override color palette is identical to the regular color palette|descriptionEnd| */
bool network_player_is_override_palette_same(struct NetworkPlayer *np); bool network_player_is_override_palette_same(struct NetworkPlayer *np);
void network_player_update(void); void network_player_update(void);