Merge branch 'coop-deluxe:main' into coopdx.-dev-sept25

This commit is contained in:
iZePlayz 2026-04-03 01:13:09 +02:00 committed by GitHub
commit 8a7ead7a05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
225 changed files with 8522 additions and 4422 deletions

View file

@ -1603,7 +1603,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/libjuice.1.2.2.dylib $(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)/opt/sdl2/lib/libSDL2-2.0.0.dylib @executable_path/libSDL2.dylib $(APP_MACOS_DIR)/sm64coopdx; > /dev/null 2>&1 \
install_name_tool -id @executable_path/libSDL2.dylib $(APP_MACOS_DIR)/libSDL2.dylib; > /dev/null 2>&1 \

View file

@ -93,7 +93,7 @@ override_allowed_functions = {
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/platform_displacement.h": [ "apply_platform_displacement" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*", "geo_get_.*_state" ],
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running", "pressed_pause", "fade_into_special_warp", "get_instant_warp" ],
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_warp", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running", "pressed_pause", "fade_into_special_warp", "get_instant_warp" ],
"src/game/area.h": [ "get_mario_spawn_type", "area_get_warp_node", "area_get_any_warp_node", "play_transition" ],
"src/engine/level_script.h": [ "area_create_warp_node" ],
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color", "set_menu_mode", "create_dialog_box", "create_dialog_box_with_var", "create_dialog_inverted_box", "create_dialog_box_with_response", "reset_dialog_render_state", "set_dialog_box_state", "handle_special_dialog_text" ],
@ -159,7 +159,9 @@ lua_function_params = {
}
parameter_keywords = [
"OUT",
"VEC_OUT",
"RET",
"INOUT",
"OPTIONAL"
]
@ -833,18 +835,45 @@ def build_param(fid, param, i):
def build_param_after(param, i):
ptype = param['type']
pid = param['identifier']
is_output = 'OUT' in param
is_output = 'VEC_OUT' in param
if ptype in VEC_TYPES and is_output:
return (vec_type_after % (ptype.lower())).replace('$[IDENTIFIER]', str(pid)).replace('$[INDEX]', str(i))
else:
return ''
def build_return_value(id, rtype):
rtype = alter_type(rtype)
lot = translate_type_to_lot(rtype)
lfunc = 'UNIMPLEMENTED -->'
if rtype in integer_types:
lfunc = 'lua_pushinteger'
elif rtype in number_types:
lfunc = 'lua_pushnumber'
elif rtype == 'bool':
lfunc = 'lua_pushboolean'
elif rtype == 'char*':
lfunc = 'lua_pushstring'
elif rtype == 'const char*':
lfunc = 'lua_pushstring'
elif rtype == 'ByteString':
lfunc = 'smlua_push_bytestring'
elif rtype == 'LuaTable':
lfunc = 'smlua_push_lua_table'
elif lot == 'LOT_POINTER':
lvt = translate_type_to_lvt(rtype)
return ' smlua_push_pointer(L, %s, (void*)%s, NULL);\n' % (lvt, id)
elif '???' not in lot and lot != 'LOT_NONE':
return ' smlua_push_object(L, %s, %s, NULL);\n' % (lot, id)
return ' %s(L, %s);\n' % (lfunc, id)
def build_call(function):
ftype = alter_type(function['type'])
fid = function['identifier']
ccall = '%s(%s)' % (fid, ', '.join([x['identifier'] for x in function['params']]))
ccall = '%s(%s)' % (fid, ', '.join([('&' if ('RET' in x or 'INOUT' in x) else '') + x['identifier'] for x in function['params']]))
if ftype == 'void':
return ' %s;\n' % ccall
@ -856,30 +885,21 @@ def build_call(function):
if ftype in VECP_TYPES:
return ' %s;\n' % ccall
flot = translate_type_to_lot(ftype)
return build_return_value(ccall, ftype)
lfunc = 'UNIMPLEMENTED -->'
if ftype in integer_types:
lfunc = 'lua_pushinteger'
elif ftype in number_types:
lfunc = 'lua_pushnumber'
elif ftype == 'bool':
lfunc = 'lua_pushboolean'
elif ftype == 'char*':
lfunc = 'lua_pushstring'
elif ftype == 'const char*':
lfunc = 'lua_pushstring'
elif ftype == 'ByteString':
lfunc = 'smlua_push_bytestring'
elif ftype == 'LuaTable':
lfunc = 'smlua_push_lua_table'
elif translate_type_to_lot(ftype) == 'LOT_POINTER':
lvt = translate_type_to_lvt(ftype)
return ' smlua_push_pointer(L, %s, (void*)%s, NULL);\n' % (lvt, ccall)
elif '???' not in flot and flot != 'LOT_NONE':
return ' smlua_push_object(L, %s, %s, NULL);\n' % (flot, ccall)
return ' %s(L, %s);\n' % (lfunc, ccall)
def split_function_parameters_and_returns(function):
fparams = []
freturns = []
for param in function['params']:
deref_type = param['type'][:param['type'].rfind('*')].strip() # Remove pointer
if 'INOUT' in param:
fparams.append({ **{ k: v for k, v in param.items() if k != "type" }, "type": deref_type})
freturns.append({ **param, "rtype": deref_type })
elif 'RET' in param:
freturns.append({ **param, "rtype": deref_type })
else:
fparams.append(param)
return fparams, freturns
def build_function(function, do_extern):
s = ''
@ -888,6 +908,8 @@ def build_function(function, do_extern):
if fid in override_function_version_excludes:
s += '#ifndef ' + override_function_version_excludes[fid] + '\n'
fparams, freturns = split_function_parameters_and_returns(function)
if len(function['params']) <= 0:
s += 'int smlua_func_%s(UNUSED lua_State* L) {\n' % function['identifier']
else:
@ -899,8 +921,8 @@ def build_function(function, do_extern):
if 'bhv_' in fid:
s += ' if (!gCurrentObject) { return 0; }\n'
params_max = len(function['params'])
params_min = len([param for param in function['params'] if 'OPTIONAL' not in param])
params_max = len(fparams)
params_min = len([param for param in fparams if 'OPTIONAL' not in param])
if params_min == params_max:
s += """ if (L == NULL) { return 0; }\n
int top = lua_gettop(L);
@ -919,7 +941,7 @@ def build_function(function, do_extern):
is_interact_func = fid.startswith('interact_') and fname == 'interaction.h'
i = 1
for param in function['params']:
for param in fparams:
pid = param['identifier']
if is_interact_func and pid == 'interactType':
s += " // interactType skipped so mods can't lie about what interaction it is\n"
@ -938,14 +960,25 @@ def build_function(function, do_extern):
i += 1
s += '\n'
if freturns:
for param in freturns:
if 'INOUT' not in param:
pid = param['identifier']
ptype = alter_type(param['rtype'])
s += ' %s %s;\n' % (ptype, pid)
s += '\n'
if do_extern:
s += ' extern %s\n' % function['line']
push_value = True
if is_interact_func:
# special case for interaction functions to call the hooks associated with interactions
s += " lua_pushinteger(L, process_interaction(m, " + fid.upper() + ", o, " + fid + "));\n"
else:
s += build_call(function)
call_str = build_call(function)
push_value = "lua_push" in call_str
s += call_str
i = 1
for param in function['params']:
@ -953,14 +986,23 @@ def build_function(function, do_extern):
i += 1
s += '\n'
# To allow chaining vector functions calls, return the table corresponding to the `OUT` parameter
# To allow chaining vector functions calls, return the table corresponding to the `VEC_OUT` parameter
if function['type'] in VECP_TYPES:
for i, param in enumerate(function['params']):
if 'OUT' in param:
if 'VEC_OUT' in param:
s += ' lua_settop(L, %d);\n' % (i + 1)
break
s += ' return 1;\n}\n'
# Push extra return values
if freturns:
for param in freturns:
pid = param['identifier']
ptype = alter_type(param['rtype'])
s += build_return_value(pid, ptype)
s += '\n'
num_returns = max(1, push_value + len(freturns))
s += ' return %d;\n}\n' % num_returns
if fid in override_function_version_excludes:
s += '#endif\n'
@ -1252,23 +1294,34 @@ def doc_function(fname, function):
description = function.get('description', "")
rtype, rlink = translate_type_to_lua(function['type'])
param_str = ', '.join([x['identifier'] for x in function['params']])
param_str = ', '.join([x['identifier'] for x in function['params'] if 'RET' not in x])
if description != "":
s += '\n### Description\n'
s += f'{description}\n'
s += "\n### Lua Example\n"
if rtype != None:
s += "`local %sValue = %s(%s)`\n" % (rtype.replace('`', '').split(' ')[0], fid, param_str)
rvalues = []
if rtype is not None:
rid = rtype.replace('`', '').split(' ')[0]
rid = rid[0].lower() + rid[1:]
rvalues.append((rid + 'Value', rtype, rlink))
fparams, freturns = split_function_parameters_and_returns(function)
for param in freturns:
ptype, plink = translate_type_to_lua(param['rtype'])
rvalues.append((param['identifier'], ptype, plink))
if rvalues:
s += "`local %s = %s(%s)`\n" % (", ".join([id for id, _, _ in rvalues]), fid, param_str)
else:
s += "`%s(%s)`\n" % (fid, param_str)
s += '\n### Parameters\n'
if len(function['params']) > 0:
if len(fparams) > 0:
s += '| Field | Type |\n'
s += '| ----- | ---- |\n'
for param in function['params']:
for param in fparams:
pid = param['identifier']
ptype = param['type']
ptype, plink = translate_type_to_lua(ptype)
@ -1288,10 +1341,11 @@ def doc_function(fname, function):
s += '\n### Returns\n'
if rtype != None:
if rlink:
s += '[%s](%s)\n' % (rtype, rlink)
else:
s += '- %s\n' % rtype
for _, ptype, plink in rvalues:
if plink:
s += '- [%s](%s)\n' % (ptype, plink)
else:
s += '- %s\n' % ptype
else:
s += '- None\n'
@ -1380,19 +1434,26 @@ def def_function(fname, function):
if not doc_should_document(fname, fid):
return ''
rtype, rlink = translate_type_to_lua(function['type'])
param_str = ', '.join([x['identifier'] for x in function['params']])
rtype, _ = translate_type_to_lua(function['type'])
param_str = ', '.join([x['identifier'] for x in function['params'] if 'RET' not in x])
if rtype == None:
rtype = 'nil'
rtypes = []
if rtype is not None:
rtypes.append((rtype, None))
fparams, freturns = split_function_parameters_and_returns(function)
for param in freturns:
rtype, _ = translate_type_to_lua(param['rtype'])
rid = param['identifier']
rtypes.append((rtype, rid))
if function['description'].startswith("[DEPRECATED"):
s += "--- @deprecated\n"
for param in function['params']:
for param in fparams:
pid = param['identifier']
ptype = param['type']
ptype, plink = translate_type_to_lua(ptype)
ptype, _ = translate_type_to_lua(ptype)
ptype = translate_to_def(ptype)
if ptype.startswith('Pointer_') and ptype not in def_pointers:
@ -1400,12 +1461,14 @@ def def_function(fname, function):
s += '--- @param %s%s %s\n' % (pid, ('?' if 'OPTIONAL' in param else ''), ptype)
rtype = translate_to_def(rtype)
if rtype.startswith('Pointer_') and rtype not in def_pointers:
def_pointers.append(rtype)
for rtype, rid in rtypes:
rtype = translate_to_def(rtype)
if rtype.startswith('Pointer_') and rtype not in def_pointers:
def_pointers.append(rtype)
if rtype != "nil":
s += ('--- @return %s' % rtype) + (' %s' % rid if rid else '') + '\n'
if rtype != "nil":
s += '--- @return %s\n' % rtype
if function['description'] != "":
s += "--- %s\n" % (function['description'])
s += "function %s(%s)\n -- ...\nend\n\n" % (fid, param_str)

View file

@ -118,7 +118,7 @@ override_field_immutable = {
"GlobalObjectAnimations": [ "*"],
"SpawnParticlesInfo": [ "model" ],
"WaterDropletParams": [ "model" ],
"MarioBodyState": [ "updateTorsoTime", "updateHeadPosTime", "animPartsPos", "currAnimPart" ],
"MarioBodyState": [ "updateTorsoTime", "updateHeadPosTime", "animPartsPos", "animPartsRot", "currAnimPart" ],
"Area": [ "localAreaTimer", "nextSyncID", "objectSpawnInfos", "paintingWarpNodes", "warpNodes" ],
"Mod": [ "*" ],
"ModFile": [ "*" ],
@ -550,26 +550,26 @@ def build_struct(struct):
endStr += '\n#endif'
startStr += ' { '
if ftype == cobject_function_identifier:
row.append(startStr )
row.append('"%s", ' % fid )
row.append('%s, ' % lvt )
row.append('(size_t) FUNCTION__%s, ' % (field['function']))
row.append('%s, ' % fimmutable )
row.append('%s, ' % lot )
row.append('%s, ' % size )
row.append('sizeof(const char *)' )
row.append(endStr )
row.append(startStr )
row.append('"%s", ' % fid )
row.append('%s, ' % lvt )
row.append('(size_t) "%s", ' % field['function'])
row.append('%s, ' % fimmutable )
row.append('%s, ' % lot )
row.append('%s, ' % size )
row.append('sizeof(const char *)' )
row.append(endStr )
field_functions.append(field['function'])
else:
row.append(startStr )
row.append('"%s", ' % fid )
row.append('%s, ' % lvt )
row.append(startStr )
row.append('"%s", ' % fid )
row.append('%s, ' % lvt )
row.append('offsetof(%s%s, %s), ' % (struct_str, name, field['identifier']))
row.append('%s, ' % fimmutable )
row.append('%s, ' % lot )
row.append('%s, ' % size )
row.append('sizeof(%s)' % ftype )
row.append(endStr )
row.append('%s, ' % fimmutable )
row.append('%s, ' % lot )
row.append('%s, ' % size )
row.append('sizeof(%s)' % ftype )
row.append(endStr )
field_table.append(row)
field_table_str, field_count = table_to_string(field_table)
@ -577,10 +577,6 @@ def build_struct(struct):
struct_lot = 'LOT_%s' % sid.upper()
s = ''
if field_functions:
for field_function in field_functions:
s += 'static const char FUNCTION__%s[] = "%s";\n' % (field_function, field_function)
s += '\n'
s += "#define %s $[STRUCTFIELDCOUNT]\n" % field_count_define
s += "static struct LuaObjectField s%sFields[%s] = {\n" % (sid, field_count_define)

View file

@ -4,7 +4,7 @@ VECX_TO_VECY = """
/* |description|
Converts a {{size}}D {{desc}} vector `a` into a {{size}}D {{desc_2}} vector and stores the result in `dest`
|descriptionEnd| */
INLINE OPTIMIZE_O3 Vec{{size}}{{suffix_2}}p vec{{size}}{{suffix}}_to_vec{{size}}{{suffix_2}}(OUT Vec{{size}}{{suffix_2}} dest, Vec{{size}}{{suffix}} a) {
INLINE OPTIMIZE_O3 Vec{{size}}{{suffix_2}}p vec{{size}}{{suffix}}_to_vec{{size}}{{suffix_2}}(VEC_OUT Vec{{size}}{{suffix_2}} dest, Vec{{size}}{{suffix}} a) {
{{body}}
return dest;
}

View file

@ -5,6 +5,13 @@ FONT_TINY = -1
ANIM_FLAG_FORWARD = (1 << 1)
-----------------------
-- Renamed functions --
-----------------------
rom_hack_cam_set_collisions = camera_romhack_set_collisions
--------------------
-- Math functions --
--------------------

View file

@ -3635,7 +3635,7 @@ HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_CO
--- | `HUD_DISPLAY_DEFAULT`
--- @type integer
LE_MAX_LIGHTS = 256
LE_MAX_LIGHTS = 512
LE_MODE_AFFECT_ALL_SHADED_AND_COLORED = 0 --- @type LEMode
LE_MODE_AFFECT_ALL_SHADED = 1 --- @type LEMode
@ -9523,7 +9523,7 @@ SOUND_PEACH_FOR_MARIO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3E, 0xFF, SOUND
SOUND_PEACH_MARIO2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3F, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)
--- @type integer
SOUND_MARIO_LETS_A_GO = SOUND_MENU_STAR_SOUND_LETS_A_GO
SOUND_MARIO_LETS_A_GO = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x24, 0xFF, SOUND_DISCRETE)
--- @type integer
SOUND_GENERAL_ACTIVATE_CAP_SWITCH = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x00, 0x80, SOUND_DISCRETE)
@ -11170,7 +11170,7 @@ COOP_OBJ_FLAG_NON_SYNC = (1 << 2)
COOP_OBJ_FLAG_INITIALIZED = (1 << 3)
--- @type string
SM64COOPDX_VERSION = "v1.4"
SM64COOPDX_VERSION = "v1.4.1"
--- @type string
VERSION_TEXT = "v"
@ -11179,7 +11179,7 @@ VERSION_TEXT = "v"
VERSION_NUMBER = 41
--- @type integer
MINOR_VERSION_NUMBER = 0
MINOR_VERSION_NUMBER = 1
--- @type string
GAME_NAME = "sm64coopdx"

View file

@ -124,9 +124,10 @@ function play_penguin_walking_sound(walk)
-- ...
end
--- @param angle Pointer_integer
--- @param angle integer
--- @return integer
--- Updates the current object's angle from its move flags
--- @return integer angle
--- Computes and returns an angle depending on the current object's angle and move flags
function update_angle_from_move_flags(angle)
-- ...
end
@ -3204,20 +3205,22 @@ function is_within_100_units_of_mario(posX, posY, posZ)
-- ...
end
--- @param dst Pointer_number
--- @param dst number
--- @param goal number
--- @param scale number
--- @return integer
--- Smoothly transitions or directly sets a floating-point value (`dst`) to approach a target (`goal`). Uses asymptotic scaling for gradual adjustments or direct assignment
--- @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`
function set_or_approach_f32_asymptotic(dst, goal, scale)
-- ...
end
--- @param current Pointer_number
--- @param current number
--- @param target number
--- @param multiplier number
--- @return integer
--- Gradually adjusts a floating-point value (`current`) towards a target (`target`) using asymptotic smoothing. Returns true if `current` reaches the `target` and false otherwise
--- @return number current
--- 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
@ -3231,11 +3234,12 @@ function approach_f32_asymptotic(current, target, multiplier)
-- ...
end
--- @param current Pointer_integer
--- @param current integer
--- @param target integer
--- @param divisor integer
--- @return integer
--- Gradually adjusts a signed 16-bit integer (`current`) towards a target (`target`) using asymptotic smoothing. Returns true if `current` reaches `target` and false otherwise
--- @return integer current
--- 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
@ -3269,29 +3273,32 @@ function set_or_approach_vec3f_asymptotic(dst, goal, xMul, yMul, zMul)
-- ...
end
--- @param current Pointer_integer
--- @param current integer
--- @param target integer
--- @param increment integer
--- @return integer
--- Adjusts a signed 16-bit integer (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`). Returns true if the value reaches the target and false otherwise
--- @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`
function camera_approach_s16_symmetric_bool(current, target, increment)
-- ...
end
--- @param current Pointer_integer
--- @param current integer
--- @param target integer
--- @param increment integer
--- @return integer
--- Smoothly transitions or directly sets a signed 16-bit value (`current`) to approach a target (`target`). Uses symmetric scaling for gradual or immediate adjustments
--- @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`
function set_or_approach_s16_symmetric(current, target, increment)
-- ...
end
--- @param current Pointer_number
--- @param current number
--- @param target number
--- @param increment number
--- @return integer
--- Adjusts a floating-point value (`current`) towards a target (`target`) symmetrically with a fixed increment (`increment`). Returns true if the value reaches the target and false otherwise
--- @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`
function camera_approach_f32_symmetric_bool(current, target, increment)
-- ...
end
@ -3364,10 +3371,10 @@ end
--- @param from Vec3f
--- @param to Vec3f
--- @param pitch Pointer_integer
--- @param yaw Pointer_integer
--- Calculates the pitch and yaw angles from one 3D position (`from`) to another (`to`). Updates the provided pointers with the computed pitch and yaw values
function calculate_angles(from, to, pitch, yaw)
--- @return integer pitch
--- @return integer yaw
--- Calculates and returns the pitch and yaw angles from one 3D position (`from`) to another (`to`)
function calculate_angles(from, to)
-- ...
end
@ -3453,7 +3460,8 @@ function shake_camera_yaw(pos, focus)
-- ...
end
--- @param roll Pointer_integer
--- @param roll integer
--- @return integer roll
--- Applies a roll-based shake effect to the camera. Simulates rotational disturbances caused by impacts or other events
function shake_camera_roll(roll)
-- ...
@ -3607,9 +3615,10 @@ end
--- @param c Camera
--- @param cPos Vec3f
--- @param avoidYaw Pointer_integer
--- @param avoidYaw integer
--- @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
function rotate_camera_around_walls(c, cPos, avoidYaw, yawRange)
-- ...
@ -5039,6 +5048,15 @@ function warp_special(arg)
-- ...
end
--- @param destLevel integer
--- @param destArea integer
--- @param destWarpNode integer
--- @param arg integer
--- Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This function is unstable and it's generally recommended to use `warp_to_level` instead
function initiate_warp(destLevel, destArea, destWarpNode, arg)
-- ...
end
--- @param param integer
--- @param levelNum integer
--- @return integer
@ -5439,6 +5457,24 @@ function resolve_and_return_wall_collisions_data(pos, offset, radius, collisionD
-- ...
end
--- @param pos Vec3f
--- @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
function vec3f_find_ceil(pos, height)
-- ...
end
--- @param pos Vec3f
--- @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
function vec3f_mario_ceil(pos, height)
-- ...
end
--- @param m MarioState
--- @param turnYaw integer
--- @return integer
@ -6584,11 +6620,11 @@ end
--- @param from Vec3f
--- @param to Vec3f
--- @param dist Pointer_number
--- @param pitch Pointer_integer
--- @param yaw Pointer_integer
--- Calculates the distance between two points in 3D space (`from` and `to`), as well as the pitch and yaw angles that describe the direction from `from` to `to`. The results are stored in `dist`, `pitch`, and `yaw`
function vec3f_get_dist_and_angle(from, to, dist, pitch, yaw)
--- @return number dist
--- @return integer pitch
--- @return integer yaw
--- Calculates the distance between two points in 3D space (`from` and `to`), as well as the pitch and yaw angles that describe the direction from `from` to `to`. Returns the calculated distance, pitch and yaw
function vec3f_get_dist_and_angle(from, to)
-- ...
end
@ -7917,10 +7953,10 @@ function obj_orient_graph(obj, normalX, normalY, normalZ)
-- ...
end
--- @param objFriction Pointer_number
--- @param floor_nY number
--- Orients an object with the given normals, typically the surface under the object.
function calc_obj_friction(objFriction, floor_nY)
--- @return number objFriction
--- Determines an object's forward speed multiplier.
function calc_obj_friction(floor_nY)
-- ...
end
@ -8276,11 +8312,12 @@ function obj_turn_pitch_toward_mario(m, targetOffsetY, turnAmount)
-- ...
end
--- @param px Pointer_number
--- @param px number
--- @param target number
--- @param delta number
--- @return integer
--- Approaches a `target` for `px` using `delta`
--- @return number px
--- Approaches a `target` for `px` using `delta`. Returns TRUE if `px` reaches `target`
function approach_f32_ptr(px, target, delta)
-- ...
end
@ -8333,14 +8370,16 @@ function obj_face_roll_approach(targetRoll, deltaRoll)
-- ...
end
--- @param angleVel Pointer_integer
--- @param angle Pointer_integer
--- @param angleVel integer
--- @param angle integer
--- @param targetAngle integer
--- @param targetSpeedProportion number
--- @param accel integer
--- @param minSpeed integer
--- @param maxSpeed integer
--- @return integer
--- @return integer angleVel
--- @return integer angle
function obj_smooth_turn(angleVel, angle, targetAngle, targetSpeedProportion, accel, minSpeed, maxSpeed)
-- ...
end
@ -8377,45 +8416,49 @@ function obj_random_fixed_turn(delta)
-- ...
end
--- @param scaleVel Pointer_number
--- @param scaleVel number
--- @param shootFireScale number
--- @param endScale number
--- @return integer
--- Begin by increasing the current object's scale by `*scaleVel`, and slowly decreasing `scaleVel`. Once the object starts to shrink, wait a bit, and then begin to scale the object toward `endScale`. The first time it reaches below `shootFireScale` during this time, return 1. Return -1 once it's reached endScale
--- @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
function obj_grow_then_shrink(scaleVel, shootFireScale, endScale)
-- ...
end
--- @param value Pointer_integer
--- @param vel Pointer_number
--- @param value integer
--- @param vel number
--- @param target integer
--- @param velCloseToZero number
--- @param accel number
--- @param slowdown number
--- @return integer
--- @return integer value
--- @return number vel
function oscillate_toward(value, vel, target, velCloseToZero, accel, slowdown)
-- ...
end
--- @param blinkTimer Pointer_integer
--- @param blinkTimer integer
--- @param baseCycleLength integer
--- @param cycleLengthRange integer
--- @param blinkLength integer
--- @return integer blinkTimer
function obj_update_blinking(blinkTimer, baseCycleLength, cycleLengthRange, blinkLength)
-- ...
end
--- @param targetYaw Pointer_integer
--- @return integer
--- Resolves "collisions" with the current object and other objects by offsetting the current object's position
function obj_resolve_object_collisions(targetYaw)
--- @return integer targetYaw
--- Resolves "collisions" with the current object and other objects by offsetting the current object's position. Returns TRUE and the target yaw if there is collision
function obj_resolve_object_collisions()
-- ...
end
--- @param targetYaw Pointer_integer
--- @return integer
--- Bounces the current object off of walls, edges, and objects using `*targetYaw`
function obj_bounce_off_walls_edges_objects(targetYaw)
--- @return integer targetYaw
--- Bounces the current object off of walls, edges, and objects. Returns TRUE and the target yaw if there is collision
function obj_bounce_off_walls_edges_objects()
-- ...
end
@ -8493,10 +8536,10 @@ function obj_move_for_one_second(endAction)
end
--- @param threshold number
--- @param distanceToPlayer Pointer_integer
--- @param angleToPlayer Pointer_integer
--- Moves the current object for specifically one second (`oTimer` < 30)
function treat_far_home_as_mario(threshold, distanceToPlayer, angleToPlayer)
--- @return integer distanceToPlayer
--- @return integer angleToPlayer
--- Treats far home as Mario. Returns the distance and angle to the nearest player
function treat_far_home_as_mario(threshold)
-- ...
end
@ -8513,9 +8556,11 @@ function obj_spit_fire(relativePosX, relativePosY, relativePosZ, scale, model, s
-- ...
end
--- @param bitSet Pointer_integer
--- @param bitSet integer
--- @param flag integer
--- @return integer
--- @return integer bitSet
--- Clears the `flag` from the `bitSet`
function clear_move_flag(bitSet, flag)
-- ...
end
@ -8581,10 +8626,11 @@ function cur_obj_forward_vel_approach_upward(target, increment)
-- ...
end
--- @param value Pointer_number
--- @param value number
--- @param target number
--- @param increment number
--- @return integer
--- @return number value
function approach_f32_signed(value, target, increment)
-- ...
end
@ -8905,9 +8951,9 @@ function cur_obj_find_nearest_pole()
end
--- @param behavior Pointer_BehaviorScript
--- @param dist Pointer_number
--- @return Object
function cur_obj_find_nearest_object_with_behavior(behavior, dist)
--- @return number dist
function cur_obj_find_nearest_object_with_behavior(behavior)
-- ...
end
@ -9084,8 +9130,9 @@ function cur_obj_update_floor_height_and_get_floor()
-- ...
end
--- @param value Pointer_number
--- @param value number
--- @param dragStrength number
--- @return number value
function apply_drag_to_value(value, dragStrength)
-- ...
end
@ -10301,7 +10348,7 @@ end
--- @param enable integer
--- Toggles collision settings for the ROM hack camera. This enables or disables specific collision behaviors in modded levels
function rom_hack_cam_set_collisions(enable)
function camera_romhack_set_collisions(enable)
-- ...
end
@ -10805,6 +10852,14 @@ function gfx_get_texture(cmd)
-- ...
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
function gfx_get_from_name(name)
-- ...
end
--- @param gfx Pointer_Gfx
--- @return string
--- Gets the name of a display list
@ -10868,6 +10923,14 @@ function gfx_delete_all()
-- ...
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
function vtx_get_from_name(name)
-- ...
end
--- @param vtx Pointer_Vtx
--- @return string
--- Gets the name of a vertex buffer
@ -11347,6 +11410,15 @@ function get_mario_anim_part_pos(m, animPart, pos)
-- ...
end
--- @param m MarioState
--- @param animPart integer
--- @param rot Vec3s
--- @return boolean
--- Retrieves the animated part rotation associated to `animPart` from the MarioState `m` and stores it into `rot`. Returns `true` on success or `false` on failure
function get_mario_anim_part_rot(m, animPart, rot)
-- ...
end
--- @return integer
--- Gets the current save file number (1-indexed)
function get_current_save_file_num()
@ -12300,6 +12372,16 @@ function find_wall_collisions(colData)
-- ...
end
--- @param posX number
--- @param posY number
--- @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)
function find_ceil(posX, posY, posZ)
-- ...
end
--- @param x number
--- @param y number
--- @param z number
@ -12318,6 +12400,16 @@ function find_floor_height(x, y, z)
-- ...
end
--- @param xPos number
--- @param yPos number
--- @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)
function find_floor(xPos, yPos, zPos)
-- ...
end
--- @param x number
--- @param z number
--- @return number
@ -12412,9 +12504,8 @@ function sync_object_is_owned_locally(syncId)
-- ...
end
--- @alias Pointer_integer integer
--- @alias Pointer_BehaviorScript BehaviorScript
--- @alias Pointer_number number
--- @alias Pointer_integer integer
--- @alias Pointer_Vec4s Vec4s
--- @alias Pointer_Trajectory Trajectory
--- @alias Pointer_Collision Collision

View file

@ -195,6 +195,7 @@
--- @field public RespawnShellBoxes integer
--- @field public MultipleCapCollection integer
--- @field public InfiniteRenderDistance integer
--- @field public ProcessLODs integer
--- @field public CourtyardBoosRequirement integer
--- @field public starsNeededForDialog StarsNeededForDialog
--- @field public dialogs BehaviorDialogs
@ -1085,6 +1086,7 @@
--- @field public torsoPos Vec3f
--- @field public heldObjLastPosition Vec3f
--- @field public animPartsPos Vec3f[]
--- @field public animPartsRot Vec3s[]
--- @field public currAnimPart integer
--- @field public updateTorsoTime integer
--- @field public updateHeadPosTime integer

View file

@ -3,6 +3,7 @@
#ifdef __cplusplus
#include "dynos.h"
#include <vector>
extern "C" {
#include "engine/behavior_script.h"
@ -158,6 +159,9 @@ public:
template <typename T>
T *Read(T *aBuffer, s32 aCount) const {
if (aCount <= 0 || aBuffer == NULL) {
return aBuffer;
}
if (mOffset + aCount * sizeof(T) <= mSize) {
memcpy(aBuffer, mData + mOffset, aCount * sizeof(T));
mOffset += aCount * sizeof(T);
@ -176,6 +180,9 @@ public:
template <typename T>
void Write(const T *aBuffer, s32 aCount) {
if (aCount <= 0 || aBuffer == NULL) {
return;
}
if (!mReadOnly) {
Grow(mOffset + aCount * sizeof(T));
memcpy(mData + mOffset, aBuffer, aCount * sizeof(T));
@ -304,6 +311,10 @@ public:
public:
void Read(BinFile *aFile) {
s32 _Length = aFile->Read<s32>();
if (_Length <= 0) {
Resize(0);
return;
}
Resize(_Length);
aFile->Read<T>(mBuffer, _Length);
}
@ -597,8 +608,8 @@ struct PackData {
bool mEnabled;
SysPath mPath;
String mDisplayName;
Array<Pair<const char *, GfxData *>> mGfxData;
Array<DataNode<TexData>*> mTextures;
std::vector<std::pair<std::string, GfxData *>> mGfxData;
std::vector<DataNode<TexData>*> mTextures;
bool mLoaded;
};
@ -878,7 +889,7 @@ void DynOS_Pack_SetEnabled(PackData* aPack, bool aEnabled);
PackData* DynOS_Pack_GetFromIndex(s32 aIndex);
PackData* DynOS_Pack_GetFromPath(const SysPath& aPath);
PackData* DynOS_Pack_Add(const SysPath& aPath);
Pair<const char *, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName);
std::pair<std::string, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName);
void DynOS_Pack_AddActor(PackData* aPackData, const char* aActorName, GfxData* aGfxData);
DataNode<TexData>* DynOS_Pack_GetTex(PackData* aPackData, const char* aTexName);
void DynOS_Pack_AddTex(PackData* aPackData, DataNode<TexData>* aTexData);
@ -927,7 +938,7 @@ void DynOS_Tex_ModShutdown();
// Lvl Manager
//
Array<Pair<const char*, GfxData*>> &DynOS_Lvl_GetArray();
std::vector<std::pair<std::string, GfxData *>> &DynOS_Lvl_GetArray();
LevelScript* DynOS_Lvl_GetScript(const char* aScriptEntryName);
void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilePath, const char *aLevelName);
GfxData* DynOS_Lvl_GetActiveGfx(void);
@ -942,7 +953,7 @@ void DynOS_Lvl_ModShutdown();
// Bhv Manager
//
Array<Pair<const char *, GfxData *>> &DynOS_Bhv_GetArray();
std::vector<std::pair<std::string, GfxData *>> &DynOS_Bhv_GetArray();
void DynOS_Bhv_Activate(s32 modIndex, const SysPath &aFilename, const char *aBehaviorName);
GfxData *DynOS_Bhv_GetActiveGfx(BehaviorScript *bhvScript);
bool DynOS_Bhv_GetActiveModIndex(BehaviorScript *bhvScript, s32 *modIndex, s32 *modFileIndex);

View file

@ -64,9 +64,6 @@ static void ValidateColSectionChange(GfxData* aGfxData, struct CollisionValidati
}
static void ValidateColInit(GfxData* aGfxData, struct CollisionValidationData& aColValData) {
if (aColValData.tokenIndex != 0) {
PrintDataError("COL_INIT found after the first token");
}
ValidateColSectionChange(aGfxData, aColValData, COL_SECTION_VTX);
}

View file

@ -13,6 +13,7 @@ typedef Pair<String, u32> PointerData;
static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
// Lights
for (auto& _Node : aGfxData->mLights) {
if (!_Node->mData) { continue; }
if (&_Node->mData->l[0] == aPtr) { // Light *, not Lights1 *
return { _Node->mName, 1 };
}
@ -23,6 +24,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
// Light0s
for (auto& _Node : aGfxData->mLight0s) {
if (!_Node->mData) { continue; }
if (&_Node->mData->l[0] == aPtr) { // Light *, not Lights1 *
return { _Node->mName, 1 };
}
@ -33,6 +35,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
// Light_ts
for (auto& _Node : aGfxData->mLightTs) {
if (!_Node->mData) { continue; }
if (&_Node->mData->col[0] == aPtr) {
return { _Node->mName, 1 };
}
@ -46,6 +49,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
// Ambient_ts
for (auto& _Node : aGfxData->mAmbientTs) {
if (!_Node->mData) { continue; }
if (&_Node->mData->col[0] == aPtr) {
return { _Node->mName, 1 };
}
@ -81,7 +85,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
return { _Node->mName, 0 };
}
}
// Collisions
for (auto& _Node : aGfxData->mCollisions) {
if (_Node->mData == aPtr) {
@ -153,7 +157,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
if (builtinCol != NULL) {
return { builtinCol, 0 };
}
// Built-in Animations
auto builtinAnim = DynOS_Builtin_Anim_GetFromData((const Animation *)aPtr);
if (builtinAnim != NULL) {
@ -360,7 +364,7 @@ static void *GetPointerFromData(GfxData *aGfxData, const String &aPtrName, u32 a
return (void *) (_Node->mData + aPtrData);
}
}
// Behavior scripts
for (auto &_Node : aGfxData->mBehaviorScripts) {
if (_Node->mName == aPtrName) {
@ -432,7 +436,7 @@ static void *GetPointerFromData(GfxData *aGfxData, const String &aPtrName, u32 a
if (builtinCol != NULL) {
return (void*)builtinCol;
}
// Built-in Animations
auto builtinAnim = DynOS_Builtin_Anim_GetFromName(aPtrName.begin());
if (builtinAnim != NULL) {

View file

@ -54,7 +54,9 @@ static s32 sDynosCustomLevelSlot[LEVEL_UNKNOWN_2 + 1] = { 0 };
u64 DynOS_Level_CmdGet(void *aCmd, u64 aOffset) {
u64 _Offset = (((aOffset) & 3llu) | (((aOffset) & ~3llu) << (sizeof(void *) >> 3llu)));
return *((u64 *) (u64(aCmd) + _Offset));
u64 value = 0;
memcpy(&value, (void *) ((uintptr_t) aCmd + _Offset), sizeof(value));
return value;
}
LvlCmd *DynOS_Level_CmdNext(LvlCmd *aCmd) {

View file

@ -18,8 +18,8 @@ static std::map<const void*, ActorGfx>& DynosValidActors() {
return sDynosValidActors;
}
static Array<Pair<const char*, void *>>& DynosCustomActors() {
static Array<Pair<const char*, void *>> sDynosCustomActors;
static std::vector<std::pair<std::string, void *>> &DynosCustomActors() {
static std::vector<std::pair<std::string, void *>> sDynosCustomActors;
return sDynosCustomActors;
}
@ -35,14 +35,11 @@ std::map<const void *, ActorGfx> &DynOS_Actor_GetValidActors() {
bool DynOS_Actor_AddCustom(s32 aModIndex, s32 aModFileIndex, const SysPath &aFilename, const char *aActorName) {
const void* georef = DynOS_Builtin_Actor_GetFromName(aActorName);
u16 actorLen = strlen(aActorName);
char* actorName = (char*)calloc(1, sizeof(char) * (actorLen + 1));
strcpy(actorName, aActorName);
std::string actorName = aActorName;
GfxData *_GfxData = DynOS_Actor_LoadFromBinary(aFilename, actorName, aFilename, false);
GfxData *_GfxData = DynOS_Actor_LoadFromBinary(aFilename, actorName.c_str(), aFilename, false);
if (!_GfxData) {
PrintError(" ERROR: Couldn't load Actor Binary \"%s\" from \"%s\"", actorName, aFilename.c_str());
free(actorName);
PrintError(" ERROR: Couldn't load Actor Binary \"%s\" from \"%s\"", actorName.c_str(), aFilename.c_str());
return false;
}
_GfxData->mModIndex = aModIndex;
@ -50,8 +47,7 @@ bool DynOS_Actor_AddCustom(s32 aModIndex, s32 aModFileIndex, const SysPath &aFil
void* geoLayout = (*(_GfxData->mGeoLayouts.end() - 1))->mData;
if (!geoLayout) {
PrintError(" ERROR: Couldn't load geo layout for \"%s\"", actorName);
free(actorName);
PrintError(" ERROR: Couldn't load geo layout for \"%s\"", actorName.c_str());
return false;
}
@ -62,21 +58,19 @@ bool DynOS_Actor_AddCustom(s32 aModIndex, s32 aModFileIndex, const SysPath &aFil
actorGfx.mPackIndex = MOD_PACK_INDEX;
actorGfx.mGraphNode = (GraphNode *) DynOS_Model_LoadGeo(&id, MODEL_POOL_SESSION, geoLayout, true);
if (!actorGfx.mGraphNode) {
PrintError(" ERROR: Couldn't load graph node for \"%s\"", actorName);
free(actorName);
PrintError(" ERROR: Couldn't load graph node for \"%s\"", actorName.c_str());
return false;
}
actorGfx.mGraphNode->georef = georef;
// Add to custom actors
if (georef == NULL) {
DynosCustomActors().Add({ strdup(actorName), geoLayout });
DynosCustomActors().emplace_back(actorName, geoLayout);
georef = geoLayout;
}
// Add to list
DynOS_Actor_Valid(georef, actorGfx);
free(actorName);
return true;
}
@ -95,7 +89,7 @@ const void *DynOS_Actor_GetLayoutFromName(const char *aActorName) {
// check custom actors
for (auto& pair : DynosCustomActors()) {
if (!strcmp(aActorName, pair.first)) {
if (pair.first == aActorName) {
return pair.second;
}
}
@ -297,12 +291,10 @@ void DynOS_Actor_RegisterModifiedGraphNode(GraphNode *aNode) {
void DynOS_Actor_ModShutdown() {
auto& _DynosCustomActors = DynosCustomActors();
while (_DynosCustomActors.Count() > 0) {
auto& pair = _DynosCustomActors[0];
for (auto &pair : _DynosCustomActors) {
DynOS_Actor_Invalid(pair.second, MOD_PACK_INDEX);
free((void*)pair.first);
_DynosCustomActors.Remove(0);
}
_DynosCustomActors.clear();
auto& _ValidActors = DynosValidActors();
for (auto it = _ValidActors.cbegin(); it != _ValidActors.cend();) {

View file

@ -6,8 +6,8 @@ extern "C" {
#include "pc/lua/smlua_hooks.h"
}
Array<Pair<const char *, GfxData *>> &DynOS_Bhv_GetArray() {
static Array<Pair<const char *, GfxData *>> sDynosCustomBehaviorScripts;
std::vector<std::pair<std::string, GfxData *>> &DynOS_Bhv_GetArray() {
static std::vector<std::pair<std::string, GfxData *>> sDynosCustomBehaviorScripts;
return sDynosCustomBehaviorScripts;
}
@ -15,44 +15,37 @@ void DynOS_Bhv_Activate(s32 modIndex, const SysPath &aFilename, const char *aBeh
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
// check for duplicates
for (s32 i = 0; i < _CustomBehaviorScripts.Count(); ++i) {
if (!strcmp(_CustomBehaviorScripts[i].first, aBehaviorName)) {
for (auto &behavior : _CustomBehaviorScripts) {
if (behavior.first == aBehaviorName) {
return;
}
}
u16 behaviorLen = strlen(aBehaviorName);
char *behaviorName = (char *)calloc(1, sizeof(char) * (behaviorLen + 1));
strcpy(behaviorName, aBehaviorName);
std::string behaviorName = aBehaviorName;
GfxData *_Node = DynOS_Bhv_LoadFromBinary(aFilename, behaviorName);
if (!_Node) {
free(behaviorName);
return;
}
GfxData *_Node = DynOS_Bhv_LoadFromBinary(aFilename, behaviorName.c_str());
if (!_Node) { return; }
// Remember index
_Node->mModIndex = modIndex;
// Add to behaviors
_CustomBehaviorScripts.Add({ behaviorName, _Node });
_CustomBehaviorScripts.emplace_back(behaviorName, _Node);
}
void DynOS_Bhv_ModShutdown() {
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
while (_CustomBehaviorScripts.Count() > 0) {
auto &pair = _CustomBehaviorScripts[0];
for (auto &pair : _CustomBehaviorScripts) {
Delete(pair.second);
free((void *)pair.first);
_CustomBehaviorScripts.Remove(0);
}
_CustomBehaviorScripts.clear();
}
GfxData *DynOS_Bhv_GetActiveGfx(BehaviorScript *bhvScript) {
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
for (s32 i = 0; i < _CustomBehaviorScripts.Count(); ++i) {
auto &gfxData = _CustomBehaviorScripts[i].second;
for (auto &behavior : _CustomBehaviorScripts) {
auto &gfxData = behavior.second;
auto &scripts = gfxData->mBehaviorScripts;
if (scripts.Count() == 0) { continue; }
if (bhvScript == scripts[scripts.Count() - 1]->mData) {
@ -65,8 +58,8 @@ GfxData *DynOS_Bhv_GetActiveGfx(BehaviorScript *bhvScript) {
bool DynOS_Bhv_GetActiveModIndex(BehaviorScript *bhvScript, s32 *modIndex, s32 *modFileIndex) {
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
for (s32 i = 0; i < _CustomBehaviorScripts.Count(); ++i) {
auto &gfxData = _CustomBehaviorScripts[i].second;
for (auto &behavior : _CustomBehaviorScripts) {
auto &gfxData = behavior.second;
auto &scripts = gfxData->mBehaviorScripts;
if (scripts.Count() == 0) { continue; }
if (bhvScript == scripts[scripts.Count() - 1]->mData) {
@ -97,17 +90,17 @@ const char *DynOS_Bhv_GetToken(BehaviorScript *bhvScript, u32 index) {
void DynOS_Bhv_HookAllCustomBehaviors() {
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
for (s32 i = 0; i < _CustomBehaviorScripts.Count(); ++i) {
auto &scriptName = _CustomBehaviorScripts[i].first;
auto &aGfxData = _CustomBehaviorScripts[i].second;
for (auto &behavior : _CustomBehaviorScripts) {
auto &scriptName = behavior.first;
auto &aGfxData = behavior.second;
if (aGfxData->mBehaviorScripts.Count() == 0) { continue; }
auto *node = aGfxData->mBehaviorScripts[aGfxData->mBehaviorScripts.Count() - 1];
if (node == nullptr) { continue; }
auto &script = node->mData;
// Theres currently no better place but to do this here.
if (smlua_hook_custom_bhv(script, scriptName) == 0) {
PrintDataError(" ERROR: Failed to add custom behavior '%s'!", scriptName);
if (smlua_hook_custom_bhv(script, scriptName.c_str()) == 0) {
PrintDataError(" ERROR: Failed to add custom behavior '%s'!", scriptName.c_str());
}
}
}
}

View file

@ -4,8 +4,8 @@ extern "C" {
#include "pc/mods/mod_fs.h"
}
static Array<Pair<const char*, DataNode<Collision>*>>& DynosCollisions() {
static Array<Pair<const char*, DataNode<Collision>*>> sDynosCollisions;
static std::vector<std::pair<std::string, DataNode<Collision>*>> &DynosCollisions() {
static std::vector<std::pair<std::string, DataNode<Collision>*>> sDynosCollisions;
return sDynosCollisions;
}
@ -13,26 +13,18 @@ bool DynOS_Col_Activate(const SysPath &aFilename, const char *aCollisionName) {
auto& _DynosCollisions = DynosCollisions();
// check for duplicates
for (s32 i = 0; i < _DynosCollisions.Count(); ++i) {
if (!strcmp(_DynosCollisions[i].first, aCollisionName)) {
for (auto &collision : _DynosCollisions) {
if (collision.first == aCollisionName) {
return true;
}
}
// Allocate name
u16 collisionLen = strlen(aCollisionName);
char* collisionName = (char*)calloc(1, sizeof(char) * (collisionLen + 1));
strcpy(collisionName, aCollisionName);
// Load
DataNode<Collision>* _Node = DynOS_Col_LoadFromBinary(aFilename, collisionName);
if (!_Node) {
free(collisionName);
return false;
}
DataNode<Collision>* _Node = DynOS_Col_LoadFromBinary(aFilename, aCollisionName);
if (!_Node) { return false; }
// Add to collisions
_DynosCollisions.Add({ collisionName, _Node });
_DynosCollisions.emplace_back(aCollisionName, _Node);
return true;
}
@ -50,9 +42,9 @@ Collision* DynOS_Col_Get(const char* collisionName) {
}
// check mod actor collisions
for (s32 i = 0; i < _DynosCollisions.Count(); ++i) {
if (!strcmp(_DynosCollisions[i].first, collisionName)) {
return _DynosCollisions[i].second->mData;
for (auto &collision : _DynosCollisions) {
if (collision.first == collisionName) {
return collision.second->mData;
}
}
@ -69,10 +61,8 @@ Collision* DynOS_Col_Get(const char* collisionName) {
void DynOS_Col_ModShutdown() {
auto& _DynosCollisions = DynosCollisions();
while (_DynosCollisions.Count() > 0) {
auto& pair = _DynosCollisions[0];
free((void*)pair.first);
for (auto &pair : _DynosCollisions) {
Delete(pair.second);
_DynosCollisions.Remove(0);
}
_DynosCollisions.clear();
}

View file

@ -6,26 +6,26 @@ extern "C" {
}
struct OverrideLevelScript {
const void* originalScript;
const void* newScript;
GfxData* gfxData;
const void *originalScript;
const void *newScript;
GfxData *gfxData;
};
static Array<struct OverrideLevelScript>& DynosOverrideLevelScripts() {
static Array<struct OverrideLevelScript> sDynosOverrideLevelScripts;
static std::vector<OverrideLevelScript> &DynosOverrideLevelScripts() {
static std::vector<OverrideLevelScript> sDynosOverrideLevelScripts;
return sDynosOverrideLevelScripts;
}
Array<Pair<const char*, GfxData*>> &DynOS_Lvl_GetArray() {
static Array<Pair<const char*, GfxData*>> sDynosCustomLevelScripts;
std::vector<std::pair<std::string, GfxData *>> &DynOS_Lvl_GetArray() {
static std::vector<std::pair<std::string, GfxData *>> sDynosCustomLevelScripts;
return sDynosCustomLevelScripts;
}
LevelScript* DynOS_Lvl_GetScript(const char* aScriptEntryName) {
auto& _CustomLevelScripts = DynOS_Lvl_GetArray();
for (s32 i = 0; i < _CustomLevelScripts.Count(); ++i) {
for (size_t i = 0; i < _CustomLevelScripts.size(); ++i) {
auto& pair = _CustomLevelScripts[i];
if (!strcmp(pair.first, aScriptEntryName)) {
if (pair.first == aScriptEntryName) {
auto& newScripts = pair.second->mLevelScripts;
auto& newScriptNode = newScripts[newScripts.Count() - 1];
return newScriptNode->mData;
@ -38,17 +38,16 @@ void DynOS_Lvl_ModShutdown() {
DynOS_Level_Unoverride();
auto& _CustomLevelScripts = DynOS_Lvl_GetArray();
while (_CustomLevelScripts.Count() > 0) {
if (!_CustomLevelScripts.empty()) {
for (auto& pair : _CustomLevelScripts) {
DynOS_Tex_Invalid(pair.second);
Delete(pair.second);
free((void*)pair.first);
}
_CustomLevelScripts.Clear();
_CustomLevelScripts.clear();
}
auto& _OverrideLevelScripts = DynosOverrideLevelScripts();
_OverrideLevelScripts.Clear();
_OverrideLevelScripts.clear();
}
void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilename, const char *aLevelName) {
@ -59,19 +58,16 @@ void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilename, const char *aLev
DynOS_Level_Init();
// check for duplicates
for (s32 i = 0; i < _CustomLevelScripts.Count(); ++i) {
if (!strcmp(_CustomLevelScripts[i].first, aLevelName)) {
for (auto &customLevel : _CustomLevelScripts) {
if (customLevel.first == aLevelName) {
return;
}
}
u16 levelLen = strlen(aLevelName);
char* levelName = (char*)calloc(1, sizeof(char) * (levelLen + 1));
strcpy(levelName, aLevelName);
std::string levelName = aLevelName;
GfxData* _Node = DynOS_Lvl_LoadFromBinary(aFilename, levelName);
GfxData* _Node = DynOS_Lvl_LoadFromBinary(aFilename, levelName.c_str());
if (!_Node) {
free(levelName);
return;
}
@ -79,7 +75,7 @@ void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilename, const char *aLev
_Node->mModIndex = modIndex;
// Add to levels
_CustomLevelScripts.Add({ levelName, _Node });
_CustomLevelScripts.emplace_back(levelName, _Node);
DynOS_Tex_Valid(_Node);
// Override vanilla script
@ -96,13 +92,13 @@ void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilename, const char *aLev
}
DynOS_Level_Override((void*)originalScript, newScriptNode->mData, modIndex);
_OverrideLevelScripts.Add({ originalScript, newScriptNode->mData, _Node});
_OverrideLevelScripts.push_back({ originalScript, newScriptNode->mData, _Node});
}
GfxData* DynOS_Lvl_GetActiveGfx(void) {
auto& _CustomLevelScripts = DynOS_Lvl_GetArray();
for (s32 i = 0; i < _CustomLevelScripts.Count(); ++i) {
auto& gfxData = _CustomLevelScripts[i].second;
for (auto &lvlEntry : _CustomLevelScripts) {
auto& gfxData = lvlEntry.second;
auto& scripts = gfxData->mLevelScripts;
for (auto& s : scripts) {
if (gLevelScriptActive == s->mData) {
@ -200,4 +196,3 @@ void *DynOS_Lvl_Override(void *aCmd) {
return aCmd;
}

View file

@ -10,8 +10,8 @@ struct RegisteredMovtexQC {
s16 type;
};
static Array<RegisteredMovtexQC>& DynosRegisteredMovtexQCs() {
static Array<RegisteredMovtexQC> sDynosRegisteredMovtexQCs;
static std::vector<RegisteredMovtexQC> &DynosRegisteredMovtexQCs() {
static std::vector<RegisteredMovtexQC> sDynosRegisteredMovtexQCs;
return sDynosRegisteredMovtexQCs;
}
@ -28,7 +28,7 @@ void DynOS_MovtexQC_Register(const char* name, s16 level, s16 area, s16 type) {
for (auto& node : lvlPair.second->mMovtexQCs) {
if (node->mName == name) {
// add it
_DynosRegisteredMovtexQCs.Add({
_DynosRegisteredMovtexQCs.push_back({
.dataNode = node,
.level = level,
.area = area,
@ -70,9 +70,8 @@ DataNode<MovtexQC>* DynOS_MovtexQC_GetFromIndex(s32 index) {
void DynOS_MovtexQC_ModShutdown() {
auto& _DynosRegisteredMovtexQCs = DynosRegisteredMovtexQCs();
while (_DynosRegisteredMovtexQCs.Count() > 0) {
auto& registered = _DynosRegisteredMovtexQCs[0];
for (auto &registered : _DynosRegisteredMovtexQCs) {
Delete(registered.dataNode);
_DynosRegisteredMovtexQCs.Remove(0);
}
_DynosRegisteredMovtexQCs.clear();
}

View file

@ -1,10 +1,11 @@
#include <deque>
#include "dynos.cpp.h"
extern "C" {
#include "engine/graph_node.h"
}
static Array<PackData>& DynosPacks() {
static Array<PackData> sDynosPacks;
static std::deque<PackData>& DynosPacks() {
static std::deque<PackData> sDynosPacks;
return sDynosPacks;
}
@ -37,8 +38,8 @@ static void ScanPackBins(struct PackData* aPack) {
}
}
static void DynOS_Pack_ActivateActor(s32 aPackIndex, Pair<const char *, GfxData *>& pair) {
const char* aActorName = pair.first;
static void DynOS_Pack_ActivateActor(s32 aPackIndex, std::pair<std::string, GfxData *> &pair) {
const char* aActorName = pair.first.c_str();
GfxData* aGfxData = pair.second;
auto& geoNode = *(aGfxData->mGeoLayouts.end() - 1);
@ -64,13 +65,13 @@ static void DynOS_Pack_ActivateActor(s32 aPackIndex, Pair<const char *, GfxData
DynOS_Actor_Valid(georef, actorGfx);
}
static void DynOS_Pack_DeactivateActor(s32 aPackIndex, Pair<const char *, GfxData *>& pair) {
const char* aActorName = pair.first;
static void DynOS_Pack_DeactivateActor(s32 aPackIndex, std::pair<std::string, GfxData *> &pair) {
const char* aActorName = pair.first.c_str();
const void* georef = DynOS_Builtin_Actor_GetFromName(aActorName);
DynOS_Actor_Invalid(georef, aPackIndex);
// figure out which actor to replace it with
Pair<const char *, GfxData *>* _Replacement = NULL;
std::pair<std::string, GfxData *> *_Replacement = NULL;
s32 _ReplacementPackIndex = 0;
for (auto& _Pack : DynosPacks()) {
if (!_Pack.mEnabled) { continue; }
@ -86,7 +87,7 @@ static void DynOS_Pack_DeactivateActor(s32 aPackIndex, Pair<const char *, GfxDat
}
s32 DynOS_Pack_GetCount() {
return DynosPacks().Count();
return DynosPacks().size();
}
void DynOS_Pack_SetEnabled(PackData* aPack, bool aEnabled) {
@ -118,7 +119,7 @@ void DynOS_Pack_SetEnabled(PackData* aPack, bool aEnabled) {
PackData* DynOS_Pack_GetFromIndex(s32 aIndex) {
auto& _DynosPacks = DynosPacks();
if (aIndex < 0 || aIndex >= _DynosPacks.Count()) {
if (aIndex < 0 || aIndex >= _DynosPacks.size()) {
return NULL;
}
return &_DynosPacks[aIndex];
@ -163,7 +164,7 @@ PackData* DynOS_Pack_Add(const SysPath& aPath) {
auto& _DynosPacks = DynosPacks();
s32 index = _DynosPacks.Count();
s32 index = _DynosPacks.size();
const PackData packData = {
.mIndex = index,
.mEnabled = false,
@ -173,21 +174,21 @@ PackData* DynOS_Pack_Add(const SysPath& aPath) {
.mTextures = {},
.mLoaded = false,
};
_DynosPacks.Add(packData);
_DynosPacks.push_back(packData);
PackData* _Pack = &_DynosPacks[index];
PackData* _Pack = &_DynosPacks.back();
_Pack->mDisplayName = displayName;
return _Pack;
}
Pair<const char *, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName) {
std::pair<std::string, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName) {
if (aPackData == NULL || aActorName == NULL) {
return NULL;
}
for (auto& pair : aPackData->mGfxData) {
if (!strcmp(pair.first, aActorName)) {
if (pair.first == aActorName) {
return &pair;
}
}
@ -199,8 +200,8 @@ void DynOS_Pack_AddActor(PackData* aPackData, const char* aActorName, GfxData* a
return;
}
s32 index = aPackData->mGfxData.Count();
aPackData->mGfxData.Add({ strdup(aActorName), aGfxData });
s32 index = aPackData->mGfxData.size();
aPackData->mGfxData.emplace_back(aActorName, aGfxData);
if (aPackData->mEnabled) {
DynOS_Pack_ActivateActor(aPackData->mIndex, aPackData->mGfxData[index]);
@ -225,7 +226,7 @@ void DynOS_Pack_AddTex(PackData* aPackData, DataNode<TexData>* aTexData) {
return;
}
aPackData->mTextures.Add(aTexData);
aPackData->mTextures.push_back(aTexData);
if (aPackData->mEnabled) {
DynOS_Tex_Activate(aTexData, false);

View file

@ -1,5 +1,7 @@
#include <map>
#include <set>
#include <string>
#include <vector>
#include "dynos.cpp.h"
extern "C" {
#include "pc/gfx/gfx.h"
@ -32,13 +34,13 @@ static std::set<DataNode<TexData> *>& DynosValidTextures() {
return sDynosValidTextures;
}
static Array<DataNode<TexData> *>& DynosScheduledInvalidTextures() {
static Array<DataNode<TexData> *> sDynosScheduledInvalidTextures;
static std::vector<DataNode<TexData> *> &DynosScheduledInvalidTextures() {
static std::vector<DataNode<TexData> *> sDynosScheduledInvalidTextures;
return sDynosScheduledInvalidTextures;
}
static Array<Pair<const char*, DataNode<TexData>*>>& DynosCustomTexs() {
static Array<Pair<const char*, DataNode<TexData>*>> sDynosCustomTexs;
static std::vector<std::pair<std::string, DataNode<TexData> *>> &DynosCustomTexs() {
static std::vector<std::pair<std::string, DataNode<TexData> *>> sDynosCustomTexs;
return sDynosCustomTexs;
}
@ -284,17 +286,17 @@ void DynOS_Tex_Valid(GfxData* aGfxData) {
void DynOS_Tex_Invalid(GfxData* aGfxData) {
auto& schedule = DynosScheduledInvalidTextures();
for (auto &_Texture : aGfxData->mTextures) {
schedule.Add(_Texture);
schedule.push_back(_Texture);
}
}
void DynOS_Tex_Update() {
auto& schedule = DynosScheduledInvalidTextures();
if (schedule.Count() == 0) { return; }
if (schedule.empty()) { return; }
for (auto &_Texture : schedule) {
DynosValidTextures().erase(_Texture);
}
schedule.Clear();
schedule.clear();
}
//
@ -368,8 +370,8 @@ void DynOS_Tex_Activate(DataNode<TexData>* aNode, bool aCustomTexture) {
// check for duplicates
auto& _DynosCustomTexs = DynosCustomTexs();
bool _HasCustomTex = false;
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
if (!strcmp(_DynosCustomTexs[i].first, aNode->mName.begin())) {
for (auto &customTex : _DynosCustomTexs) {
if (customTex.first == aNode->mName.begin()) {
_HasCustomTex = true;
break;
}
@ -389,7 +391,7 @@ void DynOS_Tex_Activate(DataNode<TexData>* aNode, bool aCustomTexture) {
// Add to custom textures
if (!_HasCustomTex && aCustomTexture) {
_DynosCustomTexs.Add({ aNode->mName.begin(), aNode });
_DynosCustomTexs.emplace_back(aNode->mName.begin(), aNode);
}
// Add to valid
@ -402,10 +404,11 @@ void DynOS_Tex_Deactivate(DataNode<TexData>* aNode) {
// remove from custom textures
auto& _DynosCustomTexs = DynosCustomTexs();
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
for (size_t i = 0; i < _DynosCustomTexs.size();) {
if (_DynosCustomTexs[i].second == aNode) {
_DynosCustomTexs.Remove(i);
i--;
_DynosCustomTexs.erase(_DynosCustomTexs.begin() + i);
} else {
++i;
}
}
@ -421,28 +424,22 @@ void DynOS_Tex_Deactivate(DataNode<TexData>* aNode) {
// Remove from valid
auto& _Schedule = DynosScheduledInvalidTextures();
_Schedule.Add(aNode);
_Schedule.push_back(aNode);
}
bool DynOS_Tex_AddCustom(const SysPath &aFilename, const char *aTexName) {
auto& _DynosCustomTexs = DynosCustomTexs();
// check for duplicates
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
if (!strcmp(_DynosCustomTexs[i].first, aTexName)) {
for (auto &customTex : _DynosCustomTexs) {
if (customTex.first == aTexName) {
return true;
}
}
// Allocate name
u16 texLen = strlen(aTexName);
char* _TexName = (char*)calloc(1, sizeof(char) * (texLen + 1));
strcpy(_TexName, aTexName);
// Load
SysPath _PackFolder = "";
DataNode<TexData>* _Node = DynOS_Tex_LoadFromBinary(_PackFolder, aFilename, _TexName, false);
free(_TexName);
DataNode<TexData>* _Node = DynOS_Tex_LoadFromBinary(_PackFolder, aFilename, aTexName, false);
if (_Node) {
DynOS_Tex_Activate(_Node, true);
return true;
@ -463,9 +460,9 @@ bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) {
// check custom textures
auto& _DynosCustomTexs = DynosCustomTexs();
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
if (!strcmp(_DynosCustomTexs[i].first, aTexName)) {
auto& _Data = _DynosCustomTexs[i].second->mData;
for (auto &customTex : _DynosCustomTexs) {
if (customTex.first == aTexName) {
auto& _Data = customTex.second->mData;
// load the texture if it hasn't been yet
if (_Data->mRawData.begin() == NULL) {
@ -529,9 +526,9 @@ bool DynOS_Tex_GetFromData(const Texture *aTex, struct TextureInfo* aOutTexInfo)
static DataNode<TexData> *DynOS_Lua_Tex_RetrieveNode(const char* aName) {
auto& _DynosCustomTexs = DynosCustomTexs();
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
if (!strcmp(_DynosCustomTexs[i].first, aName)) {
return _DynosCustomTexs[i].second;
for (auto &customTex : _DynosCustomTexs) {
if (customTex.first == aName) {
return customTex.second;
}
}
@ -567,13 +564,25 @@ void DynOS_Tex_Override_Set(const char* aTexName, struct TextureInfo* aOverrideT
void DynOS_Tex_Override_Reset(const char* aTexName) {
// Override texture
const Texture* _BuiltinTex = DynOS_Builtin_Tex_GetFromName(aTexName);
if (!_BuiltinTex) { return; }
const Texture* _BuiltinTexture = DynOS_Builtin_Tex_GetFromName(aTexName);
DataNode<TexData>* _BuiltinTexData;
if (!_BuiltinTexture) {
_BuiltinTexData = DynOS_Lua_Tex_RetrieveNode(aTexName);
if (!_BuiltinTexData) { return; }
}
auto& _DynosOverrideLuaTextures = DynosOverrideLuaTextures();
auto _Override = _DynosOverrideLuaTextures[_BuiltinTex];
if (_Override) {
_DynosOverrideLuaTextures.erase(_BuiltinTex);
if (_BuiltinTexture) {
auto& _DynosOverrideLuaTextures = DynosOverrideLuaTextures();
auto _Override = _DynosOverrideLuaTextures[_BuiltinTexture];
if (_Override) {
_DynosOverrideLuaTextures.erase(_BuiltinTexture);
}
} else {
auto& _DynosOverrideLuaTexData = DynosOverrideLuaTexData();
auto _Override = _DynosOverrideLuaTexData[_BuiltinTexData];
if (_Override) {
_DynosOverrideLuaTexData.erase(_BuiltinTexData);
}
}
}
@ -582,7 +591,7 @@ void DynOS_Tex_ModShutdown() {
_DynosOverrideLuaTextures.clear();
auto& _DynosCustomTexs = DynosCustomTexs();
while (_DynosCustomTexs.Count() > 0) {
while (!_DynosCustomTexs.empty()) {
auto& pair = _DynosCustomTexs[0];
DynOS_Tex_Deactivate(pair.second);
}

View file

@ -13,12 +13,9 @@ extern "C" {
#include "game/object_list_processor.h"
#include "pc/network/packets/packet.h"
#include "pc/lua/smlua_hooks.h"
extern s8 gDialogBoxState;
extern s16 gMenuMode;
extern s32 gWdwWaterLevelSet;
extern u8 sSpawnTypeFromWarpBhv[];
extern void set_mario_initial_action(struct MarioState *, u32, u32);
extern void set_play_mode(s16);
}
//

View file

@ -257,21 +257,22 @@ Plays the penguin walking sound
## [update_angle_from_move_flags](#update_angle_from_move_flags)
### Description
Updates the current object's angle from its move flags
Computes and returns an angle depending on the current object's angle and move flags
### Lua Example
`local integerValue = update_angle_from_move_flags(angle)`
`local integerValue, angle = update_angle_from_move_flags(angle)`
### Parameters
| Field | Type |
| ----- | ---- |
| angle | `Pointer` <`integer`> |
| angle | `integer` |
### Returns
- `integer`
- `integer`
### C Prototype
`s32 update_angle_from_move_flags(s32 *angle);`
`s32 update_angle_from_move_flags(INOUT s32 *angle);`
[:arrow_up_small:](#)
@ -12011,7 +12012,7 @@ Behavior loop function for the lighting engine point light
Spawns a Star with an ID corresponding to the current object's first behavior parameter byte
### Lua Example
`local ObjectValue = spawn_default_star(x, y, z)`
`local objectValue = spawn_default_star(x, y, z)`
### Parameters
| Field | Type |
@ -12021,7 +12022,7 @@ Spawns a Star with an ID corresponding to the current object's first behavior pa
| z | `number` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* spawn_default_star(f32 x, f32 y, f32 z);`
@ -12036,7 +12037,7 @@ Spawns a Star with an ID corresponding to the current object's first behavior pa
Spawns a Red Coin cutscene star with an ID corresponding to the current object's first behavior parameter byte
### Lua Example
`local ObjectValue = spawn_red_coin_cutscene_star(x, y, z)`
`local objectValue = spawn_red_coin_cutscene_star(x, y, z)`
### Parameters
| Field | Type |
@ -12046,7 +12047,7 @@ Spawns a Red Coin cutscene star with an ID corresponding to the current object's
| z | `number` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* spawn_red_coin_cutscene_star(f32 x, f32 y, f32 z);`
@ -12061,7 +12062,7 @@ Spawns a Red Coin cutscene star with an ID corresponding to the current object's
Spawns a Star that won't make Mario exit the level with an ID corresponding to the current object's first behavior parameter byte
### Lua Example
`local ObjectValue = spawn_no_exit_star(x, y, z)`
`local objectValue = spawn_no_exit_star(x, y, z)`
### Parameters
| Field | Type |
@ -12071,7 +12072,7 @@ Spawns a Star that won't make Mario exit the level with an ID corresponding to t
| z | `number` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* spawn_no_exit_star(f32 x, f32 y, f32 z);`

View file

@ -180,7 +180,7 @@ Gets a behavior ID from a behavior script
| behavior | `Pointer` <`BehaviorScript`> |
### Returns
[enum BehaviorId](constants.md#enum-BehaviorId)
- [enum BehaviorId](constants.md#enum-BehaviorId)
### C Prototype
`enum BehaviorId get_id_from_behavior(const BehaviorScript* behavior);`
@ -203,7 +203,7 @@ Gets a behavior ID from only vanilla behavior scripts
| behavior | `Pointer` <`BehaviorScript`> |
### Returns
[enum BehaviorId](constants.md#enum-BehaviorId)
- [enum BehaviorId](constants.md#enum-BehaviorId)
### C Prototype
`enum BehaviorId get_id_from_vanilla_behavior(const BehaviorScript* behavior);`
@ -218,7 +218,7 @@ Gets a behavior ID from only vanilla behavior scripts
Gets a behavior script from a behavior ID
### Lua Example
`local PointerValue = get_behavior_from_id(id)`
`local pointerValue = get_behavior_from_id(id)`
### Parameters
| Field | Type |
@ -272,7 +272,7 @@ gets a behavior ID from a behavior name
| name | `string` |
### Returns
[enum BehaviorId](constants.md#enum-BehaviorId)
- [enum BehaviorId](constants.md#enum-BehaviorId)
### C Prototype
`enum BehaviorId get_id_from_behavior_name(const char* name);`
@ -537,7 +537,7 @@ Converts an object's position to a `Vec3f` format. Useful for aligning object be
- None
### C Prototype
`void object_pos_to_vec3f(OUT Vec3f dst, struct Object *o);`
`void object_pos_to_vec3f(VEC_OUT Vec3f dst, struct Object *o);`
[:arrow_up_small:](#)
@ -585,7 +585,7 @@ Converts an object's face angle to a `Vec3s` format
- None
### C Prototype
`void object_face_angle_to_vec3s(OUT Vec3s dst, struct Object *o);`
`void object_face_angle_to_vec3s(VEC_OUT Vec3s dst, struct Object *o);`
[:arrow_up_small:](#)
@ -633,7 +633,7 @@ Converts an object's move angle to a `Vec3s` format
- None
### C Prototype
`void object_move_angle_to_vec3s(OUT Vec3s dst, struct Object *o);`
`void object_move_angle_to_vec3s(VEC_OUT Vec3s dst, struct Object *o);`
[:arrow_up_small:](#)
@ -750,7 +750,7 @@ Activates a handheld camera shake effect. Calculates positional and focus adjust
- None
### C Prototype
`void shake_camera_handheld(Vec3f pos, OUT Vec3f focus);`
`void shake_camera_handheld(Vec3f pos, VEC_OUT Vec3f focus);`
[:arrow_up_small:](#)
@ -800,7 +800,7 @@ Checks for collisions between the camera and level geometry. Adjusts the camera'
- `integer`
### C Prototype
`s32 collide_with_walls(OUT Vec3f pos, f32 offsetY, f32 radius);`
`s32 collide_with_walls(VEC_OUT Vec3f pos, f32 offsetY, f32 radius);`
[:arrow_up_small:](#)
@ -826,7 +826,7 @@ Clamps the camera's pitch angle between a maximum and minimum value. Prevents ov
- `integer`
### C Prototype
`s32 clamp_pitch(Vec3f from, OUT Vec3f to, s16 maxPitch, s16 minPitch);`
`s32 clamp_pitch(Vec3f from, VEC_OUT Vec3f to, s16 maxPitch, s16 minPitch);`
[:arrow_up_small:](#)
@ -860,23 +860,24 @@ 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
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 = set_or_approach_f32_asymptotic(dst, goal, scale)`
`local integerValue, dst = set_or_approach_f32_asymptotic(dst, goal, scale)`
### Parameters
| Field | Type |
| ----- | ---- |
| dst | `Pointer` <`number`> |
| dst | `number` |
| goal | `number` |
| scale | `number` |
### Returns
- `integer`
- `number`
### C Prototype
`s32 set_or_approach_f32_asymptotic(f32 *dst, f32 goal, f32 scale);`
`s32 set_or_approach_f32_asymptotic(INOUT f32 *dst, f32 goal, f32 scale);`
[:arrow_up_small:](#)
@ -885,23 +886,24 @@ 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 true if `current` reaches the `target` and false otherwise
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 = approach_f32_asymptotic_bool(current, target, multiplier)`
`local integerValue, current = approach_f32_asymptotic_bool(current, target, multiplier)`
### Parameters
| Field | Type |
| ----- | ---- |
| current | `Pointer` <`number`> |
| current | `number` |
| target | `number` |
| multiplier | `number` |
### Returns
- `integer`
- `number`
### C Prototype
`s32 approach_f32_asymptotic_bool(f32 *current, f32 target, f32 multiplier);`
`s32 approach_f32_asymptotic_bool(INOUT f32 *current, f32 target, f32 multiplier);`
[:arrow_up_small:](#)
@ -935,23 +937,24 @@ 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 true if `current` reaches `target` and false otherwise
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 = approach_s16_asymptotic_bool(current, target, divisor)`
`local integerValue, current = approach_s16_asymptotic_bool(current, target, divisor)`
### Parameters
| Field | Type |
| ----- | ---- |
| current | `Pointer` <`integer`> |
| current | `integer` |
| target | `integer` |
| divisor | `integer` |
### Returns
- `integer`
- `integer`
### C Prototype
`s32 approach_s16_asymptotic_bool(s16 *current, s16 target, s16 divisor);`
`s32 approach_s16_asymptotic_bool(INOUT s16 *current, s16 target, s16 divisor);`
[:arrow_up_small:](#)
@ -1003,7 +1006,7 @@ Smoothly transitions a 3D vector (`current`) towards a target vector (`target`)
- None
### C Prototype
`void approach_vec3f_asymptotic(OUT Vec3f current, Vec3f target, f32 xMul, f32 yMul, f32 zMul);`
`void approach_vec3f_asymptotic(VEC_OUT Vec3f current, Vec3f target, f32 xMul, f32 yMul, f32 zMul);`
[:arrow_up_small:](#)
@ -1030,7 +1033,7 @@ Smoothly transitions a 3D vector (`current`) toward a target vector (`goal`) usi
- None
### C Prototype
`void set_or_approach_vec3f_asymptotic(OUT Vec3f dst, Vec3f goal, f32 xMul, f32 yMul, f32 zMul);`
`void set_or_approach_vec3f_asymptotic(VEC_OUT Vec3f dst, Vec3f goal, f32 xMul, f32 yMul, f32 zMul);`
[:arrow_up_small:](#)
@ -1039,23 +1042,24 @@ 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 true if the value reaches the target and false otherwise
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 = camera_approach_s16_symmetric_bool(current, target, increment)`
`local integerValue, current = camera_approach_s16_symmetric_bool(current, target, increment)`
### Parameters
| Field | Type |
| ----- | ---- |
| current | `Pointer` <`integer`> |
| current | `integer` |
| target | `integer` |
| increment | `integer` |
### Returns
- `integer`
- `integer`
### C Prototype
`s32 camera_approach_s16_symmetric_bool(s16 *current, s16 target, s16 increment);`
`s32 camera_approach_s16_symmetric_bool(INOUT s16 *current, s16 target, s16 increment);`
[:arrow_up_small:](#)
@ -1064,23 +1068,24 @@ 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
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 = set_or_approach_s16_symmetric(current, target, increment)`
`local integerValue, current = set_or_approach_s16_symmetric(current, target, increment)`
### Parameters
| Field | Type |
| ----- | ---- |
| current | `Pointer` <`integer`> |
| current | `integer` |
| target | `integer` |
| increment | `integer` |
### Returns
- `integer`
- `integer`
### C Prototype
`s32 set_or_approach_s16_symmetric(s16 *current, s16 target, s16 increment);`
`s32 set_or_approach_s16_symmetric(INOUT s16 *current, s16 target, s16 increment);`
[:arrow_up_small:](#)
@ -1089,23 +1094,24 @@ 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 true if the value reaches the target and false otherwise
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 = camera_approach_f32_symmetric_bool(current, target, increment)`
`local integerValue, current = camera_approach_f32_symmetric_bool(current, target, increment)`
### Parameters
| Field | Type |
| ----- | ---- |
| current | `Pointer` <`number`> |
| current | `number` |
| target | `number` |
| increment | `number` |
### Returns
- `integer`
- `number`
### C Prototype
`s32 camera_approach_f32_symmetric_bool(f32 *current, f32 target, f32 increment);`
`s32 camera_approach_f32_symmetric_bool(INOUT f32 *current, f32 target, f32 increment);`
[:arrow_up_small:](#)
@ -1156,7 +1162,7 @@ Generates a random 3D vector with short integer components. Useful for randomize
- None
### C Prototype
`void random_vec3s(OUT Vec3s dst, s16 xRange, s16 yRange, s16 zRange);`
`void random_vec3s(VEC_OUT Vec3s dst, s16 xRange, s16 yRange, s16 zRange);`
[:arrow_up_small:](#)
@ -1184,7 +1190,7 @@ Clamps a position within specified X and Z bounds and calculates the yaw angle f
- `integer`
### C Prototype
`s32 clamp_positions_and_find_yaw(OUT Vec3f pos, Vec3f origin, f32 xMax, f32 xMin, f32 zMax, f32 zMin);`
`s32 clamp_positions_and_find_yaw(VEC_OUT Vec3f pos, Vec3f origin, f32 xMax, f32 xMin, f32 zMax, f32 zMin);`
[:arrow_up_small:](#)
@ -1237,7 +1243,7 @@ Scales a point along a line between two 3D points (`from` and `to`). The scaling
- None
### C Prototype
`void scale_along_line(OUT Vec3f dest, Vec3f from, Vec3f to, f32 scale);`
`void scale_along_line(VEC_OUT Vec3f dest, Vec3f from, Vec3f to, f32 scale);`
[:arrow_up_small:](#)
@ -1294,24 +1300,22 @@ Determines the yaw angle (rotation around the Y-axis) from one 3D position (`fro
## [calculate_angles](#calculate_angles)
### Description
Calculates the pitch and yaw angles from one 3D position (`from`) to another (`to`). Updates the provided pointers with the computed pitch and yaw values
Calculates and returns the pitch and yaw angles from one 3D position (`from`) to another (`to`)
### Lua Example
`calculate_angles(from, to, pitch, yaw)`
`local pitch, yaw = calculate_angles(from, to)`
### Parameters
| Field | Type |
| ----- | ---- |
| from | [Vec3f](structs.md#Vec3f) |
| to | [Vec3f](structs.md#Vec3f) |
| pitch | `Pointer` <`integer`> |
| yaw | `Pointer` <`integer`> |
### Returns
- None
### C Prototype
`void calculate_angles(Vec3f from, Vec3f to, s16 *pitch, s16 *yaw);`
`void calculate_angles(Vec3f from, Vec3f to, RET s16 *pitch, RET s16 *yaw);`
[:arrow_up_small:](#)
@ -1384,7 +1388,7 @@ Rotates a vector around the XZ-plane by a specified yaw angle. The result is sto
- None
### C Prototype
`void rotate_in_xz(OUT Vec3f dst, Vec3f src, s16 yaw);`
`void rotate_in_xz(VEC_OUT Vec3f dst, Vec3f src, s16 yaw);`
[:arrow_up_small:](#)
@ -1409,7 +1413,7 @@ Rotates a vector around the YZ-plane by a specified pitch angle. The result is s
- None
### C Prototype
`void rotate_in_yz(OUT Vec3f dst, Vec3f src, s16 pitch);`
`void rotate_in_yz(VEC_OUT Vec3f dst, Vec3f src, s16 pitch);`
[:arrow_up_small:](#)
@ -1537,7 +1541,7 @@ Activates a pitch-based shake effect. Adds vertical vibrational movement to the
- None
### C Prototype
`void shake_camera_pitch(Vec3f pos, OUT Vec3f focus);`
`void shake_camera_pitch(Vec3f pos, VEC_OUT Vec3f focus);`
[:arrow_up_small:](#)
@ -1561,7 +1565,7 @@ Activates a yaw-based shake effect. Adds horizontal vibrational movement to the
- None
### C Prototype
`void shake_camera_yaw(Vec3f pos, OUT Vec3f focus);`
`void shake_camera_yaw(Vec3f pos, VEC_OUT Vec3f focus);`
[:arrow_up_small:](#)
@ -1573,18 +1577,18 @@ Activates a yaw-based shake effect. Adds horizontal vibrational movement to the
Applies a roll-based shake effect to the camera. Simulates rotational disturbances caused by impacts or other events
### Lua Example
`shake_camera_roll(roll)`
`local roll = shake_camera_roll(roll)`
### Parameters
| Field | Type |
| ----- | ---- |
| roll | `Pointer` <`integer`> |
| roll | `integer` |
### Returns
- None
### C Prototype
`void shake_camera_roll(s16 *roll);`
`void shake_camera_roll(INOUT s16 *roll);`
[:arrow_up_small:](#)
@ -1990,7 +1994,7 @@ Offsets a vector by rotating it in 3D space relative to a reference position. Th
- None
### C Prototype
`void offset_rotated(OUT Vec3f dst, Vec3f from, Vec3f to, Vec3s rotation);`
`void offset_rotated(VEC_OUT Vec3f dst, Vec3f from, Vec3f to, Vec3s rotation);`
[:arrow_up_small:](#)
@ -2019,7 +2023,7 @@ Transitions the camera to the next Lakitu state, updating position and focus. Th
- `integer`
### C Prototype
`s16 next_lakitu_state(OUT Vec3f newPos, OUT Vec3f newFoc, Vec3f curPos, Vec3f curFoc, Vec3f oldPos, Vec3f oldFoc, s16 yaw);`
`s16 next_lakitu_state(VEC_OUT Vec3f newPos, VEC_OUT Vec3f newFoc, Vec3f curPos, Vec3f curFoc, Vec3f oldPos, Vec3f oldFoc, s16 yaw);`
[:arrow_up_small:](#)
@ -2089,7 +2093,7 @@ Resolves collisions between the camera and level geometry. Adjusts the camera's
- None
### C Prototype
`void resolve_geometry_collisions(OUT Vec3f pos, UNUSED Vec3f lastGood);`
`void resolve_geometry_collisions(VEC_OUT Vec3f pos, UNUSED Vec3f lastGood);`
[:arrow_up_small:](#)
@ -2101,21 +2105,22 @@ Resolves collisions between the camera and level geometry. Adjusts the camera's
Rotates the camera to avoid walls or other obstructions. Ensures clear visibility of the player or target objects
### Lua Example
`local integerValue = rotate_camera_around_walls(c, cPos, avoidYaw, yawRange)`
`local integerValue, avoidYaw = rotate_camera_around_walls(c, cPos, avoidYaw, yawRange)`
### Parameters
| Field | Type |
| ----- | ---- |
| c | [Camera](structs.md#Camera) |
| cPos | [Vec3f](structs.md#Vec3f) |
| avoidYaw | `Pointer` <`integer`> |
| avoidYaw | `integer` |
| yawRange | `integer` |
### Returns
- `integer`
- `integer`
### C Prototype
`s32 rotate_camera_around_walls(struct Camera *c, Vec3f cPos, s16 *avoidYaw, s16 yawRange);`
`s32 rotate_camera_around_walls(struct Camera *c, Vec3f cPos, INOUT s16 *avoidYaw, s16 yawRange);`
[:arrow_up_small:](#)
@ -2494,7 +2499,7 @@ Centers the ROM hack camera. This function is designed for non-standard level la
Gets a Character struct from `m`
### Lua Example
`local CharacterValue = get_character(m)`
`local characterValue = get_character(m)`
### Parameters
| Field | Type |
@ -2502,7 +2507,7 @@ Gets a Character struct from `m`
| m | [MarioState](structs.md#MarioState) |
### Returns
[Character](structs.md#Character)
- [Character](structs.md#Character)
### C Prototype
`struct Character* get_character(struct MarioState* m);`
@ -2855,13 +2860,13 @@ Sets the current DJUI HUD font
Gets the current DJUI HUD color
### Lua Example
`local DjuiColorValue = djui_hud_get_color()`
`local djuiColorValue = djui_hud_get_color()`
### Parameters
- None
### Returns
[DjuiColor](structs.md#DjuiColor)
- [DjuiColor](structs.md#DjuiColor)
### C Prototype
`struct DjuiColor* djui_hud_get_color(void);`
@ -2923,13 +2928,13 @@ Resets the current DJUI HUD color
Gets the current DJUI HUD rotation
### Lua Example
`local HudUtilsRotationValue = djui_hud_get_rotation()`
`local hudUtilsRotationValue = djui_hud_get_rotation()`
### Parameters
- None
### Returns
[HudUtilsRotation](structs.md#HudUtilsRotation)
- [HudUtilsRotation](structs.md#HudUtilsRotation)
### C Prototype
`struct HudUtilsRotation* djui_hud_get_rotation(void);`
@ -3705,7 +3710,7 @@ Converts a world position to screen position
- `boolean`
### C Prototype
`bool djui_hud_world_pos_to_screen_pos(Vec3f pos, OUT Vec3f out);`
`bool djui_hud_world_pos_to_screen_pos(Vec3f pos, VEC_OUT Vec3f out);`
[:arrow_up_small:](#)
@ -6114,7 +6119,7 @@ Retrieves Mario's normal cap if it was previously lost. Removes the cap from Mar
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)`
`local objectValue = mario_get_collided_object(m, interactType)`
### Parameters
| Field | Type |
@ -6123,7 +6128,7 @@ Returns a collided object that matches a given interaction type from Mario's cur
| interactType | `integer` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType);`
@ -6330,7 +6335,7 @@ Stores the local Mario's current state in lag compensation history
Gets the local Mario's state stored in lag compensation history
### Lua Example
`local MarioStateValue = lag_compensation_get_local_state(otherNp)`
`local marioStateValue = lag_compensation_get_local_state(otherNp)`
### Parameters
| Field | Type |
@ -6338,7 +6343,7 @@ Gets the local Mario's state stored in lag compensation history
| otherNp | [NetworkPlayer](structs.md#NetworkPlayer) |
### Returns
[MarioState](structs.md#MarioState)
- [MarioState](structs.md#MarioState)
### C Prototype
`struct MarioState* lag_compensation_get_local_state(struct NetworkPlayer* otherNp);`
@ -6427,7 +6432,7 @@ Returns the name of the level corresponding to `courseNum`, `levelNum` and `area
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)`
`local pointerValue = get_level_name_sm64(courseNum, levelNum, areaIndex, charCase)`
### Parameters
| Field | Type |
@ -6503,7 +6508,7 @@ Returns the name of the star corresponding to `courseNum` and `starNum` as an AS
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)`
`local pointerValue = get_star_name_sm64(courseNum, starNum, charCase)`
### Parameters
| Field | Type |
@ -6558,7 +6563,7 @@ Returns the name of the star corresponding to `courseNum` and `starNum` as a dec
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)`
`local objectWarpNodeValue = area_create_warp_node(id, destLevel, destArea, destNode, checkpoint, o)`
### Parameters
| Field | Type |
@ -6571,7 +6576,7 @@ Creates a warp node in the current level and area with id `id` that goes to the
| o | [Object](structs.md#Object) |
### Returns
[ObjectWarpNode](structs.md#ObjectWarpNode)
- [ObjectWarpNode](structs.md#ObjectWarpNode)
### C Prototype
`struct ObjectWarpNode *area_create_warp_node(u8 id, u8 destLevel, u8 destArea, u8 destNode, u8 checkpoint, struct Object *o);`
@ -6658,7 +6663,7 @@ Fades into a special warp with `arg` and using `color`
Gets an instant warp from the current area's instant warp array (0-3)
### Lua Example
`local InstantWarpValue = get_instant_warp(index)`
`local instantWarpValue = get_instant_warp(index)`
### Parameters
| Field | Type |
@ -6666,7 +6671,7 @@ Gets an instant warp from the current area's instant warp array (0-3)
| index | `integer` |
### Returns
[InstantWarp](structs.md#InstantWarp)
- [InstantWarp](structs.md#InstantWarp)
### C Prototype
`struct InstantWarp *get_instant_warp(u8 index);`
@ -6681,13 +6686,13 @@ Gets an instant warp from the current area's instant warp array (0-3)
Gets a painting warp node from the local mario's floor type
### Lua Example
`local WarpNodeValue = get_painting_warp_node()`
`local warpNodeValue = get_painting_warp_node()`
### Parameters
- None
### Returns
[WarpNode](structs.md#WarpNode)
- [WarpNode](structs.md#WarpNode)
### C Prototype
`struct WarpNode *get_painting_warp_node(void);`
@ -6766,6 +6771,32 @@ Special warps to arg (`SPECIAL_WARP_*`)
<br />
## [initiate_warp](#initiate_warp)
### Description
Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This function is unstable and it's generally recommended to use `warp_to_level` instead
### Lua Example
`initiate_warp(destLevel, destArea, destWarpNode, arg)`
### Parameters
| Field | Type |
| ----- | ---- |
| destLevel | `integer` |
| destArea | `integer` |
| destWarpNode | `integer` |
| arg | `integer` |
### Returns
- None
### C Prototype
`void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg);`
[:arrow_up_small:](#)
<br />
## [lvl_set_current_level](#lvl_set_current_level)
### Description

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -13,20 +13,24 @@
## [clear_move_flag](#clear_move_flag)
### Description
Clears the `flag` from the `bitSet`
### Lua Example
`local integerValue = clear_move_flag(bitSet, flag)`
`local integerValue, bitSet = clear_move_flag(bitSet, flag)`
### Parameters
| Field | Type |
| ----- | ---- |
| bitSet | `Pointer` <`integer`> |
| bitSet | `integer` |
| flag | `integer` |
### Returns
- `integer`
- `integer`
### C Prototype
`s32 clear_move_flag(u32 *bitSet, s32 flag);`
`s32 clear_move_flag(INOUT u32 *bitSet, s32 flag);`
[:arrow_up_small:](#)
@ -92,7 +96,7 @@ Overrides the current room Mario is in. Set to -1 to reset override
- None
### C Prototype
`void obj_apply_scale_to_matrix(struct Object *obj, OUT Mat4 dst, Mat4 src);`
`void obj_apply_scale_to_matrix(struct Object *obj, VEC_OUT Mat4 dst, Mat4 src);`
[:arrow_up_small:](#)
@ -114,7 +118,7 @@ Overrides the current room Mario is in. Set to -1 to reset override
- None
### C Prototype
`void create_transformation_from_matrices(OUT Mat4 a0, Mat4 a1, Mat4 a2);`
`void create_transformation_from_matrices(VEC_OUT Mat4 a0, Mat4 a1, Mat4 a2);`
[:arrow_up_small:](#)
@ -230,20 +234,21 @@ Overrides the current room Mario is in. Set to -1 to reset override
## [approach_f32_signed](#approach_f32_signed)
### Lua Example
`local integerValue = approach_f32_signed(value, target, increment)`
`local integerValue, value = approach_f32_signed(value, target, increment)`
### Parameters
| Field | Type |
| ----- | ---- |
| value | `Pointer` <`number`> |
| value | `number` |
| target | `number` |
| increment | `number` |
### Returns
- `integer`
- `number`
### C Prototype
`s32 approach_f32_signed(f32 *value, f32 target, f32 increment);`
`s32 approach_f32_signed(INOUT f32 *value, f32 target, f32 increment);`
[:arrow_up_small:](#)
@ -588,7 +593,7 @@ Overrides the current room Mario is in. Set to -1 to reset override
## [spawn_water_droplet](#spawn_water_droplet)
### Lua Example
`local ObjectValue = spawn_water_droplet(parent, params)`
`local objectValue = spawn_water_droplet(parent, params)`
### Parameters
| Field | Type |
@ -597,7 +602,7 @@ Overrides the current room Mario is in. Set to -1 to reset override
| params | [WaterDropletParams](structs.md#WaterDropletParams) |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *spawn_water_droplet(struct Object *parent, struct WaterDropletParams *params);`
@ -788,7 +793,7 @@ Multiplies a vector by a matrix of the form: `| ? ? ? 0 |` `| ? ? ? 0 |` `| ? ?
- None
### C Prototype
`void linear_mtxf_mul_vec3f(Mat4 m, OUT Vec3f dst, Vec3f v);`
`void linear_mtxf_mul_vec3f(Mat4 m, VEC_OUT Vec3f dst, Vec3f v);`
[:arrow_up_small:](#)
@ -813,7 +818,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
- None
### C Prototype
`void linear_mtxf_transpose_mul_vec3f(Mat4 m, OUT Vec3f dst, Vec3f v);`
`void linear_mtxf_transpose_mul_vec3f(Mat4 m, VEC_OUT Vec3f dst, Vec3f v);`
[:arrow_up_small:](#)
@ -1243,7 +1248,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
## [cur_obj_nearest_object_with_behavior](#cur_obj_nearest_object_with_behavior)
### Lua Example
`local ObjectValue = cur_obj_nearest_object_with_behavior(behavior)`
`local objectValue = cur_obj_nearest_object_with_behavior(behavior)`
### Parameters
| Field | Type |
@ -1251,7 +1256,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
| behavior | `Pointer` <`BehaviorScript`> |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *cur_obj_nearest_object_with_behavior(const BehaviorScript *behavior);`
@ -1283,13 +1288,13 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
## [cur_obj_find_nearest_pole](#cur_obj_find_nearest_pole)
### Lua Example
`local ObjectValue = cur_obj_find_nearest_pole()`
`local objectValue = cur_obj_find_nearest_pole()`
### Parameters
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* cur_obj_find_nearest_pole(void);`
@ -1301,19 +1306,19 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
## [cur_obj_find_nearest_object_with_behavior](#cur_obj_find_nearest_object_with_behavior)
### Lua Example
`local ObjectValue = cur_obj_find_nearest_object_with_behavior(behavior, dist)`
`local objectValue, dist = cur_obj_find_nearest_object_with_behavior(behavior)`
### Parameters
| Field | Type |
| ----- | ---- |
| behavior | `Pointer` <`BehaviorScript`> |
| dist | `Pointer` <`number`> |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
- `number`
### C Prototype
`struct Object *cur_obj_find_nearest_object_with_behavior(const BehaviorScript *behavior, f32 *dist);`
`struct Object *cur_obj_find_nearest_object_with_behavior(const BehaviorScript *behavior, RET f32 *dist);`
[:arrow_up_small:](#)
@ -1343,13 +1348,13 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
## [find_unimportant_object](#find_unimportant_object)
### Lua Example
`local ObjectValue = find_unimportant_object()`
`local objectValue = find_unimportant_object()`
### Parameters
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *find_unimportant_object(void);`
@ -1399,7 +1404,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
## [find_object_with_behavior](#find_object_with_behavior)
### Lua Example
`local ObjectValue = find_object_with_behavior(behavior)`
`local objectValue = find_object_with_behavior(behavior)`
### Parameters
| Field | Type |
@ -1407,7 +1412,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
| behavior | `Pointer` <`BehaviorScript`> |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *find_object_with_behavior(const BehaviorScript *behavior);`
@ -1419,7 +1424,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
## [cur_obj_find_nearby_held_actor](#cur_obj_find_nearby_held_actor)
### Lua Example
`local ObjectValue = cur_obj_find_nearby_held_actor(behavior, maxDist)`
`local objectValue = cur_obj_find_nearby_held_actor(behavior, maxDist)`
### Parameters
| Field | Type |
@ -1428,7 +1433,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
| maxDist | `number` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *cur_obj_find_nearby_held_actor(const BehaviorScript *behavior, f32 maxDist);`
@ -1931,13 +1936,13 @@ Marks an object to be unloaded at the end of the frame
## [cur_obj_update_floor_height_and_get_floor](#cur_obj_update_floor_height_and_get_floor)
### Lua Example
`local SurfaceValue = cur_obj_update_floor_height_and_get_floor()`
`local surfaceValue = cur_obj_update_floor_height_and_get_floor()`
### Parameters
- None
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface *cur_obj_update_floor_height_and_get_floor(void);`
@ -1949,19 +1954,19 @@ Marks an object to be unloaded at the end of the frame
## [apply_drag_to_value](#apply_drag_to_value)
### Lua Example
`apply_drag_to_value(value, dragStrength)`
`local value = apply_drag_to_value(value, dragStrength)`
### Parameters
| Field | Type |
| ----- | ---- |
| value | `Pointer` <`number`> |
| value | `number` |
| dragStrength | `number` |
### Returns
- None
### C Prototype
`void apply_drag_to_value(f32 *value, f32 dragStrength);`
`void apply_drag_to_value(INOUT f32 *value, f32 dragStrength);`
[:arrow_up_small:](#)
@ -3730,7 +3735,7 @@ Transforms the vector at `localTranslateIndex` into the object's local coordinat
## [spawn_star_with_no_lvl_exit](#spawn_star_with_no_lvl_exit)
### Lua Example
`local ObjectValue = spawn_star_with_no_lvl_exit(sp20, sp24)`
`local objectValue = spawn_star_with_no_lvl_exit(sp20, sp24)`
### Parameters
| Field | Type |
@ -3739,7 +3744,7 @@ Transforms the vector at `localTranslateIndex` into the object's local coordinat
| sp24 | `integer` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *spawn_star_with_no_lvl_exit(s32 sp20, s32 sp24);`
@ -5239,7 +5244,7 @@ Retrieves the current position of Mario's cap, if it is on the ground in the cur
- `integer`
### C Prototype
`s32 save_file_get_cap_pos(OUT Vec3s capPos);`
`s32 save_file_get_cap_pos(VEC_OUT Vec3s capPos);`
[:arrow_up_small:](#)
@ -5494,7 +5499,7 @@ Gets the mute volume scale of `player`
Gets a vanilla mario Animation with `index`
### Lua Example
`local AnimationValue = get_mario_vanilla_animation(index)`
`local animationValue = get_mario_vanilla_animation(index)`
### Parameters
| Field | Type |
@ -5502,7 +5507,7 @@ Gets a vanilla mario Animation with `index`
| index | `integer` |
### Returns
[Animation](structs.md#Animation)
- [Animation](structs.md#Animation)
### C Prototype
`struct Animation *get_mario_vanilla_animation(u16 index);`
@ -5617,7 +5622,7 @@ Replaces the sequence corresponding to `sequenceId` with one called `m64Name`.m6
Loads an `audio` stream by `filename` (with extension)
### Lua Example
`local ModAudioValue = audio_stream_load(filename)`
`local modAudioValue = audio_stream_load(filename)`
### Parameters
| Field | Type |
@ -5625,7 +5630,7 @@ Loads an `audio` stream by `filename` (with extension)
| filename | `string` |
### Returns
[ModAudio](structs.md#ModAudio)
- [ModAudio](structs.md#ModAudio)
### C Prototype
`struct ModAudio* audio_stream_load(const char* filename);`
@ -5947,7 +5952,7 @@ Sets the volume of an `audio` stream
Loads an `audio` sample
### Lua Example
`local ModAudioValue = audio_sample_load(filename)`
`local modAudioValue = audio_sample_load(filename)`
### Parameters
| Field | Type |
@ -5955,7 +5960,7 @@ Loads an `audio` sample
| filename | `string` |
### Returns
[ModAudio](structs.md#ModAudio)
- [ModAudio](structs.md#ModAudio)
### C Prototype
`struct ModAudio* audio_sample_load(const char* filename);`
@ -6240,13 +6245,13 @@ Sets if the romhack camera should allow D-Pad movement
<br />
## [rom_hack_cam_set_collisions](#rom_hack_cam_set_collisions)
## [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
### Lua Example
`rom_hack_cam_set_collisions(enable)`
`camera_romhack_set_collisions(enable)`
### Parameters
| Field | Type |
@ -6257,7 +6262,7 @@ Toggles collision settings for the ROM hack camera. This enables or disables spe
- None
### C Prototype
`void rom_hack_cam_set_collisions(u8 enable);`
`void camera_romhack_set_collisions(u8 enable);`
[:arrow_up_small:](#)
@ -6451,7 +6456,7 @@ Gets the current romhack camera override status
- None
### Returns
[enum RomhackCameraOverride](constants.md#enum-RomhackCameraOverride)
- [enum RomhackCameraOverride](constants.md#enum-RomhackCameraOverride)
### C Prototype
`enum RomhackCameraOverride camera_get_romhack_override(void);`
@ -7172,7 +7177,7 @@ Sets if the camera should account for surfaces
Finds a potential floor at the given `x`, `y`, and `z` values
### Lua Example
`local SurfaceValue = collision_find_floor(x, y, z)`
`local surfaceValue = collision_find_floor(x, y, z)`
### Parameters
| Field | Type |
@ -7182,7 +7187,7 @@ Finds a potential floor at the given `x`, `y`, and `z` values
| z | `number` |
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface* collision_find_floor(f32 x, f32 y, f32 z);`
@ -7197,7 +7202,7 @@ Finds a potential floor at the given `x`, `y`, and `z` values
Finds a potential ceiling at the given `x`, `y`, and `z` values
### Lua Example
`local SurfaceValue = collision_find_ceil(x, y, z)`
`local surfaceValue = collision_find_ceil(x, y, z)`
### Parameters
| Field | Type |
@ -7207,7 +7212,7 @@ Finds a potential ceiling at the given `x`, `y`, and `z` values
| z | `number` |
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface* collision_find_ceil(f32 x, f32 y, f32 z);`
@ -7222,13 +7227,13 @@ Finds a potential ceiling at the given `x`, `y`, and `z` values
Gets the generated water floor surface used when riding a shell
### Lua Example
`local SurfaceValue = get_water_surface_pseudo_floor()`
`local surfaceValue = get_water_surface_pseudo_floor()`
### Parameters
- None
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface* get_water_surface_pseudo_floor(void);`
@ -7243,7 +7248,7 @@ Gets the generated water floor surface used when riding a shell
Gets the `Collision` with `name`
### Lua Example
`local PointerValue = smlua_collision_util_get(name)`
`local pointerValue = smlua_collision_util_get(name)`
### Parameters
| Field | Type |
@ -7266,13 +7271,13 @@ Gets the `Collision` with `name`
Returns a temporary wall collision data pointer
### Lua Example
`local WallCollisionDataValue = collision_get_temp_wall_collision_data()`
`local wallCollisionDataValue = collision_get_temp_wall_collision_data()`
### Parameters
- None
### Returns
[WallCollisionData](structs.md#WallCollisionData)
- [WallCollisionData](structs.md#WallCollisionData)
### C Prototype
`struct WallCollisionData* collision_get_temp_wall_collision_data(void);`
@ -7287,7 +7292,7 @@ Returns a temporary wall collision data pointer
Gets the surface corresponding to `index` from `wcd`
### Lua Example
`local SurfaceValue = get_surface_from_wcd_index(wcd, index)`
`local surfaceValue = get_surface_from_wcd_index(wcd, index)`
### Parameters
| Field | Type |
@ -7296,7 +7301,7 @@ Gets the surface corresponding to `index` from `wcd`
| index | `integer` |
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface* get_surface_from_wcd_index(struct WallCollisionData* wcd, s8 index);`
@ -7311,7 +7316,7 @@ Gets the surface corresponding to `index` from `wcd`
Gets the current level terrain collision
### Lua Example
`local PointerValue = smlua_collision_util_get_current_terrain_collision()`
`local pointerValue = smlua_collision_util_get_current_terrain_collision()`
### Parameters
- None
@ -7332,7 +7337,7 @@ Gets the current level terrain collision
Gets the `level` terrain collision from `area`
### Lua Example
`local PointerValue = smlua_collision_util_get_level_collision(level, area)`
`local pointerValue = smlua_collision_util_get_level_collision(level, area)`
### Parameters
| Field | Type |
@ -7946,7 +7951,7 @@ Gets the op of the display list command
Gets the display list from a display list command if it has the op `G_DL`
### Lua Example
`local PointerValue = gfx_get_display_list(cmd)`
`local pointerValue = gfx_get_display_list(cmd)`
### Parameters
| Field | Type |
@ -7969,7 +7974,7 @@ Gets the display list from a display list command if it has the op `G_DL`
Gets the vertex buffer from a display list command if it has the op `G_VTX`
### Lua Example
`local PointerValue = gfx_get_vertex_buffer(cmd)`
`local pointerValue = gfx_get_vertex_buffer(cmd)`
### Parameters
| Field | Type |
@ -8015,7 +8020,7 @@ Gets the number of vertices from a display list command if it has the op `G_VTX`
Gets the texture from a display list command if it has an image related op
### Lua Example
`local PointerValue = gfx_get_texture(cmd)`
`local pointerValue = gfx_get_texture(cmd)`
### Parameters
| Field | Type |
@ -8032,6 +8037,30 @@ Gets the texture from a display list command if it has an image related op
<br />
## [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
### Lua Example
`local pointerValue, length = gfx_get_from_name(name)`
### Parameters
| Field | Type |
| ----- | ---- |
| name | `string` |
### Returns
- `Pointer` <`Gfx`>
- `integer`
### C Prototype
`Gfx *gfx_get_from_name(const char *name, RET u32 *length);`
[:arrow_up_small:](#)
<br />
## [gfx_get_name](#gfx_get_name)
### Description
@ -8084,7 +8113,7 @@ Gets the max length of a display list
Gets a command of a display list at position `offset`
### Lua Example
`local PointerValue = gfx_get_command(gfx, offset)`
`local pointerValue = gfx_get_command(gfx, offset)`
### Parameters
| Field | Type |
@ -8108,7 +8137,7 @@ Gets a command of a display list at position `offset`
Gets the next command of a given display list pointer. Intended to use in a for loop
### Lua Example
`local PointerValue = gfx_get_next_command(gfx)`
`local pointerValue = gfx_get_next_command(gfx)`
### Parameters
| Field | Type |
@ -8156,7 +8185,7 @@ Copies `length` commands from display list `src` to display list `dest`
Creates a new named display list of `length` commands
### Lua Example
`local PointerValue = gfx_create(name, length)`
`local pointerValue = gfx_create(name, length)`
### Parameters
| Field | Type |
@ -8242,6 +8271,30 @@ Deletes all display lists created by `gfx_create`
<br />
## [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
### Lua Example
`local pointerValue, count = vtx_get_from_name(name)`
### Parameters
| Field | Type |
| ----- | ---- |
| name | `string` |
### Returns
- `Pointer` <`Vtx`>
- `integer`
### C Prototype
`Vtx *vtx_get_from_name(const char *name, RET u32 *count);`
[:arrow_up_small:](#)
<br />
## [vtx_get_name](#vtx_get_name)
### Description
@ -8294,7 +8347,7 @@ Gets the max count of vertices of a vertex buffer
Gets a vertex of a vertex buffer at position `offset`
### Lua Example
`local PointerValue = vtx_get_vertex(vtx, offset)`
`local pointerValue = vtx_get_vertex(vtx, offset)`
### Parameters
| Field | Type |
@ -8318,7 +8371,7 @@ Gets a vertex of a vertex buffer at position `offset`
Gets the next vertex of a given vertex pointer. Intended to use in a for loop
### Lua Example
`local PointerValue = vtx_get_next_vertex(vtx)`
`local pointerValue = vtx_get_next_vertex(vtx)`
### Parameters
| Field | Type |
@ -8366,7 +8419,7 @@ Copies `count` vertices from vertex buffer `src` to vertex buffer `dest`
Creates a new named vertex buffer of `count` vertices
### Lua Example
`local PointerValue = vtx_create(name, count)`
`local pointerValue = vtx_create(name, count)`
### Parameters
| Field | Type |

View file

@ -40,7 +40,7 @@ Instantly changes the current area to `areaIndex`
Gets information on a custom level from `levelNum`
### Lua Example
`local CustomLevelInfoValue = smlua_level_util_get_info(levelNum)`
`local customLevelInfoValue = smlua_level_util_get_info(levelNum)`
### Parameters
| Field | Type |
@ -48,7 +48,7 @@ Gets information on a custom level from `levelNum`
| levelNum | `integer` |
### Returns
[CustomLevelInfo](structs.md#CustomLevelInfo)
- [CustomLevelInfo](structs.md#CustomLevelInfo)
### C Prototype
`struct CustomLevelInfo* smlua_level_util_get_info(s16 levelNum);`
@ -63,7 +63,7 @@ Gets information on a custom level from `levelNum`
Gets information on a custom level from `shortName`
### Lua Example
`local CustomLevelInfoValue = smlua_level_util_get_info_from_short_name(shortName)`
`local customLevelInfoValue = smlua_level_util_get_info_from_short_name(shortName)`
### Parameters
| Field | Type |
@ -71,7 +71,7 @@ Gets information on a custom level from `shortName`
| shortName | `string` |
### Returns
[CustomLevelInfo](structs.md#CustomLevelInfo)
- [CustomLevelInfo](structs.md#CustomLevelInfo)
### C Prototype
`struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName);`
@ -86,7 +86,7 @@ Gets information on a custom level from `shortName`
Gets information on a custom level from `courseNum`
### Lua Example
`local CustomLevelInfoValue = smlua_level_util_get_info_from_course_num(courseNum)`
`local customLevelInfoValue = smlua_level_util_get_info_from_course_num(courseNum)`
### Parameters
| Field | Type |
@ -94,7 +94,7 @@ Gets information on a custom level from `courseNum`
| courseNum | `integer` |
### Returns
[CustomLevelInfo](structs.md#CustomLevelInfo)
- [CustomLevelInfo](structs.md#CustomLevelInfo)
### C Prototype
`struct CustomLevelInfo* smlua_level_util_get_info_from_course_num(u8 courseNum);`
@ -349,7 +349,7 @@ Gets the area update counter incremented when objects are updated
Returns a temporary signed 32-bit integer pointer with its value set to `initialValue`
### Lua Example
`local PointerValue = get_temp_s32_pointer(initialValue)`
`local pointerValue = get_temp_s32_pointer(initialValue)`
### Parameters
| Field | Type |
@ -574,7 +574,7 @@ Gets the DJUI menu font
- None
### Returns
[enum DjuiFontType](constants.md#enum-DjuiFontType)
- [enum DjuiFontType](constants.md#enum-DjuiFontType)
### C Prototype
`enum DjuiFontType djui_menu_get_font(void);`
@ -589,13 +589,13 @@ Gets the DJUI menu font
Gets the DJUI menu theme
### Lua Example
`local DjuiThemeValue = djui_menu_get_theme()`
`local djuiThemeValue = djui_menu_get_theme()`
### Parameters
- None
### Returns
[DjuiTheme](structs.md#DjuiTheme)
- [DjuiTheme](structs.md#DjuiTheme)
### C Prototype
`struct DjuiTheme* djui_menu_get_theme(void);`
@ -1410,7 +1410,32 @@ Retrieves the animated part position associated to `animPart` from the MarioStat
- `boolean`
### C Prototype
`bool get_mario_anim_part_pos(struct MarioState *m, u32 animPart, OUT Vec3f pos);`
`bool get_mario_anim_part_pos(struct MarioState *m, u32 animPart, VEC_OUT Vec3f pos);`
[:arrow_up_small:](#)
<br />
## [get_mario_anim_part_rot](#get_mario_anim_part_rot)
### Description
Retrieves the animated part rotation associated to `animPart` from the MarioState `m` and stores it into `rot`. Returns `true` on success or `false` on failure
### Lua Example
`local booleanValue = get_mario_anim_part_rot(m, animPart, rot)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| animPart | `integer` |
| rot | [Vec3s](structs.md#Vec3s) |
### Returns
- `boolean`
### C Prototype
`bool get_mario_anim_part_rot(struct MarioState *m, u32 animPart, VEC_OUT Vec3s rot);`
[:arrow_up_small:](#)
@ -1649,13 +1674,13 @@ Gets the Unix Timestamp
Gets the system clock's date and time
### Lua Example
`local DateTimeValue = get_date_and_time()`
`local dateTimeValue = get_date_and_time()`
### Parameters
- None
### Returns
[DateTime](structs.md#DateTime)
- [DateTime](structs.md#DateTime)
### C Prototype
`struct DateTime* get_date_and_time(void);`
@ -2046,13 +2071,13 @@ Checks if a file exists inside of a mod
Gets the mod currently being processed
### Lua Example
`local ModValue = get_active_mod()`
`local modValue = get_active_mod()`
### Parameters
- None
### Returns
[Mod](structs.md#Mod)
- [Mod](structs.md#Mod)
### C Prototype
`struct Mod* get_active_mod(void);`
@ -2132,13 +2157,13 @@ Gets the name of the operating system the game is running on
Gets the current GraphNodeRoot
### Lua Example
`local GraphNodeRootValue = geo_get_current_root()`
`local graphNodeRootValue = geo_get_current_root()`
### Parameters
- None
### Returns
[GraphNodeRoot](structs.md#GraphNodeRoot)
- [GraphNodeRoot](structs.md#GraphNodeRoot)
### C Prototype
`struct GraphNodeRoot* geo_get_current_root(void);`
@ -2153,13 +2178,13 @@ Gets the current GraphNodeRoot
Gets the current GraphNodeMasterList
### Lua Example
`local GraphNodeMasterListValue = geo_get_current_master_list()`
`local graphNodeMasterListValue = geo_get_current_master_list()`
### Parameters
- None
### Returns
[GraphNodeMasterList](structs.md#GraphNodeMasterList)
- [GraphNodeMasterList](structs.md#GraphNodeMasterList)
### C Prototype
`struct GraphNodeMasterList* geo_get_current_master_list(void);`
@ -2174,13 +2199,13 @@ Gets the current GraphNodeMasterList
Gets the current GraphNodePerspective
### Lua Example
`local GraphNodePerspectiveValue = geo_get_current_perspective()`
`local graphNodePerspectiveValue = geo_get_current_perspective()`
### Parameters
- None
### Returns
[GraphNodePerspective](structs.md#GraphNodePerspective)
- [GraphNodePerspective](structs.md#GraphNodePerspective)
### C Prototype
`struct GraphNodePerspective* geo_get_current_perspective(void);`
@ -2195,13 +2220,13 @@ Gets the current GraphNodePerspective
Gets the current GraphNodeCamera
### Lua Example
`local GraphNodeCameraValue = geo_get_current_camera()`
`local graphNodeCameraValue = geo_get_current_camera()`
### Parameters
- None
### Returns
[GraphNodeCamera](structs.md#GraphNodeCamera)
- [GraphNodeCamera](structs.md#GraphNodeCamera)
### C Prototype
`struct GraphNodeCamera* geo_get_current_camera(void);`
@ -2216,13 +2241,13 @@ Gets the current GraphNodeCamera
Gets the current GraphNodeHeldObject
### Lua Example
`local GraphNodeHeldObjectValue = geo_get_current_held_object()`
`local graphNodeHeldObjectValue = geo_get_current_held_object()`
### Parameters
- None
### Returns
[GraphNodeHeldObject](structs.md#GraphNodeHeldObject)
- [GraphNodeHeldObject](structs.md#GraphNodeHeldObject)
### C Prototype
`struct GraphNodeHeldObject* geo_get_current_held_object(void);`
@ -2297,7 +2322,7 @@ Gets the extended model ID for the `name` of a `GeoLayout`
| name | `string` |
### Returns
[enum ModelExtendedId](constants.md#enum-ModelExtendedId)
- [enum ModelExtendedId](constants.md#enum-ModelExtendedId)
### C Prototype
`enum ModelExtendedId smlua_model_util_get_id(const char* name);`
@ -2318,7 +2343,7 @@ Gets the extended model ID for the `name` of a `GeoLayout`
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)`
`local objectValue = spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)`
### Parameters
| Field | Type |
@ -2331,7 +2356,7 @@ Spawns a synchronized object at `x`, `y`, and `z` as a child object of the local
| objSetupFunction | `Lua Function` () |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);`
@ -2346,7 +2371,7 @@ Spawns a synchronized object at `x`, `y`, and `z` as a child object of the local
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)`
`local objectValue = spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)`
### Parameters
| Field | Type |
@ -2359,7 +2384,7 @@ Spawns a non-synchronized object at `x`, `y`, and `z` as a child object of the l
| objSetupFunction | `Lua Function` () |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);`
@ -2430,7 +2455,7 @@ Returns an object's extended model id
| o | [Object](structs.md#Object) |
### Returns
[enum ModelExtendedId](constants.md#enum-ModelExtendedId)
- [enum ModelExtendedId](constants.md#enum-ModelExtendedId)
### C Prototype
`enum ModelExtendedId obj_get_model_id_extended(struct Object *o);`
@ -2469,7 +2494,7 @@ Sets an object's model to `modelId`
Gets a trajectory by `name`
### Lua Example
`local PointerValue = get_trajectory(name)`
`local pointerValue = get_trajectory(name)`
### Parameters
| Field | Type |
@ -2492,13 +2517,13 @@ Gets a trajectory by `name`
When used in a geo function, retrieve the current processed object
### Lua Example
`local ObjectValue = geo_get_current_object()`
`local objectValue = geo_get_current_object()`
### Parameters
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *geo_get_current_object(void);`
@ -2513,13 +2538,13 @@ When used in a geo function, retrieve the current processed object
Gets the object currently being processed
### Lua Example
`local ObjectValue = get_current_object()`
`local objectValue = get_current_object()`
### Parameters
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *get_current_object(void);`
@ -2534,13 +2559,13 @@ Gets the object currently being processed
Gets the NPC object Mario is talking to
### Lua Example
`local ObjectValue = get_dialog_object()`
`local objectValue = get_dialog_object()`
### Parameters
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *get_dialog_object(void);`
@ -2555,13 +2580,13 @@ Gets the NPC object Mario is talking to
Gets the cutscene focus object
### Lua Example
`local ObjectValue = get_cutscene_focus()`
`local objectValue = get_cutscene_focus()`
### Parameters
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *get_cutscene_focus(void);`
@ -2576,13 +2601,13 @@ Gets the cutscene focus object
Gets the secondary camera focus object
### Lua Example
`local ObjectValue = get_secondary_camera_focus()`
`local objectValue = get_secondary_camera_focus()`
### Parameters
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *get_secondary_camera_focus(void);`
@ -2643,7 +2668,7 @@ Sets the secondary camera focus object
Gets the first object in an object list
### Lua Example
`local ObjectValue = obj_get_first(objList)`
`local objectValue = obj_get_first(objList)`
### Parameters
| Field | Type |
@ -2651,7 +2676,7 @@ Gets the first object in an object list
| objList | [enum ObjectList](constants.md#enum-ObjectList) |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_first(enum ObjectList objList);`
@ -2666,7 +2691,7 @@ Gets the first object in an object list
Gets the first object loaded with `behaviorId`
### Lua Example
`local ObjectValue = obj_get_first_with_behavior_id(behaviorId)`
`local objectValue = obj_get_first_with_behavior_id(behaviorId)`
### Parameters
| Field | Type |
@ -2674,7 +2699,7 @@ Gets the first object loaded with `behaviorId`
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_first_with_behavior_id(enum BehaviorId behaviorId);`
@ -2689,7 +2714,7 @@ Gets the first object loaded with `behaviorId`
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)`
`local objectValue = obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value)`
### Parameters
| Field | Type |
@ -2699,7 +2724,7 @@ Gets the first object loaded with `behaviorId` and object signed 32-bit integer
| value | `integer` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_first_with_behavior_id_and_field_s32(enum BehaviorId behaviorId, s32 fieldIndex, s32 value);`
@ -2714,7 +2739,7 @@ Gets the first object loaded with `behaviorId` and object signed 32-bit integer
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)`
`local objectValue = obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value)`
### Parameters
| Field | Type |
@ -2724,7 +2749,7 @@ Gets the first object loaded with `behaviorId` and object float field (look in `
| value | `number` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_first_with_behavior_id_and_field_f32(enum BehaviorId behaviorId, s32 fieldIndex, f32 value);`
@ -2739,7 +2764,7 @@ Gets the first object loaded with `behaviorId` and object float field (look in `
Gets the next object in an object list
### Lua Example
`local ObjectValue = obj_get_next(o)`
`local objectValue = obj_get_next(o)`
### Parameters
| Field | Type |
@ -2747,7 +2772,7 @@ Gets the next object in an object list
| o | [Object](structs.md#Object) |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_next(struct Object *o);`
@ -2762,7 +2787,7 @@ Gets the next object in an object list
Gets the next object loaded with the same behavior ID
### Lua Example
`local ObjectValue = obj_get_next_with_same_behavior_id(o)`
`local objectValue = obj_get_next_with_same_behavior_id(o)`
### Parameters
| Field | Type |
@ -2770,7 +2795,7 @@ Gets the next object loaded with the same behavior ID
| o | [Object](structs.md#Object) |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_next_with_same_behavior_id(struct Object *o);`
@ -2785,7 +2810,7 @@ Gets the next object loaded with the same behavior ID
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)`
`local objectValue = obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value)`
### Parameters
| Field | Type |
@ -2795,7 +2820,7 @@ Gets the next object loaded with the same behavior ID and object signed 32-bit i
| value | `integer` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_next_with_same_behavior_id_and_field_s32(struct Object *o, s32 fieldIndex, s32 value);`
@ -2810,7 +2835,7 @@ Gets the next object loaded with the same behavior ID and object signed 32-bit i
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)`
`local objectValue = obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value)`
### Parameters
| Field | Type |
@ -2820,7 +2845,7 @@ Gets the next object loaded with the same behavior ID and object float field (lo
| value | `number` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_next_with_same_behavior_id_and_field_f32(struct Object *o, s32 fieldIndex, f32 value);`
@ -2835,7 +2860,7 @@ Gets the next object loaded with the same behavior ID and object float field (lo
Gets the nearest object with `behaviorId` to `o`
### Lua Example
`local ObjectValue = obj_get_nearest_object_with_behavior_id(o, behaviorId)`
`local objectValue = obj_get_nearest_object_with_behavior_id(o, behaviorId)`
### Parameters
| Field | Type |
@ -2844,7 +2869,7 @@ Gets the nearest object with `behaviorId` to `o`
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_nearest_object_with_behavior_id(struct Object *o, enum BehaviorId behaviorId);`
@ -2882,7 +2907,7 @@ Counts every object with `behaviorId`
Gets the corresponding collided object to an index from `o`
### Lua Example
`local ObjectValue = obj_get_collided_object(o, index)`
`local objectValue = obj_get_collided_object(o, index)`
### Parameters
| Field | Type |
@ -2891,7 +2916,7 @@ Gets the corresponding collided object to an index from `o`
| index | `integer` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *obj_get_collided_object(struct Object *o, s16 index);`
@ -3104,7 +3129,7 @@ Sets the signed 32-bit integer value from the sub field corresponding to `fieldS
Returns a temporary particle spawn info pointer with its model loaded in from `modelId`
### Lua Example
`local SpawnParticlesInfoValue = obj_get_temp_spawn_particles_info(modelId)`
`local spawnParticlesInfoValue = obj_get_temp_spawn_particles_info(modelId)`
### Parameters
| Field | Type |
@ -3112,7 +3137,7 @@ Returns a temporary particle spawn info pointer with its model loaded in from `m
| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) |
### Returns
[SpawnParticlesInfo](structs.md#SpawnParticlesInfo)
- [SpawnParticlesInfo](structs.md#SpawnParticlesInfo)
### C Prototype
`struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId);`
@ -3127,7 +3152,7 @@ Returns a temporary particle spawn info pointer with its model loaded in from `m
Returns a temporary water droplet params pointer with its model and behavior loaded in from `modelId` and `behaviorId`
### Lua Example
`local WaterDropletParamsValue = obj_get_temp_water_droplet_params(modelId, behaviorId)`
`local waterDropletParamsValue = obj_get_temp_water_droplet_params(modelId, behaviorId)`
### Parameters
| Field | Type |
@ -3136,7 +3161,7 @@ Returns a temporary water droplet params pointer with its model and behavior loa
| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) |
### Returns
[WaterDropletParams](structs.md#WaterDropletParams)
- [WaterDropletParams](structs.md#WaterDropletParams)
### C Prototype
`struct WaterDropletParams* obj_get_temp_water_droplet_params(enum ModelExtendedId modelId, enum BehaviorId behaviorId);`
@ -3151,13 +3176,13 @@ Returns a temporary water droplet params pointer with its model and behavior loa
Returns a temporary object hitbox pointer
### Lua Example
`local ObjectHitboxValue = get_temp_object_hitbox()`
`local objectHitboxValue = get_temp_object_hitbox()`
### Parameters
- None
### Returns
[ObjectHitbox](structs.md#ObjectHitbox)
- [ObjectHitbox](structs.md#ObjectHitbox)
### C Prototype
`struct ObjectHitbox* get_temp_object_hitbox(void);`
@ -3539,7 +3564,7 @@ Resets every modified dialog back to vanilla
Gets the DialogEntry struct for the given `dialogId`
### Lua Example
`local DialogEntryValue = smlua_text_utils_dialog_get(dialogId)`
`local dialogEntryValue = smlua_text_utils_dialog_get(dialogId)`
### Parameters
| Field | Type |
@ -3547,7 +3572,7 @@ Gets the DialogEntry struct for the given `dialogId`
| dialogId | [enum DialogId](constants.md#enum-DialogId) |
### Returns
[DialogEntry](structs.md#DialogEntry)
- [DialogEntry](structs.md#DialogEntry)
### C Prototype
`struct DialogEntry* smlua_text_utils_dialog_get(enum DialogId dialogId);`
@ -4626,6 +4651,32 @@ Detects wall collisions at a given position and adjusts the position based on th
<br />
## [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)
### Lua Example
`local numberValue, pceil = find_ceil(posX, posY, posZ)`
### Parameters
| Field | Type |
| ----- | ---- |
| posX | `number` |
| posY | `number` |
| posZ | `number` |
### Returns
- `number`
- [Surface](structs.md#Surface)
### C Prototype
`f32 find_ceil(f32 posX, f32 posY, f32 posZ, RET struct Surface **pceil);`
[:arrow_up_small:](#)
<br />
## [find_ceil_height](#find_ceil_height)
### Description
@ -4676,6 +4727,32 @@ Finds the height of the highest floor below a given position (x, y, z). If no fl
<br />
## [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)
### Lua Example
`local numberValue, pfloor = find_floor(xPos, yPos, zPos)`
### Parameters
| Field | Type |
| ----- | ---- |
| xPos | `number` |
| yPos | `number` |
| zPos | `number` |
### Returns
- `number`
- [Surface](structs.md#Surface)
### C Prototype
`f32 find_floor(f32 xPos, f32 yPos, f32 zPos, RET struct Surface **pfloor);`
[:arrow_up_small:](#)
<br />
## [find_water_level](#find_water_level)
### Description
@ -4768,7 +4845,7 @@ Gets the closest point of the triangle to `src` and returns it in `out`.
- None
### C Prototype
`void closest_point_to_triangle(struct Surface* surf, Vec3f src, OUT Vec3f out);`
`void closest_point_to_triangle(struct Surface* surf, Vec3f src, VEC_OUT Vec3f out);`
[:arrow_up_small:](#)
@ -4807,13 +4884,13 @@ Loads the object's collision data into dynamic collision. You must run this ever
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()`
`local staticObjectCollisionValue = load_static_object_collision()`
### Parameters
- None
### Returns
[StaticObjectCollision](structs.md#StaticObjectCollision)
- [StaticObjectCollision](structs.md#StaticObjectCollision)
### C Prototype
`struct StaticObjectCollision *load_static_object_collision();`
@ -4852,7 +4929,7 @@ Toggles a collection of static object surfaces
Gets a surface corresponding to `index` from the static object collision
### Lua Example
`local SurfaceValue = get_static_object_surface(col, index)`
`local surfaceValue = get_static_object_surface(col, index)`
### Parameters
| Field | Type |
@ -4861,7 +4938,7 @@ Gets a surface corresponding to `index` from the static object collision
| index | `integer` |
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface *get_static_object_surface(struct StaticObjectCollision *col, u32 index);`
@ -4876,7 +4953,7 @@ Gets a surface corresponding to `index` from the static object collision
Gets a surface corresponding to `index` from the surface pool buffer
### Lua Example
`local SurfaceValue = obj_get_surface_from_index(o, index)`
`local surfaceValue = obj_get_surface_from_index(o, index)`
### Parameters
| Field | Type |
@ -4885,7 +4962,7 @@ Gets a surface corresponding to `index` from the surface pool buffer
| index | `integer` |
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface *obj_get_surface_from_index(struct Object *o, u32 index);`
@ -4929,7 +5006,7 @@ Checks if a surface has force
Retrieves an object from a sync ID
### Lua Example
`local ObjectValue = sync_object_get_object(syncId)`
`local objectValue = sync_object_get_object(syncId)`
### Parameters
| Field | Type |
@ -4937,7 +5014,7 @@ Retrieves an object from a sync ID
| syncId | `integer` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* sync_object_get_object(u32 syncId);`

View file

@ -964,6 +964,7 @@
- [initiate_painting_warp](functions-3.md#initiate_painting_warp)
- [level_trigger_warp](functions-3.md#level_trigger_warp)
- [warp_special](functions-3.md#warp_special)
- [initiate_warp](functions-3.md#initiate_warp)
- [lvl_set_current_level](functions-3.md#lvl_set_current_level)
<br />
@ -1026,6 +1027,8 @@
- [mario_get_terrain_sound_addend](functions-4.md#mario_get_terrain_sound_addend)
- [resolve_and_return_wall_collisions](functions-4.md#resolve_and_return_wall_collisions)
- [resolve_and_return_wall_collisions_data](functions-4.md#resolve_and_return_wall_collisions_data)
- [vec3f_find_ceil](functions-4.md#vec3f_find_ceil)
- [vec3f_mario_ceil](functions-4.md#vec3f_mario_ceil)
- [mario_facing_downhill](functions-4.md#mario_facing_downhill)
- [mario_floor_is_slippery](functions-4.md#mario_floor_is_slippery)
- [mario_floor_is_slope](functions-4.md#mario_floor_is_slope)
@ -1285,28 +1288,28 @@
<br />
- math_util_vec3i.inl
- [vec3i_zero](functions-4.md#vec3i_zero)
- [vec3i_copy](functions-4.md#vec3i_copy)
- [vec3i_set](functions-4.md#vec3i_set)
- [vec3i_add](functions-4.md#vec3i_add)
- [vec3i_sum](functions-4.md#vec3i_sum)
- [vec3i_sub](functions-4.md#vec3i_sub)
- [vec3i_dif](functions-4.md#vec3i_dif)
- [vec3i_mul](functions-4.md#vec3i_mul)
- [vec3i_mult](functions-4.md#vec3i_mult)
- [vec3i_prod](functions-4.md#vec3i_prod)
- [vec3i_div](functions-4.md#vec3i_div)
- [vec3i_length](functions-4.md#vec3i_length)
- [vec3i_normalize](functions-4.md#vec3i_normalize)
- [vec3i_set_magnitude](functions-4.md#vec3i_set_magnitude)
- [vec3i_dot](functions-4.md#vec3i_dot)
- [vec3i_cross](functions-4.md#vec3i_cross)
- [vec3i_combine](functions-4.md#vec3i_combine)
- [vec3i_dist](functions-4.md#vec3i_dist)
- [vec3i_hdist](functions-4.md#vec3i_hdist)
- [vec3i_is_zero](functions-4.md#vec3i_is_zero)
- [vec3i_to_vec3f](functions-4.md#vec3i_to_vec3f)
- [vec3i_to_vec3s](functions-4.md#vec3i_to_vec3s)
- [vec3i_zero](functions-5.md#vec3i_zero)
- [vec3i_copy](functions-5.md#vec3i_copy)
- [vec3i_set](functions-5.md#vec3i_set)
- [vec3i_add](functions-5.md#vec3i_add)
- [vec3i_sum](functions-5.md#vec3i_sum)
- [vec3i_sub](functions-5.md#vec3i_sub)
- [vec3i_dif](functions-5.md#vec3i_dif)
- [vec3i_mul](functions-5.md#vec3i_mul)
- [vec3i_mult](functions-5.md#vec3i_mult)
- [vec3i_prod](functions-5.md#vec3i_prod)
- [vec3i_div](functions-5.md#vec3i_div)
- [vec3i_length](functions-5.md#vec3i_length)
- [vec3i_normalize](functions-5.md#vec3i_normalize)
- [vec3i_set_magnitude](functions-5.md#vec3i_set_magnitude)
- [vec3i_dot](functions-5.md#vec3i_dot)
- [vec3i_cross](functions-5.md#vec3i_cross)
- [vec3i_combine](functions-5.md#vec3i_combine)
- [vec3i_dist](functions-5.md#vec3i_dist)
- [vec3i_hdist](functions-5.md#vec3i_hdist)
- [vec3i_is_zero](functions-5.md#vec3i_is_zero)
- [vec3i_to_vec3f](functions-5.md#vec3i_to_vec3f)
- [vec3i_to_vec3s](functions-5.md#vec3i_to_vec3s)
<br />
@ -1847,7 +1850,7 @@
- [camera_romhack_allow_centering](functions-6.md#camera_romhack_allow_centering)
- [camera_allow_toxic_gas_camera](functions-6.md#camera_allow_toxic_gas_camera)
- [camera_romhack_allow_dpad_usage](functions-6.md#camera_romhack_allow_dpad_usage)
- [rom_hack_cam_set_collisions](functions-6.md#rom_hack_cam_set_collisions)
- [camera_romhack_set_collisions](functions-6.md#camera_romhack_set_collisions)
- [camera_romhack_set_zoomed_in_dist](functions-6.md#camera_romhack_set_zoomed_in_dist)
- [camera_romhack_set_zoomed_out_dist](functions-6.md#camera_romhack_set_zoomed_out_dist)
- [camera_romhack_set_zoomed_in_height](functions-6.md#camera_romhack_set_zoomed_in_height)
@ -1938,6 +1941,7 @@
- [gfx_get_vertex_buffer](functions-6.md#gfx_get_vertex_buffer)
- [gfx_get_vertex_count](functions-6.md#gfx_get_vertex_count)
- [gfx_get_texture](functions-6.md#gfx_get_texture)
- [gfx_get_from_name](functions-6.md#gfx_get_from_name)
- [gfx_get_name](functions-6.md#gfx_get_name)
- [gfx_get_length](functions-6.md#gfx_get_length)
- [gfx_get_command](functions-6.md#gfx_get_command)
@ -1947,6 +1951,7 @@
- [gfx_resize](functions-6.md#gfx_resize)
- [gfx_delete](functions-6.md#gfx_delete)
- [gfx_delete_all](functions-6.md#gfx_delete_all)
- [vtx_get_from_name](functions-6.md#vtx_get_from_name)
- [vtx_get_name](functions-6.md#vtx_get_name)
- [vtx_get_count](functions-6.md#vtx_get_count)
- [vtx_get_vertex](functions-6.md#vtx_get_vertex)
@ -2026,6 +2031,7 @@
- [get_hand_foot_pos_y](functions-7.md#get_hand_foot_pos_y)
- [get_hand_foot_pos_z](functions-7.md#get_hand_foot_pos_z)
- [get_mario_anim_part_pos](functions-7.md#get_mario_anim_part_pos)
- [get_mario_anim_part_rot](functions-7.md#get_mario_anim_part_rot)
- [get_current_save_file_num](functions-7.md#get_current_save_file_num)
- [save_file_get_using_backup_slot](functions-7.md#save_file_get_using_backup_slot)
- [save_file_set_using_backup_slot](functions-7.md#save_file_set_using_backup_slot)
@ -2188,8 +2194,10 @@
- surface_collision.h
- [find_wall_collisions](functions-7.md#find_wall_collisions)
- [find_ceil](functions-7.md#find_ceil)
- [find_ceil_height](functions-7.md#find_ceil_height)
- [find_floor_height](functions-7.md#find_floor_height)
- [find_floor](functions-7.md#find_floor)
- [find_water_level](functions-7.md#find_water_level)
- [find_poison_gas_level](functions-7.md#find_poison_gas_level)
- [set_find_wall_direction](functions-7.md#set_find_wall_direction)
@ -2739,7 +2747,7 @@ Derives a `MARIO_SPAWN_*` constant from `o`
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)`
`local objectWarpNodeValue = area_get_warp_node(id)`
### Parameters
| Field | Type |
@ -2747,7 +2755,7 @@ Finds a warp node in the current area by its ID. The warp node must exist in the
| id | `integer` |
### Returns
[ObjectWarpNode](structs.md#ObjectWarpNode)
- [ObjectWarpNode](structs.md#ObjectWarpNode)
### C Prototype
`struct ObjectWarpNode *area_get_warp_node(u8 id);`
@ -2762,13 +2770,13 @@ Finds a warp node in the current area by its ID. The warp node must exist in the
Gets the first warp node found in the area, otherwise returns nil
### Lua Example
`local ObjectWarpNodeValue = area_get_any_warp_node()`
`local objectWarpNodeValue = area_get_any_warp_node()`
### Parameters
- None
### Returns
[ObjectWarpNode](structs.md#ObjectWarpNode)
- [ObjectWarpNode](structs.md#ObjectWarpNode)
### C Prototype
`struct ObjectWarpNode *area_get_any_warp_node(void);`
@ -2783,7 +2791,7 @@ Gets the first warp node found in the area, otherwise returns nil
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)`
`local objectWarpNodeValue = area_get_warp_node_from_params(o)`
### Parameters
| Field | Type |
@ -2791,7 +2799,7 @@ Finds a warp node in the current area using parameters from the provided object.
| o | [Object](structs.md#Object) |
### Returns
[ObjectWarpNode](structs.md#ObjectWarpNode)
- [ObjectWarpNode](structs.md#ObjectWarpNode)
### C Prototype
`struct ObjectWarpNode *area_get_warp_node_from_params(struct Object *o);`

View file

@ -8,25 +8,29 @@ The Lighting Engine is a vertex point lighting system built directly into sm64co
To use the Lighting Engine, you need to figure out how you want to approach using it given the different modes it has. There are also 2 methods to enable the lighting engine, either by setting the ambient color, or spawning a point light in.
If you want to make a vertex buffer not be affected by the lighting engine even when it's enabled, you can use `gsSPVertexNonGlobal` in the displaylist instead of `gsSPVertex`. This tells the renderer to not apply any of the effects Lua can do.
## Section 2: Modes
The lighting engine has 3 modes you can switch between using `le_set_mode(mode)`.
1. `LE_MODE_AFFECT_ALL_SHADED_AND_COLORED`: (Default) Applies lighting to every shaded and vertex colored surface minus some geometry and menus.
1. `LE_MODE_AFFECT_ALL_SHADED_AND_COLORED`: Applies lighting to every shaded and vertex colored surface minus some geometry and menus.
2. `LE_MODE_AFFECT_ALL_SHADED`: Applies lighting to every shaded surface minus some geometry and menus.
3. `LE_MODE_AFFECT_ONLY_GEOMETRY_MODE`: Only applies lighting to geometry that has the `G_LIGHTING_ENGINE_EXT` geometry mode.
3. `LE_MODE_AFFECT_ONLY_GEOMETRY_MODE`: **(Default)** Only applies lighting to geometry that has the `G_LIGHTING_ENGINE_EXT` geometry mode.
`LE_MODE_AFFECT_ONLY_GEOMETRY_MODE` was the only "mode" until djoslin0 improved the lighting engine and came up with a system for affecting shaded surfaces without needing to apply the lighting engine geometry mode to every actor and level manually.
I recommend you use `LE_MODE_AFFECT_ALL_SHADED_AND_COLORED` since that generally covers everything and doesn't require any additional effort like manually adding the lighting engine flag to everything.
## Section 3: Tonemapping
The lighting engine has 4 tonemapping modes you can switch between using `le_set_tone_mapping(toneMapping)`.
1. `LE_TONE_MAPPING_TOTAL_WEIGHTED`: Weighs the combined ambient color and lights together, can look slightly dim.
2. `LE_TONE_MAPPING_WEIGHTED`: (Default) Weights the lights on top of the ambient color instead of with it, generally looks the best with good color balance.
2. `LE_TONE_MAPPING_WEIGHTED`: **(Default)** Weights the lights on top of the ambient color instead of with it, generally looks the best with good color balance.
3. `LE_TONE_MAPPING_CLAMP`: The sum of the lights and ambient color clamped between 0 and 255. Colors can look overexposed if lights are too bright.
@ -94,4 +98,4 @@ You can also make your own light behavior and call `bhv_point_light_init()` and
| `le_get_light_intensity(id)` | Gets a lighting engine point light's `intensity` |
| `le_set_light_intensity(id, intensity)` | Sets a lighting engine point light's `intensity` |
| `le_get_light_use_surface_normals(id)` | Gets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals` |
| `le_set_light_use_surface_normals(id, useSurfaceNormals)` | Sets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals` |
| `le_set_light_use_surface_normals(id, useSurfaceNormals)` | Sets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals` |

View file

@ -336,6 +336,7 @@
| RespawnShellBoxes | `integer` | |
| MultipleCapCollection | `integer` | |
| InfiniteRenderDistance | `integer` | |
| ProcessLODs | `integer` | |
| CourtyardBoosRequirement | `integer` | |
| starsNeededForDialog | [StarsNeededForDialog](structs.md#StarsNeededForDialog) | read-only |
| dialogs | [BehaviorDialogs](structs.md#BehaviorDialogs) | read-only |
@ -1595,6 +1596,7 @@
| torsoPos | [Vec3f](structs.md#Vec3f) | read-only |
| heldObjLastPosition | [Vec3f](structs.md#Vec3f) | read-only |
| animPartsPos | `Array` <`Vec3f`> | read-only |
| animPartsRot | `Array` <`Vec3s`> | read-only |
| currAnimPart | `integer` | read-only |
| updateTorsoTime | `integer` | read-only |
| updateHeadPosTime | `integer` | read-only |

View file

@ -58,6 +58,9 @@ define_gfx_symbol(gsSPLoadGeometryMode, 1, false, GFX_PARAM_TYPE_INT);
define_gfx_symbol(gsSPVertexNonGlobal, 3, true, GFX_PARAM_TYPE_VTX, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT);
define_gfx_symbol(gsSPCopyPlayerPartToColor, 3, false, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT);
define_gfx_symbol(gsSPFresnel, 2, false, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT);
define_gfx_symbol(gsDPSetColorImage, 4, false, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT);
define_gfx_symbol(gsSPNoOp, 0, false);
define_gfx_symbol(gsSPMatrix, 2, false, GFX_PARAM_TYPE_PTR, GFX_PARAM_TYPE_INT);
define_gfx_symbol_manual(gsSPTexture, 5, false, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT, GFX_PARAM_TYPE_INT);
define_gfx_symbol_manual(gsSPSetGeometryMode, 1, false, GFX_PARAM_TYPE_INT);

View file

@ -293,7 +293,7 @@ chan_setlayer 0, .layer_toad_D33
chan_end
.layer_toad_D33:
layer_note1 39, 0xaa, 127
layer_note1 39, 0xaa, 100
layer_end
.sound_toad_haha:

View file

@ -263,7 +263,7 @@
#define SOUND_PEACH_MARIO2 /* 0x243FFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3F, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)
/* Mario Sound Effects (Coop) */
#define SOUND_MARIO_LETS_A_GO /* 0x7024FF80 */ SOUND_MENU_STAR_SOUND_LETS_A_GO
#define SOUND_MARIO_LETS_A_GO /* 0x7024FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x24, 0xFF, SOUND_DISCRETE)
/* General Sound Effects */
#define SOUND_GENERAL_ACTIVATE_CAP_SWITCH /* 0x30008080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x00, 0x80, SOUND_DISCRETE)

View file

@ -420,6 +420,7 @@ struct MarioBodyState
Vec3f heldObjLastPosition; /// also known as HOLP
Vec3f animPartsPos[MARIO_ANIM_PART_MAX];
Vec3s animPartsRot[MARIO_ANIM_PART_MAX];
u32 currAnimPart;
u32 updateTorsoTime;

View file

@ -0,0 +1,353 @@
--[[
Custom Font Handler v1 - By Squishy6094
This file adds custom font functionality, and does not need to be edited
Ensure this file is loaded before anything else (make the file name start with a or !)
Use djui_hud_add_font() to add fonts as shown in main.lua
]]
FONT_HANDLER_VERSION_MAJOR = 1
FONT_HANDLER_VERSION_MINOR = 0
FONT_HANDLER_VERSION = "v"..FONT_HANDLER_VERSION_MAJOR.."."..FONT_HANDLER_VERSION_MINOR
local djui_classic_hud_set_font = djui_hud_set_font
local djui_classic_hud_print_text = djui_hud_print_text
local djui_classic_hud_print_text_interpolated = djui_hud_print_text_interpolated
local djui_classic_hud_measure_text = djui_hud_measure_text
local customFont = false
local fontTable = {}
CUSTOM_FONT_COUNT = FONT_COUNT
local customFontType = FONT_NORMAL
local latinChars = {
[32] = " ", [33] = "!", [34] = "\"", [35] = "#", [36] = "$", [37] = "%", [38] = "&", [39] = "'",
[40] = "(", [41] = ")", [42] = "*", [43] = "+", [44] = ",", [45] = "-", [46] = ".", [47] = "/",
[48] = "0", [49] = "1", [50] = "2", [51] = "3", [52] = "4", [53] = "5", [54] = "6", [55] = "7",
[56] = "8", [57] = "9", [58] = ":", [59] = ";", [60] = "<", [61] = "=", [62] = ">", [63] = "?",
[64] = "@", [65] = "A", [66] = "B", [67] = "C", [68] = "D", [69] = "E", [70] = "F", [71] = "G",
[72] = "H", [73] = "I", [74] = "J", [75] = "K", [76] = "L", [77] = "M", [78] = "N", [79] = "O",
[80] = "P", [81] = "Q", [82] = "R", [83] = "S", [84] = "T", [85] = "U", [86] = "V", [87] = "W",
[88] = "X", [89] = "Y", [90] = "Z", [91] = "[", [92] = "\\", [93] = "]", [94] = "^", [95] = "_",
[96] = "`", [97] = "a", [98] = "b", [99] = "c", [100] = "d", [101] = "e", [102] = "f", [103] = "g",
[104] = "h", [105] = "i", [106] = "j", [107] = "k", [108] = "l", [109] = "m", [110] = "n", [111] = "o",
[112] = "p", [113] = "q", [114] = "r", [115] = "s", [116] = "t", [117] = "u", [118] = "v", [119] = "w",
[120] = "x", [121] = "y", [122] = "z", [123] = "{", [124] = "|", [125] = "}", [126] = "~",
-- Latin-1 Supplement
[160] = " ", [161] = "¡", [162] = "¢", [163] = "£", [164] = "¤", [165] = "¥", [166] = "¦", [167] = "§",
[168] = "¨", [169] = "©", [170] = "ª", [171] = "«", [172] = "¬", [173] = "­", [174] = "®", [175] = "¯",
[176] = "°", [177] = "±", [178] = "²", [179] = "³", [180] = "´", [181] = "µ", [182] = "", [183] = "·",
[184] = "¸", [185] = "¹", [186] = "º", [187] = "»", [188] = "¼", [189] = "½", [190] = "¾", [191] = "¿",
[192] = "À", [193] = "Á", [194] = "Â", [195] = "Ã", [196] = "Ä", [197] = "Å", [198] = "Æ", [199] = "Ç",
[200] = "È", [201] = "É", [202] = "Ê", [203] = "Ë", [204] = "Ì", [205] = "Í", [206] = "Î", [207] = "Ï",
[208] = "Ð", [209] = "Ñ", [210] = "Ò", [211] = "Ó", [212] = "Ô", [213] = "Õ", [214] = "Ö", [215] = "×",
[216] = "Ø", [217] = "Ù", [218] = "Ú", [219] = "Û", [220] = "Ü", [221] = "Ý", [222] = "Þ", [223] = "ß",
[224] = "à", [225] = "á", [226] = "â", [227] = "ã", [228] = "ä", [229] = "å", [230] = "æ", [231] = "ç",
[232] = "è", [233] = "é", [234] = "ê", [235] = "ë", [236] = "ì", [237] = "í", [238] = "î", [239] = "ï",
[240] = "ð", [241] = "ñ", [242] = "ò", [243] = "ó", [244] = "ô", [245] = "õ", [246] = "ö", [247] = "÷",
[248] = "ø", [249] = "ù", [250] = "ú", [251] = "û", [252] = "ü", [253] = "ý", [254] = "þ", [255] = "ÿ"
}
local HudAnimTimer = 0
local function convert_unicode_table_to_string_table(input)
local output = {}
for i = 1, #input do
local letter = input[i]
if letter ~= nil and latinChars[letter.id] ~= nil then
output[latinChars[letter.id]] = letter
end
end
return output
end
local function string_to_table(str)
local charArray = {};
local iStart = 0;
local strLen = str:len();
local function bit(b)
return 2 ^ (b - 1);
end
local function hasbit(w, b)
return w % (b + b) >= b
end
local checkMultiByte = function(i)
if (iStart ~= 0) then
charArray[#charArray + 1] = str:sub(iStart, i - 1)
iStart = 0
end
end
for i = 1, strLen do
local b = str:byte(i)
local multiStart = hasbit(b, bit(7)) and hasbit(b, bit(8))
local multiTrail = not hasbit(b, bit(7)) and hasbit(b, bit(8))
if (multiStart) then
checkMultiByte(i)
iStart = i
elseif (not multiTrail) then
checkMultiByte(i)
charArray[#charArray + 1] = str:sub(i, i)
end
end
return charArray
end
---@param texture TextureInfo
---@param info table
---@param spacing integer
---@param offset integer
---@param backup string
---@param scale integer
---@return DjuiFontType
function djui_hud_add_font(texture, info, spacing, offset, backup, scale)
if texture == nil then return FONT_NORMAL end
if info == nil then return FONT_NORMAL end
if spacing == nil then spacing = 1 end
if offset == nil then offset = 0 end
if backup == nil then backup = "x" end
if scale == nil then scale = 1 end
if info[1] ~= nil and info[1].id ~= nil then
info = convert_unicode_table_to_string_table(info)
end
CUSTOM_FONT_COUNT = CUSTOM_FONT_COUNT + 1
fontTable[CUSTOM_FONT_COUNT] = {
spritesheet = texture,
spacing = spacing,
offset = offset,
info = info,
backup = backup,
scale = scale,
}
return CUSTOM_FONT_COUNT
end
---@param fontType DjuiFontType
---@return nil
function djui_hud_set_font(fontType)
if fontType > FONT_COUNT then
customFont = true
customFontType = fontType
else
customFont = false
djui_classic_hud_set_font(fontType)
end
end
local textShake = 0
function djui_hud_effect_shake(intensity)
textShake = math.ceil(intensity*100)*0.01
end
local textWaveX = 0
local textWaveY = 0
local textWaveSpeed = 0
function djui_hud_effect_wave(x, y, speed)
textWaveX = x
textWaveY = y
textWaveSpeed = speed
end
---@param message string
---@param x number
---@param y number
---@param scale number
---@return nil
function djui_hud_print_text(message, x, y, scale)
if customFont then
if message == nil or message == "" then return end
local message = string_to_table(message)
local currFont = fontTable[customFontType]
y = y + currFont.offset
scale = scale*currFont.scale
for i = 1, #message do
local letter = message[i]
if letter and letter ~= " " then
if currFont.info[letter] == nil then
letter = currFont.backup
end
local scaleWidth = scale*(currFont.info[letter].height/currFont.info[letter].width)
djui_hud_render_texture_tile(currFont.spritesheet,
x + ((currFont.info[letter].xoffset or 0)*scale) + math.random(-textShake*100, textShake*100)*0.01 + math.sin((HudAnimTimer+i*2)*textWaveSpeed*0.1)*textWaveX,
y + ((currFont.info[letter].yoffset or 0)*scale) + math.random(-textShake*100, textShake*100)*0.01 + math.cos((HudAnimTimer+i*2)*textWaveSpeed*0.1)*textWaveY,
scaleWidth, scale,
currFont.info[letter].x,
currFont.info[letter].y,
currFont.info[letter].width,
currFont.info[letter].height)
else
letter = currFont.backup
end
x = x + (currFont.info[letter].width + currFont.spacing)*scale
end
else
djui_classic_hud_print_text(message, x, y, scale)
end
end
---@param message string
---@param prevX number
---@param prevY number
---@param prevScale number
---@param x number
---@param y number
---@param scale number
---@return nil
-- Custom Fonts do not currently support Interpolation due to lack of RESOLUTION_N64 support
function djui_hud_print_text_interpolated(message, prevX, prevY, prevScale, x, y, scale)
if customFont then
if message == nil or message == "" then return end
local message = string_to_table(message)
local currFont = fontTable[customFontType]
prevY = prevY + currFont.offset
y = y + currFont.offset
scale = scale*currFont.scale
for i = 1, #message do
local letter = message[i]
if letter and letter ~= " " then
if currFont.info[letter] == nil then
letter = currFont.backup
end
local prevScaleWidth = prevScale*(currFont.info[letter].height/currFont.info[letter].width)
local scaleWidth = scale*(currFont.info[letter].height/currFont.info[letter].width)
local xOffset = ((currFont.info[letter].xoffset or 0)*scale) + math.random(-textShake*100, textShake*100)*0.01 + math.sin((HudAnimTimer+i*2)*textWaveSpeed*0.1)*textWaveX
local yOffset = ((currFont.info[letter].yoffset or 0)*scale) + math.random(-textShake*100, textShake*100)*0.01 + math.cos((HudAnimTimer+i*2)*textWaveSpeed*0.1)*textWaveY
djui_hud_render_texture_tile_interpolated(currFont.spritesheet,
prevX + xOffset,
prevY + yOffset,
prevScaleWidth, prevScale,
x + xOffset,
y + yOffset,
scaleWidth, scale,
currFont.info[letter].x,
currFont.info[letter].y,
currFont.info[letter].width,
currFont.info[letter].height)
else
letter = currFont.backup
end
x = x + (currFont.info[letter].width + currFont.spacing)*scale
prevX = prevX + (currFont.info[letter].width + currFont.spacing)*prevScale
end
else
djui_classic_hud_print_text_interpolated(message, prevX, prevY, prevScale, x, y, scale)
end
end
---@param message string
---@return number
function djui_hud_measure_text(message)
if customFont then
if message == nil or message == "" then return end
local message = string_to_table(message)
local currFont = fontTable[customFontType]
local scale = 1
local x = 0
for i = 1, #message do
local letter = message[i]
if letter and letter ~= " " then
if currFont.info[letter] == nil then
letter = currFont.backup
end
else
letter = currFont.backup
end
x = x + (currFont.info[letter].width + currFont.spacing)*scale
end
return x
else
return djui_classic_hud_measure_text(message)
end
end
local function hud_update()
-- Reset Values Every Frame
textShake = 0
textWaveX = 0
textWaveY = 0
textWaveSpeed = 0
-- Update Basic Anim Timer
HudAnimTimer = HudAnimTimer + 1
end
hook_event(HOOK_ON_HUD_RENDER_BEHIND, hud_update)
-- Adding custom fonts here to prevent main clutter
fontdataCharacteristic = {
["A"] = {x = 0, y = 0, width = 26, height = 32},
["B"] = {x = 32, y = 0, width = 25, height = 32},
["C"] = {x = 32*2, y = 0, width = 25, height = 32},
["D"] = {x = 32*3, y = 0, width = 23, height = 32},
["E"] = {x = 32*4, y = 0, width = 24, height = 32},
["F"] = {x = 32*5, y = 0, width = 24, height = 32},
["G"] = {x = 32*6, y = 0, width = 26, height = 32},
["H"] = {x = 32*7, y = 0, width = 25, height = 32},
["I"] = {x = 0, y = 32, width = 15, height = 32},
["J"] = {x = 32, y = 32, width = 21, height = 32},
["K"] = {x = 32*2, y = 32, width = 25, height = 32},
["L"] = {x = 32*3, y = 32, width = 22, height = 32},
["M"] = {x = 32*4, y = 32, width = 29, height = 32},
["N"] = {x = 32*5, y = 32, width = 27, height = 32},
["Ñ"] = {x = 32*6, y = 32, width = 27, height = 32},
["O"] = {x = 32*7, y = 32, width = 26, height = 32},
["P"] = {x = 0, y = 32*2, width = 25, height = 32},
["Q"] = {x = 32, y = 32*2, width = 27, height = 32},
["R"] = {x = 32*2, y = 32*2, width = 25, height = 32},
["S"] = {x = 32*3, y = 32*2, width = 24, height = 32},
["T"] = {x = 32*4, y = 32*2, width = 28, height = 32},
["U"] = {x = 32*5, y = 32*2, width = 26, height = 32},
["V"] = {x = 32*6, y = 32*2, width = 27, height = 32},
["W"] = {x = 32*7, y = 32*2, width = 30, height = 32},
["X"] = {x = 0, y = 32*3, width = 28, height = 32},
["Y"] = {x = 32, y = 32*3, width = 27, height = 32},
["Z"] = {x = 32*2, y = 32*3, width = 27, height = 32},
["!"] = {x = 32*3, y = 32*3, width = 30, height = 32},
["?"] = {x = 32*4, y = 32*3, width = 27, height = 32},
["@"] = {x = 32*5, y = 32*3, width = 29, height = 32},
["#"] = {x = 32*6, y = 32*3, width = 29, height = 32},
["$"] = {x = 32*7, y = 32*3, width = 23, height = 32},
["%"] = {x = 0, y = 32*4, width = 27, height = 32},
["^"] = {x = 32, y = 32*4, width = 24, height = 32},
["&"] = {x = 32*2, y = 32*4, width = 29, height = 32},
["*"] = {x = 32*3, y = 32*4, width = 18, height = 32},
["("] = {x = 32*4, y = 32*4, width = 17, height = 32},
[")"] = {x = 32*5, y = 32*4, width = 17, height = 32},
["_"] = {x = 32*6, y = 32*4, width = 31, height = 32},
["-"] = {x = 32*7, y = 32*4, width = 23, height = 32},
["+"] = {x = 0, y = 32*5, width = 24, height = 32},
["="] = {x = 32, y = 32*5, width = 27, height = 32},
["<"] = {x = 32*2, y = 32*5, width = 23, height = 32},
[">"] = {x = 32*3, y = 32*5, width = 23, height = 32},
["."] = {x = 32*4, y = 32*5, width = 11, height = 32},
[","] = {x = 32*5, y = 32*5, width = 11, height = 32},
[":"] = {x = 32*6, y = 32*5, width = 11, height = 32},
[";"] = {x = 32*7, y = 32*5, width = 11, height = 32},
["/"] = {x = 0, y = 32*6, width = 28, height = 32},
["\\"] = {x = 32, y = 32*6, width = 28, height = 32},
['"'] = {x = 32*2, y = 32*6, width = 14, height = 32},
["'"] = {x = 32*3, y = 32*6, width = 9, height = 32},
["|"] = {x = 32*4, y = 32*6, width = 10, height = 32},
["~"] = {x = 32*5, y = 32*6, width = 23, height = 32},
["1"] = {x = 32*6, y = 32*6, width = 23, height = 32},
["2"] = {x = 32*7, y = 32*6, width = 26, height = 32},
["3"] = {x = 0, y = 32*7, width = 24, height = 32},
["4"] = {x = 32, y = 32*7, width = 24, height = 32},
["5"] = {x = 32*2, y = 32*7, width = 26, height = 32},
["6"] = {x = 32*3, y = 32*7, width = 26, height = 32},
["7"] = {x = 32*4, y = 32*7, width = 30, height = 32},
["8"] = {x = 32*5, y = 32*7, width = 22, height = 32},
["9"] = {x = 32*6, y = 32*7, width = 24, height = 32},
["0"] = {x = 32*7, y = 32*7, width = 24, height = 32},
}
FONT_CHARACTERISTIC = djui_hud_add_font(get_texture_info("char_select_font_characteristic"), fontdataCharacteristic, -5, 0, "X", 1)

View file

@ -1,3 +0,0 @@
GITHUB_COMMIT_TIME = '05/16/2025 07:27:43 PM PST'
GITHUB_COMMIT_ID = '115b65e'
GITHUB_REPO = 'Squishy6094/character-select-coop'

View file

@ -0,0 +1,15 @@
CREDIT_SUPPORTERS = {
"Saul",
"Ellie",
"Lyrae",
"Sophia",
"maemae",
"charity",
"FunkyLion",
"VioletArts",
"Nope208",
"Jack Black",
"GRAND DAD",
"Key's Artworks",
"Kale!",
}

View file

@ -1,68 +1,22 @@
-- localize functions to improve performance - a-utils.lua
local string_lower,string_format,table_insert,get_date_and_time = string.lower,string.format,table.insert,get_date_and_time
-- Version Data --
MOD_VERSION_API = 1
MOD_VERSION_MAJOR = 14
MOD_VERSION_MINOR = 1
MOD_VERSION_MAJOR = 16
MOD_VERSION_MINOR = 0
MOD_VERSION_INDEV = false
MOD_VERSION_STRING = tostring(MOD_VERSION_API) .. "." .. tostring(MOD_VERSION_MAJOR) .. (MOD_VERSION_MINOR > 0 and ("." .. tostring(MOD_VERSION_MINOR)) or "") .. (MOD_VERSION_INDEV and " (In-Dev)" or "")
MOD_VERSION_DEBUG = tostring(GITHUB_REPO) .. " | " .. tostring(GITHUB_COMMIT_ID) .. " | " .. tostring(GITHUB_COMMIT_TIME)
if VERSION_NUMBER < 38 then
djui_popup_create("\n\\#FFAAAA\\Character Select requires\n the latest version of CoopDX to use!\n\nYou can find CoopDX here:\n\\#6666FF\\https://sm64coopdx.com", 5)
incompatibleClient = true
return 0
end
local dependacyFiles = {
-- Required Lua File
--"a-github.lua",
"dialog.lua",
"main.lua",
"n-hud.lua",
"o-api.lua",
"z-moveset.lua",
"z-palettes.lua",
"z-voice.lua",
-- Required Actors
"actors/armature_geo.bin",
}
local legacyFiles = {
"voice.lua",
"palettes.lua",
"z-anims.lua",
}
local fileErrorList = {}
-- Check for Missing Files
for i = 1, #dependacyFiles do
if not mod_file_exists(dependacyFiles[i]) then
log_to_console("Character Select file missing: '" .. dependacyFiles[i] .. "'", CONSOLE_MESSAGE_WARNING)
table_insert(fileErrorList, "Missing File '" .. dependacyFiles[i] .. "'")
end
end
-- Check for Legacy Files
for i = 1, #legacyFiles do
if mod_file_exists(legacyFiles[i]) then
log_to_console("Character Select legacy file found: '" .. legacyFiles[i] .. "'", CONSOLE_MESSAGE_WARNING)
table_insert(fileErrorList, "Legacy File '" .. legacyFiles[i] .. "'")
end
end
if #fileErrorList > 0 then
-- Check CoopDX Version
VERSION_REQUIRED = 41
if VERSION_NUMBER < VERSION_REQUIRED then
incompatibleClient = true
local frameCount = 0
hook_event(HOOK_UPDATE, function ()
frameCount = frameCount + 1
if frameCount == 5 then
local errorString = "\\#FFAAAA\\Character Select File Issues:"
djui_popup_create("\\#FFAAAA\\Character Select is having\nfile issues and cannot load!\n\nErrors have been logged in chat!", 4)
for i = 1, #fileErrorList do
errorString = errorString .. "\n" .. fileErrorList[i]
end
errorString = errorString .. "\n\nThe best way to resolve these issues is to delete your current version of Character Select and then install the latest version!"
djui_popup_create("\n\\#FFAAAA\\Character Select requires\n the latest version of CoopDX to use!\n\nYou can find CoopDX here:\n\\#AAAAFF\\https://sm64coopdx.com", 5)
djui_chat_message_create("\\#FFAAAA\\Character Select Version Issue:\nVersion " .. tostring(VERSION_NUMBER) .. " < " .. tostring(VERSION_REQUIRED))
local errorString = "\\#FFAAAA\\The best way to resolve this issue is to reinstall SM64CoopDX from the Offical Site or Github Repo!\n\\#AAAAFF\\https://sm64coopdx.com/\nhttps://github.com/coop-deluxe/sm64coopdx/"
log_to_console(errorString)
djui_chat_message_create(errorString)
end
@ -70,6 +24,132 @@ if #fileErrorList > 0 then
return 0
end
log_to_console("Character Select "..MOD_VERSION_STRING)
local dependacyFiles = {
--- Required Lua Files
"a-font-handler.lua",
"anims.lua",
"dialog.lua",
"hud.lua",
"main.lua",
"moveset.lua",
"palettes.lua",
"voice.lua",
"z-api.lua",
-- Required Texture Files
"textures/char_select_album_back.tex",
"textures/char_select_album_front.tex",
"textures/char_select_album_overlay.tex",
"textures/char_select_category.tex",
"textures/char_select_caution_tape.tex",
"textures/char_select_cd_layer1.tex",
"textures/char_select_cd_layer2.tex",
"textures/char_select_cd_layer3.tex",
"textures/char_select_cd_layer4.tex",
"textures/char_select_custom_course_bottom.tex",
"textures/char_select_custom_course_top.tex",
"textures/char_select_custom_meter_left.tex",
"textures/char_select_custom_meter_pie1.tex",
"textures/char_select_custom_meter_pie2.tex",
"textures/char_select_custom_meter_pie3.tex",
"textures/char_select_custom_meter_pie4.tex",
"textures/char_select_custom_meter_pie5.tex",
"textures/char_select_custom_meter_pie6.tex",
"textures/char_select_custom_meter_pie7.tex",
"textures/char_select_custom_meter_pie8.tex",
"textures/char_select_custom_meter_right.tex",
"textures/char_select_font_brick.tex",
"textures/char_select_font_characteristic.tex",
"textures/char_select_gear.tex",
"textures/char_select_graffiti_default.tex",
"textures/char_select_graffiti_luigi.tex",
"textures/char_select_graffiti_mario.tex",
"textures/char_select_graffiti_toad.tex",
"textures/char_select_graffiti_waluigi.tex",
"textures/char_select_graffiti_wario.tex",
"textures/char_select_icon_signs.tex",
"textures/char_select_list_button.tex",
"textures/char_select_logo.tex",
"textures/char_select_luigi_meter_left.tex",
"textures/char_select_luigi_meter_right.tex",
"textures/char_select_nameplate.tex",
"textures/char_select_options_tv.tex",
"textures/char_select_palette_bucket.tex",
"textures/char_select_record.tex",
"textures/char_select_toad_meter_left.tex",
"textures/char_select_toad_meter_right.tex",
"textures/char_select_wall_left.tex",
"textures/char_select_wall_right.tex",
"textures/char_select_waluigi_meter_left.tex",
"textures/char_select_waluigi_meter_right.tex",
"textures/char_select_wario_meter_left.tex",
"textures/char_select_wario_meter_right.tex",
}
local legacyFiles = {
"z-anims.lua",
"n-hud.lua",
"o-api.lua",
"z-moveset.lua",
"z-palettes.lua",
"z-voice.lua",
}
local fileErrorList = {}
if network_is_server() then
-- Check for Missing Files
for i = 1, #dependacyFiles do
if not mod_file_exists(dependacyFiles[i]) then
log_to_console("Character Select file missing: '" .. dependacyFiles[i] .. "'", CONSOLE_MESSAGE_WARNING)
table.insert(fileErrorList, "Missing File '" .. dependacyFiles[i] .. "'")
end
end
-- Check for Legacy Files
for i = 1, #legacyFiles do
if mod_file_exists(legacyFiles[i]) then
log_to_console("Character Select legacy file found: '" .. legacyFiles[i] .. "'", CONSOLE_MESSAGE_WARNING)
table.insert(fileErrorList, "Legacy File '" .. legacyFiles[i] .. "'")
end
end
if #fileErrorList > 0 then
incompatibleClient = true
local frameCount = 0
hook_event(HOOK_UPDATE, function ()
frameCount = frameCount + 1
if frameCount == 5 then
local errorString = "\\#FFAAAA\\Character Select File Issues:"
djui_popup_create("\\#FFAAAA\\Character Select is having\nfile issues and cannot load!\n\nErrors have been logged in chat!", 4)
for i = 1, #fileErrorList do
errorString = errorString .. "\n" .. fileErrorList[i]
end
log_to_console(errorString)
djui_chat_message_create(errorString)
errorString = "\\#FFAAAA\\The best way to resolve these issues is to delete your current version of Character Select and then install the latest version from the Github Repo!\n\\#AAAAFF\\https://github.com/Squishy6094/character-select-coop/\\#FFAAAA\\"
log_to_console(errorString)
djui_chat_message_create(errorString)
end
end)
return 0
end
end
-- Failsafe printing nil text
local djui_hud_print_text_original = djui_hud_print_text
function djui_hud_print_text(string, x, y, scale)
djui_hud_print_text_original(tostring(string), x, y, scale)
end
local string_sub = string.sub
function djui_hud_print_monospace_text(string, x, y, scale, space)
space = space or 16
for i = 1, #string do
djui_hud_print_text(string_sub(string, i, i), x + space*(i - 1)*scale, y, scale)
end
end
ommActive = false
for i in pairs(gActiveMods) do
if gActiveMods[i].relativePath == "omm-coop" then
@ -78,8 +158,6 @@ for i in pairs(gActiveMods) do
end
end
E_MODEL_ARMATURE = smlua_model_util_get_id("armature_geo")
local saveableCharacters = {
["1"] = 1,
["2"] = 1,
@ -125,44 +203,44 @@ local saveableCharacters = {
[" "] = 0,
}
--- @param string string
---@param string string
--- Replaces underscores in the string with spaces
function string_underscore_to_space(string)
if string == nil then return "" end
return string:gsub("_", " ")
end
--- @param string string
---@param string string
--- Constructs a new string but only with characters from `saveableCharacters`
--- * Spaces are the notable character that gets turned into an underscore
function string_space_to_underscore(string)
local s = ''
for i = 1, #string do
local c = string:sub(i,i)
if saveableCharacters[string_lower(c)] == 1 then
if saveableCharacters[string.lower(c)] == 1 then
s = s .. c
elseif saveableCharacters[string_lower(c)] == 0 then
elseif saveableCharacters[string.lower(c)] == 0 then
s = s .. "_"
end
end
return s
end
--- @param string string
---@param string string
--- Splits a string into a table by spaces
function string_split(string, splitAt)
if splitAt == nil then
splitAt = " "
end
local result = {}
for match in string:gmatch(string_format("[^%s]+", splitAt)) do
table_insert(result, match)
for match in string:gmatch(string.format("[^%s]+", splitAt)) do
table.insert(result, match)
end
return result
end
--- @param param number
--- @param caseTable table
---@param param number
---@param caseTable table
--- Switch statement function
function switch(param, caseTable)
local case = caseTable[param]
@ -171,17 +249,52 @@ function switch(param, caseTable)
return def and def() or nil
end
function clamp(num, min, max)
return math.max(math.min(num, max), min)
---@param s string
---@param v any
--- Defines a global variable by name `s` with the value `v` and indexes it if it already exists
function define_valid_global(s, v)
local name = s
local index = 1
while _G[name] ~= nil do
name = s .. "_" .. index
index = index + 1
end
_G[name] = v
end
---@param n integer
---@return boolean
function num_power_of_two(n)
return n ~= 0 and (n & (n - 1)) == 0
end
function angle_from_2d_points(x1, y1, x2, y2)
return atan2s(y2 - y1, x2 - x1) - 0x4000
end
function hash(word)
local result = 5381
for i = 1, #word do
result = (result << 5) + result + word:byte(i)
end
return result
end
function lerp(a, b, t)
return a * (1 - t) + b * t
end
function num_wrap(num, min, max)
if num > max then num = min end
if num < min then num = max end
return num
end
allowMenu = {}
renderInMenuTable = {
hookTableRenderInMenu = {
front = {},
back = {},
}
@ -190,18 +303,13 @@ queueStorageFailsafe = false
charBeingSet = false
stopPalettes = false
for i in pairs(gActiveMods) do
if (gActiveMods[i].incompatible ~= nil and gActiveMods[i].incompatible:find("gamemode")) and not (gActiveMods[i].name:find("Personal Star Counter")) then
stopPalettes = true
end
end
stopMovesets = false
gGlobalSyncTable.charSelectRestrictPalettes = 0
gGlobalSyncTable.charSelectRestrictMovesets = 0
seasonalEvent = 0
SEASON_EVENT_BIRTHDAY = 1
SEASON_EVENT_CHRISTMAS = 2
SEASON_EVENT_FOOLS = 2
-- December
if get_date_and_time().month == 11 then
if get_date_and_time().day == 3 then
@ -211,6 +319,8 @@ if get_date_and_time().month == 11 then
-- Christmas
seasonalEvent = SEASON_EVENT_CHRISTMAS
end
elseif get_date_and_time().month == 4 and get_date_and_time().month == 1 then
seasonalEvent = SEASON_EVENT_FOOLS
end
-- Dedicated Networking Table for Character Select
@ -222,8 +332,9 @@ for i = 0, MAX_PLAYERS - 1 do
currAlt = 1,
presetPalette = 0,
offset = 0,
forceChar = 0,
baseChar = 0,
modelId = E_MODEL_MARIO,
prevModelId = E_MODEL_MARIO,
isUpdating = false,
movesetToggle = true,
modelEditOffset = 0,
@ -231,9 +342,24 @@ for i = 0, MAX_PLAYERS - 1 do
}
end
local stallFrame = 0
local stallComplete = 3
function startup_init_stall(framesBefore)
framesBefore = framesBefore or 0
return stallFrame == (stallComplete - framesBefore)
end
local stallPacket = 0
local function update()
stallPacket = (stallPacket+1)%3 -- refresh rate (to reduce stress)
local function network_update(m)
if m.playerIndex ~= 0 then return end
-- Initialization Update
if stallFrame < stallComplete then
stallFrame = stallFrame + 1
end
-- Packet Refresh Rate
stallPacket = (stallPacket+1)%3
if stallPacket == 0 then
network_send(false, gCSPlayers[0])
end
@ -245,4 +371,353 @@ local function on_packet_recieve(data)
end
hook_event(HOOK_ON_PACKET_RECEIVE, on_packet_recieve)
hook_event(HOOK_UPDATE, update)
hook_event(HOOK_MARIO_UPDATE, network_update)
-- Default Actions Check
local defaultActions = {
[ACT_UNINITIALIZED] = ACT_UNINITIALIZED,
[ACT_IDLE] = ACT_IDLE,
[ACT_START_SLEEPING] = ACT_START_SLEEPING,
[ACT_SLEEPING] = ACT_SLEEPING,
[ACT_WAKING_UP] = ACT_WAKING_UP,
[ACT_PANTING] = ACT_PANTING,
[ACT_HOLD_PANTING_UNUSED] = ACT_HOLD_PANTING_UNUSED,
[ACT_HOLD_IDLE] = ACT_HOLD_IDLE,
[ACT_HOLD_HEAVY_IDLE] = ACT_HOLD_HEAVY_IDLE,
[ACT_STANDING_AGAINST_WALL] = ACT_STANDING_AGAINST_WALL,
[ACT_COUGHING] = ACT_COUGHING,
[ACT_SHIVERING] = ACT_SHIVERING,
[ACT_IN_QUICKSAND] = ACT_IN_QUICKSAND,
[ACT_UNKNOWN_0002020E] = ACT_UNKNOWN_0002020E,
[ACT_CROUCHING] = ACT_CROUCHING,
[ACT_START_CROUCHING] = ACT_START_CROUCHING,
[ACT_STOP_CROUCHING] = ACT_STOP_CROUCHING,
[ACT_START_CRAWLING] = ACT_START_CRAWLING,
[ACT_STOP_CRAWLING] = ACT_STOP_CRAWLING,
[ACT_SLIDE_KICK_SLIDE_STOP] = ACT_SLIDE_KICK_SLIDE_STOP,
[ACT_SHOCKWAVE_BOUNCE] = ACT_SHOCKWAVE_BOUNCE,
[ACT_FIRST_PERSON] = ACT_FIRST_PERSON,
[ACT_BACKFLIP_LAND_STOP] = ACT_BACKFLIP_LAND_STOP,
[ACT_JUMP_LAND_STOP] = ACT_JUMP_LAND_STOP,
[ACT_DOUBLE_JUMP_LAND_STOP] = ACT_DOUBLE_JUMP_LAND_STOP,
[ACT_FREEFALL_LAND_STOP] = ACT_FREEFALL_LAND_STOP,
[ACT_SIDE_FLIP_LAND_STOP] = ACT_SIDE_FLIP_LAND_STOP,
[ACT_HOLD_JUMP_LAND_STOP] = ACT_HOLD_JUMP_LAND_STOP,
[ACT_HOLD_FREEFALL_LAND_STOP] = ACT_HOLD_FREEFALL_LAND_STOP,
[ACT_AIR_THROW_LAND] = ACT_AIR_THROW_LAND,
[ACT_TWIRL_LAND] = ACT_TWIRL_LAND,
[ACT_LAVA_BOOST_LAND] = ACT_LAVA_BOOST_LAND,
[ACT_TRIPLE_JUMP_LAND_STOP] = ACT_TRIPLE_JUMP_LAND_STOP,
[ACT_LONG_JUMP_LAND_STOP] = ACT_LONG_JUMP_LAND_STOP,
[ACT_GROUND_POUND_LAND] = ACT_GROUND_POUND_LAND,
[ACT_BRAKING_STOP] = ACT_BRAKING_STOP,
[ACT_BUTT_SLIDE_STOP] = ACT_BUTT_SLIDE_STOP,
[ACT_HOLD_BUTT_SLIDE_STOP] = ACT_HOLD_BUTT_SLIDE_STOP,
[ACT_WALKING] = ACT_WALKING,
[ACT_HOLD_WALKING] = ACT_HOLD_WALKING,
[ACT_TURNING_AROUND] = ACT_TURNING_AROUND,
[ACT_FINISH_TURNING_AROUND] = ACT_FINISH_TURNING_AROUND,
[ACT_BRAKING] = ACT_BRAKING,
[ACT_RIDING_SHELL_GROUND] = ACT_RIDING_SHELL_GROUND,
[ACT_HOLD_HEAVY_WALKING] = ACT_HOLD_HEAVY_WALKING,
[ACT_CRAWLING] = ACT_CRAWLING,
[ACT_BURNING_GROUND] = ACT_BURNING_GROUND,
[ACT_DECELERATING] = ACT_DECELERATING,
[ACT_HOLD_DECELERATING] = ACT_HOLD_DECELERATING,
[ACT_BEGIN_SLIDING] = ACT_BEGIN_SLIDING,
[ACT_HOLD_BEGIN_SLIDING] = ACT_HOLD_BEGIN_SLIDING,
[ACT_BUTT_SLIDE] = ACT_BUTT_SLIDE,
[ACT_STOMACH_SLIDE] = ACT_STOMACH_SLIDE,
[ACT_HOLD_BUTT_SLIDE] = ACT_HOLD_BUTT_SLIDE,
[ACT_HOLD_STOMACH_SLIDE] = ACT_HOLD_STOMACH_SLIDE,
[ACT_DIVE_SLIDE] = ACT_DIVE_SLIDE,
[ACT_MOVE_PUNCHING] = ACT_MOVE_PUNCHING,
[ACT_CROUCH_SLIDE] = ACT_CROUCH_SLIDE,
[ACT_SLIDE_KICK_SLIDE] = ACT_SLIDE_KICK_SLIDE,
[ACT_HARD_BACKWARD_GROUND_KB] = ACT_HARD_BACKWARD_GROUND_KB,
[ACT_HARD_FORWARD_GROUND_KB] = ACT_HARD_FORWARD_GROUND_KB,
[ACT_BACKWARD_GROUND_KB] = ACT_BACKWARD_GROUND_KB,
[ACT_FORWARD_GROUND_KB] = ACT_FORWARD_GROUND_KB,
[ACT_SOFT_BACKWARD_GROUND_KB] = ACT_SOFT_BACKWARD_GROUND_KB,
[ACT_SOFT_FORWARD_GROUND_KB] = ACT_SOFT_FORWARD_GROUND_KB,
[ACT_GROUND_BONK] = ACT_GROUND_BONK,
[ACT_DEATH_EXIT_LAND] = ACT_DEATH_EXIT_LAND,
[ACT_JUMP_LAND] = ACT_JUMP_LAND,
[ACT_FREEFALL_LAND] = ACT_FREEFALL_LAND,
[ACT_DOUBLE_JUMP_LAND] = ACT_DOUBLE_JUMP_LAND,
[ACT_SIDE_FLIP_LAND] = ACT_SIDE_FLIP_LAND,
[ACT_HOLD_JUMP_LAND] = ACT_HOLD_JUMP_LAND,
[ACT_HOLD_FREEFALL_LAND] = ACT_HOLD_FREEFALL_LAND,
[ACT_QUICKSAND_JUMP_LAND] = ACT_QUICKSAND_JUMP_LAND,
[ACT_HOLD_QUICKSAND_JUMP_LAND] = ACT_HOLD_QUICKSAND_JUMP_LAND,
[ACT_TRIPLE_JUMP_LAND] = ACT_TRIPLE_JUMP_LAND,
[ACT_LONG_JUMP_LAND] = ACT_LONG_JUMP_LAND,
[ACT_BACKFLIP_LAND] = ACT_BACKFLIP_LAND,
[ACT_JUMP] = ACT_JUMP,
[ACT_DOUBLE_JUMP] = ACT_DOUBLE_JUMP,
[ACT_TRIPLE_JUMP] = ACT_TRIPLE_JUMP,
[ACT_BACKFLIP] = ACT_BACKFLIP,
[ACT_STEEP_JUMP] = ACT_STEEP_JUMP,
[ACT_WALL_KICK_AIR] = ACT_WALL_KICK_AIR,
[ACT_SIDE_FLIP] = ACT_SIDE_FLIP,
[ACT_LONG_JUMP] = ACT_LONG_JUMP,
[ACT_WATER_JUMP] = ACT_WATER_JUMP,
[ACT_DIVE] = ACT_DIVE,
[ACT_FREEFALL] = ACT_FREEFALL,
[ACT_TOP_OF_POLE_JUMP] = ACT_TOP_OF_POLE_JUMP,
[ACT_BUTT_SLIDE_AIR] = ACT_BUTT_SLIDE_AIR,
[ACT_FLYING_TRIPLE_JUMP] = ACT_FLYING_TRIPLE_JUMP,
[ACT_SHOT_FROM_CANNON] = ACT_SHOT_FROM_CANNON,
[ACT_FLYING] = ACT_FLYING,
[ACT_RIDING_SHELL_JUMP] = ACT_RIDING_SHELL_JUMP,
[ACT_RIDING_SHELL_FALL] = ACT_RIDING_SHELL_FALL,
[ACT_VERTICAL_WIND] = ACT_VERTICAL_WIND,
[ACT_HOLD_JUMP] = ACT_HOLD_JUMP,
[ACT_HOLD_FREEFALL] = ACT_HOLD_FREEFALL,
[ACT_HOLD_BUTT_SLIDE_AIR] = ACT_HOLD_BUTT_SLIDE_AIR,
[ACT_HOLD_WATER_JUMP] = ACT_HOLD_WATER_JUMP,
[ACT_TWIRLING] = ACT_TWIRLING,
[ACT_FORWARD_ROLLOUT] = ACT_FORWARD_ROLLOUT,
[ACT_AIR_HIT_WALL] = ACT_AIR_HIT_WALL,
[ACT_RIDING_HOOT] = ACT_RIDING_HOOT,
[ACT_GROUND_POUND] = ACT_GROUND_POUND,
[ACT_SLIDE_KICK] = ACT_SLIDE_KICK,
[ACT_AIR_THROW] = ACT_AIR_THROW,
[ACT_JUMP_KICK] = ACT_JUMP_KICK,
[ACT_BACKWARD_ROLLOUT] = ACT_BACKWARD_ROLLOUT,
[ACT_CRAZY_BOX_BOUNCE] = ACT_CRAZY_BOX_BOUNCE,
[ACT_SPECIAL_TRIPLE_JUMP] = ACT_SPECIAL_TRIPLE_JUMP,
[ACT_BACKWARD_AIR_KB] = ACT_BACKWARD_AIR_KB,
[ACT_FORWARD_AIR_KB] = ACT_FORWARD_AIR_KB,
[ACT_HARD_FORWARD_AIR_KB] = ACT_HARD_FORWARD_AIR_KB,
[ACT_HARD_BACKWARD_AIR_KB] = ACT_HARD_BACKWARD_AIR_KB,
[ACT_BURNING_JUMP] = ACT_BURNING_JUMP,
[ACT_BURNING_FALL] = ACT_BURNING_FALL,
[ACT_SOFT_BONK] = ACT_SOFT_BONK,
[ACT_LAVA_BOOST] = ACT_LAVA_BOOST,
[ACT_GETTING_BLOWN] = ACT_GETTING_BLOWN,
[ACT_THROWN_FORWARD] = ACT_THROWN_FORWARD,
[ACT_THROWN_BACKWARD] = ACT_THROWN_BACKWARD,
[ACT_WATER_IDLE] = ACT_WATER_IDLE,
[ACT_HOLD_WATER_IDLE] = ACT_HOLD_WATER_IDLE,
[ACT_WATER_ACTION_END] = ACT_WATER_ACTION_END,
[ACT_HOLD_WATER_ACTION_END] = ACT_HOLD_WATER_ACTION_END,
[ACT_DROWNING] = ACT_DROWNING,
[ACT_BACKWARD_WATER_KB] = ACT_BACKWARD_WATER_KB,
[ACT_FORWARD_WATER_KB] = ACT_FORWARD_WATER_KB,
[ACT_WATER_DEATH] = ACT_WATER_DEATH,
[ACT_WATER_SHOCKED] = ACT_WATER_SHOCKED,
[ACT_BREASTSTROKE] = ACT_BREASTSTROKE,
[ACT_SWIMMING_END] = ACT_SWIMMING_END,
[ACT_FLUTTER_KICK] = ACT_FLUTTER_KICK,
[ACT_HOLD_BREASTSTROKE] = ACT_HOLD_BREASTSTROKE,
[ACT_HOLD_SWIMMING_END] = ACT_HOLD_SWIMMING_END,
[ACT_HOLD_FLUTTER_KICK] = ACT_HOLD_FLUTTER_KICK,
[ACT_WATER_SHELL_SWIMMING] = ACT_WATER_SHELL_SWIMMING,
[ACT_WATER_THROW] = ACT_WATER_THROW,
[ACT_WATER_PUNCH] = ACT_WATER_PUNCH,
[ACT_WATER_PLUNGE] = ACT_WATER_PLUNGE,
[ACT_CAUGHT_IN_WHIRLPOOL] = ACT_CAUGHT_IN_WHIRLPOOL,
[ACT_METAL_WATER_STANDING] = ACT_METAL_WATER_STANDING,
[ACT_HOLD_METAL_WATER_STANDING] = ACT_HOLD_METAL_WATER_STANDING,
[ACT_METAL_WATER_WALKING] = ACT_METAL_WATER_WALKING,
[ACT_HOLD_METAL_WATER_WALKING] = ACT_HOLD_METAL_WATER_WALKING,
[ACT_METAL_WATER_FALLING] = ACT_METAL_WATER_FALLING,
[ACT_HOLD_METAL_WATER_FALLING] = ACT_HOLD_METAL_WATER_FALLING,
[ACT_METAL_WATER_FALL_LAND] = ACT_METAL_WATER_FALL_LAND,
[ACT_HOLD_METAL_WATER_FALL_LAND] = ACT_HOLD_METAL_WATER_FALL_LAND,
[ACT_METAL_WATER_JUMP] = ACT_METAL_WATER_JUMP,
[ACT_HOLD_METAL_WATER_JUMP] = ACT_HOLD_METAL_WATER_JUMP,
[ACT_METAL_WATER_JUMP_LAND] = ACT_METAL_WATER_JUMP_LAND,
[ACT_HOLD_METAL_WATER_JUMP_LAND] = ACT_HOLD_METAL_WATER_JUMP_LAND,
[ACT_DISAPPEARED] = ACT_DISAPPEARED,
[ACT_INTRO_CUTSCENE] = ACT_INTRO_CUTSCENE,
[ACT_STAR_DANCE_EXIT] = ACT_STAR_DANCE_EXIT,
[ACT_STAR_DANCE_WATER] = ACT_STAR_DANCE_WATER,
[ACT_FALL_AFTER_STAR_GRAB] = ACT_FALL_AFTER_STAR_GRAB,
[ACT_READING_AUTOMATIC_DIALOG] = ACT_READING_AUTOMATIC_DIALOG,
[ACT_READING_NPC_DIALOG] = ACT_READING_NPC_DIALOG,
[ACT_STAR_DANCE_NO_EXIT] = ACT_STAR_DANCE_NO_EXIT,
[ACT_READING_SIGN] = ACT_READING_SIGN,
[ACT_JUMBO_STAR_CUTSCENE] = ACT_JUMBO_STAR_CUTSCENE,
[ACT_WAITING_FOR_DIALOG] = ACT_WAITING_FOR_DIALOG,
[ACT_DEBUG_FREE_MOVE] = ACT_DEBUG_FREE_MOVE,
[ACT_STANDING_DEATH] = ACT_STANDING_DEATH,
[ACT_QUICKSAND_DEATH] = ACT_QUICKSAND_DEATH,
[ACT_ELECTROCUTION] = ACT_ELECTROCUTION,
[ACT_SUFFOCATION] = ACT_SUFFOCATION,
[ACT_DEATH_ON_STOMACH] = ACT_DEATH_ON_STOMACH,
[ACT_DEATH_ON_BACK] = ACT_DEATH_ON_BACK,
[ACT_EATEN_BY_BUBBA] = ACT_EATEN_BY_BUBBA,
[ACT_END_PEACH_CUTSCENE] = ACT_END_PEACH_CUTSCENE,
[ACT_CREDITS_CUTSCENE] = ACT_CREDITS_CUTSCENE,
[ACT_END_WAVING_CUTSCENE] = ACT_END_WAVING_CUTSCENE,
[ACT_PULLING_DOOR] = ACT_PULLING_DOOR,
[ACT_PUSHING_DOOR] = ACT_PUSHING_DOOR,
[ACT_WARP_DOOR_SPAWN] = ACT_WARP_DOOR_SPAWN,
[ACT_EMERGE_FROM_PIPE] = ACT_EMERGE_FROM_PIPE,
[ACT_SPAWN_SPIN_AIRBORNE] = ACT_SPAWN_SPIN_AIRBORNE,
[ACT_SPAWN_SPIN_LANDING] = ACT_SPAWN_SPIN_LANDING,
[ACT_EXIT_AIRBORNE] = ACT_EXIT_AIRBORNE,
[ACT_EXIT_LAND_SAVE_DIALOG] = ACT_EXIT_LAND_SAVE_DIALOG,
[ACT_DEATH_EXIT] = ACT_DEATH_EXIT,
[ACT_UNUSED_DEATH_EXIT] = ACT_UNUSED_DEATH_EXIT,
[ACT_FALLING_DEATH_EXIT] = ACT_FALLING_DEATH_EXIT,
[ACT_SPECIAL_EXIT_AIRBORNE] = ACT_SPECIAL_EXIT_AIRBORNE,
[ACT_SPECIAL_DEATH_EXIT] = ACT_SPECIAL_DEATH_EXIT,
[ACT_FALLING_EXIT_AIRBORNE] = ACT_FALLING_EXIT_AIRBORNE,
[ACT_UNLOCKING_KEY_DOOR] = ACT_UNLOCKING_KEY_DOOR,
[ACT_UNLOCKING_STAR_DOOR] = ACT_UNLOCKING_STAR_DOOR,
[ACT_ENTERING_STAR_DOOR] = ACT_ENTERING_STAR_DOOR,
[ACT_SPAWN_NO_SPIN_AIRBORNE] = ACT_SPAWN_NO_SPIN_AIRBORNE,
[ACT_SPAWN_NO_SPIN_LANDING] = ACT_SPAWN_NO_SPIN_LANDING,
[ACT_BBH_ENTER_JUMP] = ACT_BBH_ENTER_JUMP,
[ACT_BBH_ENTER_SPIN] = ACT_BBH_ENTER_SPIN,
[ACT_TELEPORT_FADE_OUT] = ACT_TELEPORT_FADE_OUT,
[ACT_TELEPORT_FADE_IN] = ACT_TELEPORT_FADE_IN,
[ACT_SHOCKED] = ACT_SHOCKED,
[ACT_SQUISHED] = ACT_SQUISHED,
[ACT_HEAD_STUCK_IN_GROUND] = ACT_HEAD_STUCK_IN_GROUND,
[ACT_BUTT_STUCK_IN_GROUND] = ACT_BUTT_STUCK_IN_GROUND,
[ACT_FEET_STUCK_IN_GROUND] = ACT_FEET_STUCK_IN_GROUND,
[ACT_PUTTING_ON_CAP] = ACT_PUTTING_ON_CAP,
[ACT_HOLDING_POLE] = ACT_HOLDING_POLE,
[ACT_GRAB_POLE_SLOW] = ACT_GRAB_POLE_SLOW,
[ACT_GRAB_POLE_FAST] = ACT_GRAB_POLE_FAST,
[ACT_CLIMBING_POLE] = ACT_CLIMBING_POLE,
[ACT_TOP_OF_POLE_TRANSITION] = ACT_TOP_OF_POLE_TRANSITION,
[ACT_TOP_OF_POLE] = ACT_TOP_OF_POLE,
[ACT_START_HANGING] = ACT_START_HANGING,
[ACT_HANGING] = ACT_HANGING,
[ACT_HANG_MOVING] = ACT_HANG_MOVING,
[ACT_LEDGE_GRAB] = ACT_LEDGE_GRAB,
[ACT_LEDGE_CLIMB_SLOW_1] = ACT_LEDGE_CLIMB_SLOW_1,
[ACT_LEDGE_CLIMB_SLOW_2] = ACT_LEDGE_CLIMB_SLOW_2,
[ACT_LEDGE_CLIMB_DOWN] = ACT_LEDGE_CLIMB_DOWN,
[ACT_LEDGE_CLIMB_FAST] = ACT_LEDGE_CLIMB_FAST,
[ACT_GRABBED] = ACT_GRABBED,
[ACT_IN_CANNON] = ACT_IN_CANNON,
[ACT_TORNADO_TWIRLING] = ACT_TORNADO_TWIRLING,
[ACT_BUBBLED] = ACT_BUBBLED,
[ACT_PUNCHING] = ACT_PUNCHING,
[ACT_PICKING_UP] = ACT_PICKING_UP,
[ACT_DIVE_PICKING_UP] = ACT_DIVE_PICKING_UP,
[ACT_STOMACH_SLIDE_STOP] = ACT_STOMACH_SLIDE_STOP,
[ACT_PLACING_DOWN] = ACT_PLACING_DOWN,
[ACT_THROWING] = ACT_THROWING,
[ACT_HEAVY_THROW] = ACT_HEAVY_THROW,
[ACT_PICKING_UP_BOWSER] = ACT_PICKING_UP_BOWSER,
[ACT_HOLDING_BOWSER] = ACT_HOLDING_BOWSER,
[ACT_RELEASING_BOWSER] = ACT_RELEASING_BOWSER,
}
---@param m MarioState
function is_mario_in_vanilla_action(m)
return defaultActions[m.action] ~= nil
end
-- Lazy automation of interpolation on HUD elements
local interpTable = {}
function djui_set_interpolation(index, x, y, width, height)
interpTable[index] = {
x = x,
y = y,
width = width,
height = height
}
end
function djui_get_interpolation(index, backUpX, backUpY, backUpWidth, backUpHeight)
return interpTable[index] or {x = backUpX or 0, y = backUpY or 0, width = backUpWidth or 0, height = backUpHeight or 0}
end
function djui_hud_print_text_auto_interpolated(index, message, x, y, scale)
local interp = djui_get_interpolation(index, x, y, scale, nil)
djui_hud_print_text_interpolated(message, interp.x, interp.y, interp.width, x, y, scale)
djui_set_interpolation(index, x, y, scale, nil)
end
function djui_hud_render_texture_auto_interpolated(index, texture, x, y, width, height)
local interp = djui_get_interpolation(index, x, y, width, height)
djui_hud_render_texture_interpolated(texture, interp.x, interp.y, interp.width, interp.height, x, y, width, height)
djui_set_interpolation(index, x, y, width, height)
end
local hasBeenLogged = {}
---@param message string
---@param level ConsoleMessageLevel
function log_to_console_once(message, level)
if not hasBeenLogged[message] then
hasBeenLogged[message] = true
log_to_console("Character Select: "..message, level)
end
end
function is_power_of_two(n)
return (n & (n - 1)) == 0
end
---@param tex TextureInfo
function is_texture_valid(tex)
if tex ~= nil then
return is_power_of_two(tex.width) and is_power_of_two(tex.height)
else
return false
end
end
function run_func_or_get_var(x, ...)
if type(x) == "function" then
return x(...)
else
return x
end
end
---@param x integer
function mirror_mode_number(x)
if _G.mirrorMode ~= nil and _G.mirrorMode.is_mirrored() then
return x * -1
end
return x
end
---@param str1 string
---@param str2 string
local function levenshtein_distance(str1, str2)
local len1 = #str1
local len2 = #str2
local matrix = {}
for i = 0, len1 do
matrix[i] = {}
matrix[i][0] = i
end
for j = 0, len2 do
matrix[0][j] = j
end
for i = 1, len1 do
for j = 1, len2 do
local cost = (str1:sub(i, i) == str2:sub(j, j)) and 0 or 1
local del = matrix[i-1][j] + 1
local ins = matrix[i][j-1] + 1
local sub = matrix[i-1][j-1] + cost
matrix[i][j] = math.min(del, ins, sub)
end
end
return matrix[len1][len2]
end
---@param str1 string
---@param str2 string
-- Compares two strings and returns simularity (0-1)
function string_sim(str1, str2)
local distance = levenshtein_distance(str1, str2)
local maxLength = math.max(#str1, #str2)
if maxLength == 0 then return 1 end
return (distance / maxLength)
end

File diff suppressed because it is too large Load diff

View file

@ -1,222 +1,54 @@
if incompatibleClient then return 0 end
-- Original Made by EliteMasterEric along with CoopDX PR #321 to replace dialog depending on character --
-- https://github.com/coop-deluxe/sm64coopdx/pull/321 --
-- Eric's Original stuffs will be added as soon as there is some way to directly get dialog strings
DEFAULT_DIALOG_NAME = "Mario"
local dialogTable = {}
local function define_cs_dialog(dialogId, unused, linesPerBox, leftOffset, width, str)
dialogTable[dialogId] = {
unused = unused,
linesPerBox = linesPerBox,
leftOffset = leftOffset,
width = width,
str = str,
}
end
local ogDialog = {}
local real_dialog_replace = smlua_text_utils_dialog_replace
_G.smlua_text_utils_dialog_replace = define_cs_dialog
-- All Base SM64 Dialog added to the Dialog Table
define_cs_dialog(DIALOG_000, 1, 6, 30, 200, ("Wow! You're smack in the\nmiddle of the battlefield.\nYou'll find the Power\nStars that Bowser stole\ninside the painting\nworlds.\nFirst, talk to the\nBob-omb Buddy. (Press [B]\nto talk.) He'll certainly\nhelp you out, and so will\nhis comrades in other\nareas.\nTo read signs, stop, face\nthem and press [B]. Press [A]\nor [B] to scroll ahead. You\ncan talk to some other\ncharacters by facing them\nand pressing [B]."))
define_cs_dialog(DIALOG_001, 1, 4, 95, 200, ("Watch out! If you wander\naround here, you're liable\nto be plastered by a\nwater bomb!\nThose enemy Bob-ombs love\nto fight, and they're\nalways finding ways to\nattack.\nThis meadow has become\na battlefield ever since\nthe Big Bob-omb got his\npaws on the Power Star.\nCan you recover the Star\nfor us? Cross the bridge\nand go left up the path\nto find the Big Bob-omb.\nPlease come back to see\nme after you've retrieved\nthe Power Star!"))
define_cs_dialog(DIALOG_002, 1, 4, 95, 200, ("Hey, you! It's dangerous\nahead, so listen up! Take\nmy advice.\n\nCross the two\nbridges ahead, then\nwatch for falling\nwater bombs.\nThe Big Bob-omb at the\ntop of the mountain is\nvery powerful--don't let\nhim grab you!\nWe're Bob-omb Buddies,\nand we're on your side.\nYou can talk to us\nwhenever you'd like to!"))
define_cs_dialog(DIALOG_003, 1, 5, 95, 200, ("Thank you, Mario! The Big\nBob-omb is nothing but a\nbig dud now! But the\nbattle for the castle has\njust begun.\nOther enemies are holding\nthe other Power Stars. If\nyou recover more Stars,\nyou can open new doors\nthat lead to new worlds!\nMy Bob-omb Buddies are\nwaiting for you. Be sure\nto talk to them--they'll\nset up cannons for you."))
define_cs_dialog(DIALOG_004, 1, 3, 95, 200, ("We're peace-loving\nBob-ombs, so we don't use\ncannons.\nBut if you'd like\nto blast off, we don't\nmind. Help yourself.\nWe'll prepare all of the\ncannons in this course for\nyou to use. Bon Voyage!"))
define_cs_dialog(DIALOG_005, 1, 3, 30, 200, ("Hey, Mario! Is it true\nthat you beat the Big\nBob-omb? Cool!\nYou must be strong. And\npretty fast. So, how fast\nare you, anyway?\nFast enough to beat me...\nKoopa the Quick? I don't\nthink so. Just try me.\nHow about a race to the\nmountaintop, where the\nBig Bob-omb was?\nWhaddya say? When I say\n『Go,』 let the race begin!\n\nReady....\n\n//Go!////Don't Go"))
define_cs_dialog(DIALOG_006, 1, 3, 30, 200, ("Hey!!! Don't try to scam\nME. You've gotta run\nthe whole course.\nLater. Look me up when\nyou want to race for\nreal."))
define_cs_dialog(DIALOG_007, 1, 5, 30, 200, ("Hufff...fff...pufff...\nWhoa! You...really...are...\nfast! A human blur!\nHere you go--you've won\nit, fair and square!"))
define_cs_dialog(DIALOG_008, 1, 4, 30, 200, ("BEWARE OF CHAIN CHOMP\nExtreme Danger!\nGet close and press [C]▲\nfor a better look.\nScary, huh?\nSee the Red Coin on top\nof the stake?\n\nWhen you collect eight of\nthem, a Power Star will\nappear in the meadow\nacross the bridge."))
define_cs_dialog(DIALOG_009, 1, 5, 30, 200, ("Long time, no see! Wow,\nhave you gotten fast!\nHave you been training\non the sly, or is it the\npower of the Stars?\nI've been feeling down\nabout losing the last\nrace. This is my home\ncourse--how about a\nrematch?\nThe goal is in\nWindswept Valley.\nReady?\n\n//Go//// Don't Go"))
define_cs_dialog(DIALOG_010, 1, 4, 30, 200, ("You've stepped on the\nWing Cap Switch. Wearing\nthe Wing Cap, you can\nsoar through the sky.\nNow Wing Caps will pop\nout of all the red blocks\nyou find.\n\nWould you like to Save?\n\n//Yes////No"))
define_cs_dialog(DIALOG_011, 1, 4, 30, 200, ("You've just stepped on\nthe Metal Cap Switch!\nThe Metal Cap makes\nMario invincible.\nNow Metal Caps will\npop out of all of the\ngreen blocks you find.\n\nWould you like to Save?\n\n//Yes////No"))
define_cs_dialog(DIALOG_012, 1, 4, 30, 200, ("You've just stepped on\nthe Vanish Cap Switch.\nThe Vanish Cap makes\nMario disappear.\nNow Vanish Caps will pop\nfrom all of the blue\nblocks you find.\n\nWould you like to Save?\n\n//Yes////No"))
define_cs_dialog(DIALOG_013, 1, 5, 30, 200, ("You've collected 100\ncoins! Mario gains more\npower from the castle.\nDo you want to Save?\n//Yes////No"))
define_cs_dialog(DIALOG_014, 1, 4, 30, 200, ("Wow! Another Power Star!\nMario gains more courage\nfrom the power of the\ncastle.\nDo you want to Save?\n\n//You Bet//Not Now"))
define_cs_dialog(DIALOG_015, 1, 4, 30, 200, ("You can punch enemies to\nknock them down. Press [A]\nto jump, [B] to punch.\nPress [A] then [B] to Kick.\nTo pick something up,\npress [B], too. To throw\nsomething you're holding,\npress [B] again."))
define_cs_dialog(DIALOG_016, 1, 3, 30, 200, ("Hop on the shiny shell and\nride wherever you want to\ngo! Shred those enemies!"))
define_cs_dialog(DIALOG_017, 1, 4, 30, 200, ("I'm the Big Bob-omb, lord\nof all blasting matter,\nking of ka-booms the\nworld over!\nHow dare you scale my\nmountain? By what right\ndo you set foot on my\nimperial mountaintop?\nYou may have eluded my\nguards, but you'll never\nescape my grasp...\n\n...and you'll never take\naway my Power Star. I\nhereby challenge you,\nMario!\nIf you want the Star I\nhold, you must prove\nyourself in battle.\n\nCan you pick me up from\nthe back and hurl me to\nthis royal turf? I think\nthat you cannot!"))
define_cs_dialog(DIALOG_018, 1, 4, 30, 200, ("I'm sleeping because...\n...I'm sleepy. I don't\nlike being disturbed.\nPlease walk quietly."))
define_cs_dialog(DIALOG_019, 1, 2, 30, 200, ("Shhh! Please walk\nquietly in the hallway!"))
define_cs_dialog(DIALOG_020, 1, 6, 95, 150, ("Dear Mario:\nPlease come to the\ncastle. I've baked\na cake for you.\nYours truly--\nPrincess Toadstool"))
define_cs_dialog(DIALOG_021, 1, 5, 95, 200, ("Welcome.\nNo one's home!\nNow scram--\nand don't come back!\nGwa ha ha!"))
define_cs_dialog(DIALOG_022, 1, 2, 95, 200, ("You need a key to open\nthis door."))
define_cs_dialog(DIALOG_023, 1, 3, 95, 200, ("This key doesn't fit!\nMaybe it's for the\nbasement..."))
define_cs_dialog(DIALOG_024, 1, 5, 95, 200, ("You need Star power to\nopen this door. Recover a\nPower Star from an enemy\ninside one of the castle's\npaintings."))
define_cs_dialog(DIALOG_025, 1, 4, 95, 200, ("It takes the power of\n3 Stars to open this\ndoor. You need [%] more\nStars."))
define_cs_dialog(DIALOG_026, 1, 4, 95, 200, ("It takes the power of\n8 Stars to open this\ndoor. You need [%] more\nStars."))
define_cs_dialog(DIALOG_027, 1, 4, 95, 200, ("It takes the power of\n30 Stars to open this\ndoor. You need [%] more\nStars."))
define_cs_dialog(DIALOG_028, 1, 4, 95, 200, ("It takes the power of\n50 Stars to open this\ndoor. You need [%] more\nStars."))
define_cs_dialog(DIALOG_029, 1, 5, 95, 200, ("To open the door that\nleads to the 『endless』\nstairs, you need 70\nStars.\nBwa ha ha!"))
define_cs_dialog(DIALOG_030, 1, 6, 30, 200, ("Hello! The Lakitu Bros.,\ncutting in with a live\nupdate on Mario's\nprogress. He's about to\nlearn a technique for\nsneaking up on enemies.\nThe trick is this: He has\nto walk very slowly in\norder to walk quietly.\n\n\n\nAnd wrapping up filming\ntechniques reported on\nearlier, you can take a\nlook around using [C]▶ and\n[C]◀. Press [C]▼ to view the\naction from a distance.\nWhen you can't move the\ncamera any farther, the\nbuzzer will sound. This is\nthe Lakitu Bros.,\nsigning off."))
define_cs_dialog(DIALOG_031, 1, 5, 30, 200, ("No way! You beat me...\nagain!! And I just spent\nmy entire savings on\nthese new Koopa\nMach 1 Sprint shoes!\nHere, I guess I have to\nhand over this Star to\nthe winner of the race.\nCongrats, Mario!"))
define_cs_dialog(DIALOG_032, 1, 5, 30, 200, ("If you get the Wing Cap,\nyou can fly! Put the cap\non, then do a Triple\nJump--jump three times\nin a row--to take off.\nYou can fly even higher\nif you blast out of a\ncannon wearing the\nWing Cap!\n\nUse the [C] Buttons to look\naround while flying, and\npress [Z] to land."))
define_cs_dialog(DIALOG_033, 1, 6, 30, 200, ("Ciao! You've reached\nPrincess Toadstool's\ncastle via a warp pipe.\nUsing the controller is a\npiece of cake. Press [A] to\njump and [B] to attack.\nPress [B] to read signs,\ntoo. Use the Control Stick\nin the center of the\ncontroller to move Mario\naround. Now, head for\nthe castle."))
define_cs_dialog(DIALOG_034, 1, 6, 30, 200, ("Good afternoon. The\nLakitu Bros., here,\nreporting live from just\noutside the Princess's\ncastle.\n\nMario has just arrived\non the scene, and we'll\nbe filming the action live\nas he enters the castle\nand pursues the missing\nPower Stars.\nAs seasoned cameramen,\nwe'll be shooting from the\nrecommended angle, but\nyou can change the\ncamera angle by pressing\nthe [C] Buttons.\nIf we can't adjust the\nview any further, we'll\nbuzz. To take a look at\nthe surroundings, stop\nand press [C]▲.\n\nPress [A] to resume play.\nSwitch camera modes with\nthe [R] Button. Signs along\nthe way will review these\ninstructions.\n\nFor now, reporting live,\nthis has been the\nLakitu Bros."))
define_cs_dialog(DIALOG_035, 1, 5, 30, 200, ("There are four camera, or\n『[C],』 Buttons. Press [C]▲\nto look around using the\nControl Stick.\n\nYou'll usually see Mario\nthrough Lakitu's camera.\nIt is the camera\nrecommended for normal\nplay.\nYou can change angles by\npressing [C]▶. If you press\n[R], the view switches to\nMario's camera, which\nis directly behind him.\nPress [R] again to return\nto Lakitu's camera. Press\n[C]▼ to see Mario from\nafar, using either\nLakitu's or Mario's view."))
define_cs_dialog(DIALOG_036, 1, 5, 30, 200, ("OBSERVATION PLATFORM\nPress [C]▲ to take a look\naround. Don't miss\nanything!\n\nPress [R] to switch to\nMario's camera. It\nalways follows Mario.\nPress [R] again to switch\nto Lakitu's camera.\nPause the game and\nswitch the mode to 『fix』\nthe camera in place while\nholding [R]. Give it a try!"))
define_cs_dialog(DIALOG_037, 1, 2, 30, 200, ("I win! You lose!\nHa ha ha ha!\nYou're no slouch, but I'm\na better sledder!\nBetter luck next time!"))
define_cs_dialog(DIALOG_038, 1, 3, 95, 200, ("Reacting to the Star\npower, the door slowly\nopens."))
define_cs_dialog(DIALOG_039, 1, 4, 30, 200, ("No visitors allowed,\nby decree of\nthe Big Bob-omb\n\nI shall never surrender my\nStars, for they hold the\npower of the castle in\ntheir glow.\nThey were a gift from\nBowser, the Koopa King\nhimself, and they lie well\nhidden within my realm.\nNot a whisper of their\nwhereabouts shall leave\nmy lips. Oh, all right,\nperhaps one hint:\nHeed the Star names at\nthe beginning of the\ncourse.\n//--The Big Bob-omb"))
define_cs_dialog(DIALOG_040, 1, 3, 30, 200, ("Warning!\nCold, Cold Crevasse\nBelow!"))
define_cs_dialog(DIALOG_041, 1, 3, 30, 200, ("I win! You lose!\nHa ha ha!\n\nThat's what you get for\nmessin' with Koopa the\nQuick.\nBetter luck next time!"))
define_cs_dialog(DIALOG_042, 1, 4, 30, 200, ("Caution! Narrow Bridge!\nCross slowly!\n\n\nYou can jump to the edge\nof the cliff and hang on,\nand you can climb off the\nedge if you move slowly.\nWhen you want to let go,\neither press [Z] or press\nthe Control Stick in the\ndirection of Mario's back.\nTo climb up, press Up on\nthe Control Stick. To\nscurry up quickly, press\nthe [A] Button."))
define_cs_dialog(DIALOG_043, 1, 5, 30, 200, ("If you jump and hold the\n[A] Button, you can hang on\nto some objects overhead.\nIt's the same as grabbing\na flying bird!"))
define_cs_dialog(DIALOG_044, 1, 5, 95, 200, ("Whooo's there? Whooo\nwoke me up? It's still\ndaylight--I should be\nsleeping!\n\nHey, as long as I'm\nawake, why not take a\nshort flight with me?\nPress and hold [A] to grab\non. Release [A] to let go.\nI'll take you wherever\nyou want to go, as long\nas my wings hold out.\nWatch my shadow, and\ngrab on."))
define_cs_dialog(DIALOG_045, 1, 6, 95, 200, ("Whew! I'm just about\nflapped out. You should\nlay off the pasta, Mario!\nThat's it for now. Press\n[A] to let go. Okay,\nbye byyyyyyeeee!"))
define_cs_dialog(DIALOG_046, 1, 5, 30, 200, ("You have to master three\nimportant jumping\ntechniques.\nFirst try the Triple Jump.\n\nRun fast, then jump three\ntimes, one, two, three.\nIf you time the jumps\nright, you'll hop, skip,\nthen jump really high.\nNext, go for distance\nwith the Long Jump. Run,\npress [Z] to crouch then [A]\nto jump really far.\n\nTo do the Wall Kick, press\n[A] to jump at a wall, then\njump again when you hit\nthe wall.\n\nGot that? Triple Jump,\nLong Jump, Wall Kick.\nPractice, practice,\npractice. You don't stand\na chance without them."))
define_cs_dialog(DIALOG_047, 1, 2, 95, 200, ("Hi! I'll prepare the\ncannon for you!"))
define_cs_dialog(DIALOG_048, 1, 4, 30, 200, ("Snow Mountain Summit\nWatch for slippery\nconditions! Please enter\nthe cottage first."))
define_cs_dialog(DIALOG_049, 1, 5, 30, 200, ("Remember that tricky Wall\nKick jump? It's a\ntechnique you'll have to\nmaster in order to reach\nhigh places.\nUse it to jump from wall\nto wall. Press the\nControl Stick in the\ndirection you want to\nbounce to gain momentum.\nPractice makes perfect!"))
define_cs_dialog(DIALOG_050, 1, 4, 30, 200, ("Hold [Z] to crouch and\nslide down a slope.\nOr press [Z] while in the\nair to Pound the Ground!\nIf you stop, crouch, then\njump, you'll do a\nBackward Somersault!\nGot that?\nThere's more. Crouch and\nthen jump to do a\nLong Jump! Or crouch and\nwalk to...never mind."))
define_cs_dialog(DIALOG_051, 1, 6, 30, 200, ("Climbing's easy! When you\njump at trees, poles or\npillars, you'll grab them\nautomatically. Press [A] to\njump off backward.\n\nTo rotate around the\nobject, press Right or\nLeft on the Control Stick.\nWhen you reach the top,\npress Up to do a\nhandstand!\nJump off from the\nhandstand for a high,\nstylin' dismount."))
define_cs_dialog(DIALOG_052, 1, 5, 30, 200, ("Stop and press [Z] to\ncrouch, then press [A]\nto do a high, Backward\nSomersault!\n\nTo perform a Side\nSomersault, run, do a\nsharp U-turn and jump.\nYou can catch lots of\nair with both jumps."))
define_cs_dialog(DIALOG_053, 1, 5, 30, 200, ("Sometimes, if you pass\nthrough a coin ring or\nfind a secret point in a\ncourse, a red number will\nappear.\nIf you trigger five red\nnumbers, a secret Star\nwill show up."))
define_cs_dialog(DIALOG_054, 1, 5, 30, 200, ("Welcome to the snow\nslide! Hop on! To speed\nup, press forward on the\nControl Stick. To slow\ndown, pull back."))
define_cs_dialog(DIALOG_055, 1, 4, 30, 200, ("Hey-ey, Mario, buddy,\nhowzit goin'? Step right\nup. You look like a fast\nsleddin' kind of guy.\nI know speed when I see\nit, yes siree--I'm the\nworld champion sledder,\nyou know. Whaddya say?\nHow about a race?\nReady...\n\n//Go//// Don't Go"))
define_cs_dialog(DIALOG_056, 1, 6, 30, 200, ("You brrrr-oke my record!\nUnbelievable! I knew\nthat you were the coolest.\nNow you've proven\nthat you're also the\nfastest!\nI can't award you a gold\nmedal, but here, take this\nStar instead. You've\nearned it!"))
define_cs_dialog(DIALOG_057, 1, 4, 30, 200, ("Egad! My baby!! Have you\nseen my baby??? She's\nthe most precious baby in\nthe whole wide world.\n(They say she has my\nbeak...) I just can't\nremember where I left\nher.\nLet's see...I stopped\nfor herring and ice cubes,\nthen I...oohh! I just\ndon't know!"))
define_cs_dialog(DIALOG_058, 1, 4, 30, 200, ("You found my precious,\nprecious baby! Where\nhave you been? How can\nI ever thank you, Mario?\nOh, I do have this...\n...Star. Here, take it\nwith my eternal\ngratitude."))
define_cs_dialog(DIALOG_059, 1, 4, 30, 200, ("That's not my baby! She\nlooks nothing like me!\nHer parents must be\nworried sick!"))
define_cs_dialog(DIALOG_060, 1, 4, 30, 200, ("ATTENTION!\nRead Before Diving In!\n\n\nIf you stay under the\nwater for too long, you'll\nrun out of oxygen.\n\nReturn to the surface for\nair or find an air bubble\nor coins to breathe while\nunderwater.\nPress [A] to swim. Hold [A]\nto swim slow and steady.\nTap [A] with smooth timing\nto gain speed.\nPress Up on the\nControl Stick and press [A]\nto dive.\n\nPress Down on the Control\nStick and press [A] to\nreturn to the surface.\n\nHold Down and press [A]\nwhile on the surface near\nthe edge of the water to\njump out."))
define_cs_dialog(DIALOG_061, 1, 4, 30, 200, ("BRRR! Frostbite Danger!\nDo not swim here.\nI'm serious.\n/--The Penguin"))
define_cs_dialog(DIALOG_062, 1, 3, 30, 200, ("Hidden inside the green\nblock is the amazing\nMetal Cap.\nWearing it, you won't\ncatch fire or be hurt\nby enemy attacks.\nYou don't even have to\nbreathe while wearing it.\n\nThe only problem:\nYou can't swim in it."))
define_cs_dialog(DIALOG_063, 1, 5, 30, 200, ("The Vanish Cap is inside\nthe blue block. Mr. I.\nwill be surprised, since\nyou'll be invisible when\nyou wear it!\nEven the Big Boo will be\nfooled--and you can walk\nthrough secret walls, too."))
define_cs_dialog(DIALOG_064, 1, 5, 30, 200, ("When you put on the Wing\nCap that comes from a\nred block, do the Triple\nJump to soar high into\nthe sky.\nUse the Control Stick to\nguide Mario. Pull back to\nto fly up, press forward\nto nose down, and press [Z]\nto land."))
define_cs_dialog(DIALOG_065, 1, 6, 30, 200, ("Swimming Lessons!\nTap [A] to do the breast\nstroke. If you time the\ntaps right, you'll swim\nfast.\n\nPress and hold [A] to do a\nslow, steady flutter kick.\nPress Up on the Control\nStick to dive, and pull\nback on the stick to head\nfor the surface.\nTo jump out of the water,\nhold Down on the Control\nStick, then press [A].\nEasy as pie, right?\n\n\nBut remember:\nMario can't breathe under\nthe water! Return to the\nsurface for air when the\nPower Meter runs low.\n\nAnd one last thing: You\ncan't open doors that\nare underwater."))
define_cs_dialog(DIALOG_066, 1, 5, 30, 200, ("Mario, it's Peach!\nPlease be careful! Bowser\nis so wicked! He will try\nto burn you with his\nhorrible flame breath.\nRun around behind and\ngrab him by the tail with\nthe [B] Button. Once you\ngrab hold, swing him\naround in great circles.\nRotate the Control Stick\nto go faster and faster.\nThe faster you swing him,\nthe farther he'll fly.\n\nUse the [C] Buttons to look\naround, Mario. You have\nto throw Bowser into one\nof the bombs in the four\ncorners.\nAim well, then press [B]\nagain to launch Bowser.\nGood luck, Mario! Our\nfate is in your hands."))
define_cs_dialog(DIALOG_067, 1, 5, 30, 200, ("Tough luck, Mario!\nPrincess Toadstool isn't\nhere...Gwa ha ha!! Go\nahead--just try to grab\nme by the tail!\nYou'll never be able to\nswing ME around! A wimp\nlike you won't throw me\nout of here! Never! Ha!"))
define_cs_dialog(DIALOG_068, 1, 5, 30, 200, ("It's Lethal Lava Land!\nIf you catch fire or fall\ninto a pool of flames,\nyou'll be hopping mad, but\ndon't lose your cool.\nYou can still control\nMario--just try to keep\ncalm!"))
define_cs_dialog(DIALOG_069, 1, 6, 30, 200, ("Sometimes you'll bump into\ninvisible walls at the\nedges of the painting\nworlds. If you hit a wall\nwhile flying, you'll bounce\nback."))
define_cs_dialog(DIALOG_070, 1, 5, 30, 200, ("You can return to the\ncastle's main hall at any\ntime from the painting\nworlds where the enemies\nlive.\nJust stop, stand still,\npress Start to pause the\ngame, then select\n『Exit Course.』\n\nYou don't have to collect\nall Power Stars in one\ncourse before going on to\nthe next.\n\nReturn later, when you're\nmore experienced, to pick\nup difficult ones.\n\n\nWhenever you find a Star,\na hint for finding the\nnext one will appear on\nthe course's start screen.\n\nYou can, however, collect\nany of the remaining\nStars next. You don't\nhave to recover the one\ndescribed by the hint."))
define_cs_dialog(DIALOG_071, 1, 3, 30, 200, ("Danger Ahead!\nBeware of the strange\ncloud! Don't inhale!\nIf you feel faint, run for\nhigher ground and fresh\nair!\nCircle: Shelter\nArrow: Entrance-Exit"))
define_cs_dialog(DIALOG_072, 1, 5, 30, 200, ("High winds ahead!\nPull your Cap down tight.\nIf it blows off, you'll\nhave to find it on this\nmountain."))
define_cs_dialog(DIALOG_073, 1, 4, 95, 200, ("Aarrgh! Ahoy, matey. I\nhave sunken treasure,\nhere, I do.\n\nBut to pluck the plunder,\nyou must open the\nTreasure Chests in the\nright order.\nWhat order is that,\nye say?\n\n\nI'll never tell!\n\n//--The Cap'n"))
define_cs_dialog(DIALOG_074, 1, 5, 30, 200, ("You can grab on to the\nedge of a cliff or ledge\nwith your fingertips and\nhang down from it.\n\nTo drop from the edge,\neither press the Control\nStick in the direction of\nMario's back or press the\n[Z] Button.\nTo get up onto the ledge,\neither press Up on the\nControl Stick or press [A]\nas soon as you grab the\nledge to climb up quickly."))
define_cs_dialog(DIALOG_075, 1, 5, 30, 200, ("Mario!! My castle is in\ngreat peril. I know that\nBowser is the cause...and\nI know that only you can\nstop him!\nThe doors in the castle\nthat have been sealed by\nBowser can be opened only\nwith Star Power.\n\nBut there are secret\npaths in the castle,\npaths that Bowser hasn't\nfound.\n\nOne of those paths is in\nthis room, and it holds\none of the castle's Secret\nStars!\n\nFind that Secret Star,\nMario! It will help you\non your quest. Please,\nMario, you have to\nhelp us!\nRetrieve all of the\nPower Stars in the castle\nand free us from this\nawful prison!\nPlease!"))
define_cs_dialog(DIALOG_076, 1, 6, 30, 200, ("Thanks to the power of\nthe Stars, life is\nreturning to the castle.\nPlease, Mario, you have\nto give Bowser the boot!\n\nHere, let me tell you a\nlittle something about the\ncastle. In the room with\nthe mirrors, look carefully\nfor anything that's not\nreflected in the mirror.\nAnd when you go to the\nwater town, you can flood\nit with a high jump into\nthe painting. Oh, by the\nway, look what I found!"))
define_cs_dialog(DIALOG_077, 1, 2, 150, 200, ("It is decreed that one\nshall pound the pillars."))
define_cs_dialog(DIALOG_078, 1, 5, 30, 200, ("Break open the Blue Coin\nBlock by Pounding the\nGround with the [Z] Button.\nOne Blue Coin is worth\nfive Yellow Coins.\nBut you have to hurry!\nThe coins will disappear\nif you're not quick to\ncollect them! Too bad."))
define_cs_dialog(DIALOG_079, 1, 4, 30, 200, ("Owwwuu! Let me go!\nUukee-kee! I was only\nteasing! Can't you take\na joke?\nI'll tell you what, let's\ntrade. If you let me go,\nI'll give you something\nreally good.\nSo, how about it?\n\n//Free him/ Hold on"))
define_cs_dialog(DIALOG_080, 1, 1, 30, 200, ("Eeeh hee hee hee!"))
define_cs_dialog(DIALOG_081, 1, 4, 30, 200, ("The mystery is of Wet\nor Dry.\nAnd where does the\nsolution lie?\nThe city welcomes visitors\nwith the depth they bring\nas they enter."))
define_cs_dialog(DIALOG_082, 1, 4, 30, 200, ("Hold on to your hat! If\nyou lose it, you'll be\ninjured easily.\n\nIf you do lose your Cap,\nyou'll have to find it in\nthe course where you\nlost it.\nOh, boy, it's not looking\ngood for Peach. She's\nstill trapped somewhere\ninside the walls.\nPlease, Mario, you have\nto help her! Did you know\nthat there are enemy\nworlds inside the walls?\nYup. It's true. Bowser's\ntroops are there, too.\nOh, here, take this. I've\nbeen keeping it for you."))
define_cs_dialog(DIALOG_083, 1, 6, 30, 200, ("There's something strange\nabout that clock. As you\njump inside, watch the\nposition of the big hand.\nOh, look what I found!\nHere, Mario, catch!"))
define_cs_dialog(DIALOG_084, 1, 3, 30, 200, ("Yeeoww! Unhand me,\nbrute! I'm late, so late,\nI must make haste!\nThis shiny thing? Mine!\nIt's mine. Finders,\nkeepers, losers...\nLate, late, late...\nOuch! Take it then! A\ngift from Bowser, it was.\nNow let me be! I have a\ndate! I cannot be late\nfor tea!"))
define_cs_dialog(DIALOG_085, 1, 5, 30, 200, ("You don't stand a ghost\nof a chance in this house.\nIf you walk out of here,\nyou deserve...\n...a Ghoul Medal..."))
define_cs_dialog(DIALOG_086, 1, 3, 30, 200, ("Running around in circles\nmakes some bad guys roll\ntheir eyes."))
define_cs_dialog(DIALOG_087, 1, 4, 30, 200, ("Santa Claus isn't the only\none who can go down a\nchimney! Come on in!\n/--Cabin Proprietor"))
define_cs_dialog(DIALOG_088, 1, 5, 30, 200, ("Work Elevator\nFor those who get off\nhere: Grab the pole to the\nleft and slide carefully\ndown."))
define_cs_dialog(DIALOG_089, 1, 5, 95, 200, ("Both ways fraught with\ndanger! Watch your feet!\nThose who can't do the\nLong Jump, tsk, tsk. Make\nyour way to the right.\nRight: Work Elevator\n/// Cloudy Maze\nLeft: Black Hole\n///Underground Lake\n\nRed Circle: Elevator 2\n//// Underground Lake\nArrow: You are here"))
define_cs_dialog(DIALOG_090, 1, 6, 30, 200, ("Bwa ha ha ha!\nYou've stepped right into\nmy trap, just as I knew\nyou would! I warn you,\n" .. ' "Friend," ' .. "watch your\nstep!"))
define_cs_dialog(DIALOG_091, 2, 2, 30, 200, ("Danger!\nStrong Gusts!\nBut the wind makes a\ncomfy ride."))
define_cs_dialog(DIALOG_092, 1, 5, 30, 200, ("Pestering me again, are\nyou, Mario? Can't you see\nthat I'm having a merry\nlittle time, making\nmischief with my minions?\nNow, return those Stars!\nMy troops in the walls\nneed them! Bwa ha ha!"))
define_cs_dialog(DIALOG_093, 1, 5, 30, 200, ("Mario! You again! Well\nthat's just fine--I've\nbeen looking for something\nto fry with my fire\nbreath!\nYour Star Power is\nuseless against me!\nYour friends are all\ntrapped within the\nwalls...\nAnd you'll never see the\nPrincess again!\nBwa ha ha ha!"))
define_cs_dialog(DIALOG_094, 1, 4, 30, 200, ("Get a good run up the\nslope! Do you remember\nthe Long Jump? Run, press\n[Z], then jump!"))
define_cs_dialog(DIALOG_095, 1, 4, 30, 200, ("To read a sign, stand in\nfront of it and press [B],\nlike you did just now.\n\nWhen you want to talk to\na Koopa Troopa or other\nanimal, stand right in\nfront of it.\nPlease recover the Stars\nthat were stolen by\nBowser in this course."))
define_cs_dialog(DIALOG_096, 1, 4, 30, 200, ("The path is narrow here.\nEasy does it! No one is\nallowed on top of the\nmountain!\nAnd if you know what's\ngood for you, you won't\nwake anyone who's\nsleeping!\nMove slowly,\ntread lightly."))
define_cs_dialog(DIALOG_097, 1, 5, 30, 200, ("Don't be a pushover!\nIf anyone tries to shove\nyou around, push back!\nIt's one-on-one, with a\nfiery finish for the loser!"))
define_cs_dialog(DIALOG_098, 1, 2, 95, 200, ("Come on in here...\n...heh, heh, heh..."))
define_cs_dialog(DIALOG_099, 1, 5, 95, 200, ("Eh he he...\nYou're mine, now, hee hee!\nI'll pass right through\nthis wall. Can you do\nthat? Heh, heh, heh!")) -- unused
define_cs_dialog(DIALOG_100, 1, 3, 95, 200, ("Ukkiki...Wakkiki...kee kee!\nHa! I snagged it!\nIt's mine! Heeheeheeee!"))
define_cs_dialog(DIALOG_101, 1, 3, 95, 200, ("Ackk! Let...go...\nYou're...choking...me...\nCough...I've been framed!\nThis Cap? Oh, all right,\ntake it. It's a cool Cap,\nbut I'll give it back.\nI think it looks better on\nme than it does on you,\nthough! Eeeee! Kee keee!"))
define_cs_dialog(DIALOG_102, 1, 5, 30, 200, ("Pssst! The Boos are super\nshy. If you look them\nin the eyes, they fade\naway, but if you turn\nyour back, they reappear.\nIt's no use trying to hit\nthem when they're fading\naway. Instead, sneak up\nbehind them and punch."))
define_cs_dialog(DIALOG_103, 1, 4, 95, 200, ("Upon four towers\none must alight...\nThen at the peak\nshall shine the light..."))
define_cs_dialog(DIALOG_104, 1, 5, 30, 200, ("The shadowy star in front\nof you is a 『Star\nMarker.』 When you collect\nall 8 Red Coins, the Star\nwill appear here."))
define_cs_dialog(DIALOG_105, 1, 3, 95, 200, ("Ready for blastoff! Come\non, hop into the cannon!\n\nYou can reach the Star on\nthe floating island by\nusing the four cannons.\nUse the Control Stick to\naim, then press [A] to fire.\n\nIf you're handy, you can\ngrab on to trees or poles\nto land."))
define_cs_dialog(DIALOG_106, 1, 2, 95, 200, ("Ready for blastoff! Come\non, hop into the cannon!"))
define_cs_dialog(DIALOG_107, 1, 3, 95, 200, ("Ghosts...\n...don't...\n...DIE!\nHeh, heh, heh!\nCan you get out of here...\n...alive?"))
define_cs_dialog(DIALOG_108, 1, 2, 95, 200, ("Boooooo-m! Here comes\nthe master of mischief,\nthe tower of terror,\nthe Big Boo!\nKa ha ha ha..."))
define_cs_dialog(DIALOG_109, 1, 4, 95, 200, ("Ooooo Nooooo!\nTalk about out-of-body\nexperiences--my body\nhas melted away!\nHave you run in to any\nheadhunters lately??\nI could sure use a new\nbody!\nBrrr! My face might\nfreeze like this!"))
define_cs_dialog(DIALOG_110, 1, 5, 95, 200, ("I need a good head on my\nshoulders. Do you know of\nanybody in need of a good\nbody? Please! I'll follow\nyou if you do!"))
define_cs_dialog(DIALOG_111, 1, 4, 95, 200, ("Perfect! What a great\nnew body! Here--this is a\npresent for you. It's sure\nto warm you up."))
define_cs_dialog(DIALOG_112, 1, 4, 30, 200, ("Collect as many coins as\npossible! They'll refill\nyour Power Meter.\n\nYou can check to see how\nmany coins you've\ncollected in each of the\n15 enemy worlds.\nYou can also recover\npower by touching the\nSpinning Heart.\n\nThe faster you run\nthrough the heart, the\nmore power you'll recover."))
define_cs_dialog(DIALOG_113, 1, 6, 30, 200, ("There are special Caps in\nthe red, green and blue\nblocks. Step on the\nswitches in the hidden\ncourses to activate the\nCap Blocks."))
define_cs_dialog(DIALOG_114, 1, 5, 95, 200, ("It makes me so mad! We\nbuild your houses, your\ncastles. We pave your\nroads, and still you\nwalk all over us.\nDo you ever say thank\nyou? No! Well, you're not\ngoing to wipe your feet\non me! I think I'll crush\nyou just for fun!\nDo you have a problem\nwith that? Just try to\npound me, wimp! Ha!"))
define_cs_dialog(DIALOG_115, 1, 5, 95, 200, ("No! Crushed again!\nI'm just a stepping stone,\nafter all. I won't gravel,\ner, grovel. Here, you win.\nTake this with you!"))
define_cs_dialog(DIALOG_116, 1, 5, 95, 200, ("Whaaa....Whaaat?\nCan it be that a\npipsqueak like you has\ndefused the Bob-omb\nking????\nYou might be fast enough\nto ground me, but you'll\nhave to pick up the pace\nif you want to take King\nBowser by the tail.\nMethinks my troops could\nlearn a lesson from you!\nHere is your Star, as I\npromised, Mario.\n\nIf you want to see me\nagain, select this Star\nfrom the menu. For now,\nfarewell."))
define_cs_dialog(DIALOG_117, 1, 1, 95, 200, ("Who...walk...here?\nWho...break...seal?\nWake..ancient..ones?\nWe no like light...\nRrrrummbbble...\nWe no like...intruders!\nNow battle...\n...hand...\n...to...\n...hand!"))
define_cs_dialog(DIALOG_118, 1, 6, 95, 200, ("Grrrrumbbble!\nWhat...happen?\nWe...crushed like pebble.\nYou so strong!\nYou rule ancient pyramid!\nFor today...\nNow, take Star of Power.\nWe...sleep...darkness."))
define_cs_dialog(DIALOG_119, 1, 6, 30, 200, ("Grrr! I was a bit\ncareless. This is not as I\nhad planned...but I still\nhold the power of the\nStars, and I still have\nPeach.\nBwa ha ha! You'll get no\nmore Stars from me! I'm\nnot finished with you yet,\nbut I'll let you go for\nnow. You'll pay for this...\nlater!"))
define_cs_dialog(DIALOG_120, 1, 4, 30, 200, ("Ooowaah! Can it be that\nI've lost??? The power of\nthe Stars has failed me...\nthis time.\nConsider this a draw.\nNext time, I'll be in\nperfect condition.\n\nNow, if you want to see\nyour precious Princess,\ncome to the top of the\ntower.\nI'll be waiting!\nGwa ha ha ha!"))
define_cs_dialog(DIALOG_121, 1, 5, 30, 200, ("Nooo! It can't be!\nYou've really beaten me,\nMario?!! I gave those\ntroops power, but now\nit's fading away!\nArrgghh! I can see peace\nreturning to the world! I\ncan't stand it! Hmmm...\nIt's not over yet...\n\nC'mon troops! Let's watch\nthe ending together!\nBwa ha ha!"))
define_cs_dialog(DIALOG_122, 1, 4, 30, 200, ("The Black Hole\nRight: Work Elevator\n/// Cloudy Maze\nLeft: Underground Lake"))
define_cs_dialog(DIALOG_123, 1, 4, 30, 200, ("Metal Cavern\nRight: To Waterfall\nLeft: Metal Cap Switch"))
define_cs_dialog(DIALOG_124, 1, 4, 30, 200, ("Work Elevator\nDanger!!\nRead instructions\nthoroughly!\nElevator continues in the\ndirection of the arrow\nactivated."))
define_cs_dialog(DIALOG_125, 1, 3, 30, 200, ("Hazy Maze-Exit\nDanger! Closed.\nTurn back now."))
define_cs_dialog(DIALOG_126, 2, 3, 30, 200, ("Up: Black Hole\nRight: Work Elevator\n/// Hazy Maze"))
define_cs_dialog(DIALOG_127, 3, 4, 30, 200, ("Underground Lake\nRight: Metal Cave\nLeft: Abandoned Mine\n///(Closed)\nA gentle sea dragon lives\nhere. Pound on his back to\nmake him lower his head.\nDon't become his lunch."))
define_cs_dialog(DIALOG_128, 1, 4, 95, 200, ("You must fight with\nhonor! It is against the\nroyal rules to throw the\nking out of the ring!"))
define_cs_dialog(DIALOG_129, 1, 5, 30, 200, ("Welcome to the Vanish\nCap Switch Course! All of\nthe blue blocks you find\nwill become solid once you\nstep on the Cap Switch.\nYou'll disappear when you\nput on the Vanish Cap, so\nyou'll be able to elude\nenemies and walk through\nmany things. Try it out!"))
define_cs_dialog(DIALOG_130, 1, 5, 30, 200, ("Welcome to the Metal Cap\nSwitch Course! Once you\nstep on the Cap Switch,\nthe green blocks will\nbecome solid.\nWhen you turn your body\ninto metal with the Metal\nCap, you can walk\nunderwater! Try it!"))
define_cs_dialog(DIALOG_131, 1, 5, 30, 200, ("Welcome to the Wing Cap\nCourse! Step on the red\nswitch at the top of the\ntower, in the center of\nthe rainbow ring.\nWhen you trigger the\nswitch, all of the red\nblocks you find will\nbecome solid.\n\nTry out the Wing Cap! Do\nthe Triple Jump to take\noff and press [Z] to land.\n\n\nPull back on the Control\nStick to go up and push\nforward to nose down,\njust as you would when\nflying an airplane."))
define_cs_dialog(DIALOG_132, 1, 4, 30, 200, ("Whoa, Mario, pal, you\naren't trying to cheat,\nare you? Shortcuts aren't\nallowed.\nNow, I know that you\nknow better. You're\ndisqualified! Next time,\nplay fair!"))
define_cs_dialog(DIALOG_133, 1, 6, 30, 200, ("Am I glad to see you! The\nPrincess...and I...and,\nwell, everybody...we're all\ntrapped inside the castle\nwalls.\n\nBowser has stolen the\ncastle's Stars, and he's\nusing their power to\ncreate his own world in\nthe paintings and walls.\n\nPlease recover the Power\nStars! As you find them,\nyou can use their power\nto open the doors that\nBowser has sealed.\n\nThere are four rooms on\nthe first floor. Start in\nthe one with the painting\nof Bob-omb inside. It's\nthe only room that Bowser\nhasn't sealed.\nWhen you collect eight\nPower Stars, you'll be\nable to open the door\nwith the big star. The\nPrincess must be inside!"))
define_cs_dialog(DIALOG_134, 1, 5, 30, 200, ("The names of the Stars\nare also hints for\nfinding them. They are\ndisplayed at the beginning\nof each course.\nYou can collect the Stars\nin any order. You won't\nfind some Stars, enemies\nor items unless you select\na specific Star.\nAfter you collect some\nStars, you can try\nanother course.\nWe're all waiting for\nyour help!"))
define_cs_dialog(DIALOG_135, 1, 5, 30, 200, ("It was Bowser who stole\nthe Stars. I saw him with\nmy own eyes!\n\n\nHe's hidden six Stars in\neach course, but you\nwon't find all of them in\nsome courses until you\npress the Cap Switches.\nThe Stars you've found\nwill show on each course's\nstarting screen.\n\n\nIf you want to see some\nof the enemies you've\nalready defeated, select\nthe Stars you recovered\nfrom them."))
define_cs_dialog(DIALOG_136, 1, 6, 30, 200, ("Wow! You've already\nrecovered that many\nStars? Way to go, Mario!\nI'll bet you'll have us out\nof here in no time!\n\nBe careful, though.\nBowser and his band\nwrote the book on 『bad.』\nTake my advice: When you\nneed to recover from\ninjuries, collect coins.\nYellow Coins refill one\npiece of the Power Meter,\nRed Coins refill two\npieces, and Blue Coins\nrefill five.\n\nTo make Blue Coins\nappear, pound on Blue\nCoin Blocks.\n\n\n\nAlso, if you fall from\nhigh places, you'll\nminimize damage if you\nPound the Ground as you\nland."))
define_cs_dialog(DIALOG_137, 1, 6, 30, 200, ("Thanks, Mario! The castle\nis recovering its energy\nas you retrieve Power\nStars, and you've chased\nBowser right out of here,\non to some area ahead.\nOh, by the by, are you\ncollecting coins? Special\nStars appear when you\ncollect 100 coins in each\nof the 15 courses!"))
define_cs_dialog(DIALOG_138, 1, 3, 30, 200, ("Down: Underground Lake\nLeft: Black Hole\nRight: Hazy Maze (Closed)"))
define_cs_dialog(DIALOG_139, 1, 6, 30, 200, ("Above: Automatic Elevator\nElevator begins\nautomatically and follows\npre-set course.\nIt disappears\nautomatically, too."))
define_cs_dialog(DIALOG_140, 1, 6, 30, 200, ("Elevator Area\nRight: Hazy Maze\n/// Entrance\nLeft: Black Hole\n///Elevator 1\nArrow: You are here"))
define_cs_dialog(DIALOG_141, 1, 5, 150, 200, ("You've recovered one of\nthe stolen Power Stars!\nNow you can open some of\nthe sealed doors in the\ncastle.\nTry the Princess's room\non the second floor and\nthe room with the\npainting of Whomp's\nFortress on Floor 1.\nBowser's troops are still\ngaining power, so you\ncan't give up. Save us,\nMario! Keep searching for\nStars!"))
define_cs_dialog(DIALOG_142, 1, 5, 150, 200, ("You've recovered three\nPower Stars! Now you can\nopen any door with a 3\non its star.\n\nYou can come and go from\nthe open courses as you\nplease. The enemies ahead\nare even meaner, so be\ncareful!"))
define_cs_dialog(DIALOG_143, 1, 6, 150, 200, ("You've recovered eight of\nthe Power Stars! Now you\ncan open the door with\nthe big Star! But Bowser\nis just ahead...can you\nhear the Princess calling?"))
define_cs_dialog(DIALOG_144, 1, 6, 150, 200, ("You've recovered 30\nPower Stars! Now you can\nopen the door with the\nbig Star! But before you\nmove on, how's it going\notherwise?\nDid you pound the two\ncolumns down? You didn't\nlose your hat, did you?\nIf you did, you'll have to\nstomp on the condor to\nget it back!\nThey say that Bowser has\nsneaked out of the sea\nand into the underground.\nHave you finally\ncornered him?"))
define_cs_dialog(DIALOG_145, 1, 6, 150, 200, ("You've recovered 50\nPower Stars! Now you can\nopen the Star Door on the\nthird floor. Bowser's\nthere, you know.\n\nOh! You've found all of\nthe Cap Switches, haven't\nyou? Red, green and blue?\nThe Caps you get from the\ncolored blocks are really\nhelpful.\nHurry along, now. The\nthird floor is just ahead."))
define_cs_dialog(DIALOG_146, 1, 6, 150, 200, ("You've found 70 Power\nStars! The mystery of the\nendless stairs is solved,\nthanks to you--and is\nBowser ever upset! Now,\non to the final bout!"))
define_cs_dialog(DIALOG_147, 1, 5, 30, 200, ("Are you using the Cap\nBlocks? You really should,\nyou know.\n\n\nTo make them solid so you\ncan break them, you have\nto press the colored Cap\nSwitches in the castle's\nhidden courses.\nYou'll find the hidden\ncourses only after\nregaining some of the\nPower Stars.\n\nThe Cap Blocks are a big\nhelp! Red for the Wing\nCap, green for the Metal\nCap, blue for the Vanish\nCap."))
define_cs_dialog(DIALOG_148, 1, 6, 30, 200, ("Snowman Mountain ahead.\nKeep out! And don't try\nthe Triple Jump over the\nice block shooter.\n\n\nIf you fall into the\nfreezing pond, your power\ndecreases quickly, and\nyou won't recover\nautomatically.\n//--The Snowman"))
define_cs_dialog(DIALOG_149, 1, 3, 30, 200, ("Welcome to\nPrincess Toadstool's\nsecret slide!\nThere's a Star hidden\nhere that Bowser couldn't\nfind.\nWhen you slide, press\nforward to speed up,\npull back to slow down.\nIf you slide really\nfast, you'll win the Star!"))
define_cs_dialog(DIALOG_150, 1, 5, 30, 200, ("Waaaa! You've flooded my\nhouse! Wh-why?? Look at\nthis mess! What am I\ngoing to do now?\n\nThe ceiling's ruined, the\nfloor is soaked...what to\ndo, what to do? Huff...\nhuff...it makes me so...\nMAD!!!\nEverything's been going\nwrong ever since I got\nthis Star...It's so shiny,\nbut it makes me feel...\nstrange..."))
define_cs_dialog(DIALOG_151, 1, 4, 30, 200, ("I can't take this\nanymore! First you get\nme all wet, then you\nstomp on me!\nNow I'm really, really,\nREALLY mad!\nWaaaaaaaaaaaaaaaaa!!!"))
define_cs_dialog(DIALOG_152, 1, 3, 30, 200, ("Owwch! Uncle! Uncle!\nOkay, I give. Take this\nStar!\nWhew! I feel better now.\nI don't really need it\nanymore, anyway--\nI can see the stars\nthrough my ceiling at\nnight.\nThey make me feel...\n...peaceful. Please, come\nback and visit anytime."))
define_cs_dialog(DIALOG_153, 1, 4, 30, 200, ("Hey! Who's there?\nWhat's climbing on me?\nIs it an ice ant?\nA snow flea?\nWhatever it is, it's\nbugging me! I think I'll\nblow it away!"))
define_cs_dialog(DIALOG_154, 1, 5, 30, 200, ("Hold on to your hat! If\nyou lose it, you'll be\neasily injured. If you\nlose it, look for it in the\ncourse where you lost it.\nSpeaking of lost, the\nPrincess is still stuck in\nthe walls somewhere.\nPlease help, Mario!\n\nOh, you know that there\nare secret worlds in the\nwalls as well as in the\npaintings, right?"))
define_cs_dialog(DIALOG_155, 1, 6, 30, 200, ("Thanks to the power of\nthe Stars, life is\nreturning to the castle.\nPlease, Mario, you have\nto give Bowser the boot!\n\nHere, let me tell you a\nlittle something about the\ncastle. In the room with\nthe mirrors, look carefully\nfor anything that's not\nreflected in the mirror.\nAnd when you go to the\nwater town, you can flood\nit with a high jump into\nthe painting."))
define_cs_dialog(DIALOG_156, 1, 5, 30, 200, ("The world inside the\nclock is so strange!\nWhen you jump inside,\nwatch the position of\nthe big hand!"))
define_cs_dialog(DIALOG_157, 1, 5, 30, 200, ("Watch out! Don't let\nyourself be swallowed by\nquicksand.\n\n\nIf you sink into the sand,\nyou won't be able to\njump, and if your head\ngoes under, you'll be\nsmothered.\nThe dark areas are\nbottomless pits."))
define_cs_dialog(DIALOG_158, 1, 6, 30, 200, ("1. If you jump repeatedly\nand time it right, you'll\njump higher and higher.\nIf you run really fast and\ntime three jumps right,\nyou can do a Triple Jump.\n2. Jump into a solid wall,\nthen jump again when you\nhit the wall. You can\nbounce to a higher level\nusing this Wall Kick."))
define_cs_dialog(DIALOG_159, 1, 6, 30, 200, ("3. If you stop, press [Z]\nto crouch, then jump, you\ncan perform a Backward\nSomersault. To do a Long\nJump, run fast, press [Z],\nthen jump."))
define_cs_dialog(DIALOG_160, 1, 4, 30, 200, ("Press [B] while running\nfast to do a Body Slide\nattack. To stand while\nsliding, press [A] or [B]."))
define_cs_dialog(DIALOG_161, 1, 4, 30, 200, ("Mario!!!\nIt that really you???\nIt has been so long since\nour last adventure!\nThey told me that I might\nsee you if I waited here,\nbut I'd just about given\nup hope!\nIs it true? Have you\nreally beaten Bowser? And\nrestored the Stars to the\ncastle?\nAnd saved the Princess?\nI knew you could do it!\nNow I have a very special\nmessage for you.\nThanks for playing Super\nMario 64! This is the\nend of the game, but not\nthe end of the fun.\nWe want you to keep on\nplaying, so we have a\nlittle something for you.\nWe hope that you like it!\nEnjoy!!!\n\nThe Super Mario 64 Team"))
define_cs_dialog(DIALOG_162, 1, 4, 30, 200, ("No, no, no! Not you\nagain! I'm in a great\nhurry, can't you see?\n\nI've no time to squabble\nover Stars. Here, have it.\nI never meant to hide it\nfrom you...\nIt's just that I'm in such\na rush. That's it, that's\nall. Now, I must be off.\nOwww! Let me go!"))
define_cs_dialog(DIALOG_163, 1, 5, 30, 200, ("Noooo! You've really\nbeaten me this time,\nMario! I can't stand\nlosing to you!\n\nMy troops...worthless!\nThey've turned over all\nthe Power Stars! What?!\nThere are 120 in all???\n\nAmazing! There were some\nin the castle that I\nmissed??!!\n\n\nNow I see peace\nreturning to the world...\nOooo! I really hate that!\nI can't watch--\nI'm outta here!\nJust you wait until next\ntime. Until then, keep\nthat Control Stick\nsmokin'!\nBuwaa ha ha!"))
define_cs_dialog(DIALOG_164, 1, 4, 30, 200, ("Mario! What's up, pal?\nI haven't been on the\nslide lately, so I'm out\nof shape.\nStill, I'm always up for a\ngood race, especially\nagainst an old sleddin'\nbuddy.\nWhaddya say?\nReady...set...\n\n//Go//// Don't Go"))
define_cs_dialog(DIALOG_165, 1, 5, 30, 200, ("I take no responsibility\nwhatsoever for those who\nget dizzy and pass out\nfrom running around\nthis post."))
define_cs_dialog(DIALOG_166, 1, 4, 30, 200, ("I'll be back soon.\nI'm out training now,\nso come back later.\n//--Koopa the Quick"))
define_cs_dialog(DIALOG_167, 1, 4, 30, 200, ("Princess Toadstool's\ncastle is just ahead.\n\n\nPress [A] to jump, [Z] to\ncrouch, and [B] to punch,\nread a sign, or grab\nsomething.\nPress [B] again to throw\nsomething you're holding."))
define_cs_dialog(DIALOG_168, 1, 5, 30, 200, ("Hey! Knock it off! That's\nthe second time you've\nnailed me. Now you're\nasking for it, linguine\nbreath!"))
define_cs_dialog(DIALOG_169, 1, 4, 30, 200, ("Keep out!\nThat means you!\nArrgghh!\n\nAnyone entering this cave\nwithout permission will\nmeet certain disaster."))
local DIALOG_NAME = "Mario"
---@param name string
function dialog_set_replace_name(name)
DIALOG_NAME = name
end
local prevCharName = ""
local function dialog_swap(charName)
for i = DIALOG_000, #dialogTable do
if dialogTable[i] ~= nil then
local dialog = dialogTable[i]
charName = charName:gsub('"', "''")
local replaced_dialog = dialog.str:gsub(DIALOG_NAME, charName)
real_dialog_replace(i, dialog.unused, dialog.linesPerBox, dialog.leftOffset, dialog.width, replaced_dialog)
end
local function dialog_update(dialogId)
-- Save Original Dialog
if ogDialog[dialogId] == nil then
local dialog = smlua_text_utils_dialog_get(dialogId)
ogDialog[dialogId] = {
unused = dialog.unused,
linesPerBox = dialog.linesPerBox,
leftOffset = dialog.leftOffset,
width = dialog.width,
text = dialog.text
}
end
end
local function update()
-- Query Character Swapped
local charName = characterTable[currChar][characterTable[currChar].currAlt].name
if prevCharName ~= charName then
dialog_swap(charName)
prevCharName = charName
local dialog = ogDialog[dialogId]
local charName = characterTable[currChar].nickname
local charAuto = characterTable[currChar].autoDialog
-- Check for Override Dialog and use it instead
local colorDialog = false
if characterDialog[currChar] ~= nil and characterDialog[currChar][dialogId] ~= nil then
dialog = characterDialog[currChar][dialogId]
colorDialog = true
elseif charAuto then
dialog.text = dialog.text:gsub(DEFAULT_DIALOG_NAME, charName)
colorDialog = true
end
-- Set color if Dialog has Character's Name
reset_dialog_override_color()
if colorDialog then
local charColor = characterTable[currChar][characterTable[currChar].currAlt].color
set_dialog_override_color(charColor.r*0.3, charColor.g*0.3, charColor.b*0.3, 150, 255, 255, 255, 255)
end
-- Apply Text Changes
smlua_text_utils_dialog_replace(
dialogId,
dialog.unused,
dialog.linesPerBox,
dialog.leftOffset,
dialog.width,
dialog.text
)
-- Reminder to later change this to true, string
return true
end
hook_event(HOOK_UPDATE, update)
hook_event(HOOK_ON_DIALOG, dialog_update)

View file

@ -4,20 +4,14 @@
if incompatibleClient then return 0 end
-- localize functions to improve performance - n-hud.lua
local og_hud_get_value,og_hud_set_value,djui_hud_print_text,tostring,hud_set_flash,get_global_timer,hud_get_flash,djui_hud_get_screen_width,math_ceil,obj_get_first_with_behavior_id,get_behavior_from_id,count_objects_with_behavior,djui_hud_render_rect,djui_hud_set_resolution,djui_hud_get_screen_height,djui_hud_set_color,djui_hud_set_font,djui_hud_measure_text,djui_chat_message_create,hud_is_hidden,djui_is_playerlist_open = hud_get_value,hud_set_value,djui_hud_print_text,tostring,hud_set_flash,get_global_timer,hud_get_flash,djui_hud_get_screen_width,math.ceil,obj_get_first_with_behavior_id,get_behavior_from_id,count_objects_with_behavior,djui_hud_render_rect,djui_hud_set_resolution,djui_hud_get_screen_height,djui_hud_set_color,djui_hud_set_font,djui_hud_measure_text,djui_chat_message_create,hud_is_hidden,djui_is_playerlist_open
--[[
Some functions we need for the hud
Color hud code written by EmilyEmmi
Djui box code written by xLuigiGamerx (Use outside of character select is forbidden as these functions were made for another mod I'm planning to release)
]]
local og_hud_get_value = hud_get_value
local og_hud_set_value = hud_set_value
---@param text string
---@return nil, number, number, number, number
---@return number?, number?, number?, number?
local function convert_color(text)
if text:sub(2, 2) ~= "#" then
return nil
return
end
text = text:sub(3, -2)
local rstring, gstring, bstring = "", "", ""
@ -39,7 +33,7 @@ end
---@param text string
---@param get_color boolean|nil
---@return string, string, string, boolean
---@return string, string?, string?
local function remove_color(text, get_color)
local start = text:find("\\")
local next = 1
@ -137,12 +131,12 @@ local function djui_hud_print_text_with_color(text, x, y, scale, red, green, blu
while render ~= nil do
local r, g, b, a = convert_color(color)
if alpha then a = alpha end
djui_hud_print_text(render, x + space, y, scale);
djui_hud_print_text(render, x + space, y, scale)
if r then djui_hud_set_color(r, g, b, a) end
space = space + djui_hud_measure_text(render) * scale
text, color, render = remove_color(text, true)
end
djui_hud_print_text(text, x + space, y, scale);
djui_hud_print_text(text, x + space, y, scale)
end
---@param text string Message
@ -175,36 +169,39 @@ end
-- Real HUD Stuffs --
---------------------
-- Updates the Chracter Select hud flags along with the vanilla hud flags
local hiddenList = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER
local sCharSelectHudDisplayFlags = og_hud_get_value(HUD_DISPLAY_FLAGS) | hiddenList -- Initializes custom hud flags
function flags_update()
sCharSelectHudDisplayFlags = sCharSelectHudDisplayFlags & (og_hud_get_value(HUD_DISPLAY_FLAGS) | hiddenList) -- Updated the custom flags
og_hud_set_value(HUD_DISPLAY_FLAGS, og_hud_get_value(HUD_DISPLAY_FLAGS) & ~(hiddenList)) -- Update the vanilla flags
end
hook_event(HOOK_ON_HUD_RENDER_BEHIND, flags_update)
-- Modified Vanilla Functions --
--[[
These are `_G` on their own to replace vanilla functions
]]
local sCharSelectHudDisplayFlags -- `local` because we aren't exposing this
-- Here to make sure the flags are at the default state
hook_event(HOOK_UPDATE, function ()
if not sCharSelectHudDisplayFlags or sCharSelectHudDisplayFlags == 0 then
sCharSelectHudDisplayFlags = og_hud_get_value(HUD_DISPLAY_FLAGS) | HUD_DISPLAY_DEFAULT
end
end)
--- @param type HudDisplayValue
--- @return integer
---@param type HudDisplayValue
---@return integer
function _G.hud_get_value(type)
if type == HUD_DISPLAY_FLAGS then
return sCharSelectHudDisplayFlags
return sCharSelectHudDisplayFlags | og_hud_get_value(HUD_DISPLAY_FLAGS)
else
return og_hud_get_value(type)
end
end
--- @param type HudDisplayValue
--- @param value integer
---@param type HudDisplayValue
---@param value integer
--- Sets a HUD display value
function _G.hud_set_value(type, value)
if type == HUD_DISPLAY_FLAGS then
sCharSelectHudDisplayFlags = value
og_hud_set_value(type, value & ~(hiddenList))
else
og_hud_set_value(type, value)
end
@ -215,7 +212,7 @@ end
---Hides the specified custom hud element
---@param hudElement HUDDisplayFlag
function hud_hide_element(hudElement)
--log_to_console("The `charSelect.hud_hide_element()` function is deprecated, please use normal vanilla functions as they have been modified to work with Character Select.", CONSOLE_MESSAGE_WARNING)
log_to_console_once("`charSelect.hud_hide_element` function is deprecated, please use 'hud_set_value'", CONSOLE_MESSAGE_WARNING)
hud_set_value(HUD_DISPLAY_FLAGS, hud_get_value(HUD_DISPLAY_FLAGS) & ~hudElement)
return true
end
@ -223,7 +220,7 @@ end
---Shows the specified custom hud element
---@param hudElement HUDDisplayFlag
function hud_show_element(hudElement)
--log_to_console("The `charSelect.hud_show_element()` function is deprecated, please use normal vanilla functions as they have been modified to work with Character Select.", CONSOLE_MESSAGE_WARNING)
log_to_console_once("`hud_show_element` function is deprecated, please use 'hud_set_value'", CONSOLE_MESSAGE_WARNING)
hud_set_value(HUD_DISPLAY_FLAGS, hud_get_value(HUD_DISPLAY_FLAGS) | hudElement)
return true
end
@ -232,26 +229,24 @@ end
---@param hudElement HUDDisplayFlag
---@return boolean
function hud_get_element(hudElement)
--log_to_console("The `charSelect.hud_get_element()` function is deprecated, please use normal vanilla functions as they have been modified to work with Character Select.", CONSOLE_MESSAGE_WARNING)
djui_chat_message_create(tostring(sCharSelectHudDisplayFlags))
log_to_console_once("`charSelect.hud_get_element` function is deprecated, please use 'hud_set_value'", CONSOLE_MESSAGE_WARNING)
return (hud_get_value(HUD_DISPLAY_FLAGS) & hudElement) ~= 0
end
local MATH_DIVIDE_16 = 1/16
local MATH_DIVIDE_32 = 1/32
local MATH_DIVIDE_64 = 1/64
local MATH_DIVIDE_HEALTH = 1/0x100
local FONT_USER = FONT_NORMAL
--- @param localIndex integer
--- @return string
---@param localIndex integer
---@return string
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them
function name_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
if characterTable[i].saveName == p.saveName then
return characterTable[i][(p.currAlt and p.currAlt or 1)].name
end
@ -259,14 +254,14 @@ function name_from_local_index(localIndex)
return "???"
end
--- @param localIndex integer
--- @return table
---@param localIndex integer
---@return table
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them
function color_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
if characterTable[i].saveName == p.saveName then
return characterTable[i][(p.currAlt and p.currAlt or 1)].color
end
@ -274,15 +269,15 @@ function color_from_local_index(localIndex)
return {r = 255, g = 255, b = 255}
end
--- @param localIndex integer
--- @return TextureInfo|string
---@param localIndex integer
---@return TextureInfo|string
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them.
--- This function can return nil. if this is the case, render `djui_hud_print_text("?", x, y, 1)`
function life_icon_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
local char = characterTable[i]
if char.saveName == p.saveName then
return char[(p.currAlt and p.currAlt or 1)].lifeIcon
@ -291,14 +286,14 @@ function life_icon_from_local_index(localIndex)
return "?"
end
--- @param localIndex integer
--- @return TextureInfo
---@param localIndex integer
---@return TextureInfo
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them
function star_icon_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
local char = characterTable[i]
if char.saveName == p.saveName then
return char[(p.currAlt and p.currAlt or 1)].starIcon
@ -308,10 +303,10 @@ function star_icon_from_local_index(localIndex)
end
local TYPE_STRING = "string"
--- @param localIndex integer
--- @param x integer
--- @param y integer
--- @param scale integer
---@param localIndex integer
---@param x integer
---@param y integer
---@param scale integer
function render_life_icon_from_local_index(localIndex, x, y, scale)
if localIndex == nil then localIndex = 0 end
local lifeIcon = life_icon_from_local_index(localIndex)
@ -331,13 +326,13 @@ function render_life_icon_from_local_index(localIndex, x, y, scale)
end
end
--- @param localIndex integer
--- @param prevX integer
--- @param prevY integer
--- @param prevScale integer
--- @param x integer
--- @param y integer
--- @param scale integer
---@param localIndex integer
---@param prevX integer
---@param prevY integer
---@param prevScale integer
---@param x integer
---@param y integer
---@param scale integer
function render_life_icon_from_local_index_interpolated(localIndex, prevX, prevY, prevScale, x, y, scale)
if localIndex == nil then localIndex = 0 end
local lifeIcon = life_icon_from_local_index(localIndex)
@ -357,20 +352,20 @@ function render_life_icon_from_local_index_interpolated(localIndex, prevX, prevY
end
end
--- @param localIndex integer
--- @param x integer
--- @param y integer
--- @param scale integer
---@param localIndex integer
---@param x integer
---@param y integer
---@param scale integer
function render_star_icon_from_local_index(localIndex, x, y, scale)
if localIndex == nil then localIndex = 0 end
local starIcon = star_icon_from_local_index(localIndex)
djui_hud_render_texture(starIcon, x, y, scale / (starIcon.width * MATH_DIVIDE_16), scale / (starIcon.height * MATH_DIVIDE_16))
end
--- @param localIndex integer
--- @param x integer
--- @param y integer
--- @param scale integer
---@param localIndex integer
---@param x integer
---@param y integer
---@param scale integer
function render_star_icon_from_local_index_interpolated(localIndex, prevX, prevY, prevScale, x, y, scale)
if localIndex == nil then localIndex = 0 end
local starIcon = star_icon_from_local_index(localIndex)
@ -378,7 +373,7 @@ function render_star_icon_from_local_index_interpolated(localIndex, prevX, prevY
end
-- Health Meter --
local TEXT_DEFAULT_METER_PREFIX = "char-select-custom-meter-"
local TEXT_DEFAULT_METER_PREFIX = "char_select_custom_meter_"
local TEX_DEFAULT_METER_LEFT = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."left")
local TEX_DEFAULT_METER_RIGHT = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."right")
local TEX_DEFAULT_METER_PIE1 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie1")
@ -389,7 +384,7 @@ local TEX_DEFAULT_METER_PIE5 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie5
local TEX_DEFAULT_METER_PIE6 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie6")
local TEX_DEFAULT_METER_PIE7 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie7")
local TEX_DEFAULT_METER_PIE8 = get_texture_info(TEXT_DEFAULT_METER_PREFIX.."pie8")
local defaultMeterInfo = {
defaultMeterInfo = {
label = {
left = TEX_DEFAULT_METER_LEFT,
right = TEX_DEFAULT_METER_RIGHT,
@ -406,85 +401,230 @@ local defaultMeterInfo = {
}
}
local TEXT_DEFAULT_COURSE_PREFIX = "char-select-custom-course-"
local TEX_DEFAULT_METER_LEFT = get_texture_info(TEXT_DEFAULT_COURSE_PREFIX.."top")
local TEX_DEFAULT_METER_RIGHT = get_texture_info(TEXT_DEFAULT_COURSE_PREFIX.."bottom")
local TEXT_DEFAULT_COURSE_PREFIX = "char_select_custom_course_"
local TEX_DEFAULT_COURSE_TOP = get_texture_info(TEXT_DEFAULT_COURSE_PREFIX.."top")
local TEX_DEFAULT_COURSE_BOTTOM = get_texture_info(TEXT_DEFAULT_COURSE_PREFIX.."bottom")
local defaultCourseInfo = {
top = TEX_DEFAULT_METER_LEFT,
bottom = TEX_DEFAULT_METER_RIGHT,
top = TEX_DEFAULT_COURSE_TOP,
bottom = TEX_DEFAULT_COURSE_BOTTOM,
}
--- @param localIndex integer
--- @return table
---@param localIndex integer
---@return table
--- This assumes multiple characters will not have the same model,
--- Icons can only be seen by users who have the character avalible to them
function health_meter_from_local_index(localIndex)
if localIndex == nil then localIndex = 0 end
localIndex = localIndex or 0
local p = gCSPlayers[localIndex]
for i = 1, #characterTable do
for i = 0, #characterTable do
local char = characterTable[i]
if char.saveName == p.saveName and char[(p.currAlt and p.currAlt or 1)].healthTexture ~= nil then
return char[(p.currAlt and p.currAlt or 1)].healthTexture
local healthMeter = (char[p.currAlt] and char[p.currAlt].healthMeter) or char[1].healthMeter
if char.saveName == p.saveName and healthMeter ~= nil then
return healthMeter
end
end
return defaultMeterInfo
end
--- @param localIndex integer
--- @param x integer
--- @param y integer
--- @param scaleX integer
--- @param scaleY integer
---@param localIndex integer
---@param health integer
---@param x integer
---@param y integer
---@param scaleX integer
---@param scaleY integer
function render_health_meter_from_local_index(localIndex, health, x, y, scaleX, scaleY)
if localIndex == nil then localIndex = 0 end
local health = math.floor(health*MATH_DIVIDE_HEALTH)
local textureTable = health_meter_from_local_index(localIndex)
local tex = textureTable.label.left
djui_hud_render_texture(tex, x, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
local tex = textureTable.label.right
djui_hud_render_texture(tex, x + 31*scaleX*MATH_DIVIDE_64, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
if health > 0 then
local tex = textureTable.pie[health]
djui_hud_render_texture(tex, x + 15*scaleX*MATH_DIVIDE_64, y + 16*scaleY*MATH_DIVIDE_64, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_32) * MATH_DIVIDE_64)
local color = djui_hud_get_color()
localIndex = localIndex or 0
local meter = health_meter_from_local_index(localIndex)
if type(meter) == "function" then
meter(localIndex, health, x, y, scaleX, scaleY, x, y, scaleX, scaleY)
else
health = health >> 8
local tex = meter.label.left
djui_hud_render_texture(tex, x, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
tex = meter.label.right
djui_hud_render_texture(tex, x + 31*scaleX*MATH_DIVIDE_64, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
if health > 0 then
tex = meter.pie[health]
djui_hud_render_texture(tex, x + 15*scaleX*MATH_DIVIDE_64, y + 16*scaleY*MATH_DIVIDE_64, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_32) * MATH_DIVIDE_64)
end
end
djui_hud_set_color(color.r, color.g, color.b, color.a)
end
---@param localIndex integer
---@param health integer
---@param prevX integer
---@param prevY integer
---@param prevScaleX integer
---@param prevScaleY integer
---@param x integer
---@param y integer
---@param scaleX integer
---@param scaleY integer
function render_health_meter_from_local_index_interpolated(localIndex, health, prevX, prevY, prevScaleX, prevScaleY, x, y, scaleX, scaleY)
local color = djui_hud_get_color()
localIndex = localIndex or 0
local meter = health_meter_from_local_index(localIndex)
if type(meter) == "function" then
meter(localIndex, health, prevX, prevY, prevScaleX, prevScaleY, x, y, scaleX, scaleY)
else
health = health >> 8
local tex = meter.label.left
djui_hud_render_texture_interpolated(tex, prevX, prevY, prevScaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, prevScaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64, x, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
tex = meter.label.right
djui_hud_render_texture_interpolated(tex, prevX + 31*prevScaleX*MATH_DIVIDE_64, prevY, prevScaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, prevScaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64, x + 31*scaleX*MATH_DIVIDE_64, y, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_64) * MATH_DIVIDE_64)
if health > 0 then
tex = meter.pie[health]
djui_hud_render_texture_interpolated(tex, prevX + 15*prevScaleX*MATH_DIVIDE_64, prevY + 16*scaleY*MATH_DIVIDE_64, prevScaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, prevScaleY / (tex.height * MATH_DIVIDE_32) * MATH_DIVIDE_64, x + 15*scaleX*MATH_DIVIDE_64, y + 16*scaleY*MATH_DIVIDE_64, scaleX / (tex.width * MATH_DIVIDE_32) * MATH_DIVIDE_64, scaleY / (tex.height * MATH_DIVIDE_32) * MATH_DIVIDE_64)
end
end
djui_hud_set_color(color.r, color.g, color.b, color.a)
end
-- Force Default Health function to render CS' Meter
_G.hud_render_power_meter = function(health, x, y, scaleX, scaleY)
render_health_meter_from_local_index(0, health, x, y, scaleX, scaleY)
end
_G.hud_render_power_meter_interpolated = function(health, prevX, prevY, prevScaleX, prevScaleY, x, y, scaleX, scaleY)
render_health_meter_from_local_index_interpolated(0, health, prevX, prevY, prevScaleX, prevScaleY, x, y, scaleX, scaleY)
end
-- Health Meter Code
local POWER_METER_HIDDEN = 0
local POWER_METER_EMPHASIZED = 1
local POWER_METER_DEEMPHASIZING = 2
local POWER_METER_HIDING = 3
local POWER_METER_VISIBLE = 4
local sPowerMeterHUD = {
animation = POWER_METER_HIDDEN,
x = 140,
y = 166,
unused = 1.0,
};
local sPowerMeterVisibleTimer = 0
local sPowerMeterStoredHealth = 0
local function animate_power_meter_emphasized()
local hudDisplayFlags = hud_get_value(HUD_DISPLAY_FLAGS)
if ((hudDisplayFlags & HUD_DISPLAY_FLAG_EMPHASIZE_POWER) == 0) then
if (sPowerMeterVisibleTimer == 45.0) then
sPowerMeterHUD.animation = POWER_METER_DEEMPHASIZING;
end
else
sPowerMeterVisibleTimer = 0;
end
end
local pieTextureNames = {
"one_segments",
"two_segments",
"three_segments",
"four_segments",
"five_segments",
"six_segments",
"seven_segments",
"full",
}
local function render_hud_health()
if currChar == 1 and characterTable[1].currAlt == 1 then
texture_override_reset("texture_power_meter_left_side")
texture_override_reset("texture_power_meter_right_side")
for i = 1, 8 do
texture_override_reset("texture_power_meter_" .. pieTextureNames[i])
end
return
-- Power meter animation called after emphasized mode.
-- Moves power meter y pos speed until it's at 200 to be visible.
local function animate_power_meter_deemphasizing()
local speed = 5;
if (sPowerMeterHUD.y >= 181) then
speed = 3;
end
local textureTable = characterTable[currChar][characterTable[currChar].currAlt].healthTexture
if textureTable then -- sets health HUD to custom textures
if textureTable.label.left and textureTable.label.right then -- if left and right label textures exist. BOTH have to exist to be set!
texture_override_set("texture_power_meter_left_side", textureTable.label.left)
texture_override_set("texture_power_meter_right_side", textureTable.label.right)
end
for i = 1, 8 do
texture_override_set("texture_power_meter_" .. pieTextureNames[i], (textureTable.pie and textureTable.pie[i]) and textureTable.pie[i] or defaultMeterInfo.pie[i])
if (sPowerMeterHUD.y >= 191) then
speed = 2;
end
if (sPowerMeterHUD.y >= 196) then
speed = 1;
end
sPowerMeterHUD.y = sPowerMeterHUD.y + speed;
if (sPowerMeterHUD.y >= 201) then
sPowerMeterHUD.y = 200;
sPowerMeterPrevY = 200;
sPowerMeterHUD.animation = POWER_METER_VISIBLE;
end
end
-- Power meter animation called when there's 8 health segments.
-- Moves power meter y pos quickly until it's at 301 to be hidden.
local function animate_power_meter_hiding()
sPowerMeterHUD.y = sPowerMeterHUD.y + 20;
if (sPowerMeterHUD.y >= 301) then
sPowerMeterHUD.animation = POWER_METER_HIDDEN;
sPowerMeterVisibleTimer = 0;
end
end
-- Handles power meter actions depending of the health segments values.
local function handle_power_meter_actions(numHealthWedges)
local gPlayerCameraState = gMarioStates[0].statusForCamera
-- Show power meter if health is not full, less than 8
if (numHealthWedges < 8 and sPowerMeterStoredHealth == 8 and sPowerMeterHUD.animation == POWER_METER_HIDDEN) then
sPowerMeterHUD.animation = POWER_METER_EMPHASIZED;
sPowerMeterHUD.y = 166;
sPowerMeterPrevY = 166;
end
-- Show power meter if health is full, has 8
if (numHealthWedges == 8 and sPowerMeterStoredHealth == 7) then
sPowerMeterVisibleTimer = 0;
end
-- After health is full, hide power meter
if (numHealthWedges == 8 and sPowerMeterVisibleTimer > 45.0) then
sPowerMeterHUD.animation = POWER_METER_HIDING;
end
-- Update to match health value
sPowerMeterStoredHealth = numHealthWedges;
-- If Mario is swimming, keep power meter visible
if (gPlayerCameraState.action & ACT_FLAG_SWIMMING ~= 0) then
if (sPowerMeterHUD.animation == POWER_METER_HIDDEN
or sPowerMeterHUD.animation == POWER_METER_EMPHASIZED) then
sPowerMeterHUD.animation = POWER_METER_DEEMPHASIZING;
sPowerMeterHUD.y = 166;
sPowerMeterPrevY = 166;
end
else -- resets the health HUD
texture_override_set("texture_power_meter_left_side", defaultMeterInfo.label.left)
texture_override_set("texture_power_meter_right_side", defaultMeterInfo.label.right)
for i = 1, 8 do
texture_override_set("texture_power_meter_" .. pieTextureNames[i], defaultMeterInfo.pie[i])
end
end
sPowerMeterVisibleTimer = 0;
end
end
-- Renders the power meter that shows when Mario is in underwater
-- or has taken damage and has less than 8 health segments.
-- And calls a power meter animation function depending of the value defined.
local function render_hud_power_meter()
local shownHealthWedges = hud_get_value(HUD_DISPLAY_WEDGES);
sPowerMeterHUD.x = djui_hud_get_screen_width()*0.5 - 51
if (sPowerMeterHUD.animation ~= POWER_METER_HIDING) then
handle_power_meter_actions(shownHealthWedges);
end
if (sPowerMeterHUD.animation == POWER_METER_HIDDEN) then
return;
end
local powerMeterPrevY = sPowerMeterHUD.y
local anim = sPowerMeterHUD.animation
if anim == POWER_METER_EMPHASIZED then
animate_power_meter_emphasized();
elseif anim == POWER_METER_DEEMPHASIZING then
animate_power_meter_deemphasizing();
elseif anim == POWER_METER_HIDING then
animate_power_meter_hiding();
end
--render_dl_power_meter(shownHealthWedges);
render_health_meter_from_local_index_interpolated(0, gMarioStates[0].health, sPowerMeterHUD.x, 208 - powerMeterPrevY, 64, 64, sPowerMeterHUD.x, 208 - sPowerMeterHUD.y, 64, 64)
sPowerMeterVisibleTimer = sPowerMeterVisibleTimer + 1;
end
local function render_hud_act_select_course()
@ -506,8 +646,6 @@ local function render_hud_act_select_course()
end
local function render_hud_mario_lives()
og_hud_set_value(HUD_DISPLAY_FLAGS, og_hud_get_value(HUD_DISPLAY_FLAGS) & ~HUD_DISPLAY_FLAG_LIVES)
if (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_LIVES) == 0 then return end
local x = 22
@ -518,8 +656,6 @@ local function render_hud_mario_lives()
end
local function render_hud_stars()
og_hud_set_value(HUD_DISPLAY_FLAGS, og_hud_get_value(HUD_DISPLAY_FLAGS) & ~HUD_DISPLAY_FLAG_STAR_COUNT)
if (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_STAR_COUNT) == 0 then return end
if hud_get_flash ~= nil then
-- prevent star count from flashing outside of castle
@ -530,11 +666,11 @@ local function render_hud_stars()
end
end
local x = math_ceil(djui_hud_get_screen_width() - 76)
local x = math.ceil(djui_hud_get_screen_width() - 76)
if x % 2 ~= 0 then
x = x - 1
end
local y = math_ceil(240 - 209 - 16)
local y = math.ceil(240 - 209 - 16)
local showX = 0
local hudDisplayStars = hud_get_value(HUD_DISPLAY_STARS)
@ -548,15 +684,11 @@ local function render_hud_stars()
end
local function render_hud_camera_status()
if not HUD_DISPLAY_CAMERA_STATUS then return end
og_hud_set_value(HUD_DISPLAY_FLAGS, og_hud_get_value(HUD_DISPLAY_FLAGS) & ~HUD_DISPLAY_FLAG_CAMERA)
if (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_CAMERA) == 0 then return end
if (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_CAMERA) == 0 or (hud_get_value(HUD_DISPLAY_FLAGS) & HUD_DISPLAY_FLAG_CAMERA_AND_POWER) == 0 then return end
local x = djui_hud_get_screen_width() - 54
local y = 205
local cameraHudStatus = hud_get_value(HUD_DISPLAY_CAMERA_STATUS)
local cameraHudStatus = hud_get_value(HUD_DISPLAY_CAMERA_STATUS) -- doesn't show the status of freecam because it's currently bugged when we hide the hud camera -- TODO: keep nagging the coopers to "fix `hud_get_value(HUD_DISPLAY_CAMERA_STATUS)` when using freecam and hiding the hud camera" :trollface:
if cameraHudStatus == CAM_STATUS_NONE then return end
@ -585,24 +717,86 @@ local function render_hud_camera_status()
end
-- Act Select Hud --
local STAR_SELECTOR_NOT_SELECTED = 0
local STAR_SELECTOR_SELECTED = 1
local STAR_SELECTOR_100_COINS = 2
local sVisibleStars = 0
local function render_act_select_hud()
local course = gNetworkPlayers[0].currCourseNum
if gServerSettings.enablePlayersInLevelDisplay == 0 or course == 0 or obj_get_first_with_behavior_id(id_bhvActSelector) == nil or act_select_hud_is_hidden(ACT_SELECT_HUD_PLAYERS_IN_LEVEL) then return end
if course == 0 or not obj_get_first_with_behavior_id(id_bhvActSelector) then return end
local starBhvCount = count_objects_with_behavior(get_behavior_from_id(id_bhvActSelectorStarType))
local sVisibleStars = starBhvCount < 6 and starBhvCount or 6
if sVisibleStars == 0 then
local starObj = obj_get_first_with_behavior_id(id_bhvActSelectorStarType)
while starObj do
if starObj.oStarSelectorType ~= STAR_SELECTOR_100_COINS then
sVisibleStars = sVisibleStars + 1
end
starObj = obj_get_next_with_same_behavior_id(starObj)
end
end
for a = 1, sVisibleStars do
local x = (139 - sVisibleStars * 17 + a * 34) + (djui_hud_get_screen_width() / 2) - 160 + 0.5
for j = 1, MAX_PLAYERS - 1 do -- 0 is not needed due to the due to the fact that you are never supposed to see yourself in the act
for j = 1, MAX_PLAYERS - 1 do -- 0 is not needed, you're never supposed to see yourself in act select
local np = gNetworkPlayers[j]
if np and np.connected and np.currCourseNum == course and np.currActNum == a then
djui_hud_render_rect(x - 4, 17, 16, 16)
render_life_icon_from_local_index(j, x - 4, 17, 1)
break
end
end
end
local selectedStar = obj_get_first_with_behavior_id(id_bhvActSelectorStarType)
local starsList = {}
while selectedStar do
table.insert(starsList, selectedStar)
selectedStar = obj_get_next_with_same_behavior_id(selectedStar)
end
if (sVisibleStars > 0) then
local playersInAct = 0
local sSelectedActIndex = 0
for i = 1, #starsList do
local curStar = starsList[i]
if curStar.oStarSelectorType == STAR_SELECTOR_SELECTED then
sSelectedActIndex = i - 1
end
end
local gCurrCourseNum = gNetworkPlayers[0].currCourseNum
for j = 1, MAX_PLAYERS - 1 do
local np = gNetworkPlayers[j]
if not (np or np.connected) then goto continue end
if (np.currCourseNum ~= gCurrCourseNum) then goto continue end
if (np.currActNum ~= sSelectedActIndex + 1) then goto continue end
playersInAct = playersInAct + 1
::continue::
end
if (playersInAct > 0) then
local message = ""
if (playersInAct == 1) then
message = message .. " Join "
else
message = message .. string.format("%d Players", playersInAct)
end
djui_hud_set_font(FONT_NORMAL)
djui_hud_set_color(100, 100, 100, 255)
local textScale = .5
local textWidth = djui_hud_measure_text(message) * textScale
local xPos = ((sSelectedActIndex + 1) * 34 - sVisibleStars * 17 + 139 - (textWidth / 2) + 4) + (djui_hud_get_screen_width() / 2) - 160 + 2
local yPos = -1
if message:find("Players") then
message = string.format("%d Player", playersInAct)
end
djui_hud_print_text(message, xPos, yPos, textScale) -- Not fully accurate because the font in act select is stretched in a way unachievable with normal fonts, will revisit in the future
end
end
end
---@param table table
@ -670,10 +864,11 @@ function render_playerlist_and_modlist()
local entryY = y + 88 + ((entryHeight + 4) * (i-1))
djui_hud_render_rect(entryX, entryY, entryWidth, entryHeight)
local capColor = network_player_get_override_palette_color(np, CAP)
playerNameColor = {
r = 127 + network_player_get_override_palette_color_channel(np, CAP, 0) / 2,
g = 127 + network_player_get_override_palette_color_channel(np, CAP, 1) / 2,
b = 127 + network_player_get_override_palette_color_channel(np, CAP, 2) / 2
r = 127 + capColor.r/2,
g = 127 + capColor.g/2,
b = 127 + capColor.b/2
}
djui_hud_set_color(255, 255, 255, 255)
@ -733,7 +928,6 @@ function render_playerlist_and_modlist()
end
-- Yes the ending stuffs is hardcoded, no there's not much of a better way to do it
local DIALOG_ENDING_REPLACE_1 = "$CHARNAME!"
local DIALOG_ENDING_REPLACE_2 = "Thank you $CHARNAME!"
local DIALOG_ENDING_REPLACE_3 = "...for $CHARNAME..."
@ -751,7 +945,7 @@ local function render_hud_ending_dialog()
local width = djui_hud_get_screen_width()
local charName = characterTable[currChar][characterTable[currChar].currAlt].name
local charName = characterTable[currChar].nickname
local string = ""
local startTime = 0
local endTime = 0
@ -792,47 +986,184 @@ local function render_hud_ending_dialog()
end
end
-- Nametags Powermeter Hud --
local nametagsActionBlacklist = {
[ACT_START_CROUCHING] = true,
[ACT_CROUCHING] = true,
[ACT_STOP_CROUCHING] = true,
[ACT_START_CRAWLING] = true,
[ACT_CRAWLING] = true,
[ACT_STOP_CRAWLING] = true,
[ACT_IN_CANNON] = true,
[ACT_DISAPPEARED] = true,
}
local FADE_SCALE = 4.0
--- @class StateExtras
--- @field public prevPos Vec3f
--- @field public prevScale number
--- @field public inited boolean
--- @type StateExtras[]
local sStateExtras = {}
for i = 0, MAX_PLAYERS - 1 do
sStateExtras[i] = {}
local _ENV = setmetatable(sStateExtras[i], { __index = _G })
prevPos = gVec3fZero()
prevScale = 0.0
inited = false
end
local function render_nametag_powermeter()
local sGlobalTimer = get_global_timer()
for i = 1, MAX_PLAYERS - 1 do
local m = gMarioStates[i]
if is_player_active(m) == 0 then goto continue end
local np = gNetworkPlayers[i]
if not np.currAreaSyncValid then goto continue end
if nametagsActionBlacklist[m.action] then goto continue end
if (m.marioBodyState.mirrorMario or m.marioBodyState.updateHeadPosTime ~= sGlobalTimer) then goto continue end
local pos = gVec3fZero()
local out = gVec3fZero()
vec3f_copy(pos, m.marioBodyState.headPos)
pos.y = pos.y + 100
if not djui_hud_world_pos_to_screen_pos(pos, out) then
goto continue
end
local scale = -300 / out.z * djui_hud_get_fov_coeff()
out.y = out.y - 16 * scale
local alpha = (math.min(np.fadeOpacity << 3, 255)) * math.clamp(FADE_SCALE - scale, 0.0, 1.0)
local e = sStateExtras[i]
if not e.inited then
vec3f_copy(e.prevPos, out)
e.prevScale = scale
e.inited = true
end
if gNametagsSettings.showHealth then
djui_hud_set_color(255, 255, 255, alpha)
local healthScale = 90 * scale
local prevHealthScale = 90 * e.prevScale
render_health_meter_from_local_index_interpolated(i, m.health,
e.prevPos.x - (prevHealthScale * 0.5), e.prevPos.y - 72 * scale, prevHealthScale, prevHealthScale,
out.x - ( healthScale * 0.5), out.y - 72 * scale, healthScale, healthScale
)
end
vec3f_copy(e.prevPos, out)
e.prevScale = scale
::continue::
end
end
local function nametags_reset()
for i = 0, MAX_PLAYERS - 1 do
sStateExtras[i].inited = false
end
end
local function on_level_init()
nametags_reset()
end
hook_event(HOOK_ON_LEVEL_INIT, on_level_init)
local sServerSettings = gServerSettings
local sNametagsSettings = gNametagsSettings
_G.gServerSettings = {
enablePlayerList = sServerSettings.enablePlayerList,
enablePlayersInLevelDisplay = sServerSettings.enablePlayersInLevelDisplay,
}
_G.gNametagsSettings = {
showHealth = sNametagsSettings.showHealth,
}
local _ServerSettingsMetaTable = {
__index = function (t, k)
return rawget(t, k) or sServerSettings[k]
end,
__newindex = function (_, k, v)
sServerSettings[k] = v
end,
}
local _NametagsSettingsMetaTable = {
__index = function (t, k)
return rawget(t, k) or sNametagsSettings[k]
end,
__newindex = function (_, k, v)
sNametagsSettings[k] = v
end,
}
setmetatable(gServerSettings, _ServerSettingsMetaTable)
setmetatable(gNametagsSettings, _NametagsSettingsMetaTable)
function nametags_settings()
if sNametagsSettings.showHealth then
gNametagsSettings.showHealth = not gNametagsSettings.showHealth
end
sNametagsSettings.showHealth = false
end
hook_event(HOOK_ON_NAMETAGS_RENDER, nametags_settings)
local function on_hud_render_behind()
FONT_USER = djui_menu_get_font()
djui_hud_set_resolution(RESOLUTION_N64)
djui_hud_set_font(FONT_HUD)
render_nametag_powermeter() -- Render before setting the color, it sets its own
djui_hud_set_color(255, 255, 255, 255)
if gNetworkPlayers[0].currActNum == 99 or gMarioStates[0].action == ACT_INTRO_CUTSCENE or hud_is_hidden() then
return
end
if gNetworkPlayers[0].currActNum == 99 or gMarioStates[0].action == ACT_INTRO_CUTSCENE or hud_is_hidden() then return end
if obj_get_first_with_behavior_id(id_bhvActSelector) == nil then
sServerSettings.enablePlayersInLevelDisplay = 0 -- Disables the original playersInLevel Display
local enablePlayersInLevelDisplay = gServerSettings.enablePlayersInLevelDisplay
if not obj_get_first_with_behavior_id(id_bhvActSelector) then
render_hud_mario_lives()
render_hud_stars()
render_hud_camera_status()
render_hud_health()
render_hud_power_meter()
sVisibleStars = 0
else
if enablePlayersInLevelDisplay then
render_act_select_hud()
end
render_hud_act_select_course()
end
end
-- Can't name this charSelect due to o-api.lua overriding it, if I did so, using character select with no packs would make it nil
_G.gServerSettingsCS = {
enablePlayerList = true -- Set to false to disable the playerlist
}
local function on_hud_render()
djui_hud_set_resolution(RESOLUTION_N64)
djui_hud_set_font(FONT_HUD)
djui_hud_set_color(255, 255, 255, 255)
if obj_get_first_with_behavior_id(id_bhvActSelector) ~= nil then
render_act_select_hud()
end
if gNetworkPlayers[0].currActNum == 99 then
render_hud_ending_dialog()
end
gServerSettings.enablePlayerList = false -- Disables the original playerlist and modlist
sServerSettings.enablePlayerList = 0 -- Disables the original playerlist and modlist
local enablePlayerList = gServerSettingsCS.enablePlayerList -- gServerSettings.enablePlayerList but for the character select playerlist
local enablePlayerList = gServerSettings.enablePlayerList
djui_hud_set_resolution(RESOLUTION_DJUI)
if djui_attempting_to_open_playerlist() and enablePlayerList then

File diff suppressed because it is too large Load diff

View file

@ -2,173 +2,245 @@
if incompatibleClient then return 0 end
local function find_character_number(index)
if not startup_init_stall() then return 0 end
if index == nil then index = 0 end
for i = 1, #characterTable do
if characterTable[i].saveName == gCSPlayers[index].saveName then
return i
end
end
return 1
return 0
end
local function is_moveset_restricted()
return gGlobalSyncTable.charSelectRestrictMovesets > 0
end
local function mario_update(m)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_MARIO_UPDATE
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
local returnVar = currMoveset[hook](m)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_MARIO_UPDATE, mario_update)
local function before_mario_update(m)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_BEFORE_MARIO_UPDATE
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
local returnVar = currMoveset[hook](m)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_BEFORE_MARIO_UPDATE, before_mario_update)
local function before_phys_step(m, stepType)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
local function before_phys_step(m, stepType, stepArg)
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_BEFORE_PHYS_STEP
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, stepType)
local returnVar = currMoveset[hook](m, stepType, stepArg)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_BEFORE_PHYS_STEP, before_phys_step)
local function allow_pvp_attack(attacker, victim, int)
if stopMovesets then return end
if is_moveset_restricted() then return end
local hook = HOOK_ALLOW_PVP_ATTACK
local attackerMoveset = characterMovesets[find_character_number(attacker.playerIndex)]
local victimMoveset = characterMovesets[find_character_number(victim.playerIndex)]
local returnVar
if gCSPlayers[attacker.playerIndex].movesetToggle then
if (attackerMoveset ~= nil and attackerMoveset[hook] ~= nil) then
attackerMoveset[hook](attacker, victim, int)
returnVar = attackerMoveset[hook](attacker, victim, int)
if returnVar ~= nil then
return returnVar
end
end
end
if gCSPlayers[victim.playerIndex].movesetToggle then
if (victimMoveset ~= nil and victimMoveset[hook] ~= nil) then
victimMoveset[hook](attacker, victim, int)
returnVar = victimMoveset[hook](attacker, victim, int)
if returnVar ~= nil then
return returnVar
end
end
end
end
hook_event(HOOK_ALLOW_PVP_ATTACK, allow_pvp_attack)
local function on_pvp_attack(attacker, victim, int)
if stopMovesets then return end
if is_moveset_restricted() then return end
local hook = HOOK_ON_PVP_ATTACK
local attackerMoveset = characterMovesets[find_character_number(attacker.playerIndex)]
local victimMoveset = characterMovesets[find_character_number(victim.playerIndex)]
if gCSPlayers[attacker.playerIndex].movesetToggle then
if (attackerMoveset ~= nil and attackerMoveset[hook] ~= nil) then
attackerMoveset[hook](attacker, victim, int)
local returnVar = attackerMoveset[hook](attacker, victim, int)
if returnVar ~= nil then
return returnVar
end
end
end
if gCSPlayers[victim.playerIndex].movesetToggle then
if (victimMoveset ~= nil and victimMoveset[hook] ~= nil) then
victimMoveset[hook](attacker, victim, int)
local returnVar = victimMoveset[hook](attacker, victim, int)
if returnVar ~= nil then
return returnVar
end
end
end
end
hook_event(HOOK_ON_PVP_ATTACK, on_pvp_attack)
local function on_interact(m, o, intType, intValue)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_ON_INTERACT
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, o, intType, intValue)
local returnVar = currMoveset[hook](m, o, intType, intValue)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_INTERACT, on_interact)
local function allow_interact(m, o, intType)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_ALLOW_INTERACT
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, o, intType)
local returnVar = currMoveset[hook](m, o, intType)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ALLOW_INTERACT, allow_interact)
local function on_set_mario_action(m)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_ON_SET_MARIO_ACTION
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
local returnVar = currMoveset[hook](m)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_SET_MARIO_ACTION, on_set_mario_action)
local function before_set_mario_action(m, nextAct)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
local function before_set_mario_action(m, nextAct, actionArg)
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_BEFORE_SET_MARIO_ACTION
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, nextAct)
local returnVar = currMoveset[hook](m, nextAct, actionArg)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_BEFORE_SET_MARIO_ACTION, before_set_mario_action)
local function on_death(m)
if stopMovesets or not gCSPlayers[m.playerIndex].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[m.playerIndex].movesetToggle then return end
local hook = HOOK_ON_DEATH
local currMoveset = characterMovesets[find_character_number(m.playerIndex)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m)
local returnVar = currMoveset[hook](m)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_DEATH, on_death)
local function hud_render()
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_HUD_RENDER
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
local returnVar = currMoveset[hook]()
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_HUD_RENDER, hud_render)
local function hud_render_behind()
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_HUD_RENDER_BEHIND
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
local returnVar = currMoveset[hook]()
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_HUD_RENDER_BEHIND, hud_render_behind)
local function level_init()
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
local function level_init(type, levelNum, areaIdx, nodeId, arg)
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_LEVEL_INIT
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
local returnVar = currMoveset[hook](type, levelNum, areaIdx, nodeId, arg)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_LEVEL_INIT, level_init)
local function sync_valid()
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_SYNC_VALID
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook]()
local returnVar = currMoveset[hook]()
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_SYNC_VALID, sync_valid)
local function object_render(obj)
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ON_OBJECT_RENDER
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](obj)
local returnVar = currMoveset[hook](obj)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ON_OBJECT_RENDER, object_render)
local function allow_water_action(m, water)
if stopMovesets or not gCSPlayers[0].movesetToggle then return end
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ALLOW_FORCE_WATER_ACTION
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
return currMoveset[hook](m, water)
local returnVar = currMoveset[hook](m, water)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_ALLOW_FORCE_WATER_ACTION, allow_water_action)
hook_event(HOOK_ALLOW_FORCE_WATER_ACTION, allow_water_action)
local function mario_override_floor_class(m, floorClass)
if is_moveset_restricted() or not gCSPlayers[0].movesetToggle then return end
local hook = HOOK_ALLOW_FORCE_WATER_ACTION
local currMoveset = characterMovesets[find_character_number(0)]
if currMoveset == nil or currMoveset[hook] == nil then return end
local returnVar = currMoveset[hook](m, floorClass)
if returnVar ~= nil then
return returnVar
end
end
hook_event(HOOK_MARIO_OVERRIDE_FLOOR_CLASS, mario_override_floor_class)

View file

@ -0,0 +1,391 @@
if incompatibleClient then return 0 end
-- localize functions to improve performance - z-palettes.lua
local network_player_set_override_palette_color,network_player_reset_override_palette = network_player_set_override_palette_color,network_player_reset_override_palette
characterColorPresets = {
[E_MODEL_MARIO] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0x00, g = 0x00, b = 0xff },
[SHIRT] = { r = 0xff, g = 0x00, b = 0x00 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x72, g = 0x1c, b = 0x0e },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0xff, g = 0x00, b = 0x00 },
[EMBLEM] = { r = 0xff, g = 0x00, b = 0x00 },
},
{
name = "New Game +",
[PANTS] = { r = 0x19, g = 0x4b, b = 0xa3 },
[SHIRT] = { r = 0xff, g = 0x30, b = 0x33 },
[GLOVES] = { r = 0xdd, g = 0xdd, b = 0xdd },
[SHOES] = { r = 0x51, g = 0x28, b = 0x00 },
[HAIR] = { r = 0x58, g = 0x09, b = 0x00 },
[SKIN] = { r = 0xff, g = 0xaf, b = 0x8c },
[CAP] = { r = 0xff, g = 0x30, b = 0x33 },
[EMBLEM] = { r = 0xff, g = 0x30, b = 0x33 },
},
{
name = "Fire Flower",
[PANTS] = { r = 0xb2, g = 0x28, b = 0x18 },
[SHIRT] = { r = 0xff, g = 0xe0, b = 0xe0 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x72, g = 0x1c, b = 0x0e },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0xff, g = 0xe0, b = 0xe0 },
[EMBLEM] = { r = 0xff, g = 0x00, b = 0x00 },
},
{
name = "Burgundy",
[PANTS] = { r = 0x23, g = 0x11, b = 0x03 },
[SHIRT] = { r = 0x68, g = 0x0A, b = 0x17 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x68, g = 0x0A, b = 0x17 },
[EMBLEM] = { r = 0x68, g = 0x0A, b = 0x17 },
},
{
name = "Raspberry",
[PANTS] = { r = 0xD6, g = 0x35, b = 0x4D },
[SHIRT] = { r = 0x3B, g = 0x8F, b = 0xF7 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x3B, g = 0x8F, b = 0xF7 },
[EMBLEM] = { r = 0x3B, g = 0x8F, b = 0xF7 },
},
},
[E_MODEL_LUIGI] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0x00, g = 0x00, b = 0xff },
[SHIRT] = { r = 0x00, g = 0xff, b = 0x00 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x72, g = 0x1c, b = 0x0e },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x00, g = 0xff, b = 0x00 },
[EMBLEM] = { r = 0x00, g = 0xff, b = 0x00 },
},
{
name = "Mint",
[PANTS] = { r = 0x53, g = 0x39, b = 0x3D },
[SHIRT] = { r = 0x95, g = 0xD0, b = 0x8F },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x95, g = 0xD0, b = 0x8F },
[EMBLEM] = { r = 0x95, g = 0xD0, b = 0x8F },
},
{
name = "Cold Crevase",
[PANTS] = { r = 0xD4, g = 0xDF, b = 0xE7 },
[SHIRT] = { r = 0x51, g = 0xA9, b = 0x9C },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x6B, g = 0x41, b = 0x00 },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0xD4, g = 0xDF, b = 0xE7 },
[EMBLEM] = { r = 0x51, g = 0xA9, b = 0x9C },
},
{
name = "Greedy",
[PANTS] = { r = 0x00, g = 0x48, b = 0x8a },
[SHIRT] = { r = 0xf7, g = 0xaf, b = 0x25 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0xc0, g = 0x21, b = 0x00 },
[HAIR] = { r = 0x00, g = 0x00, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x00, g = 0x48, b = 0x8a },
[EMBLEM] = { r = 0x00, g = 0x00, b = 0x00 },
},
{
name = "Kindness",
[PANTS] = { r = 0xff, g = 0x44, b = 0xff },
[SHIRT] = { r = 0x93, g = 0x00, b = 0x90 },
[GLOVES] = { r = 0xff, g = 0x99, b = 0xff },
[SHOES] = { r = 0xaa, g = 0x2c, b = 0x66 },
[HAIR] = { r = 0xf3, g = 0x65, b = 0xda },
[SKIN] = { r = 0xc8, g = 0x6b, b = 0x9d },
[CAP] = { r = 0xef, g = 0x2b, b = 0xea },
[EMBLEM] = { r = 0xef, g = 0x2b, b = 0xea },
},
},
[E_MODEL_TOAD_PLAYER] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0xff, g = 0xff, b = 0xff },
[SHIRT] = { r = 0x4c, g = 0x2c, b = 0xd3 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x68, g = 0x40, b = 0x1b },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xd5, b = 0xa1 },
[CAP] = { r = 0xff, g = 0x00, b = 0x00 },
[EMBLEM] = { r = 0xff, g = 0x00, b = 0x00 },
},
{
name = "Bucken Berry",
[PANTS] = { r = 0xff, g = 0xff, b = 0xff },
[SHIRT] = { r = 0x00, g = 0x00, b = 0xff },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x68, g = 0x40, b = 0x1b },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xd5, b = 0xa1 },
[CAP] = { r = 0x00, g = 0x00, b = 0xff },
[EMBLEM] = { r = 0x00, g = 0x00, b = 0xff },
},
{
name = "Ala Gold",
[PANTS] = { r = 0xff, g = 0xff, b = 0xff },
[SHIRT] = { r = 0xff, g = 0xff, b = 0x00 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x68, g = 0x40, b = 0x1b },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xd5, b = 0xa1 },
[CAP] = { r = 0xff, g = 0xff, b = 0x00 },
[EMBLEM] = { r = 0xff, g = 0xff, b = 0x00 },
},
{
name = "Jet Black",
[PANTS] = { r = 0x1A, g = 0x1A, b = 0x1A },
[SHIRT] = { r = 0x2C, g = 0x2C, b = 0x2C },
[GLOVES] = { r = 0x64, g = 0x64, b = 0x64 },
[SHOES] = { r = 0x64, g = 0x64, b = 0x64 },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x1A, g = 0x1A, b = 0x1A },
[EMBLEM] = { r = 0x1A, g = 0x1A, b = 0x1A },
},
{
name = "Hot Pink",
[PANTS] = { r = 0x34, g = 0x16, b = 0x0D },
[SHIRT] = { r = 0xC1, g = 0x2C, b = 0x72 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0xC1, g = 0x2C, b = 0x72 },
[EMBLEM] = { r = 0xC1, g = 0x2C, b = 0x72 },
},
{
name = "Goomba",
[PANTS] = { r = 0xC6, g = 0xB1, b = 0x32 },
[SHIRT] = { r = 0x95, g = 0x43, b = 0x01 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x95, g = 0x43, b = 0x01 },
[EMBLEM] = { r = 0x95, g = 0x43, b = 0x01 },
},
},
[E_MODEL_WALUIGI] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0x16, g = 0x16, b = 0x27 },
[SHIRT] = { r = 0x61, g = 0x26, b = 0xb0 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0xfe, g = 0x76, b = 0x00 },
[HAIR] = { r = 0x73, g = 0x53, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x61, g = 0x26, b = 0xb0 },
[EMBLEM] = { r = 0xff, g = 0xde, b = 0x00 },
},
{
name = "Cobalt",
[PANTS] = { r = 0x3F, g = 0x3F, b = 0xFF },
[SHIRT] = { r = 0x0A, g = 0x0A, b = 0x28 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x39, g = 0x0E, b = 0x07 },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x3F, g = 0x3F, b = 0xFF },
[EMBLEM] = { r = 0x3F, g = 0x3F, b = 0xFF },
},
{
name = "Clover",
[PANTS] = { r = 0x14, g = 0x19, b = 0x14 },
[SHIRT] = { r = 0x4C, g = 0x5F, b = 0x20 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x4C, g = 0x5F, b = 0x20 },
[EMBLEM] = { r = 0x4C, g = 0x5F, b = 0x20 },
},
{
name = "Blueberry Pie",
[PANTS] = { r = 0xEB, g = 0x8A, b = 0x4B },
[SHIRT] = { r = 0x10, g = 0x1B, b = 0x2E },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x10, g = 0x1B, b = 0x2E },
[EMBLEM] = { r = 0x10, g = 0x1B, b = 0x2E },
},
{
name = "Tennis Loser",
[PANTS] = { r = 0x16, g = 0x16, b = 0x27 },
[SHIRT] = { r = 0x5A, g = 0x39, b = 0x21 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x5A, g = 0x00, b = 0xCE },
[HAIR] = { r = 0x29, g = 0x10, b = 0x00 },
[SKIN] = { r = 0xE7, g = 0xB5, b = 0x94 },
[CAP] = { r = 0x5A, g = 0x39, b = 0x21 },
[EMBLEM] = { r = 0xFF, g = 0xDE, b = 0x00 },
},
{
name = "Sealed Away",
[PANTS] = { r = 0x00, g = 0x98, b = 0x00 },
[SHIRT] = { r = 0x47, g = 0xc5, b = 0xff },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x72, g = 0x1c, b = 0x0e },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x47, g = 0xc5, b = 0xff },
[EMBLEM] = { r = 0xff, g = 0xde, b = 0x00 },
},
},
[E_MODEL_WARIO] = {
currPalette = 1,
{
name = "Default",
[PANTS] = { r = 0x7f, g = 0x20, b = 0x7a },
[SHIRT] = { r = 0xff, g = 0xbd, b = 0x00 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0x0e, g = 0x72, b = 0x1c },
[HAIR] = { r = 0x73, g = 0x53, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0xff, g = 0xbd, b = 0x00 },
[EMBLEM] = { r = 0x00, g = 0x00, b = 0xff },
},
{
name = "Ruby",
[PANTS] = { r = 0xE1, g = 0x05, b = 0x31 },
[SHIRT] = { r = 0x28, g = 0x0A, b = 0x0A },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x39, g = 0x0E, b = 0x07 },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0xE1, g = 0x05, b = 0x31 },
[EMBLEM] = { r = 0xE1, g = 0x05, b = 0x31 },
},
{
name = "Eggplant",
[PANTS] = { r = 0xE6, g = 0xE3, b = 0xFF },
[SHIRT] = { r = 0x37, g = 0x32, b = 0x42 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x37, g = 0x32, b = 0x42 },
[EMBLEM] = { r = 0x37, g = 0x32, b = 0x42 },
},
{
name = "Battlements",
[PANTS] = { r = 0xF7, g = 0xC2, b = 0x45 },
[SHIRT] = { r = 0x55, g = 0x92, b = 0xB2 },
[GLOVES] = { r = 0xFF, g = 0xFF, b = 0xFF },
[SHOES] = { r = 0x72, g = 0x1C, b = 0x0E },
[HAIR] = { r = 0x73, g = 0x06, b = 0x00 },
[SKIN] = { r = 0xFE, g = 0xC1, b = 0x79 },
[CAP] = { r = 0x55, g = 0x92, b = 0xB2 },
[EMBLEM] = { r = 0x55, g = 0x92, b = 0xB2 },
},
{
name = "Cotten Candy",
[PANTS] = { r = 0x69, g = 0xa1, b = 0xff },
[SHIRT] = { r = 0xff, g = 0x7d, b = 0x89 },
[GLOVES] = { r = 0xff, g = 0xff, b = 0xff },
[SHOES] = { r = 0xb9, g = 0x48, b = 0xff },
[HAIR] = { r = 0x73, g = 0x53, b = 0x00 },
[SKIN] = { r = 0xfe, g = 0xc1, b = 0x79 },
[CAP] = { r = 0x69, g = 0xa1, b = 0xff },
[EMBLEM] = { r = 0xb9, g = 0x48, b = 0xff },
},
}
}
local paletteLoop = #characterColorPresets[E_MODEL_MARIO][1]
local function network_player_set_full_override_palette(networkPlayer, colorTable)
if colorTable == nil then return end
for i = 0, paletteLoop do
network_player_set_override_palette_color(networkPlayer, i, colorTable[i])
end
end
---@param np NetworkPlayer
function update_preset_palette(np)
local p = gCSPlayers[np.localIndex]
local modelId = p.modelId
if np.connected and gCSPlayers[0].presetPalette > 0 and characterColorPresets[modelId] and gGlobalSyncTable.charSelectRestrictPalettes == 0 then
network_player_set_full_override_palette(np, characterColorPresets[modelId][p.presetPalette])
end
end
local prevPresetPalette = {}
local prevModel = {}
local function mario_update(m)
local np = gNetworkPlayers[m.playerIndex]
local p = gCSPlayers[m.playerIndex]
if not startup_init_stall() then return end
if m.playerIndex == 0 and not p.isUpdating then
p.isUpdating = true
for i = 1, MAX_PLAYERS - 1 do
prevPresetPalette[i] = gCSPlayers[i].presetPalette
prevModel[i] = gCSPlayers[i].modelId
end
end
if m.playerIndex == 0 then
if gGlobalSyncTable.charSelectRestrictPalettes == 0 then
gCSPlayers[0].presetPalette = characterColorPresets[gCSPlayers[0].modelId] ~= nil and characterColorPresets[gCSPlayers[0].modelId].currPalette or 0
end
end
if np.connected then
if p.presetPalette == nil or characterColorPresets[p.modelId] == nil then
if p.presetPalette == nil then
prevPresetPalette[m.playerIndex] = 0
end
p.presetPalette = 0
end
if (prevPresetPalette[m.playerIndex] ~= p.presetPalette or prevModel[m.playerIndex] ~= p.modelId) then
if p.presetPalette == 0 or not characterColorPresets[p.modelId] then
network_player_reset_override_palette(np)
end
end
prevPresetPalette[m.playerIndex] = p.presetPalette
prevModel[m.playerIndex] = p.modelId
if p.presetPalette > 0 and characterColorPresets[p.modelId] and gGlobalSyncTable.charSelectRestrictPalettes == 0 then
network_player_set_full_override_palette(np, characterColorPresets[p.modelId][p.presetPalette])
end
else
if p.isUpdating then
p.isUpdating = false
end
end
end
hook_event(HOOK_MARIO_UPDATE, mario_update)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more