mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-01-10 08:44:22 +00:00
Multi-return from C and other autogen changes (#1044)
* Allow multiple returns in autogen functions * condense function member names * This shouldn't be here * Relocate these functions LVT_FIELD shouldn't be there yet * multi-return part 2: most functions are usable now --------- Co-authored-by: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com>
This commit is contained in:
parent
a9495561f4
commit
0dcb4f030a
57 changed files with 2226 additions and 1792 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -12300,6 +12363,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 +12391,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 +12495,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
|
||||
|
|
|
|||
|
|
@ -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);`
|
||||
|
|
|
|||
|
|
@ -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
|
|
@ -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);`
|
||||
|
|
@ -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 |
|
||||
|
|
|
|||
|
|
@ -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,7 @@ 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:](#)
|
||||
|
||||
|
|
@ -1649,13 +1649,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 +2046,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 +2132,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 +2153,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 +2174,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 +2195,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 +2216,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 +2297,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 +2318,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 +2331,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 +2346,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 +2359,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 +2430,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 +2469,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 +2492,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 +2513,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 +2534,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 +2555,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 +2576,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 +2643,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 +2651,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 +2666,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 +2674,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 +2689,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 +2699,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 +2714,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 +2724,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 +2739,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 +2747,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 +2762,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 +2770,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 +2785,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 +2795,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 +2810,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 +2820,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 +2835,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 +2844,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 +2882,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 +2891,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 +3104,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 +3112,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 +3127,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 +3136,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 +3151,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 +3539,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 +3547,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 +4626,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 +4702,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 +4820,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 +4859,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 +4904,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 +4913,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 +4928,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 +4937,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 +4981,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 +4989,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);`
|
||||
|
|
|
|||
|
|
@ -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 />
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
@ -2188,8 +2193,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 +2746,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 +2754,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 +2769,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 +2790,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 +2798,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);`
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void le_set_tone_mapping(enum LEToneMapping toneMapping) {
|
|||
sToneMapping = toneMapping;
|
||||
}
|
||||
|
||||
void le_get_ambient_color(OUT Color out) {
|
||||
void le_get_ambient_color(VEC_OUT Color out) {
|
||||
color_copy(out, gLEAmbientColor);
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ bool le_light_exists(s16 id) {
|
|||
return sLights[id].added;
|
||||
}
|
||||
|
||||
void le_get_light_pos(s16 id, OUT Vec3f out) {
|
||||
void le_get_light_pos(s16 id, VEC_OUT Vec3f out) {
|
||||
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
|
||||
|
||||
struct LELight* light = &sLights[id];
|
||||
|
|
@ -300,7 +300,7 @@ void le_set_light_pos(s16 id, f32 x, f32 y, f32 z) {
|
|||
light->posZ = z;
|
||||
}
|
||||
|
||||
void le_get_light_color(s16 id, OUT Color out) {
|
||||
void le_get_light_color(s16 id, VEC_OUT Color out) {
|
||||
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
|
||||
|
||||
struct LELight* light = &sLights[id];
|
||||
|
|
|
|||
|
|
@ -29,17 +29,17 @@ enum LEMode le_get_mode(void);
|
|||
/* |description|Sets the lighting engine's tone mapping mode to `toneMapping`|descriptionEnd|*/
|
||||
void le_set_tone_mapping(enum LEToneMapping toneMapping);
|
||||
/* |description|Outputs the lighting engine's ambient color to `out`|descriptionEnd| */
|
||||
void le_get_ambient_color(OUT Color out);
|
||||
void le_get_ambient_color(VEC_OUT Color out);
|
||||
/* |description|Sets the lighting engine ambient color|descriptionEnd| */
|
||||
void le_set_ambient_color(u8 r, u8 g, u8 b);
|
||||
|
||||
void le_calculate_vertex_lighting(Vtx_t* v, Vec3f pos, OUT Color out);
|
||||
void le_calculate_vertex_lighting(Vtx_t* v, Vec3f pos, VEC_OUT Color out);
|
||||
/* |description|Calculates the lighting with `lightIntensityScalar` at a position and outputs the color in `out`|descriptionEnd|*/
|
||||
void le_calculate_lighting_color(Vec3f pos, OUT Color out, f32 lightIntensityScalar);
|
||||
void le_calculate_lighting_color(Vec3f pos, VEC_OUT Color out, f32 lightIntensityScalar);
|
||||
/* |description|Calculates the lighting with `lightIntensityScalar` at a position and with a normal and outputs the color in `out`|descriptionEnd|*/
|
||||
void le_calculate_lighting_color_with_normal(Vec3f pos, Vec3f normal, OUT Color out, f32 lightIntensityScalar);
|
||||
void le_calculate_lighting_color_with_normal(Vec3f pos, Vec3f normal, VEC_OUT Color out, f32 lightIntensityScalar);
|
||||
/* |description|Calculates the lighting direction from a position and outputs the result in `out`|descriptionEnd| */
|
||||
void le_calculate_lighting_dir(Vec3f pos, OUT Vec3f out);
|
||||
void le_calculate_lighting_dir(Vec3f pos, VEC_OUT Vec3f out);
|
||||
/* |description|Adds a lighting engine point light at `x`, `y`, `z` with color `r`, `g`, `b` and `radius` with `intensity`|descriptionEnd| */
|
||||
s16 le_add_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius, f32 intensity);
|
||||
/* |description|Removes a lighting engine point light corresponding to `id`|descriptionEnd| */
|
||||
|
|
@ -49,11 +49,11 @@ s16 le_get_light_count(void);
|
|||
/* |description|Checks if a lighting engine point light corresponding to `id` exists|descriptionEnd| */
|
||||
bool le_light_exists(s16 id);
|
||||
/* |description|Outputs a lighting engine point light's position to `out`|descriptionEnd| */
|
||||
void le_get_light_pos(s16 id, OUT Vec3f out);
|
||||
void le_get_light_pos(s16 id, VEC_OUT Vec3f out);
|
||||
/* |description|Sets a lighting engine point light's position to `x`, `y`, `z`|descriptionEnd| */
|
||||
void le_set_light_pos(s16 id, f32 x, f32 y, f32 z);
|
||||
/* |description|Outputs a lighting engine point light's color to `out`|descriptionEnd| */
|
||||
void le_get_light_color(s16 id, OUT Color out);
|
||||
void le_get_light_color(s16 id, VEC_OUT Color out);
|
||||
/* |description|Sets a lighting engine point light's color to `r`, `g`, `b`|descriptionEnd| */
|
||||
void le_set_light_color(s16 id, u8 r, u8 g, u8 b);
|
||||
/* |description|Gets a lighting engine point light's `radius`|descriptionEnd| */
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ OPTIMIZE_O3 f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec) {
|
|||
* [0, 0, 0, 0, 1, 2, ... n-1, n, n, n, n]
|
||||
* TODO: verify the classification of the spline / figure out how polynomials were computed
|
||||
*/
|
||||
OPTIMIZE_O3 void spline_get_weights(struct MarioState* m, OUT Vec4f result, f32 t, UNUSED s32 c) {
|
||||
OPTIMIZE_O3 void spline_get_weights(struct MarioState* m, VEC_OUT Vec4f result, f32 t, UNUSED s32 c) {
|
||||
if (!m) { return; }
|
||||
f32 tinv = 1 - t;
|
||||
f32 tinv2 = tinv * tinv;
|
||||
|
|
@ -195,7 +195,7 @@ OPTIMIZE_O3 void anim_spline_init(struct MarioState* m, Vec4s *keyFrames) {
|
|||
* anim_spline_init should be called before polling for vectors.
|
||||
* Returns TRUE when the last point is reached, FALSE otherwise.
|
||||
*/
|
||||
OPTIMIZE_O3 s32 anim_spline_poll(struct MarioState* m, OUT Vec3f result) {
|
||||
OPTIMIZE_O3 s32 anim_spline_poll(struct MarioState* m, VEC_OUT Vec3f result) {
|
||||
if (!m) { return 0; }
|
||||
Vec4f weights = { 0 };
|
||||
s32 i;
|
||||
|
|
@ -269,7 +269,7 @@ Vec3f gVec3fOne = { 1.0f, 1.0f, 1.0f };
|
|||
* Returns a vector rotated around the z axis, then the x axis, then the y
|
||||
* axis.
|
||||
*/
|
||||
OPTIMIZE_O3 Vec3fp vec3f_rotate_zxy(OUT Vec3f dest, Vec3s rotate) {
|
||||
OPTIMIZE_O3 Vec3fp vec3f_rotate_zxy(VEC_OUT Vec3f dest, Vec3s rotate) {
|
||||
Vec3f v = { dest[0], dest[1], dest[2] };
|
||||
|
||||
f32 sx = sins(rotate[0]);
|
||||
|
|
@ -294,7 +294,7 @@ OPTIMIZE_O3 Vec3fp vec3f_rotate_zxy(OUT Vec3f dest, Vec3s rotate) {
|
|||
|
||||
// Rodrigues' formula
|
||||
// dest = v * cos(r) + (n x v) * sin(r) + n * (n . v) * (1 - cos(r))
|
||||
OPTIMIZE_O3 Vec3fp vec3f_rotate_around_n(OUT Vec3f dest, Vec3f v, Vec3f n, s16 r) {
|
||||
OPTIMIZE_O3 Vec3fp vec3f_rotate_around_n(VEC_OUT Vec3f dest, Vec3f v, Vec3f n, s16 r) {
|
||||
Vec3f nvCross;
|
||||
vec3f_cross(nvCross, n, v);
|
||||
f32 nvDot = vec3f_dot(n, v);
|
||||
|
|
@ -306,7 +306,7 @@ OPTIMIZE_O3 Vec3fp vec3f_rotate_around_n(OUT Vec3f dest, Vec3f v, Vec3f n, s16 r
|
|||
return dest;
|
||||
}
|
||||
|
||||
OPTIMIZE_O3 Vec3fp vec3f_project(OUT Vec3f dest, Vec3f v, Vec3f onto) {
|
||||
OPTIMIZE_O3 Vec3fp vec3f_project(VEC_OUT Vec3f dest, Vec3f v, Vec3f onto) {
|
||||
f32 numerator = vec3f_dot(v, onto);
|
||||
f32 denominator = vec3f_dot(onto, onto);
|
||||
if (denominator == 0) {
|
||||
|
|
@ -318,7 +318,7 @@ OPTIMIZE_O3 Vec3fp vec3f_project(OUT Vec3f dest, Vec3f v, Vec3f onto) {
|
|||
return dest;
|
||||
}
|
||||
|
||||
OPTIMIZE_O3 Vec3fp vec3f_transform(OUT Vec3f dest, Vec3f v, Vec3f translation, Vec3s rotation, Vec3f scale) {
|
||||
OPTIMIZE_O3 Vec3fp vec3f_transform(VEC_OUT Vec3f dest, Vec3f v, Vec3f translation, Vec3s rotation, Vec3f scale) {
|
||||
vec3f_copy(dest, v);
|
||||
|
||||
// scale
|
||||
|
|
@ -340,7 +340,7 @@ OPTIMIZE_O3 Vec3fp vec3f_transform(OUT Vec3f dest, Vec3f v, Vec3f translation, V
|
|||
* of that vector, as well as the yaw and pitch angles.
|
||||
* Basically it converts the direction to spherical coordinates.
|
||||
*/
|
||||
OPTIMIZE_O3 void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw) {
|
||||
OPTIMIZE_O3 void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, RET f32 *dist, RET s16 *pitch, RET s16 *yaw) {
|
||||
f32 x = to[0] - from[0];
|
||||
f32 y = to[1] - from[1];
|
||||
f32 z = to[2] - from[2];
|
||||
|
|
@ -354,7 +354,7 @@ OPTIMIZE_O3 void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *
|
|||
* Construct the 'to' point which is distance 'dist' away from the 'from' position,
|
||||
* and has the angles pitch and yaw.
|
||||
*/
|
||||
OPTIMIZE_O3 void vec3f_set_dist_and_angle(Vec3f from, OUT Vec3f to, f32 dist, s16 pitch, s16 yaw) {
|
||||
OPTIMIZE_O3 void vec3f_set_dist_and_angle(Vec3f from, VEC_OUT Vec3f to, f32 dist, s16 pitch, s16 yaw) {
|
||||
to[0] = from[0] + dist * coss(pitch) * sins(yaw);
|
||||
to[1] = from[1] + dist * sins(pitch);
|
||||
to[2] = from[2] + dist * coss(pitch) * coss(yaw);
|
||||
|
|
@ -365,7 +365,7 @@ OPTIMIZE_O3 void vec3f_set_dist_and_angle(Vec3f from, OUT Vec3f to, f32 dist, s1
|
|||
* It is similar to vec3f_cross, but it calculates the vectors (c-b) and (b-a)
|
||||
* at the same time.
|
||||
*/
|
||||
OPTIMIZE_O3 Vec3fp find_vector_perpendicular_to_plane(OUT Vec3f dest, Vec3f a, Vec3f b, Vec3f c) {
|
||||
OPTIMIZE_O3 Vec3fp find_vector_perpendicular_to_plane(VEC_OUT Vec3f dest, Vec3f a, Vec3f b, Vec3f c) {
|
||||
dest[0] = (b[1] - a[1]) * (c[2] - b[2]) - (c[1] - b[1]) * (b[2] - a[2]);
|
||||
dest[1] = (b[2] - a[2]) * (c[0] - b[0]) - (c[2] - b[2]) * (b[0] - a[0]);
|
||||
dest[2] = (b[0] - a[0]) * (c[1] - b[1]) - (c[0] - b[0]) * (b[1] - a[1]);
|
||||
|
|
@ -412,7 +412,7 @@ Mat4 gMat4Zero = {
|
|||
* at the position 'to'. The up-vector is assumed to be (0, 1, 0), but the 'roll'
|
||||
* angle allows a bank rotation of the camera.
|
||||
*/
|
||||
OPTIMIZE_O3 void mtxf_lookat(OUT Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
|
||||
OPTIMIZE_O3 void mtxf_lookat(VEC_OUT Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
|
||||
Vec3f forward, right, up;
|
||||
f32 sinRoll, cosRoll;
|
||||
f32 dx, dz, xzDist;
|
||||
|
|
@ -480,7 +480,7 @@ OPTIMIZE_O3 void mtxf_lookat(OUT Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
|
|||
* Build a matrix that rotates around the z axis, then the x axis, then the y
|
||||
* axis, and then translates.
|
||||
*/
|
||||
OPTIMIZE_O3 void mtxf_rotate_zxy_and_translate(OUT Mat4 dest, Vec3f translate, Vec3s rotate) {
|
||||
OPTIMIZE_O3 void mtxf_rotate_zxy_and_translate(VEC_OUT Mat4 dest, Vec3f translate, Vec3s rotate) {
|
||||
f32 sx = sins(rotate[0]);
|
||||
f32 cx = coss(rotate[0]);
|
||||
|
||||
|
|
@ -513,7 +513,7 @@ OPTIMIZE_O3 void mtxf_rotate_zxy_and_translate(OUT Mat4 dest, Vec3f translate, V
|
|||
* Build a matrix that rotates around the x axis, then the y axis, then the z
|
||||
* axis, and then translates.
|
||||
*/
|
||||
OPTIMIZE_O3 void mtxf_rotate_xyz_and_translate(OUT Mat4 dest, Vec3f b, Vec3s c) {
|
||||
OPTIMIZE_O3 void mtxf_rotate_xyz_and_translate(VEC_OUT Mat4 dest, Vec3f b, Vec3s c) {
|
||||
f32 sx = sins(c[0]);
|
||||
f32 cx = coss(c[0]);
|
||||
|
||||
|
|
@ -550,7 +550,7 @@ OPTIMIZE_O3 void mtxf_rotate_xyz_and_translate(OUT Mat4 dest, Vec3f b, Vec3s c)
|
|||
* 'position' is the position of the object in the world
|
||||
* 'angle' rotates the object while still facing the camera.
|
||||
*/
|
||||
OPTIMIZE_O3 void mtxf_billboard(OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
|
||||
OPTIMIZE_O3 void mtxf_billboard(VEC_OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
|
||||
dest[0][0] = coss(angle);
|
||||
dest[0][1] = sins(angle);
|
||||
dest[0][2] = 0;
|
||||
|
|
@ -573,7 +573,7 @@ OPTIMIZE_O3 void mtxf_billboard(OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 ang
|
|||
}
|
||||
|
||||
// straight up mtxf_billboard but minus the dest[1][n] lines. transform for cylindrical billboards
|
||||
OPTIMIZE_O3 void mtxf_cylboard(OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
|
||||
OPTIMIZE_O3 void mtxf_cylboard(VEC_OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
|
||||
dest[0][0] = coss(angle);
|
||||
dest[0][1] = sins(angle);
|
||||
dest[0][2] = 0;
|
||||
|
|
@ -602,7 +602,7 @@ OPTIMIZE_O3 void mtxf_cylboard(OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 angl
|
|||
* 'yaw' is the angle which it should face
|
||||
* 'pos' is the object's position in the world
|
||||
*/
|
||||
OPTIMIZE_O3 void mtxf_align_terrain_normal(OUT Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
|
||||
OPTIMIZE_O3 void mtxf_align_terrain_normal(VEC_OUT Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
|
||||
Vec3f lateralDir;
|
||||
Vec3f leftDir;
|
||||
Vec3f forwardDir;
|
||||
|
|
@ -645,7 +645,7 @@ OPTIMIZE_O3 void mtxf_align_terrain_normal(OUT Mat4 dest, Vec3f upDir, Vec3f pos
|
|||
* 'pos' is the object's position in the world
|
||||
* 'radius' is the distance from each triangle vertex to the center
|
||||
*/
|
||||
OPTIMIZE_O3 void mtxf_align_terrain_triangle(OUT Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
|
||||
OPTIMIZE_O3 void mtxf_align_terrain_triangle(VEC_OUT Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
|
||||
struct Surface *sp74;
|
||||
Vec3f point0;
|
||||
Vec3f point1;
|
||||
|
|
@ -716,7 +716,7 @@ OPTIMIZE_O3 void mtxf_align_terrain_triangle(OUT Mat4 mtx, Vec3f pos, s16 yaw, f
|
|||
* The resulting matrix represents first applying transformation b and
|
||||
* then a.
|
||||
*/
|
||||
OPTIMIZE_O3 void mtxf_mul(OUT Mat4 dest, Mat4 a, Mat4 b) {
|
||||
OPTIMIZE_O3 void mtxf_mul(VEC_OUT Mat4 dest, Mat4 a, Mat4 b) {
|
||||
Mat4 tmp;
|
||||
for (s32 i = 0; i < 4; i++) {
|
||||
for (s32 j = 0; j < 4; j++) {
|
||||
|
|
@ -734,7 +734,7 @@ OPTIMIZE_O3 void mtxf_mul(OUT Mat4 dest, Mat4 a, Mat4 b) {
|
|||
* to the point. Note that the bottom row is assumed to be [0, 0, 0, 1], which is
|
||||
* true for transformation matrices if the translation has a w component of 1.
|
||||
*/
|
||||
OPTIMIZE_O3 Vec3sp mtxf_mul_vec3s(Mat4 mtx, OUT Vec3s b) {
|
||||
OPTIMIZE_O3 Vec3sp mtxf_mul_vec3s(Mat4 mtx, VEC_OUT Vec3s b) {
|
||||
f32 x = b[0];
|
||||
f32 y = b[1];
|
||||
f32 z = b[2];
|
||||
|
|
@ -749,7 +749,7 @@ OPTIMIZE_O3 Vec3sp mtxf_mul_vec3s(Mat4 mtx, OUT Vec3s b) {
|
|||
/**
|
||||
* Set 'mtx' to a transformation matrix that rotates around the z axis.
|
||||
*/
|
||||
OPTIMIZE_O3 void mtxf_rotate_xy(OUT Mat4 mtx, s16 angle) {
|
||||
OPTIMIZE_O3 void mtxf_rotate_xy(VEC_OUT Mat4 mtx, s16 angle) {
|
||||
mtxf_identity(mtx);
|
||||
mtx[0][0] = coss(angle);
|
||||
mtx[0][1] = sins(angle);
|
||||
|
|
@ -770,7 +770,7 @@ OPTIMIZE_O3 void mtxf_rotate_xy(OUT Mat4 mtx, s16 angle) {
|
|||
* furthermore, this is currently only used to get the inverse of the camera transform
|
||||
* because that is always orthonormal, the determinant will never be 0, so that check is removed
|
||||
*/
|
||||
OPTIMIZE_O3 void mtxf_inverse(OUT Mat4 dest, Mat4 src) {
|
||||
OPTIMIZE_O3 void mtxf_inverse(VEC_OUT Mat4 dest, Mat4 src) {
|
||||
Mat4 buf;
|
||||
|
||||
// calculating the determinant has been reduced since the check is removed
|
||||
|
|
@ -809,7 +809,7 @@ OPTIMIZE_O3 void mtxf_inverse(OUT Mat4 dest, Mat4 src) {
|
|||
* Compute the inverse of 'src' and put it into 'dest' but it can be a non-affine matrix.
|
||||
* Obtains the inverse via Gauss-Jordan elimination.
|
||||
*/
|
||||
OPTIMIZE_O3 bool mtxf_inverse_non_affine(OUT Mat4 dest, Mat4 src) {
|
||||
OPTIMIZE_O3 bool mtxf_inverse_non_affine(VEC_OUT Mat4 dest, Mat4 src) {
|
||||
// augmented matrix [ src | I ]
|
||||
f32 aug[4][8];
|
||||
for (s32 i = 0; i < 4; i++) {
|
||||
|
|
@ -871,7 +871,7 @@ OPTIMIZE_O3 bool mtxf_inverse_non_affine(OUT Mat4 dest, Mat4 src) {
|
|||
* objMtx back from screen orientation to world orientation, and then subtracting
|
||||
* the camera position.
|
||||
*/
|
||||
OPTIMIZE_O3 Vec3fp get_pos_from_transform_mtx(OUT Vec3f dest, Mat4 objMtx, Mat4 camMtx) {
|
||||
OPTIMIZE_O3 Vec3fp get_pos_from_transform_mtx(VEC_OUT Vec3f dest, Mat4 objMtx, Mat4 camMtx) {
|
||||
f32 camX = camMtx[3][0] * camMtx[0][0] + camMtx[3][1] * camMtx[0][1] + camMtx[3][2] * camMtx[0][2];
|
||||
f32 camY = camMtx[3][0] * camMtx[1][0] + camMtx[3][1] * camMtx[1][1] + camMtx[3][2] * camMtx[1][2];
|
||||
f32 camZ = camMtx[3][0] * camMtx[2][0] + camMtx[3][1] * camMtx[2][1] + camMtx[3][2] * camMtx[2][2];
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ OPTIMIZE_O3 f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec);
|
|||
/* |description|
|
||||
Computes spline interpolation weights for a given parameter `t` and stores these weights in `result`. This is used in spline-based animations to find intermediate positions between keyframes
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void spline_get_weights(struct MarioState* m, OUT Vec4f result, f32 t, UNUSED s32 c);
|
||||
OPTIMIZE_O3 void spline_get_weights(struct MarioState* m, VEC_OUT Vec4f result, f32 t, UNUSED s32 c);
|
||||
|
||||
/* |description|
|
||||
Initializes a spline-based animation for the `MarioState` structure `m` using the provided array of 3D signed-integer vectors `keyFrames`. This sets up the animation so that it can be advanced by polling
|
||||
|
|
@ -147,7 +147,7 @@ OPTIMIZE_O3 void anim_spline_init(struct MarioState* m, Vec4s *keyFrames);
|
|||
/* |description|
|
||||
Advances the spline-based animation associated with `m` and stores the current interpolated position in `result`. It returns the animation's status, allowing the caller to determine if the animation is ongoing or has completed
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 s32 anim_spline_poll(struct MarioState* m, OUT Vec3f result);
|
||||
OPTIMIZE_O3 s32 anim_spline_poll(struct MarioState* m, VEC_OUT Vec3f result);
|
||||
|
||||
///////////
|
||||
// Vec2f //
|
||||
|
|
@ -176,37 +176,37 @@ OPTIMIZE_O3 s32 anim_spline_poll(struct MarioState* m, OUT Vec3f result);
|
|||
/* |description|
|
||||
Rotates the 3D floating-point vector `v` by the angles specified in the 3D signed-integer vector `rotate`, applying the rotations in the order Z, then X, then Y. The rotated vector replaces `v`
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 Vec3fp vec3f_rotate_zxy(OUT Vec3f v, Vec3s rotate);
|
||||
OPTIMIZE_O3 Vec3fp vec3f_rotate_zxy(VEC_OUT Vec3f v, Vec3s rotate);
|
||||
|
||||
/* |description|
|
||||
Rotates the 3D floating-point vector `v` around the vector `n`, given a rotation `r` (in sm64 angle units), and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 Vec3fp vec3f_rotate_around_n(OUT Vec3f dest, Vec3f v, Vec3f n, s16 r);
|
||||
OPTIMIZE_O3 Vec3fp vec3f_rotate_around_n(VEC_OUT Vec3f dest, Vec3f v, Vec3f n, s16 r);
|
||||
|
||||
/* |description|
|
||||
Projects the 3D floating-point vector `v` onto another 3D floating-point vector `onto`. The resulting projection, stored in `dest`, represents how much of `v` lies along the direction of `onto`
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 Vec3fp vec3f_project(OUT Vec3f dest, Vec3f v, Vec3f onto);
|
||||
OPTIMIZE_O3 Vec3fp vec3f_project(VEC_OUT Vec3f dest, Vec3f v, Vec3f onto);
|
||||
|
||||
/* |description|
|
||||
Scales the 3D floating-point vector `v` by the vector `scale`, then rotates it by the rotation vector `rotation`, and finally translates it by the vector `translation`. The resulting vector is stored in `dest`
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 Vec3fp vec3f_transform(OUT Vec3f dest, Vec3f v, Vec3f translation, Vec3s rotation, Vec3f scale);
|
||||
OPTIMIZE_O3 Vec3fp vec3f_transform(VEC_OUT Vec3f dest, Vec3f v, Vec3f translation, Vec3s rotation, Vec3f scale);
|
||||
|
||||
/* |description|
|
||||
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`
|
||||
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
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw);
|
||||
OPTIMIZE_O3 void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, RET f32 *dist, RET s16 *pitch, RET s16 *yaw);
|
||||
|
||||
/* |description|
|
||||
Positions the point `to` at a given `dist`, `pitch`, and `yaw` relative to the point `from`. This can be used to place objects around a reference point at specific angles and distances
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void vec3f_set_dist_and_angle(Vec3f from, OUT Vec3f to, f32 dist, s16 pitch, s16 yaw);
|
||||
OPTIMIZE_O3 void vec3f_set_dist_and_angle(Vec3f from, VEC_OUT Vec3f to, f32 dist, s16 pitch, s16 yaw);
|
||||
|
||||
/* |description|
|
||||
Determines a vector that is perpendicular (normal) to the plane defined by three given 3D floating-point points `a`, `b`, and `c`. The resulting perpendicular vector is stored in `dest`
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 Vec3fp find_vector_perpendicular_to_plane(OUT Vec3f dest, Vec3f a, Vec3f b, Vec3f c);
|
||||
OPTIMIZE_O3 Vec3fp find_vector_perpendicular_to_plane(VEC_OUT Vec3f dest, Vec3f a, Vec3f b, Vec3f c);
|
||||
|
||||
///////////
|
||||
// Vec3i //
|
||||
|
|
@ -229,67 +229,67 @@ OPTIMIZE_O3 Vec3fp find_vector_perpendicular_to_plane(OUT Vec3f dest, Vec3f a, V
|
|||
/* |description|
|
||||
Adjusts the 4x4 floating-point matrix `mtx` so that it represents a viewing transformation looking from the point `from` toward the point `to`, with a given roll angle. This creates a view matrix oriented toward `to`
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_lookat(OUT Mat4 mtx, Vec3f from, Vec3f to, s16 roll);
|
||||
OPTIMIZE_O3 void mtxf_lookat(VEC_OUT Mat4 mtx, Vec3f from, Vec3f to, s16 roll);
|
||||
|
||||
/* |description|
|
||||
Rotates `dest` according to the angles in `rotate` using ZXY order, and then translates it by the 3D floating-point vector `translate`. This effectively positions and orients `dest` in 3D space
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_rotate_zxy_and_translate(OUT Mat4 dest, Vec3f translate, Vec3s rotate);
|
||||
OPTIMIZE_O3 void mtxf_rotate_zxy_and_translate(VEC_OUT Mat4 dest, Vec3f translate, Vec3s rotate);
|
||||
|
||||
/* |description|
|
||||
Rotates `dest` using angles in XYZ order, and then translates it by the 3D floating-point vector `b` and applies the rotations described by `c`. This sets up `dest` with a specific orientation and position in space
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_rotate_xyz_and_translate(OUT Mat4 dest, Vec3f b, Vec3s c);
|
||||
OPTIMIZE_O3 void mtxf_rotate_xyz_and_translate(VEC_OUT Mat4 dest, Vec3f b, Vec3s c);
|
||||
|
||||
/* |description|
|
||||
Transforms a 4x4 floating-point matrix `mtx` into a "billboard" oriented toward the camera or a given direction. The billboard is placed at `position` and rotated by `angle`. This is useful for objects that should always face the viewer
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_billboard(OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);
|
||||
OPTIMIZE_O3 void mtxf_billboard(VEC_OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);
|
||||
|
||||
/* |description|
|
||||
Creates a "cylindrical billboard" transformation from the 4x4 matrix `mtx` placed at `position` with a given `angle`. Unlike a full billboard, this might allow rotation around one axis while still facing the viewer on others
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_cylboard(OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);
|
||||
OPTIMIZE_O3 void mtxf_cylboard(VEC_OUT Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);
|
||||
|
||||
/* |description|
|
||||
Aligns `dest` so that it fits the orientation of a terrain surface defined by its normal vector `upDir`. The transformation is positioned at `pos` and oriented with a given `yaw`. This is often used to make objects sit naturally on uneven ground
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_align_terrain_normal(OUT Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw);
|
||||
OPTIMIZE_O3 void mtxf_align_terrain_normal(VEC_OUT Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw);
|
||||
|
||||
/* |description|
|
||||
Aligns `mtx` to fit onto a terrain triangle at `pos`, applying a given `yaw` and scaling by `radius`. This helps position objects so they match the orientation of the terrain's surface
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_align_terrain_triangle(OUT Mat4 mtx, Vec3f pos, s16 yaw, f32 radius);
|
||||
OPTIMIZE_O3 void mtxf_align_terrain_triangle(VEC_OUT Mat4 mtx, Vec3f pos, s16 yaw, f32 radius);
|
||||
|
||||
/* |description|
|
||||
Multiplies two 4x4 floating-point matrices `a` and `b` (in that order), storing the product in `dest`. This can be used for combining multiple transformations into one
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_mul(OUT Mat4 dest, Mat4 a, Mat4 b);
|
||||
OPTIMIZE_O3 void mtxf_mul(VEC_OUT Mat4 dest, Mat4 a, Mat4 b);
|
||||
|
||||
/* |description|
|
||||
Multiplies the 3D signed-integer vector `b` with the 4x4 floating-point matrix `mtx`, which applies the transformation to the point
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 Vec3sp mtxf_mul_vec3s(Mat4 mtx, OUT Vec3s b);
|
||||
OPTIMIZE_O3 Vec3sp mtxf_mul_vec3s(Mat4 mtx, VEC_OUT Vec3s b);
|
||||
|
||||
/* |description|
|
||||
Rotates the matrix `mtx` in the XY plane by the given `angle`. Rotating in the XY plane typically means pivoting around the Z axis
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_rotate_xy(OUT Mat4 mtx, s16 angle);
|
||||
OPTIMIZE_O3 void mtxf_rotate_xy(VEC_OUT Mat4 mtx, s16 angle);
|
||||
|
||||
/* |description|
|
||||
Inverts the 4x4 floating-point matrix `src` and stores the inverse in `dest`. Applying the inverse transformation undoes whatever `src` did, returning points back to their original coordinate space. The `src` matrix *must* be affine!
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 void mtxf_inverse(OUT Mat4 dest, Mat4 src);
|
||||
OPTIMIZE_O3 void mtxf_inverse(VEC_OUT Mat4 dest, Mat4 src);
|
||||
|
||||
/* |description|
|
||||
Inverts the 4x4 floating-point matrix `src` and stores the inverse in `dest`. Applying the inverse transformation undoes whatever `src` did, returning points back to their original coordinate space. Returns `false` if the inversion failed.
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 bool mtxf_inverse_non_affine(OUT Mat4 dest, Mat4 src);
|
||||
OPTIMIZE_O3 bool mtxf_inverse_non_affine(VEC_OUT Mat4 dest, Mat4 src);
|
||||
|
||||
/* |description|
|
||||
Extracts the position (translation component) from the transformation matrix `objMtx` relative to the coordinate system defined by `camMtx` and stores that 3D position in `dest`. This can be used to get the object's coordinates in camera space
|
||||
|descriptionEnd| */
|
||||
OPTIMIZE_O3 Vec3fp get_pos_from_transform_mtx(OUT Vec3f dest, Mat4 objMtx, Mat4 camMtx);
|
||||
OPTIMIZE_O3 Vec3fp get_pos_from_transform_mtx(VEC_OUT Vec3f dest, Mat4 objMtx, Mat4 camMtx);
|
||||
|
||||
#endif // MATH_UTIL_H
|
||||
|
||||
|
|
|
|||
|
|
@ -14,28 +14,28 @@ optimizations and bug reports.
|
|||
Sets the 4x4 floating-point matrix `mtx` to all zeros.
|
||||
Unless you really need this-It's reccomended to use mtxf_identity instead.
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 void mtxf_zero(OUT Mat4 mtx) {
|
||||
INLINE OPTIMIZE_O3 void mtxf_zero(VEC_OUT Mat4 mtx) {
|
||||
memset(mtx, 0, sizeof(Mat4));
|
||||
}
|
||||
|
||||
/* |description|
|
||||
Copies the 4x4 floating-point matrix `src` into `dest`. After this operation, `dest` contains the same matrix values as `src`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 void mtxf_copy(OUT Mat4 dest, Mat4 src) {
|
||||
INLINE OPTIMIZE_O3 void mtxf_copy(VEC_OUT Mat4 dest, Mat4 src) {
|
||||
memcpy(dest, src, sizeof(Mat4));
|
||||
}
|
||||
|
||||
/* |description|
|
||||
Sets the 4x4 floating-point matrix `mtx` to the identity matrix. The identity matrix leaves points unchanged when they are transformed by it which is useful for matrix math
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 void mtxf_identity(OUT Mat4 mtx) {
|
||||
INLINE OPTIMIZE_O3 void mtxf_identity(VEC_OUT Mat4 mtx) {
|
||||
mtxf_copy(mtx, gMat4Identity);
|
||||
}
|
||||
|
||||
/* |description|
|
||||
Sets the 4x4 floating-point matrix `dest` to the translation matrix decribed by the 3D floating-point vector `b`. This matrix is used to shift any transformed point by `b`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 void mtxf_translate(OUT Mat4 dest, Vec3f b) {
|
||||
INLINE OPTIMIZE_O3 void mtxf_translate(VEC_OUT Mat4 dest, Vec3f b) {
|
||||
mtxf_identity(dest);
|
||||
vec3f_copy(dest[3], b);
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ INLINE OPTIMIZE_O3 void mtxf_translate(OUT Mat4 dest, Vec3f b) {
|
|||
/* |description|
|
||||
Scales the 4x4 floating-point matrix `mtx` by the scaling factors found in the 3D floating-point vector `s`, and stores the result in `dest`. This enlarges or shrinks objects in 3D space
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 void mtxf_scale_vec3f(OUT Mat4 dest, Mat4 mtx, Vec3f s) {
|
||||
INLINE OPTIMIZE_O3 void mtxf_scale_vec3f(VEC_OUT Mat4 dest, Mat4 mtx, Vec3f s) {
|
||||
mtxf_copy(dest, mtx);
|
||||
vec3f_mul(dest[0], s[0]);
|
||||
vec3f_mul(dest[1], s[1]);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/* |description|
|
||||
Sets the components of the 2D {{desc}} vector `v` to 0
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_zero(OUT Vec2{{suffix}} v) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_zero(VEC_OUT Vec2{{suffix}} v) {
|
||||
memset(v, 0, sizeof(Vec2{{suffix}}));
|
||||
return v;
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_zero(OUT Vec2{{suffix}} v) {
|
|||
/* |description|
|
||||
Copies the contents of a 2D {{desc}} vector (`src`) into another 2D {{desc}} vector (`dest`)
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_copy(OUT Vec2{{suffix}} dest, Vec2{{suffix}} src) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_copy(VEC_OUT Vec2{{suffix}} dest, Vec2{{suffix}} src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
return dest;
|
||||
|
|
@ -20,7 +20,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_copy(OUT Vec2{{suffix}} dest,
|
|||
/* |description|
|
||||
Sets the values of the 2D {{desc}} vector `dest` to the given x and y values
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_set(OUT Vec2{{suffix}} dest, {{type}} x, {{type}} y) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_set(VEC_OUT Vec2{{suffix}} dest, {{type}} x, {{type}} y) {
|
||||
dest[0] = x;
|
||||
dest[1] = y;
|
||||
return dest;
|
||||
|
|
@ -29,7 +29,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_set(OUT Vec2{{suffix}} dest, {
|
|||
/* |description|
|
||||
Adds the components of the 2D {{desc}} vector `a` to `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_add(OUT Vec2{{suffix}} dest, Vec2{{suffix}} a) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_add(VEC_OUT Vec2{{suffix}} dest, Vec2{{suffix}} a) {
|
||||
dest[0] += a[0];
|
||||
dest[1] += a[1];
|
||||
return dest;
|
||||
|
|
@ -38,7 +38,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_add(OUT Vec2{{suffix}} dest, V
|
|||
/* |description|
|
||||
Adds the components of two 2D {{desc}} vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_sum(OUT Vec2{{suffix}} dest, Vec2{{suffix}} a, Vec2{{suffix}} b) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_sum(VEC_OUT Vec2{{suffix}} dest, Vec2{{suffix}} a, Vec2{{suffix}} b) {
|
||||
dest[0] = a[0] + b[0];
|
||||
dest[1] = a[1] + b[1];
|
||||
return dest;
|
||||
|
|
@ -47,7 +47,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_sum(OUT Vec2{{suffix}} dest, V
|
|||
/* |description|
|
||||
Subtracts the components of the 2D {{desc}} vector `a` from `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_sub(OUT Vec2{{suffix}} dest, Vec2{{suffix}} a) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_sub(VEC_OUT Vec2{{suffix}} dest, Vec2{{suffix}} a) {
|
||||
dest[0] -= a[0];
|
||||
dest[1] -= a[1];
|
||||
return dest;
|
||||
|
|
@ -56,7 +56,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_sub(OUT Vec2{{suffix}} dest, V
|
|||
/* |description|
|
||||
Subtracts the components of the 2D {{desc}} vector `b` from the components of `a` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_dif(OUT Vec2{{suffix}} dest, Vec2{{suffix}} a, Vec2{{suffix}} b) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_dif(VEC_OUT Vec2{{suffix}} dest, Vec2{{suffix}} a, Vec2{{suffix}} b) {
|
||||
dest[0] = a[0] - b[0];
|
||||
dest[1] = a[1] - b[1];
|
||||
return dest;
|
||||
|
|
@ -65,7 +65,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_dif(OUT Vec2{{suffix}} dest, V
|
|||
/* |description|
|
||||
Multiplies each component of the 2D {{desc}} vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_mul(OUT Vec2{{suffix}} dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_mul(VEC_OUT Vec2{{suffix}} dest, f32 a) {
|
||||
dest[0] *= a;
|
||||
dest[1] *= a;
|
||||
return dest;
|
||||
|
|
@ -74,7 +74,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_mul(OUT Vec2{{suffix}} dest, f
|
|||
/* |description|
|
||||
Multiplies the components of the 2D {{desc}} vector `dest` with the components of `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_mult(OUT Vec2{{suffix}} dest, Vec2{{suffix}} a) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_mult(VEC_OUT Vec2{{suffix}} dest, Vec2{{suffix}} a) {
|
||||
dest[0] *= a[0];
|
||||
dest[1] *= a[1];
|
||||
return dest;
|
||||
|
|
@ -83,7 +83,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_mult(OUT Vec2{{suffix}} dest,
|
|||
/* |description|
|
||||
Multiplies the components of two 2D {{desc}} vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_prod(OUT Vec2{{suffix}} dest, Vec2{{suffix}} a, Vec2{{suffix}} b) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_prod(VEC_OUT Vec2{{suffix}} dest, Vec2{{suffix}} a, Vec2{{suffix}} b) {
|
||||
dest[0] = a[0] * b[0];
|
||||
dest[1] = a[1] * b[1];
|
||||
return dest;
|
||||
|
|
@ -92,7 +92,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_prod(OUT Vec2{{suffix}} dest,
|
|||
/* |description|
|
||||
Divides each component of the 2D {{desc}} vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_div(OUT Vec2{{suffix}} dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_div(VEC_OUT Vec2{{suffix}} dest, f32 a) {
|
||||
if (a == 0) { return dest; }
|
||||
dest[0] /= a;
|
||||
dest[1] /= a;
|
||||
|
|
@ -109,7 +109,7 @@ INLINE OPTIMIZE_O3 f32 vec2{{suffix}}_length(Vec2{{suffix}} a) {
|
|||
/* |description|
|
||||
Normalizes the 2D {{desc}} vector `v` so that its length (magnitude) becomes 1, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_normalize(OUT Vec2{{suffix}} v) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_normalize(VEC_OUT Vec2{{suffix}} v) {
|
||||
f32 mag = vec2{{suffix}}_length(v);
|
||||
vec2{{suffix}}_div(v, mag);
|
||||
return v;
|
||||
|
|
@ -118,7 +118,7 @@ INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_normalize(OUT Vec2{{suffix}} v
|
|||
/* |description|
|
||||
Sets the length (magnitude) of 2D {{desc}} vector `v`, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_set_magnitude(OUT Vec2{{suffix}} v, f32 mag) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_set_magnitude(VEC_OUT Vec2{{suffix}} v, f32 mag) {
|
||||
vec2{{suffix}}_normalize(v);
|
||||
vec2{{suffix}}_mul(v, mag);
|
||||
return v;
|
||||
|
|
@ -134,7 +134,7 @@ INLINE OPTIMIZE_O3 f32 vec2{{suffix}}_dot(Vec2{{suffix}} a, Vec2{{suffix}} b) {
|
|||
/* |description|
|
||||
Takes two 2D {{desc}} vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, adds the scaled vectors together and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_combine(OUT Vec2{{suffix}} dest, Vec2{{suffix}} vecA, Vec2{{suffix}} vecB, f32 sclA, f32 sclB) {
|
||||
INLINE OPTIMIZE_O3 Vec2{{suffix}}p vec2{{suffix}}_combine(VEC_OUT Vec2{{suffix}} dest, Vec2{{suffix}} vecA, Vec2{{suffix}} vecB, f32 sclA, f32 sclB) {
|
||||
dest[0] = vecA[0] * sclA + vecB[0] * sclB;
|
||||
dest[1] = vecA[1] * sclA + vecB[1] * sclB;
|
||||
return dest;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* |description|
|
||||
Sets the components of the 2D floating-point vector `v` to 0
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_zero(OUT Vec2f v) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_zero(VEC_OUT Vec2f v) {
|
||||
memset(v, 0, sizeof(Vec2f));
|
||||
return v;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_zero(OUT Vec2f v) {
|
|||
/* |description|
|
||||
Copies the contents of a 2D floating-point vector (`src`) into another 2D floating-point vector (`dest`)
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_copy(OUT Vec2f dest, Vec2f src) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_copy(VEC_OUT Vec2f dest, Vec2f src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
return dest;
|
||||
|
|
@ -23,7 +23,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_copy(OUT Vec2f dest, Vec2f src) {
|
|||
/* |description|
|
||||
Sets the values of the 2D floating-point vector `dest` to the given x and y values
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_set(OUT Vec2f dest, f32 x, f32 y) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_set(VEC_OUT Vec2f dest, f32 x, f32 y) {
|
||||
dest[0] = x;
|
||||
dest[1] = y;
|
||||
return dest;
|
||||
|
|
@ -32,7 +32,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_set(OUT Vec2f dest, f32 x, f32 y) {
|
|||
/* |description|
|
||||
Adds the components of the 2D floating-point vector `a` to `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_add(OUT Vec2f dest, Vec2f a) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_add(VEC_OUT Vec2f dest, Vec2f a) {
|
||||
dest[0] += a[0];
|
||||
dest[1] += a[1];
|
||||
return dest;
|
||||
|
|
@ -41,7 +41,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_add(OUT Vec2f dest, Vec2f a) {
|
|||
/* |description|
|
||||
Adds the components of two 2D floating-point vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_sum(OUT Vec2f dest, Vec2f a, Vec2f b) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_sum(VEC_OUT Vec2f dest, Vec2f a, Vec2f b) {
|
||||
dest[0] = a[0] + b[0];
|
||||
dest[1] = a[1] + b[1];
|
||||
return dest;
|
||||
|
|
@ -50,7 +50,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_sum(OUT Vec2f dest, Vec2f a, Vec2f b) {
|
|||
/* |description|
|
||||
Subtracts the components of the 2D floating-point vector `a` from `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_sub(OUT Vec2f dest, Vec2f a) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_sub(VEC_OUT Vec2f dest, Vec2f a) {
|
||||
dest[0] -= a[0];
|
||||
dest[1] -= a[1];
|
||||
return dest;
|
||||
|
|
@ -59,7 +59,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_sub(OUT Vec2f dest, Vec2f a) {
|
|||
/* |description|
|
||||
Subtracts the components of the 2D floating-point vector `b` from the components of `a` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_dif(OUT Vec2f dest, Vec2f a, Vec2f b) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_dif(VEC_OUT Vec2f dest, Vec2f a, Vec2f b) {
|
||||
dest[0] = a[0] - b[0];
|
||||
dest[1] = a[1] - b[1];
|
||||
return dest;
|
||||
|
|
@ -68,7 +68,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_dif(OUT Vec2f dest, Vec2f a, Vec2f b) {
|
|||
/* |description|
|
||||
Multiplies each component of the 2D floating-point vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_mul(OUT Vec2f dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_mul(VEC_OUT Vec2f dest, f32 a) {
|
||||
dest[0] *= a;
|
||||
dest[1] *= a;
|
||||
return dest;
|
||||
|
|
@ -77,7 +77,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_mul(OUT Vec2f dest, f32 a) {
|
|||
/* |description|
|
||||
Multiplies the components of the 2D floating-point vector `dest` with the components of `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_mult(OUT Vec2f dest, Vec2f a) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_mult(VEC_OUT Vec2f dest, Vec2f a) {
|
||||
dest[0] *= a[0];
|
||||
dest[1] *= a[1];
|
||||
return dest;
|
||||
|
|
@ -86,7 +86,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_mult(OUT Vec2f dest, Vec2f a) {
|
|||
/* |description|
|
||||
Multiplies the components of two 2D floating-point vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_prod(OUT Vec2f dest, Vec2f a, Vec2f b) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_prod(VEC_OUT Vec2f dest, Vec2f a, Vec2f b) {
|
||||
dest[0] = a[0] * b[0];
|
||||
dest[1] = a[1] * b[1];
|
||||
return dest;
|
||||
|
|
@ -95,7 +95,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_prod(OUT Vec2f dest, Vec2f a, Vec2f b) {
|
|||
/* |description|
|
||||
Divides each component of the 2D floating-point vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_div(OUT Vec2f dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_div(VEC_OUT Vec2f dest, f32 a) {
|
||||
if (a == 0) { return dest; }
|
||||
dest[0] /= a;
|
||||
dest[1] /= a;
|
||||
|
|
@ -112,7 +112,7 @@ INLINE OPTIMIZE_O3 f32 vec2f_length(Vec2f a) {
|
|||
/* |description|
|
||||
Normalizes the 2D floating-point vector `v` so that its length (magnitude) becomes 1, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_normalize(OUT Vec2f v) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_normalize(VEC_OUT Vec2f v) {
|
||||
f32 mag = vec2f_length(v);
|
||||
vec2f_div(v, mag);
|
||||
return v;
|
||||
|
|
@ -121,7 +121,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2f_normalize(OUT Vec2f v) {
|
|||
/* |description|
|
||||
Sets the length (magnitude) of 2D floating-point vector `v`, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_set_magnitude(OUT Vec2f v, f32 mag) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_set_magnitude(VEC_OUT Vec2f v, f32 mag) {
|
||||
vec2f_normalize(v);
|
||||
vec2f_mul(v, mag);
|
||||
return v;
|
||||
|
|
@ -137,7 +137,7 @@ INLINE OPTIMIZE_O3 f32 vec2f_dot(Vec2f a, Vec2f b) {
|
|||
/* |description|
|
||||
Takes two 2D floating-point vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, adds the scaled vectors together and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_combine(OUT Vec2f dest, Vec2f vecA, Vec2f vecB, f32 sclA, f32 sclB) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2f_combine(VEC_OUT Vec2f dest, Vec2f vecA, Vec2f vecB, f32 sclA, f32 sclB) {
|
||||
dest[0] = vecA[0] * sclA + vecB[0] * sclB;
|
||||
dest[1] = vecA[1] * sclA + vecB[1] * sclB;
|
||||
return dest;
|
||||
|
|
@ -162,7 +162,7 @@ INLINE OPTIMIZE_O3 bool vec2f_is_zero(Vec2f v) {
|
|||
/* |description|
|
||||
Converts a 2D floating-point vector `a` into a 2D integer vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2f_to_vec2i(OUT Vec2i dest, Vec2f a) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2f_to_vec2i(VEC_OUT Vec2i dest, Vec2f a) {
|
||||
dest[0] = a[0] + ((a[0] > 0) ? 0.5f : -0.5f);
|
||||
dest[1] = a[1] + ((a[1] > 0) ? 0.5f : -0.5f);
|
||||
return dest;
|
||||
|
|
@ -171,7 +171,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2f_to_vec2i(OUT Vec2i dest, Vec2f a) {
|
|||
/* |description|
|
||||
Converts a 2D floating-point vector `a` into a 2D short integer vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2f_to_vec2s(OUT Vec2s dest, Vec2f a) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2f_to_vec2s(VEC_OUT Vec2s dest, Vec2f a) {
|
||||
dest[0] = a[0] + ((a[0] > 0) ? 0.5f : -0.5f);
|
||||
dest[1] = a[1] + ((a[1] > 0) ? 0.5f : -0.5f);
|
||||
return dest;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* |description|
|
||||
Sets the components of the 2D integer vector `v` to 0
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_zero(OUT Vec2i v) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_zero(VEC_OUT Vec2i v) {
|
||||
memset(v, 0, sizeof(Vec2i));
|
||||
return v;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_zero(OUT Vec2i v) {
|
|||
/* |description|
|
||||
Copies the contents of a 2D integer vector (`src`) into another 2D integer vector (`dest`)
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_copy(OUT Vec2i dest, Vec2i src) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_copy(VEC_OUT Vec2i dest, Vec2i src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
return dest;
|
||||
|
|
@ -23,7 +23,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_copy(OUT Vec2i dest, Vec2i src) {
|
|||
/* |description|
|
||||
Sets the values of the 2D integer vector `dest` to the given x and y values
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_set(OUT Vec2i dest, s32 x, s32 y) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_set(VEC_OUT Vec2i dest, s32 x, s32 y) {
|
||||
dest[0] = x;
|
||||
dest[1] = y;
|
||||
return dest;
|
||||
|
|
@ -32,7 +32,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_set(OUT Vec2i dest, s32 x, s32 y) {
|
|||
/* |description|
|
||||
Adds the components of the 2D integer vector `a` to `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_add(OUT Vec2i dest, Vec2i a) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_add(VEC_OUT Vec2i dest, Vec2i a) {
|
||||
dest[0] += a[0];
|
||||
dest[1] += a[1];
|
||||
return dest;
|
||||
|
|
@ -41,7 +41,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_add(OUT Vec2i dest, Vec2i a) {
|
|||
/* |description|
|
||||
Adds the components of two 2D integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_sum(OUT Vec2i dest, Vec2i a, Vec2i b) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_sum(VEC_OUT Vec2i dest, Vec2i a, Vec2i b) {
|
||||
dest[0] = a[0] + b[0];
|
||||
dest[1] = a[1] + b[1];
|
||||
return dest;
|
||||
|
|
@ -50,7 +50,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_sum(OUT Vec2i dest, Vec2i a, Vec2i b) {
|
|||
/* |description|
|
||||
Subtracts the components of the 2D integer vector `a` from `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_sub(OUT Vec2i dest, Vec2i a) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_sub(VEC_OUT Vec2i dest, Vec2i a) {
|
||||
dest[0] -= a[0];
|
||||
dest[1] -= a[1];
|
||||
return dest;
|
||||
|
|
@ -59,7 +59,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_sub(OUT Vec2i dest, Vec2i a) {
|
|||
/* |description|
|
||||
Subtracts the components of the 2D integer vector `b` from the components of `a` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_dif(OUT Vec2i dest, Vec2i a, Vec2i b) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_dif(VEC_OUT Vec2i dest, Vec2i a, Vec2i b) {
|
||||
dest[0] = a[0] - b[0];
|
||||
dest[1] = a[1] - b[1];
|
||||
return dest;
|
||||
|
|
@ -68,7 +68,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_dif(OUT Vec2i dest, Vec2i a, Vec2i b) {
|
|||
/* |description|
|
||||
Multiplies each component of the 2D integer vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_mul(OUT Vec2i dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_mul(VEC_OUT Vec2i dest, f32 a) {
|
||||
dest[0] *= a;
|
||||
dest[1] *= a;
|
||||
return dest;
|
||||
|
|
@ -77,7 +77,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_mul(OUT Vec2i dest, f32 a) {
|
|||
/* |description|
|
||||
Multiplies the components of the 2D integer vector `dest` with the components of `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_mult(OUT Vec2i dest, Vec2i a) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_mult(VEC_OUT Vec2i dest, Vec2i a) {
|
||||
dest[0] *= a[0];
|
||||
dest[1] *= a[1];
|
||||
return dest;
|
||||
|
|
@ -86,7 +86,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_mult(OUT Vec2i dest, Vec2i a) {
|
|||
/* |description|
|
||||
Multiplies the components of two 2D integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_prod(OUT Vec2i dest, Vec2i a, Vec2i b) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_prod(VEC_OUT Vec2i dest, Vec2i a, Vec2i b) {
|
||||
dest[0] = a[0] * b[0];
|
||||
dest[1] = a[1] * b[1];
|
||||
return dest;
|
||||
|
|
@ -95,7 +95,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_prod(OUT Vec2i dest, Vec2i a, Vec2i b) {
|
|||
/* |description|
|
||||
Divides each component of the 2D integer vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_div(OUT Vec2i dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_div(VEC_OUT Vec2i dest, f32 a) {
|
||||
if (a == 0) { return dest; }
|
||||
dest[0] /= a;
|
||||
dest[1] /= a;
|
||||
|
|
@ -112,7 +112,7 @@ INLINE OPTIMIZE_O3 f32 vec2i_length(Vec2i a) {
|
|||
/* |description|
|
||||
Normalizes the 2D integer vector `v` so that its length (magnitude) becomes 1, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_normalize(OUT Vec2i v) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_normalize(VEC_OUT Vec2i v) {
|
||||
f32 mag = vec2i_length(v);
|
||||
vec2i_div(v, mag);
|
||||
return v;
|
||||
|
|
@ -121,7 +121,7 @@ INLINE OPTIMIZE_O3 Vec2ip vec2i_normalize(OUT Vec2i v) {
|
|||
/* |description|
|
||||
Sets the length (magnitude) of 2D integer vector `v`, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_set_magnitude(OUT Vec2i v, f32 mag) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_set_magnitude(VEC_OUT Vec2i v, f32 mag) {
|
||||
vec2i_normalize(v);
|
||||
vec2i_mul(v, mag);
|
||||
return v;
|
||||
|
|
@ -137,7 +137,7 @@ INLINE OPTIMIZE_O3 f32 vec2i_dot(Vec2i a, Vec2i b) {
|
|||
/* |description|
|
||||
Takes two 2D integer vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, adds the scaled vectors together and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_combine(OUT Vec2i dest, Vec2i vecA, Vec2i vecB, f32 sclA, f32 sclB) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2i_combine(VEC_OUT Vec2i dest, Vec2i vecA, Vec2i vecB, f32 sclA, f32 sclB) {
|
||||
dest[0] = vecA[0] * sclA + vecB[0] * sclB;
|
||||
dest[1] = vecA[1] * sclA + vecB[1] * sclB;
|
||||
return dest;
|
||||
|
|
@ -162,7 +162,7 @@ INLINE OPTIMIZE_O3 bool vec2i_is_zero(Vec2i v) {
|
|||
/* |description|
|
||||
Converts a 2D integer vector `a` into a 2D floating-point vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2i_to_vec2f(OUT Vec2f dest, Vec2i a) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2i_to_vec2f(VEC_OUT Vec2f dest, Vec2i a) {
|
||||
dest[0] = a[0];
|
||||
dest[1] = a[1];
|
||||
return dest;
|
||||
|
|
@ -171,7 +171,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2i_to_vec2f(OUT Vec2f dest, Vec2i a) {
|
|||
/* |description|
|
||||
Converts a 2D integer vector `a` into a 2D short integer vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2i_to_vec2s(OUT Vec2s dest, Vec2i a) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2i_to_vec2s(VEC_OUT Vec2s dest, Vec2i a) {
|
||||
dest[0] = a[0];
|
||||
dest[1] = a[1];
|
||||
return dest;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* |description|
|
||||
Sets the components of the 2D short integer vector `v` to 0
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_zero(OUT Vec2s v) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_zero(VEC_OUT Vec2s v) {
|
||||
memset(v, 0, sizeof(Vec2s));
|
||||
return v;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_zero(OUT Vec2s v) {
|
|||
/* |description|
|
||||
Copies the contents of a 2D short integer vector (`src`) into another 2D short integer vector (`dest`)
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_copy(OUT Vec2s dest, Vec2s src) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_copy(VEC_OUT Vec2s dest, Vec2s src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
return dest;
|
||||
|
|
@ -23,7 +23,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_copy(OUT Vec2s dest, Vec2s src) {
|
|||
/* |description|
|
||||
Sets the values of the 2D short integer vector `dest` to the given x and y values
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_set(OUT Vec2s dest, s16 x, s16 y) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_set(VEC_OUT Vec2s dest, s16 x, s16 y) {
|
||||
dest[0] = x;
|
||||
dest[1] = y;
|
||||
return dest;
|
||||
|
|
@ -32,7 +32,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_set(OUT Vec2s dest, s16 x, s16 y) {
|
|||
/* |description|
|
||||
Adds the components of the 2D short integer vector `a` to `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_add(OUT Vec2s dest, Vec2s a) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_add(VEC_OUT Vec2s dest, Vec2s a) {
|
||||
dest[0] += a[0];
|
||||
dest[1] += a[1];
|
||||
return dest;
|
||||
|
|
@ -41,7 +41,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_add(OUT Vec2s dest, Vec2s a) {
|
|||
/* |description|
|
||||
Adds the components of two 2D short integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_sum(OUT Vec2s dest, Vec2s a, Vec2s b) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_sum(VEC_OUT Vec2s dest, Vec2s a, Vec2s b) {
|
||||
dest[0] = a[0] + b[0];
|
||||
dest[1] = a[1] + b[1];
|
||||
return dest;
|
||||
|
|
@ -50,7 +50,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_sum(OUT Vec2s dest, Vec2s a, Vec2s b) {
|
|||
/* |description|
|
||||
Subtracts the components of the 2D short integer vector `a` from `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_sub(OUT Vec2s dest, Vec2s a) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_sub(VEC_OUT Vec2s dest, Vec2s a) {
|
||||
dest[0] -= a[0];
|
||||
dest[1] -= a[1];
|
||||
return dest;
|
||||
|
|
@ -59,7 +59,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_sub(OUT Vec2s dest, Vec2s a) {
|
|||
/* |description|
|
||||
Subtracts the components of the 2D short integer vector `b` from the components of `a` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_dif(OUT Vec2s dest, Vec2s a, Vec2s b) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_dif(VEC_OUT Vec2s dest, Vec2s a, Vec2s b) {
|
||||
dest[0] = a[0] - b[0];
|
||||
dest[1] = a[1] - b[1];
|
||||
return dest;
|
||||
|
|
@ -68,7 +68,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_dif(OUT Vec2s dest, Vec2s a, Vec2s b) {
|
|||
/* |description|
|
||||
Multiplies each component of the 2D short integer vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_mul(OUT Vec2s dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_mul(VEC_OUT Vec2s dest, f32 a) {
|
||||
dest[0] *= a;
|
||||
dest[1] *= a;
|
||||
return dest;
|
||||
|
|
@ -77,7 +77,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_mul(OUT Vec2s dest, f32 a) {
|
|||
/* |description|
|
||||
Multiplies the components of the 2D short integer vector `dest` with the components of `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_mult(OUT Vec2s dest, Vec2s a) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_mult(VEC_OUT Vec2s dest, Vec2s a) {
|
||||
dest[0] *= a[0];
|
||||
dest[1] *= a[1];
|
||||
return dest;
|
||||
|
|
@ -86,7 +86,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_mult(OUT Vec2s dest, Vec2s a) {
|
|||
/* |description|
|
||||
Multiplies the components of two 2D short integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_prod(OUT Vec2s dest, Vec2s a, Vec2s b) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_prod(VEC_OUT Vec2s dest, Vec2s a, Vec2s b) {
|
||||
dest[0] = a[0] * b[0];
|
||||
dest[1] = a[1] * b[1];
|
||||
return dest;
|
||||
|
|
@ -95,7 +95,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_prod(OUT Vec2s dest, Vec2s a, Vec2s b) {
|
|||
/* |description|
|
||||
Divides each component of the 2D short integer vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_div(OUT Vec2s dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_div(VEC_OUT Vec2s dest, f32 a) {
|
||||
if (a == 0) { return dest; }
|
||||
dest[0] /= a;
|
||||
dest[1] /= a;
|
||||
|
|
@ -112,7 +112,7 @@ INLINE OPTIMIZE_O3 f32 vec2s_length(Vec2s a) {
|
|||
/* |description|
|
||||
Normalizes the 2D short integer vector `v` so that its length (magnitude) becomes 1, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_normalize(OUT Vec2s v) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_normalize(VEC_OUT Vec2s v) {
|
||||
f32 mag = vec2s_length(v);
|
||||
vec2s_div(v, mag);
|
||||
return v;
|
||||
|
|
@ -121,7 +121,7 @@ INLINE OPTIMIZE_O3 Vec2sp vec2s_normalize(OUT Vec2s v) {
|
|||
/* |description|
|
||||
Sets the length (magnitude) of 2D short integer vector `v`, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_set_magnitude(OUT Vec2s v, f32 mag) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_set_magnitude(VEC_OUT Vec2s v, f32 mag) {
|
||||
vec2s_normalize(v);
|
||||
vec2s_mul(v, mag);
|
||||
return v;
|
||||
|
|
@ -137,7 +137,7 @@ INLINE OPTIMIZE_O3 f32 vec2s_dot(Vec2s a, Vec2s b) {
|
|||
/* |description|
|
||||
Takes two 2D short integer vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, adds the scaled vectors together and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_combine(OUT Vec2s dest, Vec2s vecA, Vec2s vecB, f32 sclA, f32 sclB) {
|
||||
INLINE OPTIMIZE_O3 Vec2sp vec2s_combine(VEC_OUT Vec2s dest, Vec2s vecA, Vec2s vecB, f32 sclA, f32 sclB) {
|
||||
dest[0] = vecA[0] * sclA + vecB[0] * sclB;
|
||||
dest[1] = vecA[1] * sclA + vecB[1] * sclB;
|
||||
return dest;
|
||||
|
|
@ -162,7 +162,7 @@ INLINE OPTIMIZE_O3 bool vec2s_is_zero(Vec2s v) {
|
|||
/* |description|
|
||||
Converts a 2D short integer vector `a` into a 2D floating-point vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2s_to_vec2f(OUT Vec2f dest, Vec2s a) {
|
||||
INLINE OPTIMIZE_O3 Vec2fp vec2s_to_vec2f(VEC_OUT Vec2f dest, Vec2s a) {
|
||||
dest[0] = a[0];
|
||||
dest[1] = a[1];
|
||||
return dest;
|
||||
|
|
@ -171,7 +171,7 @@ INLINE OPTIMIZE_O3 Vec2fp vec2s_to_vec2f(OUT Vec2f dest, Vec2s a) {
|
|||
/* |description|
|
||||
Converts a 2D short integer vector `a` into a 2D integer vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2s_to_vec2i(OUT Vec2i dest, Vec2s a) {
|
||||
INLINE OPTIMIZE_O3 Vec2ip vec2s_to_vec2i(VEC_OUT Vec2i dest, Vec2s a) {
|
||||
dest[0] = a[0];
|
||||
dest[1] = a[1];
|
||||
return dest;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/* |description|
|
||||
Sets the components of the 3D {{desc}} vector `v` to 0
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_zero(OUT Vec3{{suffix}} v) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_zero(VEC_OUT Vec3{{suffix}} v) {
|
||||
memset(v, 0, sizeof(Vec3{{suffix}}));
|
||||
return v;
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_zero(OUT Vec3{{suffix}} v) {
|
|||
/* |description|
|
||||
Copies the contents of a 3D {{desc}} vector (`src`) into another 3D {{desc}} vector (`dest`)
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_copy(OUT Vec3{{suffix}} dest, Vec3{{suffix}} src) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_copy(VEC_OUT Vec3{{suffix}} dest, Vec3{{suffix}} src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
|
|
@ -21,7 +21,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_copy(OUT Vec3{{suffix}} dest,
|
|||
/* |description|
|
||||
Sets the values of the 3D {{desc}} vector `dest` to the given x, y, and z values
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_set(OUT Vec3{{suffix}} dest, {{type}} x, {{type}} y, {{type}} z) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_set(VEC_OUT Vec3{{suffix}} dest, {{type}} x, {{type}} y, {{type}} z) {
|
||||
dest[0] = x;
|
||||
dest[1] = y;
|
||||
dest[2] = z;
|
||||
|
|
@ -31,7 +31,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_set(OUT Vec3{{suffix}} dest, {
|
|||
/* |description|
|
||||
Adds the components of the 3D {{desc}} vector `a` to `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_add(OUT Vec3{{suffix}} dest, Vec3{{suffix}} a) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_add(VEC_OUT Vec3{{suffix}} dest, Vec3{{suffix}} a) {
|
||||
dest[0] += a[0];
|
||||
dest[1] += a[1];
|
||||
dest[2] += a[2];
|
||||
|
|
@ -41,7 +41,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_add(OUT Vec3{{suffix}} dest, V
|
|||
/* |description|
|
||||
Adds the components of two 3D {{desc}} vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_sum(OUT Vec3{{suffix}} dest, Vec3{{suffix}} a, Vec3{{suffix}} b) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_sum(VEC_OUT Vec3{{suffix}} dest, Vec3{{suffix}} a, Vec3{{suffix}} b) {
|
||||
dest[0] = a[0] + b[0];
|
||||
dest[1] = a[1] + b[1];
|
||||
dest[2] = a[2] + b[2];
|
||||
|
|
@ -51,7 +51,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_sum(OUT Vec3{{suffix}} dest, V
|
|||
/* |description|
|
||||
Subtracts the components of the 3D {{desc}} vector `a` from `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_sub(OUT Vec3{{suffix}} dest, Vec3{{suffix}} a) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_sub(VEC_OUT Vec3{{suffix}} dest, Vec3{{suffix}} a) {
|
||||
dest[0] -= a[0];
|
||||
dest[1] -= a[1];
|
||||
dest[2] -= a[2];
|
||||
|
|
@ -61,7 +61,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_sub(OUT Vec3{{suffix}} dest, V
|
|||
/* |description|
|
||||
Subtracts the components of the 3D {{desc}} vector `b` from the components of `a` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_dif(OUT Vec3{{suffix}} dest, Vec3{{suffix}} a, Vec3{{suffix}} b) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_dif(VEC_OUT Vec3{{suffix}} dest, Vec3{{suffix}} a, Vec3{{suffix}} b) {
|
||||
dest[0] = a[0] - b[0];
|
||||
dest[1] = a[1] - b[1];
|
||||
dest[2] = a[2] - b[2];
|
||||
|
|
@ -71,7 +71,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_dif(OUT Vec3{{suffix}} dest, V
|
|||
/* |description|
|
||||
Multiplies each component of the 3D {{desc}} vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_mul(OUT Vec3{{suffix}} dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_mul(VEC_OUT Vec3{{suffix}} dest, f32 a) {
|
||||
dest[0] *= a;
|
||||
dest[1] *= a;
|
||||
dest[2] *= a;
|
||||
|
|
@ -81,7 +81,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_mul(OUT Vec3{{suffix}} dest, f
|
|||
/* |description|
|
||||
Multiplies the components of the 3D {{desc}} vector `dest` with the components of `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_mult(OUT Vec3{{suffix}} dest, Vec3{{suffix}} a) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_mult(VEC_OUT Vec3{{suffix}} dest, Vec3{{suffix}} a) {
|
||||
dest[0] *= a[0];
|
||||
dest[1] *= a[1];
|
||||
dest[2] *= a[2];
|
||||
|
|
@ -91,7 +91,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_mult(OUT Vec3{{suffix}} dest,
|
|||
/* |description|
|
||||
Multiplies the components of two 3D {{desc}} vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_prod(OUT Vec3{{suffix}} dest, Vec3{{suffix}} a, Vec3{{suffix}} b) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_prod(VEC_OUT Vec3{{suffix}} dest, Vec3{{suffix}} a, Vec3{{suffix}} b) {
|
||||
dest[0] = a[0] * b[0];
|
||||
dest[1] = a[1] * b[1];
|
||||
dest[2] = a[2] * b[2];
|
||||
|
|
@ -101,7 +101,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_prod(OUT Vec3{{suffix}} dest,
|
|||
/* |description|
|
||||
Divides each component of the 3D {{desc}} vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_div(OUT Vec3{{suffix}} dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_div(VEC_OUT Vec3{{suffix}} dest, f32 a) {
|
||||
if (a == 0) { return dest; }
|
||||
dest[0] /= a;
|
||||
dest[1] /= a;
|
||||
|
|
@ -119,7 +119,7 @@ INLINE OPTIMIZE_O3 f32 vec3{{suffix}}_length(Vec3{{suffix}} a) {
|
|||
/* |description|
|
||||
Normalizes the 3D {{desc}} vector `v` so that its length (magnitude) becomes 1, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_normalize(OUT Vec3{{suffix}} v) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_normalize(VEC_OUT Vec3{{suffix}} v) {
|
||||
f32 mag = vec3{{suffix}}_length(v);
|
||||
vec3{{suffix}}_div(v, mag);
|
||||
return v;
|
||||
|
|
@ -128,7 +128,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_normalize(OUT Vec3{{suffix}} v
|
|||
/* |description|
|
||||
Sets the length (magnitude) of 3D {{desc}} vector `v`, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_set_magnitude(OUT Vec3{{suffix}} v, f32 mag) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_set_magnitude(VEC_OUT Vec3{{suffix}} v, f32 mag) {
|
||||
vec3{{suffix}}_normalize(v);
|
||||
vec3{{suffix}}_mul(v, mag);
|
||||
return v;
|
||||
|
|
@ -144,7 +144,7 @@ INLINE OPTIMIZE_O3 f32 vec3{{suffix}}_dot(Vec3{{suffix}} a, Vec3{{suffix}} b) {
|
|||
/* |description|
|
||||
Computes the cross product of two 3D {{desc}} vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_cross(OUT Vec3{{suffix}} dest, Vec3{{suffix}} a, Vec3{{suffix}} b) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_cross(VEC_OUT Vec3{{suffix}} dest, Vec3{{suffix}} a, Vec3{{suffix}} b) {
|
||||
dest[0] = a[1] * b[2] - b[1] * a[2];
|
||||
dest[1] = a[2] * b[0] - b[2] * a[0];
|
||||
dest[2] = a[0] * b[1] - b[0] * a[1];
|
||||
|
|
@ -154,7 +154,7 @@ INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_cross(OUT Vec3{{suffix}} dest,
|
|||
/* |description|
|
||||
Takes two 3D {{desc}} vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, adds the scaled vectors together and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_combine(OUT Vec3{{suffix}} dest, Vec3{{suffix}} vecA, Vec3{{suffix}} vecB, f32 sclA, f32 sclB) {
|
||||
INLINE OPTIMIZE_O3 Vec3{{suffix}}p vec3{{suffix}}_combine(VEC_OUT Vec3{{suffix}} dest, Vec3{{suffix}} vecA, Vec3{{suffix}} vecB, f32 sclA, f32 sclB) {
|
||||
dest[0] = vecA[0] * sclA + vecB[0] * sclB;
|
||||
dest[1] = vecA[1] * sclA + vecB[1] * sclB;
|
||||
dest[2] = vecA[2] * sclA + vecB[2] * sclB;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* |description|
|
||||
Sets the components of the 3D floating-point vector `v` to 0
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_zero(OUT Vec3f v) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_zero(VEC_OUT Vec3f v) {
|
||||
memset(v, 0, sizeof(Vec3f));
|
||||
return v;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_zero(OUT Vec3f v) {
|
|||
/* |description|
|
||||
Copies the contents of a 3D floating-point vector (`src`) into another 3D floating-point vector (`dest`)
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_copy(OUT Vec3f dest, Vec3f src) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_copy(VEC_OUT Vec3f dest, Vec3f src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
|
|
@ -24,7 +24,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_copy(OUT Vec3f dest, Vec3f src) {
|
|||
/* |description|
|
||||
Sets the values of the 3D floating-point vector `dest` to the given x, y, and z values
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_set(OUT Vec3f dest, f32 x, f32 y, f32 z) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_set(VEC_OUT Vec3f dest, f32 x, f32 y, f32 z) {
|
||||
dest[0] = x;
|
||||
dest[1] = y;
|
||||
dest[2] = z;
|
||||
|
|
@ -34,7 +34,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_set(OUT Vec3f dest, f32 x, f32 y, f32 z) {
|
|||
/* |description|
|
||||
Adds the components of the 3D floating-point vector `a` to `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_add(OUT Vec3f dest, Vec3f a) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_add(VEC_OUT Vec3f dest, Vec3f a) {
|
||||
dest[0] += a[0];
|
||||
dest[1] += a[1];
|
||||
dest[2] += a[2];
|
||||
|
|
@ -44,7 +44,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_add(OUT Vec3f dest, Vec3f a) {
|
|||
/* |description|
|
||||
Adds the components of two 3D floating-point vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_sum(OUT Vec3f dest, Vec3f a, Vec3f b) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_sum(VEC_OUT Vec3f dest, Vec3f a, Vec3f b) {
|
||||
dest[0] = a[0] + b[0];
|
||||
dest[1] = a[1] + b[1];
|
||||
dest[2] = a[2] + b[2];
|
||||
|
|
@ -54,7 +54,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_sum(OUT Vec3f dest, Vec3f a, Vec3f b) {
|
|||
/* |description|
|
||||
Subtracts the components of the 3D floating-point vector `a` from `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_sub(OUT Vec3f dest, Vec3f a) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_sub(VEC_OUT Vec3f dest, Vec3f a) {
|
||||
dest[0] -= a[0];
|
||||
dest[1] -= a[1];
|
||||
dest[2] -= a[2];
|
||||
|
|
@ -64,7 +64,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_sub(OUT Vec3f dest, Vec3f a) {
|
|||
/* |description|
|
||||
Subtracts the components of the 3D floating-point vector `b` from the components of `a` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_dif(OUT Vec3f dest, Vec3f a, Vec3f b) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_dif(VEC_OUT Vec3f dest, Vec3f a, Vec3f b) {
|
||||
dest[0] = a[0] - b[0];
|
||||
dest[1] = a[1] - b[1];
|
||||
dest[2] = a[2] - b[2];
|
||||
|
|
@ -74,7 +74,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_dif(OUT Vec3f dest, Vec3f a, Vec3f b) {
|
|||
/* |description|
|
||||
Multiplies each component of the 3D floating-point vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_mul(OUT Vec3f dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_mul(VEC_OUT Vec3f dest, f32 a) {
|
||||
dest[0] *= a;
|
||||
dest[1] *= a;
|
||||
dest[2] *= a;
|
||||
|
|
@ -84,7 +84,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_mul(OUT Vec3f dest, f32 a) {
|
|||
/* |description|
|
||||
Multiplies the components of the 3D floating-point vector `dest` with the components of `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_mult(OUT Vec3f dest, Vec3f a) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_mult(VEC_OUT Vec3f dest, Vec3f a) {
|
||||
dest[0] *= a[0];
|
||||
dest[1] *= a[1];
|
||||
dest[2] *= a[2];
|
||||
|
|
@ -94,7 +94,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_mult(OUT Vec3f dest, Vec3f a) {
|
|||
/* |description|
|
||||
Multiplies the components of two 3D floating-point vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_prod(OUT Vec3f dest, Vec3f a, Vec3f b) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_prod(VEC_OUT Vec3f dest, Vec3f a, Vec3f b) {
|
||||
dest[0] = a[0] * b[0];
|
||||
dest[1] = a[1] * b[1];
|
||||
dest[2] = a[2] * b[2];
|
||||
|
|
@ -104,7 +104,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_prod(OUT Vec3f dest, Vec3f a, Vec3f b) {
|
|||
/* |description|
|
||||
Divides each component of the 3D floating-point vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_div(OUT Vec3f dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_div(VEC_OUT Vec3f dest, f32 a) {
|
||||
if (a == 0) { return dest; }
|
||||
dest[0] /= a;
|
||||
dest[1] /= a;
|
||||
|
|
@ -122,7 +122,7 @@ INLINE OPTIMIZE_O3 f32 vec3f_length(Vec3f a) {
|
|||
/* |description|
|
||||
Normalizes the 3D floating-point vector `v` so that its length (magnitude) becomes 1, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_normalize(OUT Vec3f v) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_normalize(VEC_OUT Vec3f v) {
|
||||
f32 mag = vec3f_length(v);
|
||||
vec3f_div(v, mag);
|
||||
return v;
|
||||
|
|
@ -131,7 +131,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_normalize(OUT Vec3f v) {
|
|||
/* |description|
|
||||
Sets the length (magnitude) of 3D floating-point vector `v`, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_set_magnitude(OUT Vec3f v, f32 mag) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_set_magnitude(VEC_OUT Vec3f v, f32 mag) {
|
||||
vec3f_normalize(v);
|
||||
vec3f_mul(v, mag);
|
||||
return v;
|
||||
|
|
@ -147,7 +147,7 @@ INLINE OPTIMIZE_O3 f32 vec3f_dot(Vec3f a, Vec3f b) {
|
|||
/* |description|
|
||||
Computes the cross product of two 3D floating-point vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_cross(OUT Vec3f dest, Vec3f a, Vec3f b) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_cross(VEC_OUT Vec3f dest, Vec3f a, Vec3f b) {
|
||||
dest[0] = a[1] * b[2] - b[1] * a[2];
|
||||
dest[1] = a[2] * b[0] - b[2] * a[0];
|
||||
dest[2] = a[0] * b[1] - b[0] * a[1];
|
||||
|
|
@ -157,7 +157,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3f_cross(OUT Vec3f dest, Vec3f a, Vec3f b) {
|
|||
/* |description|
|
||||
Takes two 3D floating-point vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, adds the scaled vectors together and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_combine(OUT Vec3f dest, Vec3f vecA, Vec3f vecB, f32 sclA, f32 sclB) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3f_combine(VEC_OUT Vec3f dest, Vec3f vecA, Vec3f vecB, f32 sclA, f32 sclB) {
|
||||
dest[0] = vecA[0] * sclA + vecB[0] * sclB;
|
||||
dest[1] = vecA[1] * sclA + vecB[1] * sclB;
|
||||
dest[2] = vecA[2] * sclA + vecB[2] * sclB;
|
||||
|
|
@ -191,7 +191,7 @@ INLINE OPTIMIZE_O3 bool vec3f_is_zero(Vec3f v) {
|
|||
/* |description|
|
||||
Converts a 3D floating-point vector `a` into a 3D integer vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3f_to_vec3i(OUT Vec3i dest, Vec3f a) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3f_to_vec3i(VEC_OUT Vec3i dest, Vec3f a) {
|
||||
dest[0] = a[0] + ((a[0] > 0) ? 0.5f : -0.5f);
|
||||
dest[1] = a[1] + ((a[1] > 0) ? 0.5f : -0.5f);
|
||||
dest[2] = a[2] + ((a[2] > 0) ? 0.5f : -0.5f);
|
||||
|
|
@ -201,7 +201,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3f_to_vec3i(OUT Vec3i dest, Vec3f a) {
|
|||
/* |description|
|
||||
Converts a 3D floating-point vector `a` into a 3D short integer vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3f_to_vec3s(OUT Vec3s dest, Vec3f a) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3f_to_vec3s(VEC_OUT Vec3s dest, Vec3f a) {
|
||||
dest[0] = a[0] + ((a[0] > 0) ? 0.5f : -0.5f);
|
||||
dest[1] = a[1] + ((a[1] > 0) ? 0.5f : -0.5f);
|
||||
dest[2] = a[2] + ((a[2] > 0) ? 0.5f : -0.5f);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* |description|
|
||||
Sets the components of the 3D integer vector `v` to 0
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_zero(OUT Vec3i v) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_zero(VEC_OUT Vec3i v) {
|
||||
memset(v, 0, sizeof(Vec3i));
|
||||
return v;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_zero(OUT Vec3i v) {
|
|||
/* |description|
|
||||
Copies the contents of a 3D integer vector (`src`) into another 3D integer vector (`dest`)
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_copy(OUT Vec3i dest, Vec3i src) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_copy(VEC_OUT Vec3i dest, Vec3i src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
|
|
@ -24,7 +24,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_copy(OUT Vec3i dest, Vec3i src) {
|
|||
/* |description|
|
||||
Sets the values of the 3D integer vector `dest` to the given x, y, and z values
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_set(OUT Vec3i dest, s32 x, s32 y, s32 z) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_set(VEC_OUT Vec3i dest, s32 x, s32 y, s32 z) {
|
||||
dest[0] = x;
|
||||
dest[1] = y;
|
||||
dest[2] = z;
|
||||
|
|
@ -34,7 +34,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_set(OUT Vec3i dest, s32 x, s32 y, s32 z) {
|
|||
/* |description|
|
||||
Adds the components of the 3D integer vector `a` to `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_add(OUT Vec3i dest, Vec3i a) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_add(VEC_OUT Vec3i dest, Vec3i a) {
|
||||
dest[0] += a[0];
|
||||
dest[1] += a[1];
|
||||
dest[2] += a[2];
|
||||
|
|
@ -44,7 +44,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_add(OUT Vec3i dest, Vec3i a) {
|
|||
/* |description|
|
||||
Adds the components of two 3D integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_sum(OUT Vec3i dest, Vec3i a, Vec3i b) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_sum(VEC_OUT Vec3i dest, Vec3i a, Vec3i b) {
|
||||
dest[0] = a[0] + b[0];
|
||||
dest[1] = a[1] + b[1];
|
||||
dest[2] = a[2] + b[2];
|
||||
|
|
@ -54,7 +54,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_sum(OUT Vec3i dest, Vec3i a, Vec3i b) {
|
|||
/* |description|
|
||||
Subtracts the components of the 3D integer vector `a` from `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_sub(OUT Vec3i dest, Vec3i a) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_sub(VEC_OUT Vec3i dest, Vec3i a) {
|
||||
dest[0] -= a[0];
|
||||
dest[1] -= a[1];
|
||||
dest[2] -= a[2];
|
||||
|
|
@ -64,7 +64,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_sub(OUT Vec3i dest, Vec3i a) {
|
|||
/* |description|
|
||||
Subtracts the components of the 3D integer vector `b` from the components of `a` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_dif(OUT Vec3i dest, Vec3i a, Vec3i b) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_dif(VEC_OUT Vec3i dest, Vec3i a, Vec3i b) {
|
||||
dest[0] = a[0] - b[0];
|
||||
dest[1] = a[1] - b[1];
|
||||
dest[2] = a[2] - b[2];
|
||||
|
|
@ -74,7 +74,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_dif(OUT Vec3i dest, Vec3i a, Vec3i b) {
|
|||
/* |description|
|
||||
Multiplies each component of the 3D integer vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_mul(OUT Vec3i dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_mul(VEC_OUT Vec3i dest, f32 a) {
|
||||
dest[0] *= a;
|
||||
dest[1] *= a;
|
||||
dest[2] *= a;
|
||||
|
|
@ -84,7 +84,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_mul(OUT Vec3i dest, f32 a) {
|
|||
/* |description|
|
||||
Multiplies the components of the 3D integer vector `dest` with the components of `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_mult(OUT Vec3i dest, Vec3i a) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_mult(VEC_OUT Vec3i dest, Vec3i a) {
|
||||
dest[0] *= a[0];
|
||||
dest[1] *= a[1];
|
||||
dest[2] *= a[2];
|
||||
|
|
@ -94,7 +94,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_mult(OUT Vec3i dest, Vec3i a) {
|
|||
/* |description|
|
||||
Multiplies the components of two 3D integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_prod(OUT Vec3i dest, Vec3i a, Vec3i b) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_prod(VEC_OUT Vec3i dest, Vec3i a, Vec3i b) {
|
||||
dest[0] = a[0] * b[0];
|
||||
dest[1] = a[1] * b[1];
|
||||
dest[2] = a[2] * b[2];
|
||||
|
|
@ -104,7 +104,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_prod(OUT Vec3i dest, Vec3i a, Vec3i b) {
|
|||
/* |description|
|
||||
Divides each component of the 3D integer vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_div(OUT Vec3i dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_div(VEC_OUT Vec3i dest, f32 a) {
|
||||
if (a == 0) { return dest; }
|
||||
dest[0] /= a;
|
||||
dest[1] /= a;
|
||||
|
|
@ -122,7 +122,7 @@ INLINE OPTIMIZE_O3 f32 vec3i_length(Vec3i a) {
|
|||
/* |description|
|
||||
Normalizes the 3D integer vector `v` so that its length (magnitude) becomes 1, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_normalize(OUT Vec3i v) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_normalize(VEC_OUT Vec3i v) {
|
||||
f32 mag = vec3i_length(v);
|
||||
vec3i_div(v, mag);
|
||||
return v;
|
||||
|
|
@ -131,7 +131,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_normalize(OUT Vec3i v) {
|
|||
/* |description|
|
||||
Sets the length (magnitude) of 3D integer vector `v`, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_set_magnitude(OUT Vec3i v, f32 mag) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_set_magnitude(VEC_OUT Vec3i v, f32 mag) {
|
||||
vec3i_normalize(v);
|
||||
vec3i_mul(v, mag);
|
||||
return v;
|
||||
|
|
@ -147,7 +147,7 @@ INLINE OPTIMIZE_O3 f32 vec3i_dot(Vec3i a, Vec3i b) {
|
|||
/* |description|
|
||||
Computes the cross product of two 3D integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_cross(OUT Vec3i dest, Vec3i a, Vec3i b) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_cross(VEC_OUT Vec3i dest, Vec3i a, Vec3i b) {
|
||||
dest[0] = a[1] * b[2] - b[1] * a[2];
|
||||
dest[1] = a[2] * b[0] - b[2] * a[0];
|
||||
dest[2] = a[0] * b[1] - b[0] * a[1];
|
||||
|
|
@ -157,7 +157,7 @@ INLINE OPTIMIZE_O3 Vec3ip vec3i_cross(OUT Vec3i dest, Vec3i a, Vec3i b) {
|
|||
/* |description|
|
||||
Takes two 3D integer vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, adds the scaled vectors together and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_combine(OUT Vec3i dest, Vec3i vecA, Vec3i vecB, f32 sclA, f32 sclB) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3i_combine(VEC_OUT Vec3i dest, Vec3i vecA, Vec3i vecB, f32 sclA, f32 sclB) {
|
||||
dest[0] = vecA[0] * sclA + vecB[0] * sclB;
|
||||
dest[1] = vecA[1] * sclA + vecB[1] * sclB;
|
||||
dest[2] = vecA[2] * sclA + vecB[2] * sclB;
|
||||
|
|
@ -191,7 +191,7 @@ INLINE OPTIMIZE_O3 bool vec3i_is_zero(Vec3i v) {
|
|||
/* |description|
|
||||
Converts a 3D integer vector `a` into a 3D floating-point vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3i_to_vec3f(OUT Vec3f dest, Vec3i a) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3i_to_vec3f(VEC_OUT Vec3f dest, Vec3i a) {
|
||||
dest[0] = a[0];
|
||||
dest[1] = a[1];
|
||||
dest[2] = a[2];
|
||||
|
|
@ -201,7 +201,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3i_to_vec3f(OUT Vec3f dest, Vec3i a) {
|
|||
/* |description|
|
||||
Converts a 3D integer vector `a` into a 3D short integer vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3i_to_vec3s(OUT Vec3s dest, Vec3i a) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3i_to_vec3s(VEC_OUT Vec3s dest, Vec3i a) {
|
||||
dest[0] = a[0];
|
||||
dest[1] = a[1];
|
||||
dest[2] = a[2];
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* |description|
|
||||
Sets the components of the 3D short integer vector `v` to 0
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_zero(OUT Vec3s v) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_zero(VEC_OUT Vec3s v) {
|
||||
memset(v, 0, sizeof(Vec3s));
|
||||
return v;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_zero(OUT Vec3s v) {
|
|||
/* |description|
|
||||
Copies the contents of a 3D short integer vector (`src`) into another 3D short integer vector (`dest`)
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_copy(OUT Vec3s dest, Vec3s src) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_copy(VEC_OUT Vec3s dest, Vec3s src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
|
|
@ -24,7 +24,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_copy(OUT Vec3s dest, Vec3s src) {
|
|||
/* |description|
|
||||
Sets the values of the 3D short integer vector `dest` to the given x, y, and z values
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_set(OUT Vec3s dest, s16 x, s16 y, s16 z) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_set(VEC_OUT Vec3s dest, s16 x, s16 y, s16 z) {
|
||||
dest[0] = x;
|
||||
dest[1] = y;
|
||||
dest[2] = z;
|
||||
|
|
@ -34,7 +34,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_set(OUT Vec3s dest, s16 x, s16 y, s16 z) {
|
|||
/* |description|
|
||||
Adds the components of the 3D short integer vector `a` to `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_add(OUT Vec3s dest, Vec3s a) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_add(VEC_OUT Vec3s dest, Vec3s a) {
|
||||
dest[0] += a[0];
|
||||
dest[1] += a[1];
|
||||
dest[2] += a[2];
|
||||
|
|
@ -44,7 +44,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_add(OUT Vec3s dest, Vec3s a) {
|
|||
/* |description|
|
||||
Adds the components of two 3D short integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_sum(OUT Vec3s dest, Vec3s a, Vec3s b) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_sum(VEC_OUT Vec3s dest, Vec3s a, Vec3s b) {
|
||||
dest[0] = a[0] + b[0];
|
||||
dest[1] = a[1] + b[1];
|
||||
dest[2] = a[2] + b[2];
|
||||
|
|
@ -54,7 +54,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_sum(OUT Vec3s dest, Vec3s a, Vec3s b) {
|
|||
/* |description|
|
||||
Subtracts the components of the 3D short integer vector `a` from `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_sub(OUT Vec3s dest, Vec3s a) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_sub(VEC_OUT Vec3s dest, Vec3s a) {
|
||||
dest[0] -= a[0];
|
||||
dest[1] -= a[1];
|
||||
dest[2] -= a[2];
|
||||
|
|
@ -64,7 +64,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_sub(OUT Vec3s dest, Vec3s a) {
|
|||
/* |description|
|
||||
Subtracts the components of the 3D short integer vector `b` from the components of `a` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_dif(OUT Vec3s dest, Vec3s a, Vec3s b) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_dif(VEC_OUT Vec3s dest, Vec3s a, Vec3s b) {
|
||||
dest[0] = a[0] - b[0];
|
||||
dest[1] = a[1] - b[1];
|
||||
dest[2] = a[2] - b[2];
|
||||
|
|
@ -74,7 +74,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_dif(OUT Vec3s dest, Vec3s a, Vec3s b) {
|
|||
/* |description|
|
||||
Multiplies each component of the 3D short integer vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_mul(OUT Vec3s dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_mul(VEC_OUT Vec3s dest, f32 a) {
|
||||
dest[0] *= a;
|
||||
dest[1] *= a;
|
||||
dest[2] *= a;
|
||||
|
|
@ -84,7 +84,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_mul(OUT Vec3s dest, f32 a) {
|
|||
/* |description|
|
||||
Multiplies the components of the 3D short integer vector `dest` with the components of `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_mult(OUT Vec3s dest, Vec3s a) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_mult(VEC_OUT Vec3s dest, Vec3s a) {
|
||||
dest[0] *= a[0];
|
||||
dest[1] *= a[1];
|
||||
dest[2] *= a[2];
|
||||
|
|
@ -94,7 +94,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_mult(OUT Vec3s dest, Vec3s a) {
|
|||
/* |description|
|
||||
Multiplies the components of two 3D short integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_prod(OUT Vec3s dest, Vec3s a, Vec3s b) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_prod(VEC_OUT Vec3s dest, Vec3s a, Vec3s b) {
|
||||
dest[0] = a[0] * b[0];
|
||||
dest[1] = a[1] * b[1];
|
||||
dest[2] = a[2] * b[2];
|
||||
|
|
@ -104,7 +104,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_prod(OUT Vec3s dest, Vec3s a, Vec3s b) {
|
|||
/* |description|
|
||||
Divides each component of the 3D short integer vector `dest` by the scalar value `a`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_div(OUT Vec3s dest, f32 a) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_div(VEC_OUT Vec3s dest, f32 a) {
|
||||
if (a == 0) { return dest; }
|
||||
dest[0] /= a;
|
||||
dest[1] /= a;
|
||||
|
|
@ -122,7 +122,7 @@ INLINE OPTIMIZE_O3 f32 vec3s_length(Vec3s a) {
|
|||
/* |description|
|
||||
Normalizes the 3D short integer vector `v` so that its length (magnitude) becomes 1, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_normalize(OUT Vec3s v) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_normalize(VEC_OUT Vec3s v) {
|
||||
f32 mag = vec3s_length(v);
|
||||
vec3s_div(v, mag);
|
||||
return v;
|
||||
|
|
@ -131,7 +131,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_normalize(OUT Vec3s v) {
|
|||
/* |description|
|
||||
Sets the length (magnitude) of 3D short integer vector `v`, while retaining its direction
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_set_magnitude(OUT Vec3s v, f32 mag) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_set_magnitude(VEC_OUT Vec3s v, f32 mag) {
|
||||
vec3s_normalize(v);
|
||||
vec3s_mul(v, mag);
|
||||
return v;
|
||||
|
|
@ -147,7 +147,7 @@ INLINE OPTIMIZE_O3 f32 vec3s_dot(Vec3s a, Vec3s b) {
|
|||
/* |description|
|
||||
Computes the cross product of two 3D short integer vectors `a` and `b` and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_cross(OUT Vec3s dest, Vec3s a, Vec3s b) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_cross(VEC_OUT Vec3s dest, Vec3s a, Vec3s b) {
|
||||
dest[0] = a[1] * b[2] - b[1] * a[2];
|
||||
dest[1] = a[2] * b[0] - b[2] * a[0];
|
||||
dest[2] = a[0] * b[1] - b[0] * a[1];
|
||||
|
|
@ -157,7 +157,7 @@ INLINE OPTIMIZE_O3 Vec3sp vec3s_cross(OUT Vec3s dest, Vec3s a, Vec3s b) {
|
|||
/* |description|
|
||||
Takes two 3D short integer vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, adds the scaled vectors together and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_combine(OUT Vec3s dest, Vec3s vecA, Vec3s vecB, f32 sclA, f32 sclB) {
|
||||
INLINE OPTIMIZE_O3 Vec3sp vec3s_combine(VEC_OUT Vec3s dest, Vec3s vecA, Vec3s vecB, f32 sclA, f32 sclB) {
|
||||
dest[0] = vecA[0] * sclA + vecB[0] * sclB;
|
||||
dest[1] = vecA[1] * sclA + vecB[1] * sclB;
|
||||
dest[2] = vecA[2] * sclA + vecB[2] * sclB;
|
||||
|
|
@ -191,7 +191,7 @@ INLINE OPTIMIZE_O3 bool vec3s_is_zero(Vec3s v) {
|
|||
/* |description|
|
||||
Converts a 3D short integer vector `a` into a 3D floating-point vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3s_to_vec3f(OUT Vec3f dest, Vec3s a) {
|
||||
INLINE OPTIMIZE_O3 Vec3fp vec3s_to_vec3f(VEC_OUT Vec3f dest, Vec3s a) {
|
||||
dest[0] = a[0];
|
||||
dest[1] = a[1];
|
||||
dest[2] = a[2];
|
||||
|
|
@ -201,7 +201,7 @@ INLINE OPTIMIZE_O3 Vec3fp vec3s_to_vec3f(OUT Vec3f dest, Vec3s a) {
|
|||
/* |description|
|
||||
Converts a 3D short integer vector `a` into a 3D integer vector and stores the result in `dest`
|
||||
|descriptionEnd| */
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3s_to_vec3i(OUT Vec3i dest, Vec3s a) {
|
||||
INLINE OPTIMIZE_O3 Vec3ip vec3s_to_vec3i(VEC_OUT Vec3i dest, Vec3s a) {
|
||||
dest[0] = a[0];
|
||||
dest[1] = a[1];
|
||||
dest[2] = a[2];
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ void set_find_wall_direction(Vec3f dir, bool active, bool airborne) {
|
|||
gFindWallDirectionAirborne = airborne;
|
||||
}
|
||||
|
||||
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) {
|
||||
Vec3f v1; vec3s_to_vec3f(v1, surf->vertex1);
|
||||
Vec3f v2; vec3s_to_vec3f(v2, surf->vertex2);
|
||||
Vec3f v3; vec3s_to_vec3f(v3, surf->vertex3);
|
||||
|
|
@ -497,7 +497,7 @@ static struct Surface *find_ceil_from_list(struct SurfaceNode *surfaceNode, s32
|
|||
/**
|
||||
* Find the lowest ceiling above a given position and return the height.
|
||||
*/
|
||||
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
|
||||
f32 find_ceil(f32 posX, f32 posY, f32 posZ, RET struct Surface **pceil) {
|
||||
s16 cellZ, cellX;
|
||||
struct Surface *ceil, *dynamicCeil;
|
||||
struct SurfaceNode *surfaceList;
|
||||
|
|
@ -812,7 +812,7 @@ f32 unused_find_dynamic_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfl
|
|||
/**
|
||||
* Find the highest floor under a given position and return the height.
|
||||
*/
|
||||
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, RET struct Surface **pfloor) {
|
||||
s16 cellZ, cellX;
|
||||
|
||||
struct Surface *floor, *dynamicFloor;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "types.h"
|
||||
|
||||
#include "engine/extended_bounds.h"
|
||||
#include "pc/lua/smlua_autogen.h"
|
||||
|
||||
|
||||
#define CELL_HEIGHT_LIMIT 20000
|
||||
|
|
@ -55,7 +56,11 @@ Detects wall collisions at a given position and adjusts the position based on th
|
|||
Returns the number of wall collisions detected
|
||||
|descriptionEnd| */
|
||||
s32 find_wall_collisions(struct WallCollisionData *colData);
|
||||
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil);
|
||||
/* |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)
|
||||
|descriptionEnd| */
|
||||
f32 find_ceil(f32 posX, f32 posY, f32 posZ, RET struct Surface **pceil);
|
||||
|
||||
/* |description|
|
||||
Finds the height of the highest ceiling above a given position (x, y, z).
|
||||
|
|
@ -69,7 +74,11 @@ Finds the height of the highest floor below a given position (x, y, z).
|
|||
If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
|
||||
|descriptionEnd| */
|
||||
f32 find_floor_height(f32 x, f32 y, f32 z);
|
||||
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor);
|
||||
/* |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)
|
||||
|descriptionEnd| */
|
||||
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, RET struct Surface **pfloor);
|
||||
|
||||
/* |description|
|
||||
Finds the height of water at a given position (x, z), if the position is within a water region.
|
||||
|
|
@ -93,6 +102,6 @@ void set_find_wall_direction(Vec3f dir, bool active, bool airborne);
|
|||
/* |description|
|
||||
Gets the closest point of the triangle to `src` and returns it in `out`.
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
#endif // SURFACE_COLLISION_H
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ s32 arc_to_goal_pos(Vec3f goal, Vec3f pos, f32 yVel, f32 gravity);
|
|||
void tox_box_move(f32 forwardVel, f32 a1, s16 deltaPitch, s16 deltaRoll);
|
||||
/* |description|Plays the penguin walking sound|descriptionEnd| */
|
||||
void play_penguin_walking_sound(s32 walk);
|
||||
/* |description|Updates the current object's angle from its move flags|descriptionEnd| */
|
||||
s32 update_angle_from_move_flags(s32 *angle);
|
||||
/* |description|Computes and returns an angle depending on the current object's angle and move flags|descriptionEnd| */
|
||||
s32 update_angle_from_move_flags(INOUT s32 *angle);
|
||||
/* |description|Spawns strong wind particles relative to the current object|descriptionEnd| */
|
||||
void cur_obj_spawn_strong_wind_particles(s32 windSpread, f32 scale, f32 relPosX, f32 relPosY, f32 relPosZ);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ struct ObjectHitbox sScuttlebugHitbox = {
|
|||
.hurtboxHeight = 60,
|
||||
};
|
||||
|
||||
s32 update_angle_from_move_flags(s32 *angle) {
|
||||
s32 update_angle_from_move_flags(INOUT s32 *angle) {
|
||||
if (!angle) { return 0; }
|
||||
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
|
||||
*angle = o->oWallAngle;
|
||||
|
|
|
|||
|
|
@ -3788,7 +3788,7 @@ void stub_camera_2(UNUSED struct Camera *c) {
|
|||
void stub_camera_3(UNUSED struct Camera *c) {
|
||||
}
|
||||
|
||||
void object_pos_to_vec3f(OUT Vec3f dst, struct Object *o) {
|
||||
void object_pos_to_vec3f(VEC_OUT Vec3f dst, struct Object *o) {
|
||||
if (!dst || !o) { return; }
|
||||
dst[0] = o->oPosX;
|
||||
dst[1] = o->oPosY;
|
||||
|
|
@ -3802,7 +3802,7 @@ void vec3f_to_object_pos(struct Object *o, Vec3f src) {
|
|||
o->oPosZ = src[2];
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!dst || !o) { return; }
|
||||
dst[0] = o->oFaceAnglePitch;
|
||||
dst[1] = o->oFaceAngleYaw;
|
||||
|
|
@ -3816,7 +3816,7 @@ void vec3s_to_object_face_angle(struct Object *o, Vec3s src) {
|
|||
o->oFaceAngleRoll = src[2];
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!dst || !o) { return; }
|
||||
dst[0] = o->oMoveAnglePitch;
|
||||
dst[1] = o->oMoveAngleYaw;
|
||||
|
|
@ -4061,7 +4061,7 @@ void set_handheld_shake(u8 mode) {
|
|||
* This function must be called every frame in order to actually apply the effect, since the effect's
|
||||
* mag and inc are set to 0 every frame at the end of this function.
|
||||
*/
|
||||
void shake_camera_handheld(Vec3f pos, OUT Vec3f focus) {
|
||||
void shake_camera_handheld(Vec3f pos, VEC_OUT Vec3f focus) {
|
||||
s32 i;
|
||||
Vec3f shakeOffset;
|
||||
Vec3f shakeSpline[4];
|
||||
|
|
@ -4195,7 +4195,7 @@ s32 update_camera_hud_status(struct Camera *c) {
|
|||
*
|
||||
* @return the number of collisions found
|
||||
*/
|
||||
s32 collide_with_walls(OUT Vec3f pos, f32 offsetY, f32 radius) {
|
||||
s32 collide_with_walls(VEC_OUT Vec3f pos, f32 offsetY, f32 radius) {
|
||||
struct WallCollisionData collisionData;
|
||||
struct Surface *wall = NULL;
|
||||
f32 normX;
|
||||
|
|
@ -4246,7 +4246,7 @@ s32 vec3f_compare(Vec3f pos, f32 posX, f32 posY, f32 posZ) {
|
|||
return equal;
|
||||
}
|
||||
|
||||
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) {
|
||||
s32 outOfRange = 0;
|
||||
s16 pitch;
|
||||
s16 yaw;
|
||||
|
|
@ -4276,7 +4276,7 @@ s32 is_within_100_units_of_mario(f32 posX, f32 posY, f32 posZ) {
|
|||
return isCloseToMario;
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!dst) { return FALSE; }
|
||||
if (sStatusFlags & CAM_FLAG_SMOOTH_MOVEMENT) {
|
||||
approach_f32_asymptotic_bool(dst, goal, scale);
|
||||
|
|
@ -4293,9 +4293,9 @@ s32 set_or_approach_f32_asymptotic(f32 *dst, f32 goal, f32 scale) {
|
|||
/**
|
||||
* Approaches an f32 value by taking the difference between the target and current value
|
||||
* and adding a fraction of that to the current value.
|
||||
* Edits the current value directly, returns TRUE if the target has been reached, FALSE otherwise.
|
||||
* Edits the current value directly, returns FALSE if the target has been reached, TRUE otherwise.
|
||||
*/
|
||||
s32 approach_f32_asymptotic_bool(f32 *current, f32 target, f32 multiplier) {
|
||||
s32 approach_f32_asymptotic_bool(INOUT f32 *current, f32 target, f32 multiplier) {
|
||||
if (!current) { return FALSE; }
|
||||
if (multiplier > 1.f) {
|
||||
multiplier = 1.f;
|
||||
|
|
@ -4321,7 +4321,7 @@ f32 approach_f32_asymptotic(f32 current, f32 target, f32 multiplier) {
|
|||
* is reached. Note: Since this function takes integers as parameters, the last argument is the
|
||||
* reciprocal of what it would be in the previous two functions.
|
||||
*/
|
||||
s32 approach_s16_asymptotic_bool(s16 *current, s16 target, s16 divisor) {
|
||||
s32 approach_s16_asymptotic_bool(INOUT s16 *current, s16 target, s16 divisor) {
|
||||
if (!current) { return FALSE; }
|
||||
s16 temp = *current;
|
||||
|
||||
|
|
@ -4362,7 +4362,7 @@ s32 approach_s16_asymptotic(s16 current, s16 target, s16 divisor) {
|
|||
* Applies the approach_f32_asymptotic_bool function to each of the X, Y, & Z components of the given
|
||||
* vector.
|
||||
*/
|
||||
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) {
|
||||
approach_f32_asymptotic_bool(¤t[0], target[0], xMul);
|
||||
approach_f32_asymptotic_bool(¤t[1], target[1], yMul);
|
||||
approach_f32_asymptotic_bool(¤t[2], target[2], zMul);
|
||||
|
|
@ -4372,7 +4372,7 @@ void approach_vec3f_asymptotic(OUT Vec3f current, Vec3f target, f32 xMul, f32 yM
|
|||
* Applies the set_or_approach_f32_asymptotic_bool function to each of the X, Y, & Z components of the
|
||||
* given vector.
|
||||
*/
|
||||
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) {
|
||||
set_or_approach_f32_asymptotic(&dst[0], goal[0], xMul);
|
||||
set_or_approach_f32_asymptotic(&dst[1], goal[1], yMul);
|
||||
set_or_approach_f32_asymptotic(&dst[2], goal[2], zMul);
|
||||
|
|
@ -4382,13 +4382,13 @@ void set_or_approach_vec3f_asymptotic(OUT Vec3f dst, Vec3f goal, f32 xMul, f32 y
|
|||
* Applies the approach_s32_asymptotic function to each of the X, Y, & Z components of the given
|
||||
* vector.
|
||||
*/
|
||||
void approach_vec3s_asymptotic(OUT Vec3s current, Vec3s target, s16 xMul, s16 yMul, s16 zMul) {
|
||||
void approach_vec3s_asymptotic(VEC_OUT Vec3s current, Vec3s target, s16 xMul, s16 yMul, s16 zMul) {
|
||||
approach_s16_asymptotic_bool(¤t[0], target[0], xMul);
|
||||
approach_s16_asymptotic_bool(¤t[1], target[1], yMul);
|
||||
approach_s16_asymptotic_bool(¤t[2], target[2], zMul);
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!current) { return FALSE; }
|
||||
s16 dist = target - *current;
|
||||
|
||||
|
|
@ -4441,7 +4441,7 @@ s32 camera_approach_s16_symmetric(s16 current, s16 target, s16 increment) {
|
|||
return current;
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!current) { return FALSE; }
|
||||
if (sStatusFlags & CAM_FLAG_SMOOTH_MOVEMENT) {
|
||||
camera_approach_s16_symmetric_bool(current, target, increment);
|
||||
|
|
@ -4460,7 +4460,7 @@ s32 set_or_approach_s16_symmetric(s16 *current, s16 target, s16 increment) {
|
|||
* Appears to be a strange way of implementing approach_f32_symmetric from object_helpers.c.
|
||||
* It could possibly be an older version of the function
|
||||
*/
|
||||
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) {
|
||||
if (!current) { return FALSE; }
|
||||
f32 dist = target - *current;
|
||||
|
||||
|
|
@ -4520,7 +4520,7 @@ f32 camera_approach_f32_symmetric(f32 current, f32 target, f32 increment) {
|
|||
* Generate a vector with all three values about zero. The
|
||||
* three ranges determine how wide the range about zero.
|
||||
*/
|
||||
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) {
|
||||
f32 randomFloat;
|
||||
UNUSED u8 unused[4];
|
||||
f32 tempXRange;
|
||||
|
|
@ -4587,7 +4587,7 @@ s16 reduce_by_dist_from_camera(s16 value, f32 maxDist, f32 posX, f32 posY, f32 p
|
|||
return result;
|
||||
}
|
||||
|
||||
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) {
|
||||
s16 yaw = gCamera->nextYaw;
|
||||
|
||||
if (pos[0] >= xMax) {
|
||||
|
|
@ -4767,7 +4767,7 @@ s32 is_mario_behind_surface(UNUSED struct Camera *c, struct Surface *surf) {
|
|||
* Calculates the distance between two points and sets a vector to a point
|
||||
* scaled along a line between them. Typically, somewhere in the middle.
|
||||
*/
|
||||
void scale_along_line(OUT Vec3f dst, Vec3f from, Vec3f to, f32 scale) {
|
||||
void scale_along_line(VEC_OUT Vec3f dst, Vec3f from, Vec3f to, f32 scale) {
|
||||
Vec3f tempVec;
|
||||
|
||||
tempVec[0] = (to[0] - from[0]) * scale + from[0];
|
||||
|
|
@ -4818,7 +4818,7 @@ s16 calculate_yaw(Vec3f from, Vec3f to) {
|
|||
/**
|
||||
* Calculates the pitch and yaw between two vectors.
|
||||
*/
|
||||
void calculate_angles(Vec3f from, Vec3f to, s16 *pitch, s16 *yaw) {
|
||||
void calculate_angles(Vec3f from, Vec3f to, RET s16 *pitch, RET s16 *yaw) {
|
||||
f32 dx = to[0] - from[0];
|
||||
f32 dy = to[1] - from[1];
|
||||
f32 dz = to[2] - from[2];
|
||||
|
|
@ -4853,7 +4853,7 @@ f32 calc_hor_dist(Vec3f a, Vec3f b) {
|
|||
/**
|
||||
* Rotates a vector in the horizontal plane and copies it to a new vector.
|
||||
*/
|
||||
void rotate_in_xz(OUT Vec3f dst, Vec3f src, s16 yaw) {
|
||||
void rotate_in_xz(VEC_OUT Vec3f dst, Vec3f src, s16 yaw) {
|
||||
Vec3f tempVec;
|
||||
|
||||
vec3f_copy(tempVec, src);
|
||||
|
|
@ -4868,7 +4868,7 @@ void rotate_in_xz(OUT Vec3f dst, Vec3f src, s16 yaw) {
|
|||
* Note: This function also flips the Z axis, so +Z moves forward, not backward like it would in world
|
||||
* space. If possible, use vec3f_set_dist_and_angle()
|
||||
*/
|
||||
void rotate_in_yz(OUT Vec3f dst, Vec3f src, s16 pitch) {
|
||||
void rotate_in_yz(VEC_OUT Vec3f dst, Vec3f src, s16 pitch) {
|
||||
Vec3f tempVec;
|
||||
|
||||
vec3f_copy(tempVec, src);
|
||||
|
|
@ -4962,7 +4962,7 @@ void increment_shake_offset(s16 *offset, s16 increment) {
|
|||
/**
|
||||
* Apply a vertical shake to the camera by adjusting its pitch
|
||||
*/
|
||||
void shake_camera_pitch(Vec3f pos, OUT Vec3f focus) {
|
||||
void shake_camera_pitch(Vec3f pos, VEC_OUT Vec3f focus) {
|
||||
f32 dist;
|
||||
s16 pitch;
|
||||
s16 yaw;
|
||||
|
|
@ -4982,7 +4982,7 @@ void shake_camera_pitch(Vec3f pos, OUT Vec3f focus) {
|
|||
/**
|
||||
* Apply a horizontal shake to the camera by adjusting its yaw
|
||||
*/
|
||||
void shake_camera_yaw(Vec3f pos, OUT Vec3f focus) {
|
||||
void shake_camera_yaw(Vec3f pos, VEC_OUT Vec3f focus) {
|
||||
f32 dist;
|
||||
s16 pitch;
|
||||
s16 yaw;
|
||||
|
|
@ -5629,7 +5629,7 @@ static void unused_set_pos_rel_mario(struct Camera *c, f32 leftRight, f32 yOff,
|
|||
*
|
||||
* @warning Flips the Z axis, so that relative to `rotation`, -Z moves forwards and +Z moves backwards.
|
||||
*/
|
||||
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) {
|
||||
Vec3f unusedCopy;
|
||||
Vec3f pitchRotated;
|
||||
|
||||
|
|
@ -5683,7 +5683,7 @@ void determine_pushing_or_pulling_door(s16 *rotation) {
|
|||
*
|
||||
* @return Lakitu's next yaw, which is the same as the yaw passed in if no transition happened
|
||||
*/
|
||||
s16 next_lakitu_state(OUT Vec3f newPos, OUT Vec3f newFoc, Vec3f curPos, Vec3f curFoc,
|
||||
s16 next_lakitu_state(VEC_OUT Vec3f newPos, VEC_OUT Vec3f newFoc, Vec3f curPos, Vec3f curFoc,
|
||||
Vec3f oldPos, Vec3f oldFoc, s16 yaw) {
|
||||
s16 yawVelocity;
|
||||
s16 pitchVelocity;
|
||||
|
|
@ -7073,7 +7073,7 @@ s16 camera_course_processing(struct Camera *c) {
|
|||
* Move `pos` between the nearest floor and ceiling
|
||||
* @param lastGood unused, passed as the last position the camera was in
|
||||
*/
|
||||
void resolve_geometry_collisions(OUT Vec3f pos, UNUSED Vec3f lastGood) {
|
||||
void resolve_geometry_collisions(VEC_OUT Vec3f pos, UNUSED Vec3f lastGood) {
|
||||
f32 ceilY, floorY;
|
||||
struct Surface *surf;
|
||||
|
||||
|
|
@ -7120,7 +7120,7 @@ void resolve_geometry_collisions(OUT Vec3f pos, UNUSED Vec3f lastGood) {
|
|||
*
|
||||
* @return 3 if a wall is covering Mario, 1 if a wall is only near the camera.
|
||||
*/
|
||||
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) {
|
||||
UNUSED f32 unused1;
|
||||
struct WallCollisionData colData;
|
||||
struct Surface *wall;
|
||||
|
|
|
|||
|
|
@ -788,7 +788,7 @@ void stub_camera_3(UNUSED struct Camera *c);
|
|||
Converts an object's position to a `Vec3f` format.
|
||||
Useful for aligning object behaviors or interactions with the camera system
|
||||
|descriptionEnd| */
|
||||
void object_pos_to_vec3f(OUT Vec3f dst, struct Object *o);
|
||||
void object_pos_to_vec3f(VEC_OUT Vec3f dst, struct Object *o);
|
||||
|
||||
/* |description|
|
||||
Converts a `Vec3f` position to an object's internal format.
|
||||
|
|
@ -799,7 +799,7 @@ void vec3f_to_object_pos(struct Object *o, Vec3f src);
|
|||
/* |description|
|
||||
Converts an object's face angle to a `Vec3s` format
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|
|
||||
Converts a `Vec3s` angle to an object's face angle internal format
|
||||
|
|
@ -809,7 +809,7 @@ void vec3s_to_object_face_angle(struct Object *o, Vec3s src);
|
|||
/* |description|
|
||||
Converts an object's move angle to a `Vec3s` format
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|
|
||||
Converts a `Vec3s` angle to an object's move angle internal format
|
||||
|
|
@ -840,7 +840,7 @@ void set_handheld_shake(u8 mode);
|
|||
Activates a handheld camera shake effect.
|
||||
Calculates positional and focus adjustments to simulate manual movement
|
||||
|descriptionEnd| */
|
||||
void shake_camera_handheld(Vec3f pos, OUT Vec3f focus);
|
||||
void shake_camera_handheld(Vec3f pos, VEC_OUT Vec3f focus);
|
||||
|
||||
/* |description|
|
||||
Determines which C-buttons are currently pressed by the player.
|
||||
|
|
@ -854,13 +854,13 @@ s32 update_camera_hud_status(struct Camera *c);
|
|||
Checks for collisions between the camera and level geometry.
|
||||
Adjusts the camera's position to avoid clipping into walls or obstacles
|
||||
|descriptionEnd| */
|
||||
s32 collide_with_walls(OUT Vec3f pos, f32 offsetY, f32 radius);
|
||||
s32 collide_with_walls(VEC_OUT Vec3f pos, f32 offsetY, f32 radius);
|
||||
|
||||
/* |description|
|
||||
Clamps the camera's pitch angle between a maximum and minimum value.
|
||||
Prevents over-rotation and maintains a consistent viewing angle
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|
|
||||
Checks if a position is within 100 units of Mario's current position.
|
||||
|
|
@ -871,16 +871,17 @@ s32 is_within_100_units_of_mario(f32 posX, f32 posY, f32 posZ);
|
|||
|
||||
/* |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
|
||||
Uses asymptotic scaling for gradual adjustments or direct assignment.
|
||||
Returns FALSE if `dst` reaches `goal`
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
|
||||
/* |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
|
||||
Returns FALSE if `current` reaches the `target`
|
||||
|descriptionEnd| */
|
||||
s32 approach_f32_asymptotic_bool(f32 *current, f32 target, f32 multiplier);
|
||||
s32 approach_f32_asymptotic_bool(INOUT f32 *current, f32 target, f32 multiplier);
|
||||
|
||||
/* |description|
|
||||
Gradually approaches a floating-point value (`target`) using asymptotic smoothing.
|
||||
|
|
@ -891,9 +892,9 @@ f32 approach_f32_asymptotic(f32 current, f32 target, f32 multiplier);
|
|||
|
||||
/* |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
|
||||
Returns FALSE if `current` reaches `target`
|
||||
|descriptionEnd| */
|
||||
s32 approach_s16_asymptotic_bool(s16 *current, s16 target, s16 divisor);
|
||||
s32 approach_s16_asymptotic_bool(INOUT s16 *current, s16 target, s16 divisor);
|
||||
|
||||
/* |description|
|
||||
Gradually approaches a signed 16-bit integer (`target`) using asymptotic smoothing.
|
||||
|
|
@ -906,31 +907,32 @@ s32 approach_s16_asymptotic(s16 current, s16 target, s16 divisor);
|
|||
Smoothly transitions a 3D vector (`current`) towards a target vector (`target`) using asymptotic scaling.
|
||||
Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|
|
||||
Smoothly transitions a 3D vector (`current`) toward a target vector (`goal`) using asymptotic scaling.
|
||||
Allows gradual or instantaneous alignment of 3D positions. Scaling values (the `Mul` variables) for x, y, and z axes determine the speed of adjustment for each component
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |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
|
||||
Returns FALSE if `current` reaches the `target`
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |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
|
||||
Uses symmetric scaling for gradual or immediate adjustments.
|
||||
Returns FALSE if `current` reaches the `target`
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |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
|
||||
Returns FALSE if `current` reaches the `target`
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|
|
||||
Symmetrically approaches a floating-point value (`target`) with a fixed increment (`increment`) per frame.
|
||||
|
|
@ -942,13 +944,13 @@ f32 camera_approach_f32_symmetric(f32 value, f32 target, f32 increment);
|
|||
Generates a random 3D vector with short integer components.
|
||||
Useful for randomized offsets or environmental effects
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|
|
||||
Clamps a position within specified X and Z bounds and calculates the yaw angle from the origin.
|
||||
Prevents the camera from moving outside of the designated area
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|
|
||||
Determines if a range is obstructed by a surface relative to the camera.
|
||||
|
|
@ -961,7 +963,7 @@ Scales a point along a line between two 3D points (`from` and `to`).
|
|||
The scaling factor determines how far along the line the resulting point will be.
|
||||
The result is stored in the destination vector (`dest`)
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|
|
||||
Calculates the pitch angle (rotation around the X-axis) from one 3D point (`from`) to another (`to`).
|
||||
|
|
@ -976,10 +978,9 @@ Returns the yaw as a signed 16-bit integer
|
|||
s16 calculate_yaw(Vec3f from, Vec3f to);
|
||||
|
||||
/* |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`)
|
||||
|descriptionEnd| */
|
||||
void calculate_angles(Vec3f from, Vec3f to, s16 *pitch, s16 *yaw);
|
||||
void calculate_angles(Vec3f from, Vec3f to, RET s16 *pitch, RET s16 *yaw);
|
||||
|
||||
/* |description|
|
||||
Calculates the absolute distance between two 3D points (`a` and `b`).
|
||||
|
|
@ -1000,14 +1001,14 @@ Rotates a vector around the XZ-plane by a specified yaw angle.
|
|||
The result is stored in the destination vector (`dst`).
|
||||
Useful for rotating camera positions or object coordinates horizontally
|
||||
|descriptionEnd| */
|
||||
void rotate_in_xz(OUT Vec3f dst, Vec3f src, s16 yaw);
|
||||
void rotate_in_xz(VEC_OUT Vec3f dst, Vec3f src, s16 yaw);
|
||||
|
||||
/* |description|
|
||||
Rotates a vector around the YZ-plane by a specified pitch angle.
|
||||
The result is stored in the destination vector (`dst`).
|
||||
Useful for vertical camera rotations or object transformations
|
||||
|descriptionEnd| */
|
||||
void rotate_in_yz(OUT Vec3f dst, Vec3f src, s16 pitch);
|
||||
void rotate_in_yz(VEC_OUT Vec3f dst, Vec3f src, s16 pitch);
|
||||
|
||||
/* |description|
|
||||
Applies a pitch-based shake effect to the camera.
|
||||
|
|
@ -1038,19 +1039,19 @@ void set_pitch_shake_from_point(s16 mag, s16 decay, s16 inc, f32 maxDist, f32 po
|
|||
Activates a pitch-based shake effect.
|
||||
Adds vertical vibrational movement to the camera's behavior
|
||||
|descriptionEnd| */
|
||||
void shake_camera_pitch(Vec3f pos, OUT Vec3f focus);
|
||||
void shake_camera_pitch(Vec3f pos, VEC_OUT Vec3f focus);
|
||||
|
||||
/* |description|
|
||||
Activates a yaw-based shake effect.
|
||||
Adds horizontal vibrational movement to the camera's behavior
|
||||
|descriptionEnd| */
|
||||
void shake_camera_yaw(Vec3f pos, OUT Vec3f focus);
|
||||
void shake_camera_yaw(Vec3f pos, VEC_OUT Vec3f focus);
|
||||
|
||||
/* |description|
|
||||
Applies a roll-based shake effect to the camera.
|
||||
Simulates rotational disturbances caused by impacts or other events
|
||||
|descriptionEnd| */
|
||||
void shake_camera_roll(s16 *roll);
|
||||
void shake_camera_roll(INOUT s16 *roll);
|
||||
|
||||
/* |description|
|
||||
Calculates an outward radial offset based on the camera's yaw angle.
|
||||
|
|
@ -1158,13 +1159,13 @@ void approach_camera_height(struct Camera *c, f32 goal, f32 inc);
|
|||
Offsets a vector by rotating it in 3D space relative to a reference position.
|
||||
This is useful for creating radial effects or dynamic transformations
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|
|
||||
Transitions the camera to the next Lakitu state, updating position and focus.
|
||||
This function handles smooth transitions between different gameplay scenarios
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|Set the fixed camera base pos depending on the current level area|descriptionEnd| */
|
||||
void set_fixed_cam_axis_sa_lobby(UNUSED s16 preset);
|
||||
|
|
@ -1178,13 +1179,13 @@ s16 camera_course_processing(struct Camera *c);
|
|||
Resolves collisions between the camera and level geometry.
|
||||
Adjusts the camera's position to prevent clipping or intersecting with objects
|
||||
|descriptionEnd| */
|
||||
void resolve_geometry_collisions(OUT Vec3f pos, UNUSED Vec3f lastGood);
|
||||
void resolve_geometry_collisions(VEC_OUT Vec3f pos, UNUSED Vec3f lastGood);
|
||||
|
||||
/* |description|
|
||||
Rotates the camera to avoid walls or other obstructions.
|
||||
Ensures clear visibility of the player or target objects
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
|
||||
/* |description|
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ s32 is_anim_past_frame(struct MarioState *m, s16 animFrame) {
|
|||
* Rotates the animation's translation into the global coordinate system
|
||||
* and returns the animation's flags.
|
||||
*/
|
||||
s16 find_mario_anim_flags_and_translation(struct Object *obj, s32 yaw, OUT Vec3s translation) {
|
||||
s16 find_mario_anim_flags_and_translation(struct Object *obj, s32 yaw, VEC_OUT Vec3s translation) {
|
||||
if (!obj) { return 0; }
|
||||
f32 dx;
|
||||
f32 dz;
|
||||
|
|
@ -620,7 +620,7 @@ u32 mario_get_terrain_sound_addend(struct MarioState *m) {
|
|||
/**
|
||||
* Collides with walls and returns the most recent wall.
|
||||
*/
|
||||
struct Surface *resolve_and_return_wall_collisions(OUT Vec3f pos, f32 offset, f32 radius) {
|
||||
struct Surface *resolve_and_return_wall_collisions(VEC_OUT Vec3f pos, f32 offset, f32 radius) {
|
||||
struct WallCollisionData collisionData;
|
||||
struct Surface *wall = NULL;
|
||||
|
||||
|
|
@ -645,7 +645,7 @@ struct Surface *resolve_and_return_wall_collisions(OUT Vec3f pos, f32 offset, f3
|
|||
/**
|
||||
* Collides with walls and returns the wall collision data.
|
||||
*/
|
||||
void resolve_and_return_wall_collisions_data(OUT Vec3f pos, f32 offset, f32 radius, struct WallCollisionData* collisionData) {
|
||||
void resolve_and_return_wall_collisions_data(VEC_OUT Vec3f pos, f32 offset, f32 radius, struct WallCollisionData* collisionData) {
|
||||
if (!collisionData || !pos) { return; }
|
||||
|
||||
collisionData->x = pos[0];
|
||||
|
|
@ -664,7 +664,7 @@ void resolve_and_return_wall_collisions_data(OUT Vec3f pos, f32 offset, f32 radi
|
|||
/**
|
||||
* Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer).
|
||||
*/
|
||||
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct Surface **ceil) {
|
||||
f32 vec3f_find_ceil(Vec3f pos, f32 height, RET struct Surface **ceil) {
|
||||
if (!ceil) { return 0; }
|
||||
UNUSED f32 unused;
|
||||
|
||||
|
|
@ -676,7 +676,7 @@ f32 vec3f_find_ceil(Vec3f pos, f32 height, struct Surface **ceil) {
|
|||
* Prevents exposed ceiling bug
|
||||
*/
|
||||
// Prevent exposed ceilings
|
||||
f32 vec3f_mario_ceil(Vec3f pos, f32 height, struct Surface **ceil) {
|
||||
f32 vec3f_mario_ceil(Vec3f pos, f32 height, RET struct Surface **ceil) {
|
||||
if (!ceil) { return 0; }
|
||||
if (gLevelValues.fixCollisionBugs) {
|
||||
height = MAX(height + 80.0f, pos[1] - 2);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ s32 is_anim_past_frame(struct MarioState *m, s16 animFrame);
|
|||
Retrieves the current animation flags and calculates the translation for Mario's animation, rotating it into the global coordinate system based on `yaw`.
|
||||
Useful for determining positional offsets from animations (e.g., stepping forward in a walk animation) and applying them to Mario's position
|
||||
|descriptionEnd| */
|
||||
s16 find_mario_anim_flags_and_translation(struct Object *o, s32 yaw, OUT Vec3s translation);
|
||||
s16 find_mario_anim_flags_and_translation(struct Object *o, s32 yaw, VEC_OUT Vec3s translation);
|
||||
|
||||
/* |description|
|
||||
Applies the translation from Mario's current animation to his world position. Considers animation flags (horizontal/vertical translation)
|
||||
|
|
@ -166,15 +166,25 @@ u32 mario_get_terrain_sound_addend(struct MarioState *m);
|
|||
Checks for and resolves wall collisions at a given position `pos`, returning the last wall encountered. Primarily used to prevent Mario from going through walls.
|
||||
Useful for collision detection when updating Mario's movement or adjusting his position
|
||||
|descriptionEnd| */
|
||||
struct Surface *resolve_and_return_wall_collisions(OUT Vec3f pos, f32 offset, f32 radius);
|
||||
struct Surface *resolve_and_return_wall_collisions(VEC_OUT Vec3f pos, f32 offset, f32 radius);
|
||||
|
||||
/* |description|
|
||||
Similar to `resolve_and_return_wall_collisions` but also returns detailed collision data (`WallCollisionData`). This can handle multiple walls and store them for further checks
|
||||
|descriptionEnd| */
|
||||
void resolve_and_return_wall_collisions_data(OUT Vec3f pos, f32 offset, f32 radius, struct WallCollisionData* collisionData);
|
||||
void resolve_and_return_wall_collisions_data(VEC_OUT Vec3f pos, f32 offset, f32 radius, struct WallCollisionData* collisionData);
|
||||
|
||||
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct Surface **ceil);
|
||||
f32 vec3f_mario_ceil(Vec3f pos, f32 height, struct Surface **ceil);
|
||||
/* |description|
|
||||
Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer).
|
||||
Returns the ceiling height and surface
|
||||
|descriptionEnd| */
|
||||
f32 vec3f_find_ceil(Vec3f pos, f32 height, RET struct Surface **ceil);
|
||||
|
||||
/* |description|
|
||||
Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer).
|
||||
Prevents exposed ceiling bug.
|
||||
Returns the ceiling height and surface
|
||||
|descriptionEnd| */
|
||||
f32 vec3f_mario_ceil(Vec3f pos, f32 height, RET struct Surface **ceil);
|
||||
|
||||
/* |description|
|
||||
Determines if Mario is facing downhill relative to his floor angle, optionally accounting for forward velocity direction. Returns true if he is oriented down the slope.
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ s32 act_top_of_pole(struct MarioState *m) {
|
|||
/* |description|
|
||||
Performs a single step of movement while Mario is hanging from a ceiling. It handles wall collisions and checks the floor and ceiling to determine if Mario remains hanging, leaves the ceiling, or hits it
|
||||
|descriptionEnd| */
|
||||
s32 perform_hanging_step(struct MarioState *m, OUT Vec3f nextPos) {
|
||||
s32 perform_hanging_step(struct MarioState *m, VEC_OUT Vec3f nextPos) {
|
||||
if (!m) { return 0; }
|
||||
UNUSED s32 unused;
|
||||
struct Surface *ceil;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ static f32 get_buoyancy(struct MarioState *m) {
|
|||
}
|
||||
|
||||
/* |description|Performs a full water movement step where ceilings, floors, and walls are handled. Generally, you should use `perform_water_step` for the full step functionality|descriptionEnd| */
|
||||
u32 perform_water_full_step(struct MarioState *m, OUT Vec3f nextPos) {
|
||||
u32 perform_water_full_step(struct MarioState *m, VEC_OUT Vec3f nextPos) {
|
||||
if (!m) { return 0; }
|
||||
struct WallCollisionData wcd = { 0 };
|
||||
struct Surface *ceil;
|
||||
|
|
@ -136,7 +136,7 @@ u32 perform_water_full_step(struct MarioState *m, OUT Vec3f nextPos) {
|
|||
}
|
||||
|
||||
/* |description|Calculates a water current and outputs it in `step`|descriptionEnd| */
|
||||
void apply_water_current(struct MarioState *m, OUT Vec3f step) {
|
||||
void apply_water_current(struct MarioState *m, VEC_OUT Vec3f step) {
|
||||
if (!m) { return; }
|
||||
s32 i;
|
||||
f32 whirlpoolRadius = 2000.0f;
|
||||
|
|
|
|||
|
|
@ -251,10 +251,8 @@ void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ)
|
|||
obj->header.gfx.throwMatrix = throwMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines an object's forward speed multiplier.
|
||||
*/
|
||||
void calc_obj_friction(f32 *objFriction, f32 floor_nY) {
|
||||
/* |description|Determines an object's forward speed multiplier.|descriptionEnd| */
|
||||
void calc_obj_friction(RET f32 *objFriction, f32 floor_nY) {
|
||||
if (!o) { return; }
|
||||
if (!objFriction) { return; }
|
||||
if (floor_nY < 0.2 && o->oFriction < 0.9999) {
|
||||
|
|
@ -760,7 +758,7 @@ s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range) {
|
|||
}
|
||||
|
||||
/* |description|Finds any wall collisions and returns what the displacement vector would be.|descriptionEnd| */
|
||||
s8 obj_find_wall_displacement(OUT Vec3f dist, f32 x, f32 y, f32 z, f32 radius) {
|
||||
s8 obj_find_wall_displacement(VEC_OUT Vec3f dist, f32 x, f32 y, f32 z, f32 radius) {
|
||||
struct WallCollisionData hitbox;
|
||||
UNUSED u8 filler[0x20];
|
||||
|
||||
|
|
|
|||
|
|
@ -419,8 +419,8 @@ s16 obj_turn_pitch_toward_mario(struct MarioState* m, f32 targetOffsetY, s16 tur
|
|||
return targetPitch;
|
||||
}
|
||||
|
||||
/* |description|Approaches a `target` for `px` using `delta`|descriptionEnd| */
|
||||
s32 approach_f32_ptr(f32 *px, f32 target, f32 delta) {
|
||||
/* |description|Approaches a `target` for `px` using `delta`. Returns TRUE if `px` reaches `target`|descriptionEnd| */
|
||||
s32 approach_f32_ptr(INOUT f32 *px, f32 target, f32 delta) {
|
||||
if (!px) { return FALSE; }
|
||||
if (*px > target) {
|
||||
delta = -delta;
|
||||
|
|
@ -495,8 +495,8 @@ s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* |description|Smoothly turns the `angle` integer pointer using parameters, although usage in Lua is difficult due to the amount of pointers needed|descriptionEnd| */
|
||||
s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion,
|
||||
/* |description|Smoothly turns `angle` and adjust `angleVel` using parameters. Returns TRUE if `angle` reaches `targetAngle`|descriptionEnd| */
|
||||
s32 obj_smooth_turn(INOUT s16 *angleVel, INOUT s32 *angle, s16 targetAngle, f32 targetSpeedProportion,
|
||||
s16 accel, s16 minSpeed, s16 maxSpeed) {
|
||||
s16 currentSpeed;
|
||||
s16 currentAngle = (s16)(*angle);
|
||||
|
|
@ -537,13 +537,12 @@ s16 obj_random_fixed_turn(s16 delta) {
|
|||
}
|
||||
|
||||
/* |description|
|
||||
Begin by increasing the current object's scale by `*scaleVel`, and slowly decreasing
|
||||
`scaleVel`. Once the object starts to shrink, wait a bit, and then begin to
|
||||
scale the object toward `endScale`. The first time it reaches below
|
||||
`shootFireScale` during this time, return 1.
|
||||
Begin by increasing the current object's scale by `scaleVel`, and slowly decreasing `scaleVel`.
|
||||
Once the object starts to shrink, wait a bit, and then begin to scale the object toward `endScale`.
|
||||
The first time it reaches below `shootFireScale` during this time, return 1.
|
||||
Return -1 once it's reached endScale
|
||||
|descriptionEnd| */
|
||||
s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale) {
|
||||
s32 obj_grow_then_shrink(INOUT f32 *scaleVel, f32 shootFireScale, f32 endScale) {
|
||||
if (!o) { return 0; }
|
||||
if (o->oTimer < 2) {
|
||||
o->header.gfx.scale[0] += *scaleVel;
|
||||
|
|
@ -563,8 +562,8 @@ s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* |description||descriptionEnd| */
|
||||
s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel,
|
||||
/* |description|Oscillates `value` towards `target`. Returns TRUE when `value` reaches `target`|descriptionEnd| */
|
||||
s32 oscillate_toward(INOUT s32 *value, INOUT f32 *vel, s32 target, f32 velCloseToZero, f32 accel,
|
||||
f32 slowdown) {
|
||||
if (value == NULL || vel == NULL) { return FALSE; }
|
||||
s32 startValue = *value;
|
||||
|
|
@ -591,7 +590,7 @@ s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 a
|
|||
}
|
||||
|
||||
/* |description|Update the current object's blinking through `oAnimState`|descriptionEnd| */
|
||||
void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange,
|
||||
void obj_update_blinking(INOUT s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange,
|
||||
s16 blinkLength) {
|
||||
if (!o) { return; }
|
||||
if (*blinkTimer != 0) {
|
||||
|
|
@ -607,8 +606,8 @@ void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRa
|
|||
}
|
||||
}
|
||||
|
||||
/* |description|Resolves "collisions" with the current object and other objects by offsetting the current object's position|descriptionEnd| */
|
||||
s32 obj_resolve_object_collisions(s32 *targetYaw) {
|
||||
/* |description|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|descriptionEnd| */
|
||||
s32 obj_resolve_object_collisions(RET s32 *targetYaw) {
|
||||
if (!o) { return 0; }
|
||||
struct Object *otherObject;
|
||||
f32 dx;
|
||||
|
|
@ -655,8 +654,8 @@ s32 obj_resolve_object_collisions(s32 *targetYaw) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* |description|Bounces the current object off of walls, edges, and objects using `*targetYaw`|descriptionEnd| */
|
||||
s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw) {
|
||||
/* |description|Bounces the current object off of walls, edges, and objects. Returns TRUE and the target yaw if there is collision|descriptionEnd| */
|
||||
s32 obj_bounce_off_walls_edges_objects(RET s32 *targetYaw) {
|
||||
if (!o) { return 0; }
|
||||
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
|
||||
*targetYaw = cur_obj_reflect_move_angle_off_wall();
|
||||
|
|
@ -961,7 +960,8 @@ s32 obj_move_for_one_second(s32 endAction) {
|
|||
* attack Mario (e.g. fly guy shooting fire or lunging), especially when combined
|
||||
* with partial updates.
|
||||
*/
|
||||
void treat_far_home_as_mario(f32 threshold, s32* distanceToPlayer, s32* angleToPlayer) {
|
||||
/* |description|Treats far home as Mario. Returns the distance and angle to the nearest player|descriptionEnd| */
|
||||
void treat_far_home_as_mario(f32 threshold, RET s32* distanceToPlayer, RET s32* angleToPlayer) {
|
||||
if (!o) { return; }
|
||||
f32 dx = o->oHomeX - o->oPosX;
|
||||
f32 dy = o->oHomeY - o->oPosY;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ static s8 sLevelsWithRooms[] = { LEVEL_BBH, LEVEL_CASTLE, LEVEL_HMC, -1 };
|
|||
|
||||
#define o gCurrentObject
|
||||
|
||||
s32 clear_move_flag(u32 *bitSet, s32 flag) {
|
||||
/* |description|Clears the `flag` from the `bitSet`|descriptionEnd| */
|
||||
s32 clear_move_flag(INOUT u32 *bitSet, s32 flag) {
|
||||
if (*bitSet & flag) {
|
||||
*bitSet &= flag ^ 0xFFFFFFFF;
|
||||
return TRUE;
|
||||
|
|
@ -273,7 +274,7 @@ void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1) {
|
|||
a1->oPosZ = spC * a0[0][2] + sp8 * a0[1][2] + sp4 * a0[2][2] + a0[3][2];
|
||||
}
|
||||
|
||||
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) {
|
||||
if (obj == NULL) { return; }
|
||||
dst[0][0] = src[0][0] * obj->header.gfx.scale[0];
|
||||
dst[1][0] = src[1][0] * obj->header.gfx.scale[1];
|
||||
|
|
@ -296,7 +297,7 @@ void obj_apply_scale_to_matrix(struct Object *obj, OUT Mat4 dst, Mat4 src) {
|
|||
dst[3][3] = src[3][3];
|
||||
}
|
||||
|
||||
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) {
|
||||
f32 spC, sp8, sp4;
|
||||
|
||||
spC = a2[3][0] * a2[0][0] + a2[3][1] * a2[0][1] + a2[3][2] * a2[0][2];
|
||||
|
|
@ -384,7 +385,7 @@ void cur_obj_forward_vel_approach_upward(f32 target, f32 increment) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 approach_f32_signed(f32 *value, f32 target, f32 increment) {
|
||||
s32 approach_f32_signed(INOUT f32 *value, f32 target, f32 increment) {
|
||||
if (value == NULL) { return 0; }
|
||||
s32 reachedTarget = FALSE;
|
||||
|
||||
|
|
@ -825,7 +826,7 @@ Multiplies a vector by a matrix of the form:
|
|||
`| 0 0 0 1 |`
|
||||
i.e. a matrix representing a linear transformation over 3 space
|
||||
|descriptionEnd| */
|
||||
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) {
|
||||
s32 i;
|
||||
for (i = 0; i < 3; i++) {
|
||||
dst[i] = m[0][i] * v[0] + m[1][i] * v[1] + m[2][i] * v[2];
|
||||
|
|
@ -840,7 +841,7 @@ Multiplies a vector by the transpose of a matrix of the form:
|
|||
`| 0 0 0 1 |`
|
||||
i.e. a matrix representing a linear transformation over 3 space
|
||||
|descriptionEnd| */
|
||||
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) {
|
||||
s32 i;
|
||||
for (i = 0; i < 3; i++) {
|
||||
dst[i] = m[i][0] * v[0] + m[i][1] * v[1] + m[i][2] * v[2];
|
||||
|
|
@ -1079,7 +1080,7 @@ struct Object* cur_obj_find_nearest_pole(void) {
|
|||
return closestObj;
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!behavior || !dist) { return NULL; }
|
||||
|
||||
behavior = smlua_override_behavior(behavior);
|
||||
|
|
@ -1519,7 +1520,7 @@ struct Surface *cur_obj_update_floor_height_and_get_floor(void) {
|
|||
return floor;
|
||||
}
|
||||
|
||||
void apply_drag_to_value(f32 *value, f32 dragStrength) {
|
||||
void apply_drag_to_value(INOUT f32 *value, f32 dragStrength) {
|
||||
f32 decel;
|
||||
|
||||
if (*value != 0) {
|
||||
|
|
|
|||
|
|
@ -73,14 +73,14 @@ Gfx *geo_switch_area(s32 callContext, struct GraphNode *node);
|
|||
#endif
|
||||
Gfx *geo_choose_area_ext(s32 callContext, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1);
|
||||
void obj_apply_scale_to_matrix(struct Object *obj, OUT Mat4 dst, Mat4 src);
|
||||
void create_transformation_from_matrices(OUT Mat4 a0, Mat4 a1, Mat4 a2);
|
||||
void obj_apply_scale_to_matrix(struct Object *obj, VEC_OUT Mat4 dst, Mat4 src);
|
||||
void create_transformation_from_matrices(VEC_OUT Mat4 a0, Mat4 a1, Mat4 a2);
|
||||
void obj_set_held_state(struct Object *obj, const BehaviorScript *heldBehavior);
|
||||
f32 lateral_dist_between_objects(struct Object *obj1, struct Object *obj2);
|
||||
f32 dist_between_objects(struct Object *obj1, struct Object *obj2);
|
||||
f32 dist_between_object_and_point(struct Object *obj, f32 pointX, f32 pointY, f32 pointZ);
|
||||
void cur_obj_forward_vel_approach_upward(f32 target, f32 increment);
|
||||
s32 approach_f32_signed(f32 *value, f32 target, f32 increment);
|
||||
s32 approach_f32_signed(INOUT f32 *value, f32 target, f32 increment);
|
||||
f32 approach_f32_symmetric(f32 value, f32 target, f32 increment);
|
||||
s16 approach_s16_symmetric(s16 value, s16 target, s16 increment);
|
||||
s32 cur_obj_rotate_yaw_toward(s16 target, s16 increment);
|
||||
|
|
@ -119,8 +119,8 @@ void obj_copy_pos_and_angle(struct Object *dst, struct Object *src);
|
|||
void obj_copy_pos(struct Object *dst, struct Object *src);
|
||||
void obj_copy_angle(struct Object *dst, struct Object *src);
|
||||
void obj_set_gfx_pos_from_pos(struct Object *obj);
|
||||
void linear_mtxf_mul_vec3f(Mat4 m, OUT Vec3f dst, Vec3f v);
|
||||
void linear_mtxf_transpose_mul_vec3f(Mat4 m, OUT Vec3f dst, Vec3f v);
|
||||
void linear_mtxf_mul_vec3f(Mat4 m, VEC_OUT Vec3f dst, Vec3f v);
|
||||
void linear_mtxf_transpose_mul_vec3f(Mat4 m, VEC_OUT Vec3f dst, Vec3f v);
|
||||
void obj_apply_scale_to_transform(struct Object *obj);
|
||||
void obj_copy_scale(struct Object *dst, struct Object *src);
|
||||
void obj_scale_xyz(struct Object* obj, f32 xScale, f32 yScale, f32 zScale);
|
||||
|
|
@ -143,7 +143,7 @@ u32 get_object_list_from_behavior(const BehaviorScript *behavior);
|
|||
struct Object *cur_obj_nearest_object_with_behavior(const BehaviorScript *behavior);
|
||||
f32 cur_obj_dist_to_nearest_object_with_behavior(const BehaviorScript* behavior);
|
||||
struct Object* cur_obj_find_nearest_pole(void);
|
||||
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);
|
||||
u16 cur_obj_count_objects_with_behavior(const BehaviorScript* behavior, f32 dist);
|
||||
struct Object *find_object_with_behavior(const BehaviorScript *behavior);
|
||||
struct Object *find_unimportant_object(void);
|
||||
|
|
|
|||
|
|
@ -791,7 +791,7 @@ void save_file_set_cap_pos(s16 x, s16 y, s16 z) {
|
|||
save_file_set_flags(SAVE_FLAG_CAP_ON_GROUND);
|
||||
}
|
||||
|
||||
s32 save_file_get_cap_pos(OUT Vec3s capPos) {
|
||||
s32 save_file_get_cap_pos(VEC_OUT Vec3s capPos) {
|
||||
if (INVALID_FILE_INDEX(gCurrSaveFileNum - 1)) { return 0; }
|
||||
if (INVALID_SRC_SLOT(gSaveFileUsingBackupSlot)) { return 0; }
|
||||
struct SaveFile *saveFile = &gSaveBuffer.files[gCurrSaveFileNum - 1][gSaveFileUsingBackupSlot];
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ void save_file_set_cap_pos(s16 x, s16 y, s16 z);
|
|||
Retrieves the current position of Mario's cap, if it is on the ground in the current level and area. The position is stored in the provided `capPos` parameter.
|
||||
Useful for tracking the cap's location after it has been dropped or lost
|
||||
|descriptionEnd| */
|
||||
s32 save_file_get_cap_pos(OUT Vec3s capPos);
|
||||
s32 save_file_get_cap_pos(VEC_OUT Vec3s capPos);
|
||||
|
||||
void save_file_set_sound_mode(u16 mode);
|
||||
|
||||
|
|
|
|||
|
|
@ -736,7 +736,7 @@ f32 djui_hud_get_fov_coeff() {
|
|||
|
||||
bool gDjuiHudToWorldCalcViewport = true;
|
||||
|
||||
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) {
|
||||
if (!gCamera) { return false; }
|
||||
hud_rotate_and_translate_vec3f(pos, &gCamera->mtx, out);
|
||||
if (out[2] >= 0.0f) {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ f32 get_current_fov();
|
|||
/* |description|Gets the camera FOV coefficient|descriptionEnd| */
|
||||
f32 djui_hud_get_fov_coeff();
|
||||
/* |description|Converts a world position to screen position|descriptionEnd| */
|
||||
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);
|
||||
/* |description|Checks if the DJUI pause menu is created|descriptionEnd| */
|
||||
bool djui_hud_is_pause_menu_created(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -608,7 +608,7 @@ static void import_texture(int tile) {
|
|||
//printf("Time diff: %d\n", t1 - t0);
|
||||
}
|
||||
|
||||
static void OPTIMIZE_O3 gfx_transposed_matrix_mul(OUT Vec3f res, const Vec3f a, const Mat4 b) {
|
||||
static void OPTIMIZE_O3 gfx_transposed_matrix_mul(VEC_OUT Vec3f res, const Vec3f a, const Mat4 b) {
|
||||
res[0] = a[0] * b[0][0] + a[1] * b[0][1] + a[2] * b[0][2];
|
||||
res[1] = a[0] * b[1][0] + a[1] * b[1][1] + a[2] * b[1][2];
|
||||
res[2] = a[0] * b[2][0] + a[1] * b[2][1] + a[2] * b[2][2];
|
||||
|
|
@ -695,7 +695,7 @@ static float gfx_adjust_x_for_aspect_ratio(float x) {
|
|||
return x * gfx_current_dimensions.x_adjust_ratio;
|
||||
}
|
||||
|
||||
static OPTIMIZE_O3 void gfx_local_to_world_space(OUT Vec3f pos, OUT Vec3f normal) {
|
||||
static OPTIMIZE_O3 void gfx_local_to_world_space(VEC_OUT Vec3f pos, VEC_OUT Vec3f normal) {
|
||||
if (!sHasInverseCameraMatrix) { return; }
|
||||
|
||||
// strip view matrix off of the model-view matrix
|
||||
|
|
|
|||
|
|
@ -6,8 +6,16 @@
|
|||
//
|
||||
|
||||
// A macro to tell autogen which function parameters are modified during the function call and should be pushed again
|
||||
// Only works with Vec3, Mat4 and Color types
|
||||
#define OUT
|
||||
// Only suitable for `Vec2`, `Vec3`, `Vec4`, `Mat4` and `Color` types
|
||||
#define VEC_OUT
|
||||
|
||||
// A macro to tell autogen which function parameters are return values
|
||||
// Such parameters must be pointers, they don't appear in the Lua definition of the function
|
||||
#define RET
|
||||
|
||||
// A macro to tell autogen which function parameters are both input and output values
|
||||
// Such parameters must be pointers, they appear as regular types as function parameters
|
||||
#define INOUT
|
||||
|
||||
// A macro to tell autogen this parameter can be omitted and replaced by 'nil' during a function call
|
||||
// Optional parameters must be contiguous until the last parameter (a mandatory parameter following an optional parameter is not allowed)
|
||||
|
|
|
|||
|
|
@ -70,38 +70,38 @@ bool smlua_valid_lvt(u16 lvt) {
|
|||
|
||||
static const char *sLuaLvtNames[] = {
|
||||
[LVT_BOOL] = "bool",
|
||||
[LVT_BOOL_P] = "bool Pointer",
|
||||
[LVT_BOOL_P] = "bool pointer",
|
||||
[LVT_U8] = "u8",
|
||||
[LVT_U8_P] = "u8 Pointer",
|
||||
[LVT_U8_P] = "u8 pointer",
|
||||
[LVT_U16] = "u16",
|
||||
[LVT_U16_P] = "u16 Pointer",
|
||||
[LVT_U16_P] = "u16 pointer",
|
||||
[LVT_U32] = "u32",
|
||||
[LVT_U32_P] = "u32 Pointer",
|
||||
[LVT_U32_P] = "u32 pointer",
|
||||
[LVT_S8] = "s8",
|
||||
[LVT_S8_P] = "s8 Pointer",
|
||||
[LVT_S8_P] = "s8 pointer",
|
||||
[LVT_S16] = "s16",
|
||||
[LVT_S16_P] = "s16 Pointer",
|
||||
[LVT_S16_P] = "s16 pointer",
|
||||
[LVT_S32] = "s32",
|
||||
[LVT_S32_P] = "s32 Pointer",
|
||||
[LVT_S32_P] = "s32 pointer",
|
||||
[LVT_F32] = "f32",
|
||||
[LVT_F32_P] = "f32 Pointer",
|
||||
[LVT_F32_P] = "f32 pointer",
|
||||
[LVT_U64] = "u64",
|
||||
[LVT_U64_P] = "u64 Pointer",
|
||||
[LVT_U64_P] = "u64 pointer",
|
||||
[LVT_COBJECT] = "CObject",
|
||||
[LVT_COBJECT_P] = "CObject Pointer",
|
||||
[LVT_COBJECT_P] = "CObject pointer",
|
||||
[LVT_STRING] = "string",
|
||||
[LVT_STRING_P] = "string Pointer",
|
||||
[LVT_BEHAVIORSCRIPT_P] = "BehaviorScript Pointer",
|
||||
[LVT_OBJECTANIMPOINTER_P] = "ObjectAnimPointer Pointer",
|
||||
[LVT_COLLISION_P] = "Collision Pointer",
|
||||
[LVT_LEVELSCRIPT_P] = "LevelScript Pointer",
|
||||
[LVT_TRAJECTORY_P] = "Trajectory Pointer",
|
||||
[LVT_TEXTURE_P] = "Texture Pointer",
|
||||
[LVT_STRING_P] = "string pointer",
|
||||
[LVT_BEHAVIORSCRIPT_P] = "BehaviorScript pointer",
|
||||
[LVT_OBJECTANIMPOINTER_P] = "ObjectAnimPointer pointer",
|
||||
[LVT_COLLISION_P] = "Collision pointer",
|
||||
[LVT_LEVELSCRIPT_P] = "LevelScript pointer",
|
||||
[LVT_TRAJECTORY_P] = "Trajectory pointer",
|
||||
[LVT_TEXTURE_P] = "Texture pointer",
|
||||
[LVT_LUAFUNCTION] = "LuaFunction",
|
||||
[LVT_LUATABLE] = "LuaTable",
|
||||
[LVT_POINTER] = "Pointer",
|
||||
[LVT_FUNCTION] = "Function",
|
||||
[LVT_MAX] = "Max",
|
||||
[LVT_POINTER] = "pointer",
|
||||
[LVT_FUNCTION] = "function",
|
||||
[LVT_MAX] = "unknown",
|
||||
};
|
||||
|
||||
const char *smlua_get_lvt_name(u16 lvt) {
|
||||
|
|
|
|||
|
|
@ -1498,83 +1498,52 @@ static struct LuaObjectField sModAudioFields[LUA_MOD_AUDIO_FIELD_COUNT] = {
|
|||
{ "loaded", LVT_BOOL, offsetof(struct ModAudio, loaded), true, LOT_NONE, 1, sizeof(bool) },
|
||||
};
|
||||
|
||||
static const char FUNCTION__mod_fs_clear[] = "mod_fs_clear";
|
||||
static const char FUNCTION__mod_fs_copy_file[] = "mod_fs_copy_file";
|
||||
static const char FUNCTION__mod_fs_create_file[] = "mod_fs_create_file";
|
||||
static const char FUNCTION__mod_fs_delete[] = "mod_fs_delete";
|
||||
static const char FUNCTION__mod_fs_delete_file[] = "mod_fs_delete_file";
|
||||
static const char FUNCTION__mod_fs_get_file[] = "mod_fs_get_file";
|
||||
static const char FUNCTION__mod_fs_get_filename[] = "mod_fs_get_filename";
|
||||
static const char FUNCTION__mod_fs_move_file[] = "mod_fs_move_file";
|
||||
static const char FUNCTION__mod_fs_save[] = "mod_fs_save";
|
||||
static const char FUNCTION__mod_fs_set_public[] = "mod_fs_set_public";
|
||||
|
||||
#define LUA_MOD_FS_FIELD_COUNT 15
|
||||
static struct LuaObjectField sModFsFields[LUA_MOD_FS_FIELD_COUNT] = {
|
||||
{ "clear", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_clear, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "copy_file", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_copy_file, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "create_file", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_create_file, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "delete", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_delete, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "delete_file", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_delete_file, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "get_file", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_get_file, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "get_filename", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_get_filename, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "isPublic", LVT_BOOL, offsetof(struct ModFs, isPublic), true, LOT_NONE, 1, sizeof(bool) },
|
||||
{ "mod", LVT_COBJECT_P, offsetof(struct ModFs, mod), true, LOT_MOD, 1, sizeof(struct Mod*) },
|
||||
{ "modPath", LVT_STRING, offsetof(struct ModFs, modPath), true, LOT_NONE, 1, sizeof(char) },
|
||||
{ "move_file", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_move_file, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "numFiles", LVT_U16, offsetof(struct ModFs, numFiles), true, LOT_NONE, 1, sizeof(u16) },
|
||||
{ "save", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_save, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "set_public", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_set_public, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "totalSize", LVT_U32, offsetof(struct ModFs, totalSize), true, LOT_NONE, 1, sizeof(u32) },
|
||||
{ "clear", LVT_FUNCTION, (size_t) "mod_fs_clear", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "copy_file", LVT_FUNCTION, (size_t) "mod_fs_copy_file", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "create_file", LVT_FUNCTION, (size_t) "mod_fs_create_file", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "delete", LVT_FUNCTION, (size_t) "mod_fs_delete", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "delete_file", LVT_FUNCTION, (size_t) "mod_fs_delete_file", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "get_file", LVT_FUNCTION, (size_t) "mod_fs_get_file", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "get_filename", LVT_FUNCTION, (size_t) "mod_fs_get_filename", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "isPublic", LVT_BOOL, offsetof(struct ModFs, isPublic), true, LOT_NONE, 1, sizeof(bool) },
|
||||
{ "mod", LVT_COBJECT_P, offsetof(struct ModFs, mod), true, LOT_MOD, 1, sizeof(struct Mod*) },
|
||||
{ "modPath", LVT_STRING, offsetof(struct ModFs, modPath), true, LOT_NONE, 1, sizeof(char) },
|
||||
{ "move_file", LVT_FUNCTION, (size_t) "mod_fs_move_file", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "numFiles", LVT_U16, offsetof(struct ModFs, numFiles), true, LOT_NONE, 1, sizeof(u16) },
|
||||
{ "save", LVT_FUNCTION, (size_t) "mod_fs_save", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "set_public", LVT_FUNCTION, (size_t) "mod_fs_set_public", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "totalSize", LVT_U32, offsetof(struct ModFs, totalSize), true, LOT_NONE, 1, sizeof(u32) },
|
||||
};
|
||||
|
||||
static const char FUNCTION__mod_fs_file_erase[] = "mod_fs_file_erase";
|
||||
static const char FUNCTION__mod_fs_file_fill[] = "mod_fs_file_fill";
|
||||
static const char FUNCTION__mod_fs_file_is_eof[] = "mod_fs_file_is_eof";
|
||||
static const char FUNCTION__mod_fs_file_read_bool[] = "mod_fs_file_read_bool";
|
||||
static const char FUNCTION__mod_fs_file_read_bytes[] = "mod_fs_file_read_bytes";
|
||||
static const char FUNCTION__mod_fs_file_read_integer[] = "mod_fs_file_read_integer";
|
||||
static const char FUNCTION__mod_fs_file_read_line[] = "mod_fs_file_read_line";
|
||||
static const char FUNCTION__mod_fs_file_read_number[] = "mod_fs_file_read_number";
|
||||
static const char FUNCTION__mod_fs_file_read_string[] = "mod_fs_file_read_string";
|
||||
static const char FUNCTION__mod_fs_file_rewind[] = "mod_fs_file_rewind";
|
||||
static const char FUNCTION__mod_fs_file_seek[] = "mod_fs_file_seek";
|
||||
static const char FUNCTION__mod_fs_file_set_public[] = "mod_fs_file_set_public";
|
||||
static const char FUNCTION__mod_fs_file_set_text_mode[] = "mod_fs_file_set_text_mode";
|
||||
static const char FUNCTION__mod_fs_file_write_bool[] = "mod_fs_file_write_bool";
|
||||
static const char FUNCTION__mod_fs_file_write_bytes[] = "mod_fs_file_write_bytes";
|
||||
static const char FUNCTION__mod_fs_file_write_integer[] = "mod_fs_file_write_integer";
|
||||
static const char FUNCTION__mod_fs_file_write_line[] = "mod_fs_file_write_line";
|
||||
static const char FUNCTION__mod_fs_file_write_number[] = "mod_fs_file_write_number";
|
||||
static const char FUNCTION__mod_fs_file_write_string[] = "mod_fs_file_write_string";
|
||||
|
||||
#define LUA_MOD_FS_FILE_FIELD_COUNT 25
|
||||
static struct LuaObjectField sModFsFileFields[LUA_MOD_FS_FILE_FIELD_COUNT] = {
|
||||
{ "erase", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_erase, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "filepath", LVT_STRING, offsetof(struct ModFsFile, filepath), true, LOT_NONE, 1, sizeof(char) },
|
||||
{ "fill", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_fill, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "isPublic", LVT_BOOL, offsetof(struct ModFsFile, isPublic), true, LOT_NONE, 1, sizeof(bool) },
|
||||
{ "isText", LVT_BOOL, offsetof(struct ModFsFile, isText), true, LOT_NONE, 1, sizeof(bool) },
|
||||
{ "is_eof", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_is_eof, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "modFs", LVT_COBJECT_P, offsetof(struct ModFsFile, modFs), true, LOT_MODFS, 1, sizeof(struct ModFs*) },
|
||||
{ "offset", LVT_U32, offsetof(struct ModFsFile, offset), true, LOT_NONE, 1, sizeof(u32) },
|
||||
{ "read_bool", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_read_bool, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_bytes", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_read_bytes, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_integer", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_read_integer, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_line", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_read_line, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_number", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_read_number, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_string", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_read_string, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "rewind", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_rewind, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "seek", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_seek, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "set_public", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_set_public, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "set_text_mode", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_set_text_mode, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "size", LVT_U32, offsetof(struct ModFsFile, size), true, LOT_NONE, 1, sizeof(u32) },
|
||||
{ "write_bool", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_write_bool, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_bytes", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_write_bytes, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_integer", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_write_integer, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_line", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_write_line, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_number", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_write_number, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_string", LVT_FUNCTION, (size_t) FUNCTION__mod_fs_file_write_string, true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "erase", LVT_FUNCTION, (size_t) "mod_fs_file_erase", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "filepath", LVT_STRING, offsetof(struct ModFsFile, filepath), true, LOT_NONE, 1, sizeof(char) },
|
||||
{ "fill", LVT_FUNCTION, (size_t) "mod_fs_file_fill", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "isPublic", LVT_BOOL, offsetof(struct ModFsFile, isPublic), true, LOT_NONE, 1, sizeof(bool) },
|
||||
{ "isText", LVT_BOOL, offsetof(struct ModFsFile, isText), true, LOT_NONE, 1, sizeof(bool) },
|
||||
{ "is_eof", LVT_FUNCTION, (size_t) "mod_fs_file_is_eof", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "modFs", LVT_COBJECT_P, offsetof(struct ModFsFile, modFs), true, LOT_MODFS, 1, sizeof(struct ModFs*) },
|
||||
{ "offset", LVT_U32, offsetof(struct ModFsFile, offset), true, LOT_NONE, 1, sizeof(u32) },
|
||||
{ "read_bool", LVT_FUNCTION, (size_t) "mod_fs_file_read_bool", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_bytes", LVT_FUNCTION, (size_t) "mod_fs_file_read_bytes", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_integer", LVT_FUNCTION, (size_t) "mod_fs_file_read_integer", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_line", LVT_FUNCTION, (size_t) "mod_fs_file_read_line", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_number", LVT_FUNCTION, (size_t) "mod_fs_file_read_number", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "read_string", LVT_FUNCTION, (size_t) "mod_fs_file_read_string", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "rewind", LVT_FUNCTION, (size_t) "mod_fs_file_rewind", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "seek", LVT_FUNCTION, (size_t) "mod_fs_file_seek", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "set_public", LVT_FUNCTION, (size_t) "mod_fs_file_set_public", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "set_text_mode", LVT_FUNCTION, (size_t) "mod_fs_file_set_text_mode", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "size", LVT_U32, offsetof(struct ModFsFile, size), true, LOT_NONE, 1, sizeof(u32) },
|
||||
{ "write_bool", LVT_FUNCTION, (size_t) "mod_fs_file_write_bool", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_bytes", LVT_FUNCTION, (size_t) "mod_fs_file_write_bytes", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_integer", LVT_FUNCTION, (size_t) "mod_fs_file_write_integer", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_line", LVT_FUNCTION, (size_t) "mod_fs_file_write_line", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_number", LVT_FUNCTION, (size_t) "mod_fs_file_write_number", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
{ "write_string", LVT_FUNCTION, (size_t) "mod_fs_file_write_string", true, LOT_NONE, 1, sizeof(const char *) },
|
||||
};
|
||||
|
||||
#define LUA_NAMETAGS_SETTINGS_FIELD_COUNT 2
|
||||
|
|
|
|||
|
|
@ -168,24 +168,6 @@ int smlua_func_init_mario_after_warp(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_initiate_warp(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
|
||||
|
||||
s16 destLevel = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("initiate_warp: Failed to convert parameter 1"); return 0; }
|
||||
s16 destArea = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("initiate_warp: Failed to convert parameter 2"); return 0; }
|
||||
s16 destWarpNode = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("initiate_warp: Failed to convert parameter 3"); return 0; }
|
||||
s32 arg3 = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("initiate_warp: Failed to convert parameter 4"); return 0; }
|
||||
|
||||
extern void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3);
|
||||
initiate_warp(destLevel, destArea, destWarpNode, arg3);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_reset_level(lua_State* L) {
|
||||
if (network_player_connected_count() >= 2) {
|
||||
LOG_LUA_LINE("reset_level() can only be used in singleplayer");
|
||||
|
|
@ -1007,36 +989,6 @@ int smlua_func_gfx_set_command(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_gfx_get_from_name(lua_State *L) {
|
||||
if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
const char *name = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("gfx_get_from_name: Failed to convert parameter 1"); return 0; }
|
||||
|
||||
u32 length = 0;
|
||||
Gfx *gfx = dynos_gfx_get(name, &length);
|
||||
|
||||
smlua_push_object(L, LOT_GFX, gfx, NULL);
|
||||
lua_pushinteger(L, length);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_vtx_get_from_name(lua_State *L) {
|
||||
if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
const char *name = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("vtx_get_from_name: Failed to convert parameter 1"); return 0; }
|
||||
|
||||
u32 count = 0;
|
||||
Vtx *vtx = dynos_vtx_get(name, &count);
|
||||
|
||||
smlua_push_object(L, LOT_VTX, vtx, NULL);
|
||||
lua_pushinteger(L, count);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
//////////
|
||||
// bind //
|
||||
//////////
|
||||
|
|
@ -1048,7 +1000,6 @@ void smlua_bind_functions(void) {
|
|||
smlua_bind_function(L, "table_copy", smlua_func_table_copy);
|
||||
smlua_bind_function(L, "table_deepcopy", smlua_func_table_deepcopy);
|
||||
smlua_bind_function(L, "init_mario_after_warp", smlua_func_init_mario_after_warp);
|
||||
smlua_bind_function(L, "initiate_warp", smlua_func_initiate_warp);
|
||||
smlua_bind_function(L, "network_init_object", smlua_func_network_init_object);
|
||||
smlua_bind_function(L, "network_send_object", smlua_func_network_send_object);
|
||||
smlua_bind_function(L, "reset_level", smlua_func_reset_level);
|
||||
|
|
@ -1069,6 +1020,4 @@ void smlua_bind_functions(void) {
|
|||
smlua_bind_function(L, "cast_graph_node", smlua_func_cast_graph_node);
|
||||
smlua_bind_function(L, "get_uncolored_string", smlua_func_get_uncolored_string);
|
||||
smlua_bind_function(L, "gfx_set_command", smlua_func_gfx_set_command);
|
||||
smlua_bind_function(L, "gfx_get_from_name", smlua_func_gfx_get_from_name);
|
||||
smlua_bind_function(L, "vtx_get_from_name", smlua_func_vtx_get_from_name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -778,12 +778,15 @@ int smlua_func_update_angle_from_move_flags(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 * angle = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P);
|
||||
s32 angle = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_angle_from_move_flags"); return 0; }
|
||||
|
||||
lua_pushinteger(L, update_angle_from_move_flags(angle));
|
||||
|
||||
return 1;
|
||||
lua_pushinteger(L, update_angle_from_move_flags(&angle));
|
||||
|
||||
lua_pushinteger(L, angle);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_cur_obj_spawn_strong_wind_particles(lua_State* L) {
|
||||
|
|
@ -10720,16 +10723,19 @@ int smlua_func_set_or_approach_f32_asymptotic(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
f32 * dst = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
|
||||
f32 dst = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_or_approach_f32_asymptotic"); return 0; }
|
||||
f32 goal = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_or_approach_f32_asymptotic"); return 0; }
|
||||
f32 scale = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_or_approach_f32_asymptotic"); return 0; }
|
||||
|
||||
lua_pushinteger(L, set_or_approach_f32_asymptotic(dst, goal, scale));
|
||||
|
||||
return 1;
|
||||
lua_pushinteger(L, set_or_approach_f32_asymptotic(&dst, goal, scale));
|
||||
|
||||
lua_pushnumber(L, dst);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_approach_f32_asymptotic_bool(lua_State* L) {
|
||||
|
|
@ -10741,16 +10747,19 @@ int smlua_func_approach_f32_asymptotic_bool(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
f32 * current = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
|
||||
f32 current = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_f32_asymptotic_bool"); return 0; }
|
||||
f32 target = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_f32_asymptotic_bool"); return 0; }
|
||||
f32 multiplier = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_f32_asymptotic_bool"); return 0; }
|
||||
|
||||
lua_pushinteger(L, approach_f32_asymptotic_bool(current, target, multiplier));
|
||||
|
||||
return 1;
|
||||
lua_pushinteger(L, approach_f32_asymptotic_bool(¤t, target, multiplier));
|
||||
|
||||
lua_pushnumber(L, current);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_approach_f32_asymptotic(lua_State* L) {
|
||||
|
|
@ -10783,16 +10792,19 @@ int smlua_func_approach_s16_asymptotic_bool(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s16 * current = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P);
|
||||
s16 current = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_s16_asymptotic_bool"); return 0; }
|
||||
s16 target = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_s16_asymptotic_bool"); return 0; }
|
||||
s16 divisor = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_s16_asymptotic_bool"); return 0; }
|
||||
|
||||
lua_pushinteger(L, approach_s16_asymptotic_bool(current, target, divisor));
|
||||
|
||||
return 1;
|
||||
lua_pushinteger(L, approach_s16_asymptotic_bool(¤t, target, divisor));
|
||||
|
||||
lua_pushinteger(L, current);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_approach_s16_asymptotic(lua_State* L) {
|
||||
|
|
@ -10887,16 +10899,19 @@ int smlua_func_camera_approach_s16_symmetric_bool(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s16 * current = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P);
|
||||
s16 current = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_approach_s16_symmetric_bool"); return 0; }
|
||||
s16 target = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "camera_approach_s16_symmetric_bool"); return 0; }
|
||||
s16 increment = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "camera_approach_s16_symmetric_bool"); return 0; }
|
||||
|
||||
lua_pushinteger(L, camera_approach_s16_symmetric_bool(current, target, increment));
|
||||
|
||||
return 1;
|
||||
lua_pushinteger(L, camera_approach_s16_symmetric_bool(¤t, target, increment));
|
||||
|
||||
lua_pushinteger(L, current);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_set_or_approach_s16_symmetric(lua_State* L) {
|
||||
|
|
@ -10908,16 +10923,19 @@ int smlua_func_set_or_approach_s16_symmetric(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s16 * current = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P);
|
||||
s16 current = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_or_approach_s16_symmetric"); return 0; }
|
||||
s16 target = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_or_approach_s16_symmetric"); return 0; }
|
||||
s16 increment = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_or_approach_s16_symmetric"); return 0; }
|
||||
|
||||
lua_pushinteger(L, set_or_approach_s16_symmetric(current, target, increment));
|
||||
|
||||
return 1;
|
||||
lua_pushinteger(L, set_or_approach_s16_symmetric(¤t, target, increment));
|
||||
|
||||
lua_pushinteger(L, current);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_camera_approach_f32_symmetric_bool(lua_State* L) {
|
||||
|
|
@ -10929,16 +10947,19 @@ int smlua_func_camera_approach_f32_symmetric_bool(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
f32 * current = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
|
||||
f32 current = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_approach_f32_symmetric_bool"); return 0; }
|
||||
f32 target = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "camera_approach_f32_symmetric_bool"); return 0; }
|
||||
f32 increment = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "camera_approach_f32_symmetric_bool"); return 0; }
|
||||
|
||||
lua_pushinteger(L, camera_approach_f32_symmetric_bool(current, target, increment));
|
||||
|
||||
return 1;
|
||||
lua_pushinteger(L, camera_approach_f32_symmetric_bool(¤t, target, increment));
|
||||
|
||||
lua_pushnumber(L, current);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_camera_approach_f32_symmetric(lua_State* L) {
|
||||
|
|
@ -11132,8 +11153,8 @@ int smlua_func_calculate_angles(lua_State* L) {
|
|||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 4) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calculate_angles", 4, top);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calculate_angles", 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -11145,14 +11166,16 @@ int smlua_func_calculate_angles(lua_State* L) {
|
|||
Vec3f to;
|
||||
smlua_get_vec3f(to, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calculate_angles"); return 0; }
|
||||
s16 * pitch = (s16 *)smlua_to_cpointer(L, 3, LVT_S16_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "calculate_angles"); return 0; }
|
||||
s16 * yaw = (s16 *)smlua_to_cpointer(L, 4, LVT_S16_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "calculate_angles"); return 0; }
|
||||
|
||||
calculate_angles(from, to, pitch, yaw);
|
||||
s16 pitch;
|
||||
s16 yaw;
|
||||
|
||||
return 1;
|
||||
calculate_angles(from, to, &pitch, &yaw);
|
||||
|
||||
lua_pushinteger(L, pitch);
|
||||
lua_pushinteger(L, yaw);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_calc_abs_dist(lua_State* L) {
|
||||
|
|
@ -11406,10 +11429,13 @@ int smlua_func_shake_camera_roll(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s16 * roll = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P);
|
||||
s16 roll = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "shake_camera_roll"); return 0; }
|
||||
|
||||
shake_camera_roll(roll);
|
||||
|
||||
shake_camera_roll(&roll);
|
||||
|
||||
lua_pushinteger(L, roll);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -11851,14 +11877,17 @@ int smlua_func_rotate_camera_around_walls(lua_State* L) {
|
|||
Vec3f cPos;
|
||||
smlua_get_vec3f(cPos, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "rotate_camera_around_walls"); return 0; }
|
||||
s16 * avoidYaw = (s16 *)smlua_to_cpointer(L, 3, LVT_S16_P);
|
||||
s16 avoidYaw = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "rotate_camera_around_walls"); return 0; }
|
||||
s16 yawRange = smlua_to_integer(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "rotate_camera_around_walls"); return 0; }
|
||||
|
||||
lua_pushinteger(L, rotate_camera_around_walls(c, cPos, avoidYaw, yawRange));
|
||||
|
||||
return 1;
|
||||
lua_pushinteger(L, rotate_camera_around_walls(c, cPos, &avoidYaw, yawRange));
|
||||
|
||||
lua_pushinteger(L, avoidYaw);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -15587,6 +15616,29 @@ int smlua_func_warp_special(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_initiate_warp(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 4) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "initiate_warp", 4, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s16 destLevel = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "initiate_warp"); return 0; }
|
||||
s16 destArea = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "initiate_warp"); return 0; }
|
||||
s16 destWarpNode = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "initiate_warp"); return 0; }
|
||||
s32 arg = smlua_to_integer(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "initiate_warp"); return 0; }
|
||||
|
||||
initiate_warp(destLevel, destArea, destWarpNode, arg);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_lvl_set_current_level(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -16661,13 +16713,12 @@ int smlua_func_resolve_and_return_wall_collisions_data(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
int smlua_func_vec3f_find_ceil(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 3) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_find_ceil", 3, top);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_find_ceil", 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -16677,22 +16728,22 @@ int smlua_func_vec3f_find_ceil(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_find_ceil"); return 0; }
|
||||
f32 height = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_find_ceil"); return 0; }
|
||||
// struct Surface** ceil = (struct Surface**)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_find_ceil"); return 0; }
|
||||
|
||||
lua_pushnumber(L, vec3f_find_ceil(pos, height, ceil));
|
||||
struct Surface* ceil;
|
||||
|
||||
return 1;
|
||||
lua_pushnumber(L, vec3f_find_ceil(pos, height, &ceil));
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, ceil, NULL);
|
||||
|
||||
return 2;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
int smlua_func_vec3f_mario_ceil(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 3) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_mario_ceil", 3, top);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_mario_ceil", 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -16702,14 +16753,15 @@ int smlua_func_vec3f_mario_ceil(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_mario_ceil"); return 0; }
|
||||
f32 height = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_mario_ceil"); return 0; }
|
||||
// struct Surface** ceil = (struct Surface**)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_mario_ceil"); return 0; }
|
||||
|
||||
lua_pushnumber(L, vec3f_mario_ceil(pos, height, ceil));
|
||||
struct Surface* ceil;
|
||||
|
||||
return 1;
|
||||
lua_pushnumber(L, vec3f_mario_ceil(pos, height, &ceil));
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, ceil, NULL);
|
||||
|
||||
return 2;
|
||||
}
|
||||
*/
|
||||
|
||||
int smlua_func_mario_facing_downhill(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
|
@ -17623,7 +17675,7 @@ int smlua_func_perform_hanging_step(lua_State* L) {
|
|||
smlua_get_vec3f(nextPos, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "perform_hanging_step"); return 0; }
|
||||
|
||||
extern s32 perform_hanging_step(struct MarioState *m, OUT Vec3f nextPos);
|
||||
extern s32 perform_hanging_step(struct MarioState *m, VEC_OUT Vec3f nextPos);
|
||||
lua_pushinteger(L, perform_hanging_step(m, nextPos));
|
||||
|
||||
smlua_push_vec3f(nextPos, 2);
|
||||
|
|
@ -19121,7 +19173,7 @@ int smlua_func_perform_water_full_step(lua_State* L) {
|
|||
smlua_get_vec3f(nextPos, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "perform_water_full_step"); return 0; }
|
||||
|
||||
extern u32 perform_water_full_step(struct MarioState *m, OUT Vec3f nextPos);
|
||||
extern u32 perform_water_full_step(struct MarioState *m, VEC_OUT Vec3f nextPos);
|
||||
lua_pushinteger(L, perform_water_full_step(m, nextPos));
|
||||
|
||||
smlua_push_vec3f(nextPos, 2);
|
||||
|
|
@ -19145,7 +19197,7 @@ int smlua_func_apply_water_current(lua_State* L) {
|
|||
smlua_get_vec3f(step, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "apply_water_current"); return 0; }
|
||||
|
||||
extern void apply_water_current(struct MarioState *m, OUT Vec3f step);
|
||||
extern void apply_water_current(struct MarioState *m, VEC_OUT Vec3f step);
|
||||
apply_water_current(m, step);
|
||||
|
||||
smlua_push_vec3f(step, 2);
|
||||
|
|
@ -19852,8 +19904,8 @@ int smlua_func_vec3f_get_dist_and_angle(lua_State* L) {
|
|||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 5) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_get_dist_and_angle", 5, top);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_get_dist_and_angle", 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -19865,16 +19917,18 @@ int smlua_func_vec3f_get_dist_and_angle(lua_State* L) {
|
|||
Vec3f to;
|
||||
smlua_get_vec3f(to, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_get_dist_and_angle"); return 0; }
|
||||
f32 * dist = (f32 *)smlua_to_cpointer(L, 3, LVT_F32_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_get_dist_and_angle"); return 0; }
|
||||
s16 * pitch = (s16 *)smlua_to_cpointer(L, 4, LVT_S16_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "vec3f_get_dist_and_angle"); return 0; }
|
||||
s16 * yaw = (s16 *)smlua_to_cpointer(L, 5, LVT_S16_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "vec3f_get_dist_and_angle"); return 0; }
|
||||
|
||||
vec3f_get_dist_and_angle(from, to, dist, pitch, yaw);
|
||||
f32 dist;
|
||||
s16 pitch;
|
||||
s16 yaw;
|
||||
|
||||
return 1;
|
||||
vec3f_get_dist_and_angle(from, to, &dist, &pitch, &yaw);
|
||||
|
||||
lua_pushnumber(L, dist);
|
||||
lua_pushinteger(L, pitch);
|
||||
lua_pushinteger(L, yaw);
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
int smlua_func_vec3f_set_dist_and_angle(lua_State* L) {
|
||||
|
|
@ -23790,18 +23844,20 @@ int smlua_func_calc_obj_friction(lua_State* L) {
|
|||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calc_obj_friction", 2, top);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calc_obj_friction", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f32 * objFriction = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
|
||||
f32 floor_nY = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_obj_friction"); return 0; }
|
||||
f32 floor_nY = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calc_obj_friction"); return 0; }
|
||||
|
||||
extern void calc_obj_friction(f32 *objFriction, f32 floor_nY);
|
||||
calc_obj_friction(objFriction, floor_nY);
|
||||
f32 objFriction;
|
||||
|
||||
extern void calc_obj_friction(RET f32 *objFriction, f32 floor_nY);
|
||||
calc_obj_friction(&objFriction, floor_nY);
|
||||
|
||||
lua_pushnumber(L, objFriction);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -24314,7 +24370,7 @@ int smlua_func_obj_find_wall_displacement(lua_State* L) {
|
|||
f32 radius = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_find_wall_displacement"); return 0; }
|
||||
|
||||
extern s8 obj_find_wall_displacement(OUT Vec3f dist, f32 x, f32 y, f32 z, f32 radius);
|
||||
extern s8 obj_find_wall_displacement(VEC_OUT Vec3f dist, f32 x, f32 y, f32 z, f32 radius);
|
||||
lua_pushinteger(L, obj_find_wall_displacement(dist, x, y, z, radius));
|
||||
|
||||
smlua_push_vec3f(dist, 1);
|
||||
|
|
@ -24743,17 +24799,20 @@ int smlua_func_approach_f32_ptr(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
f32 * px = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
|
||||
f32 px = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_f32_ptr"); return 0; }
|
||||
f32 target = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_f32_ptr"); return 0; }
|
||||
f32 delta = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_f32_ptr"); return 0; }
|
||||
|
||||
extern s32 approach_f32_ptr(f32 *px, f32 target, f32 delta);
|
||||
lua_pushinteger(L, approach_f32_ptr(px, target, delta));
|
||||
|
||||
return 1;
|
||||
extern s32 approach_f32_ptr(INOUT f32 *px, f32 target, f32 delta);
|
||||
lua_pushinteger(L, approach_f32_ptr(&px, target, delta));
|
||||
|
||||
lua_pushnumber(L, px);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_obj_forward_vel_approach(lua_State* L) {
|
||||
|
|
@ -24885,9 +24944,9 @@ int smlua_func_obj_smooth_turn(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s16 * angleVel = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P);
|
||||
s16 angleVel = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_smooth_turn"); return 0; }
|
||||
s32 * angle = (s32 *)smlua_to_cpointer(L, 2, LVT_S32_P);
|
||||
s32 angle = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_smooth_turn"); return 0; }
|
||||
s16 targetAngle = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_smooth_turn"); return 0; }
|
||||
|
|
@ -24900,10 +24959,14 @@ int smlua_func_obj_smooth_turn(lua_State* L) {
|
|||
s16 maxSpeed = smlua_to_integer(L, 7);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "obj_smooth_turn"); return 0; }
|
||||
|
||||
extern s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion, s16 accel, s16 minSpeed, s16 maxSpeed);
|
||||
lua_pushinteger(L, obj_smooth_turn(angleVel, angle, targetAngle, targetSpeedProportion, accel, minSpeed, maxSpeed));
|
||||
|
||||
return 1;
|
||||
extern s32 obj_smooth_turn(INOUT s16 *angleVel, INOUT s32 *angle, s16 targetAngle, f32 targetSpeedProportion, s16 accel, s16 minSpeed, s16 maxSpeed);
|
||||
lua_pushinteger(L, obj_smooth_turn(&angleVel, &angle, targetAngle, targetSpeedProportion, accel, minSpeed, maxSpeed));
|
||||
|
||||
lua_pushinteger(L, angleVel);
|
||||
lua_pushinteger(L, angle);
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
int smlua_func_obj_roll_to_match_yaw_turn(lua_State* L) {
|
||||
|
|
@ -24997,17 +25060,20 @@ int smlua_func_obj_grow_then_shrink(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
f32 * scaleVel = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
|
||||
f32 scaleVel = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_grow_then_shrink"); return 0; }
|
||||
f32 shootFireScale = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_grow_then_shrink"); return 0; }
|
||||
f32 endScale = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_grow_then_shrink"); return 0; }
|
||||
|
||||
extern s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale);
|
||||
lua_pushinteger(L, obj_grow_then_shrink(scaleVel, shootFireScale, endScale));
|
||||
|
||||
return 1;
|
||||
extern s32 obj_grow_then_shrink(INOUT f32 *scaleVel, f32 shootFireScale, f32 endScale);
|
||||
lua_pushinteger(L, obj_grow_then_shrink(&scaleVel, shootFireScale, endScale));
|
||||
|
||||
lua_pushnumber(L, scaleVel);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_oscillate_toward(lua_State* L) {
|
||||
|
|
@ -25019,9 +25085,9 @@ int smlua_func_oscillate_toward(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 * value = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P);
|
||||
s32 value = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "oscillate_toward"); return 0; }
|
||||
f32 * vel = (f32 *)smlua_to_cpointer(L, 2, LVT_F32_P);
|
||||
f32 vel = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "oscillate_toward"); return 0; }
|
||||
s32 target = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "oscillate_toward"); return 0; }
|
||||
|
|
@ -25032,10 +25098,14 @@ int smlua_func_oscillate_toward(lua_State* L) {
|
|||
f32 slowdown = smlua_to_number(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "oscillate_toward"); return 0; }
|
||||
|
||||
extern s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel, f32 slowdown);
|
||||
lua_pushinteger(L, oscillate_toward(value, vel, target, velCloseToZero, accel, slowdown));
|
||||
|
||||
return 1;
|
||||
extern s32 oscillate_toward(INOUT s32 *value, INOUT f32 *vel, s32 target, f32 velCloseToZero, f32 accel, f32 slowdown);
|
||||
lua_pushinteger(L, oscillate_toward(&value, &vel, target, velCloseToZero, accel, slowdown));
|
||||
|
||||
lua_pushinteger(L, value);
|
||||
lua_pushnumber(L, vel);
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
int smlua_func_obj_update_blinking(lua_State* L) {
|
||||
|
|
@ -25047,7 +25117,7 @@ int smlua_func_obj_update_blinking(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 * blinkTimer = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P);
|
||||
s32 blinkTimer = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_update_blinking"); return 0; }
|
||||
s16 baseCycleLength = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_update_blinking"); return 0; }
|
||||
|
|
@ -25056,8 +25126,11 @@ int smlua_func_obj_update_blinking(lua_State* L) {
|
|||
s16 blinkLength = smlua_to_integer(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_update_blinking"); return 0; }
|
||||
|
||||
extern void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange, s16 blinkLength);
|
||||
obj_update_blinking(blinkTimer, baseCycleLength, cycleLengthRange, blinkLength);
|
||||
|
||||
extern void obj_update_blinking(INOUT s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange, s16 blinkLength);
|
||||
obj_update_blinking(&blinkTimer, baseCycleLength, cycleLengthRange, blinkLength);
|
||||
|
||||
lua_pushinteger(L, blinkTimer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -25066,36 +25139,40 @@ int smlua_func_obj_resolve_object_collisions(lua_State* L) {
|
|||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_resolve_object_collisions", 1, top);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_resolve_object_collisions", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 * targetYaw = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_resolve_object_collisions"); return 0; }
|
||||
|
||||
extern s32 obj_resolve_object_collisions(s32 *targetYaw);
|
||||
lua_pushinteger(L, obj_resolve_object_collisions(targetYaw));
|
||||
s32 targetYaw;
|
||||
|
||||
return 1;
|
||||
extern s32 obj_resolve_object_collisions(RET s32 *targetYaw);
|
||||
lua_pushinteger(L, obj_resolve_object_collisions(&targetYaw));
|
||||
|
||||
lua_pushinteger(L, targetYaw);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_obj_bounce_off_walls_edges_objects(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_bounce_off_walls_edges_objects", 1, top);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_bounce_off_walls_edges_objects", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 * targetYaw = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_bounce_off_walls_edges_objects"); return 0; }
|
||||
|
||||
extern s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw);
|
||||
lua_pushinteger(L, obj_bounce_off_walls_edges_objects(targetYaw));
|
||||
s32 targetYaw;
|
||||
|
||||
return 1;
|
||||
extern s32 obj_bounce_off_walls_edges_objects(RET s32 *targetYaw);
|
||||
lua_pushinteger(L, obj_bounce_off_walls_edges_objects(&targetYaw));
|
||||
|
||||
lua_pushinteger(L, targetYaw);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_obj_resolve_collisions_and_turn(lua_State* L) {
|
||||
|
|
@ -25318,22 +25395,24 @@ int smlua_func_treat_far_home_as_mario(lua_State* L) {
|
|||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 3) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "treat_far_home_as_mario", 3, top);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "treat_far_home_as_mario", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f32 threshold = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "treat_far_home_as_mario"); return 0; }
|
||||
s32* distanceToPlayer = (s32*)smlua_to_cpointer(L, 2, LVT_S32_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "treat_far_home_as_mario"); return 0; }
|
||||
s32* angleToPlayer = (s32*)smlua_to_cpointer(L, 3, LVT_S32_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "treat_far_home_as_mario"); return 0; }
|
||||
|
||||
extern void treat_far_home_as_mario(f32 threshold, s32* distanceToPlayer, s32* angleToPlayer);
|
||||
treat_far_home_as_mario(threshold, distanceToPlayer, angleToPlayer);
|
||||
s32 distanceToPlayer;
|
||||
s32 angleToPlayer;
|
||||
|
||||
return 1;
|
||||
extern void treat_far_home_as_mario(f32 threshold, RET s32* distanceToPlayer, RET s32* angleToPlayer);
|
||||
treat_far_home_as_mario(threshold, &distanceToPlayer, &angleToPlayer);
|
||||
|
||||
lua_pushinteger(L, distanceToPlayer);
|
||||
lua_pushinteger(L, angleToPlayer);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_obj_spit_fire(lua_State* L) {
|
||||
|
|
@ -25381,15 +25460,18 @@ int smlua_func_clear_move_flag(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
u32 * bitSet = (u32 *)smlua_to_cpointer(L, 1, LVT_U32_P);
|
||||
u32 bitSet = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "clear_move_flag"); return 0; }
|
||||
s32 flag = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "clear_move_flag"); return 0; }
|
||||
|
||||
extern s32 clear_move_flag(u32 *bitSet, s32 flag);
|
||||
lua_pushinteger(L, clear_move_flag(bitSet, flag));
|
||||
|
||||
return 1;
|
||||
extern s32 clear_move_flag(INOUT u32 *bitSet, s32 flag);
|
||||
lua_pushinteger(L, clear_move_flag(&bitSet, flag));
|
||||
|
||||
lua_pushinteger(L, bitSet);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -25572,7 +25654,7 @@ int smlua_func_obj_apply_scale_to_matrix(lua_State* L) {
|
|||
smlua_get_mat4(src, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_apply_scale_to_matrix"); return 0; }
|
||||
|
||||
extern void obj_apply_scale_to_matrix(struct Object *obj, OUT Mat4 dst, Mat4 src);
|
||||
extern void obj_apply_scale_to_matrix(struct Object *obj, VEC_OUT Mat4 dst, Mat4 src);
|
||||
obj_apply_scale_to_matrix(obj, dst, src);
|
||||
|
||||
smlua_push_mat4(dst, 2);
|
||||
|
|
@ -25602,7 +25684,7 @@ int smlua_func_create_transformation_from_matrices(lua_State* L) {
|
|||
smlua_get_mat4(a2, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "create_transformation_from_matrices"); return 0; }
|
||||
|
||||
extern void create_transformation_from_matrices(OUT Mat4 a0, Mat4 a1, Mat4 a2);
|
||||
extern void create_transformation_from_matrices(VEC_OUT Mat4 a0, Mat4 a1, Mat4 a2);
|
||||
create_transformation_from_matrices(a0, a1, a2);
|
||||
|
||||
smlua_push_mat4(a0, 1);
|
||||
|
|
@ -25723,17 +25805,20 @@ int smlua_func_approach_f32_signed(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
f32 * value = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
|
||||
f32 value = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_f32_signed"); return 0; }
|
||||
f32 target = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_f32_signed"); return 0; }
|
||||
f32 increment = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_f32_signed"); return 0; }
|
||||
|
||||
extern s32 approach_f32_signed(f32 *value, f32 target, f32 increment);
|
||||
lua_pushinteger(L, approach_f32_signed(value, target, increment));
|
||||
|
||||
return 1;
|
||||
extern s32 approach_f32_signed(INOUT f32 *value, f32 target, f32 increment);
|
||||
lua_pushinteger(L, approach_f32_signed(&value, target, increment));
|
||||
|
||||
lua_pushnumber(L, value);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_approach_f32_symmetric(lua_State* L) {
|
||||
|
|
@ -26272,7 +26357,7 @@ int smlua_func_linear_mtxf_mul_vec3f(lua_State* L) {
|
|||
smlua_get_vec3f(v, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "linear_mtxf_mul_vec3f"); return 0; }
|
||||
|
||||
extern void linear_mtxf_mul_vec3f(Mat4 m, OUT Vec3f dst, Vec3f v);
|
||||
extern void linear_mtxf_mul_vec3f(Mat4 m, VEC_OUT Vec3f dst, Vec3f v);
|
||||
linear_mtxf_mul_vec3f(m, dst, v);
|
||||
|
||||
smlua_push_vec3f(dst, 2);
|
||||
|
|
@ -26302,7 +26387,7 @@ int smlua_func_linear_mtxf_transpose_mul_vec3f(lua_State* L) {
|
|||
smlua_get_vec3f(v, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "linear_mtxf_transpose_mul_vec3f"); return 0; }
|
||||
|
||||
extern void linear_mtxf_transpose_mul_vec3f(Mat4 m, OUT Vec3f dst, Vec3f v);
|
||||
extern void linear_mtxf_transpose_mul_vec3f(Mat4 m, VEC_OUT Vec3f dst, Vec3f v);
|
||||
linear_mtxf_transpose_mul_vec3f(m, dst, v);
|
||||
|
||||
smlua_push_vec3f(dst, 2);
|
||||
|
|
@ -26782,20 +26867,22 @@ int smlua_func_cur_obj_find_nearest_object_with_behavior(lua_State* L) {
|
|||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_find_nearest_object_with_behavior", 2, top);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_find_nearest_object_with_behavior", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BehaviorScript * behavior = (BehaviorScript *)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_find_nearest_object_with_behavior"); return 0; }
|
||||
f32 * dist = (f32 *)smlua_to_cpointer(L, 2, LVT_F32_P);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_find_nearest_object_with_behavior"); return 0; }
|
||||
|
||||
extern struct Object *cur_obj_find_nearest_object_with_behavior(const BehaviorScript *behavior, f32 *dist);
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearest_object_with_behavior(behavior, dist), NULL);
|
||||
f32 dist;
|
||||
|
||||
return 1;
|
||||
extern struct Object *cur_obj_find_nearest_object_with_behavior(const BehaviorScript *behavior, RET f32 *dist);
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearest_object_with_behavior(behavior, &dist), NULL);
|
||||
|
||||
lua_pushnumber(L, dist);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_cur_obj_count_objects_with_behavior(lua_State* L) {
|
||||
|
|
@ -27377,13 +27464,16 @@ int smlua_func_apply_drag_to_value(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
f32 * value = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
|
||||
f32 value = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "apply_drag_to_value"); return 0; }
|
||||
f32 dragStrength = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "apply_drag_to_value"); return 0; }
|
||||
|
||||
extern void apply_drag_to_value(f32 *value, f32 dragStrength);
|
||||
apply_drag_to_value(value, dragStrength);
|
||||
|
||||
extern void apply_drag_to_value(INOUT f32 *value, f32 dragStrength);
|
||||
apply_drag_to_value(&value, dragStrength);
|
||||
|
||||
lua_pushnumber(L, value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -32603,6 +32693,27 @@ int smlua_func_gfx_get_texture(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_gfx_get_from_name(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "gfx_get_from_name", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* name = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "gfx_get_from_name"); return 0; }
|
||||
|
||||
u32 length;
|
||||
|
||||
smlua_push_object(L, LOT_GFX, gfx_get_from_name(name, &length), NULL);
|
||||
|
||||
lua_pushinteger(L, length);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_gfx_get_name(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -32764,6 +32875,27 @@ int smlua_func_gfx_delete_all(UNUSED lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_vtx_get_from_name(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vtx_get_from_name", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* name = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vtx_get_from_name"); return 0; }
|
||||
|
||||
u32 count;
|
||||
|
||||
smlua_push_object(L, LOT_VTX, vtx_get_from_name(name, &count), NULL);
|
||||
|
||||
lua_pushinteger(L, count);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int smlua_func_vtx_get_name(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -36449,13 +36581,12 @@ int smlua_func_find_wall_collisions(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
int smlua_func_find_ceil(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 4) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_ceil", 4, top);
|
||||
if (top != 3) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_ceil", 3, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -36465,14 +36596,15 @@ int smlua_func_find_ceil(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_ceil"); return 0; }
|
||||
f32 posZ = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_ceil"); return 0; }
|
||||
// struct Surface** pceil = (struct Surface**)smlua_to_cobject(L, 4, LOT_???); <--- UNIMPLEMENTED
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "find_ceil"); return 0; }
|
||||
|
||||
lua_pushnumber(L, find_ceil(posX, posY, posZ, pceil));
|
||||
struct Surface* pceil;
|
||||
|
||||
return 1;
|
||||
lua_pushnumber(L, find_ceil(posX, posY, posZ, &pceil));
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, pceil, NULL);
|
||||
|
||||
return 2;
|
||||
}
|
||||
*/
|
||||
|
||||
int smlua_func_find_ceil_height(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
|
@ -36541,13 +36673,12 @@ int smlua_func_find_floor_height(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
int smlua_func_find_floor(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 4) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_floor", 4, top);
|
||||
if (top != 3) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_floor", 3, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -36557,14 +36688,15 @@ int smlua_func_find_floor(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_floor"); return 0; }
|
||||
f32 zPos = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_floor"); return 0; }
|
||||
// struct Surface** pfloor = (struct Surface**)smlua_to_cobject(L, 4, LOT_???); <--- UNIMPLEMENTED
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "find_floor"); return 0; }
|
||||
|
||||
lua_pushnumber(L, find_floor(xPos, yPos, zPos, pfloor));
|
||||
struct Surface* pfloor;
|
||||
|
||||
return 1;
|
||||
lua_pushnumber(L, find_floor(xPos, yPos, zPos, &pfloor));
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, pfloor, NULL);
|
||||
|
||||
return 2;
|
||||
}
|
||||
*/
|
||||
|
||||
int smlua_func_find_water_level(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
|
@ -37768,6 +37900,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "initiate_painting_warp", smlua_func_initiate_painting_warp);
|
||||
smlua_bind_function(L, "level_trigger_warp", smlua_func_level_trigger_warp);
|
||||
smlua_bind_function(L, "warp_special", smlua_func_warp_special);
|
||||
smlua_bind_function(L, "initiate_warp", smlua_func_initiate_warp);
|
||||
smlua_bind_function(L, "lvl_set_current_level", smlua_func_lvl_set_current_level);
|
||||
|
||||
// lighting_engine.h
|
||||
|
|
@ -37826,8 +37959,8 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "mario_get_terrain_sound_addend", smlua_func_mario_get_terrain_sound_addend);
|
||||
smlua_bind_function(L, "resolve_and_return_wall_collisions", smlua_func_resolve_and_return_wall_collisions);
|
||||
smlua_bind_function(L, "resolve_and_return_wall_collisions_data", smlua_func_resolve_and_return_wall_collisions_data);
|
||||
//smlua_bind_function(L, "vec3f_find_ceil", smlua_func_vec3f_find_ceil); <--- UNIMPLEMENTED
|
||||
//smlua_bind_function(L, "vec3f_mario_ceil", smlua_func_vec3f_mario_ceil); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "vec3f_find_ceil", smlua_func_vec3f_find_ceil);
|
||||
smlua_bind_function(L, "vec3f_mario_ceil", smlua_func_vec3f_mario_ceil);
|
||||
smlua_bind_function(L, "mario_facing_downhill", smlua_func_mario_facing_downhill);
|
||||
smlua_bind_function(L, "mario_floor_is_slippery", smlua_func_mario_floor_is_slippery);
|
||||
smlua_bind_function(L, "mario_floor_is_slope", smlua_func_mario_floor_is_slope);
|
||||
|
|
@ -38697,6 +38830,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "gfx_get_vertex_buffer", smlua_func_gfx_get_vertex_buffer);
|
||||
smlua_bind_function(L, "gfx_get_vertex_count", smlua_func_gfx_get_vertex_count);
|
||||
smlua_bind_function(L, "gfx_get_texture", smlua_func_gfx_get_texture);
|
||||
smlua_bind_function(L, "gfx_get_from_name", smlua_func_gfx_get_from_name);
|
||||
smlua_bind_function(L, "gfx_get_name", smlua_func_gfx_get_name);
|
||||
smlua_bind_function(L, "gfx_get_length", smlua_func_gfx_get_length);
|
||||
smlua_bind_function(L, "gfx_get_command", smlua_func_gfx_get_command);
|
||||
|
|
@ -38706,6 +38840,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "gfx_resize", smlua_func_gfx_resize);
|
||||
smlua_bind_function(L, "gfx_delete", smlua_func_gfx_delete);
|
||||
smlua_bind_function(L, "gfx_delete_all", smlua_func_gfx_delete_all);
|
||||
smlua_bind_function(L, "vtx_get_from_name", smlua_func_vtx_get_from_name);
|
||||
smlua_bind_function(L, "vtx_get_name", smlua_func_vtx_get_name);
|
||||
smlua_bind_function(L, "vtx_get_count", smlua_func_vtx_get_count);
|
||||
smlua_bind_function(L, "vtx_get_vertex", smlua_func_vtx_get_vertex);
|
||||
|
|
@ -38931,11 +39066,11 @@ void smlua_bind_functions_autogen(void) {
|
|||
|
||||
// surface_collision.h
|
||||
smlua_bind_function(L, "find_wall_collisions", smlua_func_find_wall_collisions);
|
||||
//smlua_bind_function(L, "find_ceil", smlua_func_find_ceil); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "find_ceil", smlua_func_find_ceil);
|
||||
smlua_bind_function(L, "find_ceil_height", smlua_func_find_ceil_height);
|
||||
//smlua_bind_function(L, "find_floor_height_and_data", smlua_func_find_floor_height_and_data); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "find_floor_height", smlua_func_find_floor_height);
|
||||
//smlua_bind_function(L, "find_floor", smlua_func_find_floor); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "find_floor", smlua_func_find_floor);
|
||||
smlua_bind_function(L, "find_water_level", smlua_func_find_water_level);
|
||||
smlua_bind_function(L, "find_poison_gas_level", smlua_func_find_poison_gas_level);
|
||||
//smlua_bind_function(L, "find_surface_on_ray", smlua_func_find_surface_on_ray); <--- UNIMPLEMENTED
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ void* smlua_to_cpointer(lua_State* L, int index, u16 lvt) {
|
|||
CPointer *cpointer = luaL_checkudata(L, index, "CPointer");
|
||||
|
||||
if (lvt != cpointer->lvt) {
|
||||
LOG_LUA_LINE("smlua_to_cpointer received improper LOT. Expected '%s', received '%s'", smlua_get_lvt_name(lvt), smlua_get_lvt_name(cpointer->lvt));
|
||||
LOG_LUA_LINE("smlua_to_cpointer received improper LVT. Expected '%s', received '%s'", smlua_get_lvt_name(lvt), smlua_get_lvt_name(cpointer->lvt));
|
||||
gSmLuaConvertSuccess = false;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart p
|
|||
np->overridePalette = np->palette;
|
||||
}
|
||||
|
||||
void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, OUT Color out) {
|
||||
void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, VEC_OUT Color out) {
|
||||
LOG_LUA_LINE_WARNING("[LUA] network_player_palette_to_color() is deprecated! Use network_player_get_palette_color() or network_player_get_override_palette_color() instead.");
|
||||
if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) {
|
||||
if (np == NULL) { // output config palette instead if np is NULL
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ void audio_stream_set_speed(struct ModAudio* audio, f32 initial_freq, f32 speed,
|
|||
/* |description|[DEPRECATED: Use `network_player_set_override_palette_color` instead]|descriptionEnd| */
|
||||
void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color);
|
||||
/* |description|[DEPRECATED: Use `network_player_get_palette_color` or `network_player_get_override_palette_color` instead]|descriptionEnd| */
|
||||
void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, OUT Color out);
|
||||
void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, VEC_OUT Color out);
|
||||
|
|
|
|||
|
|
@ -247,6 +247,11 @@ Texture *gfx_get_texture(Gfx *cmd) {
|
|||
return (Texture *) cmd->words.w1;
|
||||
}
|
||||
|
||||
Gfx *gfx_get_from_name(const char *name, RET u32 *length) {
|
||||
*length = 0;
|
||||
return dynos_gfx_get(name, length);
|
||||
}
|
||||
|
||||
const char *gfx_get_name(Gfx *gfx) {
|
||||
if (!gfx) { return NULL; }
|
||||
|
||||
|
|
@ -355,6 +360,11 @@ void gfx_delete_all() {
|
|||
dynos_gfx_delete_all();
|
||||
}
|
||||
|
||||
Vtx *vtx_get_from_name(const char *name, RET u32 *count) {
|
||||
*count = 0;
|
||||
return dynos_vtx_get(name, count);
|
||||
}
|
||||
|
||||
const char *vtx_get_name(Vtx *vtx) {
|
||||
if (!vtx) { return NULL; }
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,11 @@ u16 gfx_get_vertex_count(Gfx *cmd);
|
|||
/* |description|Gets the texture from a display list command if it has an image related op|descriptionEnd| */
|
||||
Texture *gfx_get_texture(Gfx *cmd);
|
||||
|
||||
/* |description|
|
||||
Gets a display list of the current mod from its name.
|
||||
Returns a pointer to the display list and its length
|
||||
|descriptionEnd| */
|
||||
Gfx *gfx_get_from_name(const char *name, RET u32 *length);
|
||||
/* |description|Gets the name of a display list|descriptionEnd| */
|
||||
const char *gfx_get_name(Gfx *gfx);
|
||||
/* |description|Gets the max length of a display list|descriptionEnd| */
|
||||
|
|
@ -88,6 +93,12 @@ void gfx_delete(Gfx *gfx);
|
|||
/* |description|Deletes all display lists created by `gfx_create`|descriptionEnd| */
|
||||
void gfx_delete_all();
|
||||
|
||||
|
||||
/* |description|
|
||||
Gets a vertex buffer of the current mod from its name.
|
||||
Returns a pointer to the vertex buffering and its vertex count
|
||||
|descriptionEnd| */
|
||||
Vtx *vtx_get_from_name(const char *name, RET u32 *count);
|
||||
/* |description|Gets the name of a vertex buffer|descriptionEnd| */
|
||||
const char *vtx_get_name(Vtx *vtx);
|
||||
/* |description|Gets the max count of vertices of a vertex buffer|descriptionEnd| */
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ f32 get_hand_foot_pos_z(struct MarioState* m, u8 index) {
|
|||
return m->marioBodyState->animPartsPos[sHandFootToAnimParts[index]][2];
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!m) { return false; }
|
||||
if (animPart >= MARIO_ANIM_PART_MAX) { return false; }
|
||||
vec3f_copy(pos, m->marioBodyState->animPartsPos[animPart]);
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ f32 get_hand_foot_pos_z(struct MarioState* m, u8 index);
|
|||
/* |description|
|
||||
Retrieves the animated part position associated to `animPart` from the MarioState `m` and stores it into `pos`. Returns `true` on success or `false` on failure
|
||||
|descriptionEnd| */
|
||||
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);
|
||||
|
||||
/* |description|Gets the current save file number (1-indexed)|descriptionEnd| */
|
||||
s16 get_current_save_file_num(void);
|
||||
|
|
|
|||
|
|
@ -155,14 +155,14 @@ s32 delta_interpolate_s32(s32 a, s32 b, f32 delta) {
|
|||
return a * (1.0f - delta) + b * delta;
|
||||
}
|
||||
|
||||
void delta_interpolate_vec3f(OUT Vec3f res, Vec3f a, Vec3f b, f32 delta) {
|
||||
void delta_interpolate_vec3f(VEC_OUT Vec3f res, Vec3f a, Vec3f b, f32 delta) {
|
||||
f32 antiDelta = 1.0f - delta;
|
||||
res[0] = ((a[0] * antiDelta) + (b[0] * delta));
|
||||
res[1] = ((a[1] * antiDelta) + (b[1] * delta));
|
||||
res[2] = ((a[2] * antiDelta) + (b[2] * delta));
|
||||
}
|
||||
|
||||
void delta_interpolate_vec3s(OUT Vec3s res, Vec3s a, Vec3s b, f32 delta) {
|
||||
void delta_interpolate_vec3s(VEC_OUT Vec3s res, Vec3s a, Vec3s b, f32 delta) {
|
||||
f32 antiDelta = 1.0f - delta;
|
||||
res[0] = ((a[0] * antiDelta) + (b[0] * delta));
|
||||
res[1] = ((a[1] * antiDelta) + (b[1] * delta));
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ f32 delta_interpolate_f32(f32 a, f32 b, f32 delta);
|
|||
/* |description|Linearly interpolates between `a` and `b` with `delta`|descriptionEnd| */
|
||||
s32 delta_interpolate_s32(s32 a, s32 b, f32 delta);
|
||||
/* |description|Linearly interpolates `res` between `a` and `b` with `delta`|descriptionEnd| */
|
||||
void delta_interpolate_vec3f(OUT Vec3f res, Vec3f a, Vec3f b, f32 delta);
|
||||
void delta_interpolate_vec3f(VEC_OUT Vec3f res, Vec3f a, Vec3f b, f32 delta);
|
||||
/* |description|Linearly interpolates `res` between `a` and `b` with `delta`|descriptionEnd| */
|
||||
void delta_interpolate_vec3s(OUT Vec3s res, Vec3s a, Vec3s b, f32 delta);
|
||||
void delta_interpolate_vec3s(VEC_OUT Vec3s res, Vec3s a, Vec3s b, f32 delta);
|
||||
void delta_interpolate_normal(s8* res, s8* a, s8* b, f32 delta);
|
||||
void delta_interpolate_rgba(u8* res, u8* a, u8* b, f32 delta);
|
||||
void delta_interpolate_mtx(Mtx* out, Mtx* a, Mtx* b, f32 delta);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue