Allow multiple returns in autogen functions

This commit is contained in:
Cooliokid956 2025-11-29 09:58:58 -06:00
parent 77ca4db299
commit 5f108f382d
12 changed files with 814 additions and 169 deletions

View file

@ -253,6 +253,13 @@ def translate_type_to_lot(ptype, allowArrays=True):
return 'LOT_???'
def translate_type_to_lua(ptype):
if type(ptype) is list:
rt, rl = [], []
for _t in ptype:
t, l = translate_type_to_lua(_t)
rt.append(t); rl.append(l)
return rt, rl
if ptype == 'const char*':
return '`string`', None
@ -359,6 +366,9 @@ def gen_comment_header(f):
return s
def translate_to_def(ptype):
if type(ptype) is list:
return [translate_to_def(t) for t in ptype]
if ptype == None:
return 'nil'
if 'Lua Function' in ptype:

View file

@ -751,6 +751,10 @@ def normalize_type(t):
return t
def alter_type(t):
if type(t) is list:
if len(t) > 1:
return 'void'
t = t[0]
if t.startswith('enum '):
return 'int'
return t
@ -954,13 +958,14 @@ def build_function(function, do_extern):
s += '\n'
# To allow chaining vector functions calls, return the table corresponding to the `OUT` parameter
if function['type'] in VECP_TYPES:
ftype = function['type']
if len(ftype) == 1 and ftype[0] in VECP_TYPES:
for i, param in enumerate(function['params']):
if 'OUT' in param:
s += ' lua_settop(L, %d);\n' % (i + 1)
break
s += ' return 1;\n}\n'
s += ' return %i;\n}\n' % len(ftype)
if fid in override_function_version_excludes:
s += '#endif\n'
@ -1046,7 +1051,11 @@ def process_function(fname, line, description):
line = line.replace('UNUSED', '')
match = re.search(r'[a-zA-Z0-9_]+\(', line)
function['type'] = normalize_type(line[0:match.span()[0]])
if match.group() == "RETURNS(":
function['type'] = [t.strip() for t in line.split('(', 1)[1].split(')', 1)[0].split(',')]
line = re.sub(r'RETURNS\(.*?\)', 'void', line)
match = re.search(r'[a-zA-Z0-9_]+\(', line)
else: function['type'] = [normalize_type(line[0:match.span()[0]])]
function['identifier'] = match.group()[0:-1]
function['params'] = []
@ -1259,8 +1268,8 @@ def doc_function(fname, function):
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)
if None not in rtype:
s += "`local %s = %s(%s)`\n" % (", ".join([t.replace('`', '').split(' ')[0] + "Value" for t in rtype]), fid, param_str)
else:
s += "`%s(%s)`\n" % (fid, param_str)
@ -1288,10 +1297,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 t, l in zip(rtype, rlink):
if l:
s += '- [%s](%s)\n' % (t, l)
else:
s += '- %s\n' % t
else:
s += '- None\n'
@ -1383,8 +1393,8 @@ def def_function(fname, function):
rtype, rlink = translate_type_to_lua(function['type'])
param_str = ', '.join([x['identifier'] for x in function['params']])
if rtype == None:
rtype = 'nil'
if None in rtype:
rtype[0] = 'nil'
if function['description'].startswith("[DEPRECATED"):
s += "--- @deprecated\n"
@ -1401,11 +1411,12 @@ 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 t in rtype:
if t.startswith('Pointer_') and t not in def_pointers:
def_pointers.append(t)
if rtype != "nil":
s += '--- @return %s\n' % rtype
if t != "nil":
s += '--- @return %s\n' % t
if function['description'] != "":
s += "--- %s\n" % (function['description'])
s += "function %s(%s)\n -- ...\nend\n\n" % (fid, param_str)

View file

@ -75,8 +75,8 @@ def extract_functions(filename):
while (' ' in txt):
txt = txt.replace(' ', ' ')
# strip macros
txt = re.sub(r'[^a-zA-Z0-9_][A-Z0-9_]+\(.*\)', '', txt)
# strip macros (except RETURNS(...))
txt = re.sub(r'((?!RETURNS)[^a-zA-Z0-9_][A-Z0-9_])+\(.*\)', '', txt)
# strip blocks
tmp = txt

View file

@ -12021,7 +12021,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);`
@ -12046,7 +12046,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);`
@ -12071,7 +12071,7 @@ Spawns a Star that won't make Mario exit the level with an ID corresponding to t
| z | `number` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* spawn_no_exit_star(f32 x, f32 y, f32 z);`

View file

@ -180,7 +180,7 @@ Gets a behavior ID from a behavior script
| behavior | `Pointer` <`BehaviorScript`> |
### Returns
[enum BehaviorId](constants.md#enum-BehaviorId)
- [enum BehaviorId](constants.md#enum-BehaviorId)
### C Prototype
`enum BehaviorId get_id_from_behavior(const BehaviorScript* behavior);`
@ -203,7 +203,7 @@ Gets a behavior ID from only vanilla behavior scripts
| behavior | `Pointer` <`BehaviorScript`> |
### Returns
[enum BehaviorId](constants.md#enum-BehaviorId)
- [enum BehaviorId](constants.md#enum-BehaviorId)
### C Prototype
`enum BehaviorId get_id_from_vanilla_behavior(const BehaviorScript* behavior);`
@ -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);`
@ -2502,7 +2502,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);`
@ -2861,7 +2861,7 @@ Gets the current DJUI HUD color
- None
### Returns
[DjuiColor](structs.md#DjuiColor)
- [DjuiColor](structs.md#DjuiColor)
### C Prototype
`struct DjuiColor* djui_hud_get_color(void);`
@ -2929,7 +2929,7 @@ Gets the current DJUI HUD rotation
- None
### Returns
[HudUtilsRotation](structs.md#HudUtilsRotation)
- [HudUtilsRotation](structs.md#HudUtilsRotation)
### C Prototype
`struct HudUtilsRotation* djui_hud_get_rotation(void);`
@ -6123,7 +6123,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);`
@ -6338,7 +6338,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);`
@ -6571,7 +6571,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);`
@ -6666,7 +6666,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);`
@ -6687,7 +6687,7 @@ Gets a painting warp node from the local mario's floor type
- None
### Returns
[WarpNode](structs.md#WarpNode)
- [WarpNode](structs.md#WarpNode)
### C Prototype
`struct WarpNode *get_painting_warp_node(void);`

View file

@ -67,7 +67,7 @@ Gets the lighting engine mode
- None
### Returns
[enum LEMode](constants.md#enum-LEMode)
- [enum LEMode](constants.md#enum-LEMode)
### C Prototype
`enum LEMode le_get_mode(void);`
@ -1249,7 +1249,7 @@ Checks for and resolves wall collisions at a given position `pos`, returning the
| radius | `number` |
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface *resolve_and_return_wall_collisions(OUT Vec3f pos, f32 offset, f32 radius);`
@ -1845,7 +1845,7 @@ Gets the MarioState corresponding to the provided object if the object is a Mari
| o | [Object](structs.md#Object) |
### Returns
[MarioState](structs.md#MarioState)
- [MarioState](structs.md#MarioState)
### C Prototype
`struct MarioState *get_mario_state_from_object(struct Object *o);`
@ -4397,7 +4397,7 @@ When used in a geo function, retrieve the MarioState associated to the current p
- None
### Returns
[MarioState](structs.md#MarioState)
- [MarioState](structs.md#MarioState)
### C Prototype
`struct MarioState *geo_get_mario_state(void);`
@ -4418,7 +4418,7 @@ When used in a geo function, retrieve the MarioBodyState associated to the curre
- None
### Returns
[MarioBodyState](structs.md#MarioBodyState)
- [MarioBodyState](structs.md#MarioBodyState)
### C Prototype
`struct MarioBodyState *geo_get_body_state(void);`
@ -4930,7 +4930,7 @@ Rotates the 3D floating-point vector `v` by the angles specified in the 3D signe
| rotate | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_rotate_zxy(OUT Vec3f v, Vec3s rotate);`
@ -4956,7 +4956,7 @@ Rotates the 3D floating-point vector `v` around the vector `n`, given a rotation
| r | `integer` |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_rotate_around_n(OUT Vec3f dest, Vec3f v, Vec3f n, s16 r);`
@ -4981,7 +4981,7 @@ Projects the 3D floating-point vector `v` onto another 3D floating-point vector
| onto | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_project(OUT Vec3f dest, Vec3f v, Vec3f onto);`
@ -5008,7 +5008,7 @@ Scales the 3D floating-point vector `v` by the vector `scale`, then rotates it b
| scale | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_transform(OUT Vec3f dest, Vec3f v, Vec3f translation, Vec3s rotation, Vec3f scale);`
@ -5088,7 +5088,7 @@ Determines a vector that is perpendicular (normal) to the plane defined by three
| c | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp find_vector_perpendicular_to_plane(OUT Vec3f dest, Vec3f a, Vec3f b, Vec3f c);`
@ -5317,7 +5317,7 @@ Multiplies the 3D signed-integer vector `b` with the 4x4 floating-point matrix `
| b | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp mtxf_mul_vec3s(Mat4 mtx, OUT Vec3s b);`
@ -5414,7 +5414,7 @@ Extracts the position (translation component) from the transformation matrix `ob
| camMtx | [Mat4](structs.md#Mat4) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp get_pos_from_transform_mtx(OUT Vec3f dest, Mat4 objMtx, Mat4 camMtx);`
@ -5690,7 +5690,7 @@ Sets the components of the 3D floating-point vector `v` to 0
| v | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_zero(OUT Vec3f v);`
@ -5714,7 +5714,7 @@ Copies the contents of a 3D floating-point vector (`src`) into another 3D floati
| src | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_copy(OUT Vec3f dest, Vec3f src);`
@ -5740,7 +5740,7 @@ Sets the values of the 3D floating-point vector `dest` to the given x, y, and z
| z | `number` |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_set(OUT Vec3f dest, f32 x, f32 y, f32 z);`
@ -5764,7 +5764,7 @@ Adds the components of the 3D floating-point vector `a` to `dest`
| a | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_add(OUT Vec3f dest, Vec3f a);`
@ -5789,7 +5789,7 @@ Adds the components of two 3D floating-point vectors `a` and `b` and stores the
| b | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_sum(OUT Vec3f dest, Vec3f a, Vec3f b);`
@ -5813,7 +5813,7 @@ Subtracts the components of the 3D floating-point vector `a` from `dest`
| a | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_sub(OUT Vec3f dest, Vec3f a);`
@ -5838,7 +5838,7 @@ Subtracts the components of the 3D floating-point vector `b` from the components
| b | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_dif(OUT Vec3f dest, Vec3f a, Vec3f b);`
@ -5862,7 +5862,7 @@ Multiplies each component of the 3D floating-point vector `dest` by the scalar v
| a | `number` |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_mul(OUT Vec3f dest, f32 a);`
@ -5886,7 +5886,7 @@ Multiplies the components of the 3D floating-point vector `dest` with the compon
| a | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_mult(OUT Vec3f dest, Vec3f a);`
@ -5911,7 +5911,7 @@ Multiplies the components of two 3D floating-point vectors `a` and `b` and store
| b | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_prod(OUT Vec3f dest, Vec3f a, Vec3f b);`
@ -5935,7 +5935,7 @@ Divides each component of the 3D floating-point vector `dest` by the scalar valu
| a | `number` |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_div(OUT Vec3f dest, f32 a);`
@ -5981,7 +5981,7 @@ Normalizes the 3D floating-point vector `v` so that its length (magnitude) becom
| v | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_normalize(OUT Vec3f v);`
@ -6005,7 +6005,7 @@ Sets the length (magnitude) of 3D floating-point vector `v`, while retaining its
| mag | `number` |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_set_magnitude(OUT Vec3f v, f32 mag);`
@ -6054,7 +6054,7 @@ Computes the cross product of two 3D floating-point vectors `a` and `b` and stor
| b | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_cross(OUT Vec3f dest, Vec3f a, Vec3f b);`
@ -6081,7 +6081,7 @@ Takes two 3D floating-point vectors `vecA` and `vecB`, multiplies them by `sclA`
| sclB | `number` |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3f_combine(OUT Vec3f dest, Vec3f vecA, Vec3f vecB, f32 sclA, f32 sclB);`
@ -6176,7 +6176,7 @@ Converts a 3D floating-point vector `a` into a 3D integer vector and stores the
| a | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3f_to_vec3i(OUT Vec3i dest, Vec3f a);`
@ -6200,7 +6200,7 @@ Converts a 3D floating-point vector `a` into a 3D short integer vector and store
| a | [Vec3f](structs.md#Vec3f) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3f_to_vec3s(OUT Vec3s dest, Vec3f a);`
@ -6229,7 +6229,7 @@ Sets the components of the 3D integer vector `v` to 0
| v | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_zero(OUT Vec3i v);`
@ -6253,7 +6253,7 @@ Copies the contents of a 3D integer vector (`src`) into another 3D integer vecto
| src | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_copy(OUT Vec3i dest, Vec3i src);`
@ -6279,7 +6279,7 @@ Sets the values of the 3D integer vector `dest` to the given x, y, and z values
| z | `integer` |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_set(OUT Vec3i dest, s32 x, s32 y, s32 z);`
@ -6303,7 +6303,7 @@ Adds the components of the 3D integer vector `a` to `dest`
| a | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_add(OUT Vec3i dest, Vec3i a);`
@ -6328,7 +6328,7 @@ Adds the components of two 3D integer vectors `a` and `b` and stores the result
| b | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_sum(OUT Vec3i dest, Vec3i a, Vec3i b);`
@ -6352,7 +6352,7 @@ Subtracts the components of the 3D integer vector `a` from `dest`
| a | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_sub(OUT Vec3i dest, Vec3i a);`
@ -6377,7 +6377,7 @@ Subtracts the components of the 3D integer vector `b` from the components of `a`
| b | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_dif(OUT Vec3i dest, Vec3i a, Vec3i b);`
@ -6401,7 +6401,7 @@ Multiplies each component of the 3D integer vector `dest` by the scalar value `a
| a | `number` |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_mul(OUT Vec3i dest, f32 a);`
@ -6425,7 +6425,7 @@ Multiplies the components of the 3D integer vector `dest` with the components of
| a | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_mult(OUT Vec3i dest, Vec3i a);`
@ -6450,7 +6450,7 @@ Multiplies the components of two 3D integer vectors `a` and `b` and stores the r
| b | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_prod(OUT Vec3i dest, Vec3i a, Vec3i b);`
@ -6474,7 +6474,7 @@ Divides each component of the 3D integer vector `dest` by the scalar value `a`
| a | `number` |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_div(OUT Vec3i dest, f32 a);`
@ -6520,7 +6520,7 @@ Normalizes the 3D integer vector `v` so that its length (magnitude) becomes 1, w
| v | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_normalize(OUT Vec3i v);`
@ -6544,7 +6544,7 @@ Sets the length (magnitude) of 3D integer vector `v`, while retaining its direct
| mag | `number` |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_set_magnitude(OUT Vec3i v, f32 mag);`
@ -6593,7 +6593,7 @@ Computes the cross product of two 3D integer vectors `a` and `b` and stores the
| b | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_cross(OUT Vec3i dest, Vec3i a, Vec3i b);`
@ -6620,7 +6620,7 @@ Takes two 3D integer vectors `vecA` and `vecB`, multiplies them by `sclA` and `s
| sclB | `number` |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3i_combine(OUT Vec3i dest, Vec3i vecA, Vec3i vecB, f32 sclA, f32 sclB);`
@ -6715,7 +6715,7 @@ Converts a 3D integer vector `a` into a 3D floating-point vector and stores the
| a | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3i_to_vec3f(OUT Vec3f dest, Vec3i a);`
@ -6739,7 +6739,7 @@ Converts a 3D integer vector `a` into a 3D short integer vector and stores the r
| a | [Vec3i](structs.md#Vec3i) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3i_to_vec3s(OUT Vec3s dest, Vec3i a);`

View file

@ -25,7 +25,7 @@ Sets the components of the 3D short integer vector `v` to 0
| v | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_zero(OUT Vec3s v);`
@ -49,7 +49,7 @@ Copies the contents of a 3D short integer vector (`src`) into another 3D short i
| src | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_copy(OUT Vec3s dest, Vec3s src);`
@ -75,7 +75,7 @@ Sets the values of the 3D short integer vector `dest` to the given x, y, and z v
| z | `integer` |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_set(OUT Vec3s dest, s16 x, s16 y, s16 z);`
@ -99,7 +99,7 @@ Adds the components of the 3D short integer vector `a` to `dest`
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_add(OUT Vec3s dest, Vec3s a);`
@ -124,7 +124,7 @@ Adds the components of two 3D short integer vectors `a` and `b` and stores the r
| b | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_sum(OUT Vec3s dest, Vec3s a, Vec3s b);`
@ -148,7 +148,7 @@ Subtracts the components of the 3D short integer vector `a` from `dest`
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_sub(OUT Vec3s dest, Vec3s a);`
@ -173,7 +173,7 @@ Subtracts the components of the 3D short integer vector `b` from the components
| b | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_dif(OUT Vec3s dest, Vec3s a, Vec3s b);`
@ -197,7 +197,7 @@ Multiplies each component of the 3D short integer vector `dest` by the scalar va
| a | `number` |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_mul(OUT Vec3s dest, f32 a);`
@ -221,7 +221,7 @@ Multiplies the components of the 3D short integer vector `dest` with the compone
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_mult(OUT Vec3s dest, Vec3s a);`
@ -246,7 +246,7 @@ Multiplies the components of two 3D short integer vectors `a` and `b` and stores
| b | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_prod(OUT Vec3s dest, Vec3s a, Vec3s b);`
@ -270,7 +270,7 @@ Divides each component of the 3D short integer vector `dest` by the scalar value
| a | `number` |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_div(OUT Vec3s dest, f32 a);`
@ -316,7 +316,7 @@ Normalizes the 3D short integer vector `v` so that its length (magnitude) become
| v | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_normalize(OUT Vec3s v);`
@ -340,7 +340,7 @@ Sets the length (magnitude) of 3D short integer vector `v`, while retaining its
| mag | `number` |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_set_magnitude(OUT Vec3s v, f32 mag);`
@ -389,7 +389,7 @@ Computes the cross product of two 3D short integer vectors `a` and `b` and store
| b | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_cross(OUT Vec3s dest, Vec3s a, Vec3s b);`
@ -416,7 +416,7 @@ Takes two 3D short integer vectors `vecA` and `vecB`, multiplies them by `sclA`
| sclB | `number` |
### Returns
[Vec3s](structs.md#Vec3s)
- [Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_combine(OUT Vec3s dest, Vec3s vecA, Vec3s vecB, f32 sclA, f32 sclB);`
@ -511,7 +511,7 @@ Converts a 3D short integer vector `a` into a 3D floating-point vector and store
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3f](structs.md#Vec3f)
- [Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3s_to_vec3f(OUT Vec3f dest, Vec3s a);`
@ -535,7 +535,7 @@ Converts a 3D short integer vector `a` into a 3D integer vector and stores the r
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3i](structs.md#Vec3i)
- [Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3s_to_vec3i(OUT Vec3i dest, Vec3s a);`
@ -828,7 +828,7 @@ Gets the modfs object at path `modPath` or the active mod one if not provided. T
| modPath | `string` |
### Returns
[ModFs](structs.md#ModFs)
- [ModFs](structs.md#ModFs)
### C Prototype
`struct ModFs *mod_fs_get(OPTIONAL const char *modPath);`
@ -851,7 +851,7 @@ Reloads the modfs object at path `modPath`. This function will return nil for a
| modPath | `string` |
### Returns
[ModFs](structs.md#ModFs)
- [ModFs](structs.md#ModFs)
### C Prototype
`struct ModFs *mod_fs_reload(OPTIONAL const char *modPath);`
@ -872,7 +872,7 @@ Creates a modfs object for the active mod if it doesn't exist. Returns the modfs
- None
### Returns
[ModFs](structs.md#ModFs)
- [ModFs](structs.md#ModFs)
### C Prototype
`struct ModFs *mod_fs_create();`
@ -920,7 +920,7 @@ Gets the file object at path `filepath` of the provided `modFs`. This function w
| filepath | `string` |
### Returns
[ModFsFile](structs.md#ModFsFile)
- [ModFsFile](structs.md#ModFsFile)
### C Prototype
`struct ModFsFile *mod_fs_get_file(struct ModFs *modFs, const char *filepath);`
@ -945,7 +945,7 @@ Creates a new file at path `filepath` for the provided `modFs`. Set `text` to tr
| text | `boolean` |
### Returns
[ModFsFile](structs.md#ModFsFile)
- [ModFsFile](structs.md#ModFsFile)
### C Prototype
`struct ModFsFile *mod_fs_create_file(struct ModFs *modFs, const char *filepath, bool text);`
@ -1950,7 +1950,7 @@ Gets a network player from `globalIndex`
| globalIndex | `integer` |
### Returns
[NetworkPlayer](structs.md#NetworkPlayer)
- [NetworkPlayer](structs.md#NetworkPlayer)
### C Prototype
`struct NetworkPlayer* network_player_from_global_index(u8 globalIndex);`
@ -1975,7 +1975,7 @@ Gets the first network player whose information matches `courseNum`, `actNum`, a
| levelNum | `integer` |
### Returns
[NetworkPlayer](structs.md#NetworkPlayer)
- [NetworkPlayer](structs.md#NetworkPlayer)
### C Prototype
`struct NetworkPlayer* get_network_player_from_level(s16 courseNum, s16 actNum, s16 levelNum);`
@ -2001,7 +2001,7 @@ Gets the first network player whose information matches `courseNum`, `actNum`, `
| areaIndex | `integer` |
### Returns
[NetworkPlayer](structs.md#NetworkPlayer)
- [NetworkPlayer](structs.md#NetworkPlayer)
### C Prototype
`struct NetworkPlayer* get_network_player_from_area(s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex);`
@ -2022,7 +2022,7 @@ Gets the active network player with the smallest global index. Useful for assign
- None
### Returns
[NetworkPlayer](structs.md#NetworkPlayer)
- [NetworkPlayer](structs.md#NetworkPlayer)
### C Prototype
`struct NetworkPlayer* get_network_player_smallest_global(void);`
@ -2712,7 +2712,7 @@ Gets the nearest active Mario who isn't bubbled to `obj`
| obj | [Object](structs.md#Object) |
### Returns
[MarioState](structs.md#MarioState)
- [MarioState](structs.md#MarioState)
### C Prototype
`struct MarioState* nearest_mario_state_to_object(struct Object *obj);`
@ -2735,7 +2735,7 @@ Gets the nearest possible Mario to `obj` despite anything like bubbled state or
| obj | [Object](structs.md#Object) |
### Returns
[MarioState](structs.md#MarioState)
- [MarioState](structs.md#MarioState)
### C Prototype
`struct MarioState* nearest_possible_mario_state_to_object(struct Object *obj);`
@ -2758,7 +2758,7 @@ Gets the nearest player (Mario Object) to `obj`
| obj | [Object](structs.md#Object) |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* nearest_player_to_object(struct Object *obj);`
@ -2781,7 +2781,7 @@ Gets the nearest interacting Mario to `obj`
| obj | [Object](structs.md#Object) |
### Returns
[MarioState](structs.md#MarioState)
- [MarioState](structs.md#MarioState)
### C Prototype
`struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj);`
@ -2804,7 +2804,7 @@ Gets the nearest interacting player (Mario Object) to `obj`
| obj | [Object](structs.md#Object) |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *nearest_interacting_player_to_object(struct Object *obj);`
@ -4230,7 +4230,7 @@ Moves the current object for specifically one second (`oTimer` < 30)
| movePitch | `integer` |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, s32 model, f32 startSpeed, f32 endSpeed, s16 movePitch);`

View file

@ -597,7 +597,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);`
@ -1251,7 +1251,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);`
@ -1289,7 +1289,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object* cur_obj_find_nearest_pole(void);`
@ -1310,7 +1310,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
| dist | `Pointer` <`number`> |
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *cur_obj_find_nearest_object_with_behavior(const BehaviorScript *behavior, f32 *dist);`
@ -1349,7 +1349,7 @@ Multiplies a vector by the transpose of a matrix of the form: `| ? ? ? 0 |` `| ?
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *find_unimportant_object(void);`
@ -1407,7 +1407,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);`
@ -1428,7 +1428,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);`
@ -1937,7 +1937,7 @@ Marks an object to be unloaded at the end of the frame
- None
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface *cur_obj_update_floor_height_and_get_floor(void);`
@ -3739,7 +3739,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);`
@ -5502,7 +5502,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);`
@ -5625,7 +5625,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);`
@ -5955,7 +5955,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 +6451,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);`
@ -7182,7 +7182,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);`
@ -7207,7 +7207,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);`
@ -7228,7 +7228,7 @@ Gets the generated water floor surface used when riding a shell
- None
### Returns
[Surface](structs.md#Surface)
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface* get_water_surface_pseudo_floor(void);`
@ -7272,7 +7272,7 @@ Returns a temporary wall collision data pointer
- None
### Returns
[WallCollisionData](structs.md#WallCollisionData)
- [WallCollisionData](structs.md#WallCollisionData)
### C Prototype
`struct WallCollisionData* collision_get_temp_wall_collision_data(void);`
@ -7296,7 +7296,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);`

View file

@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -595,7 +595,7 @@ Gets the DJUI menu theme
- None
### Returns
[DjuiTheme](structs.md#DjuiTheme)
- [DjuiTheme](structs.md#DjuiTheme)
### C Prototype
`struct DjuiTheme* djui_menu_get_theme(void);`
@ -1655,7 +1655,7 @@ Gets the system clock's date and time
- None
### Returns
[DateTime](structs.md#DateTime)
- [DateTime](structs.md#DateTime)
### C Prototype
`struct DateTime* get_date_and_time(void);`
@ -2052,7 +2052,7 @@ Gets the mod currently being processed
- None
### Returns
[Mod](structs.md#Mod)
- [Mod](structs.md#Mod)
### C Prototype
`struct Mod* get_active_mod(void);`
@ -2138,7 +2138,7 @@ Gets the current GraphNodeRoot
- None
### Returns
[GraphNodeRoot](structs.md#GraphNodeRoot)
- [GraphNodeRoot](structs.md#GraphNodeRoot)
### C Prototype
`struct GraphNodeRoot* geo_get_current_root(void);`
@ -2159,7 +2159,7 @@ Gets the current GraphNodeMasterList
- None
### Returns
[GraphNodeMasterList](structs.md#GraphNodeMasterList)
- [GraphNodeMasterList](structs.md#GraphNodeMasterList)
### C Prototype
`struct GraphNodeMasterList* geo_get_current_master_list(void);`
@ -2180,7 +2180,7 @@ Gets the current GraphNodePerspective
- None
### Returns
[GraphNodePerspective](structs.md#GraphNodePerspective)
- [GraphNodePerspective](structs.md#GraphNodePerspective)
### C Prototype
`struct GraphNodePerspective* geo_get_current_perspective(void);`
@ -2201,7 +2201,7 @@ Gets the current GraphNodeCamera
- None
### Returns
[GraphNodeCamera](structs.md#GraphNodeCamera)
- [GraphNodeCamera](structs.md#GraphNodeCamera)
### C Prototype
`struct GraphNodeCamera* geo_get_current_camera(void);`
@ -2222,7 +2222,7 @@ Gets the current GraphNodeHeldObject
- 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);`
@ -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);`
@ -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);`
@ -2498,7 +2498,7 @@ When used in a geo function, retrieve the current processed object
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *geo_get_current_object(void);`
@ -2519,7 +2519,7 @@ Gets the object currently being processed
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *get_current_object(void);`
@ -2540,7 +2540,7 @@ Gets the NPC object Mario is talking to
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *get_dialog_object(void);`
@ -2561,7 +2561,7 @@ Gets the cutscene focus object
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *get_cutscene_focus(void);`
@ -2582,7 +2582,7 @@ Gets the secondary camera focus object
- None
### Returns
[Object](structs.md#Object)
- [Object](structs.md#Object)
### C Prototype
`struct Object *get_secondary_camera_focus(void);`
@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -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);`
@ -3157,7 +3157,7 @@ Returns a temporary object hitbox pointer
- None
### Returns
[ObjectHitbox](structs.md#ObjectHitbox)
- [ObjectHitbox](structs.md#ObjectHitbox)
### C Prototype
`struct ObjectHitbox* get_temp_object_hitbox(void);`
@ -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);`
@ -4813,7 +4813,7 @@ Loads the object's collision data into static collision. You may run this only o
- None
### Returns
[StaticObjectCollision](structs.md#StaticObjectCollision)
- [StaticObjectCollision](structs.md#StaticObjectCollision)
### C Prototype
`struct StaticObjectCollision *load_static_object_collision();`
@ -4861,7 +4861,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);`
@ -4885,7 +4885,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);`
@ -4937,7 +4937,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);`

620
docs/lua/functions-8.md Normal file
View file

@ -0,0 +1,620 @@
## [:rewind: Lua Functions](functions.md)
---
[< prev](functions-7.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | [5](functions-5.md) | [6](functions-6.md) | [7](functions-7.md) | 8]
---
# functions from spawn_sound.h
<br />
## [cur_obj_play_sound_1](#cur_obj_play_sound_1)
### Description
Plays a sound if the current object is visible
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = cur_obj_play_sound_1(soundMagic)`
### Parameters
| Field | Type |
| ----- | ---- |
| soundMagic | `integer` |
### Returns
- None
### C Prototype
`void cur_obj_play_sound_1(s32 soundMagic);`
[:arrow_up_small:](#)
<br />
## [cur_obj_play_sound_2](#cur_obj_play_sound_2)
### Description
Plays a sound if the current object is visible and queues rumble for specific sounds
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c75000> = cur_obj_play_sound_2(soundMagic)`
### Parameters
| Field | Type |
| ----- | ---- |
| soundMagic | `integer` |
### Returns
- None
### C Prototype
`void cur_obj_play_sound_2(s32 soundMagic);`
[:arrow_up_small:](#)
<br />
## [create_sound_spawner](#create_sound_spawner)
### Description
Create a sound spawner for objects that need a sound play once. (Breakable walls, King Bobomb exploding, etc)
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = create_sound_spawner(soundMagic)`
### Parameters
| Field | Type |
| ----- | ---- |
| soundMagic | `integer` |
### Returns
- None
### C Prototype
`void create_sound_spawner(s32 soundMagic);`
[:arrow_up_small:](#)
<br />
## [calc_dist_to_volume_range_1](#calc_dist_to_volume_range_1)
### Description
Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124. What an even more strange and confusing function
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = calc_dist_to_volume_range_1(distance)`
### Parameters
| Field | Type |
| ----- | ---- |
| distance | `number` |
### Returns
- `integer`
### C Prototype
`s32 calc_dist_to_volume_range_1(f32 distance);`
[:arrow_up_small:](#)
<br />
## [calc_dist_to_volume_range_2](#calc_dist_to_volume_range_2)
### Description
Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127. What a strange and confusing function
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = calc_dist_to_volume_range_2(distance)`
### Parameters
| Field | Type |
| ----- | ---- |
| distance | `number` |
### Returns
- `integer`
### C Prototype
`s32 calc_dist_to_volume_range_2(f32 distance);`
[:arrow_up_small:](#)
<br />
---
# functions from surface_collision.h
<br />
## [find_wall_collisions](#find_wall_collisions)
### Description
Detects wall collisions at a given position and adjusts the position based on the walls found. Returns the number of wall collisions detected
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = find_wall_collisions(colData)`
### Parameters
| Field | Type |
| ----- | ---- |
| colData | [WallCollisionData](structs.md#WallCollisionData) |
### Returns
- `integer`
### C Prototype
`s32 find_wall_collisions(struct WallCollisionData *colData);`
[:arrow_up_small:](#)
<br />
## [find_ceil](#find_ceil)
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = find_ceil(posX, posY, posZ, pceil)`
### Parameters
| Field | Type |
| ----- | ---- |
| posX | `number` |
| posY | `number` |
| posZ | `number` |
| pceil | [Surface](structs.md#Surface) |
### Returns
- `number`
### C Prototype
`f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil);`
[:arrow_up_small:](#)
<br />
## [find_ceil_height](#find_ceil_height)
### Description
Finds the height of the highest ceiling above a given position (x, y, z). If no ceiling is found, returns the default height limit of `gLevelValues.cellHeightLimit`(20000 by default)
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = find_ceil_height(x, y, z)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| y | `number` |
| z | `number` |
### Returns
- `number`
### C Prototype
`f32 find_ceil_height(f32 x, f32 y, f32 z);`
[:arrow_up_small:](#)
<br />
## [find_floor_height_and_data](#find_floor_height_and_data)
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = find_floor_height_and_data(xPos, yPos, zPos, floorGeo)`
### Parameters
| Field | Type |
| ----- | ---- |
| xPos | `number` |
| yPos | `number` |
| zPos | `number` |
| floorGeo | [FloorGeometry](structs.md#FloorGeometry) |
### Returns
- `number`
### C Prototype
`f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometry **floorGeo);`
[:arrow_up_small:](#)
<br />
## [find_floor_height](#find_floor_height)
### Description
Finds the height of the highest floor below a given position (x, y, z). If no floor is found, returns the default floor height of `gLevelValues.floorLowerLimit`(-11000 by default)
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = find_floor_height(x, y, z)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| y | `number` |
| z | `number` |
### Returns
- `number`
### C Prototype
`f32 find_floor_height(f32 x, f32 y, f32 z);`
[:arrow_up_small:](#)
<br />
## [find_floor](#find_floor)
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = find_floor(xPos, yPos, zPos, pfloor)`
### Parameters
| Field | Type |
| ----- | ---- |
| xPos | `number` |
| yPos | `number` |
| zPos | `number` |
| pfloor | [Surface](structs.md#Surface) |
### Returns
- `number`
### C Prototype
`f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor);`
[:arrow_up_small:](#)
<br />
## [find_water_level](#find_water_level)
### Description
Finds the height of water at a given position (x, z), if the position is within a water region. If no water is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = find_water_level(x, z)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| z | `number` |
### Returns
- `number`
### C Prototype
`f32 find_water_level(f32 x, f32 z);`
[:arrow_up_small:](#)
<br />
## [find_poison_gas_level](#find_poison_gas_level)
### Description
Finds the height of the poison gas at a given position (x, z), if the position is within a gas region. If no gas is found, returns the default height of `gLevelValues.floorLowerLimit`(-11000 by default)
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = find_poison_gas_level(x, z)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| z | `number` |
### Returns
- `number`
### C Prototype
`f32 find_poison_gas_level(f32 x, f32 z);`
[:arrow_up_small:](#)
<br />
## [find_surface_on_ray](#find_surface_on_ray)
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = find_surface_on_ray(orig, dir, hit_surface, hit_pos, precision)`
### Parameters
| Field | Type |
| ----- | ---- |
| orig | [Vec3f](structs.md#Vec3f) |
| dir | [Vec3f](structs.md#Vec3f) |
| hit_surface | [Surface](structs.md#Surface) |
| hit_pos | [Vec3f](structs.md#Vec3f) |
| precision | `number` |
### Returns
- None
### C Prototype
`void find_surface_on_ray(Vec3f orig, Vec3f dir, struct Surface **hit_surface, Vec3f hit_pos, f32 precision);`
[:arrow_up_small:](#)
<br />
## [set_find_wall_direction](#set_find_wall_direction)
### Description
Sets whether collision finding functions should check wall directions.
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = set_find_wall_direction(dir, active, airborne)`
### Parameters
| Field | Type |
| ----- | ---- |
| dir | [Vec3f](structs.md#Vec3f) |
| active | `boolean` |
| airborne | `boolean` |
### Returns
- None
### C Prototype
`void set_find_wall_direction(Vec3f dir, bool active, bool airborne);`
[:arrow_up_small:](#)
<br />
## [closest_point_to_triangle](#closest_point_to_triangle)
### Description
Gets the closest point of the triangle to `src` and returns it in `out`.
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = closest_point_to_triangle(surf, src, out)`
### Parameters
| Field | Type |
| ----- | ---- |
| surf | [Surface](structs.md#Surface) |
| src | [Vec3f](structs.md#Vec3f) |
| out | [Vec3f](structs.md#Vec3f) |
### Returns
- None
### C Prototype
`void closest_point_to_triangle(struct Surface* surf, Vec3f src, OUT Vec3f out);`
[:arrow_up_small:](#)
<br />
---
# functions from surface_load.h
<br />
## [load_object_collision_model](#load_object_collision_model)
### Description
Loads the object's collision data into dynamic collision. You must run this every frame in your object's behavior loop for it to have collision
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = load_object_collision_model()`
### Parameters
- None
### Returns
- None
### C Prototype
`void load_object_collision_model(void);`
[:arrow_up_small:](#)
<br />
## [load_static_object_collision](#load_static_object_collision)
### Description
Loads the object's collision data into static collision. You may run this only once to capture the object's collision at that frame.
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = load_static_object_collision()`
### Parameters
- None
### Returns
- [StaticObjectCollision](structs.md#StaticObjectCollision)
### C Prototype
`struct StaticObjectCollision *load_static_object_collision();`
[:arrow_up_small:](#)
<br />
## [toggle_static_object_collision](#toggle_static_object_collision)
### Description
Toggles a collection of static object surfaces
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = toggle_static_object_collision(col, tangible)`
### Parameters
| Field | Type |
| ----- | ---- |
| col | [StaticObjectCollision](structs.md#StaticObjectCollision) |
| tangible | `boolean` |
### Returns
- None
### C Prototype
`void toggle_static_object_collision(struct StaticObjectCollision *col, bool tangible);`
[:arrow_up_small:](#)
<br />
## [get_static_object_surface](#get_static_object_surface)
### Description
Gets a surface corresponding to `index` from the static object collision
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = get_static_object_surface(col, index)`
### Parameters
| Field | Type |
| ----- | ---- |
| col | [StaticObjectCollision](structs.md#StaticObjectCollision) |
| index | `integer` |
### Returns
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface *get_static_object_surface(struct StaticObjectCollision *col, u32 index);`
[:arrow_up_small:](#)
<br />
## [obj_get_surface_from_index](#obj_get_surface_from_index)
### Description
Gets a surface corresponding to `index` from the surface pool buffer
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = obj_get_surface_from_index(o, index)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
| index | `integer` |
### Returns
- [Surface](structs.md#Surface)
### C Prototype
`struct Surface *obj_get_surface_from_index(struct Object *o, u32 index);`
[:arrow_up_small:](#)
<br />
## [surface_has_force](#surface_has_force)
### Description
Checks if a surface has force
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = surface_has_force(surfaceType)`
### Parameters
| Field | Type |
| ----- | ---- |
| surfaceType | `integer` |
### Returns
- `boolean`
### C Prototype
`bool surface_has_force(s16 surfaceType);`
[:arrow_up_small:](#)
<br />
---
# functions from sync_object.h
<br />
## [sync_object_get_object](#sync_object_get_object)
### Description
Retrieves an object from a sync ID
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = sync_object_get_object(syncId)`
### Parameters
| Field | Type |
| ----- | ---- |
| syncId | `integer` |
### Returns
- [Object](structs.md#Object)
### C Prototype
`struct Object* sync_object_get_object(u32 syncId);`
[:arrow_up_small:](#)
<br />
## [sync_object_is_initialized](#sync_object_is_initialized)
### Description
Checks if a sync object is initialized using a `syncId`
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = sync_object_is_initialized(syncId)`
### Parameters
| Field | Type |
| ----- | ---- |
| syncId | `integer` |
### Returns
- `boolean`
### C Prototype
`bool sync_object_is_initialized(u32 syncId);`
[:arrow_up_small:](#)
<br />
## [sync_object_is_owned_locally](#sync_object_is_owned_locally)
### Description
Checks if a sync object is owned locally using a `syncId`
### Lua Example
`local <generator object doc_function.<locals>.<genexpr> at 0x000001e039c74f20> = sync_object_is_owned_locally(syncId)`
### Parameters
| Field | Type |
| ----- | ---- |
| syncId | `integer` |
### Returns
- `boolean`
### C Prototype
`bool sync_object_is_owned_locally(u32 syncId);`
[:arrow_up_small:](#)
<br />
---
[< prev](functions-7.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | [5](functions-5.md) | [6](functions-6.md) | [7](functions-7.md) | 8]

View file

@ -2747,7 +2747,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);`
@ -2768,7 +2768,7 @@ Gets the first warp node found in the area, otherwise returns nil
- None
### Returns
[ObjectWarpNode](structs.md#ObjectWarpNode)
- [ObjectWarpNode](structs.md#ObjectWarpNode)
### C Prototype
`struct ObjectWarpNode *area_get_any_warp_node(void);`
@ -2791,7 +2791,7 @@ Finds a warp node in the current area using parameters from the provided object.
| o | [Object](structs.md#Object) |
### Returns
[ObjectWarpNode](structs.md#ObjectWarpNode)
- [ObjectWarpNode](structs.md#ObjectWarpNode)
### C Prototype
`struct ObjectWarpNode *area_get_warp_node_from_params(struct Object *o);`

View file

@ -13,6 +13,10 @@
// Optional parameters must be contiguous until the last parameter (a mandatory parameter following an optional parameter is not allowed)
#define OPTIONAL
// A macro to tell autogen this function returns more than one value
// Fill this in with the types returned
#define RETURNS(...) void
// A macro to tell autogen the field `name` is a function member of the struct that calls `c_function`
#define FUNCTION(name, c_function)