diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index 995a3e014..865605c50 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -1377,6 +1377,9 @@ def def_function(function): if rtype == None: rtype = 'nil' + if function['description'].startswith("[DEPRECATED"): + s += "--- @deprecated\n" + for param in function['params']: pid = param['identifier'] ptype = param['type'] diff --git a/autogen/lua_constants/built-in.lua b/autogen/lua_constants/built-in.lua index 29266a674..5241b381f 100644 --- a/autogen/lua_constants/built-in.lua +++ b/autogen/lua_constants/built-in.lua @@ -331,6 +331,7 @@ COURSE_MIN = 1 --- @param np NetworkPlayer --- @param part PlayerPart --- @return Color +--- Gets the palette color of `part` on `np` function network_player_get_palette_color(np, part) local color = { r = network_player_get_palette_color_channel(np, part, 0), @@ -343,6 +344,7 @@ end --- @param np NetworkPlayer --- @param part PlayerPart --- @return Color +--- Gets the override palette color of `part` on `np` function network_player_get_override_palette_color(np, part) local color = { r = network_player_get_override_palette_color_channel(np, part, 0), diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 5ab102ac1..5a72f4d37 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -2,14 +2,14 @@ --- @param id integer --- @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 function area_get_warp_node(id) -- ... end --- @param o Object --- @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 function area_get_warp_node_from_params(o) -- ... end @@ -7694,29 +7694,34 @@ end --- @param index integer --- @return Animation +--- Gets a vanilla mario Animation with `index` function get_mario_vanilla_animation(index) -- ... end --- @param obj Object --- @return string +--- Gets the name of the current animation playing on `obj`, returns `nil` if there's no name function smlua_anim_util_get_current_animation_name(obj) -- ... end --- @param obj Object --- @param name string +--- Sets the animation of `obj` to the animation `name` corresponds to function smlua_anim_util_set_animation(obj, name) -- ... end --- @param audio ModAudio +--- Destroys an `audio` sample function audio_sample_destroy(audio) -- ... end --- @param filename string --- @return ModAudio +--- Loads an `audio` sample function audio_sample_load(filename) -- ... end @@ -7724,51 +7729,60 @@ end --- @param audio ModAudio --- @param position Vec3f --- @param volume number +--- Plays an `audio` sample at `position` with `volume` function audio_sample_play(audio, position, volume) -- ... end --- @param audio ModAudio +--- Stops an `audio` sample function audio_sample_stop(audio) -- ... end --- @param audio ModAudio +--- Destroys an `audio` stream function audio_stream_destroy(audio) -- ... end --- @param audio ModAudio --- @return number +--- Gets the frequency of an `audio` stream function audio_stream_get_frequency(audio) -- ... end --- @param audio ModAudio --- @return boolean +--- Gets if an `audio` stream is looping or not function audio_stream_get_looping(audio) -- ... end --- @param audio ModAudio --- @return number +--- Gets the position of an `audio` stream function audio_stream_get_position(audio) -- ... end --- @param audio ModAudio --- @return number +--- Gets the volume of an `audio` stream function audio_stream_get_volume(audio) -- ... end --- @param filename string --- @return ModAudio +--- Loads an `audio` stream by `filename` (with extension) function audio_stream_load(filename) -- ... end --- @param audio ModAudio +--- Pauses an `audio` stream function audio_stream_pause(audio) -- ... end @@ -7776,35 +7790,41 @@ end --- @param audio ModAudio --- @param restart boolean --- @param volume number +--- Plays an `audio` stream with `volume`. `restart` sets the elapsed time back to 0. function audio_stream_play(audio, restart, volume) -- ... end --- @param audio ModAudio --- @param freq number +--- Sets the frequency of an `audio` stream function audio_stream_set_frequency(audio, freq) -- ... end --- @param audio ModAudio --- @param looping boolean +--- Sets if an `audio` stream is looping or not function audio_stream_set_looping(audio, looping) -- ... end --- @param audio ModAudio --- @param pos number +--- Sets the position of an `audio` stream function audio_stream_set_position(audio, pos) -- ... end --- @param audio ModAudio --- @param volume number +--- Sets the volume of an `audio` stream function audio_stream_set_volume(audio, volume) -- ... end --- @param audio ModAudio +--- Stops an `audio` stream function audio_stream_stop(audio) -- ... end @@ -7822,21 +7842,25 @@ function smlua_audio_utils_reset_all() end --- @param allow integer +--- Sets if the romhack camera should fly above poison gas function camera_allow_toxic_gas_camera(allow) -- ... end --- @param enable boolean +--- Overrides if Analog Camera is enabled function camera_config_enable_analog_cam(enable) -- ... end --- @param enable boolean +--- Overrides if Free Camera is enabled function camera_config_enable_free_cam(enable) -- ... end --- @param enable boolean +--- Overrides if camera mouse look is enabled function camera_config_enable_mouse_look(enable) -- ... end @@ -7867,103 +7891,124 @@ function camera_config_get_y_sensitivity() end --- @param invert boolean +--- Overrides if camera X is inverted function camera_config_invert_x(invert) -- ... end --- @param invert boolean +--- Overrides if camera Y is inverted function camera_config_invert_y(invert) -- ... end --- @return boolean +--- Checks if Analog Camera is enabled function camera_config_is_analog_cam_enabled() -- ... end --- @return boolean +--- Checks if Free Camera is enabled function camera_config_is_free_cam_enabled() -- ... end --- @return boolean +--- Checks if Mouse Look is enabled function camera_config_is_mouse_look_enabled() -- ... end --- @return boolean +--- Checks if camera X is inverted function camera_config_is_x_inverted() -- ... end --- @return boolean +--- Checks if camera Y is inverted function camera_config_is_y_inverted() -- ... end --- @param value integer +--- Overrides camera aggression function camera_config_set_aggression(value) -- ... end --- @param value integer +--- Overrides camera deceleration function camera_config_set_deceleration(value) -- ... end --- @param value integer +--- Overrides camera pan level function camera_config_set_pan_level(value) -- ... end --- @param value integer +--- Overrides camera X sensitivity function camera_config_set_x_sensitivity(value) -- ... end --- @param value integer +--- Overrides camera Y sensitivity function camera_config_set_y_sensitivity(value) -- ... end +--- Freezes the camera by not updating it function camera_freeze() -- ... end --- @return boolean +--- Checks if the camera should account for surfaces function camera_get_checking_surfaces() -- ... end --- @return boolean +--- Checks if the camera is frozen function camera_is_frozen() -- ... end +--- Resets camera config overrides function camera_reset_overrides() -- ... end --- @param allow integer +--- Sets if the romhack camera should allow centering function camera_romhack_allow_centering(allow) -- ... end --- @param allow integer +--- Sets if the romhack camera should allow D-Pad movement function camera_romhack_allow_dpad_usage(allow) -- ... end --- @param value boolean +--- Sets if the camera should account for surfaces function camera_set_checking_surfaces(value) -- ... end --- @param rco RomhackCameraOverride +--- Sets the romhack camera override status function camera_set_romhack_override(rco) -- ... end +--- Unfreezes the camera function camera_unfreeze() -- ... end @@ -7972,6 +8017,7 @@ end --- @param y number --- @param z number --- @return Surface +--- Finds a potential ceiling at the given `x`, `y`, and `z` values function collision_find_ceil(x, y, z) -- ... end @@ -7980,11 +8026,13 @@ end --- @param y number --- @param z number --- @return Surface +--- Finds a potential floor at the given `x`, `y`, and `z` values function collision_find_floor(x, y, z) -- ... end --- @return WallCollisionData +--- Returns a temporary wall collision data pointer function collision_get_temp_wall_collision_data() -- ... end @@ -7992,27 +8040,32 @@ end --- @param wcd WallCollisionData --- @param index integer --- @return Surface +--- Gets the surface corresponding to `index` from `wcd` function get_surface_from_wcd_index(wcd, index) -- ... end --- @return Surface +--- Finds a potential ceiling at the given `x`, `y`, and `z` values function get_water_surface_pseudo_floor() -- ... end --- @param data Pointer_Collision +--- Gets a table of the surface types from `data` function smlua_collision_util_find_surface_types(data) -- ... end --- @param name string --- @return Pointer_Collision +--- Gets the `Collision` with `name` function smlua_collision_util_get(name) -- ... end --- @return Pointer_Collision +--- Gets the current level terrain collision function smlua_collision_util_get_current_terrain_collision() -- ... end @@ -8020,51 +8073,58 @@ end --- @param level integer --- @param area integer --- @return Pointer_Collision +--- Gets the `level` terrain collision from `area` function smlua_collision_util_get_level_collision(level, area) -- ... end +--- @deprecated --- @param audio ModAudio --- @return number +--- [DEPRECATED: There may be a replacement for this function in the future] function audio_stream_get_tempo(audio) -- ... end ---- @param url string ---- @return ModAudio -function audio_stream_load_url(url) - -- ... -end - +--- @deprecated --- @param audio ModAudio --- @param initial_freq number --- @param speed number --- @param pitch boolean +--- [DEPRECATED: There may be a replacement for this function in the future] function audio_stream_set_speed(audio, initial_freq, speed, pitch) -- ... end +--- @deprecated --- @param audio ModAudio --- @param tempo number +--- [DEPRECATED: There may be a replacement for this function in the future] function audio_stream_set_tempo(audio, tempo) -- ... end +--- @deprecated --- @param enable boolean +--- [DEPRECATED: Use `HOOK_ON_HUD_RENDER_BEHIND` instead] Sets if DJUI should render behind the vanilla HUD function djui_hud_set_render_behind_hud(enable) -- ... end +--- @deprecated --- @param np NetworkPlayer --- @param part PlayerPart --- @param color Color +--- [DEPRECATED: Use `network_player_set_override_palette_color` instead] function network_player_color_to_palette(np, part, color) -- ... end +--- @deprecated --- @param np NetworkPlayer --- @param part PlayerPart --- @param out Color +--- [DEPRECATED: Use `network_player_get_palette_color` or `network_player_get_override_palette_color` instead] function network_player_palette_to_color(np, part, out) -- ... end @@ -8197,6 +8257,7 @@ end --- @param levelNum integer --- @return boolean +--- Checks if `levelNum` is a vanilla level function level_is_vanilla_level(levelNum) -- ... end @@ -8210,46 +8271,54 @@ end --- @param echoLevel2 integer --- @param echoLevel3 integer --- @return integer +--- Registers a fully custom level. Level ID begins at 50 function level_register(scriptEntryName, courseNum, fullName, shortName, acousticReach, echoLevel1, echoLevel2, echoLevel3) -- ... end --- @param areaIndex integer +--- Instantly changes the current area to `areaIndex` function smlua_level_util_change_area(areaIndex) -- ... end --- @param levelNum integer --- @return CustomLevelInfo +--- Gets information on a custom level from `levelNum` function smlua_level_util_get_info(levelNum) -- ... end --- @param courseNum integer --- @return CustomLevelInfo +--- Gets information on a custom level from `courseNum` function smlua_level_util_get_info_from_course_num(courseNum) -- ... end --- @param shortName string --- @return CustomLevelInfo +--- Gets information on a custom level from `shortName` function smlua_level_util_get_info_from_short_name(shortName) -- ... end --- @param aDelay integer --- @return boolean +--- Exits the current level after `aDelay` function warp_exit_level(aDelay) -- ... end --- @return boolean +--- Restarts the current level function warp_restart_level() -- ... end --- @param aLevel integer --- @return boolean +--- Warps back to the castle from `aLevel` function warp_to_castle(aLevel) -- ... end @@ -8258,11 +8327,13 @@ end --- @param aArea integer --- @param aAct integer --- @return boolean +--- Warps to `aArea` of `aLevel` in `aAct` function warp_to_level(aLevel, aArea, aAct) -- ... end --- @return boolean +--- Warps to the start level (Castle Grounds by default) function warp_to_start_level() -- ... end @@ -8272,6 +8343,7 @@ end --- @param aAct integer --- @param aWarpId integer --- @return boolean +--- Warps to `aWarpId` of `aArea` in `aLevel` during `aAct` function warp_to_warpnode(aLevel, aArea, aAct, aWarpId) -- ... end @@ -8392,7 +8464,7 @@ end --- @param pointer Pointer_integer --- @return integer ---- Gets the 32-bit integer value from the pointer +--- Gets the signed 32-bit integer value from `pointer` function deref_s32_pointer(pointer) -- ... end @@ -8447,7 +8519,7 @@ end --- @param localIndex integer --- @return string ---- Gets the CoopNet ID of a player if CoopNet is being used and the player is connected, otherwise "-1" is returned +--- Gets the CoopNet ID of a player with `localIndex` if CoopNet is being used and the player is connected, otherwise "-1" is returned function get_coopnet_id(localIndex) -- ... end @@ -8518,7 +8590,7 @@ end --- @param m MarioState --- @param index integer --- @return number ---- Gets the Y coordinate of Mario's hand (0-1) or foot (2-3) but it is important to note that the positions are not updated off-screen +--- Gets the Y coordinate of Mario's hand (0-1) or foot (2-3) but It is important to note that the positions are not updated off-screen function get_hand_foot_pos_y(m, index) -- ... end @@ -8575,7 +8647,7 @@ end --- @param initialValue integer --- @return Pointer_integer ---- Returns a temporary 32-bit integer pointer +--- Returns a temporary signed 32-bit integer pointer with its value set to `initialValue` function get_temp_s32_pointer(initialValue) -- ... end @@ -8832,17 +8904,20 @@ end --- @param name string --- @return ModelExtendedId +--- Gets the extended model ID for the `name` of a `GeoLayout` function smlua_model_util_get_id(name) -- ... end --- @return ObjectHitbox +--- Returns a temporary object hitbox pointer function get_temp_object_hitbox() -- ... end --- @param name string --- @return Pointer_Trajectory +--- Gets a trajectory by `name` function get_trajectory(name) -- ... end @@ -8850,6 +8925,7 @@ end --- @param o1 Object --- @param o2 Object --- @return boolean +--- Checks if `o1`'s hitbox is colliding with `o2`'s hitbox function obj_check_hitbox_overlap(o1, o2) -- ... end @@ -8862,12 +8938,14 @@ end --- @param r number --- @param d number --- @return boolean +--- Checks if `o`'s hitbox is colliding with the parameters of a hitbox function obj_check_overlap_with_hitbox_params(o, x, y, z, h, r, d) -- ... end --- @param behaviorId BehaviorId --- @return integer +--- Counts every object with `behaviorId` function obj_count_objects_with_behavior_id(behaviorId) -- ... end @@ -8875,6 +8953,7 @@ end --- @param o Object --- @param index integer --- @return Object +--- Gets the corresponding collided object to an index from `o` function obj_get_collided_object(o, index) -- ... end @@ -8882,6 +8961,7 @@ end --- @param o Object --- @param fieldIndex integer --- @return number +--- Sets the float value from the field corresponding to `fieldIndex` function obj_get_field_f32(o, fieldIndex) -- ... end @@ -8890,6 +8970,7 @@ end --- @param fieldIndex integer --- @param fieldSubIndex integer --- @return integer +--- Gets the signed 32-bit integer value from the sub field corresponding to `fieldSubIndex` from the field corresponding to `fieldIndex` function obj_get_field_s16(o, fieldIndex, fieldSubIndex) -- ... end @@ -8897,6 +8978,7 @@ end --- @param o Object --- @param fieldIndex integer --- @return integer +--- Gets the signed 32-bit integer value from the field corresponding to `fieldIndex` function obj_get_field_s32(o, fieldIndex) -- ... end @@ -8904,18 +8986,21 @@ end --- @param o Object --- @param fieldIndex integer --- @return integer +--- Gets the unsigned 32-bit integer value from the field corresponding to `fieldIndex` function obj_get_field_u32(o, fieldIndex) -- ... end --- @param objList ObjectList --- @return Object +--- Gets the first object in an object list function obj_get_first(objList) -- ... end --- @param behaviorId BehaviorId --- @return Object +--- Gets the first object loaded with `behaviorId` function obj_get_first_with_behavior_id(behaviorId) -- ... end @@ -8924,6 +9009,7 @@ end --- @param fieldIndex integer --- @param value number --- @return Object +--- Gets the first object loaded with `behaviorId` and object float field (look in `object_fields.h` to get the index of a field) function obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value) -- ... end @@ -8932,6 +9018,7 @@ end --- @param fieldIndex integer --- @param value integer --- @return Object +--- Gets the first object loaded with `behaviorId` and object signed 32-bit integer field (look in `object_fields.h` to get the index of a field) function obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value) -- ... end @@ -8939,18 +9026,21 @@ end --- @param o Object --- @param behaviorId BehaviorId --- @return Object +--- Gets the nearest object with `behaviorId` to `o` function obj_get_nearest_object_with_behavior_id(o, behaviorId) -- ... end --- @param o Object --- @return Object +--- Gets the next object in an object list function obj_get_next(o) -- ... end --- @param o Object --- @return Object +--- Gets the next object loaded with the same behavior ID function obj_get_next_with_same_behavior_id(o) -- ... end @@ -8959,6 +9049,7 @@ end --- @param fieldIndex integer --- @param value number --- @return Object +--- Gets the next object loaded with the same behavior ID and object float field (look in `object_fields.h` to get the index of a field) function obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value) -- ... end @@ -8967,12 +9058,14 @@ end --- @param fieldIndex integer --- @param value integer --- @return Object +--- Gets the next object loaded with the same behavior ID and object signed 32-bit integer field (look in `object_fields.h` to get the index of a field) function obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value) -- ... end --- @param modelId ModelExtendedId --- @return SpawnParticlesInfo +--- Returns a temporary particle spawn info pointer with its model loaded in from `modelId` function obj_get_temp_spawn_particles_info(modelId) -- ... end @@ -8980,6 +9073,7 @@ end --- @param o Object --- @param behaviorId BehaviorId --- @return integer +--- Checks if an object has `behaviorId` function obj_has_behavior_id(o, behaviorId) -- ... end @@ -8987,60 +9081,70 @@ end --- @param o Object --- @param modelId ModelExtendedId --- @return integer +--- Checks if an object's model is equal to `modelId` function obj_has_model_extended(o, modelId) -- ... end --- @param o Object --- @return boolean +--- Checks if `o` is attackable function obj_is_attackable(o) -- ... end --- @param o Object --- @return boolean +--- Checks if `o` is breakable function obj_is_breakable_object(o) -- ... end --- @param o Object --- @return boolean +--- Checks if `o` is a Bully function obj_is_bully(o) -- ... end --- @param o Object --- @return boolean +--- Checks if `o` is a coin function obj_is_coin(o) -- ... end --- @param o Object --- @return boolean +--- Checks if `o` is an exclamation box function obj_is_exclamation_box(o) -- ... end --- @param o Object --- @return boolean +--- Checks if `o` is grabbable function obj_is_grabbable(o) -- ... end --- @param o Object --- @return boolean +--- Checks if `o` is a 1-Up Mushroom function obj_is_mushroom_1up(o) -- ... end --- @param o Object --- @return boolean +--- Checks if `o` is a secret function obj_is_secret(o) -- ... end --- @param o Object --- @return boolean +--- Checks if `o` is activated, tangible, and interactible function obj_is_valid_for_interaction(o) -- ... end @@ -9049,6 +9153,7 @@ end --- @param dx number --- @param dy number --- @param dz number +--- Moves the object in the direction of `dx`, `dy`, and `dz` function obj_move_xyz(o, dx, dy, dz) -- ... end @@ -9056,6 +9161,7 @@ end --- @param o Object --- @param fieldIndex integer --- @param value number +--- Sets the float value from the field corresponding to `fieldIndex` function obj_set_field_f32(o, fieldIndex, value) -- ... end @@ -9064,6 +9170,7 @@ end --- @param fieldIndex integer --- @param fieldSubIndex integer --- @param value integer +--- Sets the signed 32-bit integer value from the sub field corresponding to `fieldSubIndex` from the field corresponding to `fieldIndex` function obj_set_field_s16(o, fieldIndex, fieldSubIndex, value) -- ... end @@ -9071,6 +9178,7 @@ end --- @param o Object --- @param fieldIndex integer --- @param value integer +--- Sets the signed 32-bit integer value from the field corresponding to `fieldIndex` function obj_set_field_s32(o, fieldIndex, value) -- ... end @@ -9078,12 +9186,14 @@ end --- @param o Object --- @param fieldIndex integer --- @param value integer +--- Sets the unsigned 32-bit integer value from the field corresponding to `fieldIndex` function obj_set_field_u32(o, fieldIndex, value) -- ... end --- @param o Object --- @param modelId ModelExtendedId +--- Sets an object's model to `modelId` function obj_set_model_extended(o, modelId) -- ... end @@ -9092,6 +9202,7 @@ end --- @param vx number --- @param vy number --- @param vz number +--- Sets an object's velocity to `vx`, `vy`, and `vz` function obj_set_vel(o, vx, vy, vz) -- ... end @@ -9102,6 +9213,7 @@ end --- @param strength integer --- @param area integer --- @param index integer +--- Sets the parameters of one of the two whirlpools (0-indexed) in an area function set_whirlpools(x, y, z, strength, area, index) -- ... end @@ -9113,6 +9225,7 @@ end --- @param z number --- @param objSetupFunction function --- @return Object +--- Spawns a synchronized object in at `x`, `y`, and `z` as a child object of the local Mario with his rotation. You can change the fields of the object in `objSetupFunction` function spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction) -- ... end @@ -9124,6 +9237,7 @@ end --- @param z number --- @param objSetupFunction function --- @return Object +--- Spawns a synchronized object in at `x`, `y`, and `z` as a child object of the local Mario with his rotation. You can change the fields of the object in `objSetupFunction` function spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction) -- ... end @@ -9131,6 +9245,7 @@ end --- @param courseNum integer --- @param actNum integer --- @return string +--- Gets the act name of `actNum` in `courseNum` function smlua_text_utils_act_name_get(courseNum, actNum) -- ... end @@ -9138,6 +9253,7 @@ end --- @param courseNum integer --- @param actNum integer --- @return integer +--- Gets the index of the mod that replaced the act name of `actNum` in `courseNum` function smlua_text_utils_act_name_mod_index(courseNum, actNum) -- ... end @@ -9145,17 +9261,20 @@ end --- @param courseNum integer --- @param actNum integer --- @param name string +--- Replaces the act name of `actNum` in `courseNum` with `name` function smlua_text_utils_act_name_replace(courseNum, actNum, name) -- ... end --- @param courseNum integer --- @param actNum integer +--- Resets the act name of `actNum` in `courseNum` function smlua_text_utils_act_name_reset(courseNum, actNum) -- ... end --- @param name string +--- Replaces the castle secret stars text with `name` function smlua_text_utils_castle_secret_stars_replace(name) -- ... end @@ -9168,29 +9287,34 @@ end --- @param act4 string --- @param act5 string --- @param act6 string +--- Replaces the act names of `courseNum` function smlua_text_utils_course_acts_replace(courseNum, courseName, act1, act2, act3, act4, act5, act6) -- ... end --- @param courseNum integer --- @return string +--- Gets the name of `courseNum` function smlua_text_utils_course_name_get(courseNum) -- ... end --- @param courseNum integer --- @return integer +--- Gets the index of the mod that replaced the name of `courseNum` function smlua_text_utils_course_name_mod_index(courseNum) -- ... end --- @param courseNum integer --- @param name string +--- Replaces the name of `courseNum` with `name` function smlua_text_utils_course_name_replace(courseNum, name) -- ... end --- @param courseNum integer +--- Resets the name of `courseNum` function smlua_text_utils_course_name_reset(courseNum) -- ... end @@ -9201,23 +9325,27 @@ end --- @param leftOffset integer --- @param width integer --- @param str string +--- Replaces `dialogId` with a custom one function smlua_text_utils_dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str) -- ... end --- @param index integer --- @param text string +--- Replace extra text (e.g. one of the castle's secret stars) with `text` function smlua_text_utils_extra_text_replace(index, text) -- ... end --- @return string +--- Gets the current language function smlua_text_utils_get_language() -- ... end --- @param courseNum integer --- @param courseName string +--- Replaces the secret star course name of `courseNum` with `courseName` function smlua_text_utils_secret_star_replace(courseNum, courseName) -- ... end diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index a90c768ea..1f0b46850 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -5233,6 +5233,9 @@ ## [get_mario_vanilla_animation](#get_mario_vanilla_animation) +### Description +Gets a vanilla mario Animation with `index` + ### Lua Example `local AnimationValue = get_mario_vanilla_animation(index)` @@ -5253,6 +5256,9 @@ ## [smlua_anim_util_get_current_animation_name](#smlua_anim_util_get_current_animation_name) +### Description +Gets the name of the current animation playing on `obj`, returns `nil` if there's no name + ### Lua Example `local stringValue = smlua_anim_util_get_current_animation_name(obj)` @@ -5273,6 +5279,9 @@ ## [smlua_anim_util_set_animation](#smlua_anim_util_set_animation) +### Description +Sets the animation of `obj` to the animation `name` corresponds to + ### Lua Example `smlua_anim_util_set_animation(obj, name)` @@ -5300,6 +5309,9 @@ ## [audio_sample_destroy](#audio_sample_destroy) +### Description +Destroys an `audio` sample + ### Lua Example `audio_sample_destroy(audio)` @@ -5320,6 +5332,9 @@ ## [audio_sample_load](#audio_sample_load) +### Description +Loads an `audio` sample + ### Lua Example `local ModAudioValue = audio_sample_load(filename)` @@ -5340,6 +5355,9 @@ ## [audio_sample_play](#audio_sample_play) +### Description +Plays an `audio` sample at `position` with `volume` + ### Lua Example `audio_sample_play(audio, position, volume)` @@ -5362,6 +5380,9 @@ ## [audio_sample_stop](#audio_sample_stop) +### Description +Stops an `audio` sample + ### Lua Example `audio_sample_stop(audio)` @@ -5382,6 +5403,9 @@ ## [audio_stream_destroy](#audio_stream_destroy) +### Description +Destroys an `audio` stream + ### Lua Example `audio_stream_destroy(audio)` @@ -5402,6 +5426,9 @@ ## [audio_stream_get_frequency](#audio_stream_get_frequency) +### Description +Gets the frequency of an `audio` stream + ### Lua Example `local numberValue = audio_stream_get_frequency(audio)` @@ -5422,6 +5449,9 @@ ## [audio_stream_get_looping](#audio_stream_get_looping) +### Description +Gets if an `audio` stream is looping or not + ### Lua Example `local booleanValue = audio_stream_get_looping(audio)` @@ -5442,6 +5472,9 @@ ## [audio_stream_get_position](#audio_stream_get_position) +### Description +Gets the position of an `audio` stream + ### Lua Example `local numberValue = audio_stream_get_position(audio)` @@ -5462,6 +5495,9 @@ ## [audio_stream_get_volume](#audio_stream_get_volume) +### Description +Gets the volume of an `audio` stream + ### Lua Example `local numberValue = audio_stream_get_volume(audio)` @@ -5482,6 +5518,9 @@ ## [audio_stream_load](#audio_stream_load) +### Description +Loads an `audio` stream by `filename` (with extension) + ### Lua Example `local ModAudioValue = audio_stream_load(filename)` @@ -5502,6 +5541,9 @@ ## [audio_stream_pause](#audio_stream_pause) +### Description +Pauses an `audio` stream + ### Lua Example `audio_stream_pause(audio)` @@ -5522,6 +5564,9 @@ ## [audio_stream_play](#audio_stream_play) +### Description +Plays an `audio` stream with `volume`. `restart` sets the elapsed time back to 0. + ### Lua Example `audio_stream_play(audio, restart, volume)` @@ -5544,6 +5589,9 @@ ## [audio_stream_set_frequency](#audio_stream_set_frequency) +### Description +Sets the frequency of an `audio` stream + ### Lua Example `audio_stream_set_frequency(audio, freq)` @@ -5565,6 +5613,9 @@ ## [audio_stream_set_looping](#audio_stream_set_looping) +### Description +Sets if an `audio` stream is looping or not + ### Lua Example `audio_stream_set_looping(audio, looping)` @@ -5586,6 +5637,9 @@ ## [audio_stream_set_position](#audio_stream_set_position) +### Description +Sets the position of an `audio` stream + ### Lua Example `audio_stream_set_position(audio, pos)` @@ -5607,6 +5661,9 @@ ## [audio_stream_set_volume](#audio_stream_set_volume) +### Description +Sets the volume of an `audio` stream + ### Lua Example `audio_stream_set_volume(audio, volume)` @@ -5628,6 +5685,9 @@ ## [audio_stream_stop](#audio_stream_stop) +### Description +Stops an `audio` stream + ### Lua Example `audio_stream_stop(audio)` @@ -5695,6 +5755,9 @@ ## [camera_allow_toxic_gas_camera](#camera_allow_toxic_gas_camera) +### Description +Sets if the romhack camera should fly above poison gas + ### Lua Example `camera_allow_toxic_gas_camera(allow)` @@ -5715,6 +5778,9 @@ ## [camera_config_enable_analog_cam](#camera_config_enable_analog_cam) +### Description +Overrides if Analog Camera is enabled + ### Lua Example `camera_config_enable_analog_cam(enable)` @@ -5735,6 +5801,9 @@ ## [camera_config_enable_free_cam](#camera_config_enable_free_cam) +### Description +Overrides if Free Camera is enabled + ### Lua Example `camera_config_enable_free_cam(enable)` @@ -5755,6 +5824,9 @@ ## [camera_config_enable_mouse_look](#camera_config_enable_mouse_look) +### Description +Overrides if camera mouse look is enabled + ### Lua Example `camera_config_enable_mouse_look(enable)` @@ -5865,6 +5937,9 @@ ## [camera_config_invert_x](#camera_config_invert_x) +### Description +Overrides if camera X is inverted + ### Lua Example `camera_config_invert_x(invert)` @@ -5885,6 +5960,9 @@ ## [camera_config_invert_y](#camera_config_invert_y) +### Description +Overrides if camera Y is inverted + ### Lua Example `camera_config_invert_y(invert)` @@ -5905,6 +5983,9 @@ ## [camera_config_is_analog_cam_enabled](#camera_config_is_analog_cam_enabled) +### Description +Checks if Analog Camera is enabled + ### Lua Example `local booleanValue = camera_config_is_analog_cam_enabled()` @@ -5923,6 +6004,9 @@ ## [camera_config_is_free_cam_enabled](#camera_config_is_free_cam_enabled) +### Description +Checks if Free Camera is enabled + ### Lua Example `local booleanValue = camera_config_is_free_cam_enabled()` @@ -5941,6 +6025,9 @@ ## [camera_config_is_mouse_look_enabled](#camera_config_is_mouse_look_enabled) +### Description +Checks if Mouse Look is enabled + ### Lua Example `local booleanValue = camera_config_is_mouse_look_enabled()` @@ -5959,6 +6046,9 @@ ## [camera_config_is_x_inverted](#camera_config_is_x_inverted) +### Description +Checks if camera X is inverted + ### Lua Example `local booleanValue = camera_config_is_x_inverted()` @@ -5977,6 +6067,9 @@ ## [camera_config_is_y_inverted](#camera_config_is_y_inverted) +### Description +Checks if camera Y is inverted + ### Lua Example `local booleanValue = camera_config_is_y_inverted()` @@ -5995,6 +6088,9 @@ ## [camera_config_set_aggression](#camera_config_set_aggression) +### Description +Overrides camera aggression + ### Lua Example `camera_config_set_aggression(value)` @@ -6015,6 +6111,9 @@ ## [camera_config_set_deceleration](#camera_config_set_deceleration) +### Description +Overrides camera deceleration + ### Lua Example `camera_config_set_deceleration(value)` @@ -6035,6 +6134,9 @@ ## [camera_config_set_pan_level](#camera_config_set_pan_level) +### Description +Overrides camera pan level + ### Lua Example `camera_config_set_pan_level(value)` @@ -6055,6 +6157,9 @@ ## [camera_config_set_x_sensitivity](#camera_config_set_x_sensitivity) +### Description +Overrides camera X sensitivity + ### Lua Example `camera_config_set_x_sensitivity(value)` @@ -6075,6 +6180,9 @@ ## [camera_config_set_y_sensitivity](#camera_config_set_y_sensitivity) +### Description +Overrides camera Y sensitivity + ### Lua Example `camera_config_set_y_sensitivity(value)` @@ -6095,6 +6203,9 @@ ## [camera_freeze](#camera_freeze) +### Description +Freezes the camera by not updating it + ### Lua Example `camera_freeze()` @@ -6113,6 +6224,9 @@ ## [camera_get_checking_surfaces](#camera_get_checking_surfaces) +### Description +Checks if the camera should account for surfaces + ### Lua Example `local booleanValue = camera_get_checking_surfaces()` @@ -6131,6 +6245,9 @@ ## [camera_is_frozen](#camera_is_frozen) +### Description +Checks if the camera is frozen + ### Lua Example `local booleanValue = camera_is_frozen()` @@ -6149,6 +6266,9 @@ ## [camera_reset_overrides](#camera_reset_overrides) +### Description +Resets camera config overrides + ### Lua Example `camera_reset_overrides()` @@ -6167,6 +6287,9 @@ ## [camera_romhack_allow_centering](#camera_romhack_allow_centering) +### Description +Sets if the romhack camera should allow centering + ### Lua Example `camera_romhack_allow_centering(allow)` @@ -6187,6 +6310,9 @@ ## [camera_romhack_allow_dpad_usage](#camera_romhack_allow_dpad_usage) +### Description +Sets if the romhack camera should allow D-Pad movement + ### Lua Example `camera_romhack_allow_dpad_usage(allow)` @@ -6207,6 +6333,9 @@ ## [camera_set_checking_surfaces](#camera_set_checking_surfaces) +### Description +Sets if the camera should account for surfaces + ### Lua Example `camera_set_checking_surfaces(value)` @@ -6227,6 +6356,9 @@ ## [camera_set_romhack_override](#camera_set_romhack_override) +### Description +Sets the romhack camera override status + ### Lua Example `camera_set_romhack_override(rco)` @@ -6247,6 +6379,9 @@ ## [camera_unfreeze](#camera_unfreeze) +### Description +Unfreezes the camera + ### Lua Example `camera_unfreeze()` @@ -6271,6 +6406,9 @@ ## [collision_find_ceil](#collision_find_ceil) +### Description +Finds a potential ceiling at the given `x`, `y`, and `z` values + ### Lua Example `local SurfaceValue = collision_find_ceil(x, y, z)` @@ -6293,6 +6431,9 @@ ## [collision_find_floor](#collision_find_floor) +### Description +Finds a potential floor at the given `x`, `y`, and `z` values + ### Lua Example `local SurfaceValue = collision_find_floor(x, y, z)` @@ -6315,6 +6456,9 @@ ## [collision_get_temp_wall_collision_data](#collision_get_temp_wall_collision_data) +### Description +Returns a temporary wall collision data pointer + ### Lua Example `local WallCollisionDataValue = collision_get_temp_wall_collision_data()` @@ -6333,6 +6477,9 @@ ## [get_surface_from_wcd_index](#get_surface_from_wcd_index) +### Description +Gets the surface corresponding to `index` from `wcd` + ### Lua Example `local SurfaceValue = get_surface_from_wcd_index(wcd, index)` @@ -6354,6 +6501,9 @@ ## [get_water_surface_pseudo_floor](#get_water_surface_pseudo_floor) +### Description +Finds a potential ceiling at the given `x`, `y`, and `z` values + ### Lua Example `local SurfaceValue = get_water_surface_pseudo_floor()` @@ -6372,6 +6522,9 @@ ## [smlua_collision_util_find_surface_types](#smlua_collision_util_find_surface_types) +### Description +Gets a table of the surface types from `data` + ### Lua Example `smlua_collision_util_find_surface_types(data)` @@ -6392,6 +6545,9 @@ ## [smlua_collision_util_get](#smlua_collision_util_get) +### Description +Gets the `Collision` with `name` + ### Lua Example `local PointerValue = smlua_collision_util_get(name)` @@ -6412,6 +6568,9 @@ ## [smlua_collision_util_get_current_terrain_collision](#smlua_collision_util_get_current_terrain_collision) +### Description +Gets the current level terrain collision + ### Lua Example `local PointerValue = smlua_collision_util_get_current_terrain_collision()` @@ -6430,6 +6589,9 @@ ## [smlua_collision_util_get_level_collision](#smlua_collision_util_get_level_collision) +### Description +Gets the `level` terrain collision from `area` + ### Lua Example `local PointerValue = smlua_collision_util_get_level_collision(level, area)` @@ -6908,6 +7070,9 @@ Sets a value of the global vertex shading color ## [level_is_vanilla_level](#level_is_vanilla_level) +### Description +Checks if `levelNum` is a vanilla level + ### Lua Example `local booleanValue = level_is_vanilla_level(levelNum)` @@ -6928,6 +7093,9 @@ Sets a value of the global vertex shading color ## [level_register](#level_register) +### Description +Registers a fully custom level. Level ID begins at 50 + ### Lua Example `local integerValue = level_register(scriptEntryName, courseNum, fullName, shortName, acousticReach, echoLevel1, echoLevel2, echoLevel3)` @@ -6955,6 +7123,9 @@ Sets a value of the global vertex shading color ## [smlua_level_util_change_area](#smlua_level_util_change_area) +### Description +Instantly changes the current area to `areaIndex` + ### Lua Example `smlua_level_util_change_area(areaIndex)` @@ -6975,6 +7146,9 @@ Sets a value of the global vertex shading color ## [smlua_level_util_get_info](#smlua_level_util_get_info) +### Description +Gets information on a custom level from `levelNum` + ### Lua Example `local CustomLevelInfoValue = smlua_level_util_get_info(levelNum)` @@ -6995,6 +7169,9 @@ Sets a value of the global vertex shading color ## [smlua_level_util_get_info_from_course_num](#smlua_level_util_get_info_from_course_num) +### Description +Gets information on a custom level from `courseNum` + ### Lua Example `local CustomLevelInfoValue = smlua_level_util_get_info_from_course_num(courseNum)` @@ -7015,6 +7192,9 @@ Sets a value of the global vertex shading color ## [smlua_level_util_get_info_from_short_name](#smlua_level_util_get_info_from_short_name) +### Description +Gets information on a custom level from `shortName` + ### Lua Example `local CustomLevelInfoValue = smlua_level_util_get_info_from_short_name(shortName)` @@ -7035,6 +7215,9 @@ Sets a value of the global vertex shading color ## [warp_exit_level](#warp_exit_level) +### Description +Exits the current level after `aDelay` + ### Lua Example `local booleanValue = warp_exit_level(aDelay)` @@ -7055,6 +7238,9 @@ Sets a value of the global vertex shading color ## [warp_restart_level](#warp_restart_level) +### Description +Restarts the current level + ### Lua Example `local booleanValue = warp_restart_level()` @@ -7073,6 +7259,9 @@ Sets a value of the global vertex shading color ## [warp_to_castle](#warp_to_castle) +### Description +Warps back to the castle from `aLevel` + ### Lua Example `local booleanValue = warp_to_castle(aLevel)` @@ -7093,6 +7282,9 @@ Sets a value of the global vertex shading color ## [warp_to_level](#warp_to_level) +### Description +Warps to `aArea` of `aLevel` in `aAct` + ### Lua Example `local booleanValue = warp_to_level(aLevel, aArea, aAct)` @@ -7115,6 +7307,9 @@ Sets a value of the global vertex shading color ## [warp_to_start_level](#warp_to_start_level) +### Description +Warps to the start level (Castle Grounds by default) + ### Lua Example `local booleanValue = warp_to_start_level()` @@ -7133,6 +7328,9 @@ Sets a value of the global vertex shading color ## [warp_to_warpnode](#warp_to_warpnode) +### Description +Warps to `aWarpId` of `aArea` in `aLevel` during `aAct` + ### Lua Example `local booleanValue = warp_to_warpnode(aLevel, aArea, aAct, aWarpId)` @@ -7466,1602 +7664,6 @@ Computes the square of a floating-point number [:arrow_up_small:](#) -
- ---- -# functions from smlua_misc_utils.h - -
- - -## [allocate_mario_action](#allocate_mario_action) - -### Description -Allocates an action ID with bitwise flags - -### Lua Example -`local integerValue = allocate_mario_action(actFlags)` - -### Parameters -| Field | Type | -| ----- | ---- | -| actFlags | `integer` | - -### Returns -- `integer` - -### C Prototype -`u32 allocate_mario_action(u32 actFlags);` - -[:arrow_up_small:](#) - -
- -## [course_is_main_course](#course_is_main_course) - -### Description -Checks if a course is a main course and not the castle or secret levels - -### Lua Example -`local booleanValue = course_is_main_course(courseNum)` - -### Parameters -| Field | Type | -| ----- | ---- | -| courseNum | `integer` | - -### Returns -- `boolean` - -### C Prototype -`bool course_is_main_course(u16 courseNum);` - -[:arrow_up_small:](#) - -
- -## [deref_s32_pointer](#deref_s32_pointer) - -### Description -Gets the 32-bit integer value from the pointer - -### Lua Example -`local integerValue = deref_s32_pointer(pointer)` - -### Parameters -| Field | Type | -| ----- | ---- | -| pointer | `Pointer` <`integer`> | - -### Returns -- `integer` - -### C Prototype -`s32 deref_s32_pointer(s32* pointer);` - -[:arrow_up_small:](#) - -
- -## [djui_attempting_to_open_playerlist](#djui_attempting_to_open_playerlist) - -### Description -Checks if the DJUI playerlist is attempting to be opened - -### Lua Example -`local booleanValue = djui_attempting_to_open_playerlist()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool djui_attempting_to_open_playerlist(void);` - -[:arrow_up_small:](#) - -
- -## [djui_is_playerlist_open](#djui_is_playerlist_open) - -### Description -Checks if the DJUI playerlist is open - -### Lua Example -`local booleanValue = djui_is_playerlist_open()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool djui_is_playerlist_open(void);` - -[:arrow_up_small:](#) - -
- -## [djui_is_popup_disabled](#djui_is_popup_disabled) - -### Description -Returns if popups are disabled - -### Lua Example -`local booleanValue = djui_is_popup_disabled()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool djui_is_popup_disabled(void);` - -[:arrow_up_small:](#) - -
- -## [djui_menu_get_font](#djui_menu_get_font) - -### Description -Gets the DJUI menu font - -### Lua Example -`local enumValue = djui_menu_get_font()` - -### Parameters -- None - -### Returns -[enum DjuiFontType](constants.md#enum-DjuiFontType) - -### C Prototype -`enum DjuiFontType djui_menu_get_font(void);` - -[:arrow_up_small:](#) - -
- -## [djui_menu_get_theme](#djui_menu_get_theme) - -### Description -Gets the DJUI menu theme - -### Lua Example -`local DjuiThemeValue = djui_menu_get_theme()` - -### Parameters -- None - -### Returns -[DjuiTheme](structs.md#DjuiTheme) - -### C Prototype -`struct DjuiTheme* djui_menu_get_theme(void);` - -[:arrow_up_small:](#) - -
- -## [djui_popup_create_global](#djui_popup_create_global) - -### Description -Creates a DJUI popup that is broadcasted to every client - -### Lua Example -`djui_popup_create_global(message, lines)` - -### Parameters -| Field | Type | -| ----- | ---- | -| message | `string` | -| lines | `integer` | - -### Returns -- None - -### C Prototype -`void djui_popup_create_global(const char* message, int lines);` - -[:arrow_up_small:](#) - -
- -## [djui_reset_popup_disabled_override](#djui_reset_popup_disabled_override) - -### Description -Resets if popups are disabled - -### Lua Example -`djui_reset_popup_disabled_override()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void djui_reset_popup_disabled_override(void);` - -[:arrow_up_small:](#) - -
- -## [djui_set_popup_disabled_override](#djui_set_popup_disabled_override) - -### Description -Sets if popups are disabled - -### Lua Example -`djui_set_popup_disabled_override(value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| value | `boolean` | - -### Returns -- None - -### C Prototype -`void djui_set_popup_disabled_override(bool value);` - -[:arrow_up_small:](#) - -
- -## [get_coopnet_id](#get_coopnet_id) - -### Description -Gets the CoopNet ID of a player if CoopNet is being used and the player is connected, otherwise "-1" is returned - -### Lua Example -`local stringValue = get_coopnet_id(localIndex)` - -### Parameters -| Field | Type | -| ----- | ---- | -| localIndex | `integer` | - -### Returns -- `string` - -### C Prototype -`const char* get_coopnet_id(s8 localIndex);` - -[:arrow_up_small:](#) - -
- -## [get_current_save_file_num](#get_current_save_file_num) - -### Description -Gets the current save file number (1-indexed) - -### Lua Example -`local integerValue = get_current_save_file_num()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s16 get_current_save_file_num(void);` - -[:arrow_up_small:](#) - -
- -## [get_date_and_time](#get_date_and_time) - -### Description -Gets the system clock's date and time - -### Lua Example -`local DateTimeValue = get_date_and_time()` - -### Parameters -- None - -### Returns -[DateTime](structs.md#DateTime) - -### C Prototype -`struct DateTime* get_date_and_time(void);` - -[:arrow_up_small:](#) - -
- -## [get_dialog_box_state](#get_dialog_box_state) - -### Description -Gets the current state of the dialog box - -### Lua Example -`local integerValue = get_dialog_box_state()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s8 get_dialog_box_state(void);` - -[:arrow_up_small:](#) - -
- -## [get_dialog_id](#get_dialog_id) - -### Description -Gets the current dialog box ID - -### Lua Example -`local integerValue = get_dialog_id()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s16 get_dialog_id(void);` - -[:arrow_up_small:](#) - -
- -## [get_dialog_response](#get_dialog_response) - -### Description -Gets the choice selected inside of a dialog box (0-1) - -### Lua Example -`local integerValue = get_dialog_response()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s32 get_dialog_response(void);` - -[:arrow_up_small:](#) - -
- -## [get_envfx](#get_envfx) - -### Description -Gets the non overridden environment effect (e.g. snow) - -### Lua Example -`local integerValue = get_envfx()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`u16 get_envfx(void);` - -[:arrow_up_small:](#) - -
- -## [get_environment_region](#get_environment_region) - -### Description -Gets an environment region (gas/water boxes) height value - -### Lua Example -`local numberValue = get_environment_region(index)` - -### Parameters -| Field | Type | -| ----- | ---- | -| index | `integer` | - -### Returns -- `number` - -### C Prototype -`f32 get_environment_region(u8 index);` - -[:arrow_up_small:](#) - -
- -## [get_global_timer](#get_global_timer) - -### Description -Gets the global timer that has been ticking at 30 frames per second since game boot - -### Lua Example -`local integerValue = get_global_timer()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`u32 get_global_timer(void);` - -[:arrow_up_small:](#) - -
- -## [get_got_file_coin_hi_score](#get_got_file_coin_hi_score) - -### Description -Checks if the save file's coin "HI SCORE" was obtained with the last star or key collection - -### Lua Example -`local booleanValue = get_got_file_coin_hi_score()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool get_got_file_coin_hi_score(void);` - -[:arrow_up_small:](#) - -
- -## [get_hand_foot_pos_x](#get_hand_foot_pos_x) - -### Description -Gets the X coordinate of Mario's hand (0-1) or foot (2-3) but it is important to note that the positions are not updated off-screen - -### Lua Example -`local numberValue = get_hand_foot_pos_x(m, index)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| index | `integer` | - -### Returns -- `number` - -### C Prototype -`f32 get_hand_foot_pos_x(struct MarioState* m, u8 index);` - -[:arrow_up_small:](#) - -
- -## [get_hand_foot_pos_y](#get_hand_foot_pos_y) - -### Description -Gets the Y coordinate of Mario's hand (0-1) or foot (2-3) but it is important to note that the positions are not updated off-screen - -### Lua Example -`local numberValue = get_hand_foot_pos_y(m, index)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| index | `integer` | - -### Returns -- `number` - -### C Prototype -`f32 get_hand_foot_pos_y(struct MarioState* m, u8 index);` - -[:arrow_up_small:](#) - -
- -## [get_hand_foot_pos_z](#get_hand_foot_pos_z) - -### Description -Gets the Z coordinate of Mario's hand (0-1) or foot (2-3) but it is important to note that the positions are not updated off-screen - -### Lua Example -`local numberValue = get_hand_foot_pos_z(m, index)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| index | `integer` | - -### Returns -- `number` - -### C Prototype -`f32 get_hand_foot_pos_z(struct MarioState* m, u8 index);` - -[:arrow_up_small:](#) - -
- -## [get_last_completed_course_num](#get_last_completed_course_num) - -### Description -Gets the last course a star or key was collected in - -### Lua Example -`local integerValue = get_last_completed_course_num()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`u8 get_last_completed_course_num(void);` - -[:arrow_up_small:](#) - -
- -## [get_last_completed_star_num](#get_last_completed_star_num) - -### Description -Gets the last collected star's number (1-7) - -### Lua Example -`local integerValue = get_last_completed_star_num()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`u8 get_last_completed_star_num(void);` - -[:arrow_up_small:](#) - -
- -## [get_last_star_or_key](#get_last_star_or_key) - -### Description -Gets if the last objective collected was a star (0) or a key (1) - -### Lua Example -`local integerValue = get_last_star_or_key()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`u8 get_last_star_or_key(void);` - -[:arrow_up_small:](#) - -
- -## [get_local_discord_id](#get_local_discord_id) - -### Description -Gets the local discord ID if it isn't disabled, otherwise "0" is returned - -### Lua Example -`local stringValue = get_local_discord_id()` - -### Parameters -- None - -### Returns -- `string` - -### C Prototype -`const char* get_local_discord_id(void);` - -[:arrow_up_small:](#) - -
- -## [get_network_area_timer](#get_network_area_timer) - -### Description -Gets the current area's networked timer - -### Lua Example -`local integerValue = get_network_area_timer()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`u32 get_network_area_timer(void);` - -[:arrow_up_small:](#) - -
- -## [get_os_name](#get_os_name) - -### Description -Gets the name of the operating system the game is running on - -### Lua Example -`local stringValue = get_os_name()` - -### Parameters -- None - -### Returns -- `string` - -### C Prototype -`const char* get_os_name(void);` - -[:arrow_up_small:](#) - -
- -## [get_save_file_modified](#get_save_file_modified) - -### Description -Checks if the save file has been modified without saving - -### Lua Example -`local booleanValue = get_save_file_modified()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool get_save_file_modified(void);` - -[:arrow_up_small:](#) - -
- -## [get_temp_s32_pointer](#get_temp_s32_pointer) - -### Description -Returns a temporary 32-bit integer pointer - -### Lua Example -`local PointerValue = get_temp_s32_pointer(initialValue)` - -### Parameters -| Field | Type | -| ----- | ---- | -| initialValue | `integer` | - -### Returns -- `Pointer` <`integer`> - -### C Prototype -`s32* get_temp_s32_pointer(s32 initialValue);` - -[:arrow_up_small:](#) - -
- -## [get_time](#get_time) - -### Description -Gets the Unix Timestamp - -### Lua Example -`local integerValue = get_time()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s64 get_time(void);` - -[:arrow_up_small:](#) - -
- -## [get_ttc_speed_setting](#get_ttc_speed_setting) - -### Description -Gets TTC's speed setting - -### Lua Example -`local integerValue = get_ttc_speed_setting()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s16 get_ttc_speed_setting(void);` - -[:arrow_up_small:](#) - -
- -## [get_volume_env](#get_volume_env) - -### Description -Gets the volume level of environment sounds effects - -### Lua Example -`local numberValue = get_volume_env()` - -### Parameters -- None - -### Returns -- `number` - -### C Prototype -`f32 get_volume_env(void);` - -[:arrow_up_small:](#) - -
- -## [get_volume_level](#get_volume_level) - -### Description -Gets the volume level of music - -### Lua Example -`local numberValue = get_volume_level()` - -### Parameters -- None - -### Returns -- `number` - -### C Prototype -`f32 get_volume_level(void);` - -[:arrow_up_small:](#) - -
- -## [get_volume_master](#get_volume_master) - -### Description -Gets the master volume level - -### Lua Example -`local numberValue = get_volume_master()` - -### Parameters -- None - -### Returns -- `number` - -### C Prototype -`f32 get_volume_master(void);` - -[:arrow_up_small:](#) - -
- -## [get_volume_sfx](#get_volume_sfx) - -### Description -Gets the volume level of sound effects - -### Lua Example -`local numberValue = get_volume_sfx()` - -### Parameters -- None - -### Returns -- `number` - -### C Prototype -`f32 get_volume_sfx(void);` - -[:arrow_up_small:](#) - -
- -## [get_water_level](#get_water_level) - -### Description -Gets the water level in an area - -### Lua Example -`local integerValue = get_water_level(index)` - -### Parameters -| Field | Type | -| ----- | ---- | -| index | `integer` | - -### Returns -- `integer` - -### C Prototype -`s16 get_water_level(u8 index);` - -[:arrow_up_small:](#) - -
- -## [hud_get_flash](#hud_get_flash) - -### Description -Gets if the star counter on the HUD should flash - -### Lua Example -`local integerValue = hud_get_flash()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s8 hud_get_flash(void);` - -[:arrow_up_small:](#) - -
- -## [hud_get_value](#hud_get_value) - -### Lua Example -`local integerValue = hud_get_value(type)` - -### Parameters -| Field | Type | -| ----- | ---- | -| type | [enum HudDisplayValue](constants.md#enum-HudDisplayValue) | - -### Returns -- `integer` - -### C Prototype -`s32 hud_get_value(enum HudDisplayValue type);` - -[:arrow_up_small:](#) - -
- -## [hud_hide](#hud_hide) - -### Description -Hides the HUD - -### Lua Example -`hud_hide()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void hud_hide(void);` - -[:arrow_up_small:](#) - -
- -## [hud_is_hidden](#hud_is_hidden) - -### Description -Checks if the HUD is hidden - -### Lua Example -`local booleanValue = hud_is_hidden()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool hud_is_hidden(void);` - -[:arrow_up_small:](#) - -
- -## [hud_render_power_meter](#hud_render_power_meter) - -### Description -Renders a power meter on the HUD - -### Lua Example -`hud_render_power_meter(health, x, y, width, height)` - -### Parameters -| Field | Type | -| ----- | ---- | -| health | `integer` | -| x | `number` | -| y | `number` | -| width | `number` | -| height | `number` | - -### Returns -- None - -### C Prototype -`void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height);` - -[:arrow_up_small:](#) - -
- -## [hud_render_power_meter_interpolated](#hud_render_power_meter_interpolated) - -### Description -Renders an interpolated power meter on the HUD - -### Lua Example -`hud_render_power_meter_interpolated(health, prevX, prevY, prevWidth, prevHeight, x, y, width, height)` - -### Parameters -| Field | Type | -| ----- | ---- | -| health | `integer` | -| prevX | `number` | -| prevY | `number` | -| prevWidth | `number` | -| prevHeight | `number` | -| x | `number` | -| y | `number` | -| width | `number` | -| height | `number` | - -### Returns -- None - -### C Prototype -`void hud_render_power_meter_interpolated(s32 health, f32 prevX, f32 prevY, f32 prevWidth, f32 prevHeight, f32 x, f32 y, f32 width, f32 height);` - -[:arrow_up_small:](#) - -
- -## [hud_set_flash](#hud_set_flash) - -### Description -Sets if the star counter on the HUD should flash - -### Lua Example -`hud_set_flash(value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| value | `integer` | - -### Returns -- None - -### C Prototype -`void hud_set_flash(s8 value);` - -[:arrow_up_small:](#) - -
- -## [hud_set_value](#hud_set_value) - -### Description -Sets a HUD display value - -### Lua Example -`hud_set_value(type, value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| type | [enum HudDisplayValue](constants.md#enum-HudDisplayValue) | -| value | `integer` | - -### Returns -- None - -### C Prototype -`void hud_set_value(enum HudDisplayValue type, s32 value);` - -[:arrow_up_small:](#) - -
- -## [hud_show](#hud_show) - -### Description -Shows the HUD - -### Lua Example -`hud_show()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void hud_show(void);` - -[:arrow_up_small:](#) - -
- -## [is_game_paused](#is_game_paused) - -### Description -Checks if the game is paused - -### Lua Example -`local booleanValue = is_game_paused()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool is_game_paused(void);` - -[:arrow_up_small:](#) - -
- -## [is_transition_playing](#is_transition_playing) - -### Description -Checks if a screen transition is playing - -### Lua Example -`local booleanValue = is_transition_playing()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool is_transition_playing(void);` - -[:arrow_up_small:](#) - -
- -## [mod_file_exists](#mod_file_exists) - -### Description -Checks if a file exists inside of a mod - -### Lua Example -`local booleanValue = mod_file_exists(filename)` - -### Parameters -| Field | Type | -| ----- | ---- | -| filename | `string` | - -### Returns -- `boolean` - -### C Prototype -`bool mod_file_exists(const char* filename);` - -[:arrow_up_small:](#) - -
- -## [movtexqc_register](#movtexqc_register) - -### Description -Registers a custom moving texture entry (used for vanilla water boxes) - -### Lua Example -`movtexqc_register(name, level, area, type)` - -### Parameters -| Field | Type | -| ----- | ---- | -| name | `string` | -| level | `integer` | -| area | `integer` | -| type | `integer` | - -### Returns -- None - -### C Prototype -`void movtexqc_register(const char* name, s16 level, s16 area, s16 type);` - -[:arrow_up_small:](#) - -
- -## [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:](#) - -
- -## [reset_window_title](#reset_window_title) - -### Description -Resets the window title - -### Lua Example -`reset_window_title()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void reset_window_title(void);` - -[:arrow_up_small:](#) - -
- -## [save_file_get_using_backup_slot](#save_file_get_using_backup_slot) - -### Description -Checks if the save file is using its backup slot - -### Lua Example -`local booleanValue = save_file_get_using_backup_slot()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool save_file_get_using_backup_slot(void);` - -[:arrow_up_small:](#) - -
- -## [save_file_set_using_backup_slot](#save_file_set_using_backup_slot) - -### Description -Sets if the save file should use its backup slot - -### Lua Example -`save_file_set_using_backup_slot(usingBackupSlot)` - -### Parameters -| Field | Type | -| ----- | ---- | -| usingBackupSlot | `boolean` | - -### Returns -- None - -### C Prototype -`void save_file_set_using_backup_slot(bool usingBackupSlot);` - -[:arrow_up_small:](#) - -
- -## [set_environment_region](#set_environment_region) - -### Description -Sets an environment region (gas/water boxes) height value - -### Lua Example -`set_environment_region(index, value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| index | `integer` | -| value | `integer` | - -### Returns -- None - -### C Prototype -`void set_environment_region(u8 index, s32 value);` - -[:arrow_up_small:](#) - -
- -## [set_got_file_coin_hi_score](#set_got_file_coin_hi_score) - -### Description -Sets if the save file's coin "HI SCORE" was obtained with the last star or key collection - -### Lua Example -`set_got_file_coin_hi_score(value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| value | `boolean` | - -### Returns -- None - -### C Prototype -`void set_got_file_coin_hi_score(bool value);` - -[:arrow_up_small:](#) - -
- -## [set_last_completed_course_num](#set_last_completed_course_num) - -### Description -Sets the last course a star or key was collected in - -### Lua Example -`set_last_completed_course_num(courseNum)` - -### Parameters -| Field | Type | -| ----- | ---- | -| courseNum | `integer` | - -### Returns -- None - -### C Prototype -`void set_last_completed_course_num(u8 courseNum);` - -[:arrow_up_small:](#) - -
- -## [set_last_completed_star_num](#set_last_completed_star_num) - -### Description -Sets the last collected star's number (1-7) - -### Lua Example -`set_last_completed_star_num(starNum)` - -### Parameters -| Field | Type | -| ----- | ---- | -| starNum | `integer` | - -### Returns -- None - -### C Prototype -`void set_last_completed_star_num(u8 starNum);` - -[:arrow_up_small:](#) - -
- -## [set_last_star_or_key](#set_last_star_or_key) - -### Description -Sets if the last objective collected was a star (0) or a key (1) - -### Lua Example -`set_last_star_or_key(value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| value | `integer` | - -### Returns -- None - -### C Prototype -`void set_last_star_or_key(u8 value);` - -[:arrow_up_small:](#) - -
- -## [set_override_envfx](#set_override_envfx) - -### Description -Sets the override environment effect (e.g. snow) - -### Lua Example -`set_override_envfx(envfx)` - -### Parameters -| Field | Type | -| ----- | ---- | -| envfx | `integer` | - -### Returns -- None - -### C Prototype -`void set_override_envfx(s32 envfx);` - -[:arrow_up_small:](#) - -
- -## [set_save_file_modified](#set_save_file_modified) - -### Description -Sets if the save file has been modified without saving - -### Lua Example -`set_save_file_modified(value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| value | `boolean` | - -### Returns -- None - -### C Prototype -`void set_save_file_modified(bool value);` - -[:arrow_up_small:](#) - -
- -## [set_ttc_speed_setting](#set_ttc_speed_setting) - -### Description -Sets TTC's speed setting (TTC_SPEED_*) - -### Lua Example -`set_ttc_speed_setting(speed)` - -### Parameters -| Field | Type | -| ----- | ---- | -| speed | `integer` | - -### Returns -- None - -### C Prototype -`void set_ttc_speed_setting(s16 speed);` - -[:arrow_up_small:](#) - -
- -## [set_volume_env](#set_volume_env) - -### Description -Sets the volume level of environment sounds effects - -### Lua Example -`set_volume_env(volume)` - -### Parameters -| Field | Type | -| ----- | ---- | -| volume | `number` | - -### Returns -- None - -### C Prototype -`void set_volume_env(f32 volume);` - -[:arrow_up_small:](#) - -
- -## [set_volume_level](#set_volume_level) - -### Description -Sets the volume level of music - -### Lua Example -`set_volume_level(volume)` - -### Parameters -| Field | Type | -| ----- | ---- | -| volume | `number` | - -### Returns -- None - -### C Prototype -`void set_volume_level(f32 volume);` - -[:arrow_up_small:](#) - -
- -## [set_volume_master](#set_volume_master) - -### Description -Sets the master volume level - -### Lua Example -`set_volume_master(volume)` - -### Parameters -| Field | Type | -| ----- | ---- | -| volume | `number` | - -### Returns -- None - -### C Prototype -`void set_volume_master(f32 volume);` - -[:arrow_up_small:](#) - -
- -## [set_volume_sfx](#set_volume_sfx) - -### Description -Sets the volume level of sound effects - -### Lua Example -`set_volume_sfx(volume)` - -### Parameters -| Field | Type | -| ----- | ---- | -| volume | `number` | - -### Returns -- None - -### C Prototype -`void set_volume_sfx(f32 volume);` - -[:arrow_up_small:](#) - -
- -## [set_water_level](#set_water_level) - -### Description -Sets the water level in an area - -### Lua Example -`set_water_level(index, height, sync)` - -### Parameters -| Field | Type | -| ----- | ---- | -| index | `integer` | -| height | `integer` | -| sync | `boolean` | - -### Returns -- None - -### C Prototype -`void set_water_level(u8 index, s16 height, bool sync);` - -[:arrow_up_small:](#) - -
- -## [set_window_title](#set_window_title) - -### Description -Sets the window title to a custom title - -### Lua Example -`set_window_title(title)` - -### Parameters -| Field | Type | -| ----- | ---- | -| title | `string` | - -### Returns -- None - -### C Prototype -`void set_window_title(const char* title);` - -[:arrow_up_small:](#) - -
- ---- -# functions from smlua_model_utils.h - -
- - -## [smlua_model_util_get_id](#smlua_model_util_get_id) - -### Lua Example -`local enumValue = smlua_model_util_get_id(name)` - -### Parameters -| Field | Type | -| ----- | ---- | -| name | `string` | - -### Returns -[enum ModelExtendedId](constants.md#enum-ModelExtendedId) - -### C Prototype -`enum ModelExtendedId smlua_model_util_get_id(const char* name);` - -[:arrow_up_small:](#) -
--- diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md index 1e64bf3b0..543a44fab 100644 --- a/docs/lua/functions-6.md +++ b/docs/lua/functions-6.md @@ -5,6 +5,1605 @@ [< prev](functions-5.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | [5](functions-5.md) | 6] +--- +# functions from smlua_misc_utils.h + +
+ + +## [allocate_mario_action](#allocate_mario_action) + +### Description +Allocates an action ID with bitwise flags + +### Lua Example +`local integerValue = allocate_mario_action(actFlags)` + +### Parameters +| Field | Type | +| ----- | ---- | +| actFlags | `integer` | + +### Returns +- `integer` + +### C Prototype +`u32 allocate_mario_action(u32 actFlags);` + +[:arrow_up_small:](#) + +
+ +## [course_is_main_course](#course_is_main_course) + +### Description +Checks if a course is a main course and not the castle or secret levels + +### Lua Example +`local booleanValue = course_is_main_course(courseNum)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | + +### Returns +- `boolean` + +### C Prototype +`bool course_is_main_course(u16 courseNum);` + +[:arrow_up_small:](#) + +
+ +## [deref_s32_pointer](#deref_s32_pointer) + +### Description +Gets the signed 32-bit integer value from `pointer` + +### Lua Example +`local integerValue = deref_s32_pointer(pointer)` + +### Parameters +| Field | Type | +| ----- | ---- | +| pointer | `Pointer` <`integer`> | + +### Returns +- `integer` + +### C Prototype +`s32 deref_s32_pointer(s32* pointer);` + +[:arrow_up_small:](#) + +
+ +## [djui_attempting_to_open_playerlist](#djui_attempting_to_open_playerlist) + +### Description +Checks if the DJUI playerlist is attempting to be opened + +### Lua Example +`local booleanValue = djui_attempting_to_open_playerlist()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool djui_attempting_to_open_playerlist(void);` + +[:arrow_up_small:](#) + +
+ +## [djui_is_playerlist_open](#djui_is_playerlist_open) + +### Description +Checks if the DJUI playerlist is open + +### Lua Example +`local booleanValue = djui_is_playerlist_open()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool djui_is_playerlist_open(void);` + +[:arrow_up_small:](#) + +
+ +## [djui_is_popup_disabled](#djui_is_popup_disabled) + +### Description +Returns if popups are disabled + +### Lua Example +`local booleanValue = djui_is_popup_disabled()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool djui_is_popup_disabled(void);` + +[:arrow_up_small:](#) + +
+ +## [djui_menu_get_font](#djui_menu_get_font) + +### Description +Gets the DJUI menu font + +### Lua Example +`local enumValue = djui_menu_get_font()` + +### Parameters +- None + +### Returns +[enum DjuiFontType](constants.md#enum-DjuiFontType) + +### C Prototype +`enum DjuiFontType djui_menu_get_font(void);` + +[:arrow_up_small:](#) + +
+ +## [djui_menu_get_theme](#djui_menu_get_theme) + +### Description +Gets the DJUI menu theme + +### Lua Example +`local DjuiThemeValue = djui_menu_get_theme()` + +### Parameters +- None + +### Returns +[DjuiTheme](structs.md#DjuiTheme) + +### C Prototype +`struct DjuiTheme* djui_menu_get_theme(void);` + +[:arrow_up_small:](#) + +
+ +## [djui_popup_create_global](#djui_popup_create_global) + +### Description +Creates a DJUI popup that is broadcasted to every client + +### Lua Example +`djui_popup_create_global(message, lines)` + +### Parameters +| Field | Type | +| ----- | ---- | +| message | `string` | +| lines | `integer` | + +### Returns +- None + +### C Prototype +`void djui_popup_create_global(const char* message, int lines);` + +[:arrow_up_small:](#) + +
+ +## [djui_reset_popup_disabled_override](#djui_reset_popup_disabled_override) + +### Description +Resets if popups are disabled + +### Lua Example +`djui_reset_popup_disabled_override()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void djui_reset_popup_disabled_override(void);` + +[:arrow_up_small:](#) + +
+ +## [djui_set_popup_disabled_override](#djui_set_popup_disabled_override) + +### Description +Sets if popups are disabled + +### Lua Example +`djui_set_popup_disabled_override(value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| value | `boolean` | + +### Returns +- None + +### C Prototype +`void djui_set_popup_disabled_override(bool value);` + +[:arrow_up_small:](#) + +
+ +## [get_coopnet_id](#get_coopnet_id) + +### Description +Gets the CoopNet ID of a player with `localIndex` if CoopNet is being used and the player is connected, otherwise "-1" is returned + +### Lua Example +`local stringValue = get_coopnet_id(localIndex)` + +### Parameters +| Field | Type | +| ----- | ---- | +| localIndex | `integer` | + +### Returns +- `string` + +### C Prototype +`const char* get_coopnet_id(s8 localIndex);` + +[:arrow_up_small:](#) + +
+ +## [get_current_save_file_num](#get_current_save_file_num) + +### Description +Gets the current save file number (1-indexed) + +### Lua Example +`local integerValue = get_current_save_file_num()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s16 get_current_save_file_num(void);` + +[:arrow_up_small:](#) + +
+ +## [get_date_and_time](#get_date_and_time) + +### Description +Gets the system clock's date and time + +### Lua Example +`local DateTimeValue = get_date_and_time()` + +### Parameters +- None + +### Returns +[DateTime](structs.md#DateTime) + +### C Prototype +`struct DateTime* get_date_and_time(void);` + +[:arrow_up_small:](#) + +
+ +## [get_dialog_box_state](#get_dialog_box_state) + +### Description +Gets the current state of the dialog box + +### Lua Example +`local integerValue = get_dialog_box_state()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s8 get_dialog_box_state(void);` + +[:arrow_up_small:](#) + +
+ +## [get_dialog_id](#get_dialog_id) + +### Description +Gets the current dialog box ID + +### Lua Example +`local integerValue = get_dialog_id()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s16 get_dialog_id(void);` + +[:arrow_up_small:](#) + +
+ +## [get_dialog_response](#get_dialog_response) + +### Description +Gets the choice selected inside of a dialog box (0-1) + +### Lua Example +`local integerValue = get_dialog_response()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s32 get_dialog_response(void);` + +[:arrow_up_small:](#) + +
+ +## [get_envfx](#get_envfx) + +### Description +Gets the non overridden environment effect (e.g. snow) + +### Lua Example +`local integerValue = get_envfx()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`u16 get_envfx(void);` + +[:arrow_up_small:](#) + +
+ +## [get_environment_region](#get_environment_region) + +### Description +Gets an environment region (gas/water boxes) height value + +### Lua Example +`local numberValue = get_environment_region(index)` + +### Parameters +| Field | Type | +| ----- | ---- | +| index | `integer` | + +### Returns +- `number` + +### C Prototype +`f32 get_environment_region(u8 index);` + +[:arrow_up_small:](#) + +
+ +## [get_global_timer](#get_global_timer) + +### Description +Gets the global timer that has been ticking at 30 frames per second since game boot + +### Lua Example +`local integerValue = get_global_timer()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`u32 get_global_timer(void);` + +[:arrow_up_small:](#) + +
+ +## [get_got_file_coin_hi_score](#get_got_file_coin_hi_score) + +### Description +Checks if the save file's coin "HI SCORE" was obtained with the last star or key collection + +### Lua Example +`local booleanValue = get_got_file_coin_hi_score()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool get_got_file_coin_hi_score(void);` + +[:arrow_up_small:](#) + +
+ +## [get_hand_foot_pos_x](#get_hand_foot_pos_x) + +### Description +Gets the X coordinate of Mario's hand (0-1) or foot (2-3) but it is important to note that the positions are not updated off-screen + +### Lua Example +`local numberValue = get_hand_foot_pos_x(m, index)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| index | `integer` | + +### Returns +- `number` + +### C Prototype +`f32 get_hand_foot_pos_x(struct MarioState* m, u8 index);` + +[:arrow_up_small:](#) + +
+ +## [get_hand_foot_pos_y](#get_hand_foot_pos_y) + +### Description +Gets the Y coordinate of Mario's hand (0-1) or foot (2-3) but It is important to note that the positions are not updated off-screen + +### Lua Example +`local numberValue = get_hand_foot_pos_y(m, index)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| index | `integer` | + +### Returns +- `number` + +### C Prototype +`f32 get_hand_foot_pos_y(struct MarioState* m, u8 index);` + +[:arrow_up_small:](#) + +
+ +## [get_hand_foot_pos_z](#get_hand_foot_pos_z) + +### Description +Gets the Z coordinate of Mario's hand (0-1) or foot (2-3) but it is important to note that the positions are not updated off-screen + +### Lua Example +`local numberValue = get_hand_foot_pos_z(m, index)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| index | `integer` | + +### Returns +- `number` + +### C Prototype +`f32 get_hand_foot_pos_z(struct MarioState* m, u8 index);` + +[:arrow_up_small:](#) + +
+ +## [get_last_completed_course_num](#get_last_completed_course_num) + +### Description +Gets the last course a star or key was collected in + +### Lua Example +`local integerValue = get_last_completed_course_num()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`u8 get_last_completed_course_num(void);` + +[:arrow_up_small:](#) + +
+ +## [get_last_completed_star_num](#get_last_completed_star_num) + +### Description +Gets the last collected star's number (1-7) + +### Lua Example +`local integerValue = get_last_completed_star_num()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`u8 get_last_completed_star_num(void);` + +[:arrow_up_small:](#) + +
+ +## [get_last_star_or_key](#get_last_star_or_key) + +### Description +Gets if the last objective collected was a star (0) or a key (1) + +### Lua Example +`local integerValue = get_last_star_or_key()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`u8 get_last_star_or_key(void);` + +[:arrow_up_small:](#) + +
+ +## [get_local_discord_id](#get_local_discord_id) + +### Description +Gets the local discord ID if it isn't disabled, otherwise "0" is returned + +### Lua Example +`local stringValue = get_local_discord_id()` + +### Parameters +- None + +### Returns +- `string` + +### C Prototype +`const char* get_local_discord_id(void);` + +[:arrow_up_small:](#) + +
+ +## [get_network_area_timer](#get_network_area_timer) + +### Description +Gets the current area's networked timer + +### Lua Example +`local integerValue = get_network_area_timer()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`u32 get_network_area_timer(void);` + +[:arrow_up_small:](#) + +
+ +## [get_os_name](#get_os_name) + +### Description +Gets the name of the operating system the game is running on + +### Lua Example +`local stringValue = get_os_name()` + +### Parameters +- None + +### Returns +- `string` + +### C Prototype +`const char* get_os_name(void);` + +[:arrow_up_small:](#) + +
+ +## [get_save_file_modified](#get_save_file_modified) + +### Description +Checks if the save file has been modified without saving + +### Lua Example +`local booleanValue = get_save_file_modified()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool get_save_file_modified(void);` + +[:arrow_up_small:](#) + +
+ +## [get_temp_s32_pointer](#get_temp_s32_pointer) + +### Description +Returns a temporary signed 32-bit integer pointer with its value set to `initialValue` + +### Lua Example +`local PointerValue = get_temp_s32_pointer(initialValue)` + +### Parameters +| Field | Type | +| ----- | ---- | +| initialValue | `integer` | + +### Returns +- `Pointer` <`integer`> + +### C Prototype +`s32* get_temp_s32_pointer(s32 initialValue);` + +[:arrow_up_small:](#) + +
+ +## [get_time](#get_time) + +### Description +Gets the Unix Timestamp + +### Lua Example +`local integerValue = get_time()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s64 get_time(void);` + +[:arrow_up_small:](#) + +
+ +## [get_ttc_speed_setting](#get_ttc_speed_setting) + +### Description +Gets TTC's speed setting + +### Lua Example +`local integerValue = get_ttc_speed_setting()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s16 get_ttc_speed_setting(void);` + +[:arrow_up_small:](#) + +
+ +## [get_volume_env](#get_volume_env) + +### Description +Gets the volume level of environment sounds effects + +### Lua Example +`local numberValue = get_volume_env()` + +### Parameters +- None + +### Returns +- `number` + +### C Prototype +`f32 get_volume_env(void);` + +[:arrow_up_small:](#) + +
+ +## [get_volume_level](#get_volume_level) + +### Description +Gets the volume level of music + +### Lua Example +`local numberValue = get_volume_level()` + +### Parameters +- None + +### Returns +- `number` + +### C Prototype +`f32 get_volume_level(void);` + +[:arrow_up_small:](#) + +
+ +## [get_volume_master](#get_volume_master) + +### Description +Gets the master volume level + +### Lua Example +`local numberValue = get_volume_master()` + +### Parameters +- None + +### Returns +- `number` + +### C Prototype +`f32 get_volume_master(void);` + +[:arrow_up_small:](#) + +
+ +## [get_volume_sfx](#get_volume_sfx) + +### Description +Gets the volume level of sound effects + +### Lua Example +`local numberValue = get_volume_sfx()` + +### Parameters +- None + +### Returns +- `number` + +### C Prototype +`f32 get_volume_sfx(void);` + +[:arrow_up_small:](#) + +
+ +## [get_water_level](#get_water_level) + +### Description +Gets the water level in an area + +### Lua Example +`local integerValue = get_water_level(index)` + +### Parameters +| Field | Type | +| ----- | ---- | +| index | `integer` | + +### Returns +- `integer` + +### C Prototype +`s16 get_water_level(u8 index);` + +[:arrow_up_small:](#) + +
+ +## [hud_get_flash](#hud_get_flash) + +### Description +Gets if the star counter on the HUD should flash + +### Lua Example +`local integerValue = hud_get_flash()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s8 hud_get_flash(void);` + +[:arrow_up_small:](#) + +
+ +## [hud_get_value](#hud_get_value) + +### Lua Example +`local integerValue = hud_get_value(type)` + +### Parameters +| Field | Type | +| ----- | ---- | +| type | [enum HudDisplayValue](constants.md#enum-HudDisplayValue) | + +### Returns +- `integer` + +### C Prototype +`s32 hud_get_value(enum HudDisplayValue type);` + +[:arrow_up_small:](#) + +
+ +## [hud_hide](#hud_hide) + +### Description +Hides the HUD + +### Lua Example +`hud_hide()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void hud_hide(void);` + +[:arrow_up_small:](#) + +
+ +## [hud_is_hidden](#hud_is_hidden) + +### Description +Checks if the HUD is hidden + +### Lua Example +`local booleanValue = hud_is_hidden()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool hud_is_hidden(void);` + +[:arrow_up_small:](#) + +
+ +## [hud_render_power_meter](#hud_render_power_meter) + +### Description +Renders a power meter on the HUD + +### Lua Example +`hud_render_power_meter(health, x, y, width, height)` + +### Parameters +| Field | Type | +| ----- | ---- | +| health | `integer` | +| x | `number` | +| y | `number` | +| width | `number` | +| height | `number` | + +### Returns +- None + +### C Prototype +`void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height);` + +[:arrow_up_small:](#) + +
+ +## [hud_render_power_meter_interpolated](#hud_render_power_meter_interpolated) + +### Description +Renders an interpolated power meter on the HUD + +### Lua Example +`hud_render_power_meter_interpolated(health, prevX, prevY, prevWidth, prevHeight, x, y, width, height)` + +### Parameters +| Field | Type | +| ----- | ---- | +| health | `integer` | +| prevX | `number` | +| prevY | `number` | +| prevWidth | `number` | +| prevHeight | `number` | +| x | `number` | +| y | `number` | +| width | `number` | +| height | `number` | + +### Returns +- None + +### C Prototype +`void hud_render_power_meter_interpolated(s32 health, f32 prevX, f32 prevY, f32 prevWidth, f32 prevHeight, f32 x, f32 y, f32 width, f32 height);` + +[:arrow_up_small:](#) + +
+ +## [hud_set_flash](#hud_set_flash) + +### Description +Sets if the star counter on the HUD should flash + +### Lua Example +`hud_set_flash(value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| value | `integer` | + +### Returns +- None + +### C Prototype +`void hud_set_flash(s8 value);` + +[:arrow_up_small:](#) + +
+ +## [hud_set_value](#hud_set_value) + +### Description +Sets a HUD display value + +### Lua Example +`hud_set_value(type, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| type | [enum HudDisplayValue](constants.md#enum-HudDisplayValue) | +| value | `integer` | + +### Returns +- None + +### C Prototype +`void hud_set_value(enum HudDisplayValue type, s32 value);` + +[:arrow_up_small:](#) + +
+ +## [hud_show](#hud_show) + +### Description +Shows the HUD + +### Lua Example +`hud_show()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void hud_show(void);` + +[:arrow_up_small:](#) + +
+ +## [is_game_paused](#is_game_paused) + +### Description +Checks if the game is paused + +### Lua Example +`local booleanValue = is_game_paused()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool is_game_paused(void);` + +[:arrow_up_small:](#) + +
+ +## [is_transition_playing](#is_transition_playing) + +### Description +Checks if a screen transition is playing + +### Lua Example +`local booleanValue = is_transition_playing()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool is_transition_playing(void);` + +[:arrow_up_small:](#) + +
+ +## [mod_file_exists](#mod_file_exists) + +### Description +Checks if a file exists inside of a mod + +### Lua Example +`local booleanValue = mod_file_exists(filename)` + +### Parameters +| Field | Type | +| ----- | ---- | +| filename | `string` | + +### Returns +- `boolean` + +### C Prototype +`bool mod_file_exists(const char* filename);` + +[:arrow_up_small:](#) + +
+ +## [movtexqc_register](#movtexqc_register) + +### Description +Registers a custom moving texture entry (used for vanilla water boxes) + +### Lua Example +`movtexqc_register(name, level, area, type)` + +### Parameters +| Field | Type | +| ----- | ---- | +| name | `string` | +| level | `integer` | +| area | `integer` | +| type | `integer` | + +### Returns +- None + +### C Prototype +`void movtexqc_register(const char* name, s16 level, s16 area, s16 type);` + +[:arrow_up_small:](#) + +
+ +## [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:](#) + +
+ +## [reset_window_title](#reset_window_title) + +### Description +Resets the window title + +### Lua Example +`reset_window_title()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void reset_window_title(void);` + +[:arrow_up_small:](#) + +
+ +## [save_file_get_using_backup_slot](#save_file_get_using_backup_slot) + +### Description +Checks if the save file is using its backup slot + +### Lua Example +`local booleanValue = save_file_get_using_backup_slot()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool save_file_get_using_backup_slot(void);` + +[:arrow_up_small:](#) + +
+ +## [save_file_set_using_backup_slot](#save_file_set_using_backup_slot) + +### Description +Sets if the save file should use its backup slot + +### Lua Example +`save_file_set_using_backup_slot(usingBackupSlot)` + +### Parameters +| Field | Type | +| ----- | ---- | +| usingBackupSlot | `boolean` | + +### Returns +- None + +### C Prototype +`void save_file_set_using_backup_slot(bool usingBackupSlot);` + +[:arrow_up_small:](#) + +
+ +## [set_environment_region](#set_environment_region) + +### Description +Sets an environment region (gas/water boxes) height value + +### Lua Example +`set_environment_region(index, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| index | `integer` | +| value | `integer` | + +### Returns +- None + +### C Prototype +`void set_environment_region(u8 index, s32 value);` + +[:arrow_up_small:](#) + +
+ +## [set_got_file_coin_hi_score](#set_got_file_coin_hi_score) + +### Description +Sets if the save file's coin "HI SCORE" was obtained with the last star or key collection + +### Lua Example +`set_got_file_coin_hi_score(value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| value | `boolean` | + +### Returns +- None + +### C Prototype +`void set_got_file_coin_hi_score(bool value);` + +[:arrow_up_small:](#) + +
+ +## [set_last_completed_course_num](#set_last_completed_course_num) + +### Description +Sets the last course a star or key was collected in + +### Lua Example +`set_last_completed_course_num(courseNum)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | + +### Returns +- None + +### C Prototype +`void set_last_completed_course_num(u8 courseNum);` + +[:arrow_up_small:](#) + +
+ +## [set_last_completed_star_num](#set_last_completed_star_num) + +### Description +Sets the last collected star's number (1-7) + +### Lua Example +`set_last_completed_star_num(starNum)` + +### Parameters +| Field | Type | +| ----- | ---- | +| starNum | `integer` | + +### Returns +- None + +### C Prototype +`void set_last_completed_star_num(u8 starNum);` + +[:arrow_up_small:](#) + +
+ +## [set_last_star_or_key](#set_last_star_or_key) + +### Description +Sets if the last objective collected was a star (0) or a key (1) + +### Lua Example +`set_last_star_or_key(value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| value | `integer` | + +### Returns +- None + +### C Prototype +`void set_last_star_or_key(u8 value);` + +[:arrow_up_small:](#) + +
+ +## [set_override_envfx](#set_override_envfx) + +### Description +Sets the override environment effect (e.g. snow) + +### Lua Example +`set_override_envfx(envfx)` + +### Parameters +| Field | Type | +| ----- | ---- | +| envfx | `integer` | + +### Returns +- None + +### C Prototype +`void set_override_envfx(s32 envfx);` + +[:arrow_up_small:](#) + +
+ +## [set_save_file_modified](#set_save_file_modified) + +### Description +Sets if the save file has been modified without saving + +### Lua Example +`set_save_file_modified(value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| value | `boolean` | + +### Returns +- None + +### C Prototype +`void set_save_file_modified(bool value);` + +[:arrow_up_small:](#) + +
+ +## [set_ttc_speed_setting](#set_ttc_speed_setting) + +### Description +Sets TTC's speed setting (TTC_SPEED_*) + +### Lua Example +`set_ttc_speed_setting(speed)` + +### Parameters +| Field | Type | +| ----- | ---- | +| speed | `integer` | + +### Returns +- None + +### C Prototype +`void set_ttc_speed_setting(s16 speed);` + +[:arrow_up_small:](#) + +
+ +## [set_volume_env](#set_volume_env) + +### Description +Sets the volume level of environment sounds effects + +### Lua Example +`set_volume_env(volume)` + +### Parameters +| Field | Type | +| ----- | ---- | +| volume | `number` | + +### Returns +- None + +### C Prototype +`void set_volume_env(f32 volume);` + +[:arrow_up_small:](#) + +
+ +## [set_volume_level](#set_volume_level) + +### Description +Sets the volume level of music + +### Lua Example +`set_volume_level(volume)` + +### Parameters +| Field | Type | +| ----- | ---- | +| volume | `number` | + +### Returns +- None + +### C Prototype +`void set_volume_level(f32 volume);` + +[:arrow_up_small:](#) + +
+ +## [set_volume_master](#set_volume_master) + +### Description +Sets the master volume level + +### Lua Example +`set_volume_master(volume)` + +### Parameters +| Field | Type | +| ----- | ---- | +| volume | `number` | + +### Returns +- None + +### C Prototype +`void set_volume_master(f32 volume);` + +[:arrow_up_small:](#) + +
+ +## [set_volume_sfx](#set_volume_sfx) + +### Description +Sets the volume level of sound effects + +### Lua Example +`set_volume_sfx(volume)` + +### Parameters +| Field | Type | +| ----- | ---- | +| volume | `number` | + +### Returns +- None + +### C Prototype +`void set_volume_sfx(f32 volume);` + +[:arrow_up_small:](#) + +
+ +## [set_water_level](#set_water_level) + +### Description +Sets the water level in an area + +### Lua Example +`set_water_level(index, height, sync)` + +### Parameters +| Field | Type | +| ----- | ---- | +| index | `integer` | +| height | `integer` | +| sync | `boolean` | + +### Returns +- None + +### C Prototype +`void set_water_level(u8 index, s16 height, bool sync);` + +[:arrow_up_small:](#) + +
+ +## [set_window_title](#set_window_title) + +### Description +Sets the window title to a custom title + +### Lua Example +`set_window_title(title)` + +### Parameters +| Field | Type | +| ----- | ---- | +| title | `string` | + +### Returns +- None + +### C Prototype +`void set_window_title(const char* title);` + +[:arrow_up_small:](#) + +
+ +--- +# functions from smlua_model_utils.h + +
+ + +## [smlua_model_util_get_id](#smlua_model_util_get_id) + +### Description +Gets the extended model ID for the `name` of a `GeoLayout` + +### Lua Example +`local enumValue = smlua_model_util_get_id(name)` + +### Parameters +| Field | Type | +| ----- | ---- | +| name | `string` | + +### Returns +[enum ModelExtendedId](constants.md#enum-ModelExtendedId) + +### C Prototype +`enum ModelExtendedId smlua_model_util_get_id(const char* name);` + +[:arrow_up_small:](#) + +
+ --- # functions from smlua_obj_utils.h @@ -13,6 +1612,9 @@ ## [get_temp_object_hitbox](#get_temp_object_hitbox) +### Description +Returns a temporary object hitbox pointer + ### Lua Example `local ObjectHitboxValue = get_temp_object_hitbox()` @@ -31,6 +1633,9 @@ ## [get_trajectory](#get_trajectory) +### Description +Gets a trajectory by `name` + ### Lua Example `local PointerValue = get_trajectory(name)` @@ -51,6 +1656,9 @@ ## [obj_check_hitbox_overlap](#obj_check_hitbox_overlap) +### Description +Checks if `o1`'s hitbox is colliding with `o2`'s hitbox + ### Lua Example `local booleanValue = obj_check_hitbox_overlap(o1, o2)` @@ -72,6 +1680,9 @@ ## [obj_check_overlap_with_hitbox_params](#obj_check_overlap_with_hitbox_params) +### Description +Checks if `o`'s hitbox is colliding with the parameters of a hitbox + ### Lua Example `local booleanValue = obj_check_overlap_with_hitbox_params(o, x, y, z, h, r, d)` @@ -98,6 +1709,9 @@ ## [obj_count_objects_with_behavior_id](#obj_count_objects_with_behavior_id) +### Description +Counts every object with `behaviorId` + ### Lua Example `local integerValue = obj_count_objects_with_behavior_id(behaviorId)` @@ -118,6 +1732,9 @@ ## [obj_get_collided_object](#obj_get_collided_object) +### Description +Gets the corresponding collided object to an index from `o` + ### Lua Example `local ObjectValue = obj_get_collided_object(o, index)` @@ -139,6 +1756,9 @@ ## [obj_get_field_f32](#obj_get_field_f32) +### Description +Sets the float value from the field corresponding to `fieldIndex` + ### Lua Example `local numberValue = obj_get_field_f32(o, fieldIndex)` @@ -160,6 +1780,9 @@ ## [obj_get_field_s16](#obj_get_field_s16) +### Description +Gets the signed 32-bit integer value from the sub field corresponding to `fieldSubIndex` from the field corresponding to `fieldIndex` + ### Lua Example `local integerValue = obj_get_field_s16(o, fieldIndex, fieldSubIndex)` @@ -182,6 +1805,9 @@ ## [obj_get_field_s32](#obj_get_field_s32) +### Description +Gets the signed 32-bit integer value from the field corresponding to `fieldIndex` + ### Lua Example `local integerValue = obj_get_field_s32(o, fieldIndex)` @@ -203,6 +1829,9 @@ ## [obj_get_field_u32](#obj_get_field_u32) +### Description +Gets the unsigned 32-bit integer value from the field corresponding to `fieldIndex` + ### Lua Example `local integerValue = obj_get_field_u32(o, fieldIndex)` @@ -224,6 +1853,9 @@ ## [obj_get_first](#obj_get_first) +### Description +Gets the first object in an object list + ### Lua Example `local ObjectValue = obj_get_first(objList)` @@ -244,6 +1876,9 @@ ## [obj_get_first_with_behavior_id](#obj_get_first_with_behavior_id) +### Description +Gets the first object loaded with `behaviorId` + ### Lua Example `local ObjectValue = obj_get_first_with_behavior_id(behaviorId)` @@ -264,6 +1899,9 @@ ## [obj_get_first_with_behavior_id_and_field_f32](#obj_get_first_with_behavior_id_and_field_f32) +### Description +Gets the first object loaded with `behaviorId` and object float field (look in `object_fields.h` to get the index of a field) + ### Lua Example `local ObjectValue = obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value)` @@ -286,6 +1924,9 @@ ## [obj_get_first_with_behavior_id_and_field_s32](#obj_get_first_with_behavior_id_and_field_s32) +### Description +Gets the first object loaded with `behaviorId` and object signed 32-bit integer field (look in `object_fields.h` to get the index of a field) + ### Lua Example `local ObjectValue = obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value)` @@ -308,6 +1949,9 @@ ## [obj_get_nearest_object_with_behavior_id](#obj_get_nearest_object_with_behavior_id) +### Description +Gets the nearest object with `behaviorId` to `o` + ### Lua Example `local ObjectValue = obj_get_nearest_object_with_behavior_id(o, behaviorId)` @@ -329,6 +1973,9 @@ ## [obj_get_next](#obj_get_next) +### Description +Gets the next object in an object list + ### Lua Example `local ObjectValue = obj_get_next(o)` @@ -349,6 +1996,9 @@ ## [obj_get_next_with_same_behavior_id](#obj_get_next_with_same_behavior_id) +### Description +Gets the next object loaded with the same behavior ID + ### Lua Example `local ObjectValue = obj_get_next_with_same_behavior_id(o)` @@ -369,6 +2019,9 @@ ## [obj_get_next_with_same_behavior_id_and_field_f32](#obj_get_next_with_same_behavior_id_and_field_f32) +### Description +Gets the next object loaded with the same behavior ID and object float field (look in `object_fields.h` to get the index of a field) + ### Lua Example `local ObjectValue = obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value)` @@ -391,6 +2044,9 @@ ## [obj_get_next_with_same_behavior_id_and_field_s32](#obj_get_next_with_same_behavior_id_and_field_s32) +### Description +Gets the next object loaded with the same behavior ID and object signed 32-bit integer field (look in `object_fields.h` to get the index of a field) + ### Lua Example `local ObjectValue = obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value)` @@ -413,6 +2069,9 @@ ## [obj_get_temp_spawn_particles_info](#obj_get_temp_spawn_particles_info) +### Description +Returns a temporary particle spawn info pointer with its model loaded in from `modelId` + ### Lua Example `local SpawnParticlesInfoValue = obj_get_temp_spawn_particles_info(modelId)` @@ -433,6 +2092,9 @@ ## [obj_has_behavior_id](#obj_has_behavior_id) +### Description +Checks if an object has `behaviorId` + ### Lua Example `local integerValue = obj_has_behavior_id(o, behaviorId)` @@ -454,6 +2116,9 @@ ## [obj_has_model_extended](#obj_has_model_extended) +### Description +Checks if an object's model is equal to `modelId` + ### Lua Example `local integerValue = obj_has_model_extended(o, modelId)` @@ -475,6 +2140,9 @@ ## [obj_is_attackable](#obj_is_attackable) +### Description +Checks if `o` is attackable + ### Lua Example `local booleanValue = obj_is_attackable(o)` @@ -495,6 +2163,9 @@ ## [obj_is_breakable_object](#obj_is_breakable_object) +### Description +Checks if `o` is breakable + ### Lua Example `local booleanValue = obj_is_breakable_object(o)` @@ -515,6 +2186,9 @@ ## [obj_is_bully](#obj_is_bully) +### Description +Checks if `o` is a Bully + ### Lua Example `local booleanValue = obj_is_bully(o)` @@ -535,6 +2209,9 @@ ## [obj_is_coin](#obj_is_coin) +### Description +Checks if `o` is a coin + ### Lua Example `local booleanValue = obj_is_coin(o)` @@ -555,6 +2232,9 @@ ## [obj_is_exclamation_box](#obj_is_exclamation_box) +### Description +Checks if `o` is an exclamation box + ### Lua Example `local booleanValue = obj_is_exclamation_box(o)` @@ -575,6 +2255,9 @@ ## [obj_is_grabbable](#obj_is_grabbable) +### Description +Checks if `o` is grabbable + ### Lua Example `local booleanValue = obj_is_grabbable(o)` @@ -587,7 +2270,7 @@ - `boolean` ### C Prototype -`bool obj_is_grabbable(struct Object *o) ;` +`bool obj_is_grabbable(struct Object *o);` [:arrow_up_small:](#) @@ -595,6 +2278,9 @@ ## [obj_is_mushroom_1up](#obj_is_mushroom_1up) +### Description +Checks if `o` is a 1-Up Mushroom + ### Lua Example `local booleanValue = obj_is_mushroom_1up(o)` @@ -615,6 +2301,9 @@ ## [obj_is_secret](#obj_is_secret) +### Description +Checks if `o` is a secret + ### Lua Example `local booleanValue = obj_is_secret(o)` @@ -635,6 +2324,9 @@ ## [obj_is_valid_for_interaction](#obj_is_valid_for_interaction) +### Description +Checks if `o` is activated, tangible, and interactible + ### Lua Example `local booleanValue = obj_is_valid_for_interaction(o)` @@ -655,6 +2347,9 @@ ## [obj_move_xyz](#obj_move_xyz) +### Description +Moves the object in the direction of `dx`, `dy`, and `dz` + ### Lua Example `obj_move_xyz(o, dx, dy, dz)` @@ -678,6 +2373,9 @@ ## [obj_set_field_f32](#obj_set_field_f32) +### Description +Sets the float value from the field corresponding to `fieldIndex` + ### Lua Example `obj_set_field_f32(o, fieldIndex, value)` @@ -700,6 +2398,9 @@ ## [obj_set_field_s16](#obj_set_field_s16) +### Description +Sets the signed 32-bit integer value from the sub field corresponding to `fieldSubIndex` from the field corresponding to `fieldIndex` + ### Lua Example `obj_set_field_s16(o, fieldIndex, fieldSubIndex, value)` @@ -723,6 +2424,9 @@ ## [obj_set_field_s32](#obj_set_field_s32) +### Description +Sets the signed 32-bit integer value from the field corresponding to `fieldIndex` + ### Lua Example `obj_set_field_s32(o, fieldIndex, value)` @@ -745,6 +2449,9 @@ ## [obj_set_field_u32](#obj_set_field_u32) +### Description +Sets the unsigned 32-bit integer value from the field corresponding to `fieldIndex` + ### Lua Example `obj_set_field_u32(o, fieldIndex, value)` @@ -767,6 +2474,9 @@ ## [obj_set_model_extended](#obj_set_model_extended) +### Description +Sets an object's model to `modelId` + ### Lua Example `obj_set_model_extended(o, modelId)` @@ -788,6 +2498,9 @@ ## [obj_set_vel](#obj_set_vel) +### Description +Sets an object's velocity to `vx`, `vy`, and `vz` + ### Lua Example `obj_set_vel(o, vx, vy, vz)` @@ -811,6 +2524,9 @@ ## [set_whirlpools](#set_whirlpools) +### Description +Sets the parameters of one of the two whirlpools (0-indexed) in an area + ### Lua Example `set_whirlpools(x, y, z, strength, area, index)` @@ -836,6 +2552,9 @@ ## [spawn_non_sync_object](#spawn_non_sync_object) +### Description +Spawns a synchronized object in at `x`, `y`, and `z` as a child object of the local Mario with his rotation. You can change the fields of the object in `objSetupFunction` + ### Lua Example `local ObjectValue = spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)` @@ -861,6 +2580,9 @@ ## [spawn_sync_object](#spawn_sync_object) +### Description +Spawns a synchronized object in at `x`, `y`, and `z` as a child object of the local Mario with his rotation. You can change the fields of the object in `objSetupFunction` + ### Lua Example `local ObjectValue = spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)` @@ -892,6 +2614,9 @@ ## [smlua_text_utils_act_name_get](#smlua_text_utils_act_name_get) +### Description +Gets the act name of `actNum` in `courseNum` + ### Lua Example `local stringValue = smlua_text_utils_act_name_get(courseNum, actNum)` @@ -913,6 +2638,9 @@ ## [smlua_text_utils_act_name_mod_index](#smlua_text_utils_act_name_mod_index) +### Description +Gets the index of the mod that replaced the act name of `actNum` in `courseNum` + ### Lua Example `local integerValue = smlua_text_utils_act_name_mod_index(courseNum, actNum)` @@ -934,6 +2662,9 @@ ## [smlua_text_utils_act_name_replace](#smlua_text_utils_act_name_replace) +### Description +Replaces the act name of `actNum` in `courseNum` with `name` + ### Lua Example `smlua_text_utils_act_name_replace(courseNum, actNum, name)` @@ -956,6 +2687,9 @@ ## [smlua_text_utils_act_name_reset](#smlua_text_utils_act_name_reset) +### Description +Resets the act name of `actNum` in `courseNum` + ### Lua Example `smlua_text_utils_act_name_reset(courseNum, actNum)` @@ -977,6 +2711,9 @@ ## [smlua_text_utils_castle_secret_stars_replace](#smlua_text_utils_castle_secret_stars_replace) +### Description +Replaces the castle secret stars text with `name` + ### Lua Example `smlua_text_utils_castle_secret_stars_replace(name)` @@ -997,6 +2734,9 @@ ## [smlua_text_utils_course_acts_replace](#smlua_text_utils_course_acts_replace) +### Description +Replaces the act names of `courseNum` + ### Lua Example `smlua_text_utils_course_acts_replace(courseNum, courseName, act1, act2, act3, act4, act5, act6)` @@ -1024,6 +2764,9 @@ ## [smlua_text_utils_course_name_get](#smlua_text_utils_course_name_get) +### Description +Gets the name of `courseNum` + ### Lua Example `local stringValue = smlua_text_utils_course_name_get(courseNum)` @@ -1044,6 +2787,9 @@ ## [smlua_text_utils_course_name_mod_index](#smlua_text_utils_course_name_mod_index) +### Description +Gets the index of the mod that replaced the name of `courseNum` + ### Lua Example `local integerValue = smlua_text_utils_course_name_mod_index(courseNum)` @@ -1064,6 +2810,9 @@ ## [smlua_text_utils_course_name_replace](#smlua_text_utils_course_name_replace) +### Description +Replaces the name of `courseNum` with `name` + ### Lua Example `smlua_text_utils_course_name_replace(courseNum, name)` @@ -1085,6 +2834,9 @@ ## [smlua_text_utils_course_name_reset](#smlua_text_utils_course_name_reset) +### Description +Resets the name of `courseNum` + ### Lua Example `smlua_text_utils_course_name_reset(courseNum)` @@ -1105,6 +2857,9 @@ ## [smlua_text_utils_dialog_replace](#smlua_text_utils_dialog_replace) +### Description +Replaces `dialogId` with a custom one + ### Lua Example `smlua_text_utils_dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str)` @@ -1130,6 +2885,9 @@ ## [smlua_text_utils_extra_text_replace](#smlua_text_utils_extra_text_replace) +### Description +Replace extra text (e.g. one of the castle's secret stars) with `text` + ### Lua Example `smlua_text_utils_extra_text_replace(index, text)` @@ -1151,6 +2909,9 @@ ## [smlua_text_utils_get_language](#smlua_text_utils_get_language) +### Description +Gets the current language + ### Lua Example `local stringValue = smlua_text_utils_get_language()` @@ -1169,6 +2930,9 @@ ## [smlua_text_utils_secret_star_replace](#smlua_text_utils_secret_star_replace) +### Description +Replaces the secret star course name of `courseNum` with `courseName` + ### Lua Example `smlua_text_utils_secret_star_replace(courseNum, courseName)` diff --git a/docs/lua/functions.md b/docs/lua/functions.md index d7fdcbd0d..215dba39c 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1742,81 +1742,81 @@
- smlua_misc_utils.h - - [allocate_mario_action](functions-5.md#allocate_mario_action) - - [course_is_main_course](functions-5.md#course_is_main_course) - - [deref_s32_pointer](functions-5.md#deref_s32_pointer) - - [djui_attempting_to_open_playerlist](functions-5.md#djui_attempting_to_open_playerlist) - - [djui_is_playerlist_open](functions-5.md#djui_is_playerlist_open) - - [djui_is_popup_disabled](functions-5.md#djui_is_popup_disabled) - - [djui_menu_get_font](functions-5.md#djui_menu_get_font) - - [djui_menu_get_theme](functions-5.md#djui_menu_get_theme) - - [djui_popup_create_global](functions-5.md#djui_popup_create_global) - - [djui_reset_popup_disabled_override](functions-5.md#djui_reset_popup_disabled_override) - - [djui_set_popup_disabled_override](functions-5.md#djui_set_popup_disabled_override) - - [get_coopnet_id](functions-5.md#get_coopnet_id) - - [get_current_save_file_num](functions-5.md#get_current_save_file_num) - - [get_date_and_time](functions-5.md#get_date_and_time) - - [get_dialog_box_state](functions-5.md#get_dialog_box_state) - - [get_dialog_id](functions-5.md#get_dialog_id) - - [get_dialog_response](functions-5.md#get_dialog_response) - - [get_envfx](functions-5.md#get_envfx) - - [get_environment_region](functions-5.md#get_environment_region) - - [get_global_timer](functions-5.md#get_global_timer) - - [get_got_file_coin_hi_score](functions-5.md#get_got_file_coin_hi_score) - - [get_hand_foot_pos_x](functions-5.md#get_hand_foot_pos_x) - - [get_hand_foot_pos_y](functions-5.md#get_hand_foot_pos_y) - - [get_hand_foot_pos_z](functions-5.md#get_hand_foot_pos_z) - - [get_last_completed_course_num](functions-5.md#get_last_completed_course_num) - - [get_last_completed_star_num](functions-5.md#get_last_completed_star_num) - - [get_last_star_or_key](functions-5.md#get_last_star_or_key) - - [get_local_discord_id](functions-5.md#get_local_discord_id) - - [get_network_area_timer](functions-5.md#get_network_area_timer) - - [get_os_name](functions-5.md#get_os_name) - - [get_save_file_modified](functions-5.md#get_save_file_modified) - - [get_temp_s32_pointer](functions-5.md#get_temp_s32_pointer) - - [get_time](functions-5.md#get_time) - - [get_ttc_speed_setting](functions-5.md#get_ttc_speed_setting) - - [get_volume_env](functions-5.md#get_volume_env) - - [get_volume_level](functions-5.md#get_volume_level) - - [get_volume_master](functions-5.md#get_volume_master) - - [get_volume_sfx](functions-5.md#get_volume_sfx) - - [get_water_level](functions-5.md#get_water_level) - - [hud_get_flash](functions-5.md#hud_get_flash) - - [hud_get_value](functions-5.md#hud_get_value) - - [hud_hide](functions-5.md#hud_hide) - - [hud_is_hidden](functions-5.md#hud_is_hidden) - - [hud_render_power_meter](functions-5.md#hud_render_power_meter) - - [hud_render_power_meter_interpolated](functions-5.md#hud_render_power_meter_interpolated) - - [hud_set_flash](functions-5.md#hud_set_flash) - - [hud_set_value](functions-5.md#hud_set_value) - - [hud_show](functions-5.md#hud_show) - - [is_game_paused](functions-5.md#is_game_paused) - - [is_transition_playing](functions-5.md#is_transition_playing) - - [mod_file_exists](functions-5.md#mod_file_exists) - - [movtexqc_register](functions-5.md#movtexqc_register) - - [play_transition](functions-5.md#play_transition) - - [reset_window_title](functions-5.md#reset_window_title) - - [save_file_get_using_backup_slot](functions-5.md#save_file_get_using_backup_slot) - - [save_file_set_using_backup_slot](functions-5.md#save_file_set_using_backup_slot) - - [set_environment_region](functions-5.md#set_environment_region) - - [set_got_file_coin_hi_score](functions-5.md#set_got_file_coin_hi_score) - - [set_last_completed_course_num](functions-5.md#set_last_completed_course_num) - - [set_last_completed_star_num](functions-5.md#set_last_completed_star_num) - - [set_last_star_or_key](functions-5.md#set_last_star_or_key) - - [set_override_envfx](functions-5.md#set_override_envfx) - - [set_save_file_modified](functions-5.md#set_save_file_modified) - - [set_ttc_speed_setting](functions-5.md#set_ttc_speed_setting) - - [set_volume_env](functions-5.md#set_volume_env) - - [set_volume_level](functions-5.md#set_volume_level) - - [set_volume_master](functions-5.md#set_volume_master) - - [set_volume_sfx](functions-5.md#set_volume_sfx) - - [set_water_level](functions-5.md#set_water_level) - - [set_window_title](functions-5.md#set_window_title) + - [allocate_mario_action](functions-6.md#allocate_mario_action) + - [course_is_main_course](functions-6.md#course_is_main_course) + - [deref_s32_pointer](functions-6.md#deref_s32_pointer) + - [djui_attempting_to_open_playerlist](functions-6.md#djui_attempting_to_open_playerlist) + - [djui_is_playerlist_open](functions-6.md#djui_is_playerlist_open) + - [djui_is_popup_disabled](functions-6.md#djui_is_popup_disabled) + - [djui_menu_get_font](functions-6.md#djui_menu_get_font) + - [djui_menu_get_theme](functions-6.md#djui_menu_get_theme) + - [djui_popup_create_global](functions-6.md#djui_popup_create_global) + - [djui_reset_popup_disabled_override](functions-6.md#djui_reset_popup_disabled_override) + - [djui_set_popup_disabled_override](functions-6.md#djui_set_popup_disabled_override) + - [get_coopnet_id](functions-6.md#get_coopnet_id) + - [get_current_save_file_num](functions-6.md#get_current_save_file_num) + - [get_date_and_time](functions-6.md#get_date_and_time) + - [get_dialog_box_state](functions-6.md#get_dialog_box_state) + - [get_dialog_id](functions-6.md#get_dialog_id) + - [get_dialog_response](functions-6.md#get_dialog_response) + - [get_envfx](functions-6.md#get_envfx) + - [get_environment_region](functions-6.md#get_environment_region) + - [get_global_timer](functions-6.md#get_global_timer) + - [get_got_file_coin_hi_score](functions-6.md#get_got_file_coin_hi_score) + - [get_hand_foot_pos_x](functions-6.md#get_hand_foot_pos_x) + - [get_hand_foot_pos_y](functions-6.md#get_hand_foot_pos_y) + - [get_hand_foot_pos_z](functions-6.md#get_hand_foot_pos_z) + - [get_last_completed_course_num](functions-6.md#get_last_completed_course_num) + - [get_last_completed_star_num](functions-6.md#get_last_completed_star_num) + - [get_last_star_or_key](functions-6.md#get_last_star_or_key) + - [get_local_discord_id](functions-6.md#get_local_discord_id) + - [get_network_area_timer](functions-6.md#get_network_area_timer) + - [get_os_name](functions-6.md#get_os_name) + - [get_save_file_modified](functions-6.md#get_save_file_modified) + - [get_temp_s32_pointer](functions-6.md#get_temp_s32_pointer) + - [get_time](functions-6.md#get_time) + - [get_ttc_speed_setting](functions-6.md#get_ttc_speed_setting) + - [get_volume_env](functions-6.md#get_volume_env) + - [get_volume_level](functions-6.md#get_volume_level) + - [get_volume_master](functions-6.md#get_volume_master) + - [get_volume_sfx](functions-6.md#get_volume_sfx) + - [get_water_level](functions-6.md#get_water_level) + - [hud_get_flash](functions-6.md#hud_get_flash) + - [hud_get_value](functions-6.md#hud_get_value) + - [hud_hide](functions-6.md#hud_hide) + - [hud_is_hidden](functions-6.md#hud_is_hidden) + - [hud_render_power_meter](functions-6.md#hud_render_power_meter) + - [hud_render_power_meter_interpolated](functions-6.md#hud_render_power_meter_interpolated) + - [hud_set_flash](functions-6.md#hud_set_flash) + - [hud_set_value](functions-6.md#hud_set_value) + - [hud_show](functions-6.md#hud_show) + - [is_game_paused](functions-6.md#is_game_paused) + - [is_transition_playing](functions-6.md#is_transition_playing) + - [mod_file_exists](functions-6.md#mod_file_exists) + - [movtexqc_register](functions-6.md#movtexqc_register) + - [play_transition](functions-6.md#play_transition) + - [reset_window_title](functions-6.md#reset_window_title) + - [save_file_get_using_backup_slot](functions-6.md#save_file_get_using_backup_slot) + - [save_file_set_using_backup_slot](functions-6.md#save_file_set_using_backup_slot) + - [set_environment_region](functions-6.md#set_environment_region) + - [set_got_file_coin_hi_score](functions-6.md#set_got_file_coin_hi_score) + - [set_last_completed_course_num](functions-6.md#set_last_completed_course_num) + - [set_last_completed_star_num](functions-6.md#set_last_completed_star_num) + - [set_last_star_or_key](functions-6.md#set_last_star_or_key) + - [set_override_envfx](functions-6.md#set_override_envfx) + - [set_save_file_modified](functions-6.md#set_save_file_modified) + - [set_ttc_speed_setting](functions-6.md#set_ttc_speed_setting) + - [set_volume_env](functions-6.md#set_volume_env) + - [set_volume_level](functions-6.md#set_volume_level) + - [set_volume_master](functions-6.md#set_volume_master) + - [set_volume_sfx](functions-6.md#set_volume_sfx) + - [set_water_level](functions-6.md#set_water_level) + - [set_window_title](functions-6.md#set_window_title)
- smlua_model_utils.h - - [smlua_model_util_get_id](functions-5.md#smlua_model_util_get_id) + - [smlua_model_util_get_id](functions-6.md#smlua_model_util_get_id)
@@ -2424,7 +2424,7 @@ N/A ## [area_get_warp_node](#area_get_warp_node) ### 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. 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 ### Lua Example `local ObjectWarpNodeValue = area_get_warp_node(id)` @@ -2447,7 +2447,7 @@ Finds a warp node in the current area by its ID. The warp node must exist in the ## [area_get_warp_node_from_params](#area_get_warp_node_from_params) ### Description -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 ### Lua Example `local ObjectWarpNodeValue = area_get_warp_node_from_params(o)` diff --git a/src/game/area.h b/src/game/area.h index 77bedd04b..b49b1f45c 100644 --- a/src/game/area.h +++ b/src/game/area.h @@ -161,14 +161,14 @@ u32 get_mario_spawn_type(struct Object *o); /* |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. -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| */ struct ObjectWarpNode *area_get_warp_node(u8 id); struct ObjectWarpNode *area_get_any_warp_node(void); /* |description| 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. +Useful for associating an object (like a door or warp pipe) with its corresponding warp node in the area |descriptionEnd| */ struct ObjectWarpNode *area_get_warp_node_from_params(struct Object *o); void clear_areas(void); diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 1cb01dfd9..451187a62 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -29533,23 +29533,6 @@ int smlua_func_audio_stream_get_tempo(lua_State* L) { return 1; } -int smlua_func_audio_stream_load_url(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", "audio_stream_load_url", 1, top); - return 0; - } - - const char* url = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_load_url"); return 0; } - - smlua_push_object(L, LOT_MODAUDIO, audio_stream_load_url(url)); - - return 1; -} - int smlua_func_audio_stream_set_speed(lua_State* L) { if (L == NULL) { return 0; } @@ -35058,7 +35041,6 @@ void smlua_bind_functions_autogen(void) { // smlua_deprecated.h smlua_bind_function(L, "audio_stream_get_tempo", smlua_func_audio_stream_get_tempo); - smlua_bind_function(L, "audio_stream_load_url", smlua_func_audio_stream_load_url); smlua_bind_function(L, "audio_stream_set_speed", smlua_func_audio_stream_set_speed); smlua_bind_function(L, "audio_stream_set_tempo", smlua_func_audio_stream_set_tempo); smlua_bind_function(L, "djui_hud_set_render_behind_hud", smlua_func_djui_hud_set_render_behind_hud); diff --git a/src/pc/lua/utils/smlua_anim_utils.h b/src/pc/lua/utils/smlua_anim_utils.h index 9d757e55e..ef7dff061 100644 --- a/src/pc/lua/utils/smlua_anim_utils.h +++ b/src/pc/lua/utils/smlua_anim_utils.h @@ -66,11 +66,14 @@ struct GlobalObjectAnimations { extern struct GlobalObjectAnimations gGlobalObjectAnimations; +/* |description|Gets a vanilla mario Animation with `index`|descriptionEnd| */ struct Animation *get_mario_vanilla_animation(u16 index); void smlua_anim_util_reset(); void smlua_anim_util_register_animation(const char *name, s16 flags, s16 animYTransDivisor, s16 startFrame, s16 loopStart, s16 loopEnd, u16 *values, u32 valuesLength, u16 *index, u32 indexLength); +/* |description|Sets the animation of `obj` to the animation `name` corresponds to|descriptionEnd| */ void smlua_anim_util_set_animation(struct Object *obj, const char *name); +/* |description|Gets the name of the current animation playing on `obj`, returns `nil` if there's no name|descriptionEnd| */ const char *smlua_anim_util_get_current_animation_name(struct Object *obj); #endif diff --git a/src/pc/lua/utils/smlua_audio_utils.h b/src/pc/lua/utils/smlua_audio_utils.h index 048a699f7..9559d04f5 100644 --- a/src/pc/lua/utils/smlua_audio_utils.h +++ b/src/pc/lua/utils/smlua_audio_utils.h @@ -31,24 +31,41 @@ struct ModAudio { bool loaded; }; +/* |description|Loads an `audio` stream by `filename` (with extension)|descriptionEnd| */ struct ModAudio* audio_stream_load(const char* filename); +/* |description|Destroys an `audio` stream|descriptionEnd| */ void audio_stream_destroy(struct ModAudio* audio); +/* |description|Plays an `audio` stream with `volume`. `restart` sets the elapsed time back to 0.|descriptionEnd| */ void audio_stream_play(struct ModAudio* audio, bool restart, f32 volume); +/* |description|Pauses an `audio` stream|descriptionEnd| */ void audio_stream_pause(struct ModAudio* audio); +/* |description|Stops an `audio` stream|descriptionEnd| */ void audio_stream_stop(struct ModAudio* audio); +/* |description|Gets the position of an `audio` stream|descriptionEnd| */ f32 audio_stream_get_position(struct ModAudio* audio); +/* |description|Sets the position of an `audio` stream|descriptionEnd| */ void audio_stream_set_position(struct ModAudio* audio, f32 pos); +/* |description|Gets if an `audio` stream is looping or not|descriptionEnd| */ bool audio_stream_get_looping(struct ModAudio* audio); +/* |description|Sets if an `audio` stream is looping or not|descriptionEnd| */ void audio_stream_set_looping(struct ModAudio* audio, bool looping); +/* |description|Gets the frequency of an `audio` stream|descriptionEnd| */ f32 audio_stream_get_frequency(struct ModAudio* audio); +/* |description|Sets the frequency of an `audio` stream|descriptionEnd| */ void audio_stream_set_frequency(struct ModAudio* audio, f32 freq); +/* |description|Gets the volume of an `audio` stream|descriptionEnd| */ f32 audio_stream_get_volume(struct ModAudio* audio); +/* |description|Sets the volume of an `audio` stream|descriptionEnd| */ void audio_stream_set_volume(struct ModAudio* audio, f32 volume); void audio_sample_destroy_pending_copies(void); +/* |description|Loads an `audio` sample|descriptionEnd| */ struct ModAudio* audio_sample_load(const char* filename); +/* |description|Destroys an `audio` sample|descriptionEnd| */ void audio_sample_destroy(struct ModAudio* audio); +/* |description|Stops an `audio` sample|descriptionEnd| */ void audio_sample_stop(struct ModAudio* audio); +/* |description|Plays an `audio` sample at `position` with `volume`|descriptionEnd| */ void audio_sample_play(struct ModAudio* audio, Vec3f position, f32 volume); void audio_custom_update_volume(void); diff --git a/src/pc/lua/utils/smlua_camera_utils.h b/src/pc/lua/utils/smlua_camera_utils.h index 982769a19..286b32247 100644 --- a/src/pc/lua/utils/smlua_camera_utils.h +++ b/src/pc/lua/utils/smlua_camera_utils.h @@ -9,38 +9,68 @@ struct CameraOverride { bool override; }; +/* |description|Resets camera config overrides|descriptionEnd| */ void camera_reset_overrides(void); +/* |description|Freezes the camera by not updating it|descriptionEnd| */ void camera_freeze(void); +/* |description|Unfreezes the camera|descriptionEnd| */ void camera_unfreeze(void); +/* |description|Checks if the camera is frozen|descriptionEnd| */ bool camera_is_frozen(void); +/* |description|Sets the romhack camera override status|descriptionEnd| */ void camera_set_romhack_override(enum RomhackCameraOverride rco); +/* |description|Sets if the romhack camera should allow centering|descriptionEnd| */ void camera_romhack_allow_centering(u8 allow); +/* |description|Sets if the romhack camera should fly above poison gas|descriptionEnd| */ void camera_allow_toxic_gas_camera(u8 allow); +/* |description|Sets if the romhack camera should allow D-Pad movement|descriptionEnd| */ void camera_romhack_allow_dpad_usage(u8 allow); +/* |description|Checks if Free Camera is enabled|descriptionEnd| */ bool camera_config_is_free_cam_enabled(void); +/* |description|Checks if Analog Camera is enabled|descriptionEnd| */ bool camera_config_is_analog_cam_enabled(void); +/* |description|Checks if Mouse Look is enabled|descriptionEnd| */ bool camera_config_is_mouse_look_enabled(void); +/* |description|Checks if camera X is inverted|descriptionEnd| */ bool camera_config_is_x_inverted(void); +/* |description|Checks if camera Y is inverted|descriptionEnd| */ bool camera_config_is_y_inverted(void); +/* |description|Gets camera X sensitivity|descriptionEnd| */ u32 camera_config_get_x_sensitivity(void); +/* |description|Gets camera Y sensitivity|descriptionEnd| */ u32 camera_config_get_y_sensitivity(void); +/* |description|Gets camera aggression|descriptionEnd| */ u32 camera_config_get_aggression(void); +/* |description|Gets camera pan level|descriptionEnd| */ u32 camera_config_get_pan_level(void); +/* |description|Gets camera deceleration|descriptionEnd| */ u32 camera_config_get_deceleration(void); +/* |description|Overrides if Free Camera is enabled|descriptionEnd| */ void camera_config_enable_free_cam(bool enable); +/* |description|Overrides if Analog Camera is enabled|descriptionEnd| */ void camera_config_enable_analog_cam(bool enable); +/* |description|Overrides if camera mouse look is enabled|descriptionEnd| */ void camera_config_enable_mouse_look(bool enable); +/* |description|Overrides if camera X is inverted|descriptionEnd| */ void camera_config_invert_x(bool invert); +/* |description|Overrides if camera Y is inverted|descriptionEnd| */ void camera_config_invert_y(bool invert); +/* |description|Overrides camera X sensitivity|descriptionEnd| */ void camera_config_set_x_sensitivity(u32 value); +/* |description|Overrides camera Y sensitivity|descriptionEnd| */ void camera_config_set_y_sensitivity(u32 value); +/* |description|Overrides camera aggression|descriptionEnd| */ void camera_config_set_aggression(u32 value); +/* |description|Overrides camera pan level|descriptionEnd| */ void camera_config_set_pan_level(u32 value); +/* |description|Overrides camera deceleration|descriptionEnd| */ void camera_config_set_deceleration(u32 value); +/* |description|Checks if the camera should account for surfaces|descriptionEnd| */ bool camera_get_checking_surfaces(void); +/* |description|Sets if the camera should account for surfaces|descriptionEnd| */ void camera_set_checking_surfaces(bool value); #endif diff --git a/src/pc/lua/utils/smlua_collision_utils.h b/src/pc/lua/utils/smlua_collision_utils.h index 7cb00fea9..78b93ad29 100644 --- a/src/pc/lua/utils/smlua_collision_utils.h +++ b/src/pc/lua/utils/smlua_collision_utils.h @@ -115,21 +115,29 @@ struct GlobalObjectCollisionData { extern struct GlobalObjectCollisionData gGlobalObjectCollisionData; struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 precision); +/* |description|Finds a potential floor at the given `x`, `y`, and `z` values|descriptionEnd| */ 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| */ struct Surface* collision_find_ceil(f32 x, f32 y, f32 z); struct Surface* get_water_surface_pseudo_floor(void); +/* |description|Gets the `Collision` with `name`|descriptionEnd| */ Collision* smlua_collision_util_get(const char* name); +/* |description|Returns a temporary wall collision data pointer|descriptionEnd| */ struct WallCollisionData* collision_get_temp_wall_collision_data(void); +/* |description|Gets the surface corresponding to `index` from `wcd`|descriptionEnd| */ struct Surface* get_surface_from_wcd_index(struct WallCollisionData* wcd, s8 index); +/* |description|Gets the current level terrain collision|descriptionEnd| */ Collision* smlua_collision_util_get_current_terrain_collision(void); +/* |description|Gets the `level` terrain collision from `area`|descriptionEnd| */ Collision *smlua_collision_util_get_level_collision(u32 level, u16 area); +/* |description|Gets a table of the surface types from `data`|descriptionEnd| */ void smlua_collision_util_find_surface_types(Collision* data); #endif diff --git a/src/pc/lua/utils/smlua_deprecated.c b/src/pc/lua/utils/smlua_deprecated.c index 00c00e237..b18404796 100644 --- a/src/pc/lua/utils/smlua_deprecated.c +++ b/src/pc/lua/utils/smlua_deprecated.c @@ -10,11 +10,6 @@ void djui_hud_set_render_behind_hud(bool enable) { gLuaActiveMod->renderBehindHud = enable; } -struct ModAudio* audio_stream_load_url(UNUSED const char* url) { - LOG_LUA_LINE_WARNING("[LUA] audio_stream_load_url() is deprecated! There is no replacement for this function."); - return NULL; -} - f32 audio_stream_get_tempo(UNUSED struct ModAudio* audio) { LOG_LUA_LINE_WARNING("[LUA] audio_stream_get_tempo() is deprecated! There may be a replacement for this function in the future."); return 1; diff --git a/src/pc/lua/utils/smlua_deprecated.h b/src/pc/lua/utils/smlua_deprecated.h index 7d8820f54..0137ac257 100644 --- a/src/pc/lua/utils/smlua_deprecated.h +++ b/src/pc/lua/utils/smlua_deprecated.h @@ -1,11 +1,16 @@ #pragma once +/* |description|[DEPRECATED: Use `HOOK_ON_HUD_RENDER_BEHIND` instead] Sets if DJUI should render behind the vanilla HUD|descriptionEnd| */ void djui_hud_set_render_behind_hud(bool enable); -struct ModAudio* audio_stream_load_url(const char* url); +/* |description|[DEPRECATED: There may be a replacement for this function in the future]|descriptionEnd| */ f32 audio_stream_get_tempo(struct ModAudio* audio); +/* |description|[DEPRECATED: There may be a replacement for this function in the future]|descriptionEnd| */ void audio_stream_set_tempo(struct ModAudio* audio, f32 tempo); +/* |description|[DEPRECATED: There may be a replacement for this function in the future]|descriptionEnd| */ void audio_stream_set_speed(struct ModAudio* audio, f32 initial_freq, f32 speed, bool pitch); +/* |description|[DEPRECATED: Use `network_player_set_override_palette_color` instead]|descriptionEnd| */ void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color); +/* |description|[DEPRECATED: Use `network_player_get_palette_color` or `network_player_get_override_palette_color` instead]|descriptionEnd| */ void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out); diff --git a/src/pc/lua/utils/smlua_level_utils.h b/src/pc/lua/utils/smlua_level_utils.h index 03ff6b712..97fd87b88 100644 --- a/src/pc/lua/utils/smlua_level_utils.h +++ b/src/pc/lua/utils/smlua_level_utils.h @@ -19,17 +19,29 @@ struct CustomLevelInfo { #define CUSTOM_LEVEL_NUM_START 50 void smlua_level_util_reset(void); +/* |description|Instantly changes the current area to `areaIndex`|descriptionEnd| */ void smlua_level_util_change_area(s32 areaIndex); +/* |description|Gets information on a custom level from `levelNum`|descriptionEnd| */ struct CustomLevelInfo* smlua_level_util_get_info(s16 levelNum); +/* |description|Gets information on a custom level from `shortName`|descriptionEnd| */ struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName); +/* |description|Gets information on a custom level from `courseNum`|descriptionEnd| */ struct CustomLevelInfo* smlua_level_util_get_info_from_course_num(u8 courseNum); +/* |description|Registers a fully custom level. Level ID begins at 50|descriptionEnd| */ s16 level_register(const char* scriptEntryName, s16 courseNum, const char* fullName, const char* shortName, u32 acousticReach, u32 echoLevel1, u32 echoLevel2, u32 echoLevel3); +/* |description|Checks if `levelNum` is a vanilla level|descriptionEnd| */ bool level_is_vanilla_level(s16 levelNum); +/* |description|Warps to `aWarpId` of `aArea` in `aLevel` during `aAct`|descriptionEnd| */ bool warp_to_warpnode(s32 aLevel, s32 aArea, s32 aAct, s32 aWarpId); +/* |description|Warps to `aArea` of `aLevel` in `aAct`|descriptionEnd| */ bool warp_to_level(s32 aLevel, s32 aArea, s32 aAct); +/* |description|Restarts the current level|descriptionEnd| */ bool warp_restart_level(void); +/* |description|Warps to the start level (Castle Grounds by default)|descriptionEnd| */ bool warp_to_start_level(void); +/* |description|Exits the current level after `aDelay`|descriptionEnd| */ bool warp_exit_level(s32 aDelay); +/* |description|Warps back to the castle from `aLevel`|descriptionEnd| */ bool warp_to_castle(s32 aLevel); #endif diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h index 3d02c1173..c9535fcb3 100644 --- a/src/pc/lua/utils/smlua_misc_utils.h +++ b/src/pc/lua/utils/smlua_misc_utils.h @@ -42,9 +42,9 @@ struct DateTime { /* |description|Gets the current area's networked timer|descriptionEnd| */ u32 get_network_area_timer(void); -/* |description|Returns a temporary 32-bit integer pointer|descriptionEnd| */ +/* |description|Returns a temporary signed 32-bit integer pointer with its value set to `initialValue`|descriptionEnd| */ s32* get_temp_s32_pointer(s32 initialValue); -/* |description|Gets the 32-bit integer value from the pointer|descriptionEnd| */ +/* |description|Gets the signed 32-bit integer value from `pointer`|descriptionEnd| */ s32 deref_s32_pointer(s32* pointer); /* |description|Creates a DJUI popup that is broadcasted to every client|descriptionEnd| */ @@ -117,11 +117,17 @@ bool is_transition_playing(void); /* |description|Allocates an action ID with bitwise flags|descriptionEnd| */ u32 allocate_mario_action(u32 actFlags); -/* |description|Gets the X coordinate of Mario's hand (0-1) or foot (2-3) but it is important to note that the positions are not updated off-screen|descriptionEnd| */ +/* |description| +Gets the X coordinate of Mario's hand (0-1) or foot (2-3) +but it is important to note that the positions are not updated off-screen|descriptionEnd| */ f32 get_hand_foot_pos_x(struct MarioState* m, u8 index); -/* |description|Gets the Y coordinate of Mario's hand (0-1) or foot (2-3) but it is important to note that the positions are not updated off-screen|descriptionEnd| */ +/* |description| +Gets the Y coordinate of Mario's hand (0-1) or foot (2-3) +but It is important to note that the positions are not updated off-screen|descriptionEnd| */ f32 get_hand_foot_pos_y(struct MarioState* m, u8 index); -/* |description|Gets the Z coordinate of Mario's hand (0-1) or foot (2-3) but it is important to note that the positions are not updated off-screen|descriptionEnd| */ +/* |description| +Gets the Z coordinate of Mario's hand (0-1) or foot (2-3) +but it is important to note that the positions are not updated off-screen|descriptionEnd| */ f32 get_hand_foot_pos_z(struct MarioState* m, u8 index); /* |description|Gets the current save file number (1-indexed)|descriptionEnd| */ @@ -167,7 +173,7 @@ s32 get_dialog_response(void); /* |description|Gets the local discord ID if it isn't disabled, otherwise "0" is returned|descriptionEnd| */ const char* get_local_discord_id(void); -/* |description|Gets the CoopNet ID of a player if CoopNet is being used and the player is connected, otherwise "-1" is returned|descriptionEnd| */ +/* |description|Gets the CoopNet ID of a player with `localIndex` if CoopNet is being used and the player is connected, otherwise "-1" is returned|descriptionEnd| */ const char* get_coopnet_id(s8 localIndex); /* |description|Gets the master volume level|descriptionEnd| */ diff --git a/src/pc/lua/utils/smlua_model_utils.h b/src/pc/lua/utils/smlua_model_utils.h index cb6ca1fb3..2e78b1219 100644 --- a/src/pc/lua/utils/smlua_model_utils.h +++ b/src/pc/lua/utils/smlua_model_utils.h @@ -398,6 +398,7 @@ enum ModelExtendedId { void smlua_model_util_clear(void); void smlua_model_util_store_in_slot(u32 slot, const char* name); u16 smlua_model_util_load(enum ModelExtendedId extId); +/* |description|Gets the extended model ID for the `name` of a `GeoLayout`|descriptionEnd| */ enum ModelExtendedId smlua_model_util_get_id(const char* name); #endif diff --git a/src/pc/lua/utils/smlua_obj_utils.h b/src/pc/lua/utils/smlua_obj_utils.h index e90fac0eb..a36ed4d9b 100644 --- a/src/pc/lua/utils/smlua_obj_utils.h +++ b/src/pc/lua/utils/smlua_obj_utils.h @@ -5,72 +5,131 @@ #include "smlua_model_utils.h" #include "game/object_list_processor.h" +/* |description| +Spawns a synchronized object in at `x`, `y`, and `z` as a child object of the local Mario with his rotation. +You can change the fields of the object in `objSetupFunction` +|descriptionEnd| */ struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction); +/* |description| +Spawns a synchronized object in at `x`, `y`, and `z` as a child object of the local Mario with his rotation. +You can change the fields of the object in `objSetupFunction` +|descriptionEnd| */ struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction); +/* |description|Checks if an object has `behaviorId`|descriptionEnd| */ s32 obj_has_behavior_id(struct Object *o, enum BehaviorId behaviorId); +/* |description|Checks if an object's model is equal to `modelId`|descriptionEnd| */ s32 obj_has_model_extended(struct Object *o, enum ModelExtendedId modelId); +/* |description|Sets an object's model to `modelId`|descriptionEnd| */ void obj_set_model_extended(struct Object *o, enum ModelExtendedId modelId); +/* |description|Gets a trajectory by `name`|descriptionEnd| */ Trajectory* get_trajectory(const char* name); // // Helpers to iterate through the object table // +/* |description|Gets the first object in an object list|descriptionEnd| */ struct Object *obj_get_first(enum ObjectList objList); +/* |description|Gets the first object loaded with `behaviorId`|descriptionEnd| */ struct Object *obj_get_first_with_behavior_id(enum BehaviorId behaviorId); +/* |description| +Gets the first object loaded with `behaviorId` and object signed 32-bit integer field +(look in `object_fields.h` to get the index of a field) +|descriptionEnd| */ struct Object *obj_get_first_with_behavior_id_and_field_s32(enum BehaviorId behaviorId, s32 fieldIndex, s32 value); +/* |description| +Gets the first object loaded with `behaviorId` and object float field +(look in `object_fields.h` to get the index of a field) +|descriptionEnd| */ struct Object *obj_get_first_with_behavior_id_and_field_f32(enum BehaviorId behaviorId, s32 fieldIndex, f32 value); +/* |description|Gets the next object in an object list|descriptionEnd| */ struct Object *obj_get_next(struct Object *o); +/* |description|Gets the next object loaded with the same behavior ID|descriptionEnd| */ struct Object *obj_get_next_with_same_behavior_id(struct Object *o); +/* |description| +Gets the next object loaded with the same behavior ID and object signed 32-bit integer field +(look in `object_fields.h` to get the index of a field) +|descriptionEnd| */ struct Object *obj_get_next_with_same_behavior_id_and_field_s32(struct Object *o, s32 fieldIndex, s32 value); +/* |description| +Gets the next object loaded with the same behavior ID and object float field +(look in `object_fields.h` to get the index of a field) +|descriptionEnd| */ struct Object *obj_get_next_with_same_behavior_id_and_field_f32(struct Object *o, s32 fieldIndex, f32 value); +/* |description|Gets the nearest object with `behaviorId` to `o`|descriptionEnd| */ struct Object *obj_get_nearest_object_with_behavior_id(struct Object *o, enum BehaviorId behaviorId); +/* |description|Counts every object with `behaviorId`|descriptionEnd| */ s32 obj_count_objects_with_behavior_id(enum BehaviorId behaviorId); +/* |description|Gets the corresponding collided object to an index from `o`|descriptionEnd| */ struct Object *obj_get_collided_object(struct Object *o, s16 index); // // Object fields // +/* |description|Gets the unsigned 32-bit integer value from the field corresponding to `fieldIndex`|descriptionEnd| */ u32 obj_get_field_u32(struct Object *o, s32 fieldIndex); +/* |description|Gets the signed 32-bit integer value from the field corresponding to `fieldIndex`|descriptionEnd| */ s32 obj_get_field_s32(struct Object *o, s32 fieldIndex); +/* |description|Sets the float value from the field corresponding to `fieldIndex`|descriptionEnd| */ f32 obj_get_field_f32(struct Object *o, s32 fieldIndex); +/* |description|Gets the signed 32-bit integer value from the sub field corresponding to `fieldSubIndex` from the field corresponding to `fieldIndex`|descriptionEnd| */ s16 obj_get_field_s16(struct Object *o, s32 fieldIndex, s32 fieldSubIndex); +/* |description|Sets the unsigned 32-bit integer value from the field corresponding to `fieldIndex`|descriptionEnd| */ void obj_set_field_u32(struct Object *o, s32 fieldIndex, u32 value); +/* |description|Sets the signed 32-bit integer value from the field corresponding to `fieldIndex`|descriptionEnd| */ void obj_set_field_s32(struct Object *o, s32 fieldIndex, s32 value); +/* |description|Sets the float value from the field corresponding to `fieldIndex`|descriptionEnd| */ void obj_set_field_f32(struct Object *o, s32 fieldIndex, f32 value); +/* |description|Sets the signed 32-bit integer value from the sub field corresponding to `fieldSubIndex` from the field corresponding to `fieldIndex`|descriptionEnd| */ void obj_set_field_s16(struct Object *o, s32 fieldIndex, s32 fieldSubIndex, s16 value); // // Misc object helpers // +/* |description|Returns a temporary particle spawn info pointer with its model loaded in from `modelId`|descriptionEnd| */ struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId); +/* |description|Returns a temporary object hitbox pointer|descriptionEnd| */ struct ObjectHitbox* get_temp_object_hitbox(void); +/* |description|Checks if `o` is attackable|descriptionEnd| */ bool obj_is_attackable(struct Object *o); +/* |description|Checks if `o` is breakable|descriptionEnd| */ bool obj_is_breakable_object(struct Object *o); +/* |description|Checks if `o` is a Bully|descriptionEnd| */ bool obj_is_bully(struct Object *o); +/* |description|Checks if `o` is a coin|descriptionEnd| */ bool obj_is_coin(struct Object *o); +/* |description|Checks if `o` is an exclamation box|descriptionEnd| */ bool obj_is_exclamation_box(struct Object *o); -bool obj_is_grabbable(struct Object *o) ; +/* |description|Checks if `o` is grabbable|descriptionEnd| */ +bool obj_is_grabbable(struct Object *o); +/* |description|Checks if `o` is a 1-Up Mushroom|descriptionEnd| */ bool obj_is_mushroom_1up(struct Object *o); +/* |description|Checks if `o` is a secret|descriptionEnd| */ bool obj_is_secret(struct Object *o); +/* |description|Checks if `o` is activated, tangible, and interactible|descriptionEnd| */ bool obj_is_valid_for_interaction(struct Object *o); +/* |description|Checks if `o1`'s hitbox is colliding with `o2`'s hitbox|descriptionEnd| */ bool obj_check_hitbox_overlap(struct Object *o1, struct Object *o2); +/* |description|Checks if `o`'s hitbox is colliding with the parameters of a hitbox|descriptionEnd| */ bool obj_check_overlap_with_hitbox_params(struct Object *o, f32 x, f32 y, f32 z, f32 h, f32 r, f32 d); +/* |description|Sets an object's velocity to `vx`, `vy`, and `vz`|descriptionEnd| */ void obj_set_vel(struct Object *o, f32 vx, f32 vy, f32 vz); +/* |description|Moves the object in the direction of `dx`, `dy`, and `dz`|descriptionEnd| */ void obj_move_xyz(struct Object *o, f32 dx, f32 dy, f32 dz); +/* |description|Sets the parameters of one of the two whirlpools (0-indexed) in an area|descriptionEnd| */ void set_whirlpools(f32 x, f32 y, f32 z, s16 strength, s16 area, s32 index); #endif diff --git a/src/pc/lua/utils/smlua_text_utils.h b/src/pc/lua/utils/smlua_text_utils.h index 4b325c0b8..dc80a4e4f 100644 --- a/src/pc/lua/utils/smlua_text_utils.h +++ b/src/pc/lua/utils/smlua_text_utils.h @@ -25,19 +25,33 @@ extern struct CourseName *gReplacedActNameTable[]; void smlua_text_utils_init(void); void smlua_text_utils_shutdown(void); void smlua_text_utils_reset_all(void); +/* |description|Replaces `dialogId` with a custom one|descriptionEnd| */ void smlua_text_utils_dialog_replace(enum DialogId dialogId, u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str); +/* |description|Replaces the act names of `courseNum`|descriptionEnd| */ void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName, const char* act1, const char* act2, const char* act3, const char* act4, const char* act5, const char* act6); +/* |description|Replaces the secret star course name of `courseNum` with `courseName`|descriptionEnd| */ void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName); +/* |description|Replaces the name of `courseNum` with `name`|descriptionEnd| */ void smlua_text_utils_course_name_replace(s16 courseNum, const char* name); +/* |description|Gets the name of `courseNum`|descriptionEnd| */ const char* smlua_text_utils_course_name_get(s16 courseNum); +/* |description|Gets the index of the mod that replaced the name of `courseNum`|descriptionEnd| */ s32 smlua_text_utils_course_name_mod_index(s16 courseNum); +/* |description|Resets the name of `courseNum`|descriptionEnd| */ void smlua_text_utils_course_name_reset(s16 courseNum); +/* |description|Replaces the act name of `actNum` in `courseNum` with `name`|descriptionEnd| */ void smlua_text_utils_act_name_replace(s16 courseNum, u8 actNum, const char* name); +/* |description|Gets the act name of `actNum` in `courseNum`|descriptionEnd| */ const char* smlua_text_utils_act_name_get(s16 courseNum, u8 actNum); +/* |description|Gets the index of the mod that replaced the act name of `actNum` in `courseNum`|descriptionEnd| */ s32 smlua_text_utils_act_name_mod_index(s16 courseNum, u8 actNum); +/* |description|Resets the act name of `actNum` in `courseNum`|descriptionEnd| */ void smlua_text_utils_act_name_reset(s16 courseNum, u8 actNum); +/* |description|Replaces the castle secret stars text with `name`|descriptionEnd| */ void smlua_text_utils_castle_secret_stars_replace(const char* name); +/* |description|Replace extra text (e.g. one of the castle's secret stars) with `text`|descriptionEnd| */ void smlua_text_utils_extra_text_replace(s16 index, const char* text); +/* |description|Gets the current language|descriptionEnd| */ const char* smlua_text_utils_get_language(void); #endif