diff --git a/.gitignore b/.gitignore
index c42e9ef03..12e547ad6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@
# Executables
*.exe
+!updater/*/*.exe
*.out
*.app
*.hex
diff --git a/Makefile b/Makefile
index 6a5de2ca8..045a61df2 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,8 @@ ENHANCE_LEVEL_TEXTURES ?= 1
DISCORD_SDK ?= 1
# Enable CoopNet SDK (used for CoopNet server hosting)
COOPNET ?= 1
+# Enable Updater (used for automatic updates)
+UPDATER ?= 1
# Enable docker build workarounds
DOCKERBUILD ?= 0
# Sets your optimization level for building.
@@ -924,6 +926,22 @@ else
endif
endif
+# Updater
+UPDATER_EXEC :=
+ifeq ($(UPDATER),1)
+ ifeq ($(WINDOWS_BUILD),1)
+ UPDATER_EXEC += ./updater/win64/coopdx_updater.exe
+ else ifeq ($(OSX_BUILD),1)
+ ifeq ($(shell uname -m),arm64)
+ UPDATER_EXEC += ./updater/mac_arm/coopdx_updater
+ else
+ UPDATER_EXEC += ./updater/mac_intel/coopdx_updater
+ endif
+ else ifeq ($(TARGET_RPI),0)
+ UPDATER_EXEC += ./updater/linux/coopdx_updater
+ endif
+endif
+
IS_DEV_OR_DEBUG := $(or $(filter 1,$(DEVELOPMENT)),$(filter 1,$(DEBUG)),0)
ifeq ($(IS_DEV_OR_DEBUG),0)
CFLAGS += -fno-ident -fno-common -ffile-prefix-map="$(PWD)"=. -D__DATE__="\"\"" -D__TIME__="\"\"" -Wno-builtin-macro-redefined
@@ -1126,6 +1144,9 @@ $(BUILD_DIR)/$(DISCORD_SDK_LIBS):
$(BUILD_DIR)/$(COOPNET_LIBS):
@$(CP) -f $(COOPNET_LIBS) $(BUILD_DIR)
+$(BUILD_DIR)/$(UPDATER_EXEC):
+ @$(CP) -f $(UPDATER_EXEC) $(BUILD_DIR)
+
$(BUILD_DIR)/$(LANG_DIR):
@$(CP) -f -r $(LANG_DIR) $(BUILD_DIR)
@@ -1474,7 +1495,7 @@ ifeq ($(TARGET_N64),1)
$(BUILD_DIR)/$(TARGET).objdump: $(ELF)
$(OBJDUMP) -D $< > $@
else
- $(EXE): $(O_FILES) $(MIO0_FILES:.mio0=.o) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(BUILD_DIR)/$(RPC_LIBS) $(BUILD_DIR)/$(DISCORD_SDK_LIBS) $(BUILD_DIR)/$(COOPNET_LIBS) $(BUILD_DIR)/$(LANG_DIR) $(BUILD_DIR)/$(MOD_DIR) $(BUILD_DIR)/$(PALETTES_DIR)
+ $(EXE): $(O_FILES) $(MIO0_FILES:.mio0=.o) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(BUILD_DIR)/$(RPC_LIBS) $(BUILD_DIR)/$(DISCORD_SDK_LIBS) $(BUILD_DIR)/$(COOPNET_LIBS) $(BUILD_DIR)/$(UPDATER_EXEC) $(BUILD_DIR)/$(LANG_DIR) $(BUILD_DIR)/$(MOD_DIR) $(BUILD_DIR)/$(PALETTES_DIR)
@$(PRINT) "$(GREEN)Linking executable: $(BLUE)$@ $(NO_COL)\n"
$(V)$(LD) $(PROF_FLAGS) -L $(BUILD_DIR) -o $@ $(O_FILES) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(LDFLAGS)
endif
@@ -1512,6 +1533,7 @@ all:
cp build/us_pc/discord_game_sdk.dylib $(APP_MACOS_DIR); \
cp build/us_pc/libdiscord_game_sdk.dylib $(APP_MACOS_DIR); \
cp build/us_pc/libcoopnet.dylib $(APP_MACOS_DIR); \
+ cp build/us_pc/coopdx_updater $(APP_MACOS_DIR); \
cp build/us_pc/libjuice.1.6.2.dylib $(APP_MACOS_DIR); \
cp $(SDL2_LIB) $(APP_MACOS_DIR)/libSDL2.dylib; \
install_name_tool -change $(BREW_PREFIX)/lib/libSDL2-2.0.0.dylib @executable_path/libSDL2.dylib $(APP_MACOS_DIR)/sm64coopdx > /dev/null 2>&1; \
diff --git a/actors/power_meter/model.inc.c b/actors/power_meter/model.inc.c
index ca1aff748..edb9bcd51 100644
--- a/actors/power_meter/model.inc.c
+++ b/actors/power_meter/model.inc.c
@@ -56,7 +56,7 @@ const Gfx dl_power_meter_base[] = {
gsDPSetRenderMode(G_RM_TEX_EDGE, G_RM_TEX_EDGE2),
gsDPSetTextureFilter(G_TF_POINT),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
- gsSPVertex(vertex_power_meter_base, 8, 0),
+ gsSPVertexNonGlobal(vertex_power_meter_base, 8, 0),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 6, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
@@ -78,7 +78,7 @@ ROM_ASSET_LOAD_VTX(vertex_power_meter_health_segments, 0x00201410, 96653, 0x0002
// 0x03029570 - 0x030295A0
const Gfx dl_power_meter_health_segments_begin[] = {
gsDPPipeSync(),
- gsSPVertex(vertex_power_meter_health_segments, 4, 0),
+ gsSPVertexNonGlobal(vertex_power_meter_health_segments, 4, 0),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
diff --git a/actors/sparkle_animation/model.inc.c b/actors/sparkle_animation/model.inc.c
index b0384cc37..7f62e7be9 100644
--- a/actors/sparkle_animation/model.inc.c
+++ b/actors/sparkle_animation/model.inc.c
@@ -22,18 +22,20 @@ ROM_ASSET_LOAD_TEXTURE(sparkles_animation_seg4_texture_04034A88, "actors/sparkle
// 0x04035288 - 0x04035300
const Gfx sparkles_animation_seg4_dl_04035288[] = {
gsSPClearGeometryMode(G_LIGHTING),
- gsDPSetCombineMode(G_CC_MODULATEIA, G_CC_MODULATEIA),
+ gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA),
+ gsDPSetEnvColor(255, 255, 100, 255),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
- gsSPVertexNonGlobal(sparkles_animation_seg4_vertex_04032A48, 4, 0),
+ gsSPVertex(sparkles_animation_seg4_vertex_04032A48, 4, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsSPSetGeometryMode(G_LIGHTING),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
+ gsDPSetEnvColor(255, 255, 255, 255),
gsSPEndDisplayList(),
};
diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py
index 9dcbf602e..7cb49e24c 100644
--- a/autogen/convert_constants.py
+++ b/autogen/convert_constants.py
@@ -55,6 +55,7 @@ in_files = [
"src/engine/lighting_engine.h",
"include/PR/gbi.h",
"include/PR/gbi_extension.h",
+ "src/pc/gfx/gfx_pc.h",
"src/engine/surface_load.h",
"src/pc/lua/utils/smlua_audio_utils.h",
]
diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py
index de69ffe36..3fbf280e8 100644
--- a/autogen/convert_functions.py
+++ b/autogen/convert_functions.py
@@ -145,7 +145,7 @@ override_disallowed_functions = {
"src/engine/behavior_script.h": [ "stub_behavior_script_2", "cur_obj_update" ],
"src/pc/mods/mod_storage.h": [ "mod_storage_shutdown" ],
"src/pc/mods/mod_fs.h": [ "mod_fs_read_file_from_uri", "mod_fs_shutdown" ],
- "src/pc/utils/misc.h": [ "str_.*", "file_get_line", "delta_interpolate_(normal|rgba|mtx)", "detect_and_skip_mtx_interpolation", "precise_delay_f64" ],
+ "src/pc/utils/misc.h": [ "str_.*", "file_get_line", "delta_interpolate_(normal|rgba|mtx)", "detect_and_skip_mtx_interpolation", "precise_delay_f64", "can_update_game", "update_game" ],
"src/engine/lighting_engine.h": [ "le_calculate_vertex_lighting", "le_clear", "le_shutdown" ],
}
@@ -1079,7 +1079,7 @@ def build_function(function, do_extern):
else:
global total_functions
total_functions += 1
- if function['description'] != "":
+ if function['description'][0] != "":
global total_doc_functions
total_doc_functions += 1
elif verbose:
@@ -1215,7 +1215,7 @@ def process_functions(fname, file_str, extracted_descriptions):
rejects += line + '\n'
continue
line = line.strip()
- description = extracted_descriptions.get(line, "")
+ description = extracted_descriptions.get(line, [""])
fn = process_function(fname, line, description)
if fn == None:
continue
@@ -1357,14 +1357,15 @@ def doc_function(fname, function):
fid = function['identifier']
s = '\n## [%s](#%s)\n' % (fid, fid)
- description = function.get('description', "")
+ description = function.get('description', [""])
rtype, rlink = translate_type_to_lua(function['type'])
param_str = ', '.join([x['identifier'] for x in function['params'] if 'RET' not in x])
- if description != "":
+ if description[0] != "":
s += '\n### Description\n'
- s += f'{description}\n'
+ for line in description:
+ s += f'{line}\n'
s += "\n### Lua Example\n"
rvalues = []
@@ -1513,7 +1514,7 @@ def def_function(fname, function):
rid = param['identifier']
rtypes.append((rtype, rid))
- if function['description'].startswith("[DEPRECATED"):
+ if function['description'][0].startswith("[DEPRECATED"):
s += "--- @deprecated\n"
for param in fparams:
@@ -1535,8 +1536,9 @@ def def_function(fname, function):
if rtype != "nil":
s += ('--- @return %s' % rtype) + (' %s' % rid if rid else '') + '\n'
- if function['description'] != "":
- s += "--- %s\n" % (function['description'])
+ if function['description'][0] != "":
+ for n, line in enumerate(function['description']):
+ s += "--- %s%s\n" % (line, "
" if n != len(function['description']) - 1 else "")
s += "function %s(%s)\n -- ...\nend\n\n" % (fid, param_str)
return s
diff --git a/autogen/extract_functions.py b/autogen/extract_functions.py
index a73db339d..b69d7619d 100644
--- a/autogen/extract_functions.py
+++ b/autogen/extract_functions.py
@@ -144,12 +144,13 @@ def extract_functions(filename):
description_lines.insert(0, raw_lines[k].strip())
if found_description_start and description_lines:
- # Combine all lines, remove trailing |descriptionEnd| and normalize whitespace
- combined_description = ' '.join(description_lines)
- combined_description = re.sub(r'\|\s*descriptionEnd\s*\|.*', '', combined_description).strip()
- # Normalize whitespace
- combined_description = re.sub(r'\s+', ' ', combined_description).strip()
- descriptions[re.sub(r'\)\s*\{', ');', line)] = combined_description
+ # Remove trailing |descriptionEnd|
+ if description_lines[0] == '': description_lines.pop(0)
+ description_lines[-1] = re.sub(r'\|\s*descriptionEnd\s*\|.*', '', description_lines[-1]).strip()
+ if description_lines[-1] == '': description_lines.pop(-1)
+
+ if len(description_lines) > 0:
+ descriptions[re.sub(r'\)\s*\{', ');', line)] = description_lines
break
# normalize function ending
diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua
index d5b69382e..454a3daaf 100644
--- a/autogen/lua_definitions/constants.lua
+++ b/autogen/lua_definitions/constants.lua
@@ -3070,6 +3070,27 @@ BACKGROUND_CUSTOM = 10 --- @type SkyBackgroundParams
--- | `BACKGROUND_PURPLE_SKY`
--- | `BACKGROUND_CUSTOM`
+SHADER_FLAG_HUE = 0 --- @type ShaderFlag
+SHADER_FLAG_SATURATION = 1 --- @type ShaderFlag
+SHADER_FLAG_BRIGHTNESS = 2 --- @type ShaderFlag
+SHADER_FLAG_CONTRAST = 3 --- @type ShaderFlag
+SHADER_FLAG_EXPOSURE = 4 --- @type ShaderFlag
+SHADER_FLAG_DITHERING = 5 --- @type ShaderFlag
+SHADER_FLAG_POSTERIZATION = 6 --- @type ShaderFlag
+SHADER_FLAG_SCANLINES = 7 --- @type ShaderFlag
+SHADER_FLAG_MAX = 8 --- @type ShaderFlag
+
+--- @alias ShaderFlag
+--- | `SHADER_FLAG_HUE`
+--- | `SHADER_FLAG_SATURATION`
+--- | `SHADER_FLAG_BRIGHTNESS`
+--- | `SHADER_FLAG_CONTRAST`
+--- | `SHADER_FLAG_EXPOSURE`
+--- | `SHADER_FLAG_DITHERING`
+--- | `SHADER_FLAG_POSTERIZATION`
+--- | `SHADER_FLAG_SCANLINES`
+--- | `SHADER_FLAG_MAX`
+
--- @type integer
GRAPH_RENDER_ACTIVE = (1 << 0)
diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index f5063a9ae..79125de9b 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -9,7 +9,8 @@ end
--- @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
@@ -22,7 +23,8 @@ 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
@@ -1071,7 +1073,8 @@ function bhv_tox_box_loop()
end
--- @return integer
---- Checks if Mario is moving fast enough to make Piranha Plant bite. This one is a mouthful
+--- Checks if Mario is moving fast enough to make Piranha Plant bite.
+--- This one is a mouthful
function mario_moving_fast_enough_to_make_piranha_plant_bite()
-- ...
end
@@ -2994,6 +2997,12 @@ function position_based_random_float_position()
-- ...
end
+--- @return boolean
+--- Checks if the draw distance scalar is infinite
+function draw_distance_scalar_is_infinite()
+ -- ...
+end
+
--- @return number
--- Gets the draw distance scalar
function draw_distance_scalar()
@@ -3035,19 +3044,22 @@ function get_id_from_behavior_name(name)
-- ...
end
---- Skips camera interpolation for a frame, locking the camera instantly to the target position. Useful for immediate changes in camera state or position without smooth transitions
+--- Skips camera interpolation for a frame, locking the camera instantly to the target position.
+--- Useful for immediate changes in camera state or position without smooth transitions
function skip_camera_interpolation()
-- ...
end
--- @param shake integer
---- Applies a shake effect to the camera based on a hit type. Different shake types simulate various impacts, such as attacks, falls, or shocks
+--- Applies a shake effect to the camera based on a hit type.
+--- Different shake types simulate various impacts, such as attacks, falls, or shocks
function set_camera_shake_from_hit(shake)
-- ...
end
--- @param shake integer
---- Applies an environmental shake effect to the camera. Handles predefined shake types triggered by environmental events like explosions or platform movements
+--- Applies an environmental shake effect to the camera.
+--- Handles predefined shake types triggered by environmental events like explosions or platform movements
function set_environmental_camera_shake(shake)
-- ...
end
@@ -3056,20 +3068,23 @@ end
--- @param posX number
--- @param posY number
--- @param posZ number
---- Applies a shake effect to the camera, scaled by its proximity to a specified point. The intensity decreases with distance from the point
+--- Applies a shake effect to the camera, scaled by its proximity to a specified point.
+--- The intensity decreases with distance from the point
function set_camera_shake_from_point(shake, posX, posY, posZ)
-- ...
end
--- @param c Camera
---- Moves Mario's head slightly upward when the C-Up button is pressed. This function aligns the camera to match the head movement for consistency
+--- Moves Mario's head slightly upward when the C-Up button is pressed.
+--- This function aligns the camera to match the head movement for consistency
function move_mario_head_c_up(c)
-- ...
end
--- @param c Camera
--- @param frames integer
---- Transitions the camera to the next state over a specified number of frames. This is typically used for cutscenes or scripted sequences
+--- Transitions the camera to the next state over a specified number of frames.
+--- This is typically used for cutscenes or scripted sequences
function transition_next_state(c, frames)
-- ...
end
@@ -3077,38 +3092,44 @@ end
--- @param c Camera
--- @param mode integer
--- @param frames integer
---- Changes the camera to a new mode, optionally interpolating over a specified number of frames. Useful for transitioning between different camera behaviors dynamically
+--- Changes the camera to a new mode, optionally interpolating over a specified number of frames.
+--- Useful for transitioning between different camera behaviors dynamically
function set_camera_mode(c, mode, frames)
-- ...
end
--- @param c Camera
---- Resets the camera's state while retaining some settings, such as position or mode. This is often used when soft-resetting gameplay without reinitialization
+--- Resets the camera's state while retaining some settings, such as position or mode.
+--- This is often used when soft-resetting gameplay without reinitialization
function soft_reset_camera(c)
-- ...
end
--- @param c Camera
---- Fully resets the camera to its default state and reinitializes all settings. This is typically used when restarting gameplay or loading a new area
+--- Fully resets the camera to its default state and reinitializes all settings.
+--- This is typically used when restarting gameplay or loading a new area
function reset_camera(c)
-- ...
end
---- Selects the appropriate camera mode for Mario based on the current gameplay context. Adapts camera behavior dynamically to match Mario's environment or state
+--- Selects the appropriate camera mode for Mario based on the current gameplay context.
+--- Adapts camera behavior dynamically to match Mario's environment or state
function select_mario_cam_mode()
-- ...
end
--- @param dst Vec3f
--- @param o Object
---- Converts an object's position to a `Vec3f` format. Useful for aligning object behaviors or interactions with the camera system
+--- Converts an object's position to a `Vec3f` format.
+--- Useful for aligning object behaviors or interactions with the camera system
function object_pos_to_vec3f(dst, o)
-- ...
end
--- @param o Object
--- @param src Vec3f
---- Converts a `Vec3f` position to an object's internal format. Useful for syncing 3D positions between objects and the game world
+--- Converts a `Vec3f` position to an object's internal format.
+--- Useful for syncing 3D positions between objects and the game world
function vec3f_to_object_pos(o, src)
-- ...
end
@@ -3143,27 +3164,31 @@ end
--- @param angle integer
--- @return integer
---- Selects an alternate camera mode based on the given angle. Used to toggle between predefined camera modes dynamically
+--- Selects an alternate camera mode based on the given angle.
+--- Used to toggle between predefined camera modes dynamically
function cam_select_alt_mode(angle)
-- ...
end
--- @param mode integer
--- @return integer
---- Sets the camera's angle based on the specified mode. Handles rotation and focus adjustments for predefined camera behaviors
+--- Sets the camera's angle based on the specified mode.
+--- Handles rotation and focus adjustments for predefined camera behaviors
function set_cam_angle(mode)
-- ...
end
--- @param mode integer
---- Applies a handheld camera shake effect with configurable parameters. Can be used to simulate dynamic, realistic camera movement
+--- Applies a handheld camera shake effect with configurable parameters.
+--- Can be used to simulate dynamic, realistic camera movement
function set_handheld_shake(mode)
-- ...
end
--- @param pos Vec3f
--- @param focus Vec3f
---- Activates a handheld camera shake effect. Calculates positional and focus adjustments to simulate manual movement
+--- Activates a handheld camera shake effect.
+--- Calculates positional and focus adjustments to simulate manual movement
function shake_camera_handheld(pos, focus)
-- ...
end
@@ -3172,7 +3197,8 @@ end
--- @param buttonsPressed integer
--- @param buttonsDown integer
--- @return integer
---- Determines which C-buttons are currently pressed by the player. Returns a bitmask indicating the active buttons for camera control
+--- Determines which C-buttons are currently pressed by the player.
+--- Returns a bitmask indicating the active buttons for camera control
function find_c_buttons_pressed(currentState, buttonsPressed, buttonsDown)
-- ...
end
@@ -3181,7 +3207,8 @@ end
--- @param offsetY number
--- @param radius number
--- @return integer
---- Checks for collisions between the camera and level geometry. Adjusts the camera's position to avoid clipping into walls or obstacles
+--- Checks for collisions between the camera and level geometry.
+--- Adjusts the camera's position to avoid clipping into walls or obstacles
function collide_with_walls(pos, offsetY, radius)
-- ...
end
@@ -3191,7 +3218,8 @@ end
--- @param maxPitch integer
--- @param minPitch integer
--- @return integer
---- Clamps the camera's pitch angle between a maximum and minimum value. Prevents over-rotation and maintains a consistent viewing angle
+--- Clamps the camera's pitch angle between a maximum and minimum value.
+--- Prevents over-rotation and maintains a consistent viewing angle
function clamp_pitch(from, to, maxPitch, minPitch)
-- ...
end
@@ -3200,7 +3228,8 @@ end
--- @param posY number
--- @param posZ number
--- @return integer
---- Checks if a position is within 100 units of Mario's current position. Returns true if the position is within the specified radius and false otherwise
+--- Checks if a position is within 100 units of Mario's current position.
+--- Returns true if the position is within the specified radius and false otherwise
function is_within_100_units_of_mario(posX, posY, posZ)
-- ...
end
@@ -3210,7 +3239,9 @@ end
--- @param scale number
--- @return integer
--- @return number dst
---- Smoothly transitions or directly sets a floating-point value (`dst`) to approach a target (`goal`). Uses asymptotic scaling for gradual adjustments or direct assignment. Returns FALSE if `dst` reaches `goal`
+--- Smoothly transitions or directly sets a floating-point value (`dst`) to approach a target (`goal`).
+--- Uses asymptotic scaling for gradual adjustments or direct assignment.
+--- Returns FALSE if `dst` reaches `goal`
function set_or_approach_f32_asymptotic(dst, goal, scale)
-- ...
end
@@ -3220,7 +3251,8 @@ end
--- @param multiplier number
--- @return integer
--- @return number current
---- Gradually adjusts a floating-point value (`current`) towards a target (`target`) using asymptotic smoothing. Returns FALSE if `current` reaches the `target`
+--- Gradually adjusts a floating-point value (`current`) towards a target (`target`) using asymptotic smoothing.
+--- Returns FALSE if `current` reaches the `target`
function approach_f32_asymptotic_bool(current, target, multiplier)
-- ...
end
@@ -3229,7 +3261,9 @@ end
--- @param target number
--- @param multiplier number
--- @return number
---- Gradually approaches a floating-point value (`target`) using asymptotic smoothing. The rate of approach is controlled by the `multiplier`. Useful for smoothly adjusting camera parameters like field-of-view or position
+--- Gradually approaches a floating-point value (`target`) using asymptotic smoothing.
+--- The rate of approach is controlled by the `multiplier`.
+--- Useful for smoothly adjusting camera parameters like field-of-view or position
function approach_f32_asymptotic(current, target, multiplier)
-- ...
end
@@ -3239,7 +3273,8 @@ end
--- @param divisor integer
--- @return integer
--- @return integer current
---- Gradually adjusts a signed 16-bit integer (`current`) towards a target (`target`) using asymptotic smoothing. Returns FALSE if `current` reaches `target`
+--- Gradually adjusts a signed 16-bit integer (`current`) towards a target (`target`) using asymptotic smoothing.
+--- Returns FALSE if `current` reaches `target`
function approach_s16_asymptotic_bool(current, target, divisor)
-- ...
end
@@ -3248,7 +3283,9 @@ end
--- @param target integer
--- @param divisor integer
--- @return integer
---- Gradually approaches a signed 16-bit integer (`target`) using asymptotic smoothing. The divisor controls the rate of the adjustment. Useful for adjusting angles or positions smoothly
+--- Gradually approaches a signed 16-bit integer (`target`) using asymptotic smoothing.
+--- The divisor controls the rate of the adjustment.
+--- Useful for adjusting angles or positions smoothly
function approach_s16_asymptotic(current, target, divisor)
-- ...
end
@@ -3258,7 +3295,8 @@ end
--- @param xMul number
--- @param yMul number
--- @param zMul number
---- Smoothly transitions a 3D vector (`current`) towards a target vector (`target`) using asymptotic scaling. Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
+--- Smoothly transitions a 3D vector (`current`) towards a target vector (`target`) using asymptotic scaling.
+--- Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
function approach_vec3f_asymptotic(current, target, xMul, yMul, zMul)
-- ...
end
@@ -3268,7 +3306,8 @@ end
--- @param xMul number
--- @param yMul number
--- @param zMul number
---- Smoothly transitions a 3D vector (`current`) toward a target vector (`goal`) using asymptotic scaling. Allows gradual or instantaneous alignment of 3D positions. Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
+--- Smoothly transitions a 3D vector (`current`) toward a target vector (`goal`) using asymptotic scaling.
+--- Allows gradual or instantaneous alignment of 3D positions. Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
function set_or_approach_vec3f_asymptotic(dst, goal, xMul, yMul, zMul)
-- ...
end
@@ -3278,7 +3317,8 @@ end
--- @param increment integer
--- @return integer
--- @return integer current
---- Adjusts a signed 16-bit integer (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`). Returns FALSE if `current` reaches the `target`
+--- Adjusts a signed 16-bit integer (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`).
+--- Returns FALSE if `current` reaches the `target`
function camera_approach_s16_symmetric_bool(current, target, increment)
-- ...
end
@@ -3288,7 +3328,9 @@ end
--- @param increment integer
--- @return integer
--- @return integer current
---- Smoothly transitions or directly sets a signed 16-bit value (`current`) to approach a target (`target`). Uses symmetric scaling for gradual or immediate adjustments. Returns FALSE if `current` reaches the `target`
+--- Smoothly transitions or directly sets a signed 16-bit value (`current`) to approach a target (`target`).
+--- Uses symmetric scaling for gradual or immediate adjustments.
+--- Returns FALSE if `current` reaches the `target`
function set_or_approach_s16_symmetric(current, target, increment)
-- ...
end
@@ -3298,7 +3340,8 @@ end
--- @param increment number
--- @return integer
--- @return number current
---- Adjusts a floating-point value (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`). Returns FALSE if `current` reaches the `target`
+--- Adjusts a floating-point value (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`).
+--- Returns FALSE if `current` reaches the `target`
function camera_approach_f32_symmetric_bool(current, target, increment)
-- ...
end
@@ -3307,7 +3350,8 @@ end
--- @param target number
--- @param increment number
--- @return number
---- Symmetrically approaches a floating-point value (`target`) with a fixed increment (`increment`) per frame. Limits the rate of change to ensure gradual transitions
+--- Symmetrically approaches a floating-point value (`target`) with a fixed increment (`increment`) per frame.
+--- Limits the rate of change to ensure gradual transitions
function camera_approach_f32_symmetric(value, target, increment)
-- ...
end
@@ -3316,7 +3360,8 @@ end
--- @param xRange integer
--- @param yRange integer
--- @param zRange integer
---- Generates a random 3D vector with short integer components. Useful for randomized offsets or environmental effects
+--- Generates a random 3D vector with short integer components.
+--- Useful for randomized offsets or environmental effects
function random_vec3s(dst, xRange, yRange, zRange)
-- ...
end
@@ -3328,7 +3373,8 @@ end
--- @param zMax number
--- @param zMin number
--- @return integer
---- Clamps a position within specified X and Z bounds and calculates the yaw angle from the origin. Prevents the camera from moving outside of the designated area
+--- Clamps a position within specified X and Z bounds and calculates the yaw angle from the origin.
+--- Prevents the camera from moving outside of the designated area
function clamp_positions_and_find_yaw(pos, origin, xMax, xMin, zMax, zMin)
-- ...
end
@@ -3339,7 +3385,8 @@ end
--- @param range integer
--- @param surfType integer
--- @return integer
---- Determines if a range is obstructed by a surface relative to the camera. Returns true if the range is behind the specified surface
+--- Determines if a range is obstructed by a surface relative to the camera.
+--- Returns true if the range is behind the specified surface
function is_range_behind_surface(from, to, surf, range, surfType)
-- ...
end
@@ -3348,7 +3395,9 @@ end
--- @param from Vec3f
--- @param to Vec3f
--- @param scale number
---- Scales a point along a line between two 3D points (`from` and `to`). The scaling factor determines how far along the line the resulting point will be. The result is stored in the destination vector (`dest`)
+--- Scales a point along a line between two 3D points (`from` and `to`).
+--- The scaling factor determines how far along the line the resulting point will be.
+--- The result is stored in the destination vector (`dest`)
function scale_along_line(dest, from, to, scale)
-- ...
end
@@ -3356,7 +3405,8 @@ end
--- @param from Vec3f
--- @param to Vec3f
--- @return integer
---- Calculates the pitch angle (rotation around the X-axis) from one 3D point (`from`) to another (`to`). Returns the pitch as a signed 16-bit integer
+--- Calculates the pitch angle (rotation around the X-axis) from one 3D point (`from`) to another (`to`).
+--- Returns the pitch as a signed 16-bit integer
function calculate_pitch(from, to)
-- ...
end
@@ -3364,7 +3414,8 @@ end
--- @param from Vec3f
--- @param to Vec3f
--- @return integer
---- Determines the yaw angle (rotation around the Y-axis) from one 3D position (`from`) to another (`to`). Returns the yaw as a signed 16-bit integer
+--- Determines the yaw angle (rotation around the Y-axis) from one 3D position (`from`) to another (`to`).
+--- Returns the yaw as a signed 16-bit integer
function calculate_yaw(from, to)
-- ...
end
@@ -3381,7 +3432,9 @@ end
--- @param a Vec3f
--- @param b Vec3f
--- @return number
---- Calculates the absolute distance between two 3D points (`a` and `b`). Returns the distance as a floating-point value. Useful for determining proximity between objects in 3D space
+--- Calculates the absolute distance between two 3D points (`a` and `b`).
+--- Returns the distance as a floating-point value.
+--- Useful for determining proximity between objects in 3D space
function calc_abs_dist(a, b)
-- ...
end
@@ -3389,7 +3442,9 @@ end
--- @param a Vec3f
--- @param b Vec3f
--- @return number
---- Calculates the horizontal (XZ-plane) distance between two 3D points (`a` and `b`). Returns the distance as a floating-point value. Useful for terrain navigation or collision detection
+--- Calculates the horizontal (XZ-plane) distance between two 3D points (`a` and `b`).
+--- Returns the distance as a floating-point value.
+--- Useful for terrain navigation or collision detection
function calc_hor_dist(a, b)
-- ...
end
@@ -3397,7 +3452,9 @@ end
--- @param dst Vec3f
--- @param src Vec3f
--- @param yaw integer
---- Rotates a vector around the XZ-plane by a specified yaw angle. The result is stored in the destination vector (`dst`). Useful for rotating camera positions or object coordinates horizontally
+--- Rotates a vector around the XZ-plane by a specified yaw angle.
+--- The result is stored in the destination vector (`dst`).
+--- Useful for rotating camera positions or object coordinates horizontally
function rotate_in_xz(dst, src, yaw)
-- ...
end
@@ -3405,7 +3462,9 @@ end
--- @param dst Vec3f
--- @param src Vec3f
--- @param pitch integer
---- Rotates a vector around the YZ-plane by a specified pitch angle. The result is stored in the destination vector (`dst`). Useful for vertical camera rotations or object transformations
+--- Rotates a vector around the YZ-plane by a specified pitch angle.
+--- The result is stored in the destination vector (`dst`).
+--- Useful for vertical camera rotations or object transformations
function rotate_in_yz(dst, src, pitch)
-- ...
end
@@ -3413,7 +3472,9 @@ end
--- @param mag integer
--- @param decay integer
--- @param inc integer
---- Applies a pitch-based shake effect to the camera. The shake's magnitude, decay, and increment are configurable. Simulates vertical disturbances like impacts or explosions
+--- Applies a pitch-based shake effect to the camera.
+--- The shake's magnitude, decay, and increment are configurable.
+--- Simulates vertical disturbances like impacts or explosions
function set_camera_pitch_shake(mag, decay, inc)
-- ...
end
@@ -3421,7 +3482,8 @@ end
--- @param mag integer
--- @param decay integer
--- @param inc integer
---- Applies a yaw-based shake effect to the camera. Simulates horizontal vibrations or rotational impacts
+--- Applies a yaw-based shake effect to the camera.
+--- Simulates horizontal vibrations or rotational impacts
function set_camera_yaw_shake(mag, decay, inc)
-- ...
end
@@ -3429,7 +3491,8 @@ end
--- @param mag integer
--- @param decay integer
--- @param inc integer
---- Applies a roll-based shake effect to the camera. Simulates rotational disturbances for dynamic camera effects
+--- Applies a roll-based shake effect to the camera.
+--- Simulates rotational disturbances for dynamic camera effects
function set_camera_roll_shake(mag, decay, inc)
-- ...
end
@@ -3441,28 +3504,32 @@ end
--- @param posX number
--- @param posY number
--- @param posZ number
---- Applies a pitch shake effect to the camera, scaled by proximity to a specified point. Simulates vibrations with intensity decreasing further from the point
+--- Applies a pitch shake effect to the camera, scaled by proximity to a specified point.
+--- Simulates vibrations with intensity decreasing further from the point
function set_pitch_shake_from_point(mag, decay, inc, maxDist, posX, posY, posZ)
-- ...
end
--- @param pos Vec3f
--- @param focus Vec3f
---- Activates a pitch-based shake effect. Adds vertical vibrational movement to the camera's behavior
+--- Activates a pitch-based shake effect.
+--- Adds vertical vibrational movement to the camera's behavior
function shake_camera_pitch(pos, focus)
-- ...
end
--- @param pos Vec3f
--- @param focus Vec3f
---- Activates a yaw-based shake effect. Adds horizontal vibrational movement to the camera's behavior
+--- Activates a yaw-based shake effect.
+--- Adds horizontal vibrational movement to the camera's behavior
function shake_camera_yaw(pos, focus)
-- ...
end
--- @param roll integer
--- @return integer roll
---- Applies a roll-based shake effect to the camera. Simulates rotational disturbances caused by impacts or other events
+--- Applies a roll-based shake effect to the camera.
+--- Simulates rotational disturbances caused by impacts or other events
function shake_camera_roll(roll)
-- ...
end
@@ -3470,52 +3537,62 @@ end
--- @param c Camera
--- @param areaYaw integer
--- @return integer
---- Calculates an outward radial offset based on the camera's yaw angle. Returns the offset yaw, used for positioning or alignment
+--- Calculates an outward radial offset based on the camera's yaw angle.
+--- Returns the offset yaw, used for positioning or alignment
function offset_yaw_outward_radial(c, areaYaw)
-- ...
end
---- Plays a buzzing sound effect when the camera attempts to move downward but is restricted. Provides feedback for invalid C-Down input actions
+--- Plays a buzzing sound effect when the camera attempts to move downward but is restricted.
+--- Provides feedback for invalid C-Down input actions
function play_camera_buzz_if_cdown()
-- ...
end
---- Plays a buzzing sound effect when a blocked C-button action is attempted. Used to signal invalid input or restricted camera movement
+--- Plays a buzzing sound effect when a blocked C-button action is attempted.
+--- Used to signal invalid input or restricted camera movement
function play_camera_buzz_if_cbutton()
-- ...
end
---- Plays a buzzing sound effect when the camera's position is misaligned with the player's perspective. Used as audio feedback for incorrect camera behavior
+--- Plays a buzzing sound effect when the camera's position is misaligned with the player's perspective.
+--- Used as audio feedback for incorrect camera behavior
function play_camera_buzz_if_c_sideways()
-- ...
end
---- Plays a sound effect when the C-Up button is pressed for camera movement. Provides feedback for vertical camera adjustments
+--- Plays a sound effect when the C-Up button is pressed for camera movement.
+--- Provides feedback for vertical camera adjustments
function play_sound_cbutton_up()
-- ...
end
---- Plays a sound effect when the C-Down button is pressed for camera movement. Provides auditory feedback for valid camera input
+--- Plays a sound effect when the C-Down button is pressed for camera movement.
+--- Provides auditory feedback for valid camera input
function play_sound_cbutton_down()
-- ...
end
---- Plays a sound effect when the C-Side button (left or right) is pressed for camera movement. Used as audio feedback for horizontal adjustments to the camera
+--- Plays a sound effect when the C-Side button (left or right) is pressed for camera movement.
+--- Used as audio feedback for horizontal adjustments to the camera
function play_sound_cbutton_side()
-- ...
end
---- Plays a sound effect when a blocked action changes the camera mode. This provides feedback for invalid attempts to switch the camera state
+--- Plays a sound effect when a blocked action changes the camera mode.
+--- This provides feedback for invalid attempts to switch the camera state
function play_sound_button_change_blocked()
-- ...
end
---- Plays a sound effect when the R-Button camera mode is changed. Provides feedback for toggling camera behaviors
+--- Plays a sound effect when the R-Button camera mode is changed.
+--- Provides feedback for toggling camera behaviors
function play_sound_rbutton_changed()
-- ...
end
---- Plays a sound effect when the camera switches between Lakitu and Mario perspectives. Signals a successful change in camera mode
+--- Plays a sound effect when the camera switches between Lakitu and Mario perspectives.
+--- Signals a successful change in camera mode
function play_sound_if_cam_switched_to_lakitu_or_mario()
-- ...
end
@@ -3523,34 +3600,39 @@ end
--- @param c Camera
--- @param unused number
--- @return integer
---- Handles radial camera movement based on player input. Updates the camera's position or orientation accordingly
+--- Handles radial camera movement based on player input.
+--- Updates the camera's position or orientation accordingly
function radial_camera_input(c, unused)
-- ...
end
--- @param trigger integer
--- @return integer
---- Triggers a dialog sequence during a cutscene. The dialog is synchronized with the camera's position and movement
+--- Triggers a dialog sequence during a cutscene.
+--- The dialog is synchronized with the camera's position and movement
function trigger_cutscene_dialog(trigger)
-- ...
end
--- @param c Camera
---- Handles camera movement based on input from the C-buttons. Updates the camera's position or angle to match directional player input
+--- Handles camera movement based on input from the C-buttons.
+--- Updates the camera's position or angle to match directional player input
function handle_c_button_movement(c)
-- ...
end
--- @param c Camera
--- @param cutscene integer
---- Starts a cutscene based on the provided ID. The camera transitions to predefined behaviors for the duration of the cutscene
+--- Starts a cutscene based on the provided ID.
+--- The camera transitions to predefined behaviors for the duration of the cutscene
function start_cutscene(c, cutscene)
-- ...
end
--- @param c Camera
--- @return integer
---- Gets the appropriate cutscene to play based on Mario's current gameplay state. This function helps determine transitions for cinematic or scripted sequences
+--- Gets the appropriate cutscene to play based on Mario's current gameplay state.
+--- This function helps determine transitions for cinematic or scripted sequences
function get_cutscene_from_mario_status(c)
-- ...
end
@@ -3558,7 +3640,8 @@ end
--- @param displacementX number
--- @param displacementY number
--- @param displacementZ number
---- Moves the camera to a specified warp destination. This function handles transitions between levels or areas seamlessly
+--- Moves the camera to a specified warp destination.
+--- This function handles transitions between levels or areas seamlessly
function warp_camera(displacementX, displacementY, displacementZ)
-- ...
end
@@ -3566,7 +3649,8 @@ end
--- @param c Camera
--- @param goal number
--- @param inc number
---- Adjusts the camera's height toward a target value (`goalHeight`) while respecting terrain and obstructions. This is really wonky and probably shouldn't be used, prefer `gLakituStates`
+--- Adjusts the camera's height toward a target value (`goalHeight`) while respecting terrain and obstructions.
+--- This is really wonky and probably shouldn't be used, prefer `gLakituStates`
function approach_camera_height(c, goal, inc)
-- ...
end
@@ -3575,7 +3659,8 @@ end
--- @param from Vec3f
--- @param to Vec3f
--- @param rotation Vec3s
---- Offsets a vector by rotating it in 3D space relative to a reference position. This is useful for creating radial effects or dynamic transformations
+--- Offsets a vector by rotating it in 3D space relative to a reference position.
+--- This is useful for creating radial effects or dynamic transformations
function offset_rotated(dst, from, to, rotation)
-- ...
end
@@ -3588,7 +3673,8 @@ end
--- @param oldFoc Vec3f
--- @param yaw integer
--- @return integer
---- Transitions the camera to the next Lakitu state, updating position and focus. This function handles smooth transitions between different gameplay scenarios
+--- Transitions the camera to the next Lakitu state, updating position and focus.
+--- This function handles smooth transitions between different gameplay scenarios
function next_lakitu_state(newPos, newFoc, curPos, curFoc, oldPos, oldFoc, yaw)
-- ...
end
@@ -3601,14 +3687,16 @@ end
--- @param c Camera
--- @return integer
---- Processes course-specific camera settings, such as predefined positions or modes. Adjusts the camera to match the design and gameplay requirements of the current course
+--- Processes course-specific camera settings, such as predefined positions or modes.
+--- Adjusts the camera to match the design and gameplay requirements of the current course
function camera_course_processing(c)
-- ...
end
--- @param pos Vec3f
--- @param lastGood Vec3f
---- Resolves collisions between the camera and level geometry. Adjusts the camera's position to prevent clipping or intersecting with objects
+--- Resolves collisions between the camera and level geometry.
+--- Adjusts the camera's position to prevent clipping or intersecting with objects
function resolve_geometry_collisions(pos, lastGood)
-- ...
end
@@ -3619,14 +3707,16 @@ end
--- @param yawRange integer
--- @return integer
--- @return integer avoidYaw
---- Rotates the camera to avoid walls or other obstructions. Ensures clear visibility of the player or target objects
+--- Rotates the camera to avoid walls or other obstructions.
+--- Ensures clear visibility of the player or target objects
function rotate_camera_around_walls(c, cPos, avoidYaw, yawRange)
-- ...
end
--- @param cutscene integer
--- @return integer
---- Starts a cutscene focused on an object without requiring focus to remain locked. This is useful for dynamic events where the camera adjusts freely
+--- Starts a cutscene focused on an object without requiring focus to remain locked.
+--- This is useful for dynamic events where the camera adjusts freely
function start_object_cutscene_without_focus(cutscene)
-- ...
end
@@ -3635,7 +3725,8 @@ end
--- @param o Object
--- @param dialogID integer
--- @return integer
---- Starts a cutscene involving an object and displays dialog during the sequence. The camera focuses on the object while synchronizing dialog with the scene
+--- Starts a cutscene involving an object and displays dialog during the sequence.
+--- The camera focuses on the object while synchronizing dialog with the scene
function cutscene_object_with_dialog(cutscene, o, dialogID)
-- ...
end
@@ -3643,7 +3734,8 @@ end
--- @param cutscene integer
--- @param o Object
--- @return integer
---- Starts a cutscene involving an object without dialog. The camera transitions smoothly to focus on the object
+--- Starts a cutscene involving an object without dialog.
+--- The camera transitions smoothly to focus on the object
function cutscene_object_without_dialog(cutscene, o)
-- ...
end
@@ -3651,13 +3743,15 @@ end
--- @param cutscene integer
--- @param o Object
--- @return integer
---- Initiates a cutscene focusing on a specific object in the game world. The camera transitions smoothly to the object, adapting its position as needed
+--- Initiates a cutscene focusing on a specific object in the game world.
+--- The camera transitions smoothly to the object, adapting its position as needed
function cutscene_object(cutscene, o)
-- ...
end
--- @param c Camera
---- Starts the execution of a predefined cutscene. The camera transitions dynamically to follow the scripted sequence
+--- Starts the execution of a predefined cutscene.
+--- The camera transitions dynamically to follow the scripted sequence
function play_cutscene(c)
-- ...
end
@@ -3665,7 +3759,8 @@ end
--- @param obj integer
--- @param frame integer
--- @return integer
---- Spawns an object as part of a cutscene, such as props or interactive elements. Returns the spawned object's reference for further manipulation
+--- Spawns an object as part of a cutscene, such as props or interactive elements.
+--- Returns the spawned object's reference for further manipulation
function cutscene_spawn_obj(obj, frame)
-- ...
end
@@ -3673,19 +3768,22 @@ end
--- @param amplitude integer
--- @param decay integer
--- @param shakeSpeed integer
---- Applies a field-of-view shake effect to simulate zoom or focus disruptions. Shake parameters, such as amplitude and decay, control the intensity
+--- Applies a field-of-view shake effect to simulate zoom or focus disruptions.
+--- Shake parameters, such as amplitude and decay, control the intensity
function set_fov_shake(amplitude, decay, shakeSpeed)
-- ...
end
--- @param func integer
---- Assigns a custom function for dynamic field-of-view adjustments. This allows precise control over the camera's zoom behavior during gameplay
+--- Assigns a custom function for dynamic field-of-view adjustments.
+--- This allows precise control over the camera's zoom behavior during gameplay
function set_fov_function(func)
-- ...
end
--- @param preset integer
---- Applies a preset field-of-view shake effect during a cutscene. This creates dynamic visual effects, such as zoom or focus disruptions
+--- Applies a preset field-of-view shake effect during a cutscene.
+--- This creates dynamic visual effects, such as zoom or focus disruptions
function cutscene_set_fov_shake_preset(preset)
-- ...
end
@@ -3694,7 +3792,8 @@ end
--- @param posX number
--- @param posY number
--- @param posZ number
---- Applies a preset field-of-view shake effect relative to a specific point. The intensity diminishes as the distance from the point increases
+--- Applies a preset field-of-view shake effect relative to a specific point.
+--- The intensity diminishes as the distance from the point increases
function set_fov_shake_from_point_preset(preset, posX, posY, posZ)
-- ...
end
@@ -3705,7 +3804,8 @@ end
--- @param yawOff integer
--- @param pitchDiv integer
--- @param yawDiv integer
---- Rotates an object toward a specific point in 3D space. Gradually updates the object's pitch and yaw angles to face the target
+--- Rotates an object toward a specific point in 3D space.
+--- Gradually updates the object's pitch and yaw angles to face the target
function obj_rotate_towards_point(o, point, pitchOff, yawOff, pitchDiv, yawDiv)
-- ...
end
@@ -3715,25 +3815,29 @@ end
--- @param y integer
--- @param z integer
--- @return integer
---- Activates a fixed camera mode and aligns the camera to specific X, Y, Z coordinates. This is useful for predefined static views in specific areas
+--- Activates a fixed camera mode and aligns the camera to specific X, Y, Z coordinates.
+--- This is useful for predefined static views in specific areas
function set_camera_mode_fixed(c, x, y, z)
-- ...
end
--- @param angle integer
--- @return integer
---- Takes in an SM64 angle unit and returns the nearest 45 degree angle, also in SM64 angle units. Useful when needing to align angles (camera, yaw, etc.)
+--- Takes in an SM64 angle unit and returns the nearest 45 degree angle, also in SM64 angle units.
+--- Useful when needing to align angles (camera, yaw, etc.)
function snap_to_45_degrees(angle)
-- ...
end
--- @param enable integer
---- Toggles whether the camera uses course-specific settings. This is useful for enabling or disabling custom behaviors in specific courses or areas
+--- Toggles whether the camera uses course-specific settings.
+--- This is useful for enabling or disabling custom behaviors in specific courses or areas
function camera_set_use_course_specific_settings(enable)
-- ...
end
---- Centers the ROM hack camera. This function is designed for non-standard level layouts and modded game environments
+--- Centers the ROM hack camera.
+--- This function is designed for non-standard level layouts and modded game environments
function center_rom_hack_camera()
-- ...
end
@@ -3778,7 +3882,8 @@ end
--- @param m MarioState
--- @param characterSound CharacterSound
---- Plays a character-specific sound based on the given `characterSound` value. The sound is tied to Mario's current state (`m`). Useful for triggering sound effects for actions like jumping or interacting with the environment
+--- Plays a character-specific sound based on the given `characterSound` value. The sound is tied to Mario's current state (`m`).
+--- Useful for triggering sound effects for actions like jumping or interacting with the environment
function play_character_sound(m, characterSound)
-- ...
end
@@ -3786,7 +3891,8 @@ end
--- @param m MarioState
--- @param characterSound CharacterSound
--- @param offset integer
---- Plays a character-specific sound with an additional `offset`, allowing variations or delays in the sound effect. Uses Mario's current state (`m`). Useful for adding dynamic sound effects or syncing sounds to specific animations or events
+--- Plays a character-specific sound with an additional `offset`, allowing variations or delays in the sound effect. Uses Mario's current state (`m`).
+--- Useful for adding dynamic sound effects or syncing sounds to specific animations or events
function play_character_sound_offset(m, characterSound, offset)
-- ...
end
@@ -3794,14 +3900,16 @@ end
--- @param m MarioState
--- @param characterSound CharacterSound
--- @param flags integer
---- Plays a character-specific sound only if certain flags are not set. This ensures that sounds are not repeated unnecessarily. The sound is based on `characterSound`, and the flags are checked using `flags`. Useful for avoiding duplicate sound effects in rapid succession or conditional actions
+--- Plays a character-specific sound only if certain flags are not set. This ensures that sounds are not repeated unnecessarily. The sound is based on `characterSound`, and the flags are checked using `flags`.
+--- Useful for avoiding duplicate sound effects in rapid succession or conditional actions
function play_character_sound_if_no_flag(m, characterSound, flags)
-- ...
end
--- @param m MarioState
--- @return number
---- Calculates the animation offset for Mario's current animation. The offset is determined by the type of animation being played (e.g., hand, feet, or torso movement). Useful for smoothly syncing Mario's model height or positional adjustments during animations
+--- Calculates the animation offset for Mario's current animation. The offset is determined by the type of animation being played (e.g., hand, feet, or torso movement).
+--- Useful for smoothly syncing Mario's model height or positional adjustments during animations
function get_character_anim_offset(m)
-- ...
end
@@ -3809,7 +3917,8 @@ end
--- @param m MarioState
--- @param characterAnim CharacterAnimID
--- @return integer
---- Gets the animation ID to use for a specific character and animation combination. The ID is based on `characterAnim` and the character currently controlled by Mario (`m`). Useful for determining which animation to play for actions like walking, jumping, or idle states
+--- Gets the animation ID to use for a specific character and animation combination. The ID is based on `characterAnim` and the character currently controlled by Mario (`m`).
+--- Useful for determining which animation to play for actions like walking, jumping, or idle states
function get_character_anim(m, characterAnim)
-- ...
end
@@ -3823,7 +3932,8 @@ function get_modded_character_anim_string(m, characterAnim)
end
--- @param m MarioState
---- Updates Mario's current animation offset. This adjusts Mario's position based on the calculated offset to ensure animations appear smooth and natural. Useful for keeping Mario's animations visually aligned, particularly when transitioning between animations
+--- Updates Mario's current animation offset. This adjusts Mario's position based on the calculated offset to ensure animations appear smooth and natural.
+--- Useful for keeping Mario's animations visually aligned, particularly when transitioning between animations
function update_character_anim_offset(m)
-- ...
end
@@ -3873,14 +3983,16 @@ end
--- @param character Character
--- @param characterSound CharacterSound
--- @param audioName string
---- Adds a `audioName` for `characterSound` on `character`. You can add multiple sound files to the same `characterSound` When you have multiple sounds, it picks between them at random.
+--- Adds a `audioName` for `characterSound` on `character`. You can add multiple sound files to the same `characterSound`
+--- When you have multiple sounds, it picks between them at random.
function character_add_sound(character, characterSound, audioName)
-- ...
end
--- @param character Character
--- @param characterSound CharacterSound
---- Removes all sounds for `characterSound` on `character`. Every sound file will get removed from the character.
+--- Removes all sounds for `characterSound` on `character`.
+--- Every sound file will get removed from the character.
function character_remove_sounds(character, characterSound)
-- ...
end
@@ -3888,7 +4000,9 @@ end
--- @param character Character
--- @param animID CharacterAnimID
--- @param animString string
---- Sets animation for `animID` using a registered smlua animation. You can regjster an smlua animation by using `smlua_util_register_animation`. The animation string you used to register the animation is the `animString` to be passed.
+--- Sets animation for `animID` using a registered smlua animation.
+--- You can regjster an smlua animation by using `smlua_util_register_animation`.
+--- The animation string you used to register the animation is the `animString` to be passed.
function character_set_animation(character, animID, animString)
-- ...
end
@@ -4641,7 +4755,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles Mario's interaction with coins. Collecting a coin increases Mario's coin count and heals him slightly. Useful for score, and coin management
+--- Handles Mario's interaction with coins. Collecting a coin increases Mario's coin count and heals him slightly.
+--- Useful for score, and coin management
function interact_coin(m, interactType, o)
-- ...
end
@@ -4650,7 +4765,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interactions with water rings that heal Mario. Passing through water rings increases his health counter. Useful for underwater stages
+--- Handles interactions with water rings that heal Mario. Passing through water rings increases his health counter.
+--- Useful for underwater stages
function interact_water_ring(m, interactType, o)
-- ...
end
@@ -4659,7 +4775,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with Stars or Keys. If Mario collects a star or key, it triggers a specific star grab cutscene and progression is updated. Also handles no-exit variants (like the wing cap stage star). Useful for the main progression system of collecting Stars and unlocking new areas
+--- Handles interaction with Stars or Keys. If Mario collects a star or key, it triggers a specific star grab cutscene and progression is updated. Also handles no-exit variants (like the wing cap stage star).
+--- Useful for the main progression system of collecting Stars and unlocking new areas
function interact_star_or_key(m, interactType, o)
-- ...
end
@@ -4677,7 +4794,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with warps, including warp pipes and hole warps. If Mario steps onto a warp, he either transitions into another area or level. Useful for connecting different parts of the game world and controlling transitions between levels as well as custom warp areas
+--- Handles interaction with warps, including warp pipes and hole warps. If Mario steps onto a warp, he either transitions into another area or level.
+--- Useful for connecting different parts of the game world and controlling transitions between levels as well as custom warp areas
function interact_warp(m, interactType, o)
-- ...
end
@@ -4686,7 +4804,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with warp doors that lead to other areas or require keys. If Mario can open the door (has enough stars or a key), he proceeds. Otherwise, it may show a dialog. Useful for restricting access to certain areas based on progression
+--- Handles interaction with warp doors that lead to other areas or require keys. If Mario can open the door (has enough stars or a key), he proceeds. Otherwise, it may show a dialog.
+--- Useful for restricting access to certain areas based on progression
function interact_warp_door(m, interactType, o)
-- ...
end
@@ -4695,7 +4814,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction when Mario touches a door. If Mario meets the star requirement or has the key, he can unlock/open the door. Otherwise, it may display dialog indicating the requirement. Useful for controlling access to locked areas and providing progression gating in the game
+--- Handles interaction when Mario touches a door. If Mario meets the star requirement or has the key, he can unlock/open the door. Otherwise, it may display dialog indicating the requirement.
+--- Useful for controlling access to locked areas and providing progression gating in the game
function interact_door(m, interactType, o)
-- ...
end
@@ -4704,7 +4824,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction when Mario touches a cannon base. If the cannon is ready, Mario enters the cannon, triggering a special action and camera behavior. Useful for transitioning to cannon-aiming mode and enabling cannon travel within levels
+--- Handles interaction when Mario touches a cannon base. If the cannon is ready, Mario enters the cannon, triggering a special action and camera behavior.
+--- Useful for transitioning to cannon-aiming mode and enabling cannon travel within levels
function interact_cannon_base(m, interactType, o)
-- ...
end
@@ -4713,7 +4834,9 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with another player (in multiplayer scenarios). Checks if Mario and another player collide and resolves any special behavior like bouncing on top. Useful for multiplayer interactions, such as PvP or cooperative gameplay mechanics
+--- Handles interaction with another player (in multiplayer scenarios).
+--- Checks if Mario and another player collide and resolves any special behavior like bouncing on top.
+--- Useful for multiplayer interactions, such as PvP or cooperative gameplay mechanics
function interact_player(m, interactType, o)
-- ...
end
@@ -4722,7 +4845,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with the igloo barrier found in Snowman's Land. If Mario runs into the barrier, this function pushes him away and prevents passage without the vanish cap. Useful for enforcing require-caps to access certain areas
+--- Handles interaction with the igloo barrier found in Snowman's Land. If Mario runs into the barrier, this function pushes him away and prevents passage without the vanish cap.
+--- Useful for enforcing require-caps to access certain areas
function interact_igloo_barrier(m, interactType, o)
-- ...
end
@@ -4731,7 +4855,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with tornados. If Mario touches a tornado, he enters a spinning twirl action, losing control temporarily. Useful for desert levels or areas where environmental hazards lift Mario into the air
+--- Handles interaction with tornados. If Mario touches a tornado, he enters a spinning twirl action, losing control temporarily.
+--- Useful for desert levels or areas where environmental hazards lift Mario into the air
function interact_tornado(m, interactType, o)
-- ...
end
@@ -4740,7 +4865,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with whirlpools. If Mario gets caught in a whirlpool, he's pulled toward it, resulting in a unique "caught" action. Useful for hazards that trap Mario like whirlpools
+--- Handles interaction with whirlpools. If Mario gets caught in a whirlpool, he's pulled toward it, resulting in a unique "caught" action.
+--- Useful for hazards that trap Mario like whirlpools
function interact_whirlpool(m, interactType, o)
-- ...
end
@@ -4749,7 +4875,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with strong wind gusts. These gusts push Mario back, often knocking him off platforms or sending him flying backwards. Useful for environmental wind hazards
+--- Handles interaction with strong wind gusts. These gusts push Mario back, often knocking him off platforms or sending him flying backwards.
+--- Useful for environmental wind hazards
function interact_strong_wind(m, interactType, o)
-- ...
end
@@ -4758,7 +4885,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with flame objects. If Mario touches a flame and is not invulnerable or protected by certain caps, he takes damage and may be set on fire, causing a burning jump. Useful for simulating fire damage and hazards in levels
+--- Handles interaction with flame objects. If Mario touches a flame and is not invulnerable or protected by certain caps, he takes damage and may be set on fire, causing a burning jump.
+--- Useful for simulating fire damage and hazards in levels
function interact_flame(m, interactType, o)
-- ...
end
@@ -4776,7 +4904,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interactions with objects like Clams or Bubbas, which can damage Mario or, in Bubba's case, eat Mario. If Bubba eats Mario, it triggers a unique "caught" action. Otherwise, it deals damage and knockback if hit by a Clam
+--- Handles interactions with objects like Clams or Bubbas, which can damage Mario or, in Bubba's case, eat Mario.
+--- If Bubba eats Mario, it triggers a unique "caught" action. Otherwise, it deals damage and knockback if hit by a Clam
function interact_clam_or_bubba(m, interactType, o)
-- ...
end
@@ -4785,7 +4914,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with Bully enemies. Determines if Mario attacks the Bully or gets knocked back. Updates Mario's velocity and state accordingly, and can defeat the Bully if attacked successfully. Useful for enemy encounters that involve pushing and shoving mechanics rather than just stomping like the bullies
+--- Handles interaction with Bully enemies. Determines if Mario attacks the Bully or gets knocked back. Updates Mario's velocity and state accordingly, and can defeat the Bully if attacked successfully.
+--- Useful for enemy encounters that involve pushing and shoving mechanics rather than just stomping like the bullies
function interact_bully(m, interactType, o)
-- ...
end
@@ -4794,7 +4924,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with shocking objects. If Mario touches an electrified enemy or hazard, he takes damage and may be stunned or shocked. Useful for electric-themed enemies and obstacles
+--- Handles interaction with shocking objects. If Mario touches an electrified enemy or hazard, he takes damage and may be stunned or shocked.
+--- Useful for electric-themed enemies and obstacles
function interact_shock(m, interactType, o)
-- ...
end
@@ -4803,7 +4934,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with Mr. Blizzard (the snowman enemy) or similar objects. If Mario is attacked or collides with Mr. Blizzard, it applies damage and knockback if not protected or attacking
+--- Handles interaction with Mr. Blizzard (the snowman enemy) or similar objects.
+--- If Mario is attacked or collides with Mr. Blizzard, it applies damage and knockback if not protected or attacking
function interact_mr_blizzard(m, interactType, o)
-- ...
end
@@ -4812,7 +4944,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interactions where Mario hits an object from below (e.g., hitting a block from underneath). Determines if Mario damages/destroys the object, or if it damages Mario. Useful for handling upward attacks, hitting coin blocks, or interacting with certain NPCs from below
+--- Handles interactions where Mario hits an object from below (e.g., hitting a block from underneath). Determines if Mario damages/destroys the object, or if it damages Mario.
+--- Useful for handling upward attacks, hitting coin blocks, or interacting with certain NPCs from below
function interact_hit_from_below(m, interactType, o)
-- ...
end
@@ -4821,7 +4954,9 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interactions where Mario bounces off the top of an object (e.g., Goombas, Koopas). Checks if Mario attacks the object from above and applies the appropriate knockback, sound effects, and object state changes. Useful for enemy defeat mechanics and platform bouncing
+--- Handles interactions where Mario bounces off the top of an object (e.g., Goombas, Koopas).
+--- Checks if Mario attacks the object from above and applies the appropriate knockback, sound effects, and object state changes.
+--- Useful for enemy defeat mechanics and platform bouncing
function interact_bounce_top(m, interactType, o)
-- ...
end
@@ -4830,7 +4965,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with Spiny-walking enemies. If Mario attacks it (e.g., by punching), the enemy is hurt. If he fails to attack properly (say bouncing on top), Mario takes damage and knockback. Useful for enemies that cannot be stomped from above and require direct attacks
+--- Handles interaction with Spiny-walking enemies. If Mario attacks it (e.g., by punching), the enemy is hurt. If he fails to attack properly (say bouncing on top), Mario takes damage and knockback.
+--- Useful for enemies that cannot be stomped from above and require direct attacks
function interact_spiny_walking(m, interactType, o)
-- ...
end
@@ -4839,7 +4975,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles damaging interactions from various objects (e.g., enemies, hazards). If Mario takes damage, it applies knockback and reduces health. Useful for enemy attacks, environmental hazards, and managing damage related behaviors
+--- Handles damaging interactions from various objects (e.g., enemies, hazards). If Mario takes damage, it applies knockback and reduces health.
+--- Useful for enemy attacks, environmental hazards, and managing damage related behaviors
function interact_damage(m, interactType, o)
-- ...
end
@@ -4848,7 +4985,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interactions with breakable objects (e.g., breakable boxes or bob-ombs). If Mario hits the object with a valid attack (like a punch or kick), the object is destroyed or changes state. Useful for managing collectible items hidden in breakable objects and level progression through destructible blocks or walls
+--- Handles interactions with breakable objects (e.g., breakable boxes or bob-ombs). If Mario hits the object with a valid attack (like a punch or kick), the object is destroyed or changes state.
+--- Useful for managing collectible items hidden in breakable objects and level progression through destructible blocks or walls
function interact_breakable(m, interactType, o)
-- ...
end
@@ -4857,7 +4995,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction when Mario touches a Koopa Shell. If conditions are met, Mario can hop onto the shell and start riding it, changing his movement mechanics. Useful for implementing Koopa Shell behavior
+--- Handles interaction when Mario touches a Koopa Shell. If conditions are met, Mario can hop onto the shell and start riding it, changing his movement mechanics.
+--- Useful for implementing Koopa Shell behavior
function interact_koopa_shell(m, interactType, o)
-- ...
end
@@ -4866,7 +5005,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with poles (e.g., climbing poles). If Mario runs into a vertical pole, he can grab it and start climbing. Useful for platforming mechanics
+--- Handles interaction with poles (e.g., climbing poles). If Mario runs into a vertical pole, he can grab it and start climbing.
+--- Useful for platforming mechanics
function interact_pole(m, interactType, o)
-- ...
end
@@ -4875,7 +5015,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with Hoot, the owl. If Mario can grab onto Hoot, this sets Mario onto a riding action, allowing him to fly around the level. Useful for special traversal mechanics and shortcuts within a course
+--- Handles interaction with Hoot, the owl. If Mario can grab onto Hoot, this sets Mario onto a riding action, allowing him to fly around the level.
+--- Useful for special traversal mechanics and shortcuts within a course
function interact_hoot(m, interactType, o)
-- ...
end
@@ -4884,7 +5025,9 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction when Mario picks up a cap object. This includes normal caps, wing caps, vanish caps, and metal caps. Updates Mario's state (e.g., cap timers, sound effects) and may initiate putting on the cap animation. Useful for managing cap statuses
+--- Handles interaction when Mario picks up a cap object. This includes normal caps, wing caps, vanish caps, and metal caps.
+--- Updates Mario's state (e.g., cap timers, sound effects) and may initiate putting on the cap animation.
+--- Useful for managing cap statuses
function interact_cap(m, interactType, o)
-- ...
end
@@ -4893,7 +5036,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with grabbable objects (e.g., crates, small enemies, or Bowser). Checks if Mario can pick up the object and initiates the grab action if possible. Useful for course mechanics, throwing items, and Bowser
+--- Handles interaction with grabbable objects (e.g., crates, small enemies, or Bowser). Checks if Mario can pick up the object and initiates the grab action if possible.
+--- Useful for course mechanics, throwing items, and Bowser
function interact_grabbable(m, interactType, o)
-- ...
end
@@ -4902,7 +5046,8 @@ end
--- @param interactType integer
--- @param o Object
--- @return integer
---- Handles interaction with signs, NPCs, and other text-bearing objects. If Mario presses the interact button facing them, he enters a dialog reading state. Useful for managing hints, story elements, or gameplay instructions through in-game dialogue
+--- Handles interaction with signs, NPCs, and other text-bearing objects. If Mario presses the interact button facing them, he enters a dialog reading state.
+--- Useful for managing hints, story elements, or gameplay instructions through in-game dialogue
function interact_text(m, interactType, o)
-- ...
end
@@ -4910,58 +5055,72 @@ end
--- @param m MarioState
--- @param o Object
--- @return integer
---- Calculates the angle between Mario and a specified object. Used for determining Mario's orientation relative to the object. Useful for deciding directions between Mario and NPCs
+--- Calculates the angle between Mario and a specified object. Used for determining Mario's orientation relative to the object.
+--- Useful for deciding directions between Mario and NPCs
function mario_obj_angle_to_object(m, o)
-- ...
end
--- @param m MarioState
---- Stops Mario from riding any currently ridden object (e.g., a Koopa shell or Hoot), updating the object's interaction status and Mario's state. Useful for cleanly dismounting ridden objects
+--- Stops Mario from riding any currently ridden object (e.g., a Koopa shell or Hoot), updating the object's interaction status and Mario's state.
+--- Useful for cleanly dismounting ridden objects
function mario_stop_riding_object(m)
-- ...
end
--- @param m MarioState
---- Grabs the object currently referenced by Mario's `usedObj` if it's not already being held. Changes the object's state to indicate it is now held by Mario. Useful for handling the moment Mario successfully picks up an object
+--- Grabs the object currently referenced by Mario's `usedObj` if it's not already being held.
+--- Changes the object's state to indicate it is now held by Mario.
+--- Useful for handling the moment Mario successfully picks up an object
function mario_grab_used_object(m)
-- ...
end
--- @param m MarioState
---- Causes Mario to drop the object he is currently holding. Sets the held object's state accordingly and places it in front of Mario. Useful for releasing carried objects, such as throwing Bob-ombs or setting down crates
+--- Causes Mario to drop the object he is currently holding. Sets the held object's state accordingly and places it in front of Mario.
+--- Useful for releasing carried objects, such as throwing Bob-ombs or setting down crates
function mario_drop_held_object(m)
-- ...
end
--- @param m MarioState
---- Throws the object Mario is currently holding. The object is placed in front of Mario and given a forward velocity. Useful for attacking enemies with thrown objects, solving puzzles by throwing crates, or interacting with environment items
+--- Throws the object Mario is currently holding. The object is placed in front of Mario and given a forward velocity.
+--- Useful for attacking enemies with thrown objects, solving puzzles by throwing crates, or interacting with environment items
function mario_throw_held_object(m)
-- ...
end
--- @param m MarioState
---- Causes Mario to stop riding any object (like a shell or Hoot) and also drop any held object. Resets related states to ensure Mario is no longer attached to or holding anything. Useful when changing Mario's state after certain actions, transitions, or to prevent exploits
+--- Causes Mario to stop riding any object (like a shell or Hoot) and also drop any held object.
+--- Resets related states to ensure Mario is no longer attached to or holding anything.
+--- Useful when changing Mario's state after certain actions, transitions, or to prevent exploits
function mario_stop_riding_and_holding(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks if Mario is currently wearing his normal cap on his head. Returns true if Mario's flag state matches that of having the normal cap equipped on his head, otherwise false. Useful for determining Mario's cap status
+--- Checks if Mario is currently wearing his normal cap on his head.
+--- Returns true if Mario's flag state matches that of having the normal cap equipped on his head, otherwise false.
+--- Useful for determining Mario's cap status
function does_mario_have_normal_cap_on_head(m)
-- ...
end
--- @param m MarioState
--- @return boolean
---- Checks if Mario has already had a cap blown off of his head in the current level, Returns true if a blown cap can be found for Mario, false if not. Useful to check if a blown cap exists in the level currently.
+--- Checks if Mario has already had a cap blown off of his head in the current level,
+--- Returns true if a blown cap can be found for Mario, false if not.
+--- Useful to check if a blown cap exists in the level currently.
function does_mario_have_blown_cap(m)
-- ...
end
--- @param m MarioState
--- @param capSpeed number
---- Makes Mario blow off his normal cap at a given speed. Removes the normal cap from Mario's head and spawns it as a collectible object in the game world. Useful for simulating events where Mario loses his cap due to enemy attacks or environmental forces
+--- Makes Mario blow off his normal cap at a given speed.
+--- Removes the normal cap from Mario's head and spawns it as a collectible object in the game world.
+--- Useful for simulating events where Mario loses his cap due to enemy attacks or environmental forces
function mario_blow_off_cap(m, capSpeed)
-- ...
end
@@ -4969,13 +5128,17 @@ end
--- @param m MarioState
--- @param arg integer
--- @return integer
---- Makes Mario lose his normal cap to an enemy, such as Klepto or Ukiki. Updates flags so that the cap is no longer on Mario's head. Returns true if Mario was wearing his normal cap, otherwise false. Useful for scenarios where enemies steal Mario's cap
+--- Makes Mario lose his normal cap to an enemy, such as Klepto or Ukiki. Updates flags so that the cap is no longer on Mario's head.
+--- Returns true if Mario was wearing his normal cap, otherwise false.
+--- Useful for scenarios where enemies steal Mario's cap
function mario_lose_cap_to_enemy(m, arg)
-- ...
end
--- @param m MarioState
---- Retrieves Mario's normal cap if it was previously lost. Removes the cap from Mario's hand state and places it on his head. Useful when Mario recovers his normal cap from enemies, finds it in a level, or if it were to disappear
+--- Retrieves Mario's normal cap if it was previously lost.
+--- Removes the cap from Mario's hand state and places it on his head.
+--- Useful when Mario recovers his normal cap from enemies, finds it in a level, or if it were to disappear
function mario_retrieve_cap(m)
-- ...
end
@@ -4983,21 +5146,24 @@ end
--- @param m MarioState
--- @param interactType integer
--- @return Object
---- Returns a collided object that matches a given interaction type from Mario's current collision data. Useful for determining which object Mario has come into contact with
+--- Returns a collided object that matches a given interaction type from Mario's current collision data.
+--- Useful for determining which object Mario has come into contact with
function mario_get_collided_object(m, interactType)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks if Mario can grab the currently encountered object (usually triggered when Mario punches or dives). If conditions are met, initiates the grabbing process. Useful for picking up objects, throwing enemies, or grabbing special items
+--- Checks if Mario can grab the currently encountered object (usually triggered when Mario punches or dives). If conditions are met, initiates the grabbing process.
+--- Useful for picking up objects, throwing enemies, or grabbing special items
function mario_check_object_grab(m)
-- ...
end
--- @param door Object
--- @return integer
---- Retrieves the save file flag associated with a door, based on the number of stars required to open it. Used to check if the player has unlocked certain star doors or progressed far enough to access new areas
+--- Retrieves the save file flag associated with a door, based on the number of stars required to open it.
+--- Used to check if the player has unlocked certain star doors or progressed far enough to access new areas
function get_door_save_file_flag(door)
-- ...
end
@@ -5005,7 +5171,9 @@ end
--- @param attacker MarioState
--- @param victim MarioState
--- @return integer
---- Checks if the necessary conditions are met for one player to successfully attack another player in a PvP scenario. Considers factors like invincibility, action states, and whether the attack is valid. Useful for multiplayer where players can harm each other
+--- Checks if the necessary conditions are met for one player to successfully attack another player in a PvP scenario.
+--- Considers factors like invincibility, action states, and whether the attack is valid.
+--- Useful for multiplayer where players can harm each other
function passes_pvp_interaction_checks(attacker, victim)
-- ...
end
@@ -5013,7 +5181,8 @@ end
--- @param m MarioState
--- @param o Object
--- @return integer
---- Determines whether Mario should push or pull a door when he interacts with it, based on his orientation and position. Useful for animating door interactions realistically, depending on which side Mario approaches from
+--- Determines whether Mario should push or pull a door when he interacts with it, based on his orientation and position.
+--- Useful for animating door interactions realistically, depending on which side Mario approaches from
function should_push_or_pull_door(m, o)
-- ...
end
@@ -5021,14 +5190,17 @@ end
--- @param m MarioState
--- @param o Object
--- @return integer
---- Handles the logic of Mario taking damage and being knocked back by a damaging object. Decreases Mario's health, sets his knockback state, and triggers appropriate sound and camera effects. Useful for implementing enemy attacks, hazards, and ensuring Mario receives proper feedback upon taking damage
+--- Handles the logic of Mario taking damage and being knocked back by a damaging object.
+--- Decreases Mario's health, sets his knockback state, and triggers appropriate sound and camera effects.
+--- Useful for implementing enemy attacks, hazards, and ensuring Mario receives proper feedback upon taking damage
function take_damage_and_knock_back(m, o)
-- ...
end
--- @param capObject Object
--- @return integer
---- Determines the type of cap an object represents. Depending on the object's behavior, it returns a cap type (normal, metal, wing, vanish). Useful for handling the logic of picking up, wearing, or losing different kinds of caps
+--- Determines the type of cap an object represents. Depending on the object's behavior, it returns a cap type (normal, metal, wing, vanish).
+--- Useful for handling the logic of picking up, wearing, or losing different kinds of caps
function get_mario_cap_flag(capObject)
-- ...
end
@@ -5036,7 +5208,9 @@ end
--- @param m MarioState
--- @param o Object
--- @return integer
---- Determines how Mario interacts with a given object based on his current action, position, and other state variables. Calculates the appropriate interaction type (e.g., punch, kick, ground pound) that should result from Mario's contact with the specified object (`o`). Useful for handling different types of player-object collisions, attacks, and object behaviors
+--- Determines how Mario interacts with a given object based on his current action, position, and other state variables.
+--- Calculates the appropriate interaction type (e.g., punch, kick, ground pound) that should result from Mario's contact with the specified object (`o`).
+--- Useful for handling different types of player-object collisions, attacks, and object behaviors
function determine_interaction(m, o)
-- ...
end
@@ -5070,7 +5244,8 @@ end
--- @param areaIndex integer
--- @param charCase integer
--- @return string
---- Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an ASCII (human readable) string. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
+--- Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an ASCII (human readable) string.
+--- Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
function get_level_name_ascii(courseNum, levelNum, areaIndex, charCase)
-- ...
end
@@ -5080,7 +5255,9 @@ end
--- @param areaIndex integer
--- @param charCase integer
--- @return Pointer_integer
---- Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an SM64 encoded string. This function should not be used in Lua mods. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
+--- Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an SM64 encoded string.
+--- This function should not be used in Lua mods.
+--- Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
function get_level_name_sm64(courseNum, levelNum, areaIndex, charCase)
-- ...
end
@@ -5098,7 +5275,8 @@ end
--- @param starNum integer
--- @param charCase integer
--- @return string
---- Returns the name of the star corresponding to `courseNum` and `starNum` as an ASCII (human readable) string. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
+--- Returns the name of the star corresponding to `courseNum` and `starNum` as an ASCII (human readable) string.
+--- Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
function get_star_name_ascii(courseNum, starNum, charCase)
-- ...
end
@@ -5107,7 +5285,9 @@ end
--- @param starNum integer
--- @param charCase integer
--- @return Pointer_integer
---- Returns the name of the star corresponding to `courseNum` and `starNum` as an SM64 encoded string. This function should not be used in Lua mods. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
+--- Returns the name of the star corresponding to `courseNum` and `starNum` as an SM64 encoded string.
+--- This function should not be used in Lua mods.
+--- Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
function get_star_name_sm64(courseNum, starNum, charCase)
-- ...
end
@@ -5127,7 +5307,9 @@ end
--- @param checkpoint integer
--- @param o Object
--- @return ObjectWarpNode
---- Creates a warp node in the current level and area with id `id` that goes to the warp node `destNode` in level `destLevel` and area `destArea`, and attach it to the object `o`. To work properly, object `o` must be able to trigger a warp (for example, with interact type set to `INTERACT_WARP`.) `checkpoint` should be set only to WARP_NO_CHECKPOINT (0x00) or WARP_CHECKPOINT (0x80.) If `checkpoint` is set to `0x80`, Mario will warp directly to this node if he enters the level again (after a death for example)
+--- Creates a warp node in the current level and area with id `id` that goes to the warp node `destNode` in level `destLevel` and area `destArea`, and attach it to the object `o`.
+--- To work properly, object `o` must be able to trigger a warp (for example, with interact type set to `INTERACT_WARP`.)
+--- `checkpoint` should be set only to WARP_NO_CHECKPOINT (0x00) or WARP_CHECKPOINT (0x80.) If `checkpoint` is set to `0x80`, Mario will warp directly to this node if he enters the level again (after a death for example)
function area_create_warp_node(id, destLevel, destArea, destNode, checkpoint, o)
-- ...
end
@@ -5390,14 +5572,16 @@ end
--- @param m MarioState
--- @return integer
---- Checks if Mario's current animation has reached its final frame (i.e., the last valid frame in the animation). Useful for deciding when to transition out of an animation-driven action
+--- Checks if Mario's current animation has reached its final frame (i.e., the last valid frame in the animation).
+--- Useful for deciding when to transition out of an animation-driven action
function is_anim_at_end(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks if Mario's current animation has passed the second-to-last valid frame (i.e., effectively at or beyond its final frames). Useful for advanced checks where slightly early transitions or timing are needed before the final frame
+--- Checks if Mario's current animation has passed the second-to-last valid frame (i.e., effectively at or beyond its final frames).
+--- Useful for advanced checks where slightly early transitions or timing are needed before the final frame
function is_anim_past_end(m)
-- ...
end
@@ -5414,7 +5598,8 @@ end
--- @param targetAnimID integer
--- @param accel integer
--- @return integer
---- Sets Mario's current animation to `targetAnimID` with a custom `accel` value to speed up or slow down the animation. Useful for controlling animation timing, e.g., slow-motion or fast-forward effects
+--- Sets Mario's current animation to `targetAnimID` with a custom `accel` value to speed up or slow down the animation.
+--- Useful for controlling animation timing, e.g., slow-motion or fast-forward effects
function set_mario_anim_with_accel(m, targetAnimID, accel)
-- ...
end
@@ -5431,7 +5616,8 @@ end
--- @param targetAnimID CharacterAnimID
--- @param accel integer
--- @return integer
---- Sets a character-specific animation where the animation speed is adjusted by `accel`. Useful for varying animation speeds based on context or dynamic conditions (e.g., slow-motion)
+--- Sets a character-specific animation where the animation speed is adjusted by `accel`.
+--- Useful for varying animation speeds based on context or dynamic conditions (e.g., slow-motion)
function set_character_anim_with_accel(m, targetAnimID, accel)
-- ...
end
@@ -5446,7 +5632,8 @@ end
--- @param m MarioState
--- @param animFrame integer
--- @return integer
---- Checks if Mario's current animation is past a specified `animFrame`. Useful for conditional logic where an action can branch after reaching a specific point in the animation
+--- Checks if Mario's current animation is past a specified `animFrame`.
+--- Useful for conditional logic where an action can branch after reaching a specific point in the animation
function is_anim_past_frame(m, animFrame)
-- ...
end
@@ -5455,7 +5642,8 @@ end
--- @param yaw integer
--- @param translation Vec3s
--- @return integer
---- Retrieves the current animation flags and calculates the translation for Mario's animation, rotating it into the global coordinate system based on `yaw`. Useful for determining positional offsets from animations (e.g., stepping forward in a walk animation) and applying them to Mario's position
+--- Retrieves the current animation flags and calculates the translation for Mario's animation, rotating it into the global coordinate system based on `yaw`.
+--- Useful for determining positional offsets from animations (e.g., stepping forward in a walk animation) and applying them to Mario's position
function find_mario_anim_flags_and_translation(o, yaw, translation)
-- ...
end
@@ -5468,7 +5656,8 @@ end
--- @param m MarioState
--- @return integer
---- Determines the vertical translation from Mario's animation (how much the animation moves Mario up or down). Returns the y-component of the animation's translation. Useful for adjusting Mario's vertical position based on an ongoing animation (e.g., a bounce or jump)
+--- Determines the vertical translation from Mario's animation (how much the animation moves Mario up or down). Returns the y-component of the animation's translation.
+--- Useful for adjusting Mario's vertical position based on an ongoing animation (e.g., a bounce or jump)
function return_mario_anim_y_translation(m)
-- ...
end
@@ -5488,7 +5677,8 @@ function play_mario_jump_sound(m)
end
--- @param m MarioState
---- Adjusts the pitch/volume of Mario's movement-based sounds according to his forward velocity (`m.forwardVel`). Useful for adding dynamic audio feedback based on Mario's running or walking speed
+--- Adjusts the pitch/volume of Mario's movement-based sounds according to his forward velocity (`m.forwardVel`).
+--- Useful for adding dynamic audio feedback based on Mario's running or walking speed
function adjust_sound_for_speed(m)
-- ...
end
@@ -5525,14 +5715,16 @@ end
--- @param m MarioState
--- @param soundBits integer
---- Plays a heavier, more forceful landing sound, possibly for ground pounds or large impacts. Takes into account whether Mario has a metal cap equipped. Useful for making big impact landings stand out aurally
+--- Plays a heavier, more forceful landing sound, possibly for ground pounds or large impacts. Takes into account whether Mario has a metal cap equipped.
+--- Useful for making big impact landings stand out aurally
function play_mario_heavy_landing_sound(m, soundBits)
-- ...
end
--- @param m MarioState
--- @param soundBits integer
---- A variant of `play_mario_heavy_landing_sound` that ensures the sound is only played once per action (using `play_mario_action_sound` internally). Useful for consistent heavy landing effects without repetition
+--- A variant of `play_mario_heavy_landing_sound` that ensures the sound is only played once per action (using `play_mario_action_sound` internally).
+--- Useful for consistent heavy landing effects without repetition
function play_mario_heavy_landing_sound_once(m, soundBits)
-- ...
end
@@ -5574,21 +5766,24 @@ end
--- @param m MarioState
--- @param speed number
---- Sets Mario's forward velocity (`m.forwardVel`) and updates `slideVelX/Z` and `m.vel` accordingly, based on `m.faceAngle.y`. Useful for controlling Mario's speed and direction in various actions (jumping, walking, sliding, etc.)
+--- Sets Mario's forward velocity (`m.forwardVel`) and updates `slideVelX/Z` and `m.vel` accordingly, based on `m.faceAngle.y`.
+--- Useful for controlling Mario's speed and direction in various actions (jumping, walking, sliding, etc.)
function mario_set_forward_vel(m, speed)
-- ...
end
--- @param m MarioState
--- @return integer
---- Retrieves the slipperiness class of Mario's current floor, ranging from not slippery to very slippery. Considers terrain types and special surfaces. Useful for controlling friction, movement speed adjustments, and whether Mario slips or walks
+--- Retrieves the slipperiness class of Mario's current floor, ranging from not slippery to very slippery. Considers terrain types and special surfaces.
+--- Useful for controlling friction, movement speed adjustments, and whether Mario slips or walks
function mario_get_floor_class(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Computes a value added to terrain sounds, depending on the floor's type (sand, snow, water, etc.) and slipperiness. This returns a sound 'addend' used with sound effects. Useful for playing context-specific footstep or movement sounds
+--- Computes a value added to terrain sounds, depending on the floor's type (sand, snow, water, etc.) and slipperiness. This returns a sound 'addend' used with sound effects.
+--- Useful for playing context-specific footstep or movement sounds
function mario_get_terrain_sound_addend(m)
-- ...
end
@@ -5597,7 +5792,8 @@ end
--- @param offset number
--- @param radius number
--- @return Surface
---- Checks for and resolves wall collisions at a given position `pos`, returning the last wall encountered. Primarily used to prevent Mario from going through walls. Useful for collision detection when updating Mario's movement or adjusting his position
+--- Checks for and resolves wall collisions at a given position `pos`, returning the last wall encountered. Primarily used to prevent Mario from going through walls.
+--- Useful for collision detection when updating Mario's movement or adjusting his position
function resolve_and_return_wall_collisions(pos, offset, radius)
-- ...
end
@@ -5615,7 +5811,8 @@ end
--- @param height number
--- @return number
--- @return Surface ceil
---- Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer). Returns the ceiling height and surface
+--- Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer).
+--- Returns the ceiling height and surface
function vec3f_find_ceil(pos, height)
-- ...
end
@@ -5624,7 +5821,9 @@ end
--- @param height number
--- @return number
--- @return Surface ceil
---- Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer). Prevents exposed ceiling bug. Returns the ceiling height and surface
+--- Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer).
+--- Prevents exposed ceiling bug.
+--- Returns the ceiling height and surface
function vec3f_mario_ceil(pos, height)
-- ...
end
@@ -5632,14 +5831,16 @@ end
--- @param m MarioState
--- @param turnYaw integer
--- @return integer
---- Determines if Mario is facing downhill relative to his floor angle, optionally accounting for forward velocity direction. Returns true if he is oriented down the slope. Useful for deciding if Mario will walk or slide on sloped floors
+--- Determines if Mario is facing downhill relative to his floor angle, optionally accounting for forward velocity direction. Returns true if he is oriented down the slope.
+--- Useful for deciding if Mario will walk or slide on sloped floors
function mario_facing_downhill(m, turnYaw)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks whether Mario's current floor is slippery based on both the floor's surface class and Mario's environment (e.g., special slides). Useful for deciding if Mario should transition to sliding or maintain normal traction
+--- Checks whether Mario's current floor is slippery based on both the floor's surface class and Mario's environment (e.g., special slides).
+--- Useful for deciding if Mario should transition to sliding or maintain normal traction
function mario_floor_is_slippery(m)
-- ...
end
@@ -5653,7 +5854,8 @@ end
--- @param m MarioState
--- @return integer
---- Checks whether Mario's floor is steep enough to cause special behavior, such as forcing slides or preventing certain actions. Returns true if the slope is too steep. Useful for restricting normal movement on surfaces with extreme angles
+--- Checks whether Mario's floor is steep enough to cause special behavior, such as forcing slides or preventing certain actions. Returns true if the slope is too steep.
+--- Useful for restricting normal movement on surfaces with extreme angles
function mario_floor_is_steep(m)
-- ...
end
@@ -5662,7 +5864,8 @@ end
--- @param angleFromMario integer
--- @param distFromMario number
--- @return number
---- Finds the floor height relative to Mario's current position given a polar displacement (`angleFromMario`, `distFromMario`). Useful for determining height differentials ahead or behind Mario, e.g. for slope checks or collision logic
+--- Finds the floor height relative to Mario's current position given a polar displacement (`angleFromMario`, `distFromMario`).
+--- Useful for determining height differentials ahead or behind Mario, e.g. for slope checks or collision logic
function find_floor_height_relative_polar(m, angleFromMario, distFromMario)
-- ...
end
@@ -5670,19 +5873,22 @@ end
--- @param m MarioState
--- @param yawOffset integer
--- @return integer
---- Returns a slope angle based on comparing the floor heights slightly in front and behind Mario. It essentially calculates how steep the ground is in a specific yaw direction. Useful for slope-based calculations such as setting walking or sliding behaviors
+--- Returns a slope angle based on comparing the floor heights slightly in front and behind Mario. It essentially calculates how steep the ground is in a specific yaw direction.
+--- Useful for slope-based calculations such as setting walking or sliding behaviors
function find_floor_slope(m, yawOffset)
-- ...
end
--- @param m MarioState
---- Updates the background noise and camera modes based on Mario's action. Especially relevant for actions like first-person view or sleeping. Useful for synchronizing camera behavior and ambient sounds with Mario's state changes
+--- Updates the background noise and camera modes based on Mario's action. Especially relevant for actions like first-person view or sleeping.
+--- Useful for synchronizing camera behavior and ambient sounds with Mario's state changes
function update_mario_sound_and_camera(m)
-- ...
end
--- @param m MarioState
---- Transitions Mario into ACT_STEEP_JUMP if the floor is too steep, adjusting his forward velocity and orientation accordingly. Useful for forcing special jump states on surfaces exceeding normal slope limits
+--- Transitions Mario into ACT_STEEP_JUMP if the floor is too steep, adjusting his forward velocity and orientation accordingly.
+--- Useful for forcing special jump states on surfaces exceeding normal slope limits
function set_steep_jump_action(m)
-- ...
end
@@ -5741,7 +5947,8 @@ end
--- @param m MarioState
--- @return integer
---- Checks for inputs that cause common action transitions (jump, freefall, walking, sliding). Useful for quickly exiting certain stationary actions when Mario begins moving or leaves the floor
+--- Checks for inputs that cause common action transitions (jump, freefall, walking, sliding).
+--- Useful for quickly exiting certain stationary actions when Mario begins moving or leaves the floor
function check_common_action_exits(m)
-- ...
end
@@ -5755,7 +5962,8 @@ end
--- @param m MarioState
--- @return integer
---- Transitions Mario from being underwater to a walking state. Resets camera to the default mode and can handle object-holding states. Useful for restoring standard ground movement when emerging from water
+--- Transitions Mario from being underwater to a walking state. Resets camera to the default mode and can handle object-holding states.
+--- Useful for restoring standard ground movement when emerging from water
function transition_submerged_to_walking(m)
-- ...
end
@@ -5776,7 +5984,8 @@ end
--- @param m MarioState
--- @return integer
---- Forces Mario into an idle state, either `ACT_IDLE` or `ACT_WATER_IDLE` depending on whether he is submerged. Useful for quickly resetting Mario's state to an idle pose under special conditions (e.g., cutscene triggers)
+--- Forces Mario into an idle state, either `ACT_IDLE` or `ACT_WATER_IDLE` depending on whether he is submerged.
+--- Useful for quickly resetting Mario's state to an idle pose under special conditions (e.g., cutscene triggers)
function force_idle_state(m)
-- ...
end
@@ -5813,26 +6022,31 @@ end
--- @param frame1 integer
--- @param frame2 integer
--- @param frame3 integer
---- Plays a spinning sound at specific animation frames for flips (usually side flips or certain jump flips). If the current animation frame matches any of the specified frames, it triggers `SOUND_ACTION_SPIN`
+--- Plays a spinning sound at specific animation frames for flips (usually side flips or certain jump flips).
+--- If the current animation frame matches any of the specified frames, it triggers `SOUND_ACTION_SPIN`
function play_flip_sounds(m, frame1, frame2, frame3)
-- ...
end
--- @param m MarioState
---- Plays a unique sound when Mario has fallen a significant distance without being invulnerable, twirling, or flying. If the fall exceeds a threshold, triggers a "long fall" exclamation. Also sets a flag to prevent repeated triggering
+--- Plays a unique sound when Mario has fallen a significant distance without being invulnerable, twirling, or flying.
+--- If the fall exceeds a threshold, triggers a "long fall" exclamation. Also sets a flag to prevent repeated triggering
function play_far_fall_sound(m)
-- ...
end
--- @param m MarioState
---- Plays a knockback sound effect if Mario is hit or knocked back with significant velocity. The specific sound differs depending on whether Mario's forward velocity is high enough to be considered a strong knockback
+--- Plays a knockback sound effect if Mario is hit or knocked back with significant velocity. The specific sound differs
+--- depending on whether Mario's forward velocity is high enough to be considered a strong knockback
function play_knockback_sound(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Allows Mario to 'lava boost' off a lava wall, reorienting him to face away from the wall and adjusting forward velocity. Increases Mario's hurt counter if he's not metal, plays a burning sound, and transitions his action to `ACT_LAVA_BOOST`. Useful for handling collisions with lava walls, giving Mario a strong upward/forward boost at the cost of health
+--- Allows Mario to 'lava boost' off a lava wall, reorienting him to face away from the wall and adjusting forward velocity.
+--- Increases Mario's hurt counter if he's not metal, plays a burning sound, and transitions his action to `ACT_LAVA_BOOST`.
+--- Useful for handling collisions with lava walls, giving Mario a strong upward/forward boost at the cost of health
function lava_boost_on_wall(m)
-- ...
end
@@ -5840,21 +6054,27 @@ end
--- @param m MarioState
--- @param hardFallAction integer
--- @return integer
---- Evaluates whether Mario should take fall damage based on the height difference between his peak and current position. If the fall is large enough and does not occur over burning surfaces or while twirling, Mario may get hurt or enter a hard fall action. If the fall is significant but not extreme, minimal damage and a squish effect may be applied. Useful for determining if Mario's fall warrants a health penalty or a special landing action
+--- Evaluates whether Mario should take fall damage based on the height difference between his peak and current position.
+--- If the fall is large enough and does not occur over burning surfaces or while twirling, Mario may get hurt or enter
+--- a hard fall action. If the fall is significant but not extreme, minimal damage and a squish effect may be applied.
+--- Useful for determining if Mario's fall warrants a health penalty or a special landing action
function check_fall_damage(m, hardFallAction)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks if Mario should perform a kick or a dive while in mid-air, depending on his current forward velocity. Pressing the B button in the air can trigger a jump kick (at lower speeds) or a dive (at higher speeds)
+--- Checks if Mario should perform a kick or a dive while in mid-air, depending on his current forward velocity.
+--- Pressing the B button in the air can trigger a jump kick (at lower speeds) or a dive (at higher speeds)
function check_kick_or_dive_in_air(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Determines whether Mario should become stuck in the ground after landing, specifically for soft terrain such as snow or sand, provided certain conditions are met (height of the fall, normal of the floor, etc.). Returns true if Mario should be stuck, false otherwise
+--- Determines whether Mario should become stuck in the ground after landing, specifically for soft terrain such as snow
+--- or sand, provided certain conditions are met (height of the fall, normal of the floor, etc.).
+--- Returns true if Mario should be stuck, false otherwise
function should_get_stuck_in_ground(m)
-- ...
end
@@ -5862,50 +6082,59 @@ end
--- @param m MarioState
--- @param hardFallAction integer
--- @return integer
---- Checks if Mario should get stuck in the ground after a large fall onto soft terrain (like snow or sand) or if he should just proceed with regular fall damage calculations. If the terrain and height conditions are met, Mario's action changes to being stuck in the ground. Otherwise, normal fall damage logic applies
+--- Checks if Mario should get stuck in the ground after a large fall onto soft terrain (like snow or sand) or if he
+--- should just proceed with regular fall damage calculations. If the terrain and height conditions are met, Mario's
+--- action changes to being stuck in the ground. Otherwise, normal fall damage logic applies
function check_fall_damage_or_get_stuck(m, hardFallAction)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks for the presence of a horizontal wind surface under Mario. If found, applies a push force to Mario's horizontal velocity. Caps speed at certain thresholds, updates Mario's forward velocity and yaw for sliding/wind movement
+--- Checks for the presence of a horizontal wind surface under Mario. If found, applies a push force to Mario's horizontal
+--- velocity. Caps speed at certain thresholds, updates Mario's forward velocity and yaw for sliding/wind movement
function check_horizontal_wind(m)
-- ...
end
--- @param m MarioState
---- Updates Mario's air movement while allowing him to turn. Checks horizontal wind and applies a moderate amount of drag, approaches the forward velocity toward zero if no input is pressed, and modifies forward velocity/angle based on stick input
+--- Updates Mario's air movement while allowing him to turn. Checks horizontal wind and applies a moderate amount of drag,
+--- approaches the forward velocity toward zero if no input is pressed, and modifies forward velocity/angle based on stick input
function update_air_with_turn(m)
-- ...
end
--- @param m MarioState
---- Updates Mario's air movement without directly turning his facing angle to match his intended yaw. Instead, Mario can move sideways relative to his current facing direction. Also checks horizontal wind and applies drag
+--- Updates Mario's air movement without directly turning his facing angle to match his intended yaw. Instead, Mario can
+--- move sideways relative to his current facing direction. Also checks horizontal wind and applies drag
function update_air_without_turn(m)
-- ...
end
--- @param m MarioState
---- Updates Mario's movement when in actions like lava boost or twirling in mid-air. Applies player input to adjust forward velocity and facing angle, but in a more restricted manner compared to standard jump movement. Used by `ACT_LAVA_BOOST` and `ACT_TWIRLING`
+--- Updates Mario's movement when in actions like lava boost or twirling in mid-air. Applies player input to adjust forward velocity
+--- and facing angle, but in a more restricted manner compared to standard jump movement. Used by `ACT_LAVA_BOOST` and `ACT_TWIRLING`
function update_lava_boost_or_twirling(m)
-- ...
end
--- @param m MarioState
---- Calculates and applies a change in Mario's yaw while flying, based on horizontal stick input. Approaches a target yaw velocity and sets Mario's roll angle to simulate banking turns. This results in a more natural, curved flight path
+--- Calculates and applies a change in Mario's yaw while flying, based on horizontal stick input. Approaches a target yaw velocity
+--- and sets Mario's roll angle to simulate banking turns. This results in a more natural, curved flight path
function update_flying_yaw(m)
-- ...
end
--- @param m MarioState
---- Calculates and applies a change in Mario's pitch while flying, based on vertical stick input. Approaches a target pitch velocity and clamps the final pitch angle to a certain range, simulating a smooth flight control
+--- Calculates and applies a change in Mario's pitch while flying, based on vertical stick input. Approaches a target pitch velocity
+--- and clamps the final pitch angle to a certain range, simulating a smooth flight control
function update_flying_pitch(m)
-- ...
end
--- @param m MarioState
---- Handles the complete flying logic for Mario (usually with the wing cap). Continuously updates pitch and yaw based on controller input, applies drag, and adjusts forward velocity. Also updates Mario's model angles for flight animations
+--- Handles the complete flying logic for Mario (usually with the wing cap). Continuously updates pitch and yaw based on controller input,
+--- applies drag, and adjusts forward velocity. Also updates Mario's model angles for flight animations
function update_flying(m)
-- ...
end
@@ -5915,7 +6144,9 @@ end
--- @param animation integer
--- @param stepArg integer
--- @return integer
---- Performs a standard step update for air actions without knockback, typically used for jumps or freefalls. Updates Mario's velocity (and possibly checks horizontal wind), then calls `perform_air_step` with given `stepArg`. Handles how Mario lands, hits walls, grabs ledges, or grabs ceilings. Optionally sets an animation
+--- Performs a standard step update for air actions without knockback, typically used for jumps or freefalls.
+--- Updates Mario's velocity (and possibly checks horizontal wind), then calls `perform_air_step` with given `stepArg`.
+--- Handles how Mario lands, hits walls, grabs ledges, or grabs ceilings. Optionally sets an animation
function common_air_action_step(m, landAction, animation, stepArg)
-- ...
end
@@ -5926,34 +6157,40 @@ end
--- @param animation integer
--- @param speed number
--- @return integer
---- A shared step update used for airborne knockback states (both forward and backward). Updates velocity, calls `perform_air_step`, and handles wall collisions or landing transitions to appropriate ground knockback actions. Also sets animation and speed
+--- A shared step update used for airborne knockback states (both forward and backward). Updates velocity, calls `perform_air_step`,
+--- and handles wall collisions or landing transitions to appropriate ground knockback actions. Also sets animation and speed
function common_air_knockback_step(m, landAction, hardFallAction, animation, speed)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks if Mario should wall kick after performing an air hit against a wall. If the input conditions (e.g., pressing A) and the `wallKickTimer` allow, Mario transitions to `ACT_WALL_KICK_AIR`
+--- Checks if Mario should wall kick after performing an air hit against a wall. If the input conditions (e.g., pressing A)
+--- and the `wallKickTimer` allow, Mario transitions to `ACT_WALL_KICK_AIR`
function check_wall_kick(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks for and handles common conditions that would cancel Mario's current air action. This includes transitioning to a water plunge if below the water level, becoming squished if appropriate, or switching to vertical wind action if on certain wind surfaces. Also resets `m.quicksandDepth`
+--- Checks for and handles common conditions that would cancel Mario's current air action. This includes transitioning
+--- to a water plunge if below the water level, becoming squished if appropriate, or switching to vertical wind action
+--- if on certain wind surfaces. Also resets `m.quicksandDepth`
function check_common_airborne_cancels(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Executes Mario's current airborne action by first checking common airborne cancels, then playing a far-fall sound if needed. Dispatches to the appropriate action function, such as jump, double jump, freefall, etc
+--- Executes Mario's current airborne action by first checking common airborne cancels, then playing a far-fall sound if needed.
+--- Dispatches to the appropriate action function, such as jump, double jump, freefall, etc
function mario_execute_airborne_action(m)
-- ...
end
--- @param m MarioState
---- Spawns leaf particles when Mario climbs a tree, if he is sufficiently high above the floor. In Shifting Sand Land, the leaf effect spawns higher due to the taller palm trees
+--- Spawns leaf particles when Mario climbs a tree, if he is sufficiently high above the floor.
+--- In Shifting Sand Land, the leaf effect spawns higher due to the taller palm trees
function add_tree_leaf_particles(m)
-- ...
end
@@ -5968,7 +6205,8 @@ end
--- @param m MarioState
--- @param offsetY number
--- @return integer
---- Sets Mario's position and alignment while he is on a climbable pole or tree. This function checks collisions with floors and ceilings, and updates Mario's action if he leaves the pole or touches the floor. Useful for ensuring Mario's correct placement and transitions when climbing poles or trees
+--- Sets Mario's position and alignment while he is on a climbable pole or tree. This function checks collisions with floors and ceilings, and updates Mario's action if he leaves the pole or touches the floor.
+--- Useful for ensuring Mario's correct placement and transitions when climbing poles or trees
function set_pole_position(m, offsetY)
-- ...
end
@@ -6036,7 +6274,8 @@ end
--- @param m MarioState
--- @return integer
---- Executes Mario's current automatic action (e.g., climbing a pole, hanging, ledge-grabbing) by calling the corresponding function. It also checks for common cancellations, like falling into water. Returns true if the action was canceled and a new action was set, or false otherwise
+--- Executes Mario's current automatic action (e.g., climbing a pole, hanging, ledge-grabbing) by calling the corresponding function. It also checks for common cancellations, like falling into water.
+--- Returns true if the action was canceled and a new action was set, or false otherwise
function mario_execute_automatic_action(m)
-- ...
end
@@ -6153,7 +6392,8 @@ end
--- @param m MarioState
--- @return integer
---- Tilts Mario's body according to his running speed and slope angle. Calculates a pitch offset used while running to simulate leaning forward at higher speeds or on slopes
+--- Tilts Mario's body according to his running speed and slope angle.
+--- Calculates a pitch offset used while running to simulate leaning forward at higher speeds or on slopes
function tilt_body_running(m)
-- ...
end
@@ -6161,7 +6401,8 @@ end
--- @param m MarioState
--- @param frame1 integer
--- @param frame2 integer
---- Checks the current animation frame against two specified frames to trigger footstep sounds. Also chooses specific sounds if Mario is wearing Metal Cap or is in quicksand
+--- Checks the current animation frame against two specified frames to trigger footstep sounds.
+--- Also chooses specific sounds if Mario is wearing Metal Cap or is in quicksand
function play_step_sound(m, frame1, frame2)
-- ...
end
@@ -6183,7 +6424,8 @@ function begin_walking_action(m, forwardVel, action, actionArg)
end
--- @param m MarioState
---- Checks if Mario is near an edge while moving slowly and the floor below that edge is significantly lower. If the conditions are met, transitions Mario into a ledge-climb-down action and positions him accordingly on the edge
+--- Checks if Mario is near an edge while moving slowly and the floor below that edge is significantly lower.
+--- If the conditions are met, transitions Mario into a ledge-climb-down action and positions him accordingly on the edge
function check_ledge_climb_down(m)
-- ...
end
@@ -6208,7 +6450,9 @@ end
--- @param m MarioState
--- @param accel number
--- @param lossFactor number
---- Adjusts Mario's slide velocity and facing angle when on a slope. Calculates slope direction and steepness, then modifies velocity accordingly (speed up downhill, slow uphill). Handles facing-direction changes and maximum speed limits
+--- Adjusts Mario's slide velocity and facing angle when on a slope.
+--- Calculates slope direction and steepness, then modifies velocity accordingly (speed up downhill, slow uphill).
+--- Handles facing-direction changes and maximum speed limits
function update_sliding_angle(m, accel, lossFactor)
-- ...
end
@@ -6216,13 +6460,16 @@ end
--- @param m MarioState
--- @param stopSpeed number
--- @return integer
---- Updates Mario's sliding state each frame, applying additional friction or acceleration based on the surface's slipperiness. Also checks if speed has slowed below a threshold to end the slide. Returns `true` if sliding has stopped
+--- Updates Mario's sliding state each frame, applying additional friction or acceleration based on the surface's slipperiness.
+--- Also checks if speed has slowed below a threshold to end the slide.
+--- Returns `true` if sliding has stopped
function update_sliding(m, stopSpeed)
-- ...
end
--- @param m MarioState
---- Applies acceleration or deceleration based on the slope of the floor. On downward slopes, Mario gains speed, while on upward slopes, Mario loses speed
+--- Applies acceleration or deceleration based on the slope of the floor.
+--- On downward slopes, Mario gains speed, while on upward slopes, Mario loses speed
function apply_slope_accel(m)
-- ...
end
@@ -6230,7 +6477,8 @@ end
--- @param m MarioState
--- @param frictionFactor number
--- @return integer
---- Applies friction-like deceleration if the floor is flat, or slope-based acceleration if the floor is sloped. Capped in such a way that Mario eventually stops or stabilizes on flatter ground
+--- Applies friction-like deceleration if the floor is flat, or slope-based acceleration if the floor is sloped.
+--- Capped in such a way that Mario eventually stops or stabilizes on flatter ground
function apply_landing_accel(m, frictionFactor)
-- ...
end
@@ -6244,66 +6492,76 @@ end
--- @param m MarioState
--- @param decelCoef number
--- @return integer
---- Approaches Mario's forward velocity toward zero at a rate dependent on the floor's slipperiness. This function can completely stop Mario if the slope is gentle enough or if friction is high
+--- Approaches Mario's forward velocity toward zero at a rate dependent on the floor's slipperiness.
+--- This function can completely stop Mario if the slope is gentle enough or if friction is high
function apply_slope_decel(m, decelCoef)
-- ...
end
--- @param m MarioState
--- @return integer
---- Gradually reduces Mario's forward speed to zero over time on level ground, unless otherwise influenced by slope or friction. Returns true if Mario's speed reaches zero, meaning he has stopped
+--- Gradually reduces Mario's forward speed to zero over time on level ground, unless otherwise influenced by slope or friction.
+--- Returns true if Mario's speed reaches zero, meaning he has stopped
function update_decelerating_speed(m)
-- ...
end
--- @param m MarioState
---- Updates Mario's walking speed based on player input and floor conditions (e.g., a slow floor or quicksand). Caps speed at a certain value and may reduce it slightly on steep slopes
+--- Updates Mario's walking speed based on player input and floor conditions (e.g., a slow floor or quicksand).
+--- Caps speed at a certain value and may reduce it slightly on steep slopes
function update_walking_speed(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks if Mario should begin sliding, based on player input (facing downhill, pressing the analog stick backward, or on a slide terrain), and current floor steepness. Returns true if conditions to slide are met.
+--- Checks if Mario should begin sliding, based on player input (facing downhill, pressing the analog stick backward, or on a slide terrain), and current floor steepness.
+--- Returns true if conditions to slide are met.
function should_begin_sliding(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks if the analog stick is held significantly behind Mario's current facing angle. Returns true if the stick is far enough in the opposite direction, indicating Mario wants to move backward
+--- Checks if the analog stick is held significantly behind Mario's current facing angle.
+--- Returns true if the stick is far enough in the opposite direction, indicating Mario wants to move backward
function analog_stick_held_back(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Checks if the B button was pressed to either initiate a dive (if moving fast enough) or a punch (if moving slowly). Returns `true` if the action was changed to either a dive or a punching attack
+--- Checks if the B button was pressed to either initiate a dive (if moving fast enough) or a punch (if moving slowly).
+--- Returns `true` if the action was changed to either a dive or a punching attack
function check_ground_dive_or_punch(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Begins a braking action if Mario's forward velocity is high enough or transitions to a decelerating action otherwise. Also handles the scenario where Mario is up against a wall, transitioning to a standing state
+--- Begins a braking action if Mario's forward velocity is high enough or transitions to a decelerating action otherwise.
+--- Also handles the scenario where Mario is up against a wall, transitioning to a standing state
function begin_braking_action(m)
-- ...
end
--- @param m MarioState
---- Handles the animation and audio (footstep sounds) for normal walking or running. The specific animation used (tiptoe, walk, or run) depends on Mario's current speed
+--- Handles the animation and audio (footstep sounds) for normal walking or running.
+--- The specific animation used (tiptoe, walk, or run) depends on Mario's current speed
function anim_and_audio_for_walk(m)
-- ...
end
--- @param m MarioState
---- Plays the appropriate animation and footstep sounds for walking while carrying a lighter object (like a small box). Adjusts the animation speed dynamically based on Mario's velocity
+--- Plays the appropriate animation and footstep sounds for walking while carrying a lighter object (like a small box).
+--- Adjusts the animation speed dynamically based on Mario's velocity
function anim_and_audio_for_hold_walk(m)
-- ...
end
--- @param m MarioState
---- Plays the appropriate animation and footstep sounds for walking while carrying a heavy object. Sets the character animation speed based on Mario's intended movement speed
+--- Plays the appropriate animation and footstep sounds for walking while carrying a heavy object.
+--- Sets the character animation speed based on Mario's intended movement speed
function anim_and_audio_for_heavy_walk(m)
-- ...
end
@@ -6317,20 +6575,23 @@ end
--- @param m MarioState
--- @param startYaw integer
---- Applies a left/right tilt to Mario's torso (and some pitch if running fast) while walking or running. The tilt is based on his change in yaw and current speed, giving a leaning appearance when turning
+--- Applies a left/right tilt to Mario's torso (and some pitch if running fast) while walking or running.
+--- The tilt is based on his change in yaw and current speed, giving a leaning appearance when turning
function tilt_body_walking(m, startYaw)
-- ...
end
--- @param m MarioState
--- @param startYaw integer
---- Tilts Mario's torso and head while riding a shell on the ground to reflect turning. Similar to other tilt functions but tuned for shell-riding speeds and angles
+--- Tilts Mario's torso and head while riding a shell on the ground to reflect turning.
+--- Similar to other tilt functions but tuned for shell-riding speeds and angles
function tilt_body_ground_shell(m, startYaw)
-- ...
end
--- @param m MarioState
---- Tilts Mario's torso while butt sliding based on analog input direction and magnitude. Gives the appearance that Mario is balancing or leaning into a turn
+--- Tilts Mario's torso while butt sliding based on analog input direction and magnitude.
+--- Gives the appearance that Mario is balancing or leaning into a turn
function tilt_body_butt_slide(m)
-- ...
end
@@ -6350,7 +6611,8 @@ end
--- @param airAction integer
--- @param animation integer
--- @return integer
---- Builds on `common_slide_action` by also allowing Mario to jump out of a slide if A is pressed after a short delay. If the sliding slows enough, Mario transitions to a specified stopping action
+--- Builds on `common_slide_action` by also allowing Mario to jump out of a slide if A is pressed after a short delay.
+--- If the sliding slows enough, Mario transitions to a specified stopping action
function common_slide_action_with_jump(m, stopAction, jumpAction, airAction, animation)
-- ...
end
@@ -6360,7 +6622,8 @@ end
--- @param airAction integer
--- @param animation integer
--- @return integer
---- Updates Mario's sliding state where he is on his stomach. Similar to other slide actions but has a chance to roll out if A or B is pressed. Uses `common_slide_action` for the core movement logic
+--- Updates Mario's sliding state where he is on his stomach. Similar to other slide actions but has a chance to roll out if A or B is pressed.
+--- Uses `common_slide_action` for the core movement logic
function stomach_slide_action(m, stopAction, airAction, animation)
-- ...
end
@@ -6391,7 +6654,8 @@ end
--- @param endAction integer
--- @param airAction integer
--- @return integer
---- Handles a special landing in quicksand after a jump. Over several frames, Mario emerges from the quicksand. First part of the animation reduces his quicksand depth. Ends with a normal landing action or transitions back to air if he leaves the ground
+--- Handles a special landing in quicksand after a jump. Over several frames, Mario emerges from the quicksand.
+--- First part of the animation reduces his quicksand depth. Ends with a normal landing action or transitions back to air if he leaves the ground
function quicksand_jump_land_action(m, animation1, animation2, endAction, airAction)
-- ...
end
@@ -6427,14 +6691,17 @@ end
--- @param m MarioState
--- @return integer
---- Checks for and handles common conditions that would cancel Mario's current object action. This includes transitioning to a water plunge if below the water level, becoming squished if appropriate, or switching to standing death action if Mario is dead
+--- Checks for and handles common conditions that would cancel Mario's current object action. This includes transitioning
+--- to a water plunge if below the water level, becoming squished if appropriate, or switching to standing death action
+--- if Mario is dead
function check_common_object_cancels(m)
-- ...
end
--- @param m MarioState
--- @return integer
---- Executes Mario's current object action by first checking common object cancels, then updating quicksand state. Dispatches to the appropriate action function, such as punching, throwing, picking up Bowser, etc
+--- Executes Mario's current object action by first checking common object cancels, then updating quicksand state.
+--- Dispatches to the appropriate action function, such as punching, throwing, picking up Bowser, etc
function mario_execute_object_action(m)
-- ...
end
@@ -6503,7 +6770,8 @@ end
--- @param m MarioState
--- @return integer
---- Executes Mario's current object action by first checking common stationary cancels, then updating quicksand state. Dispatches to the appropriate action function, such as idle, sleeping, crouching, ect
+--- Executes Mario's current object action by first checking common stationary cancels, then updating quicksand state.
+--- Dispatches to the appropriate action function, such as idle, sleeping, crouching, ect
function mario_execute_stationary_action(m)
-- ...
end
@@ -6545,7 +6813,8 @@ end
--- @param m MarioState
--- @return integer
---- Executes Mario's current submerged action by first checking common submerged cancels, then setting quicksand depth and head angles to 0. Dispatches to the appropriate action function, such as breaststroke, flutterkick, water punch, ect
+--- Executes Mario's current submerged action by first checking common submerged cancels, then setting quicksand depth and head angles to 0.
+--- Dispatches to the appropriate action function, such as breaststroke, flutterkick, water punch, ect
function mario_execute_submerged_action(m)
-- ...
end
@@ -6947,7 +7216,8 @@ function degrees_to_sm64(degreesAngle)
end
--- @param mtx Mat4
---- Sets the 4x4 floating-point matrix `mtx` to all zeros. Unless you really need this-It's reccomended to use mtxf_identity instead.
+--- Sets the 4x4 floating-point matrix `mtx` to all zeros.
+--- Unless you really need this-It's reccomended to use mtxf_identity instead.
function mtxf_zero(mtx)
-- ...
end
@@ -7807,14 +8077,19 @@ end
--- @param offset integer
--- @param origin ModFsFileSeek
--- @return boolean
---- Sets the current position of a modfs `file`. If `origin` is `FILE_SEEK_SET`, file position is set to `offset`. If `origin` is `FILE_SEEK_CUR`, `offset` is added to file current position. If `origin` is `FILE_SEEK_END`, file position is set to `end of file + offset`. Returns true on success
+--- Sets the current position of a modfs `file`.
+--- If `origin` is `FILE_SEEK_SET`, file position is set to `offset`.
+--- If `origin` is `FILE_SEEK_CUR`, `offset` is added to file current position.
+--- If `origin` is `FILE_SEEK_END`, file position is set to `end of file + offset`.
+--- Returns true on success
function mod_fs_file_seek(file, offset, origin)
-- ...
end
--- @param file ModFsFile
--- @return boolean
---- Sets the current position of a modfs `file` to its beginning. Returns true on success
+--- Sets the current position of a modfs `file` to its beginning.
+--- Returns true on success
function mod_fs_file_rewind(file)
-- ...
end
@@ -8169,19 +8444,22 @@ function obj_splash(waterY, objY)
end
--- @return integer
---- Generic object move function. Handles walls, water, floors, and gravity. Returns flags for certain interactions
+--- Generic object move function. Handles walls, water, floors, and gravity.
+--- Returns flags for certain interactions
function object_step()
-- ...
end
--- @return integer
---- Takes an object step but does not orient with the object's floor. Used for boulders, falling pillars, and the rolling snowman body
+--- Takes an object step but does not orient with the object's floor.
+--- Used for boulders, falling pillars, and the rolling snowman body
function object_step_without_floor_orient()
-- ...
end
--- @param obj Object
---- Don't use this function outside of of a context where the current object and `obj` are the same. Moves `obj` based on a seemingly random mix of using either the current obj or `obj`'s fields
+--- Don't use this function outside of of a context where the current object and `obj` are the same.
+--- Moves `obj` based on a seemingly random mix of using either the current obj or `obj`'s fields
function obj_move_xyz_using_fvel_and_yaw(obj)
-- ...
end
@@ -8320,7 +8598,8 @@ end
--- @param goal integer
--- @param range integer
--- @return integer
---- A series of checks using sin and cos to see if a given angle is facing in the same direction of a given angle, within a certain range
+--- A series of checks using sin and cos to see if a given angle is facing in the same direction
+--- of a given angle, within a certain range
function obj_check_if_facing_toward_angle(base, goal, range)
-- ...
end
@@ -8360,13 +8639,15 @@ end
--- @param collisionFlags integer
--- @param floor Surface
---- Checks if `floor`'s type is burning or death plane and if so change the current object's action accordingly
+--- Checks if `floor`'s type is burning or death plane and if so change the
+--- current object's action accordingly
function obj_check_floor_death(collisionFlags, floor)
-- ...
end
--- @return integer
---- Controls an object dying in lava by creating smoke, sinking the object, playing audio, and eventually despawning it. Returns TRUE when the obj is dead
+--- Controls an object dying in lava by creating smoke, sinking the object, playing
+--- audio, and eventually despawning it. Returns TRUE when the obj is dead
function obj_lava_death()
-- ...
end
@@ -8598,7 +8879,10 @@ end
--- @param endScale number
--- @return integer
--- @return number scaleVel
---- Begin by increasing the current object's scale by `scaleVel`, and slowly decreasing `scaleVel`. Once the object starts to shrink, wait a bit, and then begin to scale the object toward `endScale`. The first time it reaches below `shootFireScale` during this time, return 1. Return -1 once it's reached endScale
+--- Begin by increasing the current object's scale by `scaleVel`, and slowly decreasing `scaleVel`.
+--- Once the object starts to shrink, wait a bit, and then begin to scale the object toward `endScale`.
+--- The first time it reaches below `shootFireScale` during this time, return 1.
+--- Return -1 once it's reached endScale
function obj_grow_then_shrink(scaleVel, shootFireScale, endScale)
-- ...
end
@@ -8984,7 +9268,12 @@ end
--- @param m Mat4
--- @param dst Vec3f
--- @param v Vec3f
---- Multiplies a vector by a matrix of the form: `| ? ? ? 0 |` `| ? ? ? 0 |` `| ? ? ? 0 |` `| 0 0 0 1 |` i.e. a matrix representing a linear transformation over 3 space
+--- Multiplies a vector by a matrix of the form:
+--- `| ? ? ? 0 |`
+--- `| ? ? ? 0 |`
+--- `| ? ? ? 0 |`
+--- `| 0 0 0 1 |`
+--- i.e. a matrix representing a linear transformation over 3 space
function linear_mtxf_mul_vec3f(m, dst, v)
-- ...
end
@@ -8992,7 +9281,12 @@ end
--- @param m Mat4
--- @param dst Vec3f
--- @param v Vec3f
---- Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ? ? ? 0 |` `| ? ? ? 0 |` `| 0 0 0 1 |` i.e. a matrix representing a linear transformation over 3 space
+--- Multiplies a vector by the transpose of a matrix of the form:
+--- `| ? ? ? 0 |`
+--- `| ? ? ? 0 |`
+--- `| ? ? ? 0 |`
+--- `| 0 0 0 1 |`
+--- i.e. a matrix representing a linear transformation over 3 space
function linear_mtxf_transpose_mul_vec3f(m, dst, v)
-- ...
end
@@ -10057,7 +10351,9 @@ end
--- @param name string
--- @return PresetPalette
---- Allocates a preset palette that can be shown in the player customization screen. This returns a `PresetPalette` that can be used to customize the palette. Customization functions include `preset_palette_set_name` and `preset_palette_set_color_of_part`.
+--- Allocates a preset palette that can be shown in the player customization screen.
+--- This returns a `PresetPalette` that can be used to customize the palette.
+--- Customization functions include `preset_palette_set_name` and `preset_palette_set_color_of_part`.
function preset_palette_allocate(name)
-- ...
end
@@ -10131,20 +10427,23 @@ end
--- @param fileIndex integer
--- @param courseIndex integer
---- Marks the coin score for a specific course as the newest among all save files. Adjusts the age of other scores to reflect the update. Useful for leaderboard tracking or displaying recent progress
+--- Marks the coin score for a specific course as the newest among all save files. Adjusts the age of other scores to reflect the update.
+--- Useful for leaderboard tracking or displaying recent progress
function touch_coin_score_age(fileIndex, courseIndex)
-- ...
end
--- @param fileIndex integer
--- @param forceSave integer
---- Saves the current state of the game into a specified save file. Includes data verification and backup management. Useful for maintaining game progress during play or when saving manually
+--- Saves the current state of the game into a specified save file. Includes data verification and backup management.
+--- Useful for maintaining game progress during play or when saving manually
function save_file_do_save(fileIndex, forceSave)
-- ...
end
--- @param fileIndex integer
---- Erases all data in a specified save file, including backup slots. Marks the save file as modified and performs a save to apply the changes. Useful for resetting a save file to its default state
+--- Erases all data in a specified save file, including backup slots. Marks the save file as modified and performs a save to apply the changes.
+--- Useful for resetting a save file to its default state
function save_file_erase(fileIndex)
-- ...
end
@@ -10155,14 +10454,16 @@ function save_file_erase_current_backup_save()
end
--- @param load_all integer
---- Reloads the save file data into memory, optionally resetting all save files. Marks the save file as modified. Useful for reloading state after data corruption or during development debugging
+--- Reloads the save file data into memory, optionally resetting all save files. Marks the save file as modified.
+--- Useful for reloading state after data corruption or during development debugging
function save_file_reload(load_all)
-- ...
end
--- @param courseIndex integer
--- @return integer
---- Determines the maximum coin score for a course across all save files. Returns the score along with the file index of the save containing it. Useful for leaderboard-style comparisons and overall progress tracking
+--- Determines the maximum coin score for a course across all save files. Returns the score along with the file index of the save containing it.
+--- Useful for leaderboard-style comparisons and overall progress tracking
function save_file_get_max_coin_score(courseIndex)
-- ...
end
@@ -10170,7 +10471,8 @@ end
--- @param fileIndex integer
--- @param courseIndex integer
--- @return integer
---- Calculates the total number of stars collected in a specific course for a given save file. Useful for determining completion status of individual levels
+--- Calculates the total number of stars collected in a specific course for a given save file.
+--- Useful for determining completion status of individual levels
function save_file_get_course_star_count(fileIndex, courseIndex)
-- ...
end
@@ -10179,25 +10481,29 @@ end
--- @param minCourse integer
--- @param maxCourse integer
--- @return integer
---- Calculates the total number of stars collected across multiple courses within a specified range. Useful for determining the overall progress toward game completion
+--- Calculates the total number of stars collected across multiple courses within a specified range.
+--- Useful for determining the overall progress toward game completion
function save_file_get_total_star_count(fileIndex, minCourse, maxCourse)
-- ...
end
--- @param flags integer
---- Adds new flags to the save file's flag bitmask. Useful for updating progress or triggering new gameplay features
+--- Adds new flags to the save file's flag bitmask.
+--- Useful for updating progress or triggering new gameplay features
function save_file_set_flags(flags)
-- ...
end
--- @param flags integer
---- Clears specific flags in the current save file. The flags are specified as a bitmask in the `flags` parameter. Ensures that the save file remains valid after clearing. Useful for removing specific game states, such as collected items or completed objectives, without resetting the entire save
+--- Clears specific flags in the current save file. The flags are specified as a bitmask in the `flags` parameter. Ensures that the save file remains valid after clearing.
+--- Useful for removing specific game states, such as collected items or completed objectives, without resetting the entire save
function save_file_clear_flags(flags)
-- ...
end
--- @return integer
---- Retrieves the bitmask of flags representing the current state of the save file. Flags indicate collected items, completed objectives, and other game states. Useful for checking specific game progress details
+--- Retrieves the bitmask of flags representing the current state of the save file. Flags indicate collected items, completed objectives, and other game states.
+--- Useful for checking specific game progress details
function save_file_get_flags()
-- ...
end
@@ -10205,7 +10511,8 @@ end
--- @param fileIndex integer
--- @param courseIndex integer
--- @return integer
---- Retrieves the bitmask of stars collected in a specific course or castle secret stars (-1). Useful for evaluating level progress and completion
+--- Retrieves the bitmask of stars collected in a specific course or castle secret stars (-1).
+--- Useful for evaluating level progress and completion
function save_file_get_star_flags(fileIndex, courseIndex)
-- ...
end
@@ -10213,7 +10520,8 @@ end
--- @param fileIndex integer
--- @param courseIndex integer
--- @param starFlags integer
---- Adds specific star flags to the save file, indicating collected stars for a course or castle secret stars. Updates the save file flags as necessary. Useful for recording progress after star collection
+--- Adds specific star flags to the save file, indicating collected stars for a course or castle secret stars. Updates the save file flags as necessary.
+--- Useful for recording progress after star collection
function save_file_set_star_flags(fileIndex, courseIndex, starFlags)
-- ...
end
@@ -10221,7 +10529,8 @@ end
--- @param fileIndex integer
--- @param courseIndex integer
--- @param starFlagsToRemove integer
---- Removes specific star flags from the save file. This modifies the bitmask representing collected stars for a course or castle secret stars. Useful for undoing progress or debugging collected stars
+--- Removes specific star flags from the save file. This modifies the bitmask representing collected stars for a course or castle secret stars.
+--- Useful for undoing progress or debugging collected stars
function save_file_remove_star_flags(fileIndex, courseIndex, starFlagsToRemove)
-- ...
end
@@ -10229,7 +10538,8 @@ end
--- @param fileIndex integer
--- @param courseIndex integer
--- @return integer
---- Returns the highest coin score for a specified course in the save file. Performs checks to ensure the coin score is valid. Useful for tracking player achievements and high scores
+--- Returns the highest coin score for a specified course in the save file. Performs checks to ensure the coin score is valid.
+--- Useful for tracking player achievements and high scores
function save_file_get_course_coin_score(fileIndex, courseIndex)
-- ...
end
@@ -10237,7 +10547,8 @@ end
--- @param fileIndex integer
--- @param courseIndex integer
--- @param coinScore integer
---- Updates the coin score for a specific course in the save file. The new score is provided in the `coinScore` parameter. Useful for manually setting achievements such as high coin counts in individual levels
+--- Updates the coin score for a specific course in the save file. The new score is provided in the `coinScore` parameter.
+--- Useful for manually setting achievements such as high coin counts in individual levels
function save_file_set_course_coin_score(fileIndex, courseIndex, coinScore)
-- ...
end
@@ -10245,7 +10556,8 @@ end
--- @param fileIndex integer
--- @param courseIndex integer
--- @return integer
---- Checks whether the cannon in the specified course is unlocked. Returns true if the cannon is unlocked, otherwise false. Useful for tracking course-specific progress and enabling shortcuts
+--- Checks whether the cannon in the specified course is unlocked. Returns true if the cannon is unlocked, otherwise false.
+--- Useful for tracking course-specific progress and enabling shortcuts
function save_file_is_cannon_unlocked(fileIndex, courseIndex)
-- ...
end
@@ -10257,13 +10569,15 @@ end
--- @param capPos Vec3s
--- @return integer
---- Retrieves the current position of Mario's cap, if it is on the ground in the current level and area. The position is stored in the provided `capPos` parameter. Useful for tracking the cap's location after it has been dropped or lost
+--- Retrieves the current position of Mario's cap, if it is on the ground in the current level and area. The position is stored in the provided `capPos` parameter.
+--- Useful for tracking the cap's location after it has been dropped or lost
function save_file_get_cap_pos(capPos)
-- ...
end
--- @return integer
---- Returns the current sound mode (e.g., stereo, mono) stored in the save file. Useful for checking the audio output preferences when loading a save
+--- Returns the current sound mode (e.g., stereo, mono) stored in the save file.
+--- Useful for checking the audio output preferences when loading a save
function save_file_get_sound_mode()
-- ...
end
@@ -10606,7 +10920,8 @@ function camera_romhack_allow_dpad_usage(allow)
end
--- @param enable integer
---- Toggles collision settings for the ROM hack camera. This enables or disables specific collision behaviors in modded levels
+--- Toggles collision settings for the ROM hack camera.
+--- This enables or disables specific collision behaviors in modded levels
function camera_romhack_set_collisions(enable)
-- ...
end
@@ -10928,7 +11243,9 @@ end
--- @param vertex2 Vec3s
--- @param vertex3 Vec3s
--- @return Surface
---- Allocates a new collision surface with the given vertices, computes the surface normal and other fields, and inserts it into the spatial partition. Returns the new surface, or `nil` if the triangle is degenerate (zero area). Set `dynamic` to `true` for surfaces that are cleared each frame, or `false` for persistent static surfaces
+--- Allocates a new collision surface with the given vertices, computes the surface normal and other fields, and inserts it into the spatial partition.
+--- Returns the new surface, or `nil` if the triangle is degenerate (zero area).
+--- Set `dynamic` to `true` for surfaces that are cleared each frame, or `false` for persistent static surfaces
function smlua_collision_add_surface(dynamic, surfaceType, vertex1, vertex2, vertex3)
-- ...
end
@@ -10937,7 +11254,9 @@ end
--- @param vertex1 Vec3s
--- @param vertex2 Vec3s
--- @param vertex3 Vec3s
---- Moves an existing collision surface to new vertex positions. Recalculates the surface normal, origin offset, and Y bounds, removes the surface from its old spatial partition cells, and re-adds it to the correct cells. The previous vertices are preserved for interpolation
+--- Moves an existing collision surface to new vertex positions.
+--- Recalculates the surface normal, origin offset, and Y bounds, removes the surface from its old spatial partition cells, and re-adds it to the correct cells.
+--- The previous vertices are preserved for interpolation
function smlua_collision_move_surface(surface, vertex1, vertex2, vertex3)
-- ...
end
@@ -10969,6 +11288,51 @@ function surface_is_painting_warp(surf)
-- ...
end
+--- @param flag ShaderFlag
+--- @return boolean
+--- Gets if a custom shader flag (`SHADER_FLAG_*`) is enabled or not
+function get_shader_flag_enabled(flag)
+ -- ...
+end
+
+--- @param flag ShaderFlag
+--- @param enabled boolean
+--- Enables a custom shader flag (`SHADER_FLAG_*`) for the renderer
+function set_shader_flag_enabled(flag, enabled)
+ -- ...
+end
+
+--- @param flag ShaderFlag
+--- @return number
+--- Gets a value for one of the custom shader flags (`SHADER_FLAG_*`)
+function get_shader_flag_value(flag)
+ -- ...
+end
+
+--- @param flag ShaderFlag
+--- @param value number
+--- Sets a value for one of the custom shader flags (`SHADER_FLAG_*`) for the renderer
+function set_shader_flag_value(flag, value)
+ -- ...
+end
+
+--- @return boolean
+--- Gets if custom shader flags are enabled globally
+function get_global_shader_flags_enabled()
+ -- ...
+end
+
+--- @param enabled boolean
+--- Enables custom shader flags as a global toggle, useful for disabling without manually going through every effect
+function set_global_shader_flags_enabled(enabled)
+ -- ...
+end
+
+--- Clears all custom shader flags (`SHADER_FLAG_*`) for the renderer
+function clear_all_shader_flags()
+ -- ...
+end
+
--- @param fov number
--- Sets the override FOV
function set_override_fov(fov)
@@ -11140,7 +11504,8 @@ end
--- @param name string
--- @return Pointer_Gfx
--- @return integer length
---- Gets a display list of the current mod from its name. Returns a pointer to the display list and its length
+--- Gets a display list of the current mod from its name.
+--- Returns a pointer to the display list and its length
function gfx_get_from_name(name)
-- ...
end
@@ -11211,7 +11576,8 @@ end
--- @param name string
--- @return Pointer_Vtx
--- @return integer count
---- Gets a vertex buffer of the current mod from its name. Returns a pointer to the vertex buffering and its vertex count
+--- Gets a vertex buffer of the current mod from its name.
+--- Returns a pointer to the vertex buffer and its vertex count
function vtx_get_from_name(name)
-- ...
end
@@ -11665,7 +12031,8 @@ end
--- @param m MarioState
--- @param index integer
--- @return number
---- 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
+--- 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
function get_hand_foot_pos_x(m, index)
-- ...
end
@@ -11673,7 +12040,8 @@ 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
@@ -11681,7 +12049,8 @@ end
--- @param m MarioState
--- @param index integer
--- @return number
---- 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
+--- 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
function get_hand_foot_pos_z(m, index)
-- ...
end
@@ -11985,7 +12354,8 @@ end
--- @param z number
--- @param objSetupFunction function
--- @return Object
---- Spawns a synchronized object 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`
+--- Spawns a synchronized object 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
@@ -11997,7 +12367,8 @@ end
--- @param z number
--- @param objSetupFunction function
--- @return Object
---- Spawns a non-synchronized object 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`
+--- Spawns a non-synchronized object 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
@@ -12099,7 +12470,8 @@ 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)
+--- 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
@@ -12108,7 +12480,8 @@ 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)
+--- 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
@@ -12131,7 +12504,8 @@ 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)
+--- 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
@@ -12140,7 +12514,8 @@ 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)
+--- 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
@@ -12664,28 +13039,34 @@ function cur_obj_play_sound_2(soundMagic)
end
--- @param soundMagic integer
---- Create a sound spawner for objects that need a sound play once. (Breakable walls, King Bobomb exploding, etc)
+--- Create a sound spawner for objects that need a sound play once.
+--- (Breakable walls, King Bobomb exploding, etc)
function create_sound_spawner(soundMagic)
-- ...
end
--- @param distance number
--- @return integer
---- Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124. What an even more strange and confusing function
+--- Unused vanilla function, calculates a volume based on `distance`.
+--- If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124.
+--- What an even more strange and confusing function
function calc_dist_to_volume_range_1(distance)
-- ...
end
--- @param distance number
--- @return integer
---- Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127. What a strange and confusing function
+--- Unused vanilla function, calculates a volume based on `distance`.
+--- If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127.
+--- What a strange and confusing function
function calc_dist_to_volume_range_2(distance)
-- ...
end
--- @param colData WallCollisionData
--- @return integer
---- Detects wall collisions at a given position and adjusts the position based on the walls found. Returns the number of wall collisions detected
+--- Detects wall collisions at a given position and adjusts the position based on the walls found.
+--- Returns the number of wall collisions detected
function find_wall_collisions(colData)
-- ...
end
@@ -12695,7 +13076,8 @@ end
--- @param posZ number
--- @return number
--- @return Surface pceil
---- Finds the height of the highest ceiling above a given position (x, y, z) and return the corresponding ceil surface. If no ceiling is found, returns the default height limit of `gLevelValues.cellHeightLimit`(20000 by default)
+--- Finds the height of the highest ceiling above a given position (x, y, z) and return the corresponding ceil surface.
+--- If no ceiling is found, returns the default height limit of `gLevelValues.cellHeightLimit`(20000 by default)
function find_ceil(posX, posY, posZ)
-- ...
end
@@ -12704,7 +13086,8 @@ end
--- @param y number
--- @param z number
--- @return number
---- Finds the height of the highest ceiling above a given position (x, y, z). If no ceiling is found, returns the default height limit of `gLevelValues.cellHeightLimit`(20000 by default)
+--- Finds the height of the highest ceiling above a given position (x, y, z).
+--- If no ceiling is found, returns the default height limit of `gLevelValues.cellHeightLimit`(20000 by default)
function find_ceil_height(x, y, z)
-- ...
end
@@ -12713,7 +13096,8 @@ end
--- @param y number
--- @param z number
--- @return number
---- Finds the height of the highest floor below a given position (x, y, z). If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
+--- Finds the height of the highest floor below a given position (x, y, z).
+--- If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
function find_floor_height(x, y, z)
-- ...
end
@@ -12723,7 +13107,8 @@ end
--- @param zPos number
--- @return number
--- @return Surface pfloor
---- Finds the height of the highest floor below a given position (x, y, z) and return the corresponding floor surface. If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
+--- Finds the height of the highest floor below a given position (x, y, z) and return the corresponding floor surface.
+--- If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
function find_floor(xPos, yPos, zPos)
-- ...
end
@@ -12731,7 +13116,8 @@ end
--- @param x number
--- @param z number
--- @return number
---- Finds the height of water at a given position (x, z), if the position is within a water region. If no water is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
+--- Finds the height of water at a given position (x, z), if the position is within a water region.
+--- If no water is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
function find_water_level(x, z)
-- ...
end
@@ -12739,7 +13125,8 @@ end
--- @param x number
--- @param z number
--- @return number
---- Finds the height of the poison gas at a given position (x, z), if the position is within a gas region. If no gas is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
+--- Finds the height of the poison gas at a given position (x, z), if the position is within a gas region.
+--- If no gas is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
function find_poison_gas_level(x, z)
-- ...
end
@@ -12760,13 +13147,15 @@ function closest_point_to_triangle(surf, src, out)
-- ...
end
---- Loads the object's collision data into dynamic collision. You must run this every frame in your object's behavior loop for it to have collision
+--- Loads the object's collision data into dynamic collision.
+--- You must run this every frame in your object's behavior loop for it to have collision
function load_object_collision_model()
-- ...
end
--- @return StaticObjectCollision
---- Loads the object's collision data into static collision. You may run this only once to capture the object's collision at that frame.
+--- Loads the object's collision data into static collision.
+--- You may run this only once to capture the object's collision at that frame.
function load_static_object_collision()
-- ...
end
diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua
index 7fa922911..ff1e3d63c 100644
--- a/autogen/lua_definitions/structs.lua
+++ b/autogen/lua_definitions/structs.lua
@@ -556,6 +556,7 @@
--- @class DjuiInteractableTheme
--- @field public textColor DjuiColor
+--- @field public disabledTextColor DjuiColor
--- @field public defaultRectColor DjuiColor
--- @field public cursorDownRectColor DjuiColor
--- @field public hoveredRectColor DjuiColor
diff --git a/bin/segment2.c b/bin/segment2.c
index b10412813..eaeabea1d 100644
--- a/bin/segment2.c
+++ b/bin/segment2.c
@@ -2351,7 +2351,7 @@ const Gfx dl_transition_draw_filled_region[] = {
const Gfx dl_skybox_begin[] = {
gsDPPipeSync(),
gsSPClearGeometryMode(G_LIGHTING),
- gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB),
+ gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA),
gsSPPerspNormalize(0xFFFF),
gsSPMatrix(&matrix_identity, G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH),
gsSPEndDisplayList(),
diff --git a/docs/lua/constants.md b/docs/lua/constants.md
index 34f0863a7..017eccce5 100644
--- a/docs/lua/constants.md
+++ b/docs/lua/constants.md
@@ -29,6 +29,8 @@
- [gbi_extension.h](#gbi_extensionh)
- [geo_commands.h](#geo_commandsh)
- [enum SkyBackgroundParams](#enum-SkyBackgroundParams)
+- [gfx_pc.h](#gfx_pch)
+ - [enum ShaderFlag](#enum-ShaderFlag)
- [graph_node.h](#graph_nodeh)
- [interaction.c](#interactionc)
- [interaction.h](#interactionh)
@@ -1347,6 +1349,25 @@
+## [gfx_pc.h](#gfx_pc.h)
+
+### [enum ShaderFlag](#ShaderFlag)
+| Identifier | Value |
+| :--------- | :---- |
+| SHADER_FLAG_HUE | 0 |
+| SHADER_FLAG_SATURATION | 1 |
+| SHADER_FLAG_BRIGHTNESS | 2 |
+| SHADER_FLAG_CONTRAST | 3 |
+| SHADER_FLAG_EXPOSURE | 4 |
+| SHADER_FLAG_DITHERING | 5 |
+| SHADER_FLAG_POSTERIZATION | 6 |
+| SHADER_FLAG_SCANLINES | 7 |
+| SHADER_FLAG_MAX | 8 |
+
+[:arrow_up_small:](#)
+
+
+
## [graph_node.h](#graph_node.h)
- GRAPH_RENDER_ACTIVE
- GRAPH_RENDER_CHILDREN_FIRST
diff --git a/docs/lua/functions-2.md b/docs/lua/functions-2.md
index 0fe24495c..9cad9f1e8 100644
--- a/docs/lua/functions-2.md
+++ b/docs/lua/functions-2.md
@@ -4197,7 +4197,8 @@ Behavior loop function for Tox Box
## [mario_moving_fast_enough_to_make_piranha_plant_bite](#mario_moving_fast_enough_to_make_piranha_plant_bite)
### Description
-Checks if Mario is moving fast enough to make Piranha Plant bite. This one is a mouthful
+Checks if Mario is moving fast enough to make Piranha Plant bite.
+This one is a mouthful
### Lua Example
`local integerValue = mario_moving_fast_enough_to_make_piranha_plant_bite()`
diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md
index 38d749f9b..882bd72f5 100644
--- a/docs/lua/functions-3.md
+++ b/docs/lua/functions-3.md
@@ -139,6 +139,27 @@ Sets the current object's position to random floats between 0.0 and 1.0
+## [draw_distance_scalar_is_infinite](#draw_distance_scalar_is_infinite)
+
+### Description
+Checks if the draw distance scalar is infinite
+
+### Lua Example
+`local booleanValue = draw_distance_scalar_is_infinite()`
+
+### Parameters
+- None
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool draw_distance_scalar_is_infinite(void);`
+
+[:arrow_up_small:](#)
+
+
+
## [draw_distance_scalar](#draw_distance_scalar)
### Description
@@ -290,7 +311,8 @@ Gets a behavior ID from a behavior name
## [skip_camera_interpolation](#skip_camera_interpolation)
### Description
-Skips camera interpolation for a frame, locking the camera instantly to the target position. Useful for immediate changes in camera state or position without smooth transitions
+Skips camera interpolation for a frame, locking the camera instantly to the target position.
+Useful for immediate changes in camera state or position without smooth transitions
### Lua Example
`skip_camera_interpolation()`
@@ -311,7 +333,8 @@ Skips camera interpolation for a frame, locking the camera instantly to the targ
## [set_camera_shake_from_hit](#set_camera_shake_from_hit)
### Description
-Applies a shake effect to the camera based on a hit type. Different shake types simulate various impacts, such as attacks, falls, or shocks
+Applies a shake effect to the camera based on a hit type.
+Different shake types simulate various impacts, such as attacks, falls, or shocks
### Lua Example
`set_camera_shake_from_hit(shake)`
@@ -334,7 +357,8 @@ Applies a shake effect to the camera based on a hit type. Different shake types
## [set_environmental_camera_shake](#set_environmental_camera_shake)
### Description
-Applies an environmental shake effect to the camera. Handles predefined shake types triggered by environmental events like explosions or platform movements
+Applies an environmental shake effect to the camera.
+Handles predefined shake types triggered by environmental events like explosions or platform movements
### Lua Example
`set_environmental_camera_shake(shake)`
@@ -357,7 +381,8 @@ Applies an environmental shake effect to the camera. Handles predefined shake ty
## [set_camera_shake_from_point](#set_camera_shake_from_point)
### Description
-Applies a shake effect to the camera, scaled by its proximity to a specified point. The intensity decreases with distance from the point
+Applies a shake effect to the camera, scaled by its proximity to a specified point.
+The intensity decreases with distance from the point
### Lua Example
`set_camera_shake_from_point(shake, posX, posY, posZ)`
@@ -383,7 +408,8 @@ Applies a shake effect to the camera, scaled by its proximity to a specified poi
## [move_mario_head_c_up](#move_mario_head_c_up)
### Description
-Moves Mario's head slightly upward when the C-Up button is pressed. This function aligns the camera to match the head movement for consistency
+Moves Mario's head slightly upward when the C-Up button is pressed.
+This function aligns the camera to match the head movement for consistency
### Lua Example
`move_mario_head_c_up(c)`
@@ -406,7 +432,8 @@ Moves Mario's head slightly upward when the C-Up button is pressed. This functio
## [transition_next_state](#transition_next_state)
### Description
-Transitions the camera to the next state over a specified number of frames. This is typically used for cutscenes or scripted sequences
+Transitions the camera to the next state over a specified number of frames.
+This is typically used for cutscenes or scripted sequences
### Lua Example
`transition_next_state(c, frames)`
@@ -430,7 +457,8 @@ Transitions the camera to the next state over a specified number of frames. This
## [set_camera_mode](#set_camera_mode)
### Description
-Changes the camera to a new mode, optionally interpolating over a specified number of frames. Useful for transitioning between different camera behaviors dynamically
+Changes the camera to a new mode, optionally interpolating over a specified number of frames.
+Useful for transitioning between different camera behaviors dynamically
### Lua Example
`set_camera_mode(c, mode, frames)`
@@ -455,7 +483,8 @@ Changes the camera to a new mode, optionally interpolating over a specified numb
## [soft_reset_camera](#soft_reset_camera)
### Description
-Resets the camera's state while retaining some settings, such as position or mode. This is often used when soft-resetting gameplay without reinitialization
+Resets the camera's state while retaining some settings, such as position or mode.
+This is often used when soft-resetting gameplay without reinitialization
### Lua Example
`soft_reset_camera(c)`
@@ -478,7 +507,8 @@ Resets the camera's state while retaining some settings, such as position or mod
## [reset_camera](#reset_camera)
### Description
-Fully resets the camera to its default state and reinitializes all settings. This is typically used when restarting gameplay or loading a new area
+Fully resets the camera to its default state and reinitializes all settings.
+This is typically used when restarting gameplay or loading a new area
### Lua Example
`reset_camera(c)`
@@ -501,7 +531,8 @@ Fully resets the camera to its default state and reinitializes all settings. Thi
## [select_mario_cam_mode](#select_mario_cam_mode)
### Description
-Selects the appropriate camera mode for Mario based on the current gameplay context. Adapts camera behavior dynamically to match Mario's environment or state
+Selects the appropriate camera mode for Mario based on the current gameplay context.
+Adapts camera behavior dynamically to match Mario's environment or state
### Lua Example
`select_mario_cam_mode()`
@@ -522,7 +553,8 @@ Selects the appropriate camera mode for Mario based on the current gameplay cont
## [object_pos_to_vec3f](#object_pos_to_vec3f)
### Description
-Converts an object's position to a `Vec3f` format. Useful for aligning object behaviors or interactions with the camera system
+Converts an object's position to a `Vec3f` format.
+Useful for aligning object behaviors or interactions with the camera system
### Lua Example
`object_pos_to_vec3f(dst, o)`
@@ -546,7 +578,8 @@ Converts an object's position to a `Vec3f` format. Useful for aligning object be
## [vec3f_to_object_pos](#vec3f_to_object_pos)
### Description
-Converts a `Vec3f` position to an object's internal format. Useful for syncing 3D positions between objects and the game world
+Converts a `Vec3f` position to an object's internal format.
+Useful for syncing 3D positions between objects and the game world
### Lua Example
`vec3f_to_object_pos(o, src)`
@@ -666,7 +699,8 @@ Converts a `Vec3s` angle to an object's move angle internal format
## [cam_select_alt_mode](#cam_select_alt_mode)
### Description
-Selects an alternate camera mode based on the given angle. Used to toggle between predefined camera modes dynamically
+Selects an alternate camera mode based on the given angle.
+Used to toggle between predefined camera modes dynamically
### Lua Example
`local integerValue = cam_select_alt_mode(angle)`
@@ -689,7 +723,8 @@ Selects an alternate camera mode based on the given angle. Used to toggle betwee
## [set_cam_angle](#set_cam_angle)
### Description
-Sets the camera's angle based on the specified mode. Handles rotation and focus adjustments for predefined camera behaviors
+Sets the camera's angle based on the specified mode.
+Handles rotation and focus adjustments for predefined camera behaviors
### Lua Example
`local integerValue = set_cam_angle(mode)`
@@ -712,7 +747,8 @@ Sets the camera's angle based on the specified mode. Handles rotation and focus
## [set_handheld_shake](#set_handheld_shake)
### Description
-Applies a handheld camera shake effect with configurable parameters. Can be used to simulate dynamic, realistic camera movement
+Applies a handheld camera shake effect with configurable parameters.
+Can be used to simulate dynamic, realistic camera movement
### Lua Example
`set_handheld_shake(mode)`
@@ -735,7 +771,8 @@ Applies a handheld camera shake effect with configurable parameters. Can be used
## [shake_camera_handheld](#shake_camera_handheld)
### Description
-Activates a handheld camera shake effect. Calculates positional and focus adjustments to simulate manual movement
+Activates a handheld camera shake effect.
+Calculates positional and focus adjustments to simulate manual movement
### Lua Example
`shake_camera_handheld(pos, focus)`
@@ -759,7 +796,8 @@ Activates a handheld camera shake effect. Calculates positional and focus adjust
## [find_c_buttons_pressed](#find_c_buttons_pressed)
### Description
-Determines which C-buttons are currently pressed by the player. Returns a bitmask indicating the active buttons for camera control
+Determines which C-buttons are currently pressed by the player.
+Returns a bitmask indicating the active buttons for camera control
### Lua Example
`local integerValue = find_c_buttons_pressed(currentState, buttonsPressed, buttonsDown)`
@@ -784,7 +822,8 @@ Determines which C-buttons are currently pressed by the player. Returns a bitmas
## [collide_with_walls](#collide_with_walls)
### Description
-Checks for collisions between the camera and level geometry. Adjusts the camera's position to avoid clipping into walls or obstacles
+Checks for collisions between the camera and level geometry.
+Adjusts the camera's position to avoid clipping into walls or obstacles
### Lua Example
`local integerValue = collide_with_walls(pos, offsetY, radius)`
@@ -809,7 +848,8 @@ Checks for collisions between the camera and level geometry. Adjusts the camera'
## [clamp_pitch](#clamp_pitch)
### Description
-Clamps the camera's pitch angle between a maximum and minimum value. Prevents over-rotation and maintains a consistent viewing angle
+Clamps the camera's pitch angle between a maximum and minimum value.
+Prevents over-rotation and maintains a consistent viewing angle
### Lua Example
`local integerValue = clamp_pitch(from, to, maxPitch, minPitch)`
@@ -835,7 +875,8 @@ Clamps the camera's pitch angle between a maximum and minimum value. Prevents ov
## [is_within_100_units_of_mario](#is_within_100_units_of_mario)
### Description
-Checks if a position is within 100 units of Mario's current position. Returns true if the position is within the specified radius and false otherwise
+Checks if a position is within 100 units of Mario's current position.
+Returns true if the position is within the specified radius and false otherwise
### Lua Example
`local integerValue = is_within_100_units_of_mario(posX, posY, posZ)`
@@ -860,7 +901,9 @@ Checks if a position is within 100 units of Mario's current position. Returns tr
## [set_or_approach_f32_asymptotic](#set_or_approach_f32_asymptotic)
### Description
-Smoothly transitions or directly sets a floating-point value (`dst`) to approach a target (`goal`). Uses asymptotic scaling for gradual adjustments or direct assignment. Returns FALSE if `dst` reaches `goal`
+Smoothly transitions or directly sets a floating-point value (`dst`) to approach a target (`goal`).
+Uses asymptotic scaling for gradual adjustments or direct assignment.
+Returns FALSE if `dst` reaches `goal`
### Lua Example
`local integerValue, dst = set_or_approach_f32_asymptotic(dst, goal, scale)`
@@ -886,7 +929,8 @@ Smoothly transitions or directly sets a floating-point value (`dst`) to approach
## [approach_f32_asymptotic_bool](#approach_f32_asymptotic_bool)
### Description
-Gradually adjusts a floating-point value (`current`) towards a target (`target`) using asymptotic smoothing. Returns FALSE if `current` reaches the `target`
+Gradually adjusts a floating-point value (`current`) towards a target (`target`) using asymptotic smoothing.
+Returns FALSE if `current` reaches the `target`
### Lua Example
`local integerValue, current = approach_f32_asymptotic_bool(current, target, multiplier)`
@@ -912,7 +956,9 @@ Gradually adjusts a floating-point value (`current`) towards a target (`target`)
## [approach_f32_asymptotic](#approach_f32_asymptotic)
### Description
-Gradually approaches a floating-point value (`target`) using asymptotic smoothing. The rate of approach is controlled by the `multiplier`. Useful for smoothly adjusting camera parameters like field-of-view or position
+Gradually approaches a floating-point value (`target`) using asymptotic smoothing.
+The rate of approach is controlled by the `multiplier`.
+Useful for smoothly adjusting camera parameters like field-of-view or position
### Lua Example
`local numberValue = approach_f32_asymptotic(current, target, multiplier)`
@@ -937,7 +983,8 @@ Gradually approaches a floating-point value (`target`) using asymptotic smoothin
## [approach_s16_asymptotic_bool](#approach_s16_asymptotic_bool)
### Description
-Gradually adjusts a signed 16-bit integer (`current`) towards a target (`target`) using asymptotic smoothing. Returns FALSE if `current` reaches `target`
+Gradually adjusts a signed 16-bit integer (`current`) towards a target (`target`) using asymptotic smoothing.
+Returns FALSE if `current` reaches `target`
### Lua Example
`local integerValue, current = approach_s16_asymptotic_bool(current, target, divisor)`
@@ -963,7 +1010,9 @@ Gradually adjusts a signed 16-bit integer (`current`) towards a target (`target`
## [approach_s16_asymptotic](#approach_s16_asymptotic)
### Description
-Gradually approaches a signed 16-bit integer (`target`) using asymptotic smoothing. The divisor controls the rate of the adjustment. Useful for adjusting angles or positions smoothly
+Gradually approaches a signed 16-bit integer (`target`) using asymptotic smoothing.
+The divisor controls the rate of the adjustment.
+Useful for adjusting angles or positions smoothly
### Lua Example
`local integerValue = approach_s16_asymptotic(current, target, divisor)`
@@ -988,7 +1037,8 @@ Gradually approaches a signed 16-bit integer (`target`) using asymptotic smoothi
## [approach_vec3f_asymptotic](#approach_vec3f_asymptotic)
### Description
-Smoothly transitions a 3D vector (`current`) towards a target vector (`target`) using asymptotic scaling. Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
+Smoothly transitions a 3D vector (`current`) towards a target vector (`target`) using asymptotic scaling.
+Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
### Lua Example
`approach_vec3f_asymptotic(current, target, xMul, yMul, zMul)`
@@ -1015,7 +1065,8 @@ Smoothly transitions a 3D vector (`current`) towards a target vector (`target`)
## [set_or_approach_vec3f_asymptotic](#set_or_approach_vec3f_asymptotic)
### Description
-Smoothly transitions a 3D vector (`current`) toward a target vector (`goal`) using asymptotic scaling. Allows gradual or instantaneous alignment of 3D positions. Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
+Smoothly transitions a 3D vector (`current`) toward a target vector (`goal`) using asymptotic scaling.
+Allows gradual or instantaneous alignment of 3D positions. Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
### Lua Example
`set_or_approach_vec3f_asymptotic(dst, goal, xMul, yMul, zMul)`
@@ -1042,7 +1093,8 @@ Smoothly transitions a 3D vector (`current`) toward a target vector (`goal`) usi
## [camera_approach_s16_symmetric_bool](#camera_approach_s16_symmetric_bool)
### Description
-Adjusts a signed 16-bit integer (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`). Returns FALSE if `current` reaches the `target`
+Adjusts a signed 16-bit integer (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`).
+Returns FALSE if `current` reaches the `target`
### Lua Example
`local integerValue, current = camera_approach_s16_symmetric_bool(current, target, increment)`
@@ -1068,7 +1120,9 @@ Adjusts a signed 16-bit integer (`current`) towards a target (`target`) symmetri
## [set_or_approach_s16_symmetric](#set_or_approach_s16_symmetric)
### Description
-Smoothly transitions or directly sets a signed 16-bit value (`current`) to approach a target (`target`). Uses symmetric scaling for gradual or immediate adjustments. Returns FALSE if `current` reaches the `target`
+Smoothly transitions or directly sets a signed 16-bit value (`current`) to approach a target (`target`).
+Uses symmetric scaling for gradual or immediate adjustments.
+Returns FALSE if `current` reaches the `target`
### Lua Example
`local integerValue, current = set_or_approach_s16_symmetric(current, target, increment)`
@@ -1094,7 +1148,8 @@ Smoothly transitions or directly sets a signed 16-bit value (`current`) to appro
## [camera_approach_f32_symmetric_bool](#camera_approach_f32_symmetric_bool)
### Description
-Adjusts a floating-point value (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`). Returns FALSE if `current` reaches the `target`
+Adjusts a floating-point value (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`).
+Returns FALSE if `current` reaches the `target`
### Lua Example
`local integerValue, current = camera_approach_f32_symmetric_bool(current, target, increment)`
@@ -1120,7 +1175,8 @@ Adjusts a floating-point value (`current`) towards a target (`target`) symmetric
## [camera_approach_f32_symmetric](#camera_approach_f32_symmetric)
### Description
-Symmetrically approaches a floating-point value (`target`) with a fixed increment (`increment`) per frame. Limits the rate of change to ensure gradual transitions
+Symmetrically approaches a floating-point value (`target`) with a fixed increment (`increment`) per frame.
+Limits the rate of change to ensure gradual transitions
### Lua Example
`local numberValue = camera_approach_f32_symmetric(value, target, increment)`
@@ -1145,7 +1201,8 @@ Symmetrically approaches a floating-point value (`target`) with a fixed incremen
## [random_vec3s](#random_vec3s)
### Description
-Generates a random 3D vector with short integer components. Useful for randomized offsets or environmental effects
+Generates a random 3D vector with short integer components.
+Useful for randomized offsets or environmental effects
### Lua Example
`random_vec3s(dst, xRange, yRange, zRange)`
@@ -1171,7 +1228,8 @@ Generates a random 3D vector with short integer components. Useful for randomize
## [clamp_positions_and_find_yaw](#clamp_positions_and_find_yaw)
### Description
-Clamps a position within specified X and Z bounds and calculates the yaw angle from the origin. Prevents the camera from moving outside of the designated area
+Clamps a position within specified X and Z bounds and calculates the yaw angle from the origin.
+Prevents the camera from moving outside of the designated area
### Lua Example
`local integerValue = clamp_positions_and_find_yaw(pos, origin, xMax, xMin, zMax, zMin)`
@@ -1199,7 +1257,8 @@ Clamps a position within specified X and Z bounds and calculates the yaw angle f
## [is_range_behind_surface](#is_range_behind_surface)
### Description
-Determines if a range is obstructed by a surface relative to the camera. Returns true if the range is behind the specified surface
+Determines if a range is obstructed by a surface relative to the camera.
+Returns true if the range is behind the specified surface
### Lua Example
`local integerValue = is_range_behind_surface(from, to, surf, range, surfType)`
@@ -1226,7 +1285,9 @@ Determines if a range is obstructed by a surface relative to the camera. Returns
## [scale_along_line](#scale_along_line)
### Description
-Scales a point along a line between two 3D points (`from` and `to`). The scaling factor determines how far along the line the resulting point will be. The result is stored in the destination vector (`dest`)
+Scales a point along a line between two 3D points (`from` and `to`).
+The scaling factor determines how far along the line the resulting point will be.
+The result is stored in the destination vector (`dest`)
### Lua Example
`scale_along_line(dest, from, to, scale)`
@@ -1252,7 +1313,8 @@ Scales a point along a line between two 3D points (`from` and `to`). The scaling
## [calculate_pitch](#calculate_pitch)
### Description
-Calculates the pitch angle (rotation around the X-axis) from one 3D point (`from`) to another (`to`). Returns the pitch as a signed 16-bit integer
+Calculates the pitch angle (rotation around the X-axis) from one 3D point (`from`) to another (`to`).
+Returns the pitch as a signed 16-bit integer
### Lua Example
`local integerValue = calculate_pitch(from, to)`
@@ -1276,7 +1338,8 @@ Calculates the pitch angle (rotation around the X-axis) from one 3D point (`from
## [calculate_yaw](#calculate_yaw)
### Description
-Determines the yaw angle (rotation around the Y-axis) from one 3D position (`from`) to another (`to`). Returns the yaw as a signed 16-bit integer
+Determines the yaw angle (rotation around the Y-axis) from one 3D position (`from`) to another (`to`).
+Returns the yaw as a signed 16-bit integer
### Lua Example
`local integerValue = calculate_yaw(from, to)`
@@ -1325,7 +1388,9 @@ Calculates and returns the pitch and yaw angles from one 3D position (`from`) to
## [calc_abs_dist](#calc_abs_dist)
### Description
-Calculates the absolute distance between two 3D points (`a` and `b`). Returns the distance as a floating-point value. Useful for determining proximity between objects in 3D space
+Calculates the absolute distance between two 3D points (`a` and `b`).
+Returns the distance as a floating-point value.
+Useful for determining proximity between objects in 3D space
### Lua Example
`local numberValue = calc_abs_dist(a, b)`
@@ -1349,7 +1414,9 @@ Calculates the absolute distance between two 3D points (`a` and `b`). Returns th
## [calc_hor_dist](#calc_hor_dist)
### Description
-Calculates the horizontal (XZ-plane) distance between two 3D points (`a` and `b`). Returns the distance as a floating-point value. Useful for terrain navigation or collision detection
+Calculates the horizontal (XZ-plane) distance between two 3D points (`a` and `b`).
+Returns the distance as a floating-point value.
+Useful for terrain navigation or collision detection
### Lua Example
`local numberValue = calc_hor_dist(a, b)`
@@ -1373,7 +1440,9 @@ Calculates the horizontal (XZ-plane) distance between two 3D points (`a` and `b`
## [rotate_in_xz](#rotate_in_xz)
### Description
-Rotates a vector around the XZ-plane by a specified yaw angle. The result is stored in the destination vector (`dst`). Useful for rotating camera positions or object coordinates horizontally
+Rotates a vector around the XZ-plane by a specified yaw angle.
+The result is stored in the destination vector (`dst`).
+Useful for rotating camera positions or object coordinates horizontally
### Lua Example
`rotate_in_xz(dst, src, yaw)`
@@ -1398,7 +1467,9 @@ Rotates a vector around the XZ-plane by a specified yaw angle. The result is sto
## [rotate_in_yz](#rotate_in_yz)
### Description
-Rotates a vector around the YZ-plane by a specified pitch angle. The result is stored in the destination vector (`dst`). Useful for vertical camera rotations or object transformations
+Rotates a vector around the YZ-plane by a specified pitch angle.
+The result is stored in the destination vector (`dst`).
+Useful for vertical camera rotations or object transformations
### Lua Example
`rotate_in_yz(dst, src, pitch)`
@@ -1423,7 +1494,9 @@ Rotates a vector around the YZ-plane by a specified pitch angle. The result is s
## [set_camera_pitch_shake](#set_camera_pitch_shake)
### Description
-Applies a pitch-based shake effect to the camera. The shake's magnitude, decay, and increment are configurable. Simulates vertical disturbances like impacts or explosions
+Applies a pitch-based shake effect to the camera.
+The shake's magnitude, decay, and increment are configurable.
+Simulates vertical disturbances like impacts or explosions
### Lua Example
`set_camera_pitch_shake(mag, decay, inc)`
@@ -1448,7 +1521,8 @@ Applies a pitch-based shake effect to the camera. The shake's magnitude, decay,
## [set_camera_yaw_shake](#set_camera_yaw_shake)
### Description
-Applies a yaw-based shake effect to the camera. Simulates horizontal vibrations or rotational impacts
+Applies a yaw-based shake effect to the camera.
+Simulates horizontal vibrations or rotational impacts
### Lua Example
`set_camera_yaw_shake(mag, decay, inc)`
@@ -1473,7 +1547,8 @@ Applies a yaw-based shake effect to the camera. Simulates horizontal vibrations
## [set_camera_roll_shake](#set_camera_roll_shake)
### Description
-Applies a roll-based shake effect to the camera. Simulates rotational disturbances for dynamic camera effects
+Applies a roll-based shake effect to the camera.
+Simulates rotational disturbances for dynamic camera effects
### Lua Example
`set_camera_roll_shake(mag, decay, inc)`
@@ -1498,7 +1573,8 @@ Applies a roll-based shake effect to the camera. Simulates rotational disturbanc
## [set_pitch_shake_from_point](#set_pitch_shake_from_point)
### Description
-Applies a pitch shake effect to the camera, scaled by proximity to a specified point. Simulates vibrations with intensity decreasing further from the point
+Applies a pitch shake effect to the camera, scaled by proximity to a specified point.
+Simulates vibrations with intensity decreasing further from the point
### Lua Example
`set_pitch_shake_from_point(mag, decay, inc, maxDist, posX, posY, posZ)`
@@ -1527,7 +1603,8 @@ Applies a pitch shake effect to the camera, scaled by proximity to a specified p
## [shake_camera_pitch](#shake_camera_pitch)
### Description
-Activates a pitch-based shake effect. Adds vertical vibrational movement to the camera's behavior
+Activates a pitch-based shake effect.
+Adds vertical vibrational movement to the camera's behavior
### Lua Example
`shake_camera_pitch(pos, focus)`
@@ -1551,7 +1628,8 @@ Activates a pitch-based shake effect. Adds vertical vibrational movement to the
## [shake_camera_yaw](#shake_camera_yaw)
### Description
-Activates a yaw-based shake effect. Adds horizontal vibrational movement to the camera's behavior
+Activates a yaw-based shake effect.
+Adds horizontal vibrational movement to the camera's behavior
### Lua Example
`shake_camera_yaw(pos, focus)`
@@ -1575,7 +1653,8 @@ Activates a yaw-based shake effect. Adds horizontal vibrational movement to the
## [shake_camera_roll](#shake_camera_roll)
### Description
-Applies a roll-based shake effect to the camera. Simulates rotational disturbances caused by impacts or other events
+Applies a roll-based shake effect to the camera.
+Simulates rotational disturbances caused by impacts or other events
### Lua Example
`local roll = shake_camera_roll(roll)`
@@ -1598,7 +1677,8 @@ Applies a roll-based shake effect to the camera. Simulates rotational disturbanc
## [offset_yaw_outward_radial](#offset_yaw_outward_radial)
### Description
-Calculates an outward radial offset based on the camera's yaw angle. Returns the offset yaw, used for positioning or alignment
+Calculates an outward radial offset based on the camera's yaw angle.
+Returns the offset yaw, used for positioning or alignment
### Lua Example
`local integerValue = offset_yaw_outward_radial(c, areaYaw)`
@@ -1622,7 +1702,8 @@ Calculates an outward radial offset based on the camera's yaw angle. Returns the
## [play_camera_buzz_if_cdown](#play_camera_buzz_if_cdown)
### Description
-Plays a buzzing sound effect when the camera attempts to move downward but is restricted. Provides feedback for invalid C-Down input actions
+Plays a buzzing sound effect when the camera attempts to move downward but is restricted.
+Provides feedback for invalid C-Down input actions
### Lua Example
`play_camera_buzz_if_cdown()`
@@ -1643,7 +1724,8 @@ Plays a buzzing sound effect when the camera attempts to move downward but is re
## [play_camera_buzz_if_cbutton](#play_camera_buzz_if_cbutton)
### Description
-Plays a buzzing sound effect when a blocked C-button action is attempted. Used to signal invalid input or restricted camera movement
+Plays a buzzing sound effect when a blocked C-button action is attempted.
+Used to signal invalid input or restricted camera movement
### Lua Example
`play_camera_buzz_if_cbutton()`
@@ -1664,7 +1746,8 @@ Plays a buzzing sound effect when a blocked C-button action is attempted. Used t
## [play_camera_buzz_if_c_sideways](#play_camera_buzz_if_c_sideways)
### Description
-Plays a buzzing sound effect when the camera's position is misaligned with the player's perspective. Used as audio feedback for incorrect camera behavior
+Plays a buzzing sound effect when the camera's position is misaligned with the player's perspective.
+Used as audio feedback for incorrect camera behavior
### Lua Example
`play_camera_buzz_if_c_sideways()`
@@ -1685,7 +1768,8 @@ Plays a buzzing sound effect when the camera's position is misaligned with the p
## [play_sound_cbutton_up](#play_sound_cbutton_up)
### Description
-Plays a sound effect when the C-Up button is pressed for camera movement. Provides feedback for vertical camera adjustments
+Plays a sound effect when the C-Up button is pressed for camera movement.
+Provides feedback for vertical camera adjustments
### Lua Example
`play_sound_cbutton_up()`
@@ -1706,7 +1790,8 @@ Plays a sound effect when the C-Up button is pressed for camera movement. Provid
## [play_sound_cbutton_down](#play_sound_cbutton_down)
### Description
-Plays a sound effect when the C-Down button is pressed for camera movement. Provides auditory feedback for valid camera input
+Plays a sound effect when the C-Down button is pressed for camera movement.
+Provides auditory feedback for valid camera input
### Lua Example
`play_sound_cbutton_down()`
@@ -1727,7 +1812,8 @@ Plays a sound effect when the C-Down button is pressed for camera movement. Prov
## [play_sound_cbutton_side](#play_sound_cbutton_side)
### Description
-Plays a sound effect when the C-Side button (left or right) is pressed for camera movement. Used as audio feedback for horizontal adjustments to the camera
+Plays a sound effect when the C-Side button (left or right) is pressed for camera movement.
+Used as audio feedback for horizontal adjustments to the camera
### Lua Example
`play_sound_cbutton_side()`
@@ -1748,7 +1834,8 @@ Plays a sound effect when the C-Side button (left or right) is pressed for camer
## [play_sound_button_change_blocked](#play_sound_button_change_blocked)
### Description
-Plays a sound effect when a blocked action changes the camera mode. This provides feedback for invalid attempts to switch the camera state
+Plays a sound effect when a blocked action changes the camera mode.
+This provides feedback for invalid attempts to switch the camera state
### Lua Example
`play_sound_button_change_blocked()`
@@ -1769,7 +1856,8 @@ Plays a sound effect when a blocked action changes the camera mode. This provide
## [play_sound_rbutton_changed](#play_sound_rbutton_changed)
### Description
-Plays a sound effect when the R-Button camera mode is changed. Provides feedback for toggling camera behaviors
+Plays a sound effect when the R-Button camera mode is changed.
+Provides feedback for toggling camera behaviors
### Lua Example
`play_sound_rbutton_changed()`
@@ -1790,7 +1878,8 @@ Plays a sound effect when the R-Button camera mode is changed. Provides feedback
## [play_sound_if_cam_switched_to_lakitu_or_mario](#play_sound_if_cam_switched_to_lakitu_or_mario)
### Description
-Plays a sound effect when the camera switches between Lakitu and Mario perspectives. Signals a successful change in camera mode
+Plays a sound effect when the camera switches between Lakitu and Mario perspectives.
+Signals a successful change in camera mode
### Lua Example
`play_sound_if_cam_switched_to_lakitu_or_mario()`
@@ -1811,7 +1900,8 @@ Plays a sound effect when the camera switches between Lakitu and Mario perspecti
## [radial_camera_input](#radial_camera_input)
### Description
-Handles radial camera movement based on player input. Updates the camera's position or orientation accordingly
+Handles radial camera movement based on player input.
+Updates the camera's position or orientation accordingly
### Lua Example
`local integerValue = radial_camera_input(c, unused)`
@@ -1835,7 +1925,8 @@ Handles radial camera movement based on player input. Updates the camera's posit
## [trigger_cutscene_dialog](#trigger_cutscene_dialog)
### Description
-Triggers a dialog sequence during a cutscene. The dialog is synchronized with the camera's position and movement
+Triggers a dialog sequence during a cutscene.
+The dialog is synchronized with the camera's position and movement
### Lua Example
`local integerValue = trigger_cutscene_dialog(trigger)`
@@ -1858,7 +1949,8 @@ Triggers a dialog sequence during a cutscene. The dialog is synchronized with th
## [handle_c_button_movement](#handle_c_button_movement)
### Description
-Handles camera movement based on input from the C-buttons. Updates the camera's position or angle to match directional player input
+Handles camera movement based on input from the C-buttons.
+Updates the camera's position or angle to match directional player input
### Lua Example
`handle_c_button_movement(c)`
@@ -1881,7 +1973,8 @@ Handles camera movement based on input from the C-buttons. Updates the camera's
## [start_cutscene](#start_cutscene)
### Description
-Starts a cutscene based on the provided ID. The camera transitions to predefined behaviors for the duration of the cutscene
+Starts a cutscene based on the provided ID.
+The camera transitions to predefined behaviors for the duration of the cutscene
### Lua Example
`start_cutscene(c, cutscene)`
@@ -1905,7 +1998,8 @@ Starts a cutscene based on the provided ID. The camera transitions to predefined
## [get_cutscene_from_mario_status](#get_cutscene_from_mario_status)
### Description
-Gets the appropriate cutscene to play based on Mario's current gameplay state. This function helps determine transitions for cinematic or scripted sequences
+Gets the appropriate cutscene to play based on Mario's current gameplay state.
+This function helps determine transitions for cinematic or scripted sequences
### Lua Example
`local integerValue = get_cutscene_from_mario_status(c)`
@@ -1928,7 +2022,8 @@ Gets the appropriate cutscene to play based on Mario's current gameplay state. T
## [warp_camera](#warp_camera)
### Description
-Moves the camera to a specified warp destination. This function handles transitions between levels or areas seamlessly
+Moves the camera to a specified warp destination.
+This function handles transitions between levels or areas seamlessly
### Lua Example
`warp_camera(displacementX, displacementY, displacementZ)`
@@ -1953,7 +2048,8 @@ Moves the camera to a specified warp destination. This function handles transiti
## [approach_camera_height](#approach_camera_height)
### Description
-Adjusts the camera's height toward a target value (`goalHeight`) while respecting terrain and obstructions. This is really wonky and probably shouldn't be used, prefer `gLakituStates`
+Adjusts the camera's height toward a target value (`goalHeight`) while respecting terrain and obstructions.
+This is really wonky and probably shouldn't be used, prefer `gLakituStates`
### Lua Example
`approach_camera_height(c, goal, inc)`
@@ -1978,7 +2074,8 @@ Adjusts the camera's height toward a target value (`goalHeight`) while respectin
## [offset_rotated](#offset_rotated)
### Description
-Offsets a vector by rotating it in 3D space relative to a reference position. This is useful for creating radial effects or dynamic transformations
+Offsets a vector by rotating it in 3D space relative to a reference position.
+This is useful for creating radial effects or dynamic transformations
### Lua Example
`offset_rotated(dst, from, to, rotation)`
@@ -2004,7 +2101,8 @@ Offsets a vector by rotating it in 3D space relative to a reference position. Th
## [next_lakitu_state](#next_lakitu_state)
### Description
-Transitions the camera to the next Lakitu state, updating position and focus. This function handles smooth transitions between different gameplay scenarios
+Transitions the camera to the next Lakitu state, updating position and focus.
+This function handles smooth transitions between different gameplay scenarios
### Lua Example
`local integerValue = next_lakitu_state(newPos, newFoc, curPos, curFoc, oldPos, oldFoc, yaw)`
@@ -2056,7 +2154,8 @@ Set the fixed camera base pos depending on the current level area
## [camera_course_processing](#camera_course_processing)
### Description
-Processes course-specific camera settings, such as predefined positions or modes. Adjusts the camera to match the design and gameplay requirements of the current course
+Processes course-specific camera settings, such as predefined positions or modes.
+Adjusts the camera to match the design and gameplay requirements of the current course
### Lua Example
`local integerValue = camera_course_processing(c)`
@@ -2079,7 +2178,8 @@ Processes course-specific camera settings, such as predefined positions or modes
## [resolve_geometry_collisions](#resolve_geometry_collisions)
### Description
-Resolves collisions between the camera and level geometry. Adjusts the camera's position to prevent clipping or intersecting with objects
+Resolves collisions between the camera and level geometry.
+Adjusts the camera's position to prevent clipping or intersecting with objects
### Lua Example
`resolve_geometry_collisions(pos, lastGood)`
@@ -2103,7 +2203,8 @@ Resolves collisions between the camera and level geometry. Adjusts the camera's
## [rotate_camera_around_walls](#rotate_camera_around_walls)
### Description
-Rotates the camera to avoid walls or other obstructions. Ensures clear visibility of the player or target objects
+Rotates the camera to avoid walls or other obstructions.
+Ensures clear visibility of the player or target objects
### Lua Example
`local integerValue, avoidYaw = rotate_camera_around_walls(c, cPos, avoidYaw, yawRange)`
@@ -2130,7 +2231,8 @@ Rotates the camera to avoid walls or other obstructions. Ensures clear visibilit
## [start_object_cutscene_without_focus](#start_object_cutscene_without_focus)
### Description
-Starts a cutscene focused on an object without requiring focus to remain locked. This is useful for dynamic events where the camera adjusts freely
+Starts a cutscene focused on an object without requiring focus to remain locked.
+This is useful for dynamic events where the camera adjusts freely
### Lua Example
`local integerValue = start_object_cutscene_without_focus(cutscene)`
@@ -2153,7 +2255,8 @@ Starts a cutscene focused on an object without requiring focus to remain locked.
## [cutscene_object_with_dialog](#cutscene_object_with_dialog)
### Description
-Starts a cutscene involving an object and displays dialog during the sequence. The camera focuses on the object while synchronizing dialog with the scene
+Starts a cutscene involving an object and displays dialog during the sequence.
+The camera focuses on the object while synchronizing dialog with the scene
### Lua Example
`local integerValue = cutscene_object_with_dialog(cutscene, o, dialogID)`
@@ -2178,7 +2281,8 @@ Starts a cutscene involving an object and displays dialog during the sequence. T
## [cutscene_object_without_dialog](#cutscene_object_without_dialog)
### Description
-Starts a cutscene involving an object without dialog. The camera transitions smoothly to focus on the object
+Starts a cutscene involving an object without dialog.
+The camera transitions smoothly to focus on the object
### Lua Example
`local integerValue = cutscene_object_without_dialog(cutscene, o)`
@@ -2202,7 +2306,8 @@ Starts a cutscene involving an object without dialog. The camera transitions smo
## [cutscene_object](#cutscene_object)
### Description
-Initiates a cutscene focusing on a specific object in the game world. The camera transitions smoothly to the object, adapting its position as needed
+Initiates a cutscene focusing on a specific object in the game world.
+The camera transitions smoothly to the object, adapting its position as needed
### Lua Example
`local integerValue = cutscene_object(cutscene, o)`
@@ -2226,7 +2331,8 @@ Initiates a cutscene focusing on a specific object in the game world. The camera
## [play_cutscene](#play_cutscene)
### Description
-Starts the execution of a predefined cutscene. The camera transitions dynamically to follow the scripted sequence
+Starts the execution of a predefined cutscene.
+The camera transitions dynamically to follow the scripted sequence
### Lua Example
`play_cutscene(c)`
@@ -2249,7 +2355,8 @@ Starts the execution of a predefined cutscene. The camera transitions dynamicall
## [cutscene_spawn_obj](#cutscene_spawn_obj)
### Description
-Spawns an object as part of a cutscene, such as props or interactive elements. Returns the spawned object's reference for further manipulation
+Spawns an object as part of a cutscene, such as props or interactive elements.
+Returns the spawned object's reference for further manipulation
### Lua Example
`local integerValue = cutscene_spawn_obj(obj, frame)`
@@ -2273,7 +2380,8 @@ Spawns an object as part of a cutscene, such as props or interactive elements. R
## [set_fov_shake](#set_fov_shake)
### Description
-Applies a field-of-view shake effect to simulate zoom or focus disruptions. Shake parameters, such as amplitude and decay, control the intensity
+Applies a field-of-view shake effect to simulate zoom or focus disruptions.
+Shake parameters, such as amplitude and decay, control the intensity
### Lua Example
`set_fov_shake(amplitude, decay, shakeSpeed)`
@@ -2298,7 +2406,8 @@ Applies a field-of-view shake effect to simulate zoom or focus disruptions. Shak
## [set_fov_function](#set_fov_function)
### Description
-Assigns a custom function for dynamic field-of-view adjustments. This allows precise control over the camera's zoom behavior during gameplay
+Assigns a custom function for dynamic field-of-view adjustments.
+This allows precise control over the camera's zoom behavior during gameplay
### Lua Example
`set_fov_function(func)`
@@ -2321,7 +2430,8 @@ Assigns a custom function for dynamic field-of-view adjustments. This allows pre
## [cutscene_set_fov_shake_preset](#cutscene_set_fov_shake_preset)
### Description
-Applies a preset field-of-view shake effect during a cutscene. This creates dynamic visual effects, such as zoom or focus disruptions
+Applies a preset field-of-view shake effect during a cutscene.
+This creates dynamic visual effects, such as zoom or focus disruptions
### Lua Example
`cutscene_set_fov_shake_preset(preset)`
@@ -2344,7 +2454,8 @@ Applies a preset field-of-view shake effect during a cutscene. This creates dyna
## [set_fov_shake_from_point_preset](#set_fov_shake_from_point_preset)
### Description
-Applies a preset field-of-view shake effect relative to a specific point. The intensity diminishes as the distance from the point increases
+Applies a preset field-of-view shake effect relative to a specific point.
+The intensity diminishes as the distance from the point increases
### Lua Example
`set_fov_shake_from_point_preset(preset, posX, posY, posZ)`
@@ -2370,7 +2481,8 @@ Applies a preset field-of-view shake effect relative to a specific point. The in
## [obj_rotate_towards_point](#obj_rotate_towards_point)
### Description
-Rotates an object toward a specific point in 3D space. Gradually updates the object's pitch and yaw angles to face the target
+Rotates an object toward a specific point in 3D space.
+Gradually updates the object's pitch and yaw angles to face the target
### Lua Example
`obj_rotate_towards_point(o, point, pitchOff, yawOff, pitchDiv, yawDiv)`
@@ -2398,7 +2510,8 @@ Rotates an object toward a specific point in 3D space. Gradually updates the obj
## [set_camera_mode_fixed](#set_camera_mode_fixed)
### Description
-Activates a fixed camera mode and aligns the camera to specific X, Y, Z coordinates. This is useful for predefined static views in specific areas
+Activates a fixed camera mode and aligns the camera to specific X, Y, Z coordinates.
+This is useful for predefined static views in specific areas
### Lua Example
`local integerValue = set_camera_mode_fixed(c, x, y, z)`
@@ -2424,7 +2537,8 @@ Activates a fixed camera mode and aligns the camera to specific X, Y, Z coordina
## [snap_to_45_degrees](#snap_to_45_degrees)
### Description
-Takes in an SM64 angle unit and returns the nearest 45 degree angle, also in SM64 angle units. Useful when needing to align angles (camera, yaw, etc.)
+Takes in an SM64 angle unit and returns the nearest 45 degree angle, also in SM64 angle units.
+Useful when needing to align angles (camera, yaw, etc.)
### Lua Example
`local integerValue = snap_to_45_degrees(angle)`
@@ -2447,7 +2561,8 @@ Takes in an SM64 angle unit and returns the nearest 45 degree angle, also in SM6
## [camera_set_use_course_specific_settings](#camera_set_use_course_specific_settings)
### Description
-Toggles whether the camera uses course-specific settings. This is useful for enabling or disabling custom behaviors in specific courses or areas
+Toggles whether the camera uses course-specific settings.
+This is useful for enabling or disabling custom behaviors in specific courses or areas
### Lua Example
`camera_set_use_course_specific_settings(enable)`
@@ -2470,7 +2585,8 @@ Toggles whether the camera uses course-specific settings. This is useful for ena
## [center_rom_hack_camera](#center_rom_hack_camera)
### Description
-Centers the ROM hack camera. This function is designed for non-standard level layouts and modded game environments
+Centers the ROM hack camera.
+This function is designed for non-standard level layouts and modded game environments
### Lua Example
`center_rom_hack_camera()`
@@ -2627,7 +2743,8 @@ Gets a Character struct from `m`
## [play_character_sound](#play_character_sound)
### Description
-Plays a character-specific sound based on the given `characterSound` value. The sound is tied to Mario's current state (`m`). Useful for triggering sound effects for actions like jumping or interacting with the environment
+Plays a character-specific sound based on the given `characterSound` value. The sound is tied to Mario's current state (`m`).
+Useful for triggering sound effects for actions like jumping or interacting with the environment
### Lua Example
`play_character_sound(m, characterSound)`
@@ -2651,7 +2768,8 @@ Plays a character-specific sound based on the given `characterSound` value. The
## [play_character_sound_offset](#play_character_sound_offset)
### Description
-Plays a character-specific sound with an additional `offset`, allowing variations or delays in the sound effect. Uses Mario's current state (`m`). Useful for adding dynamic sound effects or syncing sounds to specific animations or events
+Plays a character-specific sound with an additional `offset`, allowing variations or delays in the sound effect. Uses Mario's current state (`m`).
+Useful for adding dynamic sound effects or syncing sounds to specific animations or events
### Lua Example
`play_character_sound_offset(m, characterSound, offset)`
@@ -2676,7 +2794,8 @@ Plays a character-specific sound with an additional `offset`, allowing variation
## [play_character_sound_if_no_flag](#play_character_sound_if_no_flag)
### Description
-Plays a character-specific sound only if certain flags are not set. This ensures that sounds are not repeated unnecessarily. The sound is based on `characterSound`, and the flags are checked using `flags`. Useful for avoiding duplicate sound effects in rapid succession or conditional actions
+Plays a character-specific sound only if certain flags are not set. This ensures that sounds are not repeated unnecessarily. The sound is based on `characterSound`, and the flags are checked using `flags`.
+Useful for avoiding duplicate sound effects in rapid succession or conditional actions
### Lua Example
`play_character_sound_if_no_flag(m, characterSound, flags)`
@@ -2701,7 +2820,8 @@ Plays a character-specific sound only if certain flags are not set. This ensures
## [get_character_anim_offset](#get_character_anim_offset)
### Description
-Calculates the animation offset for Mario's current animation. The offset is determined by the type of animation being played (e.g., hand, feet, or torso movement). Useful for smoothly syncing Mario's model height or positional adjustments during animations
+Calculates the animation offset for Mario's current animation. The offset is determined by the type of animation being played (e.g., hand, feet, or torso movement).
+Useful for smoothly syncing Mario's model height or positional adjustments during animations
### Lua Example
`local numberValue = get_character_anim_offset(m)`
@@ -2724,7 +2844,8 @@ Calculates the animation offset for Mario's current animation. The offset is det
## [get_character_anim](#get_character_anim)
### Description
-Gets the animation ID to use for a specific character and animation combination. The ID is based on `characterAnim` and the character currently controlled by Mario (`m`). Useful for determining which animation to play for actions like walking, jumping, or idle states
+Gets the animation ID to use for a specific character and animation combination. The ID is based on `characterAnim` and the character currently controlled by Mario (`m`).
+Useful for determining which animation to play for actions like walking, jumping, or idle states
### Lua Example
`local integerValue = get_character_anim(m, characterAnim)`
@@ -2772,7 +2893,8 @@ Gets the current name of the animation used if the animation is modded.
## [update_character_anim_offset](#update_character_anim_offset)
### Description
-Updates Mario's current animation offset. This adjusts Mario's position based on the calculated offset to ensure animations appear smooth and natural. Useful for keeping Mario's animations visually aligned, particularly when transitioning between animations
+Updates Mario's current animation offset. This adjusts Mario's position based on the calculated offset to ensure animations appear smooth and natural.
+Useful for keeping Mario's animations visually aligned, particularly when transitioning between animations
### Lua Example
`update_character_anim_offset(m)`
@@ -2938,7 +3060,8 @@ Set hud head texture for `character`. This is the texture that appears for the p
## [character_add_sound](#character_add_sound)
### Description
-Adds a `audioName` for `characterSound` on `character`. You can add multiple sound files to the same `characterSound` When you have multiple sounds, it picks between them at random.
+Adds a `audioName` for `characterSound` on `character`. You can add multiple sound files to the same `characterSound`
+When you have multiple sounds, it picks between them at random.
### Lua Example
`character_add_sound(character, characterSound, audioName)`
@@ -2963,7 +3086,8 @@ Adds a `audioName` for `characterSound` on `character`. You can add multiple sou
## [character_remove_sounds](#character_remove_sounds)
### Description
-Removes all sounds for `characterSound` on `character`. Every sound file will get removed from the character.
+Removes all sounds for `characterSound` on `character`.
+Every sound file will get removed from the character.
### Lua Example
`character_remove_sounds(character, characterSound)`
@@ -2987,7 +3111,9 @@ Removes all sounds for `characterSound` on `character`. Every sound file will ge
## [character_set_animation](#character_set_animation)
### Description
-Sets animation for `animID` using a registered smlua animation. You can regjster an smlua animation by using `smlua_util_register_animation`. The animation string you used to register the animation is the `animString` to be passed.
+Sets animation for `animID` using a registered smlua animation.
+You can regjster an smlua animation by using `smlua_util_register_animation`.
+The animation string you used to register the animation is the `animString` to be passed.
### Lua Example
`character_set_animation(character, animID, animString)`
@@ -5571,7 +5697,8 @@ Sets the state for a dialog box (`DIALOG_STATE_*`)
## [interact_coin](#interact_coin)
### Description
-Handles Mario's interaction with coins. Collecting a coin increases Mario's coin count and heals him slightly. Useful for score, and coin management
+Handles Mario's interaction with coins. Collecting a coin increases Mario's coin count and heals him slightly.
+Useful for score, and coin management
### Lua Example
`local integerValue = interact_coin(m, interactType, o)`
@@ -5596,7 +5723,8 @@ Handles Mario's interaction with coins. Collecting a coin increases Mario's coin
## [interact_water_ring](#interact_water_ring)
### Description
-Handles interactions with water rings that heal Mario. Passing through water rings increases his health counter. Useful for underwater stages
+Handles interactions with water rings that heal Mario. Passing through water rings increases his health counter.
+Useful for underwater stages
### Lua Example
`local integerValue = interact_water_ring(m, interactType, o)`
@@ -5621,7 +5749,8 @@ Handles interactions with water rings that heal Mario. Passing through water rin
## [interact_star_or_key](#interact_star_or_key)
### Description
-Handles interaction with Stars or Keys. If Mario collects a star or key, it triggers a specific star grab cutscene and progression is updated. Also handles no-exit variants (like the wing cap stage star). Useful for the main progression system of collecting Stars and unlocking new areas
+Handles interaction with Stars or Keys. If Mario collects a star or key, it triggers a specific star grab cutscene and progression is updated. Also handles no-exit variants (like the wing cap stage star).
+Useful for the main progression system of collecting Stars and unlocking new areas
### Lua Example
`local integerValue = interact_star_or_key(m, interactType, o)`
@@ -5671,7 +5800,8 @@ Handles Mario's interaction with the Boo's Big Haunt (BBH) entrance object. When
## [interact_warp](#interact_warp)
### Description
-Handles interaction with warps, including warp pipes and hole warps. If Mario steps onto a warp, he either transitions into another area or level. Useful for connecting different parts of the game world and controlling transitions between levels as well as custom warp areas
+Handles interaction with warps, including warp pipes and hole warps. If Mario steps onto a warp, he either transitions into another area or level.
+Useful for connecting different parts of the game world and controlling transitions between levels as well as custom warp areas
### Lua Example
`local integerValue = interact_warp(m, interactType, o)`
@@ -5696,7 +5826,8 @@ Handles interaction with warps, including warp pipes and hole warps. If Mario st
## [interact_warp_door](#interact_warp_door)
### Description
-Handles interaction with warp doors that lead to other areas or require keys. If Mario can open the door (has enough stars or a key), he proceeds. Otherwise, it may show a dialog. Useful for restricting access to certain areas based on progression
+Handles interaction with warp doors that lead to other areas or require keys. If Mario can open the door (has enough stars or a key), he proceeds. Otherwise, it may show a dialog.
+Useful for restricting access to certain areas based on progression
### Lua Example
`local integerValue = interact_warp_door(m, interactType, o)`
@@ -5721,7 +5852,8 @@ Handles interaction with warp doors that lead to other areas or require keys. If
## [interact_door](#interact_door)
### Description
-Handles interaction when Mario touches a door. If Mario meets the star requirement or has the key, he can unlock/open the door. Otherwise, it may display dialog indicating the requirement. Useful for controlling access to locked areas and providing progression gating in the game
+Handles interaction when Mario touches a door. If Mario meets the star requirement or has the key, he can unlock/open the door. Otherwise, it may display dialog indicating the requirement.
+Useful for controlling access to locked areas and providing progression gating in the game
### Lua Example
`local integerValue = interact_door(m, interactType, o)`
@@ -5746,7 +5878,8 @@ Handles interaction when Mario touches a door. If Mario meets the star requireme
## [interact_cannon_base](#interact_cannon_base)
### Description
-Handles interaction when Mario touches a cannon base. If the cannon is ready, Mario enters the cannon, triggering a special action and camera behavior. Useful for transitioning to cannon-aiming mode and enabling cannon travel within levels
+Handles interaction when Mario touches a cannon base. If the cannon is ready, Mario enters the cannon, triggering a special action and camera behavior.
+Useful for transitioning to cannon-aiming mode and enabling cannon travel within levels
### Lua Example
`local integerValue = interact_cannon_base(m, interactType, o)`
@@ -5771,7 +5904,9 @@ Handles interaction when Mario touches a cannon base. If the cannon is ready, Ma
## [interact_player](#interact_player)
### Description
-Handles interaction with another player (in multiplayer scenarios). Checks if Mario and another player collide and resolves any special behavior like bouncing on top. Useful for multiplayer interactions, such as PvP or cooperative gameplay mechanics
+Handles interaction with another player (in multiplayer scenarios).
+Checks if Mario and another player collide and resolves any special behavior like bouncing on top.
+Useful for multiplayer interactions, such as PvP or cooperative gameplay mechanics
### Lua Example
`local integerValue = interact_player(m, interactType, o)`
@@ -5796,7 +5931,8 @@ Handles interaction with another player (in multiplayer scenarios). Checks if Ma
## [interact_igloo_barrier](#interact_igloo_barrier)
### Description
-Handles interaction with the igloo barrier found in Snowman's Land. If Mario runs into the barrier, this function pushes him away and prevents passage without the vanish cap. Useful for enforcing require-caps to access certain areas
+Handles interaction with the igloo barrier found in Snowman's Land. If Mario runs into the barrier, this function pushes him away and prevents passage without the vanish cap.
+Useful for enforcing require-caps to access certain areas
### Lua Example
`local integerValue = interact_igloo_barrier(m, interactType, o)`
@@ -5821,7 +5957,8 @@ Handles interaction with the igloo barrier found in Snowman's Land. If Mario run
## [interact_tornado](#interact_tornado)
### Description
-Handles interaction with tornados. If Mario touches a tornado, he enters a spinning twirl action, losing control temporarily. Useful for desert levels or areas where environmental hazards lift Mario into the air
+Handles interaction with tornados. If Mario touches a tornado, he enters a spinning twirl action, losing control temporarily.
+Useful for desert levels or areas where environmental hazards lift Mario into the air
### Lua Example
`local integerValue = interact_tornado(m, interactType, o)`
@@ -5846,7 +5983,8 @@ Handles interaction with tornados. If Mario touches a tornado, he enters a spinn
## [interact_whirlpool](#interact_whirlpool)
### Description
-Handles interaction with whirlpools. If Mario gets caught in a whirlpool, he's pulled toward it, resulting in a unique "caught" action. Useful for hazards that trap Mario like whirlpools
+Handles interaction with whirlpools. If Mario gets caught in a whirlpool, he's pulled toward it, resulting in a unique "caught" action.
+Useful for hazards that trap Mario like whirlpools
### Lua Example
`local integerValue = interact_whirlpool(m, interactType, o)`
@@ -5871,7 +6009,8 @@ Handles interaction with whirlpools. If Mario gets caught in a whirlpool, he's p
## [interact_strong_wind](#interact_strong_wind)
### Description
-Handles interaction with strong wind gusts. These gusts push Mario back, often knocking him off platforms or sending him flying backwards. Useful for environmental wind hazards
+Handles interaction with strong wind gusts. These gusts push Mario back, often knocking him off platforms or sending him flying backwards.
+Useful for environmental wind hazards
### Lua Example
`local integerValue = interact_strong_wind(m, interactType, o)`
@@ -5896,7 +6035,8 @@ Handles interaction with strong wind gusts. These gusts push Mario back, often k
## [interact_flame](#interact_flame)
### Description
-Handles interaction with flame objects. If Mario touches a flame and is not invulnerable or protected by certain caps, he takes damage and may be set on fire, causing a burning jump. Useful for simulating fire damage and hazards in levels
+Handles interaction with flame objects. If Mario touches a flame and is not invulnerable or protected by certain caps, he takes damage and may be set on fire, causing a burning jump.
+Useful for simulating fire damage and hazards in levels
### Lua Example
`local integerValue = interact_flame(m, interactType, o)`
@@ -5946,7 +6086,8 @@ Handles interaction with Snufit bullets (projectiles fired by certain enemies).
## [interact_clam_or_bubba](#interact_clam_or_bubba)
### Description
-Handles interactions with objects like Clams or Bubbas, which can damage Mario or, in Bubba's case, eat Mario. If Bubba eats Mario, it triggers a unique "caught" action. Otherwise, it deals damage and knockback if hit by a Clam
+Handles interactions with objects like Clams or Bubbas, which can damage Mario or, in Bubba's case, eat Mario.
+If Bubba eats Mario, it triggers a unique "caught" action. Otherwise, it deals damage and knockback if hit by a Clam
### Lua Example
`local integerValue = interact_clam_or_bubba(m, interactType, o)`
@@ -5971,7 +6112,8 @@ Handles interactions with objects like Clams or Bubbas, which can damage Mario o
## [interact_bully](#interact_bully)
### Description
-Handles interaction with Bully enemies. Determines if Mario attacks the Bully or gets knocked back. Updates Mario's velocity and state accordingly, and can defeat the Bully if attacked successfully. Useful for enemy encounters that involve pushing and shoving mechanics rather than just stomping like the bullies
+Handles interaction with Bully enemies. Determines if Mario attacks the Bully or gets knocked back. Updates Mario's velocity and state accordingly, and can defeat the Bully if attacked successfully.
+Useful for enemy encounters that involve pushing and shoving mechanics rather than just stomping like the bullies
### Lua Example
`local integerValue = interact_bully(m, interactType, o)`
@@ -5996,7 +6138,8 @@ Handles interaction with Bully enemies. Determines if Mario attacks the Bully or
## [interact_shock](#interact_shock)
### Description
-Handles interaction with shocking objects. If Mario touches an electrified enemy or hazard, he takes damage and may be stunned or shocked. Useful for electric-themed enemies and obstacles
+Handles interaction with shocking objects. If Mario touches an electrified enemy or hazard, he takes damage and may be stunned or shocked.
+Useful for electric-themed enemies and obstacles
### Lua Example
`local integerValue = interact_shock(m, interactType, o)`
@@ -6021,7 +6164,8 @@ Handles interaction with shocking objects. If Mario touches an electrified enemy
## [interact_mr_blizzard](#interact_mr_blizzard)
### Description
-Handles interaction with Mr. Blizzard (the snowman enemy) or similar objects. If Mario is attacked or collides with Mr. Blizzard, it applies damage and knockback if not protected or attacking
+Handles interaction with Mr. Blizzard (the snowman enemy) or similar objects.
+If Mario is attacked or collides with Mr. Blizzard, it applies damage and knockback if not protected or attacking
### Lua Example
`local integerValue = interact_mr_blizzard(m, interactType, o)`
@@ -6046,7 +6190,8 @@ Handles interaction with Mr. Blizzard (the snowman enemy) or similar objects. If
## [interact_hit_from_below](#interact_hit_from_below)
### Description
-Handles interactions where Mario hits an object from below (e.g., hitting a block from underneath). Determines if Mario damages/destroys the object, or if it damages Mario. Useful for handling upward attacks, hitting coin blocks, or interacting with certain NPCs from below
+Handles interactions where Mario hits an object from below (e.g., hitting a block from underneath). Determines if Mario damages/destroys the object, or if it damages Mario.
+Useful for handling upward attacks, hitting coin blocks, or interacting with certain NPCs from below
### Lua Example
`local integerValue = interact_hit_from_below(m, interactType, o)`
@@ -6071,7 +6216,9 @@ Handles interactions where Mario hits an object from below (e.g., hitting a bloc
## [interact_bounce_top](#interact_bounce_top)
### Description
-Handles interactions where Mario bounces off the top of an object (e.g., Goombas, Koopas). Checks if Mario attacks the object from above and applies the appropriate knockback, sound effects, and object state changes. Useful for enemy defeat mechanics and platform bouncing
+Handles interactions where Mario bounces off the top of an object (e.g., Goombas, Koopas).
+Checks if Mario attacks the object from above and applies the appropriate knockback, sound effects, and object state changes.
+Useful for enemy defeat mechanics and platform bouncing
### Lua Example
`local integerValue = interact_bounce_top(m, interactType, o)`
@@ -6096,7 +6243,8 @@ Handles interactions where Mario bounces off the top of an object (e.g., Goombas
## [interact_spiny_walking](#interact_spiny_walking)
### Description
-Handles interaction with Spiny-walking enemies. If Mario attacks it (e.g., by punching), the enemy is hurt. If he fails to attack properly (say bouncing on top), Mario takes damage and knockback. Useful for enemies that cannot be stomped from above and require direct attacks
+Handles interaction with Spiny-walking enemies. If Mario attacks it (e.g., by punching), the enemy is hurt. If he fails to attack properly (say bouncing on top), Mario takes damage and knockback.
+Useful for enemies that cannot be stomped from above and require direct attacks
### Lua Example
`local integerValue = interact_spiny_walking(m, interactType, o)`
@@ -6121,7 +6269,8 @@ Handles interaction with Spiny-walking enemies. If Mario attacks it (e.g., by pu
## [interact_damage](#interact_damage)
### Description
-Handles damaging interactions from various objects (e.g., enemies, hazards). If Mario takes damage, it applies knockback and reduces health. Useful for enemy attacks, environmental hazards, and managing damage related behaviors
+Handles damaging interactions from various objects (e.g., enemies, hazards). If Mario takes damage, it applies knockback and reduces health.
+Useful for enemy attacks, environmental hazards, and managing damage related behaviors
### Lua Example
`local integerValue = interact_damage(m, interactType, o)`
@@ -6146,7 +6295,8 @@ Handles damaging interactions from various objects (e.g., enemies, hazards). If
## [interact_breakable](#interact_breakable)
### Description
-Handles interactions with breakable objects (e.g., breakable boxes or bob-ombs). If Mario hits the object with a valid attack (like a punch or kick), the object is destroyed or changes state. Useful for managing collectible items hidden in breakable objects and level progression through destructible blocks or walls
+Handles interactions with breakable objects (e.g., breakable boxes or bob-ombs). If Mario hits the object with a valid attack (like a punch or kick), the object is destroyed or changes state.
+Useful for managing collectible items hidden in breakable objects and level progression through destructible blocks or walls
### Lua Example
`local integerValue = interact_breakable(m, interactType, o)`
@@ -6171,7 +6321,8 @@ Handles interactions with breakable objects (e.g., breakable boxes or bob-ombs).
## [interact_koopa_shell](#interact_koopa_shell)
### Description
-Handles interaction when Mario touches a Koopa Shell. If conditions are met, Mario can hop onto the shell and start riding it, changing his movement mechanics. Useful for implementing Koopa Shell behavior
+Handles interaction when Mario touches a Koopa Shell. If conditions are met, Mario can hop onto the shell and start riding it, changing his movement mechanics.
+Useful for implementing Koopa Shell behavior
### Lua Example
`local integerValue = interact_koopa_shell(m, interactType, o)`
@@ -6196,7 +6347,8 @@ Handles interaction when Mario touches a Koopa Shell. If conditions are met, Mar
## [interact_pole](#interact_pole)
### Description
-Handles interaction with poles (e.g., climbing poles). If Mario runs into a vertical pole, he can grab it and start climbing. Useful for platforming mechanics
+Handles interaction with poles (e.g., climbing poles). If Mario runs into a vertical pole, he can grab it and start climbing.
+Useful for platforming mechanics
### Lua Example
`local integerValue = interact_pole(m, interactType, o)`
@@ -6221,7 +6373,8 @@ Handles interaction with poles (e.g., climbing poles). If Mario runs into a vert
## [interact_hoot](#interact_hoot)
### Description
-Handles interaction with Hoot, the owl. If Mario can grab onto Hoot, this sets Mario onto a riding action, allowing him to fly around the level. Useful for special traversal mechanics and shortcuts within a course
+Handles interaction with Hoot, the owl. If Mario can grab onto Hoot, this sets Mario onto a riding action, allowing him to fly around the level.
+Useful for special traversal mechanics and shortcuts within a course
### Lua Example
`local integerValue = interact_hoot(m, interactType, o)`
@@ -6246,7 +6399,9 @@ Handles interaction with Hoot, the owl. If Mario can grab onto Hoot, this sets M
## [interact_cap](#interact_cap)
### Description
-Handles interaction when Mario picks up a cap object. This includes normal caps, wing caps, vanish caps, and metal caps. Updates Mario's state (e.g., cap timers, sound effects) and may initiate putting on the cap animation. Useful for managing cap statuses
+Handles interaction when Mario picks up a cap object. This includes normal caps, wing caps, vanish caps, and metal caps.
+Updates Mario's state (e.g., cap timers, sound effects) and may initiate putting on the cap animation.
+Useful for managing cap statuses
### Lua Example
`local integerValue = interact_cap(m, interactType, o)`
@@ -6271,7 +6426,8 @@ Handles interaction when Mario picks up a cap object. This includes normal caps,
## [interact_grabbable](#interact_grabbable)
### Description
-Handles interaction with grabbable objects (e.g., crates, small enemies, or Bowser). Checks if Mario can pick up the object and initiates the grab action if possible. Useful for course mechanics, throwing items, and Bowser
+Handles interaction with grabbable objects (e.g., crates, small enemies, or Bowser). Checks if Mario can pick up the object and initiates the grab action if possible.
+Useful for course mechanics, throwing items, and Bowser
### Lua Example
`local integerValue = interact_grabbable(m, interactType, o)`
@@ -6296,7 +6452,8 @@ Handles interaction with grabbable objects (e.g., crates, small enemies, or Bows
## [interact_text](#interact_text)
### Description
-Handles interaction with signs, NPCs, and other text-bearing objects. If Mario presses the interact button facing them, he enters a dialog reading state. Useful for managing hints, story elements, or gameplay instructions through in-game dialogue
+Handles interaction with signs, NPCs, and other text-bearing objects. If Mario presses the interact button facing them, he enters a dialog reading state.
+Useful for managing hints, story elements, or gameplay instructions through in-game dialogue
### Lua Example
`local integerValue = interact_text(m, interactType, o)`
@@ -6321,7 +6478,8 @@ Handles interaction with signs, NPCs, and other text-bearing objects. If Mario p
## [mario_obj_angle_to_object](#mario_obj_angle_to_object)
### Description
-Calculates the angle between Mario and a specified object. Used for determining Mario's orientation relative to the object. Useful for deciding directions between Mario and NPCs
+Calculates the angle between Mario and a specified object. Used for determining Mario's orientation relative to the object.
+Useful for deciding directions between Mario and NPCs
### Lua Example
`local integerValue = mario_obj_angle_to_object(m, o)`
@@ -6345,7 +6503,8 @@ Calculates the angle between Mario and a specified object. Used for determining
## [mario_stop_riding_object](#mario_stop_riding_object)
### Description
-Stops Mario from riding any currently ridden object (e.g., a Koopa shell or Hoot), updating the object's interaction status and Mario's state. Useful for cleanly dismounting ridden objects
+Stops Mario from riding any currently ridden object (e.g., a Koopa shell or Hoot), updating the object's interaction status and Mario's state.
+Useful for cleanly dismounting ridden objects
### Lua Example
`mario_stop_riding_object(m)`
@@ -6368,7 +6527,9 @@ Stops Mario from riding any currently ridden object (e.g., a Koopa shell or Hoot
## [mario_grab_used_object](#mario_grab_used_object)
### Description
-Grabs the object currently referenced by Mario's `usedObj` if it's not already being held. Changes the object's state to indicate it is now held by Mario. Useful for handling the moment Mario successfully picks up an object
+Grabs the object currently referenced by Mario's `usedObj` if it's not already being held.
+Changes the object's state to indicate it is now held by Mario.
+Useful for handling the moment Mario successfully picks up an object
### Lua Example
`mario_grab_used_object(m)`
@@ -6391,7 +6552,8 @@ Grabs the object currently referenced by Mario's `usedObj` if it's not already b
## [mario_drop_held_object](#mario_drop_held_object)
### Description
-Causes Mario to drop the object he is currently holding. Sets the held object's state accordingly and places it in front of Mario. Useful for releasing carried objects, such as throwing Bob-ombs or setting down crates
+Causes Mario to drop the object he is currently holding. Sets the held object's state accordingly and places it in front of Mario.
+Useful for releasing carried objects, such as throwing Bob-ombs or setting down crates
### Lua Example
`mario_drop_held_object(m)`
@@ -6414,7 +6576,8 @@ Causes Mario to drop the object he is currently holding. Sets the held object's
## [mario_throw_held_object](#mario_throw_held_object)
### Description
-Throws the object Mario is currently holding. The object is placed in front of Mario and given a forward velocity. Useful for attacking enemies with thrown objects, solving puzzles by throwing crates, or interacting with environment items
+Throws the object Mario is currently holding. The object is placed in front of Mario and given a forward velocity.
+Useful for attacking enemies with thrown objects, solving puzzles by throwing crates, or interacting with environment items
### Lua Example
`mario_throw_held_object(m)`
@@ -6437,7 +6600,9 @@ Throws the object Mario is currently holding. The object is placed in front of M
## [mario_stop_riding_and_holding](#mario_stop_riding_and_holding)
### Description
-Causes Mario to stop riding any object (like a shell or Hoot) and also drop any held object. Resets related states to ensure Mario is no longer attached to or holding anything. Useful when changing Mario's state after certain actions, transitions, or to prevent exploits
+Causes Mario to stop riding any object (like a shell or Hoot) and also drop any held object.
+Resets related states to ensure Mario is no longer attached to or holding anything.
+Useful when changing Mario's state after certain actions, transitions, or to prevent exploits
### Lua Example
`mario_stop_riding_and_holding(m)`
@@ -6460,7 +6625,9 @@ Causes Mario to stop riding any object (like a shell or Hoot) and also drop any
## [does_mario_have_normal_cap_on_head](#does_mario_have_normal_cap_on_head)
### Description
-Checks if Mario is currently wearing his normal cap on his head. Returns true if Mario's flag state matches that of having the normal cap equipped on his head, otherwise false. Useful for determining Mario's cap status
+Checks if Mario is currently wearing his normal cap on his head.
+Returns true if Mario's flag state matches that of having the normal cap equipped on his head, otherwise false.
+Useful for determining Mario's cap status
### Lua Example
`local integerValue = does_mario_have_normal_cap_on_head(m)`
@@ -6483,7 +6650,9 @@ Checks if Mario is currently wearing his normal cap on his head. Returns true if
## [does_mario_have_blown_cap](#does_mario_have_blown_cap)
### Description
-Checks if Mario has already had a cap blown off of his head in the current level, Returns true if a blown cap can be found for Mario, false if not. Useful to check if a blown cap exists in the level currently.
+Checks if Mario has already had a cap blown off of his head in the current level,
+Returns true if a blown cap can be found for Mario, false if not.
+Useful to check if a blown cap exists in the level currently.
### Lua Example
`local booleanValue = does_mario_have_blown_cap(m)`
@@ -6506,7 +6675,9 @@ Checks if Mario has already had a cap blown off of his head in the current level
## [mario_blow_off_cap](#mario_blow_off_cap)
### Description
-Makes Mario blow off his normal cap at a given speed. Removes the normal cap from Mario's head and spawns it as a collectible object in the game world. Useful for simulating events where Mario loses his cap due to enemy attacks or environmental forces
+Makes Mario blow off his normal cap at a given speed.
+Removes the normal cap from Mario's head and spawns it as a collectible object in the game world.
+Useful for simulating events where Mario loses his cap due to enemy attacks or environmental forces
### Lua Example
`mario_blow_off_cap(m, capSpeed)`
@@ -6530,7 +6701,9 @@ Makes Mario blow off his normal cap at a given speed. Removes the normal cap fro
## [mario_lose_cap_to_enemy](#mario_lose_cap_to_enemy)
### Description
-Makes Mario lose his normal cap to an enemy, such as Klepto or Ukiki. Updates flags so that the cap is no longer on Mario's head. Returns true if Mario was wearing his normal cap, otherwise false. Useful for scenarios where enemies steal Mario's cap
+Makes Mario lose his normal cap to an enemy, such as Klepto or Ukiki. Updates flags so that the cap is no longer on Mario's head.
+Returns true if Mario was wearing his normal cap, otherwise false.
+Useful for scenarios where enemies steal Mario's cap
### Lua Example
`local integerValue = mario_lose_cap_to_enemy(m, arg)`
@@ -6554,7 +6727,9 @@ Makes Mario lose his normal cap to an enemy, such as Klepto or Ukiki. Updates fl
## [mario_retrieve_cap](#mario_retrieve_cap)
### Description
-Retrieves Mario's normal cap if it was previously lost. Removes the cap from Mario's hand state and places it on his head. Useful when Mario recovers his normal cap from enemies, finds it in a level, or if it were to disappear
+Retrieves Mario's normal cap if it was previously lost.
+Removes the cap from Mario's hand state and places it on his head.
+Useful when Mario recovers his normal cap from enemies, finds it in a level, or if it were to disappear
### Lua Example
`mario_retrieve_cap(m)`
@@ -6577,7 +6752,8 @@ Retrieves Mario's normal cap if it was previously lost. Removes the cap from Mar
## [mario_get_collided_object](#mario_get_collided_object)
### Description
-Returns a collided object that matches a given interaction type from Mario's current collision data. Useful for determining which object Mario has come into contact with
+Returns a collided object that matches a given interaction type from Mario's current collision data.
+Useful for determining which object Mario has come into contact with
### Lua Example
`local objectValue = mario_get_collided_object(m, interactType)`
@@ -6601,7 +6777,8 @@ Returns a collided object that matches a given interaction type from Mario's cur
## [mario_check_object_grab](#mario_check_object_grab)
### Description
-Checks if Mario can grab the currently encountered object (usually triggered when Mario punches or dives). If conditions are met, initiates the grabbing process. Useful for picking up objects, throwing enemies, or grabbing special items
+Checks if Mario can grab the currently encountered object (usually triggered when Mario punches or dives). If conditions are met, initiates the grabbing process.
+Useful for picking up objects, throwing enemies, or grabbing special items
### Lua Example
`local integerValue = mario_check_object_grab(m)`
@@ -6624,7 +6801,8 @@ Checks if Mario can grab the currently encountered object (usually triggered whe
## [get_door_save_file_flag](#get_door_save_file_flag)
### Description
-Retrieves the save file flag associated with a door, based on the number of stars required to open it. Used to check if the player has unlocked certain star doors or progressed far enough to access new areas
+Retrieves the save file flag associated with a door, based on the number of stars required to open it.
+Used to check if the player has unlocked certain star doors or progressed far enough to access new areas
### Lua Example
`local integerValue = get_door_save_file_flag(door)`
@@ -6647,7 +6825,9 @@ Retrieves the save file flag associated with a door, based on the number of star
## [passes_pvp_interaction_checks](#passes_pvp_interaction_checks)
### Description
-Checks if the necessary conditions are met for one player to successfully attack another player in a PvP scenario. Considers factors like invincibility, action states, and whether the attack is valid. Useful for multiplayer where players can harm each other
+Checks if the necessary conditions are met for one player to successfully attack another player in a PvP scenario.
+Considers factors like invincibility, action states, and whether the attack is valid.
+Useful for multiplayer where players can harm each other
### Lua Example
`local integerValue = passes_pvp_interaction_checks(attacker, victim)`
@@ -6671,7 +6851,8 @@ Checks if the necessary conditions are met for one player to successfully attack
## [should_push_or_pull_door](#should_push_or_pull_door)
### Description
-Determines whether Mario should push or pull a door when he interacts with it, based on his orientation and position. Useful for animating door interactions realistically, depending on which side Mario approaches from
+Determines whether Mario should push or pull a door when he interacts with it, based on his orientation and position.
+Useful for animating door interactions realistically, depending on which side Mario approaches from
### Lua Example
`local integerValue = should_push_or_pull_door(m, o)`
@@ -6695,7 +6876,9 @@ Determines whether Mario should push or pull a door when he interacts with it, b
## [take_damage_and_knock_back](#take_damage_and_knock_back)
### Description
-Handles the logic of Mario taking damage and being knocked back by a damaging object. Decreases Mario's health, sets his knockback state, and triggers appropriate sound and camera effects. Useful for implementing enemy attacks, hazards, and ensuring Mario receives proper feedback upon taking damage
+Handles the logic of Mario taking damage and being knocked back by a damaging object.
+Decreases Mario's health, sets his knockback state, and triggers appropriate sound and camera effects.
+Useful for implementing enemy attacks, hazards, and ensuring Mario receives proper feedback upon taking damage
### Lua Example
`local integerValue = take_damage_and_knock_back(m, o)`
@@ -6719,7 +6902,8 @@ Handles the logic of Mario taking damage and being knocked back by a damaging ob
## [get_mario_cap_flag](#get_mario_cap_flag)
### Description
-Determines the type of cap an object represents. Depending on the object's behavior, it returns a cap type (normal, metal, wing, vanish). Useful for handling the logic of picking up, wearing, or losing different kinds of caps
+Determines the type of cap an object represents. Depending on the object's behavior, it returns a cap type (normal, metal, wing, vanish).
+Useful for handling the logic of picking up, wearing, or losing different kinds of caps
### Lua Example
`local integerValue = get_mario_cap_flag(capObject)`
@@ -6742,7 +6926,9 @@ Determines the type of cap an object represents. Depending on the object's behav
## [determine_interaction](#determine_interaction)
### Description
-Determines how Mario interacts with a given object based on his current action, position, and other state variables. Calculates the appropriate interaction type (e.g., punch, kick, ground pound) that should result from Mario's contact with the specified object (`o`). Useful for handling different types of player-object collisions, attacks, and object behaviors
+Determines how Mario interacts with a given object based on his current action, position, and other state variables.
+Calculates the appropriate interaction type (e.g., punch, kick, ground pound) that should result from Mario's contact with the specified object (`o`).
+Useful for handling different types of player-object collisions, attacks, and object behaviors
### Lua Example
`local integerValue = determine_interaction(m, o)`
@@ -6864,7 +7050,8 @@ Gets the local Mario's state index
## [get_level_name_ascii](#get_level_name_ascii)
### Description
-Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an ASCII (human readable) string. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
+Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an ASCII (human readable) string.
+Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
### Lua Example
`local stringValue = get_level_name_ascii(courseNum, levelNum, areaIndex, charCase)`
@@ -6890,7 +7077,9 @@ Returns the name of the level corresponding to `courseNum`, `levelNum` and `area
## [get_level_name_sm64](#get_level_name_sm64)
### Description
-Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an SM64 encoded string. This function should not be used in Lua mods. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
+Returns the name of the level corresponding to `courseNum`, `levelNum` and `areaIndex` as an SM64 encoded string.
+This function should not be used in Lua mods.
+Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
### Lua Example
`local pointerValue = get_level_name_sm64(courseNum, levelNum, areaIndex, charCase)`
@@ -6941,7 +7130,8 @@ Returns the name of the level corresponding to `courseNum`, `levelNum` and `area
## [get_star_name_ascii](#get_star_name_ascii)
### Description
-Returns the name of the star corresponding to `courseNum` and `starNum` as an ASCII (human readable) string. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
+Returns the name of the star corresponding to `courseNum` and `starNum` as an ASCII (human readable) string.
+Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
### Lua Example
`local stringValue = get_star_name_ascii(courseNum, starNum, charCase)`
@@ -6966,7 +7156,9 @@ Returns the name of the star corresponding to `courseNum` and `starNum` as an AS
## [get_star_name_sm64](#get_star_name_sm64)
### Description
-Returns the name of the star corresponding to `courseNum` and `starNum` as an SM64 encoded string. This function should not be used in Lua mods. Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
+Returns the name of the star corresponding to `courseNum` and `starNum` as an SM64 encoded string.
+This function should not be used in Lua mods.
+Set `charCase` to 1 to capitalize or -1 to decapitalize the returned string
### Lua Example
`local pointerValue = get_star_name_sm64(courseNum, starNum, charCase)`
@@ -7021,7 +7213,9 @@ Returns the name of the star corresponding to `courseNum` and `starNum` as a dec
## [area_create_warp_node](#area_create_warp_node)
### Description
-Creates a warp node in the current level and area with id `id` that goes to the warp node `destNode` in level `destLevel` and area `destArea`, and attach it to the object `o`. To work properly, object `o` must be able to trigger a warp (for example, with interact type set to `INTERACT_WARP`.) `checkpoint` should be set only to WARP_NO_CHECKPOINT (0x00) or WARP_CHECKPOINT (0x80.) If `checkpoint` is set to `0x80`, Mario will warp directly to this node if he enters the level again (after a death for example)
+Creates a warp node in the current level and area with id `id` that goes to the warp node `destNode` in level `destLevel` and area `destArea`, and attach it to the object `o`.
+To work properly, object `o` must be able to trigger a warp (for example, with interact type set to `INTERACT_WARP`.)
+`checkpoint` should be set only to WARP_NO_CHECKPOINT (0x00) or WARP_CHECKPOINT (0x80.) If `checkpoint` is set to `0x80`, Mario will warp directly to this node if he enters the level again (after a death for example)
### Lua Example
`local objectWarpNodeValue = area_create_warp_node(id, destLevel, destArea, destNode, checkpoint, o)`
diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md
index 2547c73ca..600c2a04e 100644
--- a/docs/lua/functions-4.md
+++ b/docs/lua/functions-4.md
@@ -880,7 +880,8 @@ Overrides the soundbank, set to -1 to reset
## [is_anim_at_end](#is_anim_at_end)
### Description
-Checks if Mario's current animation has reached its final frame (i.e., the last valid frame in the animation). Useful for deciding when to transition out of an animation-driven action
+Checks if Mario's current animation has reached its final frame (i.e., the last valid frame in the animation).
+Useful for deciding when to transition out of an animation-driven action
### Lua Example
`local integerValue = is_anim_at_end(m)`
@@ -903,7 +904,8 @@ Checks if Mario's current animation has reached its final frame (i.e., the last
## [is_anim_past_end](#is_anim_past_end)
### Description
-Checks if Mario's current animation has passed the second-to-last valid frame (i.e., effectively at or beyond its final frames). Useful for advanced checks where slightly early transitions or timing are needed before the final frame
+Checks if Mario's current animation has passed the second-to-last valid frame (i.e., effectively at or beyond its final frames).
+Useful for advanced checks where slightly early transitions or timing are needed before the final frame
### Lua Example
`local integerValue = is_anim_past_end(m)`
@@ -950,7 +952,8 @@ Sets Mario's current animation to `targetAnimID` at a default acceleration (no s
## [set_mario_anim_with_accel](#set_mario_anim_with_accel)
### Description
-Sets Mario's current animation to `targetAnimID` with a custom `accel` value to speed up or slow down the animation. Useful for controlling animation timing, e.g., slow-motion or fast-forward effects
+Sets Mario's current animation to `targetAnimID` with a custom `accel` value to speed up or slow down the animation.
+Useful for controlling animation timing, e.g., slow-motion or fast-forward effects
### Lua Example
`local integerValue = set_mario_anim_with_accel(m, targetAnimID, accel)`
@@ -999,7 +1002,8 @@ Sets the character-specific animation at its default rate (no acceleration)
## [set_character_anim_with_accel](#set_character_anim_with_accel)
### Description
-Sets a character-specific animation where the animation speed is adjusted by `accel`. Useful for varying animation speeds based on context or dynamic conditions (e.g., slow-motion)
+Sets a character-specific animation where the animation speed is adjusted by `accel`.
+Useful for varying animation speeds based on context or dynamic conditions (e.g., slow-motion)
### Lua Example
`local integerValue = set_character_anim_with_accel(m, targetAnimID, accel)`
@@ -1048,7 +1052,8 @@ Sets the current animation frame to a specific `animFrame`
## [is_anim_past_frame](#is_anim_past_frame)
### Description
-Checks if Mario's current animation is past a specified `animFrame`. Useful for conditional logic where an action can branch after reaching a specific point in the animation
+Checks if Mario's current animation is past a specified `animFrame`.
+Useful for conditional logic where an action can branch after reaching a specific point in the animation
### Lua Example
`local integerValue = is_anim_past_frame(m, animFrame)`
@@ -1072,7 +1077,8 @@ Checks if Mario's current animation is past a specified `animFrame`. Useful for
## [find_mario_anim_flags_and_translation](#find_mario_anim_flags_and_translation)
### Description
-Retrieves the current animation flags and calculates the translation for Mario's animation, rotating it into the global coordinate system based on `yaw`. Useful for determining positional offsets from animations (e.g., stepping forward in a walk animation) and applying them to Mario's position
+Retrieves the current animation flags and calculates the translation for Mario's animation, rotating it into the global coordinate system based on `yaw`.
+Useful for determining positional offsets from animations (e.g., stepping forward in a walk animation) and applying them to Mario's position
### Lua Example
`local integerValue = find_mario_anim_flags_and_translation(o, yaw, translation)`
@@ -1120,7 +1126,8 @@ Applies the translation from Mario's current animation to his world position. Co
## [return_mario_anim_y_translation](#return_mario_anim_y_translation)
### Description
-Determines the vertical translation from Mario's animation (how much the animation moves Mario up or down). Returns the y-component of the animation's translation. Useful for adjusting Mario's vertical position based on an ongoing animation (e.g., a bounce or jump)
+Determines the vertical translation from Mario's animation (how much the animation moves Mario up or down). Returns the y-component of the animation's translation.
+Useful for adjusting Mario's vertical position based on an ongoing animation (e.g., a bounce or jump)
### Lua Example
`local integerValue = return_mario_anim_y_translation(m)`
@@ -1191,7 +1198,8 @@ Plays Mario's jump sound if it hasn't been played yet since the last action chan
## [adjust_sound_for_speed](#adjust_sound_for_speed)
### Description
-Adjusts the pitch/volume of Mario's movement-based sounds according to his forward velocity (`m.forwardVel`). Useful for adding dynamic audio feedback based on Mario's running or walking speed
+Adjusts the pitch/volume of Mario's movement-based sounds according to his forward velocity (`m.forwardVel`).
+Useful for adding dynamic audio feedback based on Mario's running or walking speed
### Lua Example
`adjust_sound_for_speed(m)`
@@ -1312,7 +1320,8 @@ A variant of `play_mario_landing_sound` that ensures the sound is only played on
## [play_mario_heavy_landing_sound](#play_mario_heavy_landing_sound)
### Description
-Plays a heavier, more forceful landing sound, possibly for ground pounds or large impacts. Takes into account whether Mario has a metal cap equipped. Useful for making big impact landings stand out aurally
+Plays a heavier, more forceful landing sound, possibly for ground pounds or large impacts. Takes into account whether Mario has a metal cap equipped.
+Useful for making big impact landings stand out aurally
### Lua Example
`play_mario_heavy_landing_sound(m, soundBits)`
@@ -1336,7 +1345,8 @@ Plays a heavier, more forceful landing sound, possibly for ground pounds or larg
## [play_mario_heavy_landing_sound_once](#play_mario_heavy_landing_sound_once)
### Description
-A variant of `play_mario_heavy_landing_sound` that ensures the sound is only played once per action (using `play_mario_action_sound` internally). Useful for consistent heavy landing effects without repetition
+A variant of `play_mario_heavy_landing_sound` that ensures the sound is only played once per action (using `play_mario_action_sound` internally).
+Useful for consistent heavy landing effects without repetition
### Lua Example
`play_mario_heavy_landing_sound_once(m, soundBits)`
@@ -1477,7 +1487,8 @@ Transitions Mario into a bubbled state (if available in multiplayer), decrementi
## [mario_set_forward_vel](#mario_set_forward_vel)
### Description
-Sets Mario's forward velocity (`m.forwardVel`) and updates `slideVelX/Z` and `m.vel` accordingly, based on `m.faceAngle.y`. Useful for controlling Mario's speed and direction in various actions (jumping, walking, sliding, etc.)
+Sets Mario's forward velocity (`m.forwardVel`) and updates `slideVelX/Z` and `m.vel` accordingly, based on `m.faceAngle.y`.
+Useful for controlling Mario's speed and direction in various actions (jumping, walking, sliding, etc.)
### Lua Example
`mario_set_forward_vel(m, speed)`
@@ -1501,7 +1512,8 @@ Sets Mario's forward velocity (`m.forwardVel`) and updates `slideVelX/Z` and `m.
## [mario_get_floor_class](#mario_get_floor_class)
### Description
-Retrieves the slipperiness class of Mario's current floor, ranging from not slippery to very slippery. Considers terrain types and special surfaces. Useful for controlling friction, movement speed adjustments, and whether Mario slips or walks
+Retrieves the slipperiness class of Mario's current floor, ranging from not slippery to very slippery. Considers terrain types and special surfaces.
+Useful for controlling friction, movement speed adjustments, and whether Mario slips or walks
### Lua Example
`local integerValue = mario_get_floor_class(m)`
@@ -1524,7 +1536,8 @@ Retrieves the slipperiness class of Mario's current floor, ranging from not slip
## [mario_get_terrain_sound_addend](#mario_get_terrain_sound_addend)
### Description
-Computes a value added to terrain sounds, depending on the floor's type (sand, snow, water, etc.) and slipperiness. This returns a sound 'addend' used with sound effects. Useful for playing context-specific footstep or movement sounds
+Computes a value added to terrain sounds, depending on the floor's type (sand, snow, water, etc.) and slipperiness. This returns a sound 'addend' used with sound effects.
+Useful for playing context-specific footstep or movement sounds
### Lua Example
`local integerValue = mario_get_terrain_sound_addend(m)`
@@ -1547,7 +1560,8 @@ Computes a value added to terrain sounds, depending on the floor's type (sand, s
## [resolve_and_return_wall_collisions](#resolve_and_return_wall_collisions)
### Description
-Checks for and resolves wall collisions at a given position `pos`, returning the last wall encountered. Primarily used to prevent Mario from going through walls. Useful for collision detection when updating Mario's movement or adjusting his position
+Checks for and resolves wall collisions at a given position `pos`, returning the last wall encountered. Primarily used to prevent Mario from going through walls.
+Useful for collision detection when updating Mario's movement or adjusting his position
### Lua Example
`local surfaceValue = resolve_and_return_wall_collisions(pos, offset, radius)`
@@ -1598,7 +1612,8 @@ Similar to `resolve_and_return_wall_collisions` but also returns detailed collis
## [vec3f_find_ceil](#vec3f_find_ceil)
### Description
-Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer). Returns the ceiling height and surface
+Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer).
+Returns the ceiling height and surface
### Lua Example
`local numberValue, ceil = vec3f_find_ceil(pos, height)`
@@ -1623,7 +1638,9 @@ Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffe
## [vec3f_mario_ceil](#vec3f_mario_ceil)
### Description
-Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer). Prevents exposed ceiling bug. Returns the ceiling height and surface
+Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer).
+Prevents exposed ceiling bug.
+Returns the ceiling height and surface
### Lua Example
`local numberValue, ceil = vec3f_mario_ceil(pos, height)`
@@ -1648,7 +1665,8 @@ Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffe
## [mario_facing_downhill](#mario_facing_downhill)
### Description
-Determines if Mario is facing downhill relative to his floor angle, optionally accounting for forward velocity direction. Returns true if he is oriented down the slope. Useful for deciding if Mario will walk or slide on sloped floors
+Determines if Mario is facing downhill relative to his floor angle, optionally accounting for forward velocity direction. Returns true if he is oriented down the slope.
+Useful for deciding if Mario will walk or slide on sloped floors
### Lua Example
`local integerValue = mario_facing_downhill(m, turnYaw)`
@@ -1672,7 +1690,8 @@ Determines if Mario is facing downhill relative to his floor angle, optionally a
## [mario_floor_is_slippery](#mario_floor_is_slippery)
### Description
-Checks whether Mario's current floor is slippery based on both the floor's surface class and Mario's environment (e.g., special slides). Useful for deciding if Mario should transition to sliding or maintain normal traction
+Checks whether Mario's current floor is slippery based on both the floor's surface class and Mario's environment (e.g., special slides).
+Useful for deciding if Mario should transition to sliding or maintain normal traction
### Lua Example
`local integerValue = mario_floor_is_slippery(m)`
@@ -1718,7 +1737,8 @@ Checks whether Mario's floor is a slope, i.e., not flat but not necessarily stee
## [mario_floor_is_steep](#mario_floor_is_steep)
### Description
-Checks whether Mario's floor is steep enough to cause special behavior, such as forcing slides or preventing certain actions. Returns true if the slope is too steep. Useful for restricting normal movement on surfaces with extreme angles
+Checks whether Mario's floor is steep enough to cause special behavior, such as forcing slides or preventing certain actions. Returns true if the slope is too steep.
+Useful for restricting normal movement on surfaces with extreme angles
### Lua Example
`local integerValue = mario_floor_is_steep(m)`
@@ -1741,7 +1761,8 @@ Checks whether Mario's floor is steep enough to cause special behavior, such as
## [find_floor_height_relative_polar](#find_floor_height_relative_polar)
### Description
-Finds the floor height relative to Mario's current position given a polar displacement (`angleFromMario`, `distFromMario`). Useful for determining height differentials ahead or behind Mario, e.g. for slope checks or collision logic
+Finds the floor height relative to Mario's current position given a polar displacement (`angleFromMario`, `distFromMario`).
+Useful for determining height differentials ahead or behind Mario, e.g. for slope checks or collision logic
### Lua Example
`local numberValue = find_floor_height_relative_polar(m, angleFromMario, distFromMario)`
@@ -1766,7 +1787,8 @@ Finds the floor height relative to Mario's current position given a polar displa
## [find_floor_slope](#find_floor_slope)
### Description
-Returns a slope angle based on comparing the floor heights slightly in front and behind Mario. It essentially calculates how steep the ground is in a specific yaw direction. Useful for slope-based calculations such as setting walking or sliding behaviors
+Returns a slope angle based on comparing the floor heights slightly in front and behind Mario. It essentially calculates how steep the ground is in a specific yaw direction.
+Useful for slope-based calculations such as setting walking or sliding behaviors
### Lua Example
`local integerValue = find_floor_slope(m, yawOffset)`
@@ -1790,7 +1812,8 @@ Returns a slope angle based on comparing the floor heights slightly in front and
## [update_mario_sound_and_camera](#update_mario_sound_and_camera)
### Description
-Updates the background noise and camera modes based on Mario's action. Especially relevant for actions like first-person view or sleeping. Useful for synchronizing camera behavior and ambient sounds with Mario's state changes
+Updates the background noise and camera modes based on Mario's action. Especially relevant for actions like first-person view or sleeping.
+Useful for synchronizing camera behavior and ambient sounds with Mario's state changes
### Lua Example
`update_mario_sound_and_camera(m)`
@@ -1813,7 +1836,8 @@ Updates the background noise and camera modes based on Mario's action. Especiall
## [set_steep_jump_action](#set_steep_jump_action)
### Description
-Transitions Mario into ACT_STEEP_JUMP if the floor is too steep, adjusting his forward velocity and orientation accordingly. Useful for forcing special jump states on surfaces exceeding normal slope limits
+Transitions Mario into ACT_STEEP_JUMP if the floor is too steep, adjusting his forward velocity and orientation accordingly.
+Useful for forcing special jump states on surfaces exceeding normal slope limits
### Lua Example
`set_steep_jump_action(m)`
@@ -1985,7 +2009,8 @@ Increments Mario's `hurtCounter` and immediately sets a new action. Often used w
## [check_common_action_exits](#check_common_action_exits)
### Description
-Checks for inputs that cause common action transitions (jump, freefall, walking, sliding). Useful for quickly exiting certain stationary actions when Mario begins moving or leaves the floor
+Checks for inputs that cause common action transitions (jump, freefall, walking, sliding).
+Useful for quickly exiting certain stationary actions when Mario begins moving or leaves the floor
### Lua Example
`local integerValue = check_common_action_exits(m)`
@@ -2031,7 +2056,8 @@ Checks for inputs that cause common hold-action transitions (hold jump, hold fre
## [transition_submerged_to_walking](#transition_submerged_to_walking)
### Description
-Transitions Mario from being underwater to a walking state. Resets camera to the default mode and can handle object-holding states. Useful for restoring standard ground movement when emerging from water
+Transitions Mario from being underwater to a walking state. Resets camera to the default mode and can handle object-holding states.
+Useful for restoring standard ground movement when emerging from water
### Lua Example
`local integerValue = transition_submerged_to_walking(m)`
@@ -2100,7 +2126,8 @@ Main driver for Mario's behavior. Executes the current action group (stationary,
## [force_idle_state](#force_idle_state)
### Description
-Forces Mario into an idle state, either `ACT_IDLE` or `ACT_WATER_IDLE` depending on whether he is submerged. Useful for quickly resetting Mario's state to an idle pose under special conditions (e.g., cutscene triggers)
+Forces Mario into an idle state, either `ACT_IDLE` or `ACT_WATER_IDLE` depending on whether he is submerged.
+Useful for quickly resetting Mario's state to an idle pose under special conditions (e.g., cutscene triggers)
### Lua Example
`local integerValue = force_idle_state(m)`
@@ -2224,7 +2251,8 @@ Gets the MarioState corresponding to the provided object if the object is a Mari
## [play_flip_sounds](#play_flip_sounds)
### Description
-Plays a spinning sound at specific animation frames for flips (usually side flips or certain jump flips). If the current animation frame matches any of the specified frames, it triggers `SOUND_ACTION_SPIN`
+Plays a spinning sound at specific animation frames for flips (usually side flips or certain jump flips).
+If the current animation frame matches any of the specified frames, it triggers `SOUND_ACTION_SPIN`
### Lua Example
`play_flip_sounds(m, frame1, frame2, frame3)`
@@ -2250,7 +2278,8 @@ Plays a spinning sound at specific animation frames for flips (usually side flip
## [play_far_fall_sound](#play_far_fall_sound)
### Description
-Plays a unique sound when Mario has fallen a significant distance without being invulnerable, twirling, or flying. If the fall exceeds a threshold, triggers a "long fall" exclamation. Also sets a flag to prevent repeated triggering
+Plays a unique sound when Mario has fallen a significant distance without being invulnerable, twirling, or flying.
+If the fall exceeds a threshold, triggers a "long fall" exclamation. Also sets a flag to prevent repeated triggering
### Lua Example
`play_far_fall_sound(m)`
@@ -2273,7 +2302,8 @@ Plays a unique sound when Mario has fallen a significant distance without being
## [play_knockback_sound](#play_knockback_sound)
### Description
-Plays a knockback sound effect if Mario is hit or knocked back with significant velocity. The specific sound differs depending on whether Mario's forward velocity is high enough to be considered a strong knockback
+Plays a knockback sound effect if Mario is hit or knocked back with significant velocity. The specific sound differs
+depending on whether Mario's forward velocity is high enough to be considered a strong knockback
### Lua Example
`play_knockback_sound(m)`
@@ -2296,7 +2326,9 @@ Plays a knockback sound effect if Mario is hit or knocked back with significant
## [lava_boost_on_wall](#lava_boost_on_wall)
### Description
-Allows Mario to 'lava boost' off a lava wall, reorienting him to face away from the wall and adjusting forward velocity. Increases Mario's hurt counter if he's not metal, plays a burning sound, and transitions his action to `ACT_LAVA_BOOST`. Useful for handling collisions with lava walls, giving Mario a strong upward/forward boost at the cost of health
+Allows Mario to 'lava boost' off a lava wall, reorienting him to face away from the wall and adjusting forward velocity.
+Increases Mario's hurt counter if he's not metal, plays a burning sound, and transitions his action to `ACT_LAVA_BOOST`.
+Useful for handling collisions with lava walls, giving Mario a strong upward/forward boost at the cost of health
### Lua Example
`local integerValue = lava_boost_on_wall(m)`
@@ -2319,7 +2351,10 @@ Allows Mario to 'lava boost' off a lava wall, reorienting him to face away from
## [check_fall_damage](#check_fall_damage)
### Description
-Evaluates whether Mario should take fall damage based on the height difference between his peak and current position. If the fall is large enough and does not occur over burning surfaces or while twirling, Mario may get hurt or enter a hard fall action. If the fall is significant but not extreme, minimal damage and a squish effect may be applied. Useful for determining if Mario's fall warrants a health penalty or a special landing action
+Evaluates whether Mario should take fall damage based on the height difference between his peak and current position.
+If the fall is large enough and does not occur over burning surfaces or while twirling, Mario may get hurt or enter
+a hard fall action. If the fall is significant but not extreme, minimal damage and a squish effect may be applied.
+Useful for determining if Mario's fall warrants a health penalty or a special landing action
### Lua Example
`local integerValue = check_fall_damage(m, hardFallAction)`
@@ -2343,7 +2378,8 @@ Evaluates whether Mario should take fall damage based on the height difference b
## [check_kick_or_dive_in_air](#check_kick_or_dive_in_air)
### Description
-Checks if Mario should perform a kick or a dive while in mid-air, depending on his current forward velocity. Pressing the B button in the air can trigger a jump kick (at lower speeds) or a dive (at higher speeds)
+Checks if Mario should perform a kick or a dive while in mid-air, depending on his current forward velocity.
+Pressing the B button in the air can trigger a jump kick (at lower speeds) or a dive (at higher speeds)
### Lua Example
`local integerValue = check_kick_or_dive_in_air(m)`
@@ -2366,7 +2402,9 @@ Checks if Mario should perform a kick or a dive while in mid-air, depending on h
## [should_get_stuck_in_ground](#should_get_stuck_in_ground)
### Description
-Determines whether Mario should become stuck in the ground after landing, specifically for soft terrain such as snow or sand, provided certain conditions are met (height of the fall, normal of the floor, etc.). Returns true if Mario should be stuck, false otherwise
+Determines whether Mario should become stuck in the ground after landing, specifically for soft terrain such as snow
+or sand, provided certain conditions are met (height of the fall, normal of the floor, etc.).
+Returns true if Mario should be stuck, false otherwise
### Lua Example
`local integerValue = should_get_stuck_in_ground(m)`
@@ -2389,7 +2427,9 @@ Determines whether Mario should become stuck in the ground after landing, specif
## [check_fall_damage_or_get_stuck](#check_fall_damage_or_get_stuck)
### Description
-Checks if Mario should get stuck in the ground after a large fall onto soft terrain (like snow or sand) or if he should just proceed with regular fall damage calculations. If the terrain and height conditions are met, Mario's action changes to being stuck in the ground. Otherwise, normal fall damage logic applies
+Checks if Mario should get stuck in the ground after a large fall onto soft terrain (like snow or sand) or if he
+should just proceed with regular fall damage calculations. If the terrain and height conditions are met, Mario's
+action changes to being stuck in the ground. Otherwise, normal fall damage logic applies
### Lua Example
`local integerValue = check_fall_damage_or_get_stuck(m, hardFallAction)`
@@ -2413,7 +2453,8 @@ Checks if Mario should get stuck in the ground after a large fall onto soft terr
## [check_horizontal_wind](#check_horizontal_wind)
### Description
-Checks for the presence of a horizontal wind surface under Mario. If found, applies a push force to Mario's horizontal velocity. Caps speed at certain thresholds, updates Mario's forward velocity and yaw for sliding/wind movement
+Checks for the presence of a horizontal wind surface under Mario. If found, applies a push force to Mario's horizontal
+velocity. Caps speed at certain thresholds, updates Mario's forward velocity and yaw for sliding/wind movement
### Lua Example
`local integerValue = check_horizontal_wind(m)`
@@ -2436,7 +2477,8 @@ Checks for the presence of a horizontal wind surface under Mario. If found, appl
## [update_air_with_turn](#update_air_with_turn)
### Description
-Updates Mario's air movement while allowing him to turn. Checks horizontal wind and applies a moderate amount of drag, approaches the forward velocity toward zero if no input is pressed, and modifies forward velocity/angle based on stick input
+Updates Mario's air movement while allowing him to turn. Checks horizontal wind and applies a moderate amount of drag,
+approaches the forward velocity toward zero if no input is pressed, and modifies forward velocity/angle based on stick input
### Lua Example
`update_air_with_turn(m)`
@@ -2459,7 +2501,8 @@ Updates Mario's air movement while allowing him to turn. Checks horizontal wind
## [update_air_without_turn](#update_air_without_turn)
### Description
-Updates Mario's air movement without directly turning his facing angle to match his intended yaw. Instead, Mario can move sideways relative to his current facing direction. Also checks horizontal wind and applies drag
+Updates Mario's air movement without directly turning his facing angle to match his intended yaw. Instead, Mario can
+move sideways relative to his current facing direction. Also checks horizontal wind and applies drag
### Lua Example
`update_air_without_turn(m)`
@@ -2482,7 +2525,8 @@ Updates Mario's air movement without directly turning his facing angle to match
## [update_lava_boost_or_twirling](#update_lava_boost_or_twirling)
### Description
-Updates Mario's movement when in actions like lava boost or twirling in mid-air. Applies player input to adjust forward velocity and facing angle, but in a more restricted manner compared to standard jump movement. Used by `ACT_LAVA_BOOST` and `ACT_TWIRLING`
+Updates Mario's movement when in actions like lava boost or twirling in mid-air. Applies player input to adjust forward velocity
+and facing angle, but in a more restricted manner compared to standard jump movement. Used by `ACT_LAVA_BOOST` and `ACT_TWIRLING`
### Lua Example
`update_lava_boost_or_twirling(m)`
@@ -2505,7 +2549,8 @@ Updates Mario's movement when in actions like lava boost or twirling in mid-air.
## [update_flying_yaw](#update_flying_yaw)
### Description
-Calculates and applies a change in Mario's yaw while flying, based on horizontal stick input. Approaches a target yaw velocity and sets Mario's roll angle to simulate banking turns. This results in a more natural, curved flight path
+Calculates and applies a change in Mario's yaw while flying, based on horizontal stick input. Approaches a target yaw velocity
+and sets Mario's roll angle to simulate banking turns. This results in a more natural, curved flight path
### Lua Example
`update_flying_yaw(m)`
@@ -2528,7 +2573,8 @@ Calculates and applies a change in Mario's yaw while flying, based on horizontal
## [update_flying_pitch](#update_flying_pitch)
### Description
-Calculates and applies a change in Mario's pitch while flying, based on vertical stick input. Approaches a target pitch velocity and clamps the final pitch angle to a certain range, simulating a smooth flight control
+Calculates and applies a change in Mario's pitch while flying, based on vertical stick input. Approaches a target pitch velocity
+and clamps the final pitch angle to a certain range, simulating a smooth flight control
### Lua Example
`update_flying_pitch(m)`
@@ -2551,7 +2597,8 @@ Calculates and applies a change in Mario's pitch while flying, based on vertical
## [update_flying](#update_flying)
### Description
-Handles the complete flying logic for Mario (usually with the wing cap). Continuously updates pitch and yaw based on controller input, applies drag, and adjusts forward velocity. Also updates Mario's model angles for flight animations
+Handles the complete flying logic for Mario (usually with the wing cap). Continuously updates pitch and yaw based on controller input,
+applies drag, and adjusts forward velocity. Also updates Mario's model angles for flight animations
### Lua Example
`update_flying(m)`
@@ -2574,7 +2621,9 @@ Handles the complete flying logic for Mario (usually with the wing cap). Continu
## [common_air_action_step](#common_air_action_step)
### Description
-Performs a standard step update for air actions without knockback, typically used for jumps or freefalls. Updates Mario's velocity (and possibly checks horizontal wind), then calls `perform_air_step` with given `stepArg`. Handles how Mario lands, hits walls, grabs ledges, or grabs ceilings. Optionally sets an animation
+Performs a standard step update for air actions without knockback, typically used for jumps or freefalls.
+Updates Mario's velocity (and possibly checks horizontal wind), then calls `perform_air_step` with given `stepArg`.
+Handles how Mario lands, hits walls, grabs ledges, or grabs ceilings. Optionally sets an animation
### Lua Example
`local integerValue = common_air_action_step(m, landAction, animation, stepArg)`
@@ -2600,7 +2649,8 @@ Performs a standard step update for air actions without knockback, typically use
## [common_air_knockback_step](#common_air_knockback_step)
### Description
-A shared step update used for airborne knockback states (both forward and backward). Updates velocity, calls `perform_air_step`, and handles wall collisions or landing transitions to appropriate ground knockback actions. Also sets animation and speed
+A shared step update used for airborne knockback states (both forward and backward). Updates velocity, calls `perform_air_step`,
+and handles wall collisions or landing transitions to appropriate ground knockback actions. Also sets animation and speed
### Lua Example
`local integerValue = common_air_knockback_step(m, landAction, hardFallAction, animation, speed)`
@@ -2627,7 +2677,8 @@ A shared step update used for airborne knockback states (both forward and backwa
## [check_wall_kick](#check_wall_kick)
### Description
-Checks if Mario should wall kick after performing an air hit against a wall. If the input conditions (e.g., pressing A) and the `wallKickTimer` allow, Mario transitions to `ACT_WALL_KICK_AIR`
+Checks if Mario should wall kick after performing an air hit against a wall. If the input conditions (e.g., pressing A)
+and the `wallKickTimer` allow, Mario transitions to `ACT_WALL_KICK_AIR`
### Lua Example
`local integerValue = check_wall_kick(m)`
@@ -2650,7 +2701,9 @@ Checks if Mario should wall kick after performing an air hit against a wall. If
## [check_common_airborne_cancels](#check_common_airborne_cancels)
### Description
-Checks for and handles common conditions that would cancel Mario's current air action. This includes transitioning to a water plunge if below the water level, becoming squished if appropriate, or switching to vertical wind action if on certain wind surfaces. Also resets `m.quicksandDepth`
+Checks for and handles common conditions that would cancel Mario's current air action. This includes transitioning
+to a water plunge if below the water level, becoming squished if appropriate, or switching to vertical wind action
+if on certain wind surfaces. Also resets `m.quicksandDepth`
### Lua Example
`local integerValue = check_common_airborne_cancels(m)`
@@ -2673,7 +2726,8 @@ Checks for and handles common conditions that would cancel Mario's current air a
## [mario_execute_airborne_action](#mario_execute_airborne_action)
### Description
-Executes Mario's current airborne action by first checking common airborne cancels, then playing a far-fall sound if needed. Dispatches to the appropriate action function, such as jump, double jump, freefall, etc
+Executes Mario's current airborne action by first checking common airborne cancels, then playing a far-fall sound if needed.
+Dispatches to the appropriate action function, such as jump, double jump, freefall, etc
### Lua Example
`local integerValue = mario_execute_airborne_action(m)`
@@ -2702,7 +2756,8 @@ Executes Mario's current airborne action by first checking common airborne cance
## [add_tree_leaf_particles](#add_tree_leaf_particles)
### Description
-Spawns leaf particles when Mario climbs a tree, if he is sufficiently high above the floor. In Shifting Sand Land, the leaf effect spawns higher due to the taller palm trees
+Spawns leaf particles when Mario climbs a tree, if he is sufficiently high above the floor.
+In Shifting Sand Land, the leaf effect spawns higher due to the taller palm trees
### Lua Example
`add_tree_leaf_particles(m)`
@@ -2749,7 +2804,8 @@ Plays the appropriate climbing sound effect depending on whether Mario is on a t
## [set_pole_position](#set_pole_position)
### Description
-Sets Mario's position and alignment while he is on a climbable pole or tree. This function checks collisions with floors and ceilings, and updates Mario's action if he leaves the pole or touches the floor. Useful for ensuring Mario's correct placement and transitions when climbing poles or trees
+Sets Mario's position and alignment while he is on a climbable pole or tree. This function checks collisions with floors and ceilings, and updates Mario's action if he leaves the pole or touches the floor.
+Useful for ensuring Mario's correct placement and transitions when climbing poles or trees
### Lua Example
`local integerValue = set_pole_position(m, offsetY)`
@@ -2983,7 +3039,8 @@ Checks if Mario should cancel his current automatic action, primarily by detecti
## [mario_execute_automatic_action](#mario_execute_automatic_action)
### Description
-Executes Mario's current automatic action (e.g., climbing a pole, hanging, ledge-grabbing) by calling the corresponding function. It also checks for common cancellations, like falling into water. Returns true if the action was canceled and a new action was set, or false otherwise
+Executes Mario's current automatic action (e.g., climbing a pole, hanging, ledge-grabbing) by calling the corresponding function. It also checks for common cancellations, like falling into water.
+Returns true if the action was canceled and a new action was set, or false otherwise
### Lua Example
`local integerValue = mario_execute_automatic_action(m)`
@@ -3374,7 +3431,8 @@ Executes Mario's current cutscene action based on his `action` field. Includes v
## [tilt_body_running](#tilt_body_running)
### Description
-Tilts Mario's body according to his running speed and slope angle. Calculates a pitch offset used while running to simulate leaning forward at higher speeds or on slopes
+Tilts Mario's body according to his running speed and slope angle.
+Calculates a pitch offset used while running to simulate leaning forward at higher speeds or on slopes
### Lua Example
`local integerValue = tilt_body_running(m)`
@@ -3397,7 +3455,8 @@ Tilts Mario's body according to his running speed and slope angle. Calculates a
## [play_step_sound](#play_step_sound)
### Description
-Checks the current animation frame against two specified frames to trigger footstep sounds. Also chooses specific sounds if Mario is wearing Metal Cap or is in quicksand
+Checks the current animation frame against two specified frames to trigger footstep sounds.
+Also chooses specific sounds if Mario is wearing Metal Cap or is in quicksand
### Lua Example
`play_step_sound(m, frame1, frame2)`
@@ -3471,7 +3530,8 @@ Sets Mario's facing yaw to his intended yaw, applies a specified forward velocit
## [check_ledge_climb_down](#check_ledge_climb_down)
### Description
-Checks if Mario is near an edge while moving slowly and the floor below that edge is significantly lower. If the conditions are met, transitions Mario into a ledge-climb-down action and positions him accordingly on the edge
+Checks if Mario is near an edge while moving slowly and the floor below that edge is significantly lower.
+If the conditions are met, transitions Mario into a ledge-climb-down action and positions him accordingly on the edge
### Lua Example
`check_ledge_climb_down(m)`
@@ -3544,7 +3604,9 @@ Determines the proper triple jump action based on Mario's forward velocity and t
## [update_sliding_angle](#update_sliding_angle)
### Description
-Adjusts Mario's slide velocity and facing angle when on a slope. Calculates slope direction and steepness, then modifies velocity accordingly (speed up downhill, slow uphill). Handles facing-direction changes and maximum speed limits
+Adjusts Mario's slide velocity and facing angle when on a slope.
+Calculates slope direction and steepness, then modifies velocity accordingly (speed up downhill, slow uphill).
+Handles facing-direction changes and maximum speed limits
### Lua Example
`update_sliding_angle(m, accel, lossFactor)`
@@ -3569,7 +3631,9 @@ Adjusts Mario's slide velocity and facing angle when on a slope. Calculates slop
## [update_sliding](#update_sliding)
### Description
-Updates Mario's sliding state each frame, applying additional friction or acceleration based on the surface's slipperiness. Also checks if speed has slowed below a threshold to end the slide. Returns `true` if sliding has stopped
+Updates Mario's sliding state each frame, applying additional friction or acceleration based on the surface's slipperiness.
+Also checks if speed has slowed below a threshold to end the slide.
+Returns `true` if sliding has stopped
### Lua Example
`local integerValue = update_sliding(m, stopSpeed)`
@@ -3593,7 +3657,8 @@ Updates Mario's sliding state each frame, applying additional friction or accele
## [apply_slope_accel](#apply_slope_accel)
### Description
-Applies acceleration or deceleration based on the slope of the floor. On downward slopes, Mario gains speed, while on upward slopes, Mario loses speed
+Applies acceleration or deceleration based on the slope of the floor.
+On downward slopes, Mario gains speed, while on upward slopes, Mario loses speed
### Lua Example
`apply_slope_accel(m)`
@@ -3616,7 +3681,8 @@ Applies acceleration or deceleration based on the slope of the floor. On downwar
## [apply_landing_accel](#apply_landing_accel)
### Description
-Applies friction-like deceleration if the floor is flat, or slope-based acceleration if the floor is sloped. Capped in such a way that Mario eventually stops or stabilizes on flatter ground
+Applies friction-like deceleration if the floor is flat, or slope-based acceleration if the floor is sloped.
+Capped in such a way that Mario eventually stops or stabilizes on flatter ground
### Lua Example
`local integerValue = apply_landing_accel(m, frictionFactor)`
@@ -3663,7 +3729,8 @@ Controls Mario's speed when riding a Koopa Shell on the ground.
## [apply_slope_decel](#apply_slope_decel)
### Description
-Approaches Mario's forward velocity toward zero at a rate dependent on the floor's slipperiness. This function can completely stop Mario if the slope is gentle enough or if friction is high
+Approaches Mario's forward velocity toward zero at a rate dependent on the floor's slipperiness.
+This function can completely stop Mario if the slope is gentle enough or if friction is high
### Lua Example
`local integerValue = apply_slope_decel(m, decelCoef)`
@@ -3687,7 +3754,8 @@ Approaches Mario's forward velocity toward zero at a rate dependent on the floor
## [update_decelerating_speed](#update_decelerating_speed)
### Description
-Gradually reduces Mario's forward speed to zero over time on level ground, unless otherwise influenced by slope or friction. Returns true if Mario's speed reaches zero, meaning he has stopped
+Gradually reduces Mario's forward speed to zero over time on level ground, unless otherwise influenced by slope or friction.
+Returns true if Mario's speed reaches zero, meaning he has stopped
### Lua Example
`local integerValue = update_decelerating_speed(m)`
@@ -3710,7 +3778,8 @@ Gradually reduces Mario's forward speed to zero over time on level ground, unles
## [update_walking_speed](#update_walking_speed)
### Description
-Updates Mario's walking speed based on player input and floor conditions (e.g., a slow floor or quicksand). Caps speed at a certain value and may reduce it slightly on steep slopes
+Updates Mario's walking speed based on player input and floor conditions (e.g., a slow floor or quicksand).
+Caps speed at a certain value and may reduce it slightly on steep slopes
### Lua Example
`update_walking_speed(m)`
@@ -3733,7 +3802,8 @@ Updates Mario's walking speed based on player input and floor conditions (e.g.,
## [should_begin_sliding](#should_begin_sliding)
### Description
-Checks if Mario should begin sliding, based on player input (facing downhill, pressing the analog stick backward, or on a slide terrain), and current floor steepness. Returns true if conditions to slide are met.
+Checks if Mario should begin sliding, based on player input (facing downhill, pressing the analog stick backward, or on a slide terrain), and current floor steepness.
+Returns true if conditions to slide are met.
### Lua Example
`local integerValue = should_begin_sliding(m)`
@@ -3756,7 +3826,8 @@ Checks if Mario should begin sliding, based on player input (facing downhill, pr
## [analog_stick_held_back](#analog_stick_held_back)
### Description
-Checks if the analog stick is held significantly behind Mario's current facing angle. Returns true if the stick is far enough in the opposite direction, indicating Mario wants to move backward
+Checks if the analog stick is held significantly behind Mario's current facing angle.
+Returns true if the stick is far enough in the opposite direction, indicating Mario wants to move backward
### Lua Example
`local integerValue = analog_stick_held_back(m)`
@@ -3779,7 +3850,8 @@ Checks if the analog stick is held significantly behind Mario's current facing a
## [check_ground_dive_or_punch](#check_ground_dive_or_punch)
### Description
-Checks if the B button was pressed to either initiate a dive (if moving fast enough) or a punch (if moving slowly). Returns `true` if the action was changed to either a dive or a punching attack
+Checks if the B button was pressed to either initiate a dive (if moving fast enough) or a punch (if moving slowly).
+Returns `true` if the action was changed to either a dive or a punching attack
### Lua Example
`local integerValue = check_ground_dive_or_punch(m)`
@@ -3802,7 +3874,8 @@ Checks if the B button was pressed to either initiate a dive (if moving fast eno
## [begin_braking_action](#begin_braking_action)
### Description
-Begins a braking action if Mario's forward velocity is high enough or transitions to a decelerating action otherwise. Also handles the scenario where Mario is up against a wall, transitioning to a standing state
+Begins a braking action if Mario's forward velocity is high enough or transitions to a decelerating action otherwise.
+Also handles the scenario where Mario is up against a wall, transitioning to a standing state
### Lua Example
`local integerValue = begin_braking_action(m)`
@@ -3825,7 +3898,8 @@ Begins a braking action if Mario's forward velocity is high enough or transition
## [anim_and_audio_for_walk](#anim_and_audio_for_walk)
### Description
-Handles the animation and audio (footstep sounds) for normal walking or running. The specific animation used (tiptoe, walk, or run) depends on Mario's current speed
+Handles the animation and audio (footstep sounds) for normal walking or running.
+The specific animation used (tiptoe, walk, or run) depends on Mario's current speed
### Lua Example
`anim_and_audio_for_walk(m)`
@@ -3848,7 +3922,8 @@ Handles the animation and audio (footstep sounds) for normal walking or running.
## [anim_and_audio_for_hold_walk](#anim_and_audio_for_hold_walk)
### Description
-Plays the appropriate animation and footstep sounds for walking while carrying a lighter object (like a small box). Adjusts the animation speed dynamically based on Mario's velocity
+Plays the appropriate animation and footstep sounds for walking while carrying a lighter object (like a small box).
+Adjusts the animation speed dynamically based on Mario's velocity
### Lua Example
`anim_and_audio_for_hold_walk(m)`
@@ -3871,7 +3946,8 @@ Plays the appropriate animation and footstep sounds for walking while carrying a
## [anim_and_audio_for_heavy_walk](#anim_and_audio_for_heavy_walk)
### Description
-Plays the appropriate animation and footstep sounds for walking while carrying a heavy object. Sets the character animation speed based on Mario's intended movement speed
+Plays the appropriate animation and footstep sounds for walking while carrying a heavy object.
+Sets the character animation speed based on Mario's intended movement speed
### Lua Example
`anim_and_audio_for_heavy_walk(m)`
@@ -3918,7 +3994,8 @@ When Mario hits a wall during movement, decides whether he's pushing against the
## [tilt_body_walking](#tilt_body_walking)
### Description
-Applies a left/right tilt to Mario's torso (and some pitch if running fast) while walking or running. The tilt is based on his change in yaw and current speed, giving a leaning appearance when turning
+Applies a left/right tilt to Mario's torso (and some pitch if running fast) while walking or running.
+The tilt is based on his change in yaw and current speed, giving a leaning appearance when turning
### Lua Example
`tilt_body_walking(m, startYaw)`
@@ -3942,7 +4019,8 @@ Applies a left/right tilt to Mario's torso (and some pitch if running fast) whil
## [tilt_body_ground_shell](#tilt_body_ground_shell)
### Description
-Tilts Mario's torso and head while riding a shell on the ground to reflect turning. Similar to other tilt functions but tuned for shell-riding speeds and angles
+Tilts Mario's torso and head while riding a shell on the ground to reflect turning.
+Similar to other tilt functions but tuned for shell-riding speeds and angles
### Lua Example
`tilt_body_ground_shell(m, startYaw)`
@@ -3966,7 +4044,8 @@ Tilts Mario's torso and head while riding a shell on the ground to reflect turni
## [tilt_body_butt_slide](#tilt_body_butt_slide)
### Description
-Tilts Mario's torso while butt sliding based on analog input direction and magnitude. Gives the appearance that Mario is balancing or leaning into a turn
+Tilts Mario's torso while butt sliding based on analog input direction and magnitude.
+Gives the appearance that Mario is balancing or leaning into a turn
### Lua Example
`tilt_body_butt_slide(m)`
@@ -4015,7 +4094,8 @@ Applies shared logic for sliding-related actions while playing sliding sounds, m
## [common_slide_action_with_jump](#common_slide_action_with_jump)
### Description
-Builds on `common_slide_action` by also allowing Mario to jump out of a slide if A is pressed after a short delay. If the sliding slows enough, Mario transitions to a specified stopping action
+Builds on `common_slide_action` by also allowing Mario to jump out of a slide if A is pressed after a short delay.
+If the sliding slows enough, Mario transitions to a specified stopping action
### Lua Example
`local integerValue = common_slide_action_with_jump(m, stopAction, jumpAction, airAction, animation)`
@@ -4042,7 +4122,8 @@ Builds on `common_slide_action` by also allowing Mario to jump out of a slide if
## [stomach_slide_action](#stomach_slide_action)
### Description
-Updates Mario's sliding state where he is on his stomach. Similar to other slide actions but has a chance to roll out if A or B is pressed. Uses `common_slide_action` for the core movement logic
+Updates Mario's sliding state where he is on his stomach. Similar to other slide actions but has a chance to roll out if A or B is pressed.
+Uses `common_slide_action` for the core movement logic
### Lua Example
`local integerValue = stomach_slide_action(m, stopAction, airAction, animation)`
@@ -4120,7 +4201,8 @@ Applies movement upon landing from a jump or fall. Adjusts velocity based on slo
## [quicksand_jump_land_action](#quicksand_jump_land_action)
### Description
-Handles a special landing in quicksand after a jump. Over several frames, Mario emerges from the quicksand. First part of the animation reduces his quicksand depth. Ends with a normal landing action or transitions back to air if he leaves the ground
+Handles a special landing in quicksand after a jump. Over several frames, Mario emerges from the quicksand.
+First part of the animation reduces his quicksand depth. Ends with a normal landing action or transitions back to air if he leaves the ground
### Lua Example
`local integerValue = quicksand_jump_land_action(m, animation1, animation2, endAction, airAction)`
@@ -4247,7 +4329,9 @@ Updates Mario's punching state
## [check_common_object_cancels](#check_common_object_cancels)
### Description
-Checks for and handles common conditions that would cancel Mario's current object action. This includes transitioning to a water plunge if below the water level, becoming squished if appropriate, or switching to standing death action if Mario is dead
+Checks for and handles common conditions that would cancel Mario's current object action. This includes transitioning
+to a water plunge if below the water level, becoming squished if appropriate, or switching to standing death action
+if Mario is dead
### Lua Example
`local integerValue = check_common_object_cancels(m)`
@@ -4270,7 +4354,8 @@ Checks for and handles common conditions that would cancel Mario's current objec
## [mario_execute_object_action](#mario_execute_object_action)
### Description
-Executes Mario's current object action by first checking common object cancels, then updating quicksand state. Dispatches to the appropriate action function, such as punching, throwing, picking up Bowser, etc
+Executes Mario's current object action by first checking common object cancels, then updating quicksand state.
+Dispatches to the appropriate action function, such as punching, throwing, picking up Bowser, etc
### Lua Example
`local integerValue = mario_execute_object_action(m)`
@@ -4489,7 +4574,8 @@ Checks for and handles common conditions that would cancel Mario's current stati
## [mario_execute_stationary_action](#mario_execute_stationary_action)
### Description
-Executes Mario's current object action by first checking common stationary cancels, then updating quicksand state. Dispatches to the appropriate action function, such as idle, sleeping, crouching, ect
+Executes Mario's current object action by first checking common stationary cancels, then updating quicksand state.
+Dispatches to the appropriate action function, such as idle, sleeping, crouching, ect
### Lua Example
`local integerValue = mario_execute_stationary_action(m)`
@@ -4636,7 +4722,8 @@ Controls the bobbing that happens when you swim near the water surface
## [mario_execute_submerged_action](#mario_execute_submerged_action)
### Description
-Executes Mario's current submerged action by first checking common submerged cancels, then setting quicksand depth and head angles to 0. Dispatches to the appropriate action function, such as breaststroke, flutterkick, water punch, ect
+Executes Mario's current submerged action by first checking common submerged cancels, then setting quicksand depth and head angles to 0.
+Dispatches to the appropriate action function, such as breaststroke, flutterkick, water punch, ect
### Lua Example
`local integerValue = mario_execute_submerged_action(m)`
@@ -5914,7 +6001,8 @@ Converts an angle from degrees to SM64 format
## [mtxf_zero](#mtxf_zero)
### Description
-Sets the 4x4 floating-point matrix `mtx` to all zeros. Unless you really need this-It's reccomended to use mtxf_identity instead.
+Sets the 4x4 floating-point matrix `mtx` to all zeros.
+Unless you really need this-It's reccomended to use mtxf_identity instead.
### Lua Example
`mtxf_zero(mtx)`
diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md
index e8822093a..a2a5a7598 100644
--- a/docs/lua/functions-5.md
+++ b/docs/lua/functions-5.md
@@ -1952,7 +1952,11 @@ Writes a line to a text modfs `file`. Returns true on success
## [mod_fs_file_seek](#mod_fs_file_seek)
### Description
-Sets the current position of a modfs `file`. If `origin` is `FILE_SEEK_SET`, file position is set to `offset`. If `origin` is `FILE_SEEK_CUR`, `offset` is added to file current position. If `origin` is `FILE_SEEK_END`, file position is set to `end of file + offset`. Returns true on success
+Sets the current position of a modfs `file`.
+If `origin` is `FILE_SEEK_SET`, file position is set to `offset`.
+If `origin` is `FILE_SEEK_CUR`, `offset` is added to file current position.
+If `origin` is `FILE_SEEK_END`, file position is set to `end of file + offset`.
+Returns true on success
### Lua Example
`local booleanValue = mod_fs_file_seek(file, offset, origin)`
@@ -1977,7 +1981,8 @@ Sets the current position of a modfs `file`. If `origin` is `FILE_SEEK_SET`, fil
## [mod_fs_file_rewind](#mod_fs_file_rewind)
### Description
-Sets the current position of a modfs `file` to its beginning. Returns true on success
+Sets the current position of a modfs `file` to its beginning.
+Returns true on success
### Lua Example
`local booleanValue = mod_fs_file_rewind(file)`
@@ -3126,7 +3131,8 @@ Generates splashes if at surface of water, entering water, or bubbles if underwa
## [object_step](#object_step)
### Description
-Generic object move function. Handles walls, water, floors, and gravity. Returns flags for certain interactions
+Generic object move function. Handles walls, water, floors, and gravity.
+Returns flags for certain interactions
### Lua Example
`local integerValue = object_step()`
@@ -3147,7 +3153,8 @@ Generic object move function. Handles walls, water, floors, and gravity. Returns
## [object_step_without_floor_orient](#object_step_without_floor_orient)
### Description
-Takes an object step but does not orient with the object's floor. Used for boulders, falling pillars, and the rolling snowman body
+Takes an object step but does not orient with the object's floor.
+Used for boulders, falling pillars, and the rolling snowman body
### Lua Example
`local integerValue = object_step_without_floor_orient()`
@@ -3168,7 +3175,8 @@ Takes an object step but does not orient with the object's floor. Used for bould
## [obj_move_xyz_using_fvel_and_yaw](#obj_move_xyz_using_fvel_and_yaw)
### Description
-Don't use this function outside of of a context where the current object and `obj` are the same. Moves `obj` based on a seemingly random mix of using either the current obj or `obj`'s fields
+Don't use this function outside of of a context where the current object and `obj` are the same.
+Moves `obj` based on a seemingly random mix of using either the current obj or `obj`'s fields
### Lua Example
`obj_move_xyz_using_fvel_and_yaw(obj)`
@@ -3578,7 +3586,8 @@ Randomly displaces an objects home if RNG says to, and turns the object towards
## [obj_check_if_facing_toward_angle](#obj_check_if_facing_toward_angle)
### Description
-A series of checks using sin and cos to see if a given angle is facing in the same direction of a given angle, within a certain range
+A series of checks using sin and cos to see if a given angle is facing in the same direction
+of a given angle, within a certain range
### Lua Example
`local integerValue = obj_check_if_facing_toward_angle(base, goal, range)`
@@ -3701,7 +3710,8 @@ Checks if a given room is Mario's current room, even if on an object
## [obj_check_floor_death](#obj_check_floor_death)
### Description
-Checks if `floor`'s type is burning or death plane and if so change the current object's action accordingly
+Checks if `floor`'s type is burning or death plane and if so change the
+current object's action accordingly
### Lua Example
`obj_check_floor_death(collisionFlags, floor)`
@@ -3725,7 +3735,8 @@ Checks if `floor`'s type is burning or death plane and if so change the current
## [obj_lava_death](#obj_lava_death)
### Description
-Controls an object dying in lava by creating smoke, sinking the object, playing audio, and eventually despawning it. Returns TRUE when the obj is dead
+Controls an object dying in lava by creating smoke, sinking the object, playing
+audio, and eventually despawning it. Returns TRUE when the obj is dead
### Lua Example
`local integerValue = obj_lava_death()`
@@ -4426,7 +4437,10 @@ Rotates the current object's move angle yaw using `delta` in either a randomly d
## [obj_grow_then_shrink](#obj_grow_then_shrink)
### Description
-Begin by increasing the current object's scale by `scaleVel`, and slowly decreasing `scaleVel`. Once the object starts to shrink, wait a bit, and then begin to scale the object toward `endScale`. The first time it reaches below `shootFireScale` during this time, return 1. Return -1 once it's reached endScale
+Begin by increasing the current object's scale by `scaleVel`, and slowly decreasing `scaleVel`.
+Once the object starts to shrink, wait a bit, and then begin to scale the object toward `endScale`.
+The first time it reaches below `shootFireScale` during this time, return 1.
+Return -1 once it's reached endScale
### Lua Example
`local integerValue, scaleVel = obj_grow_then_shrink(scaleVel, shootFireScale, endScale)`
diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md
index 8b96cef49..14ab5c8c5 100644
--- a/docs/lua/functions-6.md
+++ b/docs/lua/functions-6.md
@@ -777,7 +777,12 @@ Overrides the current room Mario is in. Set to -1 to reset override
## [linear_mtxf_mul_vec3f](#linear_mtxf_mul_vec3f)
### Description
-Multiplies a vector by a matrix of the form: `| ? ? ? 0 |` `| ? ? ? 0 |` `| ? ? ? 0 |` `| 0 0 0 1 |` i.e. a matrix representing a linear transformation over 3 space
+Multiplies a vector by a matrix of the form:
+`| ? ? ? 0 |`
+`| ? ? ? 0 |`
+`| ? ? ? 0 |`
+`| 0 0 0 1 |`
+i.e. a matrix representing a linear transformation over 3 space
### Lua Example
`linear_mtxf_mul_vec3f(m, dst, v)`
@@ -802,7 +807,12 @@ Multiplies a vector by a matrix of the form: `| ? ? ? 0 |` `| ? ? ? 0 |` `| ? ?
## [linear_mtxf_transpose_mul_vec3f](#linear_mtxf_transpose_mul_vec3f)
### Description
-Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ? ? ? 0 |` `| ? ? ? 0 |` `| 0 0 0 1 |` i.e. a matrix representing a linear transformation over 3 space
+Multiplies a vector by the transpose of a matrix of the form:
+`| ? ? ? 0 |`
+`| ? ? ? 0 |`
+`| ? ? ? 0 |`
+`| 0 0 0 1 |`
+i.e. a matrix representing a linear transformation over 3 space
### Lua Example
`linear_mtxf_transpose_mul_vec3f(m, dst, v)`
@@ -4615,7 +4625,9 @@ Apply one frame of platform rotation to the object using the given platform
## [preset_palette_allocate](#preset_palette_allocate)
### Description
-Allocates a preset palette that can be shown in the player customization screen. This returns a `PresetPalette` that can be used to customize the palette. Customization functions include `preset_palette_set_name` and `preset_palette_set_color_of_part`.
+Allocates a preset palette that can be shown in the player customization screen.
+This returns a `PresetPalette` that can be used to customize the palette.
+Customization functions include `preset_palette_set_name` and `preset_palette_set_color_of_part`.
### Lua Example
`local presetPaletteValue = preset_palette_allocate(name)`
@@ -4868,7 +4880,8 @@ Gets the level number's corresponding course number
## [touch_coin_score_age](#touch_coin_score_age)
### Description
-Marks the coin score for a specific course as the newest among all save files. Adjusts the age of other scores to reflect the update. Useful for leaderboard tracking or displaying recent progress
+Marks the coin score for a specific course as the newest among all save files. Adjusts the age of other scores to reflect the update.
+Useful for leaderboard tracking or displaying recent progress
### Lua Example
`touch_coin_score_age(fileIndex, courseIndex)`
@@ -4892,7 +4905,8 @@ Marks the coin score for a specific course as the newest among all save files. A
## [save_file_do_save](#save_file_do_save)
### Description
-Saves the current state of the game into a specified save file. Includes data verification and backup management. Useful for maintaining game progress during play or when saving manually
+Saves the current state of the game into a specified save file. Includes data verification and backup management.
+Useful for maintaining game progress during play or when saving manually
### Lua Example
`save_file_do_save(fileIndex, forceSave)`
@@ -4916,7 +4930,8 @@ Saves the current state of the game into a specified save file. Includes data ve
## [save_file_erase](#save_file_erase)
### Description
-Erases all data in a specified save file, including backup slots. Marks the save file as modified and performs a save to apply the changes. Useful for resetting a save file to its default state
+Erases all data in a specified save file, including backup slots. Marks the save file as modified and performs a save to apply the changes.
+Useful for resetting a save file to its default state
### Lua Example
`save_file_erase(fileIndex)`
@@ -4960,7 +4975,8 @@ Erases the backup data for the current save file without affecting the primary s
## [save_file_reload](#save_file_reload)
### Description
-Reloads the save file data into memory, optionally resetting all save files. Marks the save file as modified. Useful for reloading state after data corruption or during development debugging
+Reloads the save file data into memory, optionally resetting all save files. Marks the save file as modified.
+Useful for reloading state after data corruption or during development debugging
### Lua Example
`save_file_reload(load_all)`
@@ -4983,7 +4999,8 @@ Reloads the save file data into memory, optionally resetting all save files. Mar
## [save_file_get_max_coin_score](#save_file_get_max_coin_score)
### Description
-Determines the maximum coin score for a course across all save files. Returns the score along with the file index of the save containing it. Useful for leaderboard-style comparisons and overall progress tracking
+Determines the maximum coin score for a course across all save files. Returns the score along with the file index of the save containing it.
+Useful for leaderboard-style comparisons and overall progress tracking
### Lua Example
`local integerValue = save_file_get_max_coin_score(courseIndex)`
@@ -5006,7 +5023,8 @@ Determines the maximum coin score for a course across all save files. Returns th
## [save_file_get_course_star_count](#save_file_get_course_star_count)
### Description
-Calculates the total number of stars collected in a specific course for a given save file. Useful for determining completion status of individual levels
+Calculates the total number of stars collected in a specific course for a given save file.
+Useful for determining completion status of individual levels
### Lua Example
`local integerValue = save_file_get_course_star_count(fileIndex, courseIndex)`
@@ -5030,7 +5048,8 @@ Calculates the total number of stars collected in a specific course for a given
## [save_file_get_total_star_count](#save_file_get_total_star_count)
### Description
-Calculates the total number of stars collected across multiple courses within a specified range. Useful for determining the overall progress toward game completion
+Calculates the total number of stars collected across multiple courses within a specified range.
+Useful for determining the overall progress toward game completion
### Lua Example
`local integerValue = save_file_get_total_star_count(fileIndex, minCourse, maxCourse)`
@@ -5055,7 +5074,8 @@ Calculates the total number of stars collected across multiple courses within a
## [save_file_set_flags](#save_file_set_flags)
### Description
-Adds new flags to the save file's flag bitmask. Useful for updating progress or triggering new gameplay features
+Adds new flags to the save file's flag bitmask.
+Useful for updating progress or triggering new gameplay features
### Lua Example
`save_file_set_flags(flags)`
@@ -5078,7 +5098,8 @@ Adds new flags to the save file's flag bitmask. Useful for updating progress or
## [save_file_clear_flags](#save_file_clear_flags)
### Description
-Clears specific flags in the current save file. The flags are specified as a bitmask in the `flags` parameter. Ensures that the save file remains valid after clearing. Useful for removing specific game states, such as collected items or completed objectives, without resetting the entire save
+Clears specific flags in the current save file. The flags are specified as a bitmask in the `flags` parameter. Ensures that the save file remains valid after clearing.
+Useful for removing specific game states, such as collected items or completed objectives, without resetting the entire save
### Lua Example
`save_file_clear_flags(flags)`
@@ -5101,7 +5122,8 @@ Clears specific flags in the current save file. The flags are specified as a bit
## [save_file_get_flags](#save_file_get_flags)
### Description
-Retrieves the bitmask of flags representing the current state of the save file. Flags indicate collected items, completed objectives, and other game states. Useful for checking specific game progress details
+Retrieves the bitmask of flags representing the current state of the save file. Flags indicate collected items, completed objectives, and other game states.
+Useful for checking specific game progress details
### Lua Example
`local integerValue = save_file_get_flags()`
@@ -5122,7 +5144,8 @@ Retrieves the bitmask of flags representing the current state of the save file.
## [save_file_get_star_flags](#save_file_get_star_flags)
### Description
-Retrieves the bitmask of stars collected in a specific course or castle secret stars (-1). Useful for evaluating level progress and completion
+Retrieves the bitmask of stars collected in a specific course or castle secret stars (-1).
+Useful for evaluating level progress and completion
### Lua Example
`local integerValue = save_file_get_star_flags(fileIndex, courseIndex)`
@@ -5146,7 +5169,8 @@ Retrieves the bitmask of stars collected in a specific course or castle secret s
## [save_file_set_star_flags](#save_file_set_star_flags)
### Description
-Adds specific star flags to the save file, indicating collected stars for a course or castle secret stars. Updates the save file flags as necessary. Useful for recording progress after star collection
+Adds specific star flags to the save file, indicating collected stars for a course or castle secret stars. Updates the save file flags as necessary.
+Useful for recording progress after star collection
### Lua Example
`save_file_set_star_flags(fileIndex, courseIndex, starFlags)`
@@ -5171,7 +5195,8 @@ Adds specific star flags to the save file, indicating collected stars for a cour
## [save_file_remove_star_flags](#save_file_remove_star_flags)
### Description
-Removes specific star flags from the save file. This modifies the bitmask representing collected stars for a course or castle secret stars. Useful for undoing progress or debugging collected stars
+Removes specific star flags from the save file. This modifies the bitmask representing collected stars for a course or castle secret stars.
+Useful for undoing progress or debugging collected stars
### Lua Example
`save_file_remove_star_flags(fileIndex, courseIndex, starFlagsToRemove)`
@@ -5196,7 +5221,8 @@ Removes specific star flags from the save file. This modifies the bitmask repres
## [save_file_get_course_coin_score](#save_file_get_course_coin_score)
### Description
-Returns the highest coin score for a specified course in the save file. Performs checks to ensure the coin score is valid. Useful for tracking player achievements and high scores
+Returns the highest coin score for a specified course in the save file. Performs checks to ensure the coin score is valid.
+Useful for tracking player achievements and high scores
### Lua Example
`local integerValue = save_file_get_course_coin_score(fileIndex, courseIndex)`
@@ -5220,7 +5246,8 @@ Returns the highest coin score for a specified course in the save file. Performs
## [save_file_set_course_coin_score](#save_file_set_course_coin_score)
### Description
-Updates the coin score for a specific course in the save file. The new score is provided in the `coinScore` parameter. Useful for manually setting achievements such as high coin counts in individual levels
+Updates the coin score for a specific course in the save file. The new score is provided in the `coinScore` parameter.
+Useful for manually setting achievements such as high coin counts in individual levels
### Lua Example
`save_file_set_course_coin_score(fileIndex, courseIndex, coinScore)`
@@ -5245,7 +5272,8 @@ Updates the coin score for a specific course in the save file. The new score is
## [save_file_is_cannon_unlocked](#save_file_is_cannon_unlocked)
### Description
-Checks whether the cannon in the specified course is unlocked. Returns true if the cannon is unlocked, otherwise false. Useful for tracking course-specific progress and enabling shortcuts
+Checks whether the cannon in the specified course is unlocked. Returns true if the cannon is unlocked, otherwise false.
+Useful for tracking course-specific progress and enabling shortcuts
### Lua Example
`local integerValue = save_file_is_cannon_unlocked(fileIndex, courseIndex)`
@@ -5290,7 +5318,8 @@ Unlocks the cannon in the current course
## [save_file_get_cap_pos](#save_file_get_cap_pos)
### Description
-Retrieves the current position of Mario's cap, if it is on the ground in the current level and area. The position is stored in the provided `capPos` parameter. Useful for tracking the cap's location after it has been dropped or lost
+Retrieves the current position of Mario's cap, if it is on the ground in the current level and area. The position is stored in the provided `capPos` parameter.
+Useful for tracking the cap's location after it has been dropped or lost
### Lua Example
`local integerValue = save_file_get_cap_pos(capPos)`
@@ -5313,7 +5342,8 @@ Retrieves the current position of Mario's cap, if it is on the ground in the cur
## [save_file_get_sound_mode](#save_file_get_sound_mode)
### Description
-Returns the current sound mode (e.g., stereo, mono) stored in the save file. Useful for checking the audio output preferences when loading a save
+Returns the current sound mode (e.g., stereo, mono) stored in the save file.
+Useful for checking the audio output preferences when loading a save
### Lua Example
`local integerValue = save_file_get_sound_mode()`
@@ -6516,7 +6546,8 @@ Sets if the romhack camera should allow D-Pad movement
## [camera_romhack_set_collisions](#camera_romhack_set_collisions)
### Description
-Toggles collision settings for the ROM hack camera. This enables or disables specific collision behaviors in modded levels
+Toggles collision settings for the ROM hack camera.
+This enables or disables specific collision behaviors in modded levels
### Lua Example
`camera_romhack_set_collisions(enable)`
@@ -7649,7 +7680,9 @@ Gets a table of the surface types from `data`
## [smlua_collision_add_surface](#smlua_collision_add_surface)
### Description
-Allocates a new collision surface with the given vertices, computes the surface normal and other fields, and inserts it into the spatial partition. Returns the new surface, or `nil` if the triangle is degenerate (zero area). Set `dynamic` to `true` for surfaces that are cleared each frame, or `false` for persistent static surfaces
+Allocates a new collision surface with the given vertices, computes the surface normal and other fields, and inserts it into the spatial partition.
+Returns the new surface, or `nil` if the triangle is degenerate (zero area).
+Set `dynamic` to `true` for surfaces that are cleared each frame, or `false` for persistent static surfaces
### Lua Example
`local surfaceValue = smlua_collision_add_surface(dynamic, surfaceType, vertex1, vertex2, vertex3)`
@@ -7676,7 +7709,9 @@ Allocates a new collision surface with the given vertices, computes the surface
## [smlua_collision_move_surface](#smlua_collision_move_surface)
### Description
-Moves an existing collision surface to new vertex positions. Recalculates the surface normal, origin offset, and Y bounds, removes the surface from its old spatial partition cells, and re-adds it to the correct cells. The previous vertices are preserved for interpolation
+Moves an existing collision surface to new vertex positions.
+Recalculates the surface normal, origin offset, and Y bounds, removes the surface from its old spatial partition cells, and re-adds it to the correct cells.
+The previous vertices are preserved for interpolation
### Lua Example
`smlua_collision_move_surface(surface, vertex1, vertex2, vertex3)`
diff --git a/docs/lua/functions-7.md b/docs/lua/functions-7.md
index 9a3757f2c..6779d5890 100644
--- a/docs/lua/functions-7.md
+++ b/docs/lua/functions-7.md
@@ -11,6 +11,165 @@
+## [get_shader_flag_enabled](#get_shader_flag_enabled)
+
+### Description
+Gets if a custom shader flag (`SHADER_FLAG_*`) is enabled or not
+
+### Lua Example
+`local booleanValue = get_shader_flag_enabled(flag)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| flag | [enum ShaderFlag](constants.md#enum-ShaderFlag) |
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool get_shader_flag_enabled(enum ShaderFlag flag);`
+
+[:arrow_up_small:](#)
+
+
+
+## [set_shader_flag_enabled](#set_shader_flag_enabled)
+
+### Description
+Enables a custom shader flag (`SHADER_FLAG_*`) for the renderer
+
+### Lua Example
+`set_shader_flag_enabled(flag, enabled)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| flag | [enum ShaderFlag](constants.md#enum-ShaderFlag) |
+| enabled | `boolean` |
+
+### Returns
+- None
+
+### C Prototype
+`void set_shader_flag_enabled(enum ShaderFlag flag, bool enabled);`
+
+[:arrow_up_small:](#)
+
+
+
+## [get_shader_flag_value](#get_shader_flag_value)
+
+### Description
+Gets a value for one of the custom shader flags (`SHADER_FLAG_*`)
+
+### Lua Example
+`local numberValue = get_shader_flag_value(flag)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| flag | [enum ShaderFlag](constants.md#enum-ShaderFlag) |
+
+### Returns
+- `number`
+
+### C Prototype
+`f32 get_shader_flag_value(enum ShaderFlag flag);`
+
+[:arrow_up_small:](#)
+
+
+
+## [set_shader_flag_value](#set_shader_flag_value)
+
+### Description
+Sets a value for one of the custom shader flags (`SHADER_FLAG_*`) for the renderer
+
+### Lua Example
+`set_shader_flag_value(flag, value)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| flag | [enum ShaderFlag](constants.md#enum-ShaderFlag) |
+| value | `number` |
+
+### Returns
+- None
+
+### C Prototype
+`void set_shader_flag_value(enum ShaderFlag flag, f32 value);`
+
+[:arrow_up_small:](#)
+
+
+
+## [get_global_shader_flags_enabled](#get_global_shader_flags_enabled)
+
+### Description
+Gets if custom shader flags are enabled globally
+
+### Lua Example
+`local booleanValue = get_global_shader_flags_enabled()`
+
+### Parameters
+- None
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool get_global_shader_flags_enabled(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [set_global_shader_flags_enabled](#set_global_shader_flags_enabled)
+
+### Description
+Enables custom shader flags as a global toggle, useful for disabling without manually going through every effect
+
+### Lua Example
+`set_global_shader_flags_enabled(enabled)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| enabled | `boolean` |
+
+### Returns
+- None
+
+### C Prototype
+`void set_global_shader_flags_enabled(bool enabled);`
+
+[:arrow_up_small:](#)
+
+
+
+## [clear_all_shader_flags](#clear_all_shader_flags)
+
+### Description
+Clears all custom shader flags (`SHADER_FLAG_*`) for the renderer
+
+### Lua Example
+`clear_all_shader_flags()`
+
+### Parameters
+- None
+
+### Returns
+- None
+
+### C Prototype
+`void clear_all_shader_flags(void);`
+
+[:arrow_up_small:](#)
+
+
+
## [set_override_fov](#set_override_fov)
### Description
@@ -592,7 +751,8 @@ Gets the texture from a display list command if it has an image related op
## [gfx_get_from_name](#gfx_get_from_name)
### Description
-Gets a display list of the current mod from its name. Returns a pointer to the display list and its length
+Gets a display list of the current mod from its name.
+Returns a pointer to the display list and its length
### Lua Example
`local pointerValue, length = gfx_get_from_name(name)`
@@ -826,7 +986,8 @@ Deletes all display lists created by `gfx_create`
## [vtx_get_from_name](#vtx_get_from_name)
### Description
-Gets a vertex buffer of the current mod from its name. Returns a pointer to the vertex buffering and its vertex count
+Gets a vertex buffer of the current mod from its name.
+Returns a pointer to the vertex buffer and its vertex count
### Lua Example
`local pointerValue, count = vtx_get_from_name(name)`
@@ -2374,7 +2535,8 @@ Allocates an action ID with bitwise flags
## [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
+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)`
@@ -2398,7 +2560,8 @@ Gets the X coordinate of Mario's hand (0-1) or foot (2-3) but it is important to
## [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
+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)`
@@ -2422,7 +2585,8 @@ Gets the Y coordinate of Mario's hand (0-1) or foot (2-3) but It is important to
## [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
+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)`
@@ -3461,7 +3625,8 @@ Gets the extended model ID for the `name` of a `GeoLayout`
## [spawn_sync_object](#spawn_sync_object)
### Description
-Spawns a synchronized object 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`
+Spawns a synchronized object 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)`
@@ -3489,7 +3654,8 @@ Spawns a synchronized object at `x`, `y`, and `z` as a child object of the local
## [spawn_non_sync_object](#spawn_non_sync_object)
### Description
-Spawns a non-synchronized object 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`
+Spawns a non-synchronized object 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)`
@@ -3832,7 +3998,8 @@ Gets the first object loaded with `behaviorId`
## [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)
+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)`
@@ -3857,7 +4024,8 @@ Gets the first object loaded with `behaviorId` and object signed 32-bit integer
## [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)
+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)`
@@ -3928,7 +4096,8 @@ Gets the next object loaded with the same behavior ID
## [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)
+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)`
@@ -3953,7 +4122,8 @@ Gets the next object loaded with the same behavior ID and object signed 32-bit i
## [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)
+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)`
@@ -5723,7 +5893,8 @@ Plays a sound if the current object is visible and queues rumble for specific so
## [create_sound_spawner](#create_sound_spawner)
### Description
-Create a sound spawner for objects that need a sound play once. (Breakable walls, King Bobomb exploding, etc)
+Create a sound spawner for objects that need a sound play once.
+(Breakable walls, King Bobomb exploding, etc)
### Lua Example
`create_sound_spawner(soundMagic)`
@@ -5746,7 +5917,9 @@ Create a sound spawner for objects that need a sound play once. (Breakable walls
## [calc_dist_to_volume_range_1](#calc_dist_to_volume_range_1)
### Description
-Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124. What an even more strange and confusing function
+Unused vanilla function, calculates a volume based on `distance`.
+If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124.
+What an even more strange and confusing function
### Lua Example
`local integerValue = calc_dist_to_volume_range_1(distance)`
@@ -5769,7 +5942,9 @@ Unused vanilla function, calculates a volume based on `distance`. If `distance`
## [calc_dist_to_volume_range_2](#calc_dist_to_volume_range_2)
### Description
-Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127. What a strange and confusing function
+Unused vanilla function, calculates a volume based on `distance`.
+If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127.
+What a strange and confusing function
### Lua Example
`local integerValue = calc_dist_to_volume_range_2(distance)`
@@ -5798,7 +5973,8 @@ Unused vanilla function, calculates a volume based on `distance`. If `distance`
## [find_wall_collisions](#find_wall_collisions)
### Description
-Detects wall collisions at a given position and adjusts the position based on the walls found. Returns the number of wall collisions detected
+Detects wall collisions at a given position and adjusts the position based on the walls found.
+Returns the number of wall collisions detected
### Lua Example
`local integerValue = find_wall_collisions(colData)`
@@ -5821,7 +5997,8 @@ Detects wall collisions at a given position and adjusts the position based on th
## [find_ceil](#find_ceil)
### Description
-Finds the height of the highest ceiling above a given position (x, y, z) and return the corresponding ceil surface. If no ceiling is found, returns the default height limit of `gLevelValues.cellHeightLimit`(20000 by default)
+Finds the height of the highest ceiling above a given position (x, y, z) and return the corresponding ceil surface.
+If no ceiling is found, returns the default height limit of `gLevelValues.cellHeightLimit`(20000 by default)
### Lua Example
`local numberValue, pceil = find_ceil(posX, posY, posZ)`
@@ -5847,7 +6024,8 @@ Finds the height of the highest ceiling above a given position (x, y, z) and ret
## [find_ceil_height](#find_ceil_height)
### Description
-Finds the height of the highest ceiling above a given position (x, y, z). If no ceiling is found, returns the default height limit of `gLevelValues.cellHeightLimit`(20000 by default)
+Finds the height of the highest ceiling above a given position (x, y, z).
+If no ceiling is found, returns the default height limit of `gLevelValues.cellHeightLimit`(20000 by default)
### Lua Example
`local numberValue = find_ceil_height(x, y, z)`
@@ -5872,7 +6050,8 @@ Finds the height of the highest ceiling above a given position (x, y, z). If no
## [find_floor_height](#find_floor_height)
### Description
-Finds the height of the highest floor below a given position (x, y, z). If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
+Finds the height of the highest floor below a given position (x, y, z).
+If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
### Lua Example
`local numberValue = find_floor_height(x, y, z)`
@@ -5897,7 +6076,8 @@ Finds the height of the highest floor below a given position (x, y, z). If no fl
## [find_floor](#find_floor)
### Description
-Finds the height of the highest floor below a given position (x, y, z) and return the corresponding floor surface. If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
+Finds the height of the highest floor below a given position (x, y, z) and return the corresponding floor surface.
+If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
### Lua Example
`local numberValue, pfloor = find_floor(xPos, yPos, zPos)`
@@ -5923,7 +6103,8 @@ Finds the height of the highest floor below a given position (x, y, z) and retur
## [find_water_level](#find_water_level)
### Description
-Finds the height of water at a given position (x, z), if the position is within a water region. If no water is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
+Finds the height of water at a given position (x, z), if the position is within a water region.
+If no water is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
### Lua Example
`local numberValue = find_water_level(x, z)`
@@ -5947,7 +6128,8 @@ Finds the height of water at a given position (x, z), if the position is within
## [find_poison_gas_level](#find_poison_gas_level)
### Description
-Finds the height of the poison gas at a given position (x, z), if the position is within a gas region. If no gas is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
+Finds the height of the poison gas at a given position (x, z), if the position is within a gas region.
+If no gas is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
### Lua Example
`local numberValue = find_poison_gas_level(x, z)`
@@ -6027,7 +6209,8 @@ Gets the closest point of the triangle to `src` and returns it in `out`.
## [load_object_collision_model](#load_object_collision_model)
### Description
-Loads the object's collision data into dynamic collision. You must run this every frame in your object's behavior loop for it to have collision
+Loads the object's collision data into dynamic collision.
+You must run this every frame in your object's behavior loop for it to have collision
### Lua Example
`load_object_collision_model()`
@@ -6048,7 +6231,8 @@ Loads the object's collision data into dynamic collision. You must run this ever
## [load_static_object_collision](#load_static_object_collision)
### Description
-Loads the object's collision data into static collision. You may run this only once to capture the object's collision at that frame.
+Loads the object's collision data into static collision.
+You may run this only once to capture the object's collision at that frame.
### Lua Example
`local staticObjectCollisionValue = load_static_object_collision()`
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index db4d537c5..764474d34 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -623,6 +623,7 @@
- [obj_update_gfx_pos_and_angle](functions-3.md#obj_update_gfx_pos_and_angle)
- [position_based_random_u16](functions-3.md#position_based_random_u16)
- [position_based_random_float_position](functions-3.md#position_based_random_float_position)
+ - [draw_distance_scalar_is_infinite](functions-3.md#draw_distance_scalar_is_infinite)
- [draw_distance_scalar](functions-3.md#draw_distance_scalar)
@@ -1966,6 +1967,13 @@
- smlua_gfx_utils.h
+ - [get_shader_flag_enabled](functions-7.md#get_shader_flag_enabled)
+ - [set_shader_flag_enabled](functions-7.md#set_shader_flag_enabled)
+ - [get_shader_flag_value](functions-7.md#get_shader_flag_value)
+ - [set_shader_flag_value](functions-7.md#set_shader_flag_value)
+ - [get_global_shader_flags_enabled](functions-7.md#get_global_shader_flags_enabled)
+ - [set_global_shader_flags_enabled](functions-7.md#set_global_shader_flags_enabled)
+ - [clear_all_shader_flags](functions-7.md#clear_all_shader_flags)
- [set_override_fov](functions-7.md#set_override_fov)
- [set_override_near](functions-7.md#set_override_near)
- [set_override_far](functions-7.md#set_override_far)
@@ -2858,7 +2866,8 @@ Derives a `MARIO_SPAWN_*` constant from `o`
## [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)`
@@ -2902,7 +2911,8 @@ Gets the first warp node found in the area, otherwise returns nil
## [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/docs/lua/structs.md b/docs/lua/structs.md
index 3fccbecde..e2cbf8917 100644
--- a/docs/lua/structs.md
+++ b/docs/lua/structs.md
@@ -780,6 +780,7 @@
| Field | Type | Access |
| ----- | ---- | ------ |
| textColor | [DjuiColor](structs.md#DjuiColor) | read-only |
+| disabledTextColor | [DjuiColor](structs.md#DjuiColor) | read-only |
| defaultRectColor | [DjuiColor](structs.md#DjuiColor) | read-only |
| cursorDownRectColor | [DjuiColor](structs.md#DjuiColor) | read-only |
| hoveredRectColor | [DjuiColor](structs.md#DjuiColor) | read-only |
diff --git a/lang/Czech.ini b/lang/Czech.ini
index 53e110cae..32b6bc971 100644
--- a/lang/Czech.ini
+++ b/lang/Czech.ini
@@ -64,6 +64,7 @@ BACK = "Zpět"
CANCEL = "Zrušit"
NO = "Ne"
YES = "Ano"
+SEARCH = "Hledat..."
[CAMERA]
CAMERA = "KAMERA"
@@ -167,6 +168,7 @@ D1P5X = "1.5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "Nekonečno"
DRAW_DISTANCE = "Vzdálenost vykreslování"
DYNOS_PACKS = "DynOS packy"
ANTIALIASING = "Anti-aliasing"
@@ -415,6 +417,10 @@ SFX_VOLUME = "Hlasitost zvuků"
ENV_VOLUME = "Hlasitost prostředí"
FADEOUT = "Ztišit daleké zvuky"
MUTE_FOCUS_LOSS = "Ztlumit, když je okno na pozadí"
+SOUND_OUTPUT = "Výstup zvuku"
+STEREO = "Stereo"
+MONO = "Mono"
+HEADSET = "Sluchátka"
[LANGUAGE]
LANGUAGE = "JAZYK"
@@ -440,3 +446,7 @@ NO_LOBBIES_FOUND = "Nebyly nalezeny žádné hry."
[CHANGELOG]
CHANGELOG_TITLE = "ZÁZNAM ZMĚN"
+
+[UPDATE]
+UPDATE_TITLE = "AKTUALIZACE"
+UPDATE_AVAILABLE = "Je k dispozici aktualizace. Chcete ji nainstalovat?"
\ No newline at end of file
diff --git a/lang/Dutch.ini b/lang/Dutch.ini
index 291f09c23..fb329ed5b 100644
--- a/lang/Dutch.ini
+++ b/lang/Dutch.ini
@@ -64,6 +64,7 @@ BACK = "Terug"
CANCEL = "Stop"
NO = "Nee"
YES = "Ja"
+SEARCH = "Zoek..."
[CAMERA]
CAMERA = "CAMERA"
@@ -167,6 +168,7 @@ D1P5X = "1.5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "Oneindig"
DRAW_DISTANCE = "Teken afstand"
DYNOS_PACKS = "DynOS Packs"
ANTIALIASING = "Anti-aliasing"
@@ -415,6 +417,10 @@ SFX_VOLUME = "Sfx Geluid"
ENV_VOLUME = "Env Geluid"
FADEOUT = "Vervaagd Geluid in de Verte"
MUTE_FOCUS_LOSS = "Dempen wanneer venster niet meer scherp is"
+SOUND_OUTPUT = "Geluidsuitvoer"
+STEREO = "Stereo"
+MONO = "Mono"
+HEADSET = "Hoofdtelefoon"
[LANGUAGE]
LANGUAGE = "TAAL"
@@ -440,3 +446,7 @@ NO_LOBBIES_FOUND = "Er zijn geen lobby's gevonden."
[CHANGELOG]
CHANGELOG_TITLE = "WIJZIGINGENLOGBOEK"
+
+[UPDATE]
+UPDATE_TITLE = "UPDATE"
+UPDATE_AVAILABLE = "Een update is beschikbaar. Wilt u deze installeren?"
diff --git a/lang/English.ini b/lang/English.ini
index dce8dbe20..e7008f989 100644
--- a/lang/English.ini
+++ b/lang/English.ini
@@ -64,6 +64,7 @@ BACK = "Back"
CANCEL = "Cancel"
NO = "No"
YES = "Yes"
+SEARCH = "Search..."
[CAMERA]
CAMERA = "CAMERA"
@@ -167,6 +168,7 @@ D1P5X = "1.5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "Infinite"
DRAW_DISTANCE = "Draw Distance"
DYNOS_PACKS = "DynOS Packs"
ANTIALIASING = "Anti-aliasing"
@@ -415,6 +417,10 @@ SFX_VOLUME = "Sound Effects Volume"
ENV_VOLUME = "Environment Volume"
FADEOUT = "Fade Out Distant Sounds"
MUTE_FOCUS_LOSS = "Mute When Window Unfocused"
+SOUND_OUTPUT = "Sound Output"
+STEREO = "Stereo"
+MONO = "Mono"
+HEADSET = "Headset"
[LANGUAGE]
LANGUAGE = "LANGUAGE"
@@ -440,3 +446,7 @@ NO_LOBBIES_FOUND = "No lobbies were found."
[CHANGELOG]
CHANGELOG_TITLE = "CHANGELOG"
+
+[UPDATE]
+UPDATE_TITLE = "UPDATE"
+UPDATE_AVAILABLE = "An update is available. Would you like to install it?"
diff --git a/lang/French.ini b/lang/French.ini
index 9c91b83ce..948e25f18 100644
--- a/lang/French.ini
+++ b/lang/French.ini
@@ -64,6 +64,7 @@ BACK = "Retour"
CANCEL = "Annuler"
NO = "Non"
YES = "Oui"
+SEARCH = "Rechercher..."
[CAMERA]
CAMERA = "CAMÉRA"
@@ -167,6 +168,7 @@ D1P5X = "x1.5"
D3X = "x3"
D10X = "x10"
D100X = "x100"
+INFINITE = "Infini"
DRAW_DISTANCE = "Distance d'affichage"
DYNOS_PACKS = "Packs DynOS"
ANTIALIASING = "Anti-aliasing"
@@ -415,6 +417,10 @@ SFX_VOLUME = "Volume des effets sonores"
ENV_VOLUME = "Volume de l'environnement"
FADEOUT = "Disparition des sons distants"
MUTE_FOCUS_LOSS = "Muet en arrière plan"
+SOUND_OUTPUT = "Sortie audio"
+STEREO = "Stéréo"
+MONO = "Mono"
+HEADSET = "Casque"
[LANGUAGE]
LANGUAGE = "LANGUE"
@@ -440,3 +446,7 @@ NO_LOBBIES_FOUND = "Aucune partie n'a été trouvée."
[CHANGELOG]
CHANGELOG_TITLE = "MODIFICATIONS"
+
+[UPDATE]
+UPDATE_TITLE = "MISE À JOUR"
+UPDATE_AVAILABLE = "Une mise à jour est disponible. Voulez-vous l'installer ?"
diff --git a/lang/German.ini b/lang/German.ini
index dd37a0411..07b00cddc 100644
--- a/lang/German.ini
+++ b/lang/German.ini
@@ -64,6 +64,7 @@ BACK = "Zurück"
CANCEL = "Abbrechen"
NO = "Nein"
YES = "Ja"
+SEARCH = "Suche..."
[CAMERA]
CAMERA = "KAMERA"
@@ -167,6 +168,7 @@ D1P5X = "1.5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "Unendlich"
DRAW_DISTANCE = "Sichtweite"
DYNOS_PACKS = "DynOS-Pakete"
ANTIALIASING = "Kantenglättung"
@@ -415,6 +417,10 @@ SFX_VOLUME = "Effektlautstärke"
ENV_VOLUME = "Umgebungslautstärke"
FADEOUT = "Ausblenden"
MUTE_FOCUS_LOSS = "Audio bei Fokusverlust stummschalten"
+SOUND_OUTPUT = "Audioausgabe"
+STEREO = "Stereo"
+MONO = "Mono"
+HEADSET = "Kopfhörer"
[LANGUAGE]
LANGUAGE = "SPRACHE"
@@ -440,3 +446,7 @@ NO_LOBBIES_FOUND = "Keine Lobbys gefunden."
[CHANGELOG]
CHANGELOG_TITLE = "ÄNDERUNGSPROTOKOLL"
+
+[UPDATE]
+UPDATE_TITLE = "AKTUALISIERUNG"
+UPDATE_AVAILABLE = "Eine Aktualisierung ist verfügbar. Möchten Sie sie installieren?"
diff --git a/lang/Italian.ini b/lang/Italian.ini
index 8f28936ec..d258eaf39 100644
--- a/lang/Italian.ini
+++ b/lang/Italian.ini
@@ -64,6 +64,7 @@ BACK = "Indietro"
CANCEL = "Annulla"
NO = "No"
YES = "Si"
+SEARCH = "Cerca..."
[CAMERA]
CAMERA = "TELECAMERA"
@@ -165,6 +166,7 @@ D1P5X = "1.5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "Infinito"
DRAW_DISTANCE = "Distanza di Simulazione"
DYNOS_PACKS = "Pacchetti DynOS"
ANTIALIASING = "Anti-aliasing"
@@ -413,6 +415,10 @@ SFX_VOLUME = "Effetti sonori"
ENV_VOLUME = "Ambientazione"
FADEOUT = "Suoni lontani in dissolvenza"
MUTE_FOCUS_LOSS = "Disattiva l'audio quando la finestra non è attiva"
+SOUND_OUTPUT = "Uscita audio"
+STEREO = "Stereo"
+MONO = "Mono"
+HEADSET = "Cuffie"
[LANGUAGE]
LANGUAGE = "LINGUA"
@@ -438,3 +444,7 @@ NO_LOBBIES_FOUND = "Non è stata trovata alcuna stanza."
[CHANGELOG]
CHANGELOG_TITLE = "REGISTRO DELLE MODIFICHE"
+
+[UPDATE]
+UPDATE_TITLE = "AGGIORNAMENTO"
+UPDATE_AVAILABLE = "Un aggiornamento è disponibile. Vuoi installarlo?"
diff --git a/lang/Japanese.ini b/lang/Japanese.ini
index ae5038478..ecae47eae 100644
--- a/lang/Japanese.ini
+++ b/lang/Japanese.ini
@@ -64,6 +64,7 @@ BACK = "戻る"
CANCEL = "キャンセル"
NO = "いいえ"
YES = "はい"
+SEARCH = "検索…"
[CAMERA]
CAMERA = "CAMERA"
@@ -167,6 +168,7 @@ D1P5X = "1.5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "無限"
DRAW_DISTANCE = "描画距離"
DYNOS_PACKS = "DynOSパック"
ANTIALIASING = "アンチエイリアス"
@@ -415,6 +417,10 @@ SFX_VOLUME = "SE音量"
ENV_VOLUME = "環境音量"
FADEOUT = "音の距離減衰"
MUTE_FOCUS_LOSS = "非フォーカス時に音をミュート"
+SOUND_OUTPUT = "音声出力"
+STEREO = "ステレオ"
+MONO = "モノラル"
+HEADSET = "ヘッドセット"
[LANGUAGE]
LANGUAGE = "LANGUAGE"
@@ -441,3 +447,7 @@ NO_LOBBIES_FOUND = "ルームが見つかりませんでした。"
[CHANGELOG]
CHANGELOG_TITLE = "CHANGELOG"
+
+[UPDATE]
+UPDATE_TITLE = "最新情報"
+UPDATE_AVAILABLE = "アップデートが利用可能です。インストールしますか?"
diff --git a/lang/Polish.ini b/lang/Polish.ini
index bdd2da229..9b30e4bb4 100644
--- a/lang/Polish.ini
+++ b/lang/Polish.ini
@@ -64,6 +64,7 @@ BACK = "Wróć"
CANCEL = "Anuluj"
NO = "Nie"
YES = "Tak"
+SEARCH = "Szukaj..."
[CAMERA]
CAMERA = "KAMERA"
@@ -167,6 +168,7 @@ D1P5X = "1,5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "Nieskończony"
DRAW_DISTANCE = "Odległość Renderowania"
DYNOS_PACKS = "Paczki DynOS"
ANTIALIASING = "Anti-aliasing"
@@ -415,6 +417,10 @@ SFX_VOLUME = "Głośność Efektów"
ENV_VOLUME = "Głośność Środowiska"
FADEOUT = "Zanikanie Odległych Dźwięków"
MUTE_FOCUS_LOSS = "Wycisz dźwięk, gdy okno traci fokus"
+SOUND_OUTPUT = "Wyjście dźwięku"
+STEREO = "Stereo"
+MONO = "Mono"
+HEADSET = "Słuchawki"
[LANGUAGE]
LANGUAGE = "JĘZYK"
@@ -440,3 +446,7 @@ NO_LOBBIES_FOUND = "Nie znaleziono żadnego lobby."
[CHANGELOG]
CHANGELOG_TITLE = "REJESTR ZMIAN"
+
+[UPDATE]
+UPDATE_TITLE = "AKTUALIZACJA"
+UPDATE_AVAILABLE = "Dostępna jest aktualizacja. Czy chcesz ją zainstalować?"
diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini
index affbcf836..6ebd0826d 100644
--- a/lang/Portuguese.ini
+++ b/lang/Portuguese.ini
@@ -64,6 +64,7 @@ BACK = "Voltar"
CANCEL = "Cancelar"
NO = "Não"
YES = "Sim"
+SEARCH = "Pesquisar..."
[CAMERA]
CAMERA = "CÂMERA"
@@ -167,6 +168,7 @@ D1P5X = "1.5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "Infinito"
DRAW_DISTANCE = "Distância de renderização"
DYNOS_PACKS = "Pacotes DynOS"
ANTIALIASING = "Antisserrilhamento"
@@ -415,6 +417,10 @@ SFX_VOLUME = "Volume dos efeitos sonoros"
ENV_VOLUME = "Volume do ambiente"
FADEOUT = "Desvanecer sons distantes"
MUTE_FOCUS_LOSS = "Silenciar quando a janela estiver desfocada"
+SOUND_OUTPUT = "Saída de som"
+STEREO = "Estéreo"
+MONO = "Mono"
+HEADSET = "Fone de ouvido"
[LANGUAGE]
LANGUAGE = "IDIOMA"
@@ -440,3 +446,7 @@ NO_LOBBIES_FOUND = "Nenhuma sala encontrada."
[CHANGELOG]
CHANGELOG_TITLE = "ALTERAÇÕES"
+
+[UPDATE]
+UPDATE_TITLE = "ATUALIZAÇÃO"
+UPDATE_AVAILABLE = "Uma atualização está disponível. Deseja instalá-la?"
diff --git a/lang/Russian.ini b/lang/Russian.ini
index fa431fbfd..b0ca5c266 100644
--- a/lang/Russian.ini
+++ b/lang/Russian.ini
@@ -64,6 +64,7 @@ BACK = "Назад"
CANCEL = "Отмена"
NO = "Нет"
YES = "Да"
+SEARCH = "Поиск..."
[CAMERA]
CAMERA = "CAMERA"
@@ -166,6 +167,7 @@ D1P5X = "1.5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "Бесконечный"
DRAW_DISTANCE = "Дальность прорисовки"
DYNOS_PACKS = "Пакеты DynOS"
ANTIALIASING = "Анизотропная фильтрация"
@@ -414,6 +416,10 @@ SFX_VOLUME = "Громкость звуков"
ENV_VOLUME = "Объёмное звучание"
FADEOUT = "Затухание звуков на расстоянии"
MUTE_FOCUS_LOSS = "Выключить звук когда окно не выбрано"
+SOUND_OUTPUT = "Выход звука"
+STEREO = "Стерео"
+MONO = "Моно"
+HEADSET = "Наушники"
[LANGUAGE]
LANGUAGE = "LANGUAGE"
@@ -439,3 +445,7 @@ NO_LOBBIES_FOUND = "Группы не найдены."
[CHANGELOG]
CHANGELOG_TITLE = "ЖУРНАЛ ИЗМЕНЕНИЙ"
+
+[UPDATE]
+UPDATE_TITLE = "ОБНОВЛЕНИЕ"
+UPDATE_AVAILABLE = "Доступно обновление. Хотите его установить?"
diff --git a/lang/Spanish.ini b/lang/Spanish.ini
index 9a264bb3e..a43ae2133 100644
--- a/lang/Spanish.ini
+++ b/lang/Spanish.ini
@@ -64,6 +64,7 @@ BACK = "Volver"
CANCEL = "Cancelar"
NO = "No"
YES = "Sí"
+SEARCH = "Buscar..."
[CAMERA]
CAMERA = "CÁMARA"
@@ -167,6 +168,7 @@ D1P5X = "1.5x"
D3X = "3x"
D10X = "10x"
D100X = "100x"
+INFINITE = "Infinito"
DRAW_DISTANCE = "Distancia de dibujado"
DYNOS_PACKS = "Packs DynOS"
ANTIALIASING = "Anti-aliasing"
@@ -415,6 +417,10 @@ SFX_VOLUME = "Volumen de los sonidos"
ENV_VOLUME = "Volumen del entorno"
FADEOUT = "Silenciar sonidos lejanos"
MUTE_FOCUS_LOSS = "Silenciar sonido cuando la ventana esté desenfocada"
+SOUND_OUTPUT = "Salida de sonido"
+STEREO = "Estéreo"
+MONO = "Mono"
+HEADSET = "Auriculares"
[LANGUAGE]
LANGUAGE = "IDIOMA"
@@ -440,3 +446,7 @@ NO_LOBBIES_FOUND = "No se han encontrado partidas."
[CHANGELOG]
CHANGELOG_TITLE = "REGISTRO DE CAMBIOS"
+
+[UPDATE]
+UPDATE_TITLE = "ACTUALIZACIÓN"
+UPDATE_AVAILABLE = "Hay una actualización disponible. ¿Quieres instalarla?"
diff --git a/levels/bbh/areas/1/10/model.inc.c b/levels/bbh/areas/1/10/model.inc.c
index 784955fce..790aec55e 100644
--- a/levels/bbh/areas/1/10/model.inc.c
+++ b/levels/bbh/areas/1/10/model.inc.c
@@ -19,26 +19,26 @@ static const Gfx bbh_seg7_dl_0700B8A8[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, spooky_09006800),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700B488, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_0700B488, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles( 5, 10, 11, 0x0, 5, 1, 10, 0x0),
gsSP1Triangle(12, 13, 14, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700B578, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_0700B578, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 6, 4, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles( 7, 4, 8, 0x0, 10, 11, 12, 0x0),
gsSP2Triangles(10, 13, 11, 0x0, 14, 13, 15, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700B678, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_0700B678, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 6, 7, 8, 0x0, 9, 10, 11, 0x0),
gsSP1Triangle(12, 13, 14, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700B768, 14, 0),
+ gsSPVertex(bbh_seg7_vertex_0700B768, 14, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0),
gsSP2Triangles( 4, 1, 5, 0x0, 4, 5, 6, 0x0),
gsSP2Triangles( 7, 8, 9, 0x0, 7, 10, 8, 0x0),
gsSP2Triangles(11, 10, 12, 0x0, 11, 13, 10, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700B848, 6, 0),
+ gsSPVertex(bbh_seg7_vertex_0700B848, 6, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSPEndDisplayList(),
};
@@ -46,7 +46,7 @@ static const Gfx bbh_seg7_dl_0700B8A8[] = {
// 0x0700B9E0 - 0x0700BA50
const Gfx bbh_seg7_dl_0700B9E0[] = {
gsDPPipeSync(),
- gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB),
+ gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
gsSPClearGeometryMode(G_LIGHTING),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
diff --git a/levels/bbh/areas/1/11/model.inc.c b/levels/bbh/areas/1/11/model.inc.c
index cef6ca89b..6d18c0a91 100644
--- a/levels/bbh/areas/1/11/model.inc.c
+++ b/levels/bbh/areas/1/11/model.inc.c
@@ -7,7 +7,7 @@ static const Gfx bbh_seg7_dl_0700BB50[] = {
gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_16b, 1, spooky_0900B000),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700BA50, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_0700BA50, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 5, 6, 0x0, 7, 4, 3, 0x0),
gsSP2Triangles( 7, 8, 4, 0x0, 6, 5, 9, 0x0),
diff --git a/levels/bbh/areas/1/15/model.inc.c b/levels/bbh/areas/1/15/model.inc.c
index 8c94e203e..80436ebfe 100644
--- a/levels/bbh/areas/1/15/model.inc.c
+++ b/levels/bbh/areas/1/15/model.inc.c
@@ -10,14 +10,14 @@ static const Gfx bbh_seg7_dl_0700D6F0[] = {
gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_16b, 1, spooky_0900B000),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700D500, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_0700D500, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 6, 4, 0x0, 7, 6, 3, 0x0),
gsSP2Triangles( 7, 8, 6, 0x0, 5, 4, 9, 0x0),
gsSP2Triangles( 5, 9, 10, 0x0, 10, 9, 8, 0x0),
gsSP2Triangles(10, 8, 7, 0x0, 11, 1, 0, 0x0),
gsSP2Triangles( 0, 2, 12, 0x0, 13, 14, 15, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700D600, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_0700D600, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 5, 6, 0x0, 6, 5, 1, 0x0),
gsSP2Triangles( 6, 1, 0, 0x0, 7, 8, 9, 0x0),
diff --git a/levels/bbh/areas/1/21/model.inc.c b/levels/bbh/areas/1/21/model.inc.c
index bfe47aecd..36937e234 100644
--- a/levels/bbh/areas/1/21/model.inc.c
+++ b/levels/bbh/areas/1/21/model.inc.c
@@ -7,7 +7,7 @@ static const Gfx bbh_seg7_dl_07012680[] = {
gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_16b, 1, spooky_0900B000),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07012580, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_07012580, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 5, 6, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles( 7, 9, 10, 0x0, 11, 12, 13, 0x0),
diff --git a/levels/bbh/areas/1/27/model.inc.c b/levels/bbh/areas/1/27/model.inc.c
index 070bd23ee..bf339ffb5 100644
--- a/levels/bbh/areas/1/27/model.inc.c
+++ b/levels/bbh/areas/1/27/model.inc.c
@@ -10,14 +10,14 @@ static const Gfx bbh_seg7_dl_07015930[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, spooky_09006800),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07015750, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_07015750, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 3, 2, 0x0),
gsSP2Triangles( 3, 4, 2, 0x0, 4, 0, 2, 0x0),
gsSP2Triangles( 5, 6, 7, 0x0, 8, 5, 7, 0x0),
gsSP2Triangles( 6, 9, 7, 0x0, 9, 8, 7, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 11, 13, 12, 0x0),
gsSP2Triangles(13, 14, 12, 0x0, 14, 10, 12, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07015840, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_07015840, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 3, 2, 0x0),
gsSP2Triangles( 3, 4, 2, 0x0, 4, 0, 2, 0x0),
gsSP2Triangles( 5, 6, 7, 0x0, 8, 5, 7, 0x0),
@@ -30,7 +30,7 @@ static const Gfx bbh_seg7_dl_07015930[] = {
// 0x07015A20 - 0x07015A90
const Gfx bbh_seg7_dl_07015A20[] = {
gsDPPipeSync(),
- gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB),
+ gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
gsSPClearGeometryMode(G_LIGHTING),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
diff --git a/levels/bbh/areas/1/30/model.inc.c b/levels/bbh/areas/1/30/model.inc.c
index 6497e3efe..291ca900b 100644
--- a/levels/bbh/areas/1/30/model.inc.c
+++ b/levels/bbh/areas/1/30/model.inc.c
@@ -7,7 +7,7 @@ static const Gfx bbh_seg7_dl_070176E0[] = {
gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_16b, 1, spooky_0900B000),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_070175E0, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_070175E0, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 5, 6, 0x0, 7, 4, 3, 0x0),
gsSP2Triangles( 7, 8, 4, 0x0, 6, 5, 9, 0x0),
diff --git a/levels/bbh/areas/1/38/model.inc.c b/levels/bbh/areas/1/38/model.inc.c
index 0790886e0..d6f7097d6 100644
--- a/levels/bbh/areas/1/38/model.inc.c
+++ b/levels/bbh/areas/1/38/model.inc.c
@@ -21,7 +21,7 @@ static const Gfx bbh_seg7_dl_0701EE90[] = {
gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_16b, 1, spooky_0900B800),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 64 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0701EE08, 4, 0),
+ gsSPVertex(bbh_seg7_vertex_0701EE08, 4, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPEndDisplayList(),
};
diff --git a/levels/bbh/areas/1/39/model.inc.c b/levels/bbh/areas/1/39/model.inc.c
index 91f6a0b4b..ca10a0111 100644
--- a/levels/bbh/areas/1/39/model.inc.c
+++ b/levels/bbh/areas/1/39/model.inc.c
@@ -7,7 +7,7 @@ static const Gfx bbh_seg7_dl_0701F018[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, spooky_09006800),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0701EF58, 12, 0),
+ gsSPVertex(bbh_seg7_vertex_0701EF58, 12, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0),
gsSP2Triangles( 4, 3, 5, 0x0, 4, 6, 3, 0x0),
gsSP2Triangles( 7, 8, 9, 0x0, 10, 5, 11, 0x0),
@@ -17,7 +17,7 @@ static const Gfx bbh_seg7_dl_0701F018[] = {
// 0x0701F070 - 0x0701F0E0
const Gfx bbh_seg7_dl_0701F070[] = {
gsDPPipeSync(),
- gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB),
+ gsDPSetCombineMode(G_CC_DECALRGB, G_CC_DECALRGB),
gsSPClearGeometryMode(G_LIGHTING),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
diff --git a/levels/bbh/areas/1/4/model.inc.c b/levels/bbh/areas/1/4/model.inc.c
index f42d54f8e..89a8f615d 100644
--- a/levels/bbh/areas/1/4/model.inc.c
+++ b/levels/bbh/areas/1/4/model.inc.c
@@ -13,17 +13,17 @@ static const Gfx bbh_seg7_dl_07007EE8[] = {
gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_16b, 1, spooky_0900B800),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 64 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07007C08, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_07007C08, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 6, 4, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles( 7, 10, 8, 0x0, 11, 12, 13, 0x0),
gsSP1Triangle(11, 13, 14, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07007CF8, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_07007CF8, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 6, 7, 8, 0x0, 6, 9, 7, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 10, 13, 11, 0x0),
gsSP1Triangle( 0, 2, 14, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07007DE8, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_07007DE8, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 6, 4, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles( 7, 9, 10, 0x0, 11, 12, 13, 0x0),
diff --git a/levels/bbh/areas/1/5/model.inc.c b/levels/bbh/areas/1/5/model.inc.c
index efa80a882..89e97f0dd 100644
--- a/levels/bbh/areas/1/5/model.inc.c
+++ b/levels/bbh/areas/1/5/model.inc.c
@@ -31,45 +31,45 @@ static const Gfx bbh_seg7_dl_070088E0[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, spooky_09006800),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008040, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_07008040, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 7, 0, 8, 0x0),
gsSP2Triangles( 9, 1, 10, 0x0, 9, 11, 1, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 12, 15, 13, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008140, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_07008140, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 1, 6, 7, 0x0, 1, 7, 8, 0x0),
gsSP2Triangles( 9, 10, 11, 0x0, 9, 11, 12, 0x0),
gsSP2Triangles(13, 14, 10, 0x0, 13, 10, 15, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008240, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_07008240, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 6, 7, 8, 0x0, 6, 8, 9, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 13, 6, 14, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008330, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_07008330, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles( 5, 10, 11, 0x0, 5, 11, 12, 0x0),
gsSP2Triangles(13, 14, 10, 0x0, 13, 10, 15, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008430, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_07008430, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles( 5, 2, 10, 0x0, 5, 10, 11, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 12, 14, 15, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008530, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_07008530, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 7, 0, 8, 0x0),
gsSP2Triangles( 9, 10, 11, 0x0, 12, 13, 14, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008620, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_07008620, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSP2Triangles( 4, 2, 5, 0x0, 4, 5, 6, 0x0),
gsSP2Triangles( 7, 8, 9, 0x0, 7, 9, 10, 0x0),
gsSP2Triangles(11, 12, 13, 0x0, 14, 10, 15, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008720, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_07008720, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles(10, 11, 5, 0x0, 10, 12, 11, 0x0),
gsSP2Triangles(13, 14, 15, 0x0, 13, 11, 14, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008820, 12, 0),
+ gsSPVertex(bbh_seg7_vertex_07008820, 12, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 7, 3, 8, 0x0),
gsSP2Triangles( 9, 2, 10, 0x0, 9, 10, 11, 0x0),
@@ -79,7 +79,7 @@ static const Gfx bbh_seg7_dl_070088E0[] = {
// 0x07008B58 - 0x07008BC8
const Gfx bbh_seg7_dl_07008B58[] = {
gsDPPipeSync(),
- gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB),
+ gsDPSetCombineMode(G_CC_DECALRGB, G_CC_DECALRGB),
gsSPClearGeometryMode(G_LIGHTING),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
diff --git a/levels/bbh/areas/1/6/model.inc.c b/levels/bbh/areas/1/6/model.inc.c
index dd1776f26..e21e328e6 100644
--- a/levels/bbh/areas/1/6/model.inc.c
+++ b/levels/bbh/areas/1/6/model.inc.c
@@ -10,14 +10,14 @@ static const Gfx bbh_seg7_dl_07008DB8[] = {
gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_16b, 1, spooky_0900B000),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008BC8, 16, 0),
+ gsSPVertex(bbh_seg7_vertex_07008BC8, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 6, 4, 0x0, 7, 6, 3, 0x0),
gsSP2Triangles( 7, 8, 6, 0x0, 5, 4, 9, 0x0),
gsSP2Triangles( 5, 9, 10, 0x0, 10, 9, 8, 0x0),
gsSP2Triangles(10, 8, 7, 0x0, 11, 1, 0, 0x0),
gsSP2Triangles( 0, 2, 12, 0x0, 13, 14, 15, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_07008CC8, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_07008CC8, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 5, 6, 0x0, 6, 5, 1, 0x0),
gsSP2Triangles( 6, 1, 0, 0x0, 7, 8, 9, 0x0),
diff --git a/levels/bbh/areas/1/9/model.inc.c b/levels/bbh/areas/1/9/model.inc.c
index 8bd745ab7..576ace3f8 100644
--- a/levels/bbh/areas/1/9/model.inc.c
+++ b/levels/bbh/areas/1/9/model.inc.c
@@ -10,12 +10,12 @@ static const Gfx bbh_seg7_dl_0700B398[] = {
gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_16b, 1, spooky_0900B800),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 64 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700B238, 15, 0),
+ gsSPVertex(bbh_seg7_vertex_0700B238, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 5, 6, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles( 7, 9, 10, 0x0, 11, 12, 13, 0x0),
gsSP1Triangle(11, 14, 12, 0x0),
- gsSPVertexNonGlobal(bbh_seg7_vertex_0700B328, 7, 0),
+ gsSPVertex(bbh_seg7_vertex_0700B328, 7, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP1Triangle( 0, 6, 1, 0x0),
gsSPEndDisplayList(),
diff --git a/src/audio/external.h b/src/audio/external.h
index ff6a41f47..856033768 100644
--- a/src/audio/external.h
+++ b/src/audio/external.h
@@ -14,8 +14,8 @@
#define SEQUENCE_ARGS(priority, seqId) ((priority << 8) | seqId)
#define SOUND_MODE_STEREO 0
-#define SOUND_MODE_MONO 3
-#define SOUND_MODE_HEADSET 1
+#define SOUND_MODE_MONO 1
+#define SOUND_MODE_HEADSET 2
#define SEQ_PLAYER_LEVEL 0 // Level background music
#define SEQ_PLAYER_ENV 1 // Misc music like the puzzle jingle
diff --git a/src/audio/heap.c b/src/audio/heap.c
index 8390cbda7..83c46c373 100644
--- a/src/audio/heap.c
+++ b/src/audio/heap.c
@@ -228,6 +228,13 @@ void discard_bank(s32 bankId) {
note->parentLayer->finished = TRUE;
}
note_disable(note);
+
+ // Reset sample state
+ note->sound = NULL;
+ note->samplePosInt = 0;
+ note->samplePosFrac = 0;
+ note->sampleDmaIndex = 0;
+
audio_list_remove(¬e->listItem);
audio_list_push_back(&gNoteFreeLists.disabled, ¬e->listItem);
}
diff --git a/src/audio/load.c b/src/audio/load.c
index 3e27fbf66..38737481a 100644
--- a/src/audio/load.c
+++ b/src/audio/load.c
@@ -1591,7 +1591,15 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
if (smlua_audio_utils_override(seqId, &bankId, &sequenceData)) {
sequence_player_disable(seqPlayer);
seqPlayer->defaultBank[0] = bankId;
- if (!bank_load_immediate(bankId, 0)) { return; }
+
+ // Check if the bank is already loaded in the temporary cache
+ if (get_bank_or_seq(&gBankLoadedPool, 0, bankId) == NULL) {
+ if (!bank_load_immediate(bankId, 0)) { return; }
+ } else if (gBankLoadStatus[bankId] == SOUND_LOAD_STATUS_DISCARDABLE) {
+ // This bank is still available, so just mark it as loaded again
+ gBankLoadStatus[bankId] = SOUND_LOAD_STATUS_COMPLETE;
+ }
+
seqPlayer->seqId = seqId;
gSeqLoadStatus[seqId] = SOUND_LOAD_STATUS_COMPLETE;
init_sequence_player(player);
diff --git a/src/engine/behavior_script.c b/src/engine/behavior_script.c
index 054e773f4..316b5b82d 100644
--- a/src/engine/behavior_script.c
+++ b/src/engine/behavior_script.c
@@ -1438,7 +1438,9 @@ cur_obj_update_begin:;
} else if ((objFlags & OBJ_FLAG_COMPUTE_DIST_TO_MARIO) && gCurrentObject->collisionData == NULL) {
if (!(objFlags & OBJ_FLAG_ACTIVE_FROM_AFAR)) {
// If the object has a render distance, check if it should be shown.
- if (distanceFromMario > gCurrentObject->oDrawingDistance * draw_distance_scalar()) {
+ if (!draw_distance_scalar_is_infinite() &&
+ distanceFromMario > gCurrentObject->oDrawingDistance * draw_distance_scalar()
+ ) {
// Out of render distance, hide the object.
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
@@ -1486,6 +1488,13 @@ f32 position_based_random_float_position(void) {
return rnd / (double)0x10000;
}
+bool draw_distance_scalar_is_infinite(void) {
+ if (!gBehaviorValues.InfiniteRenderDistance) {
+ return false;
+ }
+ return configDrawDistance == 6; // Expecting this to be "Infinite"
+}
+
f32 draw_distance_scalar(void) {
if (!gBehaviorValues.InfiniteRenderDistance) { return 1.0f; }
diff --git a/src/engine/behavior_script.h b/src/engine/behavior_script.h
index c3af4e0ed..43b0769d2 100644
--- a/src/engine/behavior_script.h
+++ b/src/engine/behavior_script.h
@@ -37,6 +37,8 @@ void obj_update_gfx_pos_and_angle(struct Object *obj);
u16 position_based_random_u16(void);
/* |description|Sets the current object's position to random floats between 0.0 and 1.0|descriptionEnd| */
f32 position_based_random_float_position(void);
+/* |description|Checks if the draw distance scalar is infinite|descriptionEnd| */
+bool draw_distance_scalar_is_infinite(void);
/* |description|Gets the draw distance scalar|descriptionEnd| */
f32 draw_distance_scalar(void);
diff --git a/src/engine/surface_load.c b/src/engine/surface_load.c
index c611750b0..5fbda2faf 100644
--- a/src/engine/surface_load.c
+++ b/src/engine/surface_load.c
@@ -1045,7 +1045,9 @@ static void load_object_collision_model_internal(bool isSOC) {
if (!isSOC) {
f32 marioDist = dist_between_objects(gCurrentObject, gMarioStates[0].marioObj);
- if (marioDist < gCurrentObject->oDrawingDistance * draw_distance_scalar()) {
+ if (draw_distance_scalar_is_infinite() ||
+ marioDist < gCurrentObject->oDrawingDistance * draw_distance_scalar()
+ ) {
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
} else {
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
diff --git a/src/game/behaviors/king_bobomb.inc.c b/src/game/behaviors/king_bobomb.inc.c
index 80945aca1..0ff0d7b56 100644
--- a/src/game/behaviors/king_bobomb.inc.c
+++ b/src/game/behaviors/king_bobomb.inc.c
@@ -230,7 +230,7 @@ void king_bobomb_act_7(void) {
void king_bobomb_act_8(void) {
if (!(o->header.gfx.node.flags & GRAPH_RENDER_INVISIBLE)) {
struct Object *star = NULL;
-
+
create_sound_spawner(SOUND_OBJ_KING_WHOMP_DEATH);
cur_obj_hide();
cur_obj_become_intangible();
@@ -367,6 +367,10 @@ void king_bobomb_move(void) {
cur_obj_move_using_fvel_and_gravity();
CUR_OBJ_CALL_ACTION_FUNCTION(sKingBobombActions);
exec_anim_sound_state(sKingBobombSoundStates, sizeof(sKingBobombSoundStates) / sizeof(struct SoundState));
+ if (draw_distance_scalar_is_infinite()) {
+ cur_obj_enable_rendering();
+ return;
+ }
s32 distanceToPlayer = dist_between_objects(o, gMarioStates[0].marioObj);
if (distanceToPlayer < 5000.0f * draw_distance_scalar())
cur_obj_enable_rendering();
diff --git a/src/game/behaviors/piranha_plant.inc.c b/src/game/behaviors/piranha_plant.inc.c
index 628bfcb01..f986c4eb4 100644
--- a/src/game/behaviors/piranha_plant.inc.c
+++ b/src/game/behaviors/piranha_plant.inc.c
@@ -375,12 +375,16 @@ void bhv_piranha_plant_loop(void) {
CUR_OBJ_CALL_ACTION_FUNCTION(TablePiranhaPlantActions);
// In WF, hide all Piranha Plants once high enough up.
if (gCurrLevelNum == LEVEL_WF) {
- struct Object* player = gMarioStates[0].marioObj;
- f32 scalar = max(draw_distance_scalar(), 1.0f);
- if (player->oPosY > 3400.0f * scalar)
- cur_obj_hide();
- else
+ if (draw_distance_scalar_is_infinite()) {
cur_obj_unhide();
+ } else {
+ struct Object* player = gMarioStates[0].marioObj;
+ f32 scalar = max(draw_distance_scalar(), 1.0f);
+ if (player->oPosY > 3400.0f * scalar)
+ cur_obj_hide();
+ else
+ cur_obj_unhide();
+ }
}
o->oInteractStatus = 0;
}
diff --git a/src/game/behaviors/whirlpool.inc.c b/src/game/behaviors/whirlpool.inc.c
index a5646f0c1..7034e4f0f 100644
--- a/src/game/behaviors/whirlpool.inc.c
+++ b/src/game/behaviors/whirlpool.inc.c
@@ -44,11 +44,15 @@ void bhv_whirlpool_loop(void) {
o->oWhirlpoolTimeout = 30;
}
- f32 marioDist = dist_between_objects(o, gMarioStates[0].marioObj);
- if (marioDist < 5000.0f * draw_distance_scalar()) {
+ if (draw_distance_scalar_is_infinite()) {
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
} else {
- o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
+ f32 marioDist = dist_between_objects(o, gMarioStates[0].marioObj);
+ if (marioDist < 5000.0f * draw_distance_scalar()) {
+ o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
+ } else {
+ o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
+ }
}
// not sure if actually an array
diff --git a/src/game/hud.c b/src/game/hud.c
index 49ead0a80..df6665ef9 100644
--- a/src/game/hud.c
+++ b/src/game/hud.c
@@ -325,7 +325,7 @@ void render_hud_icon(Vtx *vtx, const Texture *texture, u32 fmt, u32 siz, s32 tex
case G_IM_SIZ_16b: gDPLoadTextureBlock(gDisplayListHead++, texture, fmt, G_IM_SIZ_16b, texW, texH, 0, G_TX_CLAMP, G_TX_CLAMP, 0, 0, 0, 0); break;
case G_IM_SIZ_32b: gDPLoadTextureBlock(gDisplayListHead++, texture, fmt, G_IM_SIZ_32b, texW, texH, 0, G_TX_CLAMP, G_TX_CLAMP, 0, 0, 0, 0); break;
}
- gSPVertex(gDisplayListHead++, vtx, 4, 0);
+ gSPVertexNonGlobal(gDisplayListHead++, vtx, 4, 0);
gSP2Triangles(gDisplayListHead++, 0, 1, 2, 0x0, 0, 2, 3, 0x0);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
diff --git a/src/game/obj_behaviors.c b/src/game/obj_behaviors.c
index fc38d0a15..26b04be76 100644
--- a/src/game/obj_behaviors.c
+++ b/src/game/obj_behaviors.c
@@ -701,6 +701,10 @@ s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist) {
/* |description|Sets an object as visible if within a certain distance of Mario's graphical position|descriptionEnd| */
void set_object_visibility(struct Object *obj, s32 dist) {
if (!obj) { return; }
+ if (draw_distance_scalar_is_infinite()) {
+ obj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
+ return;
+ }
s32 distanceToPlayer = dist_between_objects(obj, gMarioStates[0].marioObj);
if (distanceToPlayer < dist * draw_distance_scalar()) {
obj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c
index 3d600d10d..8705b804a 100644
--- a/src/game/object_helpers.c
+++ b/src/game/object_helpers.c
@@ -3010,7 +3010,9 @@ void cur_obj_if_hit_wall_bounce_away(void) {
s32 cur_obj_hide_if_mario_far_away_y(f32 distY) {
if (!o) { return 0; }
if (!gMarioStates[0].marioObj) { return FALSE; }
- if (absf(o->oPosY - gMarioStates[0].marioObj->oPosY) < distY * draw_distance_scalar()) {
+ if (draw_distance_scalar_is_infinite() ||
+ absf(o->oPosY - gMarioStates[0].marioObj->oPosY) < distY * draw_distance_scalar()
+ ) {
cur_obj_unhide();
return FALSE;
}
diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c
index 07089fea5..82d0da8f7 100644
--- a/src/game/rendering_graph_node.c
+++ b/src/game/rendering_graph_node.c
@@ -50,6 +50,8 @@
#define DISPLAY_LIST_HEAP_SIZE 32000
+#define MAX_FAR_PLANE_DIST 1000000.f
+
f32 gProjectionMaxNearValue = 5;
s16 gProjectionVanillaNearValue = 100;
s16 gProjectionVanillaFarValue = 1000;
@@ -310,6 +312,10 @@ void patch_mtx_interpolated(f32 delta) {
f32 fovInterpolated = delta_interpolate_f32(sPerspectiveNode->prevFov, sPerspectiveNode->fov, delta);
f32 near = get_first_person_enabled() ? 1.f : replace_value_if_not_zero(MIN(sPerspectiveNode->near, gProjectionMaxNearValue), gOverrideNear);
f32 far = replace_value_if_not_zero(sPerspectiveNode->far, gOverrideFar);
+
+ // "infinite" draw distance
+ if (gOverrideFar == 0 && configDrawDistance == 6) { far = max(far, MAX_FAR_PLANE_DIST); }
+
guPerspective(sPerspectiveMtx, &perspNorm, fovInterpolated, sPerspectiveAspect, near, far, 1.0f);
gSPMatrix(sPerspectivePos, VIRTUAL_TO_PHYSICAL(sPerspectiveNode), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
}
@@ -650,6 +656,10 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
gProjectionVanillaFarValue = node->far;
f32 near = get_first_person_enabled() ? 1.f : replace_value_if_not_zero(MIN(node->near, gProjectionMaxNearValue), gOverrideNear);
f32 far = replace_value_if_not_zero(node->far, gOverrideFar);
+
+ // "infinite" draw distance
+ if (gOverrideFar == 0 && configDrawDistance == 6) { far = max(far, MAX_FAR_PLANE_DIST); }
+
guPerspective(mtx, &perspNorm, node->prevFov, aspect, near, far, 1.0f);
sPerspectiveNode = node;
@@ -1139,7 +1149,7 @@ static void anim_process(Vec3f translation, Vec3s rotation, Vec3f scale, u8 *ani
scale[2] *= ((f32) scaleZ) / 256.0f;
}
}
-
+
if (gCurAnim->flags & ANIM_FLAG_BONE_TRANS) {
*animType = ANIM_TYPE_TRANSLATION;
}
@@ -1459,7 +1469,7 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
// makes PU travel safe when the camera is locked on the main map.
// If Mario were rendered with a depth over 65536 it would cause overflow
// when converting the transformation matrix to a fixed point matrix.
- if (matrix[3][2] < -20000.0f - cullingRadius) {
+ if (configDrawDistance != 6 && matrix[3][2] < -20000.0f - cullingRadius) {
return FALSE;
}
diff --git a/src/game/save_file.c b/src/game/save_file.c
index 91d9350fb..d26e4e6ff 100644
--- a/src/game/save_file.c
+++ b/src/game/save_file.c
@@ -15,6 +15,8 @@
#include "pc/network/network.h"
#include "pc/lua/utils/smlua_level_utils.h"
#include "pc/utils/misc.h"
+#include "pc/configfile.h"
+#include "audio/external.h"
#ifndef bcopy
#define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), (void) 0)
@@ -814,7 +816,8 @@ void save_file_set_sound_mode(u16 mode) {
}
u16 save_file_get_sound_mode(void) {
- return gSaveBuffer.menuData[0].soundMode;
+ if (configSoundOutput > SOUND_MODE_HEADSET) { return SOUND_MODE_STEREO; }
+ return configSoundOutput;
}
void save_file_move_cap_to_default_location(void) {
diff --git a/src/game/skybox.c b/src/game/skybox.c
index 424c58ab1..d3c156095 100644
--- a/src/game/skybox.c
+++ b/src/game/skybox.c
@@ -191,7 +191,7 @@ f32 calculate_skybox_scaled_y(s8 player, UNUSED f32 fov) {
* into an x and y by modulus and division by SKYBOX_COLS. x and y are then scaled by
* SKYBOX_TILE_WIDTH to get a point in world space.
*/
-Vtx *make_skybox_rect(s32 tileRow, s32 tileCol, s8 colorIndex, s32 row, s32 col) {
+Vtx *make_skybox_rect(s32 tileRow, s32 tileCol, s32 row, s32 col) {
u16 index = row * sSkyboxTileNumX + col;
Vtx *verts;
if (gRenderingInterpolated) {
@@ -205,14 +205,10 @@ Vtx *make_skybox_rect(s32 tileRow, s32 tileCol, s8 colorIndex, s32 row, s32 col)
f32 y = SKYBOX_HEIGHT - tileRow / SKYBOX_COLS * SKYBOX_TILE_HEIGHT;
if (verts != NULL) {
- f32 r = gSkyboxColor[0] / 255.0f;
- f32 g = gSkyboxColor[1] / 255.0f;
- f32 b = gSkyboxColor[2] / 255.0f;
- u8 *colors = sSkyboxColors[colorIndex];
- make_vertex(verts, 0, x, y, -1, 0, 0, colors[0] * r, colors[1] * g, colors[2] * b, 255);
- make_vertex(verts, 1, x, y - SKYBOX_TILE_HEIGHT, -1, 0, 31 << 5, colors[0] * r, colors[1] * g, colors[2] * b, 255);
- make_vertex(verts, 2, x + SKYBOX_TILE_WIDTH, y - SKYBOX_TILE_HEIGHT, -1, 31 << 5, 31 << 5, colors[0] * r, colors[1] * g, colors[2] * b, 255);
- make_vertex(verts, 3, x + SKYBOX_TILE_WIDTH, y, -1, 31 << 5, 0, colors[0] * r, colors[1] * g, colors[2] * b, 255);
+ make_vertex(verts, 0, x, y, -1, 0, 0, 255, 255, 255, 255);
+ make_vertex(verts, 1, x, y - SKYBOX_TILE_HEIGHT, -1, 0, 31 << 5, 255, 255, 255, 255);
+ make_vertex(verts, 2, x + SKYBOX_TILE_WIDTH, y - SKYBOX_TILE_HEIGHT, -1, 31 << 5, 31 << 5, 255, 255, 255, 255);
+ make_vertex(verts, 3, x + SKYBOX_TILE_WIDTH, y, -1, 31 << 5, 0, 255, 255, 255, 255);
}
return verts;
}
@@ -246,10 +242,16 @@ void draw_skybox_tile_grid(Gfx **dlist, s8 background, s8 player, s8 colorIndex)
texture = (*(SkyboxTexture *) segmented_to_virtual(sSkyboxTextures[background]))[tileIndex];
}
- Vtx *vertices = make_skybox_rect(tileRow, tileColTmp, colorIndex, row, col);
+ f32 r = gSkyboxColor[0] / 255.0f;
+ f32 g = gSkyboxColor[1] / 255.0f;
+ f32 b = gSkyboxColor[2] / 255.0f;
+ u8 *color = sSkyboxColors[colorIndex];
+ gDPSetEnvColor((*dlist)++, color[0] * r, color[1] * g, color[2] * b, 255);
+
+ Vtx *vertices = make_skybox_rect(tileRow, tileColTmp, row, col);
gLoadBlockTexture((*dlist)++, 32, 32, G_IM_FMT_RGBA, texture);
- gSPVertexNonGlobal((*dlist)++, VIRTUAL_TO_PHYSICAL(vertices), 4, 0);
+ gSPVertex((*dlist)++, VIRTUAL_TO_PHYSICAL(vertices), 4, 0);
gSPDisplayList((*dlist)++, dl_draw_quad_verts_0123);
}
}
@@ -284,7 +286,7 @@ void *create_skybox_ortho_matrix(s8 player) {
Gfx *init_skybox_display_list(s8 player, s8 background, s8 colorIndex) {
extern Gfx* gBackgroundSkyboxGfx;
- s32 dlCommandCount = 5 + (sSkyboxTileNumY * sSkyboxTileNumX) * 7; // 5 for the start and end, plus the amount of skybox tiles
+ s32 dlCommandCount = 5 + (sSkyboxTileNumY * sSkyboxTileNumX) * 8; // 5 for the start and end, plus the amount of skybox tiles
void *skybox;
if (gRenderingInterpolated) {
diff --git a/src/pc/configfile.c b/src/pc/configfile.c
index ea33e5b5e..1969f8040 100644
--- a/src/pc/configfile.c
+++ b/src/pc/configfile.c
@@ -89,7 +89,7 @@ bool configShowPing = false;
enum RefreshRateMode configFramerateMode = RRM_AUTO;
unsigned int configFrameLimit = 60;
unsigned int configInterpolationMode = 1;
-unsigned int configDrawDistance = 4;
+unsigned int configDrawDistance = 6;
// sound settings
unsigned int configMasterVolume = 80; // 0 - MAX_VOLUME
unsigned int configMusicVolume = MAX_VOLUME;
@@ -97,6 +97,7 @@ unsigned int configSfxVolume = MAX_VOLUME;
unsigned int configEnvVolume = MAX_VOLUME;
bool configFadeoutDistantSounds = false;
bool configMuteFocusLoss = false;
+unsigned int configSoundOutput = 0; // 0 = Stereo, 1 = Mono, 2 = Headset
// control binds
unsigned int configKeyA[MAX_BINDS] = { 0x0026, 0x1000, 0x1103 };
unsigned int configKeyB[MAX_BINDS] = { 0x0033, 0x1001, 0x1101 };
@@ -243,6 +244,7 @@ static const struct ConfigOption options[] = {
{.name = "env_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configEnvVolume},
{.name = "fade_distant_sounds", .type = CONFIG_TYPE_BOOL, .boolValue = &configFadeoutDistantSounds},
{.name = "mute_focus_loss", .type = CONFIG_TYPE_BOOL, .boolValue = &configMuteFocusLoss},
+ {.name = "sound_output", .type = CONFIG_TYPE_UINT, .uintValue = &configSoundOutput},
// control binds
{.name = "key_a", .type = CONFIG_TYPE_BIND, .uintValue = configKeyA},
{.name = "key_b", .type = CONFIG_TYPE_BIND, .uintValue = configKeyB},
diff --git a/src/pc/configfile.h b/src/pc/configfile.h
index 3748e0b94..5fad17db6 100644
--- a/src/pc/configfile.h
+++ b/src/pc/configfile.h
@@ -71,6 +71,7 @@ extern unsigned int configSfxVolume;
extern unsigned int configEnvVolume;
extern bool configFadeoutDistantSounds;
extern bool configMuteFocusLoss;
+extern unsigned int configSoundOutput;
// control binds
extern unsigned int configKeyA[MAX_BINDS];
extern unsigned int configKeyB[MAX_BINDS];
diff --git a/src/pc/controller/controller_mouse.c b/src/pc/controller/controller_mouse.c
index 742fe4050..44a7a4c4f 100644
--- a/src/pc/controller/controller_mouse.c
+++ b/src/pc/controller/controller_mouse.c
@@ -75,9 +75,19 @@ void controller_mouse_read_window(void) {
GetFocus() == game_window);
POINT p;
- if (GetCursorPos(&p) && ScreenToClient(game_window, &p)) {
- mouse_window_x = p.x - gfx_current_dimensions.x_adjust_4by3;
- mouse_window_y = p.y;
+ if (GetCursorPos(&p)) {
+ HWND hwnd_under = WindowFromPoint(p);
+ if (hwnd_under == game_window || IsChild(game_window, hwnd_under)) {
+ if (ScreenToClient(game_window, &p)) {
+ mouse_window_x = p.x - gfx_current_dimensions.x_adjust_4by3;
+ mouse_window_y = p.y;
+ }
+ } else {
+ // invalidate the mouse position
+ // so the ui isn't interacted with
+ mouse_window_x = -1000;
+ mouse_window_y = -1000;
+ }
}
} else {
mouse_window_buttons = SDL_GetMouseState(&mouse_window_x, &mouse_window_y);
diff --git a/src/pc/djui/djui.c b/src/pc/djui/djui.c
index 43218a151..400c50f93 100644
--- a/src/pc/djui/djui.c
+++ b/src/pc/djui/djui.c
@@ -5,6 +5,7 @@
#include "djui_panel_pause.h"
#include "djui_panel_join.h"
#include "djui_panel_join_message.h"
+#include "djui_panel_confirm.h"
#include "djui_ctx_display.h"
#include "djui_fps_display.h"
#include "djui_lua_profiler.h"
@@ -152,6 +153,17 @@ void djui_connect_menu_open(void) {
djui_panel_join_message_create(NULL);
}
+static void djui_update_game(UNUSED struct DjuiBase *caller) {
+ update_game();
+}
+
+void djui_open_update_panel(void) {
+ djui_panel_shutdown();
+ gDjuiInMainMenu = true;
+ djui_panel_main_create(NULL);
+ djui_panel_confirm_create(NULL, DLANG(UPDATE, UPDATE_TITLE), DLANG(UPDATE, UPDATE_AVAILABLE), djui_update_game);
+}
+
void djui_lua_error(char* text, struct DjuiColor color) {
if (!sDjuiLuaError) { return; }
djui_base_set_color(&sDjuiLuaError->base, color.r, color.g, color.b, color.a);
diff --git a/src/pc/djui/djui.h b/src/pc/djui/djui.h
index da793bb23..6f63658f4 100644
--- a/src/pc/djui/djui.h
+++ b/src/pc/djui/djui.h
@@ -28,6 +28,7 @@
#include "djui_progress_bar.h"
#include "djui_checkbox.h"
#include "djui_flow_layout.h"
+#include "djui_searchbox.h"
#include "djui_selectionbox.h"
#include "djui_bind.h"
#include "djui_popup.h"
@@ -46,6 +47,7 @@ extern bool gDjuiDisabled;
void djui_init(void);
void djui_init_late(void);
void djui_connect_menu_open(void);
+void djui_open_update_panel(void);
void djui_lua_error(char* text, struct DjuiColor color);
void djui_lua_error_clear(void);
void djui_render(void);
diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c
index bddb52f6d..5633c892e 100644
--- a/src/pc/djui/djui_chat_box.c
+++ b/src/pc/djui/djui_chat_box.c
@@ -417,7 +417,7 @@ static bool djui_chat_box_input_on_key_down(UNUSED struct DjuiBase* base, int sc
sent_history_init(&sentHistory);
if (gDjuiChatBox == NULL) { return false; }
-
+
f32 pageAmount = gDjuiChatBox->chatContainer->base.elem.height * 3.0f / 4.0f;
char previousText[MAX_CHAT_MSG_LENGTH];
@@ -547,7 +547,7 @@ struct DjuiChatBox* djui_chat_box_create(void) {
struct DjuiBase* cfBase = &chatFlow->base;
djui_base_set_location(cfBase, 0, 0);
djui_base_set_size_type(cfBase, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
- djui_base_set_size(cfBase, 1.0f, 2);
+ djui_base_set_size(cfBase, 1.0f, 0);
djui_base_set_color(cfBase, 0, 0, 0, 128);
djui_base_set_padding(cfBase, 2, 2, 2, 2);
djui_flow_layout_set_margin(chatFlow, 2);
diff --git a/src/pc/djui/djui_chat_message.c b/src/pc/djui/djui_chat_message.c
index dd299af34..dfac3fcf5 100644
--- a/src/pc/djui/djui_chat_message.c
+++ b/src/pc/djui/djui_chat_message.c
@@ -96,6 +96,9 @@ void djui_chat_message_create(const char* message) {
chatText->base.comp.width = maxTextWidth;
f32 messageHeight = djui_text_count_lines(chatText, 10) * (chatText->font->lineHeight * chatText->font->defaultFontScale) + 8;
djui_base_set_size(base, 1.0f, messageHeight);
+ if (gDjuiChatBox->chatFlow->base.height.value == 0) {
+ gDjuiChatBox->chatFlow->base.height.value = 2;
+ }
gDjuiChatBox->chatFlow->base.height.value += messageHeight + gDjuiChatBox->chatFlow->margin.value;
if (!gDjuiChatBox->scrolling) {
gDjuiChatBox->chatFlow->base.y.value = gDjuiChatBox->chatContainer->base.elem.height - gDjuiChatBox->chatFlow->base.height.value;
diff --git a/src/pc/djui/djui_inputbox.c b/src/pc/djui/djui_inputbox.c
index d9e0ca396..d5c4bde44 100644
--- a/src/pc/djui/djui_inputbox.c
+++ b/src/pc/djui/djui_inputbox.c
@@ -20,15 +20,27 @@ static u8 sCursorBlink = 0;
static void djui_inputbox_update_style(struct DjuiBase* base) {
struct DjuiInputbox* inputbox = (struct DjuiInputbox*)base;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
if (!inputbox->base.enabled) {
- djui_base_set_border_color(base, 90, 90, 90, 255);
- djui_base_set_color(&inputbox->base, 140, 140, 140, 255);
+ struct DjuiColor bc = djui_theme_shade_color(theme->interactables.defaultBorderColor, 0.6f);
+ struct DjuiColor rc = djui_theme_shade_color(theme->interactables.defaultRectColor, 0.6f);
+ djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
+ djui_base_set_color(&inputbox->base, rc.r, rc.g, rc.b, rc.a);
+ } else if (gDjuiCursorDownOn == base) {
+ struct DjuiColor bc = theme->interactables.cursorDownBorderColor;
+ struct DjuiColor rc = theme->interactables.cursorDownRectColor;
+ djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
+ djui_base_set_color(&inputbox->base, rc.r, rc.g, rc.b, rc.a);
} else if (gDjuiHovered == base) {
- djui_base_set_border_color(base, 0, 120, 215, 255);
- djui_base_set_color(&inputbox->base, 255, 255, 255, 255);
+ struct DjuiColor bc = theme->interactables.hoveredBorderColor;
+ struct DjuiColor rc = theme->interactables.hoveredRectColor;
+ djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
+ djui_base_set_color(&inputbox->base, rc.r, rc.g, rc.b, rc.a);
} else {
- djui_base_set_border_color(base, 150, 150, 150, 255);
- djui_base_set_color(&inputbox->base, 240, 240, 240, 255);
+ struct DjuiColor bc = theme->interactables.defaultBorderColor;
+ struct DjuiColor rc = theme->interactables.defaultRectColor;
+ djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
+ djui_base_set_color(&inputbox->base, rc.r, rc.g, rc.b, rc.a);
}
}
@@ -397,7 +409,7 @@ void djui_inputbox_on_text_input(struct DjuiBase *base, char* text) {
inputbox->selection[1] = inputbox->selection[0];
sCursorBlink = 0;
djui_inputbox_on_change(inputbox);
-
+
inputbox->imePos = 0;
if (inputbox->imeBuffer != NULL) {
free(inputbox->imeBuffer);
@@ -408,9 +420,9 @@ void djui_inputbox_on_text_input(struct DjuiBase *base, char* text) {
void djui_inputbox_on_text_editing(struct DjuiBase *base, char* text, int cursorPos) {
struct DjuiInputbox *inputbox = (struct DjuiInputbox *) base;
inputbox->imePos = (u16)cursorPos;
-
+
if (inputbox->imeBuffer != NULL) free(inputbox->imeBuffer);
-
+
if (*text == '\0') {
inputbox->imeBuffer = NULL;
}
@@ -420,7 +432,7 @@ void djui_inputbox_on_text_editing(struct DjuiBase *base, char* text, int cursor
strcpy(copy,text);
inputbox->imeBuffer = copy;
}
-
+
djui_inputbox_on_change(inputbox);
}
@@ -469,9 +481,9 @@ static void djui_inputbox_render_selection(struct DjuiInputbox* inputbox) {
}
sCursorBlink = (sCursorBlink + 1) % DJUI_INPUTBOX_MAX_BLINK;
-
+
f32 renderX = x;
-
+
u16 imePos = inputbox->imePos;
if (imePos != 0) {
char* ime = inputbox->imeBuffer;
@@ -480,13 +492,14 @@ static void djui_inputbox_render_selection(struct DjuiInputbox* inputbox) {
ime = djui_unicode_next_char(ime);
}
}
-
+
// render only cursor when there is no selection width
if (selection[0] == selection[1]) {
if (sCursorBlink < DJUI_INPUTBOX_MID_BLINK && djui_interactable_is_input_focus(&inputbox->base)) {
create_dl_translation_matrix(DJUI_MTX_PUSH, renderX - DJUI_INPUTBOX_CURSOR_WIDTH / 2.0f, -0.1f, 0);
create_dl_scale_matrix(DJUI_MTX_NOPUSH, DJUI_INPUTBOX_CURSOR_WIDTH, 0.8f, 1.0f);
- gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255);
+ struct DjuiColor *textColor = &inputbox->textColor;
+ gDPSetEnvColor(gDisplayListHead++, textColor->r, textColor->g, textColor->b, textColor->a);
gSPDisplayList(gDisplayListHead++, dl_djui_simple_rect);
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
}
@@ -559,7 +572,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
// translate position
f32 translatedX = comp->x + inputbox->viewX;
- f32 translatedY = comp->y + DJUI_INPUTBOX_YOFF;
+ f32 translatedY = comp->y + inputbox->yOffset;
djui_gfx_position_translate(&translatedX, &translatedY);
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, 0);
@@ -584,7 +597,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
u16 selection[2] = { 0 };
selection[0] = fmin(inputbox->selection[0], inputbox->selection[1]);
selection[1] = fmax(inputbox->selection[0], inputbox->selection[1]);
-
+
// render text
char* c = inputbox->buffer;
f32 drawX = inputbox->viewX;
@@ -593,7 +606,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
font->render_begin();
for (u16 i = 0; i < inputbox->bufferSize; i++) {
-
+
//render composition text
if (selection[0] == i && inputbox->imeBuffer != NULL) {
char *ime = inputbox->imeBuffer;
@@ -602,7 +615,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
ime = djui_unicode_next_char(ime);
}
}
-
+
if (*c == '\0') { break; }
// deal with seleciton color
@@ -636,14 +649,16 @@ static void djui_inputbox_destroy(struct DjuiBase* base) {
struct DjuiInputbox* djui_inputbox_create(struct DjuiBase* parent, u16 bufferSize) {
struct DjuiInputbox* inputbox = calloc(1, sizeof(struct DjuiInputbox));
struct DjuiBase* base = &inputbox->base;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor* textColor = &theme->interactables.textColor;
inputbox->bufferSize = bufferSize;
inputbox->buffer = calloc(bufferSize, sizeof(char));
+ inputbox->yOffset = DJUI_INPUTBOX_YOFF;
djui_base_init(parent, base, djui_inputbox_render, djui_inputbox_destroy);
djui_base_set_size(base, 200, 32);
djui_base_set_border_width(base, 2);
- djui_base_set_gradient(base, false);
- djui_inputbox_set_text_color(inputbox, 0, 0, 0, 255);
+ djui_inputbox_set_text_color(inputbox, textColor->r, textColor->g, textColor->b, textColor->a);
djui_interactable_create(base, djui_inputbox_update_style);
djui_interactable_hook_cursor_down(base, djui_inputbox_on_cursor_down_begin, djui_inputbox_on_cursor_down, NULL);
djui_interactable_hook_key(base, djui_inputbox_on_key_down, djui_inputbox_on_key_up);
diff --git a/src/pc/djui/djui_inputbox.h b/src/pc/djui/djui_inputbox.h
index 7cc1f70d8..dcec5f6df 100644
--- a/src/pc/djui/djui_inputbox.h
+++ b/src/pc/djui/djui_inputbox.h
@@ -8,6 +8,7 @@ struct DjuiInputbox {
u16 bufferSize;
u16 selection[2];
f32 viewX;
+ f32 yOffset;
struct DjuiColor textColor;
void (*on_enter_press)(struct DjuiInputbox*);
void (*on_escape_press)(struct DjuiInputbox*);
diff --git a/src/pc/djui/djui_panel_display.c b/src/pc/djui/djui_panel_display.c
index fccf76752..5b58775da 100644
--- a/src/pc/djui/djui_panel_display.c
+++ b/src/pc/djui/djui_panel_display.c
@@ -26,9 +26,11 @@ static void djui_panel_display_framerate_mode_change(UNUSED struct DjuiBase* cal
static void djui_panel_display_frame_limit_text_change(struct DjuiBase* caller) {
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor* textColor = &theme->interactables.textColor;
s32 frameLimit = atoi(inputbox1->buffer);
if (frameLimit >= 30 && frameLimit <= 3000) {
- djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
+ djui_inputbox_set_text_color(inputbox1, textColor->r, textColor->g, textColor->b, textColor->a);
configFrameLimit = frameLimit;
} else {
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
@@ -129,8 +131,16 @@ void djui_panel_display_create(struct DjuiBase* caller) {
djui_selectionbox_create(body, DLANG(DISPLAY, ANTIALIASING), msaaChoices, choiceCount, &sMsaaSelection, djui_panel_display_msaa_change);
}
- char* drawDistanceChoices[6] = { DLANG(DISPLAY, D0P5X), DLANG(DISPLAY, D1X), DLANG(DISPLAY, D1P5X), DLANG(DISPLAY, D3X), DLANG(DISPLAY, D10X), DLANG(DISPLAY, D100X) };
- djui_selectionbox_create(body, DLANG(DISPLAY, DRAW_DISTANCE), drawDistanceChoices, 6, &configDrawDistance, NULL);
+ char* drawDistanceChoices[] = {
+ DLANG(DISPLAY, D0P5X),
+ DLANG(DISPLAY, D1X),
+ DLANG(DISPLAY, D1P5X),
+ DLANG(DISPLAY, D3X),
+ DLANG(DISPLAY, D10X),
+ DLANG(DISPLAY, D100X),
+ DLANG(DISPLAY, INFINITE),
+ };
+ djui_selectionbox_create(body, DLANG(DISPLAY, DRAW_DISTANCE), drawDistanceChoices, ARRAY_COUNT(drawDistanceChoices), &configDrawDistance, NULL);
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
diff --git a/src/pc/djui/djui_panel_dynos.c b/src/pc/djui/djui_panel_dynos.c
index a75f75bfa..7288af283 100644
--- a/src/pc/djui/djui_panel_dynos.c
+++ b/src/pc/djui/djui_panel_dynos.c
@@ -10,6 +10,10 @@
#include "game/level_update.h"
#include "pc/lua/smlua_hooks.h"
+static struct DjuiFlowLayout* sDynosLayout = NULL;
+static struct DjuiPaginated* sDynosPaginated = NULL;
+static struct DjuiInputbox* sSearchInputbox = NULL;
+
void djui_panel_dynos_create(struct DjuiBase* caller);
static void djui_panel_dynos_apply(struct DjuiBase* caller) {
@@ -37,27 +41,47 @@ static void djui_panel_dynos_destroy(UNUSED struct DjuiBase* caller) {
gDjuiInPlayerMenu = false;
}
+static void djui_panel_dynos_add_packs(struct DjuiBase* base) {
+ int packCount = dynos_pack_get_count();
+ for (int i = 0; i < packCount; i++) {
+ if (!dynos_pack_get_exists(i)) { continue; }
+ bool tmp = dynos_pack_get_enabled(i);
+ const char* pack = dynos_pack_get_name(i);
+ // filter results
+ if (sSearchInputbox != NULL &&
+ sSearchInputbox->buffer != NULL &&
+ !strcasestr(djui_text_get_uncolored_string(NULL, strlen(pack) + 1, pack), sSearchInputbox->buffer)
+ ) {
+ continue;
+ }
+
+ struct DjuiCheckbox* checkbox1 = djui_checkbox_create(base, pack, &tmp, djui_panel_dynos_apply);
+ checkbox1->base.tag = i;
+ checkbox1->base.bTag = tmp;
+ checkbox1->value = &checkbox1->base.bTag;
+ }
+}
+
+static void djui_panel_dynos_rebuild_list(UNUSED struct DjuiBase* caller) {
+ djui_base_destroy_children(&sDynosLayout->base);
+ djui_panel_dynos_add_packs(&sDynosLayout->base);
+ djui_paginated_calculate_height(sDynosPaginated);
+}
+
void djui_panel_dynos_create(struct DjuiBase* caller) {
gDjuiInPlayerMenu = true;
- int packCount = dynos_pack_get_count();
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(DYNOS, DYNOS), true);
struct DjuiBase* body = djui_three_panel_get_body(panel);
-
{
+ struct DjuiSearchbox* searchbox = djui_searchbox_create(body, djui_panel_dynos_rebuild_list);
+ sSearchInputbox = searchbox->inputbox;
+
struct DjuiPaginated* paginated = djui_paginated_create(body, 8);
struct DjuiBase* layoutBase = &paginated->layout->base;
- for (int i = 0; i < packCount; i++) {
- if (dynos_pack_get_exists(i)) {
- bool tmp = dynos_pack_get_enabled(i);
- const char* pack = dynos_pack_get_name(i);
-
- struct DjuiCheckbox* checkbox1 = djui_checkbox_create(layoutBase, pack, &tmp, djui_panel_dynos_apply);
- checkbox1->base.tag = i;
- checkbox1->base.bTag = tmp;
- checkbox1->value = &checkbox1->base.bTag;
- }
- }
+ sDynosLayout = paginated->layout;
+ djui_panel_dynos_add_packs(layoutBase);
djui_paginated_calculate_height(paginated);
+ sDynosPaginated = paginated;
struct DjuiRect* space = djui_rect_create(body);
djui_base_set_size_type(&space->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE);
diff --git a/src/pc/djui/djui_panel_host.c b/src/pc/djui/djui_panel_host.c
index c0ac112e9..ea679519e 100644
--- a/src/pc/djui/djui_panel_host.c
+++ b/src/pc/djui/djui_panel_host.c
@@ -45,8 +45,10 @@ static bool djui_panel_host_port_valid(void) {
static void djui_panel_host_port_text_change(struct DjuiBase* caller) {
struct DjuiInputbox* sInputboxPort = (struct DjuiInputbox*)caller;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor* textColor = &theme->interactables.textColor;
if (djui_panel_host_port_valid()) {
- djui_inputbox_set_text_color(sInputboxPort, 0, 0, 0, 255);
+ djui_inputbox_set_text_color(sInputboxPort, textColor->r, textColor->g, textColor->b, textColor->a);
} else {
djui_inputbox_set_text_color(sInputboxPort, 255, 0, 0, 255);
}
diff --git a/src/pc/djui/djui_panel_host_mods.c b/src/pc/djui/djui_panel_host_mods.c
index e102edaed..a008d6e36 100644
--- a/src/pc/djui/djui_panel_host_mods.c
+++ b/src/pc/djui/djui_panel_host_mods.c
@@ -25,6 +25,7 @@ static struct DjuiText* sTooltip = NULL;
static struct DjuiPaginated* sModPaginated = NULL;
static struct DjuiButton* sBackButton = NULL;
static struct DjuiButton* sRefreshButton = NULL;
+static struct DjuiInputbox* sSearchInputbox = NULL;
static unsigned int sSelectedCategory = MOD_CATEGORY_ALL;
static bool sWarned = false;
@@ -174,6 +175,13 @@ void djui_panel_host_mods_add_mods(struct DjuiBase* layoutBase) {
break;
}
}
+ // filter results
+ if (sSearchInputbox != NULL &&
+ sSearchInputbox->buffer != NULL &&
+ !strcasestr(djui_text_get_uncolored_string(NULL, strlen(mod->name) + 1, mod->name), sSearchInputbox->buffer)
+ ) {
+ continue;
+ }
struct DjuiCheckbox* checkbox = djui_checkbox_create(layoutBase, mod->name, &mod->enabled, djui_mod_checkbox_on_value_change);
checkbox->base.tag = i;
djui_base_set_enabled(&checkbox->base, mod->selectable);
@@ -189,7 +197,7 @@ void djui_panel_host_mods_add_mods(struct DjuiBase* layoutBase) {
}
}
-static void djui_panel_on_categories_change(UNUSED struct DjuiBase* caller) {
+static void djui_panel_rebuild_mods_list(UNUSED struct DjuiBase* caller) {
if (gModRefreshThread.state == RUNNING) { return; }
djui_base_destroy_children(&sModLayout->base);
djui_panel_host_mods_add_mods(&sModLayout->base);
@@ -234,14 +242,15 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
struct DjuiBase* body = djui_three_panel_get_body(panel);
{
- // copy category choices from sCategories
- char* categoryChoices[sizeof(sCategories)];
+ struct DjuiSearchbox* searchbox = djui_searchbox_create(body, djui_panel_rebuild_mods_list);
+ sSearchInputbox = searchbox->inputbox;
- // loop thru all categories names, and add those to the categoryChoices string array
+ char* categoryChoices[sizeof(sCategories)];
for (int i = 0; i < numCategories; i++) {
categoryChoices[i] = djui_language_get("HOST_MOD_CATEGORIES", sCategories[i].langKey);
}
- djui_selectionbox_create(body, DLANG(HOST_MODS, CATEGORIES), categoryChoices, numCategories, &sSelectedCategory, djui_panel_on_categories_change);
+ djui_selectionbox_create(body, DLANG(HOST_MODS, CATEGORIES), categoryChoices, numCategories, &sSelectedCategory, djui_panel_rebuild_mods_list);
+
struct DjuiPaginated* paginated = djui_paginated_create(body, 8);
paginated->showMaxCount = true;
sModLayout = paginated->layout;
@@ -259,7 +268,7 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
}
- panel->bodySize.value = paginated->base.height.value + 64 + 64;
+ panel->bodySize.value = paginated->base.height.value + 64 + 64 + 64;
}
panel->base.destroy = djui_panel_host_mods_destroy;
diff --git a/src/pc/djui/djui_panel_host_settings.c b/src/pc/djui/djui_panel_host_settings.c
index eceba91c0..14875a949 100644
--- a/src/pc/djui/djui_panel_host_settings.c
+++ b/src/pc/djui/djui_panel_host_settings.c
@@ -34,8 +34,10 @@ static bool djui_panel_host_limit_valid(void) {
static void djui_panel_host_player_text_change(struct DjuiBase* caller) {
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor* textColor = &theme->interactables.textColor;
if (djui_panel_host_limit_valid()) {
- djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
+ djui_inputbox_set_text_color(inputbox1, textColor->r, textColor->g, textColor->b, textColor->a);
} else {
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
return;
diff --git a/src/pc/djui/djui_panel_join_direct.c b/src/pc/djui/djui_panel_join_direct.c
index 8a29515c1..f26fe8ff5 100644
--- a/src/pc/djui/djui_panel_join_direct.c
+++ b/src/pc/djui/djui_panel_join_direct.c
@@ -86,8 +86,10 @@ UNUSED static bool djui_panel_join_direct_ip_valid(char* buffer) {
static void djui_panel_join_direct_ip_text_change(struct DjuiBase* caller) {
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor* textColor = &theme->interactables.textColor;
if (strlen(inputbox1->buffer) > 2) {
- djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
+ djui_inputbox_set_text_color(inputbox1, textColor->r, textColor->g, textColor->b, textColor->a);
} else {
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
}
diff --git a/src/pc/djui/djui_panel_player.c b/src/pc/djui/djui_panel_player.c
index 70a63e09a..d0e91a69c 100644
--- a/src/pc/djui/djui_panel_player.c
+++ b/src/pc/djui/djui_panel_player.c
@@ -160,8 +160,10 @@ static char* djui_panel_player_edit_palette_preset_name_get_text(void) {
static void djui_panel_player_edit_palette_preset_name_text_change(struct DjuiBase* caller) {
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor* textColor = &theme->interactables.textColor;
if (djui_panel_player_edit_palette_preset_name_valid(inputbox1->buffer)) {
- djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
+ djui_inputbox_set_text_color(inputbox1, textColor->r, textColor->g, textColor->b, textColor->a);
} else {
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
}
@@ -169,10 +171,12 @@ static void djui_panel_player_edit_palette_preset_name_text_change(struct DjuiBa
static void djui_panel_player_edit_palette_preset_name_on_focus_end(struct DjuiBase* caller) {
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor* textColor = &theme->interactables.textColor;
if (!djui_panel_player_edit_palette_preset_name_valid(inputbox1->buffer)) {
djui_inputbox_set_text(inputbox1, djui_panel_player_edit_palette_preset_name_get_text());
}
- djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
+ djui_inputbox_set_text_color(inputbox1, textColor->r, textColor->g, textColor->b, textColor->a);
djui_inputbox_on_focus_end(&inputbox1->base);
}
@@ -403,8 +407,10 @@ static char *djui_panel_player_name_default_get(void) {
static void djui_panel_player_name_text_change(struct DjuiBase* caller) {
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor* textColor = &theme->interactables.textColor;
if (network_player_name_valid(inputbox1->buffer)) {
- djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
+ djui_inputbox_set_text_color(inputbox1, textColor->r, textColor->g, textColor->b, textColor->a);
} else {
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
}
@@ -412,11 +418,13 @@ static void djui_panel_player_name_text_change(struct DjuiBase* caller) {
static void djui_panel_player_name_on_focus_end(struct DjuiBase* caller) {
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor* textColor = &theme->interactables.textColor;
if (!network_player_name_valid(inputbox1->buffer)) {
djui_inputbox_set_text(inputbox1, djui_panel_player_name_default_get());
}
snprintf(configPlayerName, MAX_CONFIG_STRING, "%s", inputbox1->buffer);
- djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
+ djui_inputbox_set_text_color(inputbox1, textColor->r, textColor->g, textColor->b, textColor->a);
if (gNetworkType != NT_NONE) {
network_send_player_settings();
diff --git a/src/pc/djui/djui_panel_sound.c b/src/pc/djui/djui_panel_sound.c
index f30d08eab..921aaeb96 100644
--- a/src/pc/djui/djui_panel_sound.c
+++ b/src/pc/djui/djui_panel_sound.c
@@ -4,21 +4,31 @@
#include "pc/utils/misc.h"
#include "pc/configfile.h"
#include "pc/lua/utils/smlua_audio_utils.h"
+#include "game/sound_init.h"
static void djui_panel_sound_value_change(UNUSED struct DjuiBase* caller) {
audio_custom_update_volume();
}
+static void djui_panel_sound_output_change(UNUSED struct DjuiBase* caller) {
+ set_sound_mode(configSoundOutput);
+}
+
void djui_panel_sound_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(SOUND, SOUND), false);
struct DjuiBase* body = djui_three_panel_get_body(panel);
{
+ char* outputChoices[3] = { DLANG(SOUND, STEREO), DLANG(SOUND, MONO), DLANG(SOUND, HEADSET) };
+ djui_selectionbox_create(body, DLANG(SOUND, SOUND_OUTPUT), outputChoices, 3, &configSoundOutput, djui_panel_sound_output_change);
+
djui_slider_create(body, DLANG(SOUND, MASTER_VOLUME), &configMasterVolume, 0, 127, djui_panel_sound_value_change);
djui_slider_create(body, DLANG(SOUND, MUSIC_VOLUME), &configMusicVolume, 0, 127, djui_panel_sound_value_change);
djui_slider_create(body, DLANG(SOUND, SFX_VOLUME), &configSfxVolume, 0, 127, djui_panel_sound_value_change);
djui_slider_create(body, DLANG(SOUND, ENV_VOLUME), &configEnvVolume, 0, 127, djui_panel_sound_value_change);
+
djui_checkbox_create(body, DLANG(SOUND, FADEOUT), &configFadeoutDistantSounds, NULL);
djui_checkbox_create(body, DLANG(SOUND, MUTE_FOCUS_LOSS), &configMuteFocusLoss, NULL);
+
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
}
diff --git a/src/pc/djui/djui_searchbox.c b/src/pc/djui/djui_searchbox.c
new file mode 100644
index 000000000..970f57fc6
--- /dev/null
+++ b/src/pc/djui/djui_searchbox.c
@@ -0,0 +1,63 @@
+#include
+#include
+#include "djui.h"
+
+static void djui_searchbox_destroy(struct DjuiBase* base) {
+ struct DjuiSearchbox* searchbox = (struct DjuiSearchbox*)base;
+ free(searchbox);
+}
+
+static void djui_searchbox_on_value_change(struct DjuiBase* base) {
+ struct DjuiInputbox* input = (struct DjuiInputbox*)base;
+ struct DjuiSearchbox* searchbox = (struct DjuiSearchbox*)input->base.parent->parent;
+
+ if (input->buffer[0] != '\0') {
+ djui_base_set_visible(&searchbox->text->base, false);
+ } else {
+ djui_base_set_visible(&searchbox->text->base, true);
+ }
+
+ if (searchbox->on_value_change) {
+ searchbox->on_value_change(base);
+ }
+}
+
+struct DjuiSearchbox* djui_searchbox_create(struct DjuiBase* parent, void (*on_value_change)(struct DjuiBase*)) {
+ struct DjuiSearchbox* searchbox = calloc(1, sizeof(struct DjuiSearchbox));
+ struct DjuiBase* base = &searchbox->base;
+ struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
+ struct DjuiColor disabledTextColor = theme->interactables.disabledTextColor;
+
+ djui_base_init(parent, base, NULL, djui_searchbox_destroy);
+
+ djui_base_set_size_type(base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
+ djui_base_set_size(base, 1.0f, 35.0f);
+
+ struct DjuiFlowLayout* searchFlow = djui_flow_layout_create(base);
+ djui_base_set_color(&searchFlow->base, 0, 0, 0, 0);
+ djui_base_set_size_type(&searchFlow->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
+ djui_base_set_size(&searchFlow->base, 1.0f, 35.0f);
+ djui_flow_layout_set_margin(searchFlow, 0);
+ djui_flow_layout_set_flow_direction(searchFlow, DJUI_FLOW_DIR_RIGHT);
+
+ struct DjuiInputbox* searchInputBox = djui_inputbox_create(&searchFlow->base, 64);
+ djui_base_set_alignment(&searchInputBox->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_CENTER);
+ djui_base_set_size_type(&searchInputBox->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
+ djui_base_set_size(&searchInputBox->base, 1.0f, 35.0f);
+ djui_interactable_hook_value_change(&searchInputBox->base, djui_searchbox_on_value_change);
+ searchInputBox->yOffset = 0;
+ searchbox->inputbox = searchInputBox;
+
+ struct DjuiText* text = djui_text_create(&searchInputBox->base, DLANG(MENU, SEARCH));
+ djui_base_set_color(&text->base, disabledTextColor.r, disabledTextColor.g, disabledTextColor.b, disabledTextColor.a);
+ djui_base_set_alignment(&text->base, DJUI_HALIGN_LEFT, DJUI_VALIGN_CENTER);
+ djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_RELATIVE);
+ djui_base_set_size(&text->base, 1.0f, 1.0f);
+ djui_text_set_alignment(text, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM);
+ djui_text_set_drop_shadow(text, 64, 64, 64, 100);
+ searchbox->text = text;
+
+ searchbox->on_value_change = on_value_change;
+
+ return searchbox;
+}
\ No newline at end of file
diff --git a/src/pc/djui/djui_searchbox.h b/src/pc/djui/djui_searchbox.h
new file mode 100644
index 000000000..d1eebb521
--- /dev/null
+++ b/src/pc/djui/djui_searchbox.h
@@ -0,0 +1,12 @@
+#pragma once
+#include "djui.h"
+
+struct DjuiSearchbox {
+ struct DjuiBase base;
+ struct DjuiText* text;
+ struct DjuiImage* image;
+ struct DjuiInputbox* inputbox;
+ void (*on_value_change)(struct DjuiBase*);
+};
+
+struct DjuiSearchbox* djui_searchbox_create(struct DjuiBase* base, void (*on_value_change)(struct DjuiBase*));
\ No newline at end of file
diff --git a/src/pc/djui/djui_theme.c b/src/pc/djui/djui_theme.c
index c21635f35..9438c1e91 100644
--- a/src/pc/djui/djui_theme.c
+++ b/src/pc/djui/djui_theme.c
@@ -7,6 +7,9 @@ static struct DjuiTheme sDjuiThemeLight = {
.textColor = {
11, 11, 11, 255
},
+ .disabledTextColor = {
+ 60, 60, 60, 255
+ },
.defaultRectColor = {
222, 222, 222, 255
@@ -48,6 +51,9 @@ static struct DjuiTheme sDjuiThemeDark = {
.textColor = {
220, 220, 220, 255
},
+ .disabledTextColor = {
+ 140, 140, 140, 255
+ },
.defaultRectColor = {
22, 22, 22, 255
@@ -89,6 +95,9 @@ static struct DjuiTheme sDjuiThemeFileSelect = {
.textColor = {
11, 11, 11, 255
},
+ .disabledTextColor = {
+ 60, 60, 60, 255
+ },
.defaultRectColor = {
200, 215, 197, 255
@@ -130,6 +139,9 @@ static struct DjuiTheme sDjuiThemeMario = {
.textColor = {
11, 11, 11, 255
},
+ .disabledTextColor = {
+ 60, 60, 60, 255
+ },
.defaultRectColor = {
255, 227, 0, 255
@@ -171,6 +183,9 @@ static struct DjuiTheme sDjuiThemeOdyssey = {
.textColor = {
11, 11, 11, 255
},
+ .disabledTextColor = {
+ 60, 60, 60, 255
+ },
.defaultRectColor = {
255, 255, 255, 255
diff --git a/src/pc/djui/djui_theme.h b/src/pc/djui/djui_theme.h
index ecac05d97..50c0f8afd 100644
--- a/src/pc/djui/djui_theme.h
+++ b/src/pc/djui/djui_theme.h
@@ -15,6 +15,7 @@ enum DjuiThemeType {
struct DjuiInteractableTheme {
struct DjuiColor textColor;
+ struct DjuiColor disabledTextColor;
struct DjuiColor defaultRectColor;
struct DjuiColor cursorDownRectColor;
diff --git a/src/pc/gfx/gfx.h b/src/pc/gfx/gfx.h
index 34e735b01..a2c21a70f 100644
--- a/src/pc/gfx/gfx.h
+++ b/src/pc/gfx/gfx.h
@@ -46,6 +46,7 @@ struct GfxVertex {
struct RGBA color;
uint8_t fog_z;
uint8_t clip_rej;
+ uint8_t world_geometry;
};
struct GfxDimensions {
diff --git a/src/pc/gfx/gfx_cc.h b/src/pc/gfx/gfx_cc.h
index 336a237b5..30ebe45cb 100644
--- a/src/pc/gfx/gfx_cc.h
+++ b/src/pc/gfx/gfx_cc.h
@@ -72,12 +72,13 @@ struct CombineMode {
};
union {
struct {
- uint8_t use_alpha : 1;
- uint8_t use_fog : 1;
- uint8_t texture_edge : 1;
- uint8_t use_dither : 1;
- uint8_t use_2cycle : 1;
- uint8_t light_map : 1;
+ uint8_t use_alpha : 1;
+ uint8_t use_fog : 1;
+ uint8_t texture_edge : 1;
+ uint8_t use_dither : 1;
+ uint8_t use_2cycle : 1;
+ uint8_t light_map : 1;
+ uint8_t world_geometry : 1;
};
uint32_t flags;
};
diff --git a/src/pc/gfx/gfx_direct3d11.cpp b/src/pc/gfx/gfx_direct3d11.cpp
index d00b65faa..710c5d04d 100644
--- a/src/pc/gfx/gfx_direct3d11.cpp
+++ b/src/pc/gfx/gfx_direct3d11.cpp
@@ -17,6 +17,9 @@
#endif
#include
+#include "types.h"
+#include "pc/configfile.h"
+
#include "gfx_cc.h"
#include "gfx_window_manager_api.h"
#include "gfx_rendering_api.h"
@@ -24,6 +27,7 @@
extern "C" {
#include "pc/controller/controller_bind_mapping.h"
+ extern Color gVertexColor;
}
#define DECLARE_GFX_DXGI_FUNCTIONS
@@ -31,7 +35,6 @@ extern "C" {
#include "gfx_screen_config.h"
-#define THREE_POINT_FILTERING 0
#define DEBUG_D3D 0
using namespace Microsoft::WRL; // For ComPtr
@@ -52,6 +55,13 @@ struct PerDrawCB {
uint32_t linear_filtering;
uint32_t padding;
} textures[2];
+ uint32_t filter;
+ uint32_t padding[3];
+};
+
+struct LightmapCB {
+ float color[3];
+ float padding;
};
struct TextureData {
@@ -72,6 +82,7 @@ struct ShaderProgramD3D11 {
uint8_t num_inputs;
uint8_t num_floats;
bool used_textures[2];
+ bool used_lightmap;
};
static struct {
@@ -93,6 +104,7 @@ static struct {
ComPtr vertex_buffer;
ComPtr per_frame_cb;
ComPtr per_draw_cb;
+ ComPtr lightmap_cb;
#if DEBUG_D3D
ComPtr debug;
@@ -102,6 +114,7 @@ static struct {
PerFrameCB per_frame_cb_data;
PerDrawCB per_draw_cb_data;
+ LightmapCB lightmap_cb_data;
struct ShaderProgramD3D11 shader_program_pool[CC_MAX_SHADERS];
uint8_t shader_program_pool_size;
@@ -309,6 +322,19 @@ static void gfx_d3d11_init(void) {
d3d.context->PSSetConstantBuffers(1, 1, d3d.per_draw_cb.GetAddressOf());
+ // Create lightmap constant buffer
+
+ constant_buffer_desc.Usage = D3D11_USAGE_DYNAMIC;
+ constant_buffer_desc.ByteWidth = (sizeof(LightmapCB) + 15) / 16 * 16;
+ constant_buffer_desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ constant_buffer_desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ constant_buffer_desc.MiscFlags = 0;
+
+ ThrowIfFailed(d3d.device->CreateBuffer(&constant_buffer_desc, nullptr, d3d.lightmap_cb.GetAddressOf()),
+ gfx_dxgi_get_h_wnd(), "Failed to create lightmap constant buffer.");
+
+ d3d.context->PSSetConstantBuffers(2, 1, d3d.lightmap_cb.GetAddressOf());
+
controller_bind_init();
}
@@ -331,7 +357,7 @@ static struct ShaderProgram *gfx_d3d11_create_and_load_new_shader(struct ColorCo
char buf[4096];
size_t len, num_floats;
- gfx_direct3d_common_build_shader(buf, len, num_floats, *cc, cc_features, false, THREE_POINT_FILTERING);
+ gfx_direct3d_common_build_shader(buf, len, num_floats, *cc, cc_features, false);
ComPtr vs, ps;
ComPtr error_blob;
@@ -414,6 +440,7 @@ static struct ShaderProgram *gfx_d3d11_create_and_load_new_shader(struct ColorCo
prg->num_floats = num_floats;
prg->used_textures[0] = cc_features.used_textures[0];
prg->used_textures[1] = cc_features.used_textures[1];
+ prg->used_lightmap = cc->cm.light_map;
return (struct ShaderProgram *)(d3d.shader_program = prg);
}
@@ -504,11 +531,7 @@ static void gfx_d3d11_set_sampler_parameters(int tile, bool linear_filter, uint3
D3D11_SAMPLER_DESC sampler_desc;
ZeroMemory(&sampler_desc, sizeof(D3D11_SAMPLER_DESC));
-#if THREE_POINT_FILTERING
- sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
-#else
sampler_desc.Filter = linear_filter ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_POINT;
-#endif
sampler_desc.AddressU = gfx_cm_to_d3d11(cms);
sampler_desc.AddressV = gfx_cm_to_d3d11(cmt);
sampler_desc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
@@ -611,28 +634,37 @@ static void gfx_d3d11_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t
for (int32_t i = 0; i < 2; i++) {
if (d3d.shader_program->used_textures[i]) {
- if (d3d.last_resource_views[i].Get() != d3d.textures[d3d.current_texture_ids[i]].resource_view.Get()) {
- d3d.last_resource_views[i] = d3d.textures[d3d.current_texture_ids[i]].resource_view.Get();
- d3d.context->PSSetShaderResources(i, 1, d3d.textures[d3d.current_texture_ids[i]].resource_view.GetAddressOf());
+ TextureData &texture_data = d3d.textures[d3d.current_texture_ids[i]];
+ bool resource_changed = d3d.last_resource_views[i].Get() != texture_data.resource_view.Get();
+ bool sampler_changed = d3d.last_sampler_states[i].Get() != texture_data.sampler_state.Get();
-#if THREE_POINT_FILTERING
- d3d.per_draw_cb_data.textures[i].width = d3d.textures[d3d.current_texture_ids[i]].width;
- d3d.per_draw_cb_data.textures[i].height = d3d.textures[d3d.current_texture_ids[i]].height;
- d3d.per_draw_cb_data.textures[i].linear_filtering = d3d.textures[d3d.current_texture_ids[i]].linear_filtering;
+ if (resource_changed) {
+ d3d.last_resource_views[i] = texture_data.resource_view.Get();
+ d3d.context->PSSetShaderResources(i, 1, texture_data.resource_view.GetAddressOf());
+ }
+
+ if (sampler_changed) {
+ d3d.last_sampler_states[i] = texture_data.sampler_state.Get();
+ d3d.context->PSSetSamplers(i, 1, texture_data.sampler_state.GetAddressOf());
+ }
+
+ if (resource_changed || sampler_changed) {
+ d3d.per_draw_cb_data.textures[i].width = texture_data.width;
+ d3d.per_draw_cb_data.textures[i].height = texture_data.height;
+ d3d.per_draw_cb_data.textures[i].linear_filtering = texture_data.linear_filtering;
textures_changed = true;
-#endif
-
- if (d3d.last_sampler_states[i].Get() != d3d.textures[d3d.current_texture_ids[i]].sampler_state.Get()) {
- d3d.last_sampler_states[i] = d3d.textures[d3d.current_texture_ids[i]].sampler_state.Get();
- d3d.context->PSSetSamplers(i, 1, d3d.textures[d3d.current_texture_ids[i]].sampler_state.GetAddressOf());
- }
}
}
}
// Set per-draw constant buffer
- if (textures_changed) {
+ bool per_draw_cb_dirty = textures_changed;
+ if (d3d.per_draw_cb_data.filter != configFiltering) {
+ d3d.per_draw_cb_data.filter = configFiltering;
+ per_draw_cb_dirty = true;
+ }
+ if (per_draw_cb_dirty) {
D3D11_MAPPED_SUBRESOURCE ms;
ZeroMemory(&ms, sizeof(D3D11_MAPPED_SUBRESOURCE));
d3d.context->Map(d3d.per_draw_cb.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &ms);
@@ -640,6 +672,20 @@ static void gfx_d3d11_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t
d3d.context->Unmap(d3d.per_draw_cb.Get(), 0);
}
+ // Set lightmap constant buffer
+
+ if (d3d.shader_program->used_lightmap) {
+ d3d.lightmap_cb_data.color[0] = gVertexColor[0] / 255.0f;
+ d3d.lightmap_cb_data.color[1] = gVertexColor[1] / 255.0f;
+ d3d.lightmap_cb_data.color[2] = gVertexColor[2] / 255.0f;
+
+ D3D11_MAPPED_SUBRESOURCE ms;
+ ZeroMemory(&ms, sizeof(D3D11_MAPPED_SUBRESOURCE));
+ d3d.context->Map(d3d.lightmap_cb.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &ms);
+ memcpy(ms.pData, &d3d.lightmap_cb_data, sizeof(LightmapCB));
+ d3d.context->Unmap(d3d.lightmap_cb.Get(), 0);
+ }
+
// Set vertex buffer data
D3D11_MAPPED_SUBRESOURCE ms;
diff --git a/src/pc/gfx/gfx_direct3d_common.cpp b/src/pc/gfx/gfx_direct3d_common.cpp
index 636b83ac4..e53e07e72 100644
--- a/src/pc/gfx/gfx_direct3d_common.cpp
+++ b/src/pc/gfx/gfx_direct3d_common.cpp
@@ -122,7 +122,7 @@ static void append_formula(char *buf, size_t *len, const uint8_t* c, bool do_sin
}
}
-void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_floats, struct ColorCombiner& cc, const CCFeatures& ccf, bool include_root_signature, bool three_point_filtering) {
+void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_floats, struct ColorCombiner& cc, const CCFeatures& ccf, bool include_root_signature) {
len = 0;
num_floats = 4;
@@ -194,17 +194,26 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
append_line(buf, &len, "}");
}
+ if (cc.cm.light_map) {
+ append_line(buf, &len, "cbuffer LightmapCB : register(b2) {");
+ append_line(buf, &len, " float3 lightmap_color;");
+ append_line(buf, &len, "}");
+ }
+
// 3 point texture filtering
// Original author: ArthurCarvalho
// Based on GLSL implementation by twinaphex, mupen64plus-libretro project.
- if (three_point_filtering && (ccf.used_textures[0] || ccf.used_textures[1])) {
+ if (ccf.used_textures[0] || ccf.used_textures[1]) {
append_line(buf, &len, "cbuffer PerDrawCB : register(b1) {");
append_line(buf, &len, " struct {");
append_line(buf, &len, " uint width;");
append_line(buf, &len, " uint height;");
append_line(buf, &len, " bool linear_filtering;");
+ append_line(buf, &len, " bool padding;");
append_line(buf, &len, " } textures[2];");
+ append_line(buf, &len, " uint filter;");
+ append_line(buf, &len, " uint padding[3];");
append_line(buf, &len, "}");
append_line(buf, &len, "#define TEX_OFFSET(tex, tSampler, texCoord, off, texSize) tex.Sample(tSampler, texCoord - off / texSize)");
append_line(buf, &len, "float4 tex2D3PointFilter(in Texture2D tex, in SamplerState tSampler, in float2 texCoord, in float2 texSize) {");
@@ -269,38 +278,27 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
}
if (ccf.used_textures[0]) {
- if (three_point_filtering) {
- append_line(buf, &len, " float4 texVal0;");
- append_line(buf, &len, " if (textures[0].linear_filtering)");
- append_line(buf, &len, " texVal0 = tex2D3PointFilter(g_texture0, g_sampler0, input.uv0, float2(textures[0].width, textures[0].height));");
- append_line(buf, &len, " else");
- append_line(buf, &len, " texVal0 = g_texture0.Sample(g_sampler0, input.uv0);");
- } else {
- append_line(buf, &len, " float4 texVal0 = g_texture0.Sample(g_sampler0, input.uv0);");
- }
+ append_line(buf, &len, " float4 texVal0;");
+ append_line(buf, &len, " if (textures[0].linear_filtering && filter == 2)");
+ append_line(buf, &len, " texVal0 = tex2D3PointFilter(g_texture0, g_sampler0, input.uv0, float2(textures[0].width, textures[0].height));");
+ append_line(buf, &len, " else");
+ append_line(buf, &len, " texVal0 = g_texture0.Sample(g_sampler0, input.uv0);");
}
if (ccf.used_textures[1]) {
if (cc.cm.light_map) {
- if (three_point_filtering) {
- append_line(buf, &len, " float4 texVal1;");
- append_line(buf, &len, " if (textures[1].linear_filtering)");
- append_line(buf, &len, " texVal1 = tex2D3PointFilter(g_texture1, g_sampler1, input.lightmap, float2(textures[1].width, textures[1].height));");
- append_line(buf, &len, " else");
- append_line(buf, &len, " texVal1 = g_texture1.Sample(g_sampler1, input.lightmap);");
- } else {
- append_line(buf, &len, " float4 texVal1 = g_texture1.Sample(g_sampler1, input.lightmap);");
- }
+ append_line(buf, &len, " float4 texVal1;");
+ append_line(buf, &len, " if (textures[1].linear_filtering && filter == 2)");
+ append_line(buf, &len, " texVal1 = tex2D3PointFilter(g_texture1, g_sampler1, input.lightmap, float2(textures[1].width, textures[1].height));");
+ append_line(buf, &len, " else");
+ append_line(buf, &len, " texVal1 = g_texture1.Sample(g_sampler1, input.lightmap);");
append_line(buf, &len, " texVal1.rgb = texVal1.rgb * texVal1.rgb + texVal1.rgb;");
+ append_line(buf, &len, " texVal0.rgb *= lightmap_color;");
} else {
- if (three_point_filtering) {
- append_line(buf, &len, " float4 texVal1;");
- append_line(buf, &len, " if (textures[1].linear_filtering)");
- append_line(buf, &len, " texVal1 = tex2D3PointFilter(g_texture1, g_sampler1, input.uv1, float2(textures[1].width, textures[1].height));");
- append_line(buf, &len, " else");
- append_line(buf, &len, " texVal1 = g_texture1.Sample(g_sampler1, input.uv1);");
- } else {
- append_line(buf, &len, " float4 texVal1 = g_texture1.Sample(g_sampler1, input.uv1);");
- }
+ append_line(buf, &len, " float4 texVal1;");
+ append_line(buf, &len, " if (textures[1].linear_filtering && filter == 2)");
+ append_line(buf, &len, " texVal1 = tex2D3PointFilter(g_texture1, g_sampler1, input.uv1, float2(textures[1].width, textures[1].height));");
+ append_line(buf, &len, " else");
+ append_line(buf, &len, " texVal1 = g_texture1.Sample(g_sampler1, input.uv1);");
}
}
diff --git a/src/pc/gfx/gfx_direct3d_common.h b/src/pc/gfx/gfx_direct3d_common.h
index 795bc5722..29ca329c7 100644
--- a/src/pc/gfx/gfx_direct3d_common.h
+++ b/src/pc/gfx/gfx_direct3d_common.h
@@ -7,7 +7,7 @@
#include "gfx_cc.h"
-void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_floats, struct ColorCombiner& cc, const CCFeatures& cc_features, bool include_root_signature, bool three_point_filtering);
+void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_floats, struct ColorCombiner& cc, const CCFeatures& cc_features, bool include_root_signature);
#endif
diff --git a/src/pc/gfx/gfx_dxgi.cpp b/src/pc/gfx/gfx_dxgi.cpp
index 7c35f68d9..cc5558783 100644
--- a/src/pc/gfx/gfx_dxgi.cpp
+++ b/src/pc/gfx/gfx_dxgi.cpp
@@ -394,12 +394,13 @@ static void gfx_dxgi_init(const char *window_title) {
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = nullptr;
- wcex.hIcon = nullptr;
+ HINSTANCE hInstance = GetModuleHandle(NULL);
+ wcex.hIcon = LoadIconW(hInstance, L"id");
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = nullptr;
wcex.lpszClassName = WINCLASS_NAME;
- wcex.hIconSm = nullptr;
+ wcex.hIconSm = (HICON)LoadImageW(hInstance, L"id", IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ATOM winclass = RegisterClassExW(&wcex);
@@ -411,6 +412,14 @@ static void gfx_dxgi_init(const char *window_title) {
dxgi.h_wnd = CreateWindowW(WINCLASS_NAME, w_title, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, wr.right - wr.left, wr.bottom - wr.top, nullptr, nullptr, nullptr, nullptr);
+
+ // Set the window icons
+ if (wcex.hIcon) {
+ SendMessage(dxgi.h_wnd, WM_SETICON, ICON_BIG, (LPARAM)wcex.hIcon);
+ }
+ if (wcex.hIconSm) {
+ SendMessage(dxgi.h_wnd, WM_SETICON, ICON_SMALL, (LPARAM)wcex.hIconSm);
+ }
});
load_dxgi_library();
diff --git a/src/pc/gfx/gfx_opengl.c b/src/pc/gfx/gfx_opengl.c
index 8544dedd8..51f052cdf 100644
--- a/src/pc/gfx/gfx_opengl.c
+++ b/src/pc/gfx/gfx_opengl.c
@@ -41,11 +41,12 @@ struct ShaderProgram {
bool used_textures[2];
uint8_t num_floats;
GLint attrib_locations[7];
- GLint uniform_locations[7];
+ GLint uniform_locations[9];
uint8_t attrib_sizes[7];
uint8_t num_attribs;
bool used_noise;
bool used_lightmap;
+ bool world_geometry;
};
struct GLTexture {
@@ -88,7 +89,12 @@ static void gfx_opengl_vertex_array_set_attribs(struct ShaderProgram *prg) {
static inline void gfx_opengl_set_shader_uniforms(struct ShaderProgram *prg) {
if (prg->used_noise) { glUniform1f(prg->uniform_locations[4], (float)frame_count); }
if (prg->used_lightmap) { glUniform3f(prg->uniform_locations[5], gVertexColor[0] / 255.0f, gVertexColor[1] / 255.0f, gVertexColor[2] / 255.0f); }
- glUniform1i(prg->uniform_locations[6], configFiltering);
+ if (prg->world_geometry) {
+ glUniform1iv(prg->uniform_locations[6], SHADER_FLAG_MAX, gShaderFlags);
+ glUniform1fv(prg->uniform_locations[7], SHADER_FLAG_MAX, gShaderFlagValues);
+ }
+
+ glUniform1i(prg->uniform_locations[8], configFiltering);
}
static inline void gfx_opengl_set_texture_uniforms(struct ShaderProgram *prg, const int tile) {
@@ -245,6 +251,7 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
bool opt_texture_edge = cc->cm.texture_edge;
bool opt_2cycle = cc->cm.use_2cycle;
bool opt_light_map = cc->cm.light_map;
+ bool world_geometry = cc->cm.world_geometry;
#ifdef USE_GLES
bool opt_dither = false;
@@ -252,8 +259,8 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
bool opt_dither = cc->cm.use_dither;
#endif
- char vs_buf[1024];
- char fs_buf[2048];
+ char vs_buf[8192];
+ char fs_buf[8192];
size_t vs_len = 0;
size_t fs_len = 0;
size_t num_floats = 4;
@@ -357,6 +364,56 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
append_line(fs_buf, &fs_len, "}");
}
+ if (world_geometry) {
+ append_line(fs_buf, &fs_len, "float dither4x4(vec2 position, float brightness) {");
+ append_line(fs_buf, &fs_len, " int x = int(mod(position.x, 4.0));");
+ append_line(fs_buf, &fs_len, " int y = int(mod(position.y, 4.0));");
+ append_line(fs_buf, &fs_len, " int index = x + y * 4;");
+ append_line(fs_buf, &fs_len, " float limit = 0.0;");
+ append_line(fs_buf, &fs_len, " if (x < 8) {");
+ append_line(fs_buf, &fs_len, " if (index == 0) limit = 0.0625;");
+ append_line(fs_buf, &fs_len, " if (index == 1) limit = 0.5625;");
+ append_line(fs_buf, &fs_len, " if (index == 2) limit = 0.1875;");
+ append_line(fs_buf, &fs_len, " if (index == 3) limit = 0.6875;");
+ append_line(fs_buf, &fs_len, " if (index == 4) limit = 0.8125;");
+ append_line(fs_buf, &fs_len, " if (index == 5) limit = 0.3125;");
+ append_line(fs_buf, &fs_len, " if (index == 6) limit = 0.9375;");
+ append_line(fs_buf, &fs_len, " if (index == 7) limit = 0.4375;");
+ append_line(fs_buf, &fs_len, " if (index == 8) limit = 0.25;");
+ append_line(fs_buf, &fs_len, " if (index == 9) limit = 0.75;");
+ append_line(fs_buf, &fs_len, " if (index == 10) limit = 0.125;");
+ append_line(fs_buf, &fs_len, " if (index == 11) limit = 0.625;");
+ append_line(fs_buf, &fs_len, " if (index == 12) limit = 1.0;");
+ append_line(fs_buf, &fs_len, " if (index == 13) limit = 0.5;");
+ append_line(fs_buf, &fs_len, " if (index == 14) limit = 0.875;");
+ append_line(fs_buf, &fs_len, " if (index == 15) limit = 0.375;");
+ append_line(fs_buf, &fs_len, " }");
+ append_line(fs_buf, &fs_len, " return brightness < limit ? 0.0 : 1.0;");
+ append_line(fs_buf, &fs_len, "}");
+
+ append_line(fs_buf, &fs_len, "vec3 rgb2hsv(vec3 c) {");
+ append_line(fs_buf, &fs_len, " vec4 K = vec4(0.0, -1.0/3.0, 2.0/3.0, -1.0);");
+ append_line(fs_buf, &fs_len, " vec4 p = mix(vec4(c.bg, K.wz),");
+ append_line(fs_buf, &fs_len, " vec4(c.gb, K.xy),");
+ append_line(fs_buf, &fs_len, " step(c.b, c.g));");
+ append_line(fs_buf, &fs_len, " vec4 q = mix(vec4(p.xyw, c.r),");
+ append_line(fs_buf, &fs_len, " vec4(c.r, p.yzx),");
+ append_line(fs_buf, &fs_len, " step(p.x, c.r));");
+ append_line(fs_buf, &fs_len, " float d = q.x - min(q.w, q.y);");
+ append_line(fs_buf, &fs_len, " float e = 1.0e-10;");
+ append_line(fs_buf, &fs_len, " return vec3(");
+ append_line(fs_buf, &fs_len, " abs(q.z + (q.w - q.y) / (6.0 * d + e)), // hue");
+ append_line(fs_buf, &fs_len, " d / (q.x + e), // saturation");
+ append_line(fs_buf, &fs_len, " q.x // value");
+ append_line(fs_buf, &fs_len, " );");
+ append_line(fs_buf, &fs_len, "}");
+ append_line(fs_buf, &fs_len, "");
+ append_line(fs_buf, &fs_len, "vec3 hsv2rgb(vec3 c) {");
+ append_line(fs_buf, &fs_len, " vec3 p = abs(fract(c.xxx + vec3(0.0, 2.0/3.0, 1.0/3.0)) * 6.0 - 3.0);");
+ append_line(fs_buf, &fs_len, " return c.z * mix(vec3(1.0), clamp(p - 1.0, 0.0, 1.0), c.y);");
+ append_line(fs_buf, &fs_len, "}");
+ }
+
if ((opt_alpha && opt_dither) || ccf.do_noise) {
append_line(fs_buf, &fs_len, "uniform float uFrameCount;");
@@ -370,6 +427,11 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
append_line(fs_buf, &fs_len, "uniform vec3 uLightmapColor;");
}
+ if (world_geometry) {
+ fs_len += sprintf(fs_buf + fs_len, "uniform int uShaderFlags[%d];\n", SHADER_FLAG_MAX);
+ fs_len += sprintf(fs_buf + fs_len, "uniform float uShaderFlagValues[%d];\n", SHADER_FLAG_MAX);
+ }
+
append_line(fs_buf, &fs_len, "uniform int uFilter;");
append_line(fs_buf, &fs_len, "void main() {");
@@ -416,6 +478,55 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
// TODO discard if alpha is 0?
+ if (world_geometry) {
+ // hue
+ append_line(fs_buf, &fs_len, "if (uShaderFlags[0] == 1) {");
+ append_line(fs_buf, &fs_len, "vec3 hsv = rgb2hsv(texel.rgb);");
+ append_line(fs_buf, &fs_len, "hsv.x = fract(hsv.x + uShaderFlagValues[0]);");
+ append_line(fs_buf, &fs_len, "vec3 finalColor = hsv2rgb(hsv);");
+ append_line(fs_buf, &fs_len, "texel.rgb = finalColor;");
+ append_line(fs_buf, &fs_len, "}");
+
+ // saturation
+ append_line(fs_buf, &fs_len, "if (uShaderFlags[1] == 1) {");
+ append_line(fs_buf, &fs_len, "const vec3 w = vec3(0.2125, 0.7154, 0.0721);");
+ append_line(fs_buf, &fs_len, "vec3 intensity = vec3(dot(texel.rgb, w));");
+ append_line(fs_buf, &fs_len, "texel.rgb = mix(intensity, texel.rgb, uShaderFlagValues[1]);");
+ append_line(fs_buf, &fs_len, "}");
+
+ // brightness
+ append_line(fs_buf, &fs_len, "if (uShaderFlags[2] == 1) {");
+ append_line(fs_buf, &fs_len, "texel.rgb *= uShaderFlagValues[2];");
+ append_line(fs_buf, &fs_len, "}");
+
+ // contrast
+ append_line(fs_buf, &fs_len, "if (uShaderFlags[3] == 1) {");
+ append_line(fs_buf, &fs_len, "texel.rgb = 0.5 + uShaderFlagValues[3] * (texel.rgb - 0.5);");
+ append_line(fs_buf, &fs_len, "}");
+
+ // exposure
+ append_line(fs_buf, &fs_len, "if (uShaderFlags[4] == 1) {");
+ append_line(fs_buf, &fs_len, "texel.rgb = texel.rgb + (uShaderFlagValues[4] - 2) * texel.rgb + texel.rgb;");
+ append_line(fs_buf, &fs_len, "}");
+
+ // dithering
+ append_line(fs_buf, &fs_len, "if (uShaderFlags[5] == 1) {");
+ append_line(fs_buf, &fs_len, "texel.rgb *= dither4x4(gl_FragCoord.xy, dot(texel.rgb, vec3(0.299, 0.587, 0.114)));");
+ append_line(fs_buf, &fs_len, "}");
+
+ // posterization
+ append_line(fs_buf, &fs_len, "if (uShaderFlags[6] == 1) {");
+ append_line(fs_buf, &fs_len, "int levels = int(max(1.0, uShaderFlagValues[6]));");
+ append_line(fs_buf, &fs_len, "texel.rgb = floor(texel.rgb * levels) / levels;");
+ append_line(fs_buf, &fs_len, "}");
+
+ // scan lines
+ append_line(fs_buf, &fs_len, "if (uShaderFlags[7] == 1) {");
+ append_line(fs_buf, &fs_len, "float scan = sin(gl_FragCoord.y * 1.5) * 0.04;");
+ append_line(fs_buf, &fs_len, "texel.rgb -= scan * uShaderFlagValues[7];");
+ append_line(fs_buf, &fs_len, "}");
+ }
+
if (opt_fog) {
if (opt_alpha) {
append_line(fs_buf, &fs_len, "texel = vec4(mix(texel.rgb, vFog.rgb, vFog.a), texel.a);");
@@ -558,7 +669,15 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
prg->used_lightmap = false;
}
- prg->uniform_locations[6] = glGetUniformLocation(shader_program, "uFilter");
+ if (world_geometry) {
+ prg->uniform_locations[6] = glGetUniformLocation(shader_program, "uShaderFlags");
+ prg->uniform_locations[7] = glGetUniformLocation(shader_program, "uShaderFlagValues");
+ prg->world_geometry = true;
+ } else {
+ prg->world_geometry = false;
+ }
+
+ prg->uniform_locations[8] = glGetUniformLocation(shader_program, "uFilter");
return prg;
}
@@ -717,6 +836,18 @@ static void gfx_opengl_init(void) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
+bool gfx_opengl_check_compatibility(void) {
+ // check GL version
+ int vmajor = 0;
+ int vminor = 0;
+ bool is_es = false;
+ gl_get_version(&vmajor, &vminor, &is_es);
+ if (vmajor < 2 && vminor < 1 && !is_es)
+ return false;
+
+ return true;
+}
+
static void gfx_opengl_on_resize(void) {
}
diff --git a/src/pc/gfx/gfx_opengl.h b/src/pc/gfx/gfx_opengl.h
index 95be897a2..745274efb 100644
--- a/src/pc/gfx/gfx_opengl.h
+++ b/src/pc/gfx/gfx_opengl.h
@@ -5,4 +5,6 @@
extern struct GfxRenderingAPI gfx_opengl_api;
+bool gfx_opengl_check_compatibility(void);
+
#endif
diff --git a/src/pc/gfx/gfx_pc.c b/src/pc/gfx/gfx_pc.c
index fd8045361..70e011f76 100644
--- a/src/pc/gfx/gfx_pc.c
+++ b/src/pc/gfx/gfx_pc.c
@@ -129,6 +129,20 @@ Color gVertexColor = { 0xFF, 0xFF, 0xFF };
Color gFogColor = { 0xFF, 0xFF, 0xFF };
f32 gFogIntensity = 1;
+int gShaderFlags[SHADER_FLAG_MAX] = { 0 };
+f32 gDefaultShaderFlagValues[SHADER_FLAG_MAX] = {
+ [SHADER_FLAG_HUE] = 0.0f,
+ [SHADER_FLAG_SATURATION] = 1.0f,
+ [SHADER_FLAG_BRIGHTNESS] = 1.0f,
+ [SHADER_FLAG_CONTRAST] = 1.0f,
+ [SHADER_FLAG_EXPOSURE] = 1.0f,
+ [SHADER_FLAG_DITHERING] = 0.0f,
+ [SHADER_FLAG_POSTERIZATION] = 8.0f,
+ [SHADER_FLAG_SCANLINES] = 1.0f
+};
+f32 gShaderFlagValues[SHADER_FLAG_MAX] = { 0 };
+bool gShaderFlagsEnabled = true;
+
// need inverse camera matrix to compute world space for lighting engine
static Mat4 sInverseCameraMatrix;
static bool sHasInverseCameraMatrix = false;
@@ -1015,6 +1029,8 @@ static void OPTIMIZE_O3 gfx_sp_vertex(size_t n_vertices, size_t dest_index, cons
if (!(rsp.geometry_mode & G_FRESNEL_ALPHA_EXT)) {
d->color.a = v->cn[3];
}
+
+ d->world_geometry = luaVertexColor;
}
}
@@ -1103,12 +1119,13 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
struct CombineMode* cm = &rdp.combine_mode;
- cm->use_alpha = (rdp.other_mode_l & (G_BL_A_MEM << 18)) == 0;
- cm->texture_edge = (rdp.other_mode_l & CVG_X_ALPHA) == CVG_X_ALPHA;
- cm->use_dither = (rdp.other_mode_l & G_AC_DITHER) == G_AC_DITHER;
- cm->use_2cycle = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE)) == G_CYC_2CYCLE;
- cm->use_fog = (rdp.other_mode_l >> 30) == G_BL_CLR_FOG;
- cm->light_map = (rsp.geometry_mode & G_LIGHT_MAP_EXT) == G_LIGHT_MAP_EXT;
+ cm->use_alpha = (rdp.other_mode_l & (G_BL_A_MEM << 18)) == 0;
+ cm->texture_edge = (rdp.other_mode_l & CVG_X_ALPHA) == CVG_X_ALPHA;
+ cm->use_dither = (rdp.other_mode_l & G_AC_DITHER) == G_AC_DITHER;
+ cm->use_2cycle = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE)) == G_CYC_2CYCLE;
+ cm->use_fog = (rdp.other_mode_l >> 30) == G_BL_CLR_FOG;
+ cm->light_map = (rsp.geometry_mode & G_LIGHT_MAP_EXT) == G_LIGHT_MAP_EXT;
+ cm->world_geometry = gShaderFlagsEnabled && (v1->world_geometry && v2->world_geometry && v3->world_geometry);
if (cm->texture_edge) {
cm->use_alpha = true;
diff --git a/src/pc/gfx/gfx_pc.h b/src/pc/gfx/gfx_pc.h
index 97fdca0cc..b4a970822 100644
--- a/src/pc/gfx/gfx_pc.h
+++ b/src/pc/gfx/gfx_pc.h
@@ -4,6 +4,18 @@
#include "types.h"
#include "pc/gfx/gfx.h"
+enum ShaderFlag {
+ SHADER_FLAG_HUE,
+ SHADER_FLAG_SATURATION,
+ SHADER_FLAG_BRIGHTNESS,
+ SHADER_FLAG_CONTRAST,
+ SHADER_FLAG_EXPOSURE,
+ SHADER_FLAG_DITHERING,
+ SHADER_FLAG_POSTERIZATION,
+ SHADER_FLAG_SCANLINES,
+ SHADER_FLAG_MAX
+};
+
struct GfxRenderingAPI;
struct GfxWindowManagerAPI;
@@ -13,6 +25,11 @@ extern Color gVertexColor;
extern Color gFogColor;
extern f32 gFogIntensity;
+extern int gShaderFlags[SHADER_FLAG_MAX];
+extern f32 gDefaultShaderFlagValues[SHADER_FLAG_MAX];
+extern f32 gShaderFlagValues[SHADER_FLAG_MAX];
+extern bool gShaderFlagsEnabled;
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/pc/gfx/gfx_sdl.c b/src/pc/gfx/gfx_sdl.c
index d59bfde7b..b1cf58591 100644
--- a/src/pc/gfx/gfx_sdl.c
+++ b/src/pc/gfx/gfx_sdl.c
@@ -155,6 +155,39 @@ static void gfx_sdl_init(const char *window_title) {
controller_bind_init();
}
+bool gfx_sdl_check_opengl_compatibility(void) {
+ if (!(SDL_WasInit(SDL_INIT_VIDEO) & SDL_INIT_VIDEO)) {
+ if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
+ return false;
+ }
+ }
+
+ // hidden window
+ SDL_Window* window = SDL_CreateWindow(
+ "",
+ SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1, 1,
+ SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN
+ );
+
+ if (!window) {
+ return false;
+ }
+
+ SDL_GLContext ctx = SDL_GL_CreateContext(window);
+
+ if (!ctx) {
+ SDL_DestroyWindow(window);
+ return false;
+ }
+
+ bool validVersion = gfx_opengl_check_compatibility();
+
+ SDL_GL_DeleteContext(ctx);
+ SDL_DestroyWindow(window);
+
+ return validVersion;
+}
+
static void gfx_sdl_main_loop(void (*run_one_game_iter)(void)) {
run_one_game_iter();
}
diff --git a/src/pc/gfx/gfx_sdl.h b/src/pc/gfx/gfx_sdl.h
index 458eccb54..0c9d50f7a 100644
--- a/src/pc/gfx/gfx_sdl.h
+++ b/src/pc/gfx/gfx_sdl.h
@@ -5,4 +5,6 @@
extern struct GfxWindowManagerAPI gfx_sdl;
+bool gfx_sdl_check_opengl_compatibility(void);
+
#endif
diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c
index abe64f572..8532173a1 100644
--- a/src/pc/lua/smlua_cobject_autogen.c
+++ b/src/pc/lua/smlua_cobject_autogen.c
@@ -753,12 +753,13 @@ static struct LuaObjectField sDjuiColorFields[LUA_DJUI_COLOR_FIELD_COUNT] = {
{ "r", LVT_U8, offsetof(struct DjuiColor, r), false, LOT_NONE },
};
-#define LUA_DJUI_INTERACTABLE_THEME_FIELD_COUNT 7
+#define LUA_DJUI_INTERACTABLE_THEME_FIELD_COUNT 8
static struct LuaObjectField sDjuiInteractableThemeFields[LUA_DJUI_INTERACTABLE_THEME_FIELD_COUNT] = {
{ "cursorDownBorderColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, cursorDownBorderColor), true, LOT_DJUICOLOR },
{ "cursorDownRectColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, cursorDownRectColor), true, LOT_DJUICOLOR },
{ "defaultBorderColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, defaultBorderColor), true, LOT_DJUICOLOR },
{ "defaultRectColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, defaultRectColor), true, LOT_DJUICOLOR },
+ { "disabledTextColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, disabledTextColor), true, LOT_DJUICOLOR },
{ "hoveredBorderColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, hoveredBorderColor), true, LOT_DJUICOLOR },
{ "hoveredRectColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, hoveredRectColor), true, LOT_DJUICOLOR },
{ "textColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, textColor), true, LOT_DJUICOLOR },
diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c
index 7a66d2181..646d2ba74 100644
--- a/src/pc/lua/smlua_constants_autogen.c
+++ b/src/pc/lua/smlua_constants_autogen.c
@@ -1604,6 +1604,15 @@ char gSmluaConstants[] = ""
"BACKGROUND_ABOVE_CLOUDS=8\n"
"BACKGROUND_PURPLE_SKY=9\n"
"BACKGROUND_CUSTOM=10\n"
+"SHADER_FLAG_HUE=0\n"
+"SHADER_FLAG_SATURATION=1\n"
+"SHADER_FLAG_BRIGHTNESS=2\n"
+"SHADER_FLAG_CONTRAST=3\n"
+"SHADER_FLAG_EXPOSURE=4\n"
+"SHADER_FLAG_DITHERING=5\n"
+"SHADER_FLAG_POSTERIZATION=6\n"
+"SHADER_FLAG_SCANLINES=7\n"
+"SHADER_FLAG_MAX=8\n"
"GRAPH_RENDER_ACTIVE=(1 << 0)\n"
"GRAPH_RENDER_CHILDREN_FIRST=(1 << 1)\n"
"GRAPH_RENDER_BILLBOARD=(1 << 2)\n"
diff --git a/src/pc/lua/smlua_functions.c b/src/pc/lua/smlua_functions.c
index 7f239ecd9..1d97e1525 100644
--- a/src/pc/lua/smlua_functions.c
+++ b/src/pc/lua/smlua_functions.c
@@ -900,6 +900,7 @@ static GraphNodeLot graphNodeLots[] = {
{ GRAPH_NODE_TYPE_ROOT, LOT_GRAPHNODE },
{ GRAPH_NODE_TYPE_ROTATION, LOT_GRAPHNODEROTATION },
{ GRAPH_NODE_TYPE_SCALE, LOT_GRAPHNODESCALE },
+ { GRAPH_NODE_TYPE_SCALE_XYZ, LOT_GRAPHNODESCALEXYZ },
{ GRAPH_NODE_TYPE_SHADOW, LOT_GRAPHNODESHADOW },
{ GRAPH_NODE_TYPE_START, LOT_GRAPHNODESTART },
{ GRAPH_NODE_TYPE_SWITCH_CASE, LOT_GRAPHNODESWITCHCASE },
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 16189baf9..998934558 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -9890,6 +9890,21 @@ int smlua_func_position_based_random_float_position(UNUSED lua_State* L) {
return 1;
}
+int smlua_func_draw_distance_scalar_is_infinite(UNUSED lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 0) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "draw_distance_scalar_is_infinite", 0, top);
+ return 0;
+ }
+
+
+ lua_pushboolean(L, draw_distance_scalar_is_infinite());
+
+ return 1;
+}
+
int smlua_func_draw_distance_scalar(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@@ -32586,6 +32601,125 @@ int smlua_func_network_player_palette_to_color(lua_State* L) {
// smlua_gfx_utils.h //
///////////////////////
+int smlua_func_get_shader_flag_enabled(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 1) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_shader_flag_enabled", 1, top);
+ return 0;
+ }
+
+ int flag = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_shader_flag_enabled"); return 0; }
+
+ lua_pushboolean(L, get_shader_flag_enabled(flag));
+
+ return 1;
+}
+
+int smlua_func_set_shader_flag_enabled(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 2) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_shader_flag_enabled", 2, top);
+ return 0;
+ }
+
+ int flag = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_shader_flag_enabled"); return 0; }
+ bool enabled = smlua_to_boolean(L, 2);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_shader_flag_enabled"); return 0; }
+
+ set_shader_flag_enabled(flag, enabled);
+
+ return 1;
+}
+
+int smlua_func_get_shader_flag_value(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 1) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_shader_flag_value", 1, top);
+ return 0;
+ }
+
+ int flag = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_shader_flag_value"); return 0; }
+
+ lua_pushnumber(L, get_shader_flag_value(flag));
+
+ return 1;
+}
+
+int smlua_func_set_shader_flag_value(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 2) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_shader_flag_value", 2, top);
+ return 0;
+ }
+
+ int flag = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_shader_flag_value"); return 0; }
+ f32 value = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_shader_flag_value"); return 0; }
+
+ set_shader_flag_value(flag, value);
+
+ return 1;
+}
+
+int smlua_func_get_global_shader_flags_enabled(UNUSED lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 0) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_global_shader_flags_enabled", 0, top);
+ return 0;
+ }
+
+
+ lua_pushboolean(L, get_global_shader_flags_enabled());
+
+ return 1;
+}
+
+int smlua_func_set_global_shader_flags_enabled(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", "set_global_shader_flags_enabled", 1, top);
+ return 0;
+ }
+
+ bool enabled = smlua_to_boolean(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_global_shader_flags_enabled"); return 0; }
+
+ set_global_shader_flags_enabled(enabled);
+
+ return 1;
+}
+
+int smlua_func_clear_all_shader_flags(UNUSED lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 0) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clear_all_shader_flags", 0, top);
+ return 0;
+ }
+
+
+ clear_all_shader_flags();
+
+ return 1;
+}
+
int smlua_func_set_override_fov(lua_State* L) {
if (L == NULL) { return 0; }
@@ -38038,6 +38172,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "obj_update_gfx_pos_and_angle", smlua_func_obj_update_gfx_pos_and_angle);
smlua_bind_function(L, "position_based_random_u16", smlua_func_position_based_random_u16);
smlua_bind_function(L, "position_based_random_float_position", smlua_func_position_based_random_float_position);
+ smlua_bind_function(L, "draw_distance_scalar_is_infinite", smlua_func_draw_distance_scalar_is_infinite);
smlua_bind_function(L, "draw_distance_scalar", smlua_func_draw_distance_scalar);
// behavior_table.h
@@ -39291,6 +39426,13 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "network_player_palette_to_color", smlua_func_network_player_palette_to_color);
// smlua_gfx_utils.h
+ smlua_bind_function(L, "get_shader_flag_enabled", smlua_func_get_shader_flag_enabled);
+ smlua_bind_function(L, "set_shader_flag_enabled", smlua_func_set_shader_flag_enabled);
+ smlua_bind_function(L, "get_shader_flag_value", smlua_func_get_shader_flag_value);
+ smlua_bind_function(L, "set_shader_flag_value", smlua_func_set_shader_flag_value);
+ smlua_bind_function(L, "get_global_shader_flags_enabled", smlua_func_get_global_shader_flags_enabled);
+ smlua_bind_function(L, "set_global_shader_flags_enabled", smlua_func_set_global_shader_flags_enabled);
+ smlua_bind_function(L, "clear_all_shader_flags", smlua_func_clear_all_shader_flags);
smlua_bind_function(L, "set_override_fov", smlua_func_set_override_fov);
smlua_bind_function(L, "set_override_near", smlua_func_set_override_near);
smlua_bind_function(L, "set_override_far", smlua_func_set_override_far);
diff --git a/src/pc/lua/utils/smlua_audio_utils.c b/src/pc/lua/utils/smlua_audio_utils.c
index 515e2888c..44422ad65 100644
--- a/src/pc/lua/utils/smlua_audio_utils.c
+++ b/src/pc/lua/utils/smlua_audio_utils.c
@@ -638,18 +638,20 @@ void audio_sample_play(struct ModAudio* audio, Vec3f position, f32 volume) {
}
f32 dist = 0;
- f32 pan = 0.5f;
+ f32 pan = 0;
if (gCamera) {
f32 dX = position[0] - gCamera->pos[0];
f32 dY = position[1] - gCamera->pos[1];
f32 dZ = position[2] - gCamera->pos[2];
dist = sqrtf(dX * dX + dY * dY + dZ * dZ);
- Mat4 mtx;
- mtxf_translate(mtx, position);
- mtxf_mul(mtx, mtx, gCamera->mtx);
- f32 factor = 10;
- pan = (get_sound_pan(mtx[3][0] * factor, mtx[3][2] * factor) - 0.5f) * 2.0f;
+ if (configSoundOutput != SOUND_MODE_MONO) {
+ Mat4 mtx;
+ mtxf_translate(mtx, position);
+ mtxf_mul(mtx, mtx, gCamera->mtx);
+ f32 factor = 10;
+ pan = (get_sound_pan(mtx[3][0] * factor, mtx[3][2] * factor) - 0.5f) * 2.0f;
+ }
}
if (configMuteFocusLoss && !gWindowApi->has_focus()) {
diff --git a/src/pc/lua/utils/smlua_gfx_utils.c b/src/pc/lua/utils/smlua_gfx_utils.c
index 78a3679b1..19833e9e4 100644
--- a/src/pc/lua/utils/smlua_gfx_utils.c
+++ b/src/pc/lua/utils/smlua_gfx_utils.c
@@ -1,9 +1,45 @@
#include "smlua_gfx_utils.h"
-#include "pc/gfx/gfx_pc.h"
+#include "pc/pc_main.h"
#include "game/rendering_graph_node.h"
#include "game/skybox.h"
#include "geo_commands.h"
+bool get_shader_flag_enabled(enum ShaderFlag flag) {
+ if (flag < 0 || flag >= SHADER_FLAG_MAX) { return false; }
+ return gShaderFlags[flag];
+}
+
+void set_shader_flag_enabled(enum ShaderFlag flag, bool enabled) {
+ if (flag < 0 || flag >= SHADER_FLAG_MAX) { return; }
+ gShaderFlags[flag] = enabled ? 1 : 0;
+}
+
+f32 get_shader_flag_value(enum ShaderFlag flag) {
+ if (flag < 0 || flag >= SHADER_FLAG_MAX) { return 0.0f; }
+ return gShaderFlagValues[flag];
+}
+
+void set_shader_flag_value(enum ShaderFlag flag, f32 value) {
+ if (flag < 0 || flag >= SHADER_FLAG_MAX) { return; }
+ gShaderFlagValues[flag] = value;
+}
+
+bool get_global_shader_flags_enabled(void) {
+ return gShaderFlagsEnabled;
+}
+
+void set_global_shader_flags_enabled(bool enabled) {
+ gShaderFlagsEnabled = enabled;
+}
+
+AT_STARTUP void clear_all_shader_flags(void) {
+ gShaderFlagsEnabled = true;
+ memset(gShaderFlags, 0, sizeof(s32) * SHADER_FLAG_MAX);
+ memcpy(gShaderFlagValues, gDefaultShaderFlagValues, sizeof(f32) * SHADER_FLAG_MAX);
+}
+
+///
+
void set_override_fov(f32 fov) {
gOverrideFOV = fov;
}
diff --git a/src/pc/lua/utils/smlua_gfx_utils.h b/src/pc/lua/utils/smlua_gfx_utils.h
index d49ebed34..8dbca45a1 100644
--- a/src/pc/lua/utils/smlua_gfx_utils.h
+++ b/src/pc/lua/utils/smlua_gfx_utils.h
@@ -1,6 +1,7 @@
#ifndef SMLUA_GFX_UTILS_H
#define SMLUA_GFX_UTILS_H
+#include "pc/gfx/gfx_pc.h"
#include "pc/lua/smlua.h"
#include "types.h"
#include "geo_commands.h"
@@ -12,6 +13,21 @@ Gfx *gfx_allocate_internal(Gfx *gfx, u32 length);
Vtx *vtx_allocate_internal(Vtx *vtx, u32 count);
u32 gfx_get_length_no_sentinel(const Gfx *gfx);
+/* |description|Gets if a custom shader flag (`SHADER_FLAG_*`) is enabled or not|descriptionEnd| */
+bool get_shader_flag_enabled(enum ShaderFlag flag);
+/* |description|Enables a custom shader flag (`SHADER_FLAG_*`) for the renderer|descriptionEnd| */
+void set_shader_flag_enabled(enum ShaderFlag flag, bool enabled);
+/* |description|Gets a value for one of the custom shader flags (`SHADER_FLAG_*`)|descriptionEnd| */
+f32 get_shader_flag_value(enum ShaderFlag flag);
+/* |description|Sets a value for one of the custom shader flags (`SHADER_FLAG_*`) for the renderer|descriptionEnd| */
+void set_shader_flag_value(enum ShaderFlag flag, f32 value);
+/* |description|Gets if custom shader flags are enabled globally|descriptionEnd| */
+bool get_global_shader_flags_enabled(void);
+/* |description|Enables custom shader flags as a global toggle, useful for disabling without manually going through every effect|descriptionEnd| */
+void set_global_shader_flags_enabled(bool enabled);
+/* |description|Clears all custom shader flags (`SHADER_FLAG_*`) for the renderer|descriptionEnd| */
+void clear_all_shader_flags(void);
+
/* |description|Sets the override FOV|descriptionEnd| */
void set_override_fov(f32 fov);
/* |description|Sets the override near plane|descriptionEnd| */
@@ -96,7 +112,7 @@ void gfx_delete_all();
/* |description|
Gets a vertex buffer of the current mod from its name.
-Returns a pointer to the vertex buffering and its vertex count
+Returns a pointer to the vertex buffer and its vertex count
|descriptionEnd| */
Vtx *vtx_get_from_name(const char *name, RET u32 *count);
/* |description|Gets the name of a vertex buffer|descriptionEnd| */
diff --git a/src/pc/network/network.c b/src/pc/network/network.c
index cf5056cda..d13eed442 100644
--- a/src/pc/network/network.c
+++ b/src/pc/network/network.c
@@ -16,6 +16,7 @@
#include "pc/lua/utils/smlua_model_utils.h"
#include "pc/lua/utils/smlua_misc_utils.h"
#include "pc/lua/utils/smlua_camera_utils.h"
+#include "pc/lua/utils/smlua_gfx_utils.h"
#include "pc/mods/mods.h"
#include "pc/crash_handler.h"
#include "pc/debuglog.h"
@@ -36,7 +37,7 @@
#include "game/mario.h"
#include "engine/math_util.h"
#include "engine/lighting_engine.h"
-#include "src/audio/load.h"
+#include "audio/load.h"
#ifdef DISCORD_SDK
#include "pc/discord/discord.h"
@@ -723,6 +724,7 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
color_set(gSkyboxColor, 0xFF, 0xFF, 0xFF);
color_set(gFogColor, 0xFF, 0xFF, 0xFF);
gFogIntensity = 1.0f;
+ clear_all_shader_flags();
gOverrideBackground = -1;
gOverrideEnvFx = ENVFX_MODE_NO_OVERRIDE;
gRomhackCameraSettings.centering = FALSE;
diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c
index 160c9d364..46a11b315 100644
--- a/src/pc/pc_main.c
+++ b/src/pc/pc_main.c
@@ -221,6 +221,11 @@ static void select_graphics_backend(void) {
return;
}
+#if defined(_WIN32)
+ if (configGraphicsBackend == GAPI_GL && !gfx_sdl_check_opengl_compatibility()) {
+ configGraphicsBackend = GAPI_D3D11;
+ }
+#endif
int backend = configGraphicsBackend;
#if defined(_WIN32)
if (gCLIOpts.backend != -1) { backend = gCLIOpts.backend; }
@@ -578,6 +583,10 @@ int main(int argc, char *argv[]) {
show_update_popup();
+ if (can_update_game()) {
+ djui_open_update_panel();
+ }
+
// initialize network
if (gCLIOpts.network == NT_CLIENT) {
network_set_system(NS_SOCKET);
diff --git a/src/pc/utils/misc.c b/src/pc/utils/misc.c
index 13f89fccd..4af85e437 100644
--- a/src/pc/utils/misc.c
+++ b/src/pc/utils/misc.c
@@ -1,3 +1,9 @@
+#ifdef _WIN32
+#include
+#else
+#include
+#endif
+
#include
#include
#include
@@ -14,6 +20,7 @@
#include "engine/math_util.h"
#include "pc/configfile.h"
#include "pc/pc_main.h"
+#include "pc/update_checker.h"
float smooth_step(float edge0, float edge1, float x) {
float t = (x - edge0) / (edge1 - edge0);
@@ -594,3 +601,47 @@ void str_seperator_concat(char *output_buffer, int buffer_size, char** strings,
}
}
}
+
+static char *get_update_path(void) {
+#ifdef _WIN32
+ char updateExecFilename[] = "coopdx_updater.exe";
+#else
+ char updateExecFilename[] = "coopdx_updater";
+#endif
+ static char sUpdateExecFilePath[SYS_MAX_PATH];
+ // this may truncate as sys_exe_path_dir is allocated to be of size SYS_MAX_SIZE, nonetheless such a limit should not be hit during normal use.
+ snprintf(sUpdateExecFilePath, sizeof(sUpdateExecFilePath), "%s%s%s", sys_exe_path_dir(), PATH_SEPARATOR, updateExecFilename);
+ return sUpdateExecFilePath;
+}
+
+bool can_update_game(void) {
+ // the file is not guaranteed to exist, so make sure we have the updater installed
+ return fs_sys_file_exists(get_update_path()) && gUpdateMessage;
+}
+
+void update_game(void) {
+ const char *updateExecFilePath = get_update_path();
+
+#ifdef _WIN32
+ STARTUPINFOA si = { 0 };
+ PROCESS_INFORMATION pi = { 0 };
+
+ si.cb = sizeof(si);
+
+ char commandBuf[SYS_MAX_PATH];
+ // this can truncate, but under normal use, SYS_MAX_PATH should not ever be filled up
+ snprintf(commandBuf, sizeof(commandBuf), "%s --game-update", updateExecFilePath);
+
+ if (CreateProcessA(NULL, commandBuf, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
+ CloseHandle(pi.hProcess);
+ CloseHandle(pi.hThread);
+ }
+ exit(0);
+#else
+ fclose(stdin);
+ fclose(stdout);
+ fclose(stderr);
+ execl(updateExecFilePath, "coopdx_updater", "--game-update", NULL);
+ exit(1);
+#endif
+}
\ No newline at end of file
diff --git a/src/pc/utils/misc.h b/src/pc/utils/misc.h
index 01d813fa1..f18362717 100644
--- a/src/pc/utils/misc.h
+++ b/src/pc/utils/misc.h
@@ -38,4 +38,7 @@ void detect_and_skip_mtx_interpolation(Mtx** mtxPrev, Mtx** mtx);
void str_seperator_concat(char *output_buffer, int buffer_size, char** strings, int num_strings, char* seperator);
+bool can_update_game(void);
+void update_game(void);
+
#endif
\ No newline at end of file
diff --git a/updater/linux/coopdx_updater b/updater/linux/coopdx_updater
new file mode 100644
index 000000000..c49a1441b
Binary files /dev/null and b/updater/linux/coopdx_updater differ
diff --git a/updater/mac_arm/coopdx_updater b/updater/mac_arm/coopdx_updater
new file mode 100755
index 000000000..ff33fd0d8
Binary files /dev/null and b/updater/mac_arm/coopdx_updater differ
diff --git a/updater/mac_intel/coopdx_updater b/updater/mac_intel/coopdx_updater
new file mode 100755
index 000000000..989e66df4
Binary files /dev/null and b/updater/mac_intel/coopdx_updater differ
diff --git a/updater/win64/coopdx_updater.exe b/updater/win64/coopdx_updater.exe
new file mode 100644
index 000000000..514aa22b6
Binary files /dev/null and b/updater/win64/coopdx_updater.exe differ