A bunch of LUA autogen additions. (#235)

* A bunch of LUA autogen additions.
- Add support for Vec4f, Vec4s and Mat4 in the autogen.
- Improve error messages for improper argument counts
- Added support for more pointer types in the autogen.

* Fix offsets in sMat4Fields.

* autogen: Rework this at the request of DJ.
This commit is contained in:
Prince Frizzy 2022-11-30 03:37:12 -05:00 committed by GitHub
parent 36d85af91b
commit 523e7842d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 17066 additions and 5562 deletions

View file

@ -2,6 +2,8 @@ import os
usf_types = ['u8', 'u16', 'u32', 'u64', 's8', 's16', 's32', 's64', 'f32']
vec3_types = ['Vec3s', 'Vec3f', 'Color']
vec4_types = ['Vec4s', 'Vec4f']
mat4_types = ['Mat4', 'Mtx']
typedef_pointers = ['BehaviorScript', 'ObjectAnimPointer', 'Collision', 'LevelScript', 'Trajectory']
exclude_structs = [
@ -16,54 +18,99 @@ def get_path(p):
return os.path.dirname(os.path.realpath(__file__)) + '/../' + p
def translate_type_to_lvt(ptype):
if ptype == 'char':
ptype = 'u8'
pointerLvl = 0
if ptype == "char":
ptype = "u8"
if 'const ' in ptype:
ptype = ptype.replace('const ', '').strip()
if "const " in ptype:
ptype = ptype.replace("const ", "").strip()
if ('char' in ptype and '[' in ptype):
return 'LVT_STRING'
if ("char" in ptype and "[" in ptype):
return "LVT_STRING"
if ptype == 'char*':
return 'LVT_STRING_P'
if "[" in ptype or "{" in ptype:
return "LOT_???"
# Strip out our pointer stars to get the true type.
if "*" in ptype:
# Count how many stars there is for our pointer level.
pointerLvl = ptype.count("*")
ptype = ptype.replace("*", "").strip()
if ptype == "char" and pointerLvl == 1:
return "LVT_STRING_P"
if '[' in ptype or '{' in ptype:
return 'LOT_???'
if "enum " in ptype:
if pointerLvl > 1:
return "LVT_???"
if pointerLvl == 1:
return "LVT_S32_P"
return "LVT_S32"
if 'enum ' in ptype:
return 'LVT_S32'
if ptype == 'bool':
return 'LVT_BOOL'
if ptype == "bool":
if pointerLvl > 1:
return "LVT_???"
if pointerLvl == 1:
return "LVT_BOOL_P"
return "LVT_BOOL"
if ptype in usf_types:
return 'LVT_' + ptype.upper()
if pointerLvl > 1:
return "LVT_???"
if pointerLvl == 1:
return "LVT_" + ptype.upper() + "_P"
return "LVT_" + ptype.upper()
if ptype in vec3_types:
return 'LVT_COBJECT'
if pointerLvl > 1:
return "LVT_???"
if pointerLvl == 1:
return "LVT_COBJECT_P"
return "LVT_COBJECT"
if ptype in vec4_types:
if pointerLvl > 1:
return "LVT_???"
if pointerLvl == 1:
return "LVT_COBJECT_P"
return "LVT_COBJECT"
if ptype in mat4_types:
if pointerLvl > 1:
return "LVT_???"
if pointerLvl == 1:
return "LVT_COBJECT_P"
return "LVT_COBJECT"
if ptype == 'float':
return 'LVT_F32'
if ptype == "float":
if pointerLvl > 1:
return "LVT_???"
if pointerLvl == 1:
return "LVT_F32_P"
return "LVT_F32"
if ptype == 'LuaFunction':
return 'LVT_LUAFUNCTION'
if ptype == "LuaFunction":
return "LVT_LUAFUNCTION"
if 'struct' in ptype:
if ptype.count('*') > 1:
return 'LVT_???'
if '*' in ptype:
return 'LVT_COBJECT_P'
return 'LVT_COBJECT'
if "struct" in ptype:
if pointerLvl > 1:
return "LVT_???"
if pointerLvl == 1:
return "LVT_COBJECT_P"
return "LVT_COBJECT"
if ptype.count('*') == 1 and '(' not in ptype and '[' not in ptype:
ptype = ptype.replace('const', '').replace('*', '').strip()
if pointerLvl == 1 and "(" not in ptype and "[" not in ptype:
ptype = ptype.replace("const", "").replace("*", "").strip()
if ptype in usf_types or ptype in typedef_pointers:
return 'LVT_%s_P' % ptype.upper()
return "LVT_%s_P" % ptype.upper()
return 'LVT_???'
return "LVT_???"
def translate_type_to_lot(ptype):
if ptype == 'void':
return 'LOT_NONE'
if ptype == 'const char*':
return 'LOT_NONE'
@ -90,6 +137,12 @@ def translate_type_to_lot(ptype):
if ptype in vec3_types:
return 'LOT_' + ptype.upper()
if ptype in vec4_types:
return 'LOT_' + ptype.upper()
if ptype in mat4_types:
return 'LOT_' + ptype.upper()
if ptype == 'float':
return 'LOT_NONE'
@ -110,7 +163,7 @@ def translate_type_to_lot(ptype):
if ptype.count('*') == 1 and '???' not in translate_type_to_lvt(ptype):
return 'LOT_POINTER'
return 'LOT_???'
def translate_type_to_lua(ptype):
@ -135,8 +188,7 @@ def translate_type_to_lua(ptype):
if ptype in usf_types:
if ptype.startswith('f'):
return '`number`', None
else:
return '`integer`', None
return '`integer`', None
if ptype == 'char':
return '`integer`', None

View file

@ -72,7 +72,7 @@ override_allowed_functions = {
override_disallowed_functions = {
"src/audio/external.h": [ " func_" ],
"src/engine/math_util.h": [ "atan2s", "atan2f" ],
"src/engine/math_util.h": [ "atan2s", "atan2f", "vec3s_sub" ],
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
@ -159,6 +159,90 @@ param_override_build['Vec3s'] = {
'after': param_vec3s_after_call
}
param_vec4f_before_call = """
f32* $[IDENTIFIER] = smlua_get_vec4f_from_buffer();
$[IDENTIFIER][0] = smlua_get_number_field($[INDEX], "x");
$[IDENTIFIER][1] = smlua_get_number_field($[INDEX], "y");
$[IDENTIFIER][2] = smlua_get_number_field($[INDEX], "z");
$[IDENTIFIER][3] = smlua_get_number_field($[INDEX], "w");
"""
param_vec4f_after_call = """
smlua_push_number_field($[INDEX], "x", $[IDENTIFIER][0]);
smlua_push_number_field($[INDEX], "y", $[IDENTIFIER][1]);
smlua_push_number_field($[INDEX], "z", $[IDENTIFIER][2]);
smlua_push_number_field($[INDEX], "w", $[IDENTIFIER][3]);
"""
param_override_build['Vec4f'] = {
'before': param_vec4f_before_call,
'after': param_vec4f_after_call
}
param_vec4s_before_call = """
s16* $[IDENTIFIER] = smlua_get_vec4s_from_buffer();
$[IDENTIFIER][0] = smlua_get_integer_field($[INDEX], "x");
$[IDENTIFIER][1] = smlua_get_integer_field($[INDEX], "y");
$[IDENTIFIER][2] = smlua_get_integer_field($[INDEX], "z");
$[IDENTIFIER][3] = smlua_get_integer_field($[INDEX], "w");
"""
param_vec4s_after_call = """
smlua_push_integer_field($[INDEX], "x", $[IDENTIFIER][0]);
smlua_push_integer_field($[INDEX], "y", $[IDENTIFIER][1]);
smlua_push_integer_field($[INDEX], "z", $[IDENTIFIER][2]);
smlua_push_integer_field($[INDEX], "w", $[IDENTIFIER][3]);
"""
param_override_build['Vec4s'] = {
'before': param_vec4s_before_call,
'after': param_vec4s_after_call
}
param_mat4_before_call = """
Mat4 $[IDENTIFIER];
$[IDENTIFIER][0][0] = smlua_get_number_field($[INDEX], "a");
$[IDENTIFIER][0][1] = smlua_get_number_field($[INDEX], "b");
$[IDENTIFIER][0][2] = smlua_get_number_field($[INDEX], "c");
$[IDENTIFIER][0][3] = smlua_get_number_field($[INDEX], "d");
$[IDENTIFIER][1][0] = smlua_get_number_field($[INDEX], "e");
$[IDENTIFIER][1][1] = smlua_get_number_field($[INDEX], "f");
$[IDENTIFIER][1][2] = smlua_get_number_field($[INDEX], "g");
$[IDENTIFIER][1][3] = smlua_get_number_field($[INDEX], "h");
$[IDENTIFIER][2][0] = smlua_get_number_field($[INDEX], "i");
$[IDENTIFIER][2][1] = smlua_get_number_field($[INDEX], "j");
$[IDENTIFIER][2][2] = smlua_get_number_field($[INDEX], "k");
$[IDENTIFIER][2][3] = smlua_get_number_field($[INDEX], "l");
$[IDENTIFIER][3][0] = smlua_get_number_field($[INDEX], "m");
$[IDENTIFIER][3][1] = smlua_get_number_field($[INDEX], "n");
$[IDENTIFIER][3][2] = smlua_get_number_field($[INDEX], "o");
$[IDENTIFIER][3][3] = smlua_get_number_field($[INDEX], "p");
"""
param_mat4_after_call = """
smlua_push_number_field($[INDEX], "a", $[IDENTIFIER][0][0]);
smlua_push_number_field($[INDEX], "b", $[IDENTIFIER][0][1]);
smlua_push_number_field($[INDEX], "c", $[IDENTIFIER][0][2]);
smlua_push_number_field($[INDEX], "d", $[IDENTIFIER][0][3]);
smlua_push_number_field($[INDEX], "e", $[IDENTIFIER][1][0]);
smlua_push_number_field($[INDEX], "f", $[IDENTIFIER][1][1]);
smlua_push_number_field($[INDEX], "g", $[IDENTIFIER][1][2]);
smlua_push_number_field($[INDEX], "h", $[IDENTIFIER][1][3]);
smlua_push_number_field($[INDEX], "i", $[IDENTIFIER][2][0]);
smlua_push_number_field($[INDEX], "j", $[IDENTIFIER][2][1]);
smlua_push_number_field($[INDEX], "k", $[IDENTIFIER][2][2]);
smlua_push_number_field($[INDEX], "l", $[IDENTIFIER][2][3]);
smlua_push_number_field($[INDEX], "m", $[IDENTIFIER][3][0]);
smlua_push_number_field($[INDEX], "n", $[IDENTIFIER][3][1]);
smlua_push_number_field($[INDEX], "o", $[IDENTIFIER][3][2]);
smlua_push_number_field($[INDEX], "p", $[IDENTIFIER][3][3]);
"""
param_override_build['Mat4'] = {
'before': param_mat4_before_call,
'after': param_mat4_after_call
}
param_color_before_call = """
u8* $[IDENTIFIER] = smlua_get_color_from_buffer();
$[IDENTIFIER][0] = smlua_get_integer_field($[INDEX], "r");
@ -470,6 +554,10 @@ def build_call(function):
if ftype == 'void':
return ' %s;\n' % ccall
# We can't possibly know the type of a void pointer,
# So we just don't return anything from it
elif ftype == 'void *':
return ' %s;\n' % ccall
flot = translate_type_to_lot(ftype)
@ -501,12 +589,17 @@ def build_function(function, do_extern):
else:
s = 'int smlua_func_%s(lua_State* L) {\n' % function['identifier']
s += ' if(!smlua_functions_valid_param_count(L, %d)) { return 0; }\n\n' % len(function['params'])
s += """ if (L == NULL) { return 0; }\n
int top = lua_gettop(L);
if (top != %d) {
LOG_LUA_LINE("Improper param count for '%%s': Expected %%u, Received %%u", "%s", %d, top);
return 0;
}\n\n""" % (len(function['params']), function['identifier'], len(function['params']))
i = 1
for param in function['params']:
s += build_param(param, i)
s += ' if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %d for function \'%s\'"); return 0; }\n' % (i, fid)
s += ' if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %%u for function \'%%s\'", %d, "%s"); return 0; }\n' % (i, fid)
i += 1
s += '\n'

View file

@ -4601,6 +4601,12 @@ function generate_yellow_sparkles(x, y, z, radius)
-- ...
end
--- @param str Pointer_integer
--- @return integer
function get_credits_str_width(str)
-- ...
end
--- @param m MarioState
--- @return integer
function get_star_collection_dialog(m)
@ -5121,6 +5127,13 @@ function stop_and_set_height_to_floor(arg0)
-- ...
end
--- @param m MarioState
--- @param keyFrames Pointer_Vec4s
--- @return nil
function anim_spline_init(m, keyFrames)
-- ...
end
--- @param m MarioState
--- @param result Vec3f
--- @return integer
@ -5146,6 +5159,148 @@ function approach_s32(current, target, inc, dec)
-- ...
end
--- @param dest Vec3f
--- @param a Vec3f
--- @param b Vec3f
--- @param c Vec3f
--- @return void*
function find_vector_perpendicular_to_plane(dest, a, b, c)
-- ...
end
--- @param dest Vec3f
--- @param objMtx Mat4
--- @param camMtx Mat4
--- @return nil
function get_pos_from_transform_mtx(dest, objMtx, camMtx)
-- ...
end
--- @param dest Mat4
--- @param upDir Vec3f
--- @param pos Vec3f
--- @param yaw integer
--- @return nil
function mtxf_align_terrain_normal(dest, upDir, pos, yaw)
-- ...
end
--- @param mtx Mat4
--- @param pos Vec3f
--- @param yaw integer
--- @param radius number
--- @return nil
function mtxf_align_terrain_triangle(mtx, pos, yaw, radius)
-- ...
end
--- @param dest Mat4
--- @param mtx Mat4
--- @param position Vec3f
--- @param angle integer
--- @return nil
function mtxf_billboard(dest, mtx, position, angle)
-- ...
end
--- @param dest Mat4
--- @param src Mat4
--- @return nil
function mtxf_copy(dest, src)
-- ...
end
--- @param dest Mat4
--- @param mtx Mat4
--- @param position Vec3f
--- @param angle integer
--- @return nil
function mtxf_cylboard(dest, mtx, position, angle)
-- ...
end
--- @param mtx Mat4
--- @return nil
function mtxf_identity(mtx)
-- ...
end
--- @param dest Mat4
--- @param src Mat4
--- @return nil
function mtxf_inverse(dest, src)
-- ...
end
--- @param mtx Mat4
--- @param from Vec3f
--- @param to Vec3f
--- @param roll integer
--- @return nil
function mtxf_lookat(mtx, from, to, roll)
-- ...
end
--- @param dest Mat4
--- @param a Mat4
--- @param b Mat4
--- @return nil
function mtxf_mul(dest, a, b)
-- ...
end
--- @param mtx Mat4
--- @param b Vec3s
--- @return nil
function mtxf_mul_vec3s(mtx, b)
-- ...
end
--- @param mtx Pointer_Mtx
--- @param angle integer
--- @return nil
function mtxf_rotate_xy(mtx, angle)
-- ...
end
--- @param dest Mat4
--- @param b Vec3f
--- @param c Vec3s
--- @return nil
function mtxf_rotate_xyz_and_translate(dest, b, c)
-- ...
end
--- @param dest Mat4
--- @param translate Vec3f
--- @param rotate Vec3s
--- @return nil
function mtxf_rotate_zxy_and_translate(dest, translate, rotate)
-- ...
end
--- @param dest Mat4
--- @param mtx Mat4
--- @param s Vec3f
--- @return nil
function mtxf_scale_vec3f(dest, mtx, s)
-- ...
end
--- @param dest Pointer_Mtx
--- @param src Mat4
--- @return nil
function mtxf_to_mtx(dest, src)
-- ...
end
--- @param dest Mat4
--- @param b Vec3f
--- @return nil
function mtxf_translate(dest, b)
-- ...
end
--- @param value number
--- @param replacement number
--- @return number
@ -5153,6 +5308,22 @@ function not_zero(value, replacement)
-- ...
end
--- @param m MarioState
--- @param result Vec4f
--- @param t number
--- @param c integer
--- @return nil
function spline_get_weights(m, result, t, c)
-- ...
end
--- @param dest Vec3f
--- @param a Vec3f
--- @return void*
function vec3f_add(dest, a)
-- ...
end
--- @param dest Vec3f
--- @param vecA Vec3f
--- @param vecB Vec3f
@ -5163,6 +5334,29 @@ function vec3f_combine(dest, vecA, vecB, sclA, sclB)
-- ...
end
--- @param dest Vec3f
--- @param src Vec3f
--- @return void*
function vec3f_copy(dest, src)
-- ...
end
--- @param dest Vec3f
--- @param a Vec3f
--- @param b Vec3f
--- @return void*
function vec3f_cross(dest, a, b)
-- ...
end
--- @param dest Vec3f
--- @param a Vec3f
--- @param b Vec3f
--- @return void*
function vec3f_dif(dest, a, b)
-- ...
end
--- @param v1 Vec3f
--- @param v2 Vec3f
--- @return number
@ -5193,6 +5387,19 @@ function vec3f_length(a)
-- ...
end
--- @param dest Vec3f
--- @param a number
--- @return void*
function vec3f_mul(dest, a)
-- ...
end
--- @param dest Vec3f
--- @return void*
function vec3f_normalize(dest)
-- ...
end
--- @param vec Vec3f
--- @param onto Vec3f
--- @param out Vec3f
@ -5201,6 +5408,22 @@ function vec3f_project(vec, onto, out)
-- ...
end
--- @param v Vec3f
--- @param rotate Vec3s
--- @return void*
function vec3f_rotate_zxy(v, rotate)
-- ...
end
--- @param dest Vec3f
--- @param x number
--- @param y number
--- @param z number
--- @return void*
function vec3f_set(dest, x, y, z)
-- ...
end
--- @param from Vec3f
--- @param to Vec3f
--- @param dist number
@ -5211,6 +5434,59 @@ function vec3f_set_dist_and_angle(from, to, dist, pitch, yaw)
-- ...
end
--- @param dest Vec3f
--- @param a Vec3f
--- @param b Vec3f
--- @return void*
function vec3f_sum(dest, a, b)
-- ...
end
--- @param dest Vec3s
--- @param a Vec3f
--- @return void*
function vec3f_to_vec3s(dest, a)
-- ...
end
--- @param dest Vec3s
--- @param a Vec3s
--- @return void*
function vec3s_add(dest, a)
-- ...
end
--- @param dest Vec3s
--- @param src Vec3s
--- @return void*
function vec3s_copy(dest, src)
-- ...
end
--- @param dest Vec3s
--- @param x integer
--- @param y integer
--- @param z integer
--- @return void*
function vec3s_set(dest, x, y, z)
-- ...
end
--- @param dest Vec3s
--- @param a Vec3s
--- @param b Vec3s
--- @return void*
function vec3s_sum(dest, a, b)
-- ...
end
--- @param dest Vec3f
--- @param a Vec3s
--- @return void*
function vec3s_to_vec3f(dest, a)
-- ...
end
--- @return nil
function update_all_mario_stars()
-- ...
@ -6011,6 +6287,14 @@ function count_unimportant_objects()
-- ...
end
--- @param a0 Mat4
--- @param a1 Mat4
--- @param a2 Mat4
--- @return nil
function create_transformation_from_matrices(a0, a1, a2)
-- ...
end
--- @return number
function cur_obj_abs_y_dist_to_home()
-- ...
@ -6823,6 +7107,22 @@ function lateral_dist_between_objects(obj1, obj2)
-- ...
end
--- @param m Mat4
--- @param dst Vec3f
--- @param v Vec3f
--- @return nil
function linear_mtxf_mul_vec3f(m, dst, v)
-- ...
end
--- @param m Mat4
--- @param dst Vec3f
--- @param v Vec3f
--- @return nil
function linear_mtxf_transpose_mul_vec3f(m, dst, v)
-- ...
end
--- @param m MarioState
--- @return integer
function mario_is_dive_sliding(m)
@ -6865,6 +7165,14 @@ function obj_angle_to_point(obj, pointX, pointZ)
-- ...
end
--- @param obj Object
--- @param dst Mat4
--- @param src Mat4
--- @return nil
function obj_apply_scale_to_matrix(obj, dst, src)
-- ...
end
--- @param obj Object
--- @return nil
function obj_apply_scale_to_transform(obj)
@ -7243,6 +7551,13 @@ function obj_turn_toward_object(obj, target, angleIndex, turnAmount)
-- ...
end
--- @param a0 Mat4
--- @param a1 Object
--- @return nil
function obj_update_pos_from_parent_transformation(a0, a1)
-- ...
end
--- @return integer
function player_performed_grab_escape_action()
-- ...
@ -8508,5 +8823,7 @@ end
--- @class Pointer_integer
--- @class Pointer_BehaviorScript
--- @class Pointer_number
--- @class Pointer_Vec4s
--- @class Pointer_Mtx
--- @class Pointer_Collision
--- @class Pointer_Trajectory

View file

@ -213,6 +213,7 @@
--- @field public doorStatus integer
--- @field public focus Vec3f
--- @field public mode integer
--- @field public mtx Mat4
--- @field public nextYaw integer
--- @field public pos Vec3f
--- @field public unusedVec1 Vec3f
@ -559,12 +560,15 @@
--- @field public prevScaleTimestamp integer
--- @field public prevShadowPos Vec3f
--- @field public prevShadowPosTimestamp integer
--- @field public prevThrowMatrix Mat4
--- @field public prevThrowMatrixTimestamp integer
--- @field public prevTimestamp integer
--- @field public scale Vec3f
--- @field public sharedChild GraphNode
--- @field public skipInViewCheck boolean
--- @field public skipInterpolationTimestamp integer
--- @field public throwMatrix Pointer_Mat4
--- @field public throwMatrixPrev Pointer_Mat4
--- @field public unk4C SpawnInfo
--- @class GraphNode_802A45E4
@ -733,6 +737,7 @@
--- @field public slideYaw integer
--- @field public spawnInfo SpawnInfo
--- @field public specialTripleJump integer
--- @field public splineKeyframe Pointer_Vec4s
--- @field public splineKeyframeFraction number
--- @field public splineState integer
--- @field public squishTimer integer
@ -1560,6 +1565,7 @@
--- @field public prevObj Object
--- @field public respawnInfoType integer
--- @field public setHome integer
--- @field public transform Mat4
--- @field public unused1 integer
--- @field public usingObj Object
@ -1816,4 +1822,6 @@
--- @class Pointer_LevelScript
--- @class Pointer_ObjectAnimPointer
--- @class Pointer_Collision
--- @class Pointer_Mat4
--- @class Pointer_Vec4s
--- @class Pointer_BehaviorScript

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -894,6 +894,7 @@
- [cutscene_take_cap_off](functions-3.md#cutscene_take_cap_off)
- [general_star_dance_handler](functions-3.md#general_star_dance_handler)
- [generate_yellow_sparkles](functions-3.md#generate_yellow_sparkles)
- [get_credits_str_width](functions-3.md#get_credits_str_width)
- [get_star_collection_dialog](functions-3.md#get_star_collection_dialog)
- [handle_save_menu](functions-3.md#handle_save_menu)
- [launch_mario_until_land](functions-3.md#launch_mario_until_land)
@ -998,17 +999,52 @@
<br />
- math_util.h
- [anim_spline_init](functions-3.md#anim_spline_init)
- [anim_spline_poll](functions-3.md#anim_spline_poll)
- [approach_f32](functions-3.md#approach_f32)
- [approach_s32](functions-3.md#approach_s32)
- [find_vector_perpendicular_to_plane](functions-3.md#find_vector_perpendicular_to_plane)
- [get_pos_from_transform_mtx](functions-3.md#get_pos_from_transform_mtx)
- [mtxf_align_terrain_normal](functions-3.md#mtxf_align_terrain_normal)
- [mtxf_align_terrain_triangle](functions-3.md#mtxf_align_terrain_triangle)
- [mtxf_billboard](functions-3.md#mtxf_billboard)
- [mtxf_copy](functions-3.md#mtxf_copy)
- [mtxf_cylboard](functions-3.md#mtxf_cylboard)
- [mtxf_identity](functions-3.md#mtxf_identity)
- [mtxf_inverse](functions-3.md#mtxf_inverse)
- [mtxf_lookat](functions-3.md#mtxf_lookat)
- [mtxf_mul](functions-3.md#mtxf_mul)
- [mtxf_mul_vec3s](functions-3.md#mtxf_mul_vec3s)
- [mtxf_rotate_xy](functions-3.md#mtxf_rotate_xy)
- [mtxf_rotate_xyz_and_translate](functions-3.md#mtxf_rotate_xyz_and_translate)
- [mtxf_rotate_zxy_and_translate](functions-3.md#mtxf_rotate_zxy_and_translate)
- [mtxf_scale_vec3f](functions-3.md#mtxf_scale_vec3f)
- [mtxf_to_mtx](functions-3.md#mtxf_to_mtx)
- [mtxf_translate](functions-3.md#mtxf_translate)
- [not_zero](functions-3.md#not_zero)
- [spline_get_weights](functions-3.md#spline_get_weights)
- [vec3f_add](functions-3.md#vec3f_add)
- [vec3f_combine](functions-3.md#vec3f_combine)
- [vec3f_copy](functions-3.md#vec3f_copy)
- [vec3f_cross](functions-3.md#vec3f_cross)
- [vec3f_dif](functions-3.md#vec3f_dif)
- [vec3f_dist](functions-3.md#vec3f_dist)
- [vec3f_dot](functions-3.md#vec3f_dot)
- [vec3f_get_dist_and_angle](functions-3.md#vec3f_get_dist_and_angle)
- [vec3f_length](functions-3.md#vec3f_length)
- [vec3f_mul](functions-3.md#vec3f_mul)
- [vec3f_normalize](functions-3.md#vec3f_normalize)
- [vec3f_project](functions-3.md#vec3f_project)
- [vec3f_rotate_zxy](functions-3.md#vec3f_rotate_zxy)
- [vec3f_set](functions-3.md#vec3f_set)
- [vec3f_set_dist_and_angle](functions-3.md#vec3f_set_dist_and_angle)
- [vec3f_sum](functions-3.md#vec3f_sum)
- [vec3f_to_vec3s](functions-3.md#vec3f_to_vec3s)
- [vec3s_add](functions-3.md#vec3s_add)
- [vec3s_copy](functions-3.md#vec3s_copy)
- [vec3s_set](functions-3.md#vec3s_set)
- [vec3s_sum](functions-3.md#vec3s_sum)
- [vec3s_to_vec3f](functions-3.md#vec3s_to_vec3f)
<br />
@ -1046,44 +1082,44 @@
<br />
- obj_behaviors.c
- [absf_2](functions-3.md#absf_2)
- [calc_new_obj_vel_and_pos_y](functions-3.md#calc_new_obj_vel_and_pos_y)
- [calc_new_obj_vel_and_pos_y_underwater](functions-3.md#calc_new_obj_vel_and_pos_y_underwater)
- [calc_obj_friction](functions-3.md#calc_obj_friction)
- [current_mario_room_check](functions-3.md#current_mario_room_check)
- [is_nearest_mario_state_to_object](functions-3.md#is_nearest_mario_state_to_object)
- [is_nearest_player_to_object](functions-3.md#is_nearest_player_to_object)
- [is_other_player_active](functions-3.md#is_other_player_active)
- [is_player_active](functions-3.md#is_player_active)
- [is_player_in_local_area](functions-3.md#is_player_in_local_area)
- [is_point_close_to_object](functions-3.md#is_point_close_to_object)
- [is_point_within_radius_of_any_player](functions-3.md#is_point_within_radius_of_any_player)
- [is_point_within_radius_of_mario](functions-3.md#is_point_within_radius_of_mario)
- [nearest_interacting_mario_state_to_object](functions-3.md#nearest_interacting_mario_state_to_object)
- [nearest_interacting_player_to_object](functions-3.md#nearest_interacting_player_to_object)
- [nearest_mario_state_to_object](functions-3.md#nearest_mario_state_to_object)
- [nearest_player_to_object](functions-3.md#nearest_player_to_object)
- [nearest_possible_mario_state_to_object](functions-3.md#nearest_possible_mario_state_to_object)
- [obj_check_floor_death](functions-3.md#obj_check_floor_death)
- [obj_check_if_facing_toward_angle](functions-3.md#obj_check_if_facing_toward_angle)
- [obj_find_wall](functions-3.md#obj_find_wall)
- [obj_find_wall_displacement](functions-3.md#obj_find_wall_displacement)
- [obj_flicker_and_disappear](functions-3.md#obj_flicker_and_disappear)
- [obj_lava_death](functions-3.md#obj_lava_death)
- [obj_move_xyz_using_fvel_and_yaw](functions-3.md#obj_move_xyz_using_fvel_and_yaw)
- [obj_orient_graph](functions-3.md#obj_orient_graph)
- [obj_return_and_displace_home](functions-3.md#obj_return_and_displace_home)
- [obj_return_home_if_safe](functions-3.md#obj_return_home_if_safe)
- [obj_spawn_yellow_coins](functions-3.md#obj_spawn_yellow_coins)
- [obj_splash](functions-3.md#obj_splash)
- [obj_update_pos_vel_xz](functions-3.md#obj_update_pos_vel_xz)
- [object_step](functions-3.md#object_step)
- [object_step_without_floor_orient](functions-3.md#object_step_without_floor_orient)
- [set_object_visibility](functions-3.md#set_object_visibility)
- [set_yoshi_as_not_dead](functions-3.md#set_yoshi_as_not_dead)
- [spawn_orange_number](functions-3.md#spawn_orange_number)
- [turn_obj_away_from_steep_floor](functions-3.md#turn_obj_away_from_steep_floor)
- [turn_obj_away_from_surface](functions-3.md#turn_obj_away_from_surface)
- [absf_2](functions-4.md#absf_2)
- [calc_new_obj_vel_and_pos_y](functions-4.md#calc_new_obj_vel_and_pos_y)
- [calc_new_obj_vel_and_pos_y_underwater](functions-4.md#calc_new_obj_vel_and_pos_y_underwater)
- [calc_obj_friction](functions-4.md#calc_obj_friction)
- [current_mario_room_check](functions-4.md#current_mario_room_check)
- [is_nearest_mario_state_to_object](functions-4.md#is_nearest_mario_state_to_object)
- [is_nearest_player_to_object](functions-4.md#is_nearest_player_to_object)
- [is_other_player_active](functions-4.md#is_other_player_active)
- [is_player_active](functions-4.md#is_player_active)
- [is_player_in_local_area](functions-4.md#is_player_in_local_area)
- [is_point_close_to_object](functions-4.md#is_point_close_to_object)
- [is_point_within_radius_of_any_player](functions-4.md#is_point_within_radius_of_any_player)
- [is_point_within_radius_of_mario](functions-4.md#is_point_within_radius_of_mario)
- [nearest_interacting_mario_state_to_object](functions-4.md#nearest_interacting_mario_state_to_object)
- [nearest_interacting_player_to_object](functions-4.md#nearest_interacting_player_to_object)
- [nearest_mario_state_to_object](functions-4.md#nearest_mario_state_to_object)
- [nearest_player_to_object](functions-4.md#nearest_player_to_object)
- [nearest_possible_mario_state_to_object](functions-4.md#nearest_possible_mario_state_to_object)
- [obj_check_floor_death](functions-4.md#obj_check_floor_death)
- [obj_check_if_facing_toward_angle](functions-4.md#obj_check_if_facing_toward_angle)
- [obj_find_wall](functions-4.md#obj_find_wall)
- [obj_find_wall_displacement](functions-4.md#obj_find_wall_displacement)
- [obj_flicker_and_disappear](functions-4.md#obj_flicker_and_disappear)
- [obj_lava_death](functions-4.md#obj_lava_death)
- [obj_move_xyz_using_fvel_and_yaw](functions-4.md#obj_move_xyz_using_fvel_and_yaw)
- [obj_orient_graph](functions-4.md#obj_orient_graph)
- [obj_return_and_displace_home](functions-4.md#obj_return_and_displace_home)
- [obj_return_home_if_safe](functions-4.md#obj_return_home_if_safe)
- [obj_spawn_yellow_coins](functions-4.md#obj_spawn_yellow_coins)
- [obj_splash](functions-4.md#obj_splash)
- [obj_update_pos_vel_xz](functions-4.md#obj_update_pos_vel_xz)
- [object_step](functions-4.md#object_step)
- [object_step_without_floor_orient](functions-4.md#object_step_without_floor_orient)
- [set_object_visibility](functions-4.md#set_object_visibility)
- [set_yoshi_as_not_dead](functions-4.md#set_yoshi_as_not_dead)
- [spawn_orange_number](functions-4.md#spawn_orange_number)
- [turn_obj_away_from_steep_floor](functions-4.md#turn_obj_away_from_steep_floor)
- [turn_obj_away_from_surface](functions-4.md#turn_obj_away_from_surface)
<br />
@ -1151,6 +1187,7 @@
- [clear_time_stop_flags](functions-4.md#clear_time_stop_flags)
- [count_objects_with_behavior](functions-4.md#count_objects_with_behavior)
- [count_unimportant_objects](functions-4.md#count_unimportant_objects)
- [create_transformation_from_matrices](functions-4.md#create_transformation_from_matrices)
- [cur_obj_abs_y_dist_to_home](functions-4.md#cur_obj_abs_y_dist_to_home)
- [cur_obj_advance_looping_anim](functions-4.md#cur_obj_advance_looping_anim)
- [cur_obj_align_gfx_with_floor](functions-4.md#cur_obj_align_gfx_with_floor)
@ -1286,12 +1323,15 @@
- [is_item_in_array](functions-4.md#is_item_in_array)
- [is_mario_moving_fast_or_in_air](functions-4.md#is_mario_moving_fast_or_in_air)
- [lateral_dist_between_objects](functions-4.md#lateral_dist_between_objects)
- [linear_mtxf_mul_vec3f](functions-4.md#linear_mtxf_mul_vec3f)
- [linear_mtxf_transpose_mul_vec3f](functions-4.md#linear_mtxf_transpose_mul_vec3f)
- [mario_is_dive_sliding](functions-4.md#mario_is_dive_sliding)
- [mario_is_in_air_action](functions-4.md#mario_is_in_air_action)
- [mario_is_within_rectangle](functions-4.md#mario_is_within_rectangle)
- [mario_set_flag](functions-4.md#mario_set_flag)
- [obj_angle_to_object](functions-4.md#obj_angle_to_object)
- [obj_angle_to_point](functions-4.md#obj_angle_to_point)
- [obj_apply_scale_to_matrix](functions-4.md#obj_apply_scale_to_matrix)
- [obj_apply_scale_to_transform](functions-4.md#obj_apply_scale_to_transform)
- [obj_attack_collided_from_other_object](functions-4.md#obj_attack_collided_from_other_object)
- [obj_become_tangible](functions-4.md#obj_become_tangible)
@ -1343,6 +1383,7 @@
- [obj_translate_xyz_random](functions-4.md#obj_translate_xyz_random)
- [obj_translate_xz_random](functions-4.md#obj_translate_xz_random)
- [obj_turn_toward_object](functions-4.md#obj_turn_toward_object)
- [obj_update_pos_from_parent_transformation](functions-4.md#obj_update_pos_from_parent_transformation)
- [player_performed_grab_escape_action](functions-4.md#player_performed_grab_escape_action)
- [random_f32_around_zero](functions-4.md#random_f32_around_zero)
- [set_mario_interact_hoot_if_in_range](functions-4.md#set_mario_interact_hoot_if_in_range)
@ -1509,77 +1550,77 @@
<br />
- smlua_obj_utils.h
- [get_temp_object_hitbox](functions-4.md#get_temp_object_hitbox)
- [get_trajectory](functions-4.md#get_trajectory)
- [obj_check_hitbox_overlap](functions-4.md#obj_check_hitbox_overlap)
- [obj_check_overlap_with_hitbox_params](functions-4.md#obj_check_overlap_with_hitbox_params)
- [obj_count_objects_with_behavior_id](functions-4.md#obj_count_objects_with_behavior_id)
- [obj_get_first](functions-4.md#obj_get_first)
- [obj_get_first_with_behavior_id](functions-4.md#obj_get_first_with_behavior_id)
- [obj_get_first_with_behavior_id_and_field_f32](functions-4.md#obj_get_first_with_behavior_id_and_field_f32)
- [obj_get_first_with_behavior_id_and_field_s32](functions-4.md#obj_get_first_with_behavior_id_and_field_s32)
- [obj_get_nearest_object_with_behavior_id](functions-4.md#obj_get_nearest_object_with_behavior_id)
- [obj_get_next](functions-4.md#obj_get_next)
- [obj_get_next_with_same_behavior_id](functions-4.md#obj_get_next_with_same_behavior_id)
- [obj_get_next_with_same_behavior_id_and_field_f32](functions-4.md#obj_get_next_with_same_behavior_id_and_field_f32)
- [obj_get_next_with_same_behavior_id_and_field_s32](functions-4.md#obj_get_next_with_same_behavior_id_and_field_s32)
- [obj_get_temp_spawn_particles_info](functions-4.md#obj_get_temp_spawn_particles_info)
- [obj_has_behavior_id](functions-4.md#obj_has_behavior_id)
- [obj_has_model_extended](functions-4.md#obj_has_model_extended)
- [obj_is_attackable](functions-4.md#obj_is_attackable)
- [obj_is_breakable_object](functions-4.md#obj_is_breakable_object)
- [obj_is_bully](functions-4.md#obj_is_bully)
- [obj_is_coin](functions-4.md#obj_is_coin)
- [obj_is_exclamation_box](functions-4.md#obj_is_exclamation_box)
- [obj_is_grabbable](functions-4.md#obj_is_grabbable)
- [obj_is_mushroom_1up](functions-4.md#obj_is_mushroom_1up)
- [obj_is_secret](functions-4.md#obj_is_secret)
- [obj_is_valid_for_interaction](functions-4.md#obj_is_valid_for_interaction)
- [obj_move_xyz](functions-4.md#obj_move_xyz)
- [obj_set_model_extended](functions-4.md#obj_set_model_extended)
- [obj_set_vel](functions-4.md#obj_set_vel)
- [spawn_non_sync_object](functions-4.md#spawn_non_sync_object)
- [spawn_sync_object](functions-4.md#spawn_sync_object)
- [get_temp_object_hitbox](functions-5.md#get_temp_object_hitbox)
- [get_trajectory](functions-5.md#get_trajectory)
- [obj_check_hitbox_overlap](functions-5.md#obj_check_hitbox_overlap)
- [obj_check_overlap_with_hitbox_params](functions-5.md#obj_check_overlap_with_hitbox_params)
- [obj_count_objects_with_behavior_id](functions-5.md#obj_count_objects_with_behavior_id)
- [obj_get_first](functions-5.md#obj_get_first)
- [obj_get_first_with_behavior_id](functions-5.md#obj_get_first_with_behavior_id)
- [obj_get_first_with_behavior_id_and_field_f32](functions-5.md#obj_get_first_with_behavior_id_and_field_f32)
- [obj_get_first_with_behavior_id_and_field_s32](functions-5.md#obj_get_first_with_behavior_id_and_field_s32)
- [obj_get_nearest_object_with_behavior_id](functions-5.md#obj_get_nearest_object_with_behavior_id)
- [obj_get_next](functions-5.md#obj_get_next)
- [obj_get_next_with_same_behavior_id](functions-5.md#obj_get_next_with_same_behavior_id)
- [obj_get_next_with_same_behavior_id_and_field_f32](functions-5.md#obj_get_next_with_same_behavior_id_and_field_f32)
- [obj_get_next_with_same_behavior_id_and_field_s32](functions-5.md#obj_get_next_with_same_behavior_id_and_field_s32)
- [obj_get_temp_spawn_particles_info](functions-5.md#obj_get_temp_spawn_particles_info)
- [obj_has_behavior_id](functions-5.md#obj_has_behavior_id)
- [obj_has_model_extended](functions-5.md#obj_has_model_extended)
- [obj_is_attackable](functions-5.md#obj_is_attackable)
- [obj_is_breakable_object](functions-5.md#obj_is_breakable_object)
- [obj_is_bully](functions-5.md#obj_is_bully)
- [obj_is_coin](functions-5.md#obj_is_coin)
- [obj_is_exclamation_box](functions-5.md#obj_is_exclamation_box)
- [obj_is_grabbable](functions-5.md#obj_is_grabbable)
- [obj_is_mushroom_1up](functions-5.md#obj_is_mushroom_1up)
- [obj_is_secret](functions-5.md#obj_is_secret)
- [obj_is_valid_for_interaction](functions-5.md#obj_is_valid_for_interaction)
- [obj_move_xyz](functions-5.md#obj_move_xyz)
- [obj_set_model_extended](functions-5.md#obj_set_model_extended)
- [obj_set_vel](functions-5.md#obj_set_vel)
- [spawn_non_sync_object](functions-5.md#spawn_non_sync_object)
- [spawn_sync_object](functions-5.md#spawn_sync_object)
<br />
- smlua_text_utils.h
- [smlua_text_utils_castle_secret_stars_replace](functions-4.md#smlua_text_utils_castle_secret_stars_replace)
- [smlua_text_utils_course_acts_replace](functions-4.md#smlua_text_utils_course_acts_replace)
- [smlua_text_utils_dialog_replace](functions-4.md#smlua_text_utils_dialog_replace)
- [smlua_text_utils_extra_text_replace](functions-4.md#smlua_text_utils_extra_text_replace)
- [smlua_text_utils_reset_all](functions-4.md#smlua_text_utils_reset_all)
- [smlua_text_utils_secret_star_replace](functions-4.md#smlua_text_utils_secret_star_replace)
- [smlua_text_utils_castle_secret_stars_replace](functions-5.md#smlua_text_utils_castle_secret_stars_replace)
- [smlua_text_utils_course_acts_replace](functions-5.md#smlua_text_utils_course_acts_replace)
- [smlua_text_utils_dialog_replace](functions-5.md#smlua_text_utils_dialog_replace)
- [smlua_text_utils_extra_text_replace](functions-5.md#smlua_text_utils_extra_text_replace)
- [smlua_text_utils_reset_all](functions-5.md#smlua_text_utils_reset_all)
- [smlua_text_utils_secret_star_replace](functions-5.md#smlua_text_utils_secret_star_replace)
<br />
- sound_init.h
- [disable_background_sound](functions-4.md#disable_background_sound)
- [enable_background_sound](functions-4.md#enable_background_sound)
- [fadeout_cap_music](functions-4.md#fadeout_cap_music)
- [fadeout_level_music](functions-4.md#fadeout_level_music)
- [fadeout_music](functions-4.md#fadeout_music)
- [lower_background_noise](functions-4.md#lower_background_noise)
- [play_cap_music](functions-4.md#play_cap_music)
- [play_cutscene_music](functions-4.md#play_cutscene_music)
- [play_infinite_stairs_music](functions-4.md#play_infinite_stairs_music)
- [play_menu_sounds](functions-4.md#play_menu_sounds)
- [play_painting_eject_sound](functions-4.md#play_painting_eject_sound)
- [play_shell_music](functions-4.md#play_shell_music)
- [raise_background_noise](functions-4.md#raise_background_noise)
- [reset_volume](functions-4.md#reset_volume)
- [set_background_music](functions-4.md#set_background_music)
- [stop_cap_music](functions-4.md#stop_cap_music)
- [stop_shell_music](functions-4.md#stop_shell_music)
- [disable_background_sound](functions-5.md#disable_background_sound)
- [enable_background_sound](functions-5.md#enable_background_sound)
- [fadeout_cap_music](functions-5.md#fadeout_cap_music)
- [fadeout_level_music](functions-5.md#fadeout_level_music)
- [fadeout_music](functions-5.md#fadeout_music)
- [lower_background_noise](functions-5.md#lower_background_noise)
- [play_cap_music](functions-5.md#play_cap_music)
- [play_cutscene_music](functions-5.md#play_cutscene_music)
- [play_infinite_stairs_music](functions-5.md#play_infinite_stairs_music)
- [play_menu_sounds](functions-5.md#play_menu_sounds)
- [play_painting_eject_sound](functions-5.md#play_painting_eject_sound)
- [play_shell_music](functions-5.md#play_shell_music)
- [raise_background_noise](functions-5.md#raise_background_noise)
- [reset_volume](functions-5.md#reset_volume)
- [set_background_music](functions-5.md#set_background_music)
- [stop_cap_music](functions-5.md#stop_cap_music)
- [stop_shell_music](functions-5.md#stop_shell_music)
<br />
- spawn_sound.c
- [calc_dist_to_volume_range_1](functions-4.md#calc_dist_to_volume_range_1)
- [calc_dist_to_volume_range_2](functions-4.md#calc_dist_to_volume_range_2)
- [cur_obj_play_sound_1](functions-4.md#cur_obj_play_sound_1)
- [cur_obj_play_sound_2](functions-4.md#cur_obj_play_sound_2)
- [exec_anim_sound_state](functions-4.md#exec_anim_sound_state)
- [calc_dist_to_volume_range_1](functions-5.md#calc_dist_to_volume_range_1)
- [calc_dist_to_volume_range_2](functions-5.md#calc_dist_to_volume_range_2)
- [cur_obj_play_sound_1](functions-5.md#cur_obj_play_sound_1)
- [cur_obj_play_sound_2](functions-5.md#cur_obj_play_sound_2)
- [exec_anim_sound_state](functions-5.md#exec_anim_sound_state)
<br />

View file

@ -349,6 +349,7 @@
| doorStatus | `integer` | |
| focus | [Vec3f](structs.md#Vec3f) | read-only |
| mode | `integer` | |
| mtx | `Mat4` | read-only |
| nextYaw | `integer` | |
| pos | [Vec3f](structs.md#Vec3f) | read-only |
| unusedVec1 | [Vec3f](structs.md#Vec3f) | read-only |
@ -819,12 +820,15 @@
| prevScaleTimestamp | `integer` | |
| prevShadowPos | [Vec3f](structs.md#Vec3f) | read-only |
| prevShadowPosTimestamp | `integer` | |
| prevThrowMatrix | `Mat4` | read-only |
| prevThrowMatrixTimestamp | `integer` | |
| prevTimestamp | `integer` | |
| scale | [Vec3f](structs.md#Vec3f) | read-only |
| sharedChild | [GraphNode](structs.md#GraphNode) | |
| skipInViewCheck | `boolean` | |
| skipInterpolationTimestamp | `integer` | |
| throwMatrix | `Pointer` <`Mat4`> | |
| throwMatrixPrev | `Pointer` <`Mat4`> | |
| unk4C | [SpawnInfo](structs.md#SpawnInfo) | |
[:arrow_up_small:](#)
@ -1056,6 +1060,7 @@
| slideYaw | `integer` | |
| spawnInfo | [SpawnInfo](structs.md#SpawnInfo) | |
| specialTripleJump | `integer` | |
| splineKeyframe | `Pointer` <`Vec4s`> | |
| splineKeyframeFraction | `number` | |
| splineState | `integer` | |
| squishTimer | `integer` | |
@ -1191,6 +1196,7 @@
| prevObj | [Object](structs.md#Object) | |
| respawnInfoType | `integer` | |
| setHome | `integer` | |
| transform | `Mat4` | read-only |
| unused1 | `integer` | |
| usingObj | [Object](structs.md#Object) | |

View file

@ -28,10 +28,50 @@ static struct LuaObjectField sVec3fFields[LUA_VEC3F_FIELD_COUNT] = {
{ "z", LVT_F32, sizeof(f32) * 2, false, LOT_NONE },
};
#define LUA_VEC4S_FIELD_COUNT 4
static struct LuaObjectField sVec4sFields[LUA_VEC4S_FIELD_COUNT] = {
{ "x", LVT_S16, sizeof(s16) * 0, false, LOT_NONE },
{ "y", LVT_S16, sizeof(s16) * 1, false, LOT_NONE },
{ "z", LVT_S16, sizeof(s16) * 2, false, LOT_NONE },
{ "w", LVT_S16, sizeof(s16) * 3, false, LOT_NONE },
};
#define LUA_VEC4F_FIELD_COUNT 4
static struct LuaObjectField sVec4fFields[LUA_VEC4F_FIELD_COUNT] = {
{ "x", LVT_F32, sizeof(f32) * 0, false, LOT_NONE },
{ "y", LVT_F32, sizeof(f32) * 1, false, LOT_NONE },
{ "z", LVT_F32, sizeof(f32) * 2, false, LOT_NONE },
{ "w", LVT_F32, sizeof(f32) * 3, false, LOT_NONE },
};
#define LUA_MAT4_FIELD_COUNT 16
static struct LuaObjectField sMat4Fields[LUA_MAT4_FIELD_COUNT] = {
{ "a", LVT_F32, sizeof(f32) * 0, false, LOT_NONE },
{ "b", LVT_F32, sizeof(f32) * 1, false, LOT_NONE },
{ "c", LVT_F32, sizeof(f32) * 2, false, LOT_NONE },
{ "d", LVT_F32, sizeof(f32) * 3, false, LOT_NONE },
{ "e", LVT_F32, sizeof(f32) * 4, false, LOT_NONE },
{ "f", LVT_F32, sizeof(f32) * 5, false, LOT_NONE },
{ "g", LVT_F32, sizeof(f32) * 6, false, LOT_NONE },
{ "h", LVT_F32, sizeof(f32) * 7, false, LOT_NONE },
{ "i", LVT_F32, sizeof(f32) * 8, false, LOT_NONE },
{ "j", LVT_F32, sizeof(f32) * 9, false, LOT_NONE },
{ "k", LVT_F32, sizeof(f32) * 10, false, LOT_NONE },
{ "l", LVT_F32, sizeof(f32) * 11, false, LOT_NONE },
{ "m", LVT_F32, sizeof(f32) * 12, false, LOT_NONE },
{ "n", LVT_F32, sizeof(f32) * 13, false, LOT_NONE },
{ "o", LVT_F32, sizeof(f32) * 14, false, LOT_NONE },
{ "p", LVT_F32, sizeof(f32) * 15, false, LOT_NONE },
};
struct LuaObjectTable sLuaObjectTable[LOT_MAX] = {
{ LOT_NONE, NULL, 0 },
{ LOT_VEC3S, sVec3sFields, LUA_VEC3S_FIELD_COUNT },
{ LOT_VEC3F, sVec3fFields, LUA_VEC3F_FIELD_COUNT },
{ LOT_VEC4S, sVec4sFields, LUA_VEC4S_FIELD_COUNT },
{ LOT_VEC4F, sVec4fFields, LUA_VEC4F_FIELD_COUNT },
{ LOT_MAT4, sMat4Fields, LUA_MAT4_FIELD_COUNT },
};
struct LuaObjectField* smlua_get_object_field_from_ot(struct LuaObjectTable* ot, const char* key) {
@ -384,6 +424,7 @@ static int smlua__get_field(lua_State* L) {
case LVT_TRAJECTORY: lua_pushinteger(L, *(s16*)p); break;
// pointers
case LVT_BOOL_P:
case LVT_U8_P:
case LVT_U16_P:
case LVT_U32_P:
@ -475,6 +516,7 @@ static int smlua__set_field(lua_State* L) {
break;
// pointers
case LVT_BOOL_P:
case LVT_U8_P:
case LVT_U16_P:
case LVT_U32_P:

View file

@ -3,6 +3,7 @@
enum LuaValueType {
LVT_BOOL,
LVT_BOOL_P,
LVT_U8,
LVT_U8_P,
LVT_U16,
@ -42,6 +43,9 @@ enum LuaObjectType {
LOT_NONE = 0,
LOT_VEC3S,
LOT_VEC3F,
LOT_VEC4S,
LOT_VEC4F,
LOT_MAT4,
LOT_COLOR,
LOT_POINTER,
LOT_MAX,

View file

@ -248,7 +248,7 @@ static struct LuaObjectField sBullyCollisionDataFields[LUA_BULLY_COLLISION_DATA_
{ "velZ", LVT_F32, offsetof(struct BullyCollisionData, velZ), false, LOT_NONE },
};
#define LUA_CAMERA_FIELD_COUNT 12
#define LUA_CAMERA_FIELD_COUNT 13
static struct LuaObjectField sCameraFields[LUA_CAMERA_FIELD_COUNT] = {
{ "areaCenX", LVT_F32, offsetof(struct Camera, areaCenX), false, LOT_NONE },
{ "areaCenY", LVT_F32, offsetof(struct Camera, areaCenY), false, LOT_NONE },
@ -260,7 +260,7 @@ static struct LuaObjectField sCameraFields[LUA_CAMERA_FIELD_COUNT] = {
// { "filler3C", LOT_???, offsetof(struct Camera, filler3C), false, LOT_??? }, <--- UNIMPLEMENTED
{ "focus", LVT_COBJECT, offsetof(struct Camera, focus), true, LOT_VEC3F },
{ "mode", LVT_U8, offsetof(struct Camera, mode), false, LOT_NONE },
// { "mtx", LVT_???, offsetof(struct Camera, mtx), false, LOT_??? }, <--- UNIMPLEMENTED
{ "mtx", LVT_COBJECT, offsetof(struct Camera, mtx), true, LOT_MAT4 },
{ "nextYaw", LVT_S16, offsetof(struct Camera, nextYaw), false, LOT_NONE },
{ "pos", LVT_COBJECT, offsetof(struct Camera, pos), true, LOT_VEC3F },
{ "unusedVec1", LVT_COBJECT, offsetof(struct Camera, unusedVec1), true, LOT_VEC3F },
@ -632,7 +632,7 @@ static struct LuaObjectField sGraphNodeFields[LUA_GRAPH_NODE_FIELD_COUNT] = {
{ "type", LVT_S16, offsetof(struct GraphNode, type), false, LOT_NONE },
};
#define LUA_GRAPH_NODE_OBJECT_FIELD_COUNT 20
#define LUA_GRAPH_NODE_OBJECT_FIELD_COUNT 23
static struct LuaObjectField sGraphNodeObjectFields[LUA_GRAPH_NODE_OBJECT_FIELD_COUNT] = {
{ "activeAreaIndex", LVT_S8, offsetof(struct GraphNodeObject, activeAreaIndex), false, LOT_NONE },
{ "angle", LVT_COBJECT, offsetof(struct GraphNodeObject, angle), true, LOT_VEC3S },
@ -647,15 +647,15 @@ static struct LuaObjectField sGraphNodeObjectFields[LUA_GRAPH_NODE_OBJECT_FIELD_
{ "prevScaleTimestamp", LVT_U32, offsetof(struct GraphNodeObject, prevScaleTimestamp), false, LOT_NONE },
{ "prevShadowPos", LVT_COBJECT, offsetof(struct GraphNodeObject, prevShadowPos), true, LOT_VEC3F },
{ "prevShadowPosTimestamp", LVT_U32, offsetof(struct GraphNodeObject, prevShadowPosTimestamp), false, LOT_NONE },
// { "prevThrowMatrix", LVT_???, offsetof(struct GraphNodeObject, prevThrowMatrix), false, LOT_??? }, <--- UNIMPLEMENTED
{ "prevThrowMatrix", LVT_COBJECT, offsetof(struct GraphNodeObject, prevThrowMatrix), true, LOT_MAT4 },
{ "prevThrowMatrixTimestamp", LVT_U32, offsetof(struct GraphNodeObject, prevThrowMatrixTimestamp), false, LOT_NONE },
{ "prevTimestamp", LVT_U32, offsetof(struct GraphNodeObject, prevTimestamp), false, LOT_NONE },
{ "scale", LVT_COBJECT, offsetof(struct GraphNodeObject, scale), true, LOT_VEC3F },
{ "sharedChild", LVT_COBJECT_P, offsetof(struct GraphNodeObject, sharedChild), false, LOT_GRAPHNODE },
{ "skipInViewCheck", LVT_BOOL, offsetof(struct GraphNodeObject, skipInViewCheck), false, LOT_NONE },
{ "skipInterpolationTimestamp", LVT_U32, offsetof(struct GraphNodeObject, skipInterpolationTimestamp), false, LOT_NONE },
// { "throwMatrix", LVT_???, offsetof(struct GraphNodeObject, throwMatrix), false, LOT_??? }, <--- UNIMPLEMENTED
// { "throwMatrixPrev", LVT_???, offsetof(struct GraphNodeObject, throwMatrixPrev), false, LOT_??? }, <--- UNIMPLEMENTED
{ "throwMatrix", LVT_COBJECT_P, offsetof(struct GraphNodeObject, throwMatrix), false, LOT_POINTER },
{ "throwMatrixPrev", LVT_COBJECT_P, offsetof(struct GraphNodeObject, throwMatrixPrev), false, LOT_POINTER },
{ "unk4C", LVT_COBJECT_P, offsetof(struct GraphNodeObject, unk4C), false, LOT_SPAWNINFO },
};
@ -787,7 +787,7 @@ static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_CO
{ "wingFlutter", LVT_S8, offsetof(struct MarioBodyState, wingFlutter), false, LOT_NONE },
};
#define LUA_MARIO_STATE_FIELD_COUNT 76
#define LUA_MARIO_STATE_FIELD_COUNT 77
static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = {
{ "action", LVT_U32, offsetof(struct MarioState, action), false, LOT_NONE },
{ "actionArg", LVT_U32, offsetof(struct MarioState, actionArg), false, LOT_NONE },
@ -849,7 +849,7 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = {
{ "slideYaw", LVT_S16, offsetof(struct MarioState, slideYaw), false, LOT_NONE },
{ "spawnInfo", LVT_COBJECT_P, offsetof(struct MarioState, spawnInfo), false, LOT_SPAWNINFO },
{ "specialTripleJump", LVT_U8, offsetof(struct MarioState, specialTripleJump), false, LOT_NONE },
// { "splineKeyframe", LVT_???, offsetof(struct MarioState, splineKeyframe), false, LOT_??? }, <--- UNIMPLEMENTED
{ "splineKeyframe", LVT_COBJECT_P, offsetof(struct MarioState, splineKeyframe), false, LOT_POINTER },
{ "splineKeyframeFraction", LVT_F32, offsetof(struct MarioState, splineKeyframeFraction), false, LOT_NONE },
{ "splineState", LVT_S32, offsetof(struct MarioState, splineState), false, LOT_NONE },
{ "squishTimer", LVT_U8, offsetof(struct MarioState, squishTimer), false, LOT_NONE },
@ -938,7 +938,7 @@ static struct LuaObjectField sNetworkPlayerFields[LUA_NETWORK_PLAYER_FIELD_COUNT
{ "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE },
};
#define LUA_OBJECT_FIELD_COUNT 755
#define LUA_OBJECT_FIELD_COUNT 756
static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
{ "activeFlags", LVT_S16, offsetof(struct Object, activeFlags), false, LOT_NONE },
{ "areaTimer", LVT_U32, offsetof(struct Object, areaTimer), false, LOT_NONE },
@ -1704,7 +1704,7 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
// { "respawnInfo", LVT_???, offsetof(struct Object, respawnInfo), false, LOT_??? }, <--- UNIMPLEMENTED
{ "respawnInfoType", LVT_S16, offsetof(struct Object, respawnInfoType), false, LOT_NONE },
{ "setHome", LVT_U8, offsetof(struct Object, setHome), false, LOT_NONE },
// { "transform", LVT_???, offsetof(struct Object, transform), false, LOT_??? }, <--- UNIMPLEMENTED
{ "transform", LVT_COBJECT, offsetof(struct Object, transform), true, LOT_MAT4 },
{ "unused1", LVT_U32, offsetof(struct Object, unused1), false, LOT_NONE },
{ "usingObj", LVT_COBJECT_P, offsetof(struct Object, usingObj), false, LOT_OBJECT },
};

View file

@ -14,7 +14,7 @@
bool smlua_functions_valid_param_count(lua_State* L, int expected) {
int top = lua_gettop(L);
if (top != expected) {
LOG_LUA_LINE("improper param count: expected %u, received %u", expected, top);
LOG_LUA_LINE("Improper param count: Expected %u, Received %u", expected, top);
return false;
}
return true;
@ -23,7 +23,7 @@ bool smlua_functions_valid_param_count(lua_State* L, int expected) {
bool smlua_functions_valid_param_range(lua_State* L, int min, int max) {
int top = lua_gettop(L);
if (top < min || top > max) {
LOG_LUA_LINE("improper param count: expected (%u - %u), received %u", min, max, top);
LOG_LUA_LINE("Improper param count: Expected (%u - %u), Received %u", min, max, top);
return false;
}
return true;

File diff suppressed because it is too large Load diff

View file

@ -12,6 +12,14 @@ static u8 sVec3fBufferIndex = 0;
static Vec3s sVec3sBuffer[VEC3S_BUFFER_COUNT] = { 0 };
static u8 sVec3sBufferIndex = 0;
#define VEC4F_BUFFER_COUNT 64
static Vec4f sVec4fBuffer[VEC4F_BUFFER_COUNT] = { 0 };
static u8 sVec4fBufferIndex = 0;
#define VEC4S_BUFFER_COUNT 64
static Vec4s sVec4sBuffer[VEC4S_BUFFER_COUNT] = { 0 };
static u8 sVec4sBufferIndex = 0;
#define COLOR_BUFFER_COUNT 64
static Color sColorBuffer[COLOR_BUFFER_COUNT] = { 0 };
static u8 sColorBufferIndex = 0;
@ -26,6 +34,16 @@ s16* smlua_get_vec3s_from_buffer(void) {
return sVec3sBuffer[sVec3sBufferIndex++];
}
f32* smlua_get_vec4f_from_buffer(void) {
if (sVec4fBufferIndex >= VEC4F_BUFFER_COUNT) { sVec4fBufferIndex = 0; }
return sVec4fBuffer[sVec4fBufferIndex++];
}
s16* smlua_get_vec4s_from_buffer(void) {
if (sVec4sBufferIndex >= VEC4S_BUFFER_COUNT) { sVec4sBufferIndex = 0; }
return sVec4sBuffer[sVec4sBufferIndex++];
}
u8* smlua_get_color_from_buffer(void) {
if (sColorBufferIndex >= COLOR_BUFFER_COUNT) { sColorBufferIndex = 0; }
return sColorBuffer[sColorBufferIndex++];

View file

@ -8,6 +8,8 @@ struct LSTNetworkType;
f32* smlua_get_vec3f_from_buffer(void);
s16* smlua_get_vec3s_from_buffer(void);
f32* smlua_get_vec4f_from_buffer(void);
s16* smlua_get_vec4s_from_buffer(void);
u8* smlua_get_color_from_buffer(void);
void smlua_bind_function(lua_State* L, const char* name, void* func);