diff --git a/autogen/common.py b/autogen/common.py index 8ef5d75c..f16e7354 100644 --- a/autogen/common.py +++ b/autogen/common.py @@ -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 diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index 81e787e6..e25d05cc 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -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' diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 3bc920dc..c492c18f 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -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 diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index eb9dbbe4..8c05e3a0 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -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 diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 77ab5daa..0724862e 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -5231,6 +5231,26 @@
+## [get_credits_str_width](#get_credits_str_width) + +### Lua Example +`local integerValue = get_credits_str_width(str)` + +### Parameters +| Field | Type | +| ----- | ---- | +| str | `Pointer` <`integer`> | + +### Returns +- `integer` + +### C Prototype +`s32 get_credits_str_width(char *str);` + +[:arrow_up_small:](#) + +
+ ## [get_star_collection_dialog](#get_star_collection_dialog) ### Lua Example @@ -6851,6 +6871,27 @@
+## [anim_spline_init](#anim_spline_init) + +### Lua Example +`anim_spline_init(m, keyFrames)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| keyFrames | `Pointer` <`Vec4s`> | + +### Returns +- None + +### C Prototype +`void anim_spline_init(struct MarioState* m, Vec4s *keyFrames);` + +[:arrow_up_small:](#) + +
+ ## [anim_spline_poll](#anim_spline_poll) ### Lua Example @@ -6918,6 +6959,400 @@
+## [find_vector_perpendicular_to_plane](#find_vector_perpendicular_to_plane) + +### Lua Example +`local voidValue = find_vector_perpendicular_to_plane(dest, a, b, c)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| a | [Vec3f](structs.md#Vec3f) | +| b | [Vec3f](structs.md#Vec3f) | +| c | [Vec3f](structs.md#Vec3f) | + +### Returns +- `void *` + +### C Prototype +`void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c);` + +[:arrow_up_small:](#) + +
+ +## [get_pos_from_transform_mtx](#get_pos_from_transform_mtx) + +### Lua Example +`get_pos_from_transform_mtx(dest, objMtx, camMtx)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| objMtx | `Mat4` | +| camMtx | `Mat4` | + +### Returns +- None + +### C Prototype +`void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_align_terrain_normal](#mtxf_align_terrain_normal) + +### Lua Example +`mtxf_align_terrain_normal(dest, upDir, pos, yaw)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| upDir | [Vec3f](structs.md#Vec3f) | +| pos | [Vec3f](structs.md#Vec3f) | +| yaw | `integer` | + +### Returns +- None + +### C Prototype +`void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_align_terrain_triangle](#mtxf_align_terrain_triangle) + +### Lua Example +`mtxf_align_terrain_triangle(mtx, pos, yaw, radius)` + +### Parameters +| Field | Type | +| ----- | ---- | +| mtx | `Mat4` | +| pos | [Vec3f](structs.md#Vec3f) | +| yaw | `integer` | +| radius | `number` | + +### Returns +- None + +### C Prototype +`void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_billboard](#mtxf_billboard) + +### Lua Example +`mtxf_billboard(dest, mtx, position, angle)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| mtx | `Mat4` | +| position | [Vec3f](structs.md#Vec3f) | +| angle | `integer` | + +### Returns +- None + +### C Prototype +`void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_copy](#mtxf_copy) + +### Lua Example +`mtxf_copy(dest, src)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| src | `Mat4` | + +### Returns +- None + +### C Prototype +`void mtxf_copy(Mat4 dest, Mat4 src);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_cylboard](#mtxf_cylboard) + +### Lua Example +`mtxf_cylboard(dest, mtx, position, angle)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| mtx | `Mat4` | +| position | [Vec3f](structs.md#Vec3f) | +| angle | `integer` | + +### Returns +- None + +### C Prototype +`void mtxf_cylboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_identity](#mtxf_identity) + +### Lua Example +`mtxf_identity(mtx)` + +### Parameters +| Field | Type | +| ----- | ---- | +| mtx | `Mat4` | + +### Returns +- None + +### C Prototype +`void mtxf_identity(Mat4 mtx);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_inverse](#mtxf_inverse) + +### Lua Example +`mtxf_inverse(dest, src)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| src | `Mat4` | + +### Returns +- None + +### C Prototype +`void mtxf_inverse(Mat4 dest, Mat4 src);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_lookat](#mtxf_lookat) + +### Lua Example +`mtxf_lookat(mtx, from, to, roll)` + +### Parameters +| Field | Type | +| ----- | ---- | +| mtx | `Mat4` | +| from | [Vec3f](structs.md#Vec3f) | +| to | [Vec3f](structs.md#Vec3f) | +| roll | `integer` | + +### Returns +- None + +### C Prototype +`void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_mul](#mtxf_mul) + +### Lua Example +`mtxf_mul(dest, a, b)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| a | `Mat4` | +| b | `Mat4` | + +### Returns +- None + +### C Prototype +`void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_mul_vec3s](#mtxf_mul_vec3s) + +### Lua Example +`mtxf_mul_vec3s(mtx, b)` + +### Parameters +| Field | Type | +| ----- | ---- | +| mtx | `Mat4` | +| b | [Vec3s](structs.md#Vec3s) | + +### Returns +- None + +### C Prototype +`void mtxf_mul_vec3s(Mat4 mtx, Vec3s b);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_rotate_xy](#mtxf_rotate_xy) + +### Lua Example +`mtxf_rotate_xy(mtx, angle)` + +### Parameters +| Field | Type | +| ----- | ---- | +| mtx | `Pointer` <`Mtx`> | +| angle | `integer` | + +### Returns +- None + +### C Prototype +`void mtxf_rotate_xy(Mtx *mtx, s16 angle);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_rotate_xyz_and_translate](#mtxf_rotate_xyz_and_translate) + +### Lua Example +`mtxf_rotate_xyz_and_translate(dest, b, c)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| b | [Vec3f](structs.md#Vec3f) | +| c | [Vec3s](structs.md#Vec3s) | + +### Returns +- None + +### C Prototype +`void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_rotate_zxy_and_translate](#mtxf_rotate_zxy_and_translate) + +### Lua Example +`mtxf_rotate_zxy_and_translate(dest, translate, rotate)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| translate | [Vec3f](structs.md#Vec3f) | +| rotate | [Vec3s](structs.md#Vec3s) | + +### Returns +- None + +### C Prototype +`void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_scale_vec3f](#mtxf_scale_vec3f) + +### Lua Example +`mtxf_scale_vec3f(dest, mtx, s)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| mtx | `Mat4` | +| s | [Vec3f](structs.md#Vec3f) | + +### Returns +- None + +### C Prototype +`void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_to_mtx](#mtxf_to_mtx) + +### Lua Example +`mtxf_to_mtx(dest, src)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Pointer` <`Mtx`> | +| src | `Mat4` | + +### Returns +- None + +### C Prototype +`void mtxf_to_mtx(Mtx *dest, Mat4 src);` + +[:arrow_up_small:](#) + +
+ +## [mtxf_translate](#mtxf_translate) + +### Lua Example +`mtxf_translate(dest, b)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | `Mat4` | +| b | [Vec3f](structs.md#Vec3f) | + +### Returns +- None + +### C Prototype +`void mtxf_translate(Mat4 dest, Vec3f b);` + +[:arrow_up_small:](#) + +
+ ## [not_zero](#not_zero) ### Lua Example @@ -6939,6 +7374,50 @@
+## [spline_get_weights](#spline_get_weights) + +### Lua Example +`spline_get_weights(m, result, t, c)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| result | `Vec4f` | +| t | `number` | +| c | `integer` | + +### Returns +- None + +### C Prototype +`void spline_get_weights(struct MarioState* m, Vec4f result, f32 t, UNUSED s32 c);` + +[:arrow_up_small:](#) + +
+ +## [vec3f_add](#vec3f_add) + +### Lua Example +`local voidValue = vec3f_add(dest, a)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| a | [Vec3f](structs.md#Vec3f) | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_add(Vec3f dest, Vec3f a);` + +[:arrow_up_small:](#) + +
+ ## [vec3f_combine](#vec3f_combine) ### Lua Example @@ -6963,6 +7442,71 @@
+## [vec3f_copy](#vec3f_copy) + +### Lua Example +`local voidValue = vec3f_copy(dest, src)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| src | [Vec3f](structs.md#Vec3f) | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_copy(Vec3f dest, Vec3f src);` + +[:arrow_up_small:](#) + +
+ +## [vec3f_cross](#vec3f_cross) + +### Lua Example +`local voidValue = vec3f_cross(dest, a, b)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| a | [Vec3f](structs.md#Vec3f) | +| b | [Vec3f](structs.md#Vec3f) | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b);` + +[:arrow_up_small:](#) + +
+ +## [vec3f_dif](#vec3f_dif) + +### Lua Example +`local voidValue = vec3f_dif(dest, a, b)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| a | [Vec3f](structs.md#Vec3f) | +| b | [Vec3f](structs.md#Vec3f) | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_dif(Vec3f dest, Vec3f a, Vec3f b);` + +[:arrow_up_small:](#) + +
+ ## [vec3f_dist](#vec3f_dist) ### Lua Example @@ -7049,6 +7593,47 @@
+## [vec3f_mul](#vec3f_mul) + +### Lua Example +`local voidValue = vec3f_mul(dest, a)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| a | `number` | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_mul(Vec3f dest, f32 a);` + +[:arrow_up_small:](#) + +
+ +## [vec3f_normalize](#vec3f_normalize) + +### Lua Example +`local voidValue = vec3f_normalize(dest)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_normalize(Vec3f dest);` + +[:arrow_up_small:](#) + +
+ ## [vec3f_project](#vec3f_project) ### Lua Example @@ -7071,6 +7656,50 @@
+## [vec3f_rotate_zxy](#vec3f_rotate_zxy) + +### Lua Example +`local voidValue = vec3f_rotate_zxy(v, rotate)` + +### Parameters +| Field | Type | +| ----- | ---- | +| v | [Vec3f](structs.md#Vec3f) | +| rotate | [Vec3s](structs.md#Vec3s) | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_rotate_zxy(Vec3f v, Vec3s rotate);` + +[:arrow_up_small:](#) + +
+ +## [vec3f_set](#vec3f_set) + +### Lua Example +`local voidValue = vec3f_set(dest, x, y, z)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| x | `number` | +| y | `number` | +| z | `number` | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z);` + +[:arrow_up_small:](#) + +
+ ## [vec3f_set_dist_and_angle](#vec3f_set_dist_and_angle) ### Lua Example @@ -7095,6 +7724,157 @@
+## [vec3f_sum](#vec3f_sum) + +### Lua Example +`local voidValue = vec3f_sum(dest, a, b)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| a | [Vec3f](structs.md#Vec3f) | +| b | [Vec3f](structs.md#Vec3f) | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b);` + +[:arrow_up_small:](#) + +
+ +## [vec3f_to_vec3s](#vec3f_to_vec3s) + +### Lua Example +`local voidValue = vec3f_to_vec3s(dest, a)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3s](structs.md#Vec3s) | +| a | [Vec3f](structs.md#Vec3f) | + +### Returns +- `void *` + +### C Prototype +`void *vec3f_to_vec3s(Vec3s dest, Vec3f a);` + +[:arrow_up_small:](#) + +
+ +## [vec3s_add](#vec3s_add) + +### Lua Example +`local voidValue = vec3s_add(dest, a)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3s](structs.md#Vec3s) | +| a | [Vec3s](structs.md#Vec3s) | + +### Returns +- `void *` + +### C Prototype +`void *vec3s_add(Vec3s dest, Vec3s a);` + +[:arrow_up_small:](#) + +
+ +## [vec3s_copy](#vec3s_copy) + +### Lua Example +`local voidValue = vec3s_copy(dest, src)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3s](structs.md#Vec3s) | +| src | [Vec3s](structs.md#Vec3s) | + +### Returns +- `void *` + +### C Prototype +`void *vec3s_copy(Vec3s dest, Vec3s src);` + +[:arrow_up_small:](#) + +
+ +## [vec3s_set](#vec3s_set) + +### Lua Example +`local voidValue = vec3s_set(dest, x, y, z)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3s](structs.md#Vec3s) | +| x | `integer` | +| y | `integer` | +| z | `integer` | + +### Returns +- `void *` + +### C Prototype +`void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z);` + +[:arrow_up_small:](#) + +
+ +## [vec3s_sum](#vec3s_sum) + +### Lua Example +`local voidValue = vec3s_sum(dest, a, b)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3s](structs.md#Vec3s) | +| a | [Vec3s](structs.md#Vec3s) | +| b | [Vec3s](structs.md#Vec3s) | + +### Returns +- `void *` + +### C Prototype +`void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b);` + +[:arrow_up_small:](#) + +
+ +## [vec3s_to_vec3f](#vec3s_to_vec3f) + +### Lua Example +`local voidValue = vec3s_to_vec3f(dest, a)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dest | [Vec3f](structs.md#Vec3f) | +| a | [Vec3s](structs.md#Vec3s) | + +### Returns +- `void *` + +### C Prototype +`void *vec3s_to_vec3f(Vec3f dest, Vec3s a);` + +[:arrow_up_small:](#) + +
+ --- # functions from misc.h @@ -7462,818 +8242,6 @@ [:arrow_up_small:](#) -
- ---- -# functions from obj_behaviors.c - -
- - -## [absf_2](#absf_2) - -### Lua Example -`local numberValue = absf_2(f)` - -### Parameters -| Field | Type | -| ----- | ---- | -| f | `number` | - -### Returns -- `number` - -### C Prototype -`f32 absf_2(f32 f);` - -[:arrow_up_small:](#) - -
- -## [calc_new_obj_vel_and_pos_y](#calc_new_obj_vel_and_pos_y) - -### Lua Example -`calc_new_obj_vel_and_pos_y(objFloor, objFloorY, objVelX, objVelZ)` - -### Parameters -| Field | Type | -| ----- | ---- | -| objFloor | [Surface](structs.md#Surface) | -| objFloorY | `number` | -| objVelX | `number` | -| objVelZ | `number` | - -### Returns -- None - -### C Prototype -`void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ);` - -[:arrow_up_small:](#) - -
- -## [calc_new_obj_vel_and_pos_y_underwater](#calc_new_obj_vel_and_pos_y_underwater) - -### Lua Example -`calc_new_obj_vel_and_pos_y_underwater(objFloor, floorY, objVelX, objVelZ, waterY)` - -### Parameters -| Field | Type | -| ----- | ---- | -| objFloor | [Surface](structs.md#Surface) | -| floorY | `number` | -| objVelX | `number` | -| objVelZ | `number` | -| waterY | `number` | - -### Returns -- None - -### C Prototype -`void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, f32 waterY);` - -[:arrow_up_small:](#) - -
- -## [calc_obj_friction](#calc_obj_friction) - -### Lua Example -`calc_obj_friction(objFriction, floor_nY)` - -### Parameters -| Field | Type | -| ----- | ---- | -| objFriction | `Pointer` <`number`> | -| floor_nY | `number` | - -### Returns -- None - -### C Prototype -`void calc_obj_friction(f32 *objFriction, f32 floor_nY);` - -[:arrow_up_small:](#) - -
- -## [current_mario_room_check](#current_mario_room_check) - -### Lua Example -`local integerValue = current_mario_room_check(room)` - -### Parameters -| Field | Type | -| ----- | ---- | -| room | `integer` | - -### Returns -- `integer` - -### C Prototype -`s8 current_mario_room_check(s16 room);` - -[:arrow_up_small:](#) - -
- -## [is_nearest_mario_state_to_object](#is_nearest_mario_state_to_object) - -### Lua Example -`local integerValue = is_nearest_mario_state_to_object(m, obj)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| obj | [Object](structs.md#Object) | - -### Returns -- `integer` - -### C Prototype -`u8 is_nearest_mario_state_to_object(struct MarioState *m, struct Object *obj);` - -[:arrow_up_small:](#) - -
- -## [is_nearest_player_to_object](#is_nearest_player_to_object) - -### Lua Example -`local integerValue = is_nearest_player_to_object(m, obj)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [Object](structs.md#Object) | -| obj | [Object](structs.md#Object) | - -### Returns -- `integer` - -### C Prototype -`u8 is_nearest_player_to_object(struct Object *m, struct Object *obj);` - -[:arrow_up_small:](#) - -
- -## [is_other_player_active](#is_other_player_active) - -### Lua Example -`local integerValue = is_other_player_active()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`u8 is_other_player_active(void);` - -[:arrow_up_small:](#) - -
- -## [is_player_active](#is_player_active) - -### Lua Example -`local integerValue = is_player_active(m)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | - -### Returns -- `integer` - -### C Prototype -`u8 is_player_active(struct MarioState* m);` - -[:arrow_up_small:](#) - -
- -## [is_player_in_local_area](#is_player_in_local_area) - -### Lua Example -`local integerValue = is_player_in_local_area(m)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | - -### Returns -- `integer` - -### C Prototype -`u8 is_player_in_local_area(struct MarioState* m);` - -[:arrow_up_small:](#) - -
- -## [is_point_close_to_object](#is_point_close_to_object) - -### Lua Example -`local integerValue = is_point_close_to_object(obj, x, y, z, dist)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | -| x | `number` | -| y | `number` | -| z | `number` | -| dist | `integer` | - -### Returns -- `integer` - -### C Prototype -`s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist);` - -[:arrow_up_small:](#) - -
- -## [is_point_within_radius_of_any_player](#is_point_within_radius_of_any_player) - -### Lua Example -`local integerValue = is_point_within_radius_of_any_player(x, y, z, dist)` - -### Parameters -| Field | Type | -| ----- | ---- | -| x | `number` | -| y | `number` | -| z | `number` | -| dist | `integer` | - -### Returns -- `integer` - -### C Prototype -`s8 is_point_within_radius_of_any_player(f32 x, f32 y, f32 z, s32 dist);` - -[:arrow_up_small:](#) - -
- -## [is_point_within_radius_of_mario](#is_point_within_radius_of_mario) - -### Lua Example -`local integerValue = is_point_within_radius_of_mario(x, y, z, dist)` - -### Parameters -| Field | Type | -| ----- | ---- | -| x | `number` | -| y | `number` | -| z | `number` | -| dist | `integer` | - -### Returns -- `integer` - -### C Prototype -`s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist);` - -[:arrow_up_small:](#) - -
- -## [nearest_interacting_mario_state_to_object](#nearest_interacting_mario_state_to_object) - -### Lua Example -`local MarioStateValue = nearest_interacting_mario_state_to_object(obj)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | - -### Returns -[MarioState](structs.md#MarioState) - -### C Prototype -`struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj);` - -[:arrow_up_small:](#) - -
- -## [nearest_interacting_player_to_object](#nearest_interacting_player_to_object) - -### Lua Example -`local ObjectValue = nearest_interacting_player_to_object(obj)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | - -### Returns -[Object](structs.md#Object) - -### C Prototype -`struct Object *nearest_interacting_player_to_object(struct Object *obj);` - -[:arrow_up_small:](#) - -
- -## [nearest_mario_state_to_object](#nearest_mario_state_to_object) - -### Lua Example -`local MarioStateValue = nearest_mario_state_to_object(obj)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | - -### Returns -[MarioState](structs.md#MarioState) - -### C Prototype -`struct MarioState* nearest_mario_state_to_object(struct Object *obj);` - -[:arrow_up_small:](#) - -
- -## [nearest_player_to_object](#nearest_player_to_object) - -### Lua Example -`local ObjectValue = nearest_player_to_object(obj)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | - -### Returns -[Object](structs.md#Object) - -### C Prototype -`struct Object* nearest_player_to_object(struct Object *obj);` - -[:arrow_up_small:](#) - -
- -## [nearest_possible_mario_state_to_object](#nearest_possible_mario_state_to_object) - -### Lua Example -`local MarioStateValue = nearest_possible_mario_state_to_object(obj)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | - -### Returns -[MarioState](structs.md#MarioState) - -### C Prototype -`struct MarioState* nearest_possible_mario_state_to_object(struct Object *obj);` - -[:arrow_up_small:](#) - -
- -## [obj_check_floor_death](#obj_check_floor_death) - -### Lua Example -`obj_check_floor_death(collisionFlags, floor)` - -### Parameters -| Field | Type | -| ----- | ---- | -| collisionFlags | `integer` | -| floor | [Surface](structs.md#Surface) | - -### Returns -- None - -### C Prototype -`void obj_check_floor_death(s16 collisionFlags, struct Surface *floor);` - -[:arrow_up_small:](#) - -
- -## [obj_check_if_facing_toward_angle](#obj_check_if_facing_toward_angle) - -### Lua Example -`local integerValue = obj_check_if_facing_toward_angle(base, goal, range)` - -### Parameters -| Field | Type | -| ----- | ---- | -| base | `integer` | -| goal | `integer` | -| range | `integer` | - -### Returns -- `integer` - -### C Prototype -`s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range);` - -[:arrow_up_small:](#) - -
- -## [obj_find_wall](#obj_find_wall) - -### Lua Example -`local integerValue = obj_find_wall(objNewX, objY, objNewZ, objVelX, objVelZ)` - -### Parameters -| Field | Type | -| ----- | ---- | -| objNewX | `number` | -| objY | `number` | -| objNewZ | `number` | -| objVelX | `number` | -| objVelZ | `number` | - -### Returns -- `integer` - -### C Prototype -`s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ);` - -[:arrow_up_small:](#) - -
- -## [obj_find_wall_displacement](#obj_find_wall_displacement) - -### Lua Example -`local integerValue = obj_find_wall_displacement(dist, x, y, z, radius)` - -### Parameters -| Field | Type | -| ----- | ---- | -| dist | [Vec3f](structs.md#Vec3f) | -| x | `number` | -| y | `number` | -| z | `number` | -| radius | `number` | - -### Returns -- `integer` - -### C Prototype -`s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius);` - -[:arrow_up_small:](#) - -
- -## [obj_flicker_and_disappear](#obj_flicker_and_disappear) - -### Lua Example -`local integerValue = obj_flicker_and_disappear(obj, lifeSpan)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | -| lifeSpan | `integer` | - -### Returns -- `integer` - -### C Prototype -`s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan);` - -[:arrow_up_small:](#) - -
- -## [obj_lava_death](#obj_lava_death) - -### Lua Example -`local integerValue = obj_lava_death()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s8 obj_lava_death(void);` - -[:arrow_up_small:](#) - -
- -## [obj_move_xyz_using_fvel_and_yaw](#obj_move_xyz_using_fvel_and_yaw) - -### Lua Example -`obj_move_xyz_using_fvel_and_yaw(obj)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | - -### Returns -- None - -### C Prototype -`void obj_move_xyz_using_fvel_and_yaw(struct Object *obj);` - -[:arrow_up_small:](#) - -
- -## [obj_orient_graph](#obj_orient_graph) - -### Lua Example -`obj_orient_graph(obj, normalX, normalY, normalZ)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | -| normalX | `number` | -| normalY | `number` | -| normalZ | `number` | - -### Returns -- None - -### C Prototype -`void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ);` - -[:arrow_up_small:](#) - -
- -## [obj_return_and_displace_home](#obj_return_and_displace_home) - -### Lua Example -`obj_return_and_displace_home(obj, homeX, homeY, homeZ, baseDisp)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | -| homeX | `number` | -| homeY | `number` | -| homeZ | `number` | -| baseDisp | `integer` | - -### Returns -- None - -### C Prototype -`void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp);` - -[:arrow_up_small:](#) - -
- -## [obj_return_home_if_safe](#obj_return_home_if_safe) - -### Lua Example -`local integerValue = obj_return_home_if_safe(obj, homeX, y, homeZ, dist)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | -| homeX | `number` | -| y | `number` | -| homeZ | `number` | -| dist | `integer` | - -### Returns -- `integer` - -### C Prototype -`s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist);` - -[:arrow_up_small:](#) - -
- -## [obj_spawn_yellow_coins](#obj_spawn_yellow_coins) - -### Lua Example -`obj_spawn_yellow_coins(obj, nCoins)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | -| nCoins | `integer` | - -### Returns -- None - -### C Prototype -`void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins);` - -[:arrow_up_small:](#) - -
- -## [obj_splash](#obj_splash) - -### Lua Example -`obj_splash(waterY, objY)` - -### Parameters -| Field | Type | -| ----- | ---- | -| waterY | `integer` | -| objY | `integer` | - -### Returns -- None - -### C Prototype -`void obj_splash(s32 waterY, s32 objY);` - -[:arrow_up_small:](#) - -
- -## [obj_update_pos_vel_xz](#obj_update_pos_vel_xz) - -### Lua Example -`obj_update_pos_vel_xz()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void obj_update_pos_vel_xz(void);` - -[:arrow_up_small:](#) - -
- -## [object_step](#object_step) - -### Lua Example -`local integerValue = object_step()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s16 object_step(void);` - -[:arrow_up_small:](#) - -
- -## [object_step_without_floor_orient](#object_step_without_floor_orient) - -### Lua Example -`local integerValue = object_step_without_floor_orient()` - -### Parameters -- None - -### Returns -- `integer` - -### C Prototype -`s16 object_step_without_floor_orient(void);` - -[:arrow_up_small:](#) - -
- -## [set_object_visibility](#set_object_visibility) - -### Lua Example -`set_object_visibility(obj, dist)` - -### Parameters -| Field | Type | -| ----- | ---- | -| obj | [Object](structs.md#Object) | -| dist | `integer` | - -### Returns -- None - -### C Prototype -`void set_object_visibility(struct Object *obj, s32 dist);` - -[:arrow_up_small:](#) - -
- -## [set_yoshi_as_not_dead](#set_yoshi_as_not_dead) - -### Lua Example -`set_yoshi_as_not_dead()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void set_yoshi_as_not_dead(void);` - -[:arrow_up_small:](#) - -
- -## [spawn_orange_number](#spawn_orange_number) - -### Lua Example -`spawn_orange_number(behParam, relX, relY, relZ)` - -### Parameters -| Field | Type | -| ----- | ---- | -| behParam | `integer` | -| relX | `integer` | -| relY | `integer` | -| relZ | `integer` | - -### Returns -- None - -### C Prototype -`void spawn_orange_number(s8 behParam, s16 relX, s16 relY, s16 relZ);` - -[:arrow_up_small:](#) - -
- -## [turn_obj_away_from_steep_floor](#turn_obj_away_from_steep_floor) - -### Lua Example -`local integerValue = turn_obj_away_from_steep_floor(objFloor, floorY, objVelX, objVelZ)` - -### Parameters -| Field | Type | -| ----- | ---- | -| objFloor | [Surface](structs.md#Surface) | -| floorY | `number` | -| objVelX | `number` | -| objVelZ | `number` | - -### Returns -- `integer` - -### C Prototype -`s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ);` - -[:arrow_up_small:](#) - -
- -## [turn_obj_away_from_surface](#turn_obj_away_from_surface) - -### Lua Example -`turn_obj_away_from_surface(velX, velZ, nX, nY, nZ, objYawX, objYawZ)` - -### Parameters -| Field | Type | -| ----- | ---- | -| velX | `number` | -| velZ | `number` | -| nX | `number` | -| nY | `number` | -| nZ | `number` | -| objYawX | `Pointer` <`number`> | -| objYawZ | `Pointer` <`number`> | - -### Returns -- None - -### C Prototype -`void turn_obj_away_from_surface(f32 velX, f32 velZ, f32 nX, UNUSED f32 nY, f32 nZ, f32 *objYawX, f32 *objYawZ);` - -[:arrow_up_small:](#) -
--- diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 90fe9c8b..6a0225d6 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -5,6 +5,818 @@ [< prev](functions-3.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | 4 | [5](functions-5.md) | [next >](functions-5.md)] +--- +# functions from obj_behaviors.c + +
+ + +## [absf_2](#absf_2) + +### Lua Example +`local numberValue = absf_2(f)` + +### Parameters +| Field | Type | +| ----- | ---- | +| f | `number` | + +### Returns +- `number` + +### C Prototype +`f32 absf_2(f32 f);` + +[:arrow_up_small:](#) + +
+ +## [calc_new_obj_vel_and_pos_y](#calc_new_obj_vel_and_pos_y) + +### Lua Example +`calc_new_obj_vel_and_pos_y(objFloor, objFloorY, objVelX, objVelZ)` + +### Parameters +| Field | Type | +| ----- | ---- | +| objFloor | [Surface](structs.md#Surface) | +| objFloorY | `number` | +| objVelX | `number` | +| objVelZ | `number` | + +### Returns +- None + +### C Prototype +`void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ);` + +[:arrow_up_small:](#) + +
+ +## [calc_new_obj_vel_and_pos_y_underwater](#calc_new_obj_vel_and_pos_y_underwater) + +### Lua Example +`calc_new_obj_vel_and_pos_y_underwater(objFloor, floorY, objVelX, objVelZ, waterY)` + +### Parameters +| Field | Type | +| ----- | ---- | +| objFloor | [Surface](structs.md#Surface) | +| floorY | `number` | +| objVelX | `number` | +| objVelZ | `number` | +| waterY | `number` | + +### Returns +- None + +### C Prototype +`void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, f32 waterY);` + +[:arrow_up_small:](#) + +
+ +## [calc_obj_friction](#calc_obj_friction) + +### Lua Example +`calc_obj_friction(objFriction, floor_nY)` + +### Parameters +| Field | Type | +| ----- | ---- | +| objFriction | `Pointer` <`number`> | +| floor_nY | `number` | + +### Returns +- None + +### C Prototype +`void calc_obj_friction(f32 *objFriction, f32 floor_nY);` + +[:arrow_up_small:](#) + +
+ +## [current_mario_room_check](#current_mario_room_check) + +### Lua Example +`local integerValue = current_mario_room_check(room)` + +### Parameters +| Field | Type | +| ----- | ---- | +| room | `integer` | + +### Returns +- `integer` + +### C Prototype +`s8 current_mario_room_check(s16 room);` + +[:arrow_up_small:](#) + +
+ +## [is_nearest_mario_state_to_object](#is_nearest_mario_state_to_object) + +### Lua Example +`local integerValue = is_nearest_mario_state_to_object(m, obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| obj | [Object](structs.md#Object) | + +### Returns +- `integer` + +### C Prototype +`u8 is_nearest_mario_state_to_object(struct MarioState *m, struct Object *obj);` + +[:arrow_up_small:](#) + +
+ +## [is_nearest_player_to_object](#is_nearest_player_to_object) + +### Lua Example +`local integerValue = is_nearest_player_to_object(m, obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [Object](structs.md#Object) | +| obj | [Object](structs.md#Object) | + +### Returns +- `integer` + +### C Prototype +`u8 is_nearest_player_to_object(struct Object *m, struct Object *obj);` + +[:arrow_up_small:](#) + +
+ +## [is_other_player_active](#is_other_player_active) + +### Lua Example +`local integerValue = is_other_player_active()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`u8 is_other_player_active(void);` + +[:arrow_up_small:](#) + +
+ +## [is_player_active](#is_player_active) + +### Lua Example +`local integerValue = is_player_active(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- `integer` + +### C Prototype +`u8 is_player_active(struct MarioState* m);` + +[:arrow_up_small:](#) + +
+ +## [is_player_in_local_area](#is_player_in_local_area) + +### Lua Example +`local integerValue = is_player_in_local_area(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- `integer` + +### C Prototype +`u8 is_player_in_local_area(struct MarioState* m);` + +[:arrow_up_small:](#) + +
+ +## [is_point_close_to_object](#is_point_close_to_object) + +### Lua Example +`local integerValue = is_point_close_to_object(obj, x, y, z, dist)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | +| x | `number` | +| y | `number` | +| z | `number` | +| dist | `integer` | + +### Returns +- `integer` + +### C Prototype +`s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist);` + +[:arrow_up_small:](#) + +
+ +## [is_point_within_radius_of_any_player](#is_point_within_radius_of_any_player) + +### Lua Example +`local integerValue = is_point_within_radius_of_any_player(x, y, z, dist)` + +### Parameters +| Field | Type | +| ----- | ---- | +| x | `number` | +| y | `number` | +| z | `number` | +| dist | `integer` | + +### Returns +- `integer` + +### C Prototype +`s8 is_point_within_radius_of_any_player(f32 x, f32 y, f32 z, s32 dist);` + +[:arrow_up_small:](#) + +
+ +## [is_point_within_radius_of_mario](#is_point_within_radius_of_mario) + +### Lua Example +`local integerValue = is_point_within_radius_of_mario(x, y, z, dist)` + +### Parameters +| Field | Type | +| ----- | ---- | +| x | `number` | +| y | `number` | +| z | `number` | +| dist | `integer` | + +### Returns +- `integer` + +### C Prototype +`s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist);` + +[:arrow_up_small:](#) + +
+ +## [nearest_interacting_mario_state_to_object](#nearest_interacting_mario_state_to_object) + +### Lua Example +`local MarioStateValue = nearest_interacting_mario_state_to_object(obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | + +### Returns +[MarioState](structs.md#MarioState) + +### C Prototype +`struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj);` + +[:arrow_up_small:](#) + +
+ +## [nearest_interacting_player_to_object](#nearest_interacting_player_to_object) + +### Lua Example +`local ObjectValue = nearest_interacting_player_to_object(obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *nearest_interacting_player_to_object(struct Object *obj);` + +[:arrow_up_small:](#) + +
+ +## [nearest_mario_state_to_object](#nearest_mario_state_to_object) + +### Lua Example +`local MarioStateValue = nearest_mario_state_to_object(obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | + +### Returns +[MarioState](structs.md#MarioState) + +### C Prototype +`struct MarioState* nearest_mario_state_to_object(struct Object *obj);` + +[:arrow_up_small:](#) + +
+ +## [nearest_player_to_object](#nearest_player_to_object) + +### Lua Example +`local ObjectValue = nearest_player_to_object(obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object* nearest_player_to_object(struct Object *obj);` + +[:arrow_up_small:](#) + +
+ +## [nearest_possible_mario_state_to_object](#nearest_possible_mario_state_to_object) + +### Lua Example +`local MarioStateValue = nearest_possible_mario_state_to_object(obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | + +### Returns +[MarioState](structs.md#MarioState) + +### C Prototype +`struct MarioState* nearest_possible_mario_state_to_object(struct Object *obj);` + +[:arrow_up_small:](#) + +
+ +## [obj_check_floor_death](#obj_check_floor_death) + +### Lua Example +`obj_check_floor_death(collisionFlags, floor)` + +### Parameters +| Field | Type | +| ----- | ---- | +| collisionFlags | `integer` | +| floor | [Surface](structs.md#Surface) | + +### Returns +- None + +### C Prototype +`void obj_check_floor_death(s16 collisionFlags, struct Surface *floor);` + +[:arrow_up_small:](#) + +
+ +## [obj_check_if_facing_toward_angle](#obj_check_if_facing_toward_angle) + +### Lua Example +`local integerValue = obj_check_if_facing_toward_angle(base, goal, range)` + +### Parameters +| Field | Type | +| ----- | ---- | +| base | `integer` | +| goal | `integer` | +| range | `integer` | + +### Returns +- `integer` + +### C Prototype +`s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range);` + +[:arrow_up_small:](#) + +
+ +## [obj_find_wall](#obj_find_wall) + +### Lua Example +`local integerValue = obj_find_wall(objNewX, objY, objNewZ, objVelX, objVelZ)` + +### Parameters +| Field | Type | +| ----- | ---- | +| objNewX | `number` | +| objY | `number` | +| objNewZ | `number` | +| objVelX | `number` | +| objVelZ | `number` | + +### Returns +- `integer` + +### C Prototype +`s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ);` + +[:arrow_up_small:](#) + +
+ +## [obj_find_wall_displacement](#obj_find_wall_displacement) + +### Lua Example +`local integerValue = obj_find_wall_displacement(dist, x, y, z, radius)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dist | [Vec3f](structs.md#Vec3f) | +| x | `number` | +| y | `number` | +| z | `number` | +| radius | `number` | + +### Returns +- `integer` + +### C Prototype +`s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius);` + +[:arrow_up_small:](#) + +
+ +## [obj_flicker_and_disappear](#obj_flicker_and_disappear) + +### Lua Example +`local integerValue = obj_flicker_and_disappear(obj, lifeSpan)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | +| lifeSpan | `integer` | + +### Returns +- `integer` + +### C Prototype +`s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan);` + +[:arrow_up_small:](#) + +
+ +## [obj_lava_death](#obj_lava_death) + +### Lua Example +`local integerValue = obj_lava_death()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s8 obj_lava_death(void);` + +[:arrow_up_small:](#) + +
+ +## [obj_move_xyz_using_fvel_and_yaw](#obj_move_xyz_using_fvel_and_yaw) + +### Lua Example +`obj_move_xyz_using_fvel_and_yaw(obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | + +### Returns +- None + +### C Prototype +`void obj_move_xyz_using_fvel_and_yaw(struct Object *obj);` + +[:arrow_up_small:](#) + +
+ +## [obj_orient_graph](#obj_orient_graph) + +### Lua Example +`obj_orient_graph(obj, normalX, normalY, normalZ)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | +| normalX | `number` | +| normalY | `number` | +| normalZ | `number` | + +### Returns +- None + +### C Prototype +`void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ);` + +[:arrow_up_small:](#) + +
+ +## [obj_return_and_displace_home](#obj_return_and_displace_home) + +### Lua Example +`obj_return_and_displace_home(obj, homeX, homeY, homeZ, baseDisp)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | +| homeX | `number` | +| homeY | `number` | +| homeZ | `number` | +| baseDisp | `integer` | + +### Returns +- None + +### C Prototype +`void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp);` + +[:arrow_up_small:](#) + +
+ +## [obj_return_home_if_safe](#obj_return_home_if_safe) + +### Lua Example +`local integerValue = obj_return_home_if_safe(obj, homeX, y, homeZ, dist)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | +| homeX | `number` | +| y | `number` | +| homeZ | `number` | +| dist | `integer` | + +### Returns +- `integer` + +### C Prototype +`s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist);` + +[:arrow_up_small:](#) + +
+ +## [obj_spawn_yellow_coins](#obj_spawn_yellow_coins) + +### Lua Example +`obj_spawn_yellow_coins(obj, nCoins)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | +| nCoins | `integer` | + +### Returns +- None + +### C Prototype +`void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins);` + +[:arrow_up_small:](#) + +
+ +## [obj_splash](#obj_splash) + +### Lua Example +`obj_splash(waterY, objY)` + +### Parameters +| Field | Type | +| ----- | ---- | +| waterY | `integer` | +| objY | `integer` | + +### Returns +- None + +### C Prototype +`void obj_splash(s32 waterY, s32 objY);` + +[:arrow_up_small:](#) + +
+ +## [obj_update_pos_vel_xz](#obj_update_pos_vel_xz) + +### Lua Example +`obj_update_pos_vel_xz()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void obj_update_pos_vel_xz(void);` + +[:arrow_up_small:](#) + +
+ +## [object_step](#object_step) + +### Lua Example +`local integerValue = object_step()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s16 object_step(void);` + +[:arrow_up_small:](#) + +
+ +## [object_step_without_floor_orient](#object_step_without_floor_orient) + +### Lua Example +`local integerValue = object_step_without_floor_orient()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s16 object_step_without_floor_orient(void);` + +[:arrow_up_small:](#) + +
+ +## [set_object_visibility](#set_object_visibility) + +### Lua Example +`set_object_visibility(obj, dist)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | +| dist | `integer` | + +### Returns +- None + +### C Prototype +`void set_object_visibility(struct Object *obj, s32 dist);` + +[:arrow_up_small:](#) + +
+ +## [set_yoshi_as_not_dead](#set_yoshi_as_not_dead) + +### Lua Example +`set_yoshi_as_not_dead()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void set_yoshi_as_not_dead(void);` + +[:arrow_up_small:](#) + +
+ +## [spawn_orange_number](#spawn_orange_number) + +### Lua Example +`spawn_orange_number(behParam, relX, relY, relZ)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behParam | `integer` | +| relX | `integer` | +| relY | `integer` | +| relZ | `integer` | + +### Returns +- None + +### C Prototype +`void spawn_orange_number(s8 behParam, s16 relX, s16 relY, s16 relZ);` + +[:arrow_up_small:](#) + +
+ +## [turn_obj_away_from_steep_floor](#turn_obj_away_from_steep_floor) + +### Lua Example +`local integerValue = turn_obj_away_from_steep_floor(objFloor, floorY, objVelX, objVelZ)` + +### Parameters +| Field | Type | +| ----- | ---- | +| objFloor | [Surface](structs.md#Surface) | +| floorY | `number` | +| objVelX | `number` | +| objVelZ | `number` | + +### Returns +- `integer` + +### C Prototype +`s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ);` + +[:arrow_up_small:](#) + +
+ +## [turn_obj_away_from_surface](#turn_obj_away_from_surface) + +### Lua Example +`turn_obj_away_from_surface(velX, velZ, nX, nY, nZ, objYawX, objYawZ)` + +### Parameters +| Field | Type | +| ----- | ---- | +| velX | `number` | +| velZ | `number` | +| nX | `number` | +| nY | `number` | +| nZ | `number` | +| objYawX | `Pointer` <`number`> | +| objYawZ | `Pointer` <`number`> | + +### Returns +- None + +### C Prototype +`void turn_obj_away_from_surface(f32 velX, f32 velZ, f32 nX, UNUSED f32 nY, f32 nZ, f32 *objYawX, f32 *objYawZ);` + +[:arrow_up_small:](#) + +
+ --- # functions from obj_behaviors_2.c @@ -1242,6 +2054,28 @@
+## [create_transformation_from_matrices](#create_transformation_from_matrices) + +### Lua Example +`create_transformation_from_matrices(a0, a1, a2)` + +### Parameters +| Field | Type | +| ----- | ---- | +| a0 | `Mat4` | +| a1 | `Mat4` | +| a2 | `Mat4` | + +### Returns +- None + +### C Prototype +`void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2);` + +[:arrow_up_small:](#) + +
+ ## [cur_obj_abs_y_dist_to_home](#cur_obj_abs_y_dist_to_home) ### Lua Example @@ -3883,6 +4717,50 @@
+## [linear_mtxf_mul_vec3f](#linear_mtxf_mul_vec3f) + +### Lua Example +`linear_mtxf_mul_vec3f(m, dst, v)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | `Mat4` | +| dst | [Vec3f](structs.md#Vec3f) | +| v | [Vec3f](structs.md#Vec3f) | + +### Returns +- None + +### C Prototype +`void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);` + +[:arrow_up_small:](#) + +
+ +## [linear_mtxf_transpose_mul_vec3f](#linear_mtxf_transpose_mul_vec3f) + +### Lua Example +`linear_mtxf_transpose_mul_vec3f(m, dst, v)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | `Mat4` | +| dst | [Vec3f](structs.md#Vec3f) | +| v | [Vec3f](structs.md#Vec3f) | + +### Returns +- None + +### C Prototype +`void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);` + +[:arrow_up_small:](#) + +
+ ## [mario_is_dive_sliding](#mario_is_dive_sliding) ### Lua Example @@ -4009,6 +4887,28 @@
+## [obj_apply_scale_to_matrix](#obj_apply_scale_to_matrix) + +### Lua Example +`obj_apply_scale_to_matrix(obj, dst, src)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | +| dst | `Mat4` | +| src | `Mat4` | + +### Returns +- None + +### C Prototype +`void obj_apply_scale_to_matrix(struct Object *obj, Mat4 dst, Mat4 src);` + +[:arrow_up_small:](#) + +
+ ## [obj_apply_scale_to_transform](#obj_apply_scale_to_transform) ### Lua Example @@ -5101,6 +6001,27 @@
+## [obj_update_pos_from_parent_transformation](#obj_update_pos_from_parent_transformation) + +### Lua Example +`obj_update_pos_from_parent_transformation(a0, a1)` + +### Parameters +| Field | Type | +| ----- | ---- | +| a0 | `Mat4` | +| a1 | [Object](structs.md#Object) | + +### Returns +- None + +### C Prototype +`void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1);` + +[:arrow_up_small:](#) + +
+ ## [player_performed_grab_escape_action](#player_performed_grab_escape_action) ### Lua Example @@ -7687,1239 +8608,6 @@ [:arrow_up_small:](#) -
- ---- -# functions from smlua_obj_utils.h - -
- - -## [get_temp_object_hitbox](#get_temp_object_hitbox) - -### Lua Example -`local ObjectHitboxValue = get_temp_object_hitbox()` - -### Parameters -- None - -### Returns -[ObjectHitbox](structs.md#ObjectHitbox) - -### C Prototype -`struct ObjectHitbox* get_temp_object_hitbox(void);` - -[:arrow_up_small:](#) - -
- -## [get_trajectory](#get_trajectory) - -### Lua Example -`local PointerValue = get_trajectory(name)` - -### Parameters -| Field | Type | -| ----- | ---- | -| name | `string` | - -### Returns -- `Pointer` <`Trajectory`> - -### C Prototype -`Trajectory* get_trajectory(const char* name);` - -[:arrow_up_small:](#) - -
- -## [obj_check_hitbox_overlap](#obj_check_hitbox_overlap) - -### Lua Example -`local booleanValue = obj_check_hitbox_overlap(o1, o2)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o1 | [Object](structs.md#Object) | -| o2 | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_check_hitbox_overlap(struct Object *o1, struct Object *o2);` - -[:arrow_up_small:](#) - -
- -## [obj_check_overlap_with_hitbox_params](#obj_check_overlap_with_hitbox_params) - -### Lua Example -`local booleanValue = obj_check_overlap_with_hitbox_params(o, x, y, z, h, r, d)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | -| x | `number` | -| y | `number` | -| z | `number` | -| h | `number` | -| r | `number` | -| d | `number` | - -### Returns -- `boolean` - -### C Prototype -`bool obj_check_overlap_with_hitbox_params(struct Object *o, f32 x, f32 y, f32 z, f32 h, f32 r, f32 d);` - -[:arrow_up_small:](#) - -
- -## [obj_count_objects_with_behavior_id](#obj_count_objects_with_behavior_id) - -### Lua Example -`local integerValue = obj_count_objects_with_behavior_id(behaviorId)` - -### Parameters -| Field | Type | -| ----- | ---- | -| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | - -### Returns -- `integer` - -### C Prototype -`s32 obj_count_objects_with_behavior_id(enum BehaviorId behaviorId);` - -[:arrow_up_small:](#) - -
- -## [obj_get_first](#obj_get_first) - -### Lua Example -`local ObjectValue = obj_get_first(objList)` - -### Parameters -| Field | Type | -| ----- | ---- | -| objList | [enum ObjectList](constants.md#enum-ObjectList) | - -### Returns -[Object](structs.md#Object) - -### C Prototype -`struct Object *obj_get_first(enum ObjectList objList);` - -[:arrow_up_small:](#) - -
- -## [obj_get_first_with_behavior_id](#obj_get_first_with_behavior_id) - -### Lua Example -`local ObjectValue = obj_get_first_with_behavior_id(behaviorId)` - -### Parameters -| Field | Type | -| ----- | ---- | -| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | - -### Returns -[Object](structs.md#Object) - -### C Prototype -`struct Object *obj_get_first_with_behavior_id(enum BehaviorId behaviorId);` - -[:arrow_up_small:](#) - -
- -## [obj_get_first_with_behavior_id_and_field_f32](#obj_get_first_with_behavior_id_and_field_f32) - -### Lua Example -`local ObjectValue = obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | -| fieldIndex | `integer` | -| value | `number` | - -### Returns -[Object](structs.md#Object) - -### C Prototype -`struct Object *obj_get_first_with_behavior_id_and_field_f32(enum BehaviorId behaviorId, s32 fieldIndex, f32 value);` - -[:arrow_up_small:](#) - -
- -## [obj_get_first_with_behavior_id_and_field_s32](#obj_get_first_with_behavior_id_and_field_s32) - -### Lua Example -`local ObjectValue = obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | -| fieldIndex | `integer` | -| value | `integer` | - -### Returns -[Object](structs.md#Object) - -### C Prototype -`struct Object *obj_get_first_with_behavior_id_and_field_s32(enum BehaviorId behaviorId, s32 fieldIndex, s32 value);` - -[:arrow_up_small:](#) - -
- -## [obj_get_nearest_object_with_behavior_id](#obj_get_nearest_object_with_behavior_id) - -### Lua Example -`local ObjectValue = obj_get_nearest_object_with_behavior_id(o, behaviorId)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | -| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | - -### Returns -[Object](structs.md#Object) - -### C Prototype -`struct Object *obj_get_nearest_object_with_behavior_id(struct Object *o, enum BehaviorId behaviorId);` - -[:arrow_up_small:](#) - -
- -## [obj_get_next](#obj_get_next) - -### Lua Example -`local ObjectValue = obj_get_next(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -[Object](structs.md#Object) - -### C Prototype -`struct Object *obj_get_next(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_get_next_with_same_behavior_id](#obj_get_next_with_same_behavior_id) - -### Lua Example -`local ObjectValue = obj_get_next_with_same_behavior_id(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -[Object](structs.md#Object) - -### C Prototype -`struct Object *obj_get_next_with_same_behavior_id(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_get_next_with_same_behavior_id_and_field_f32](#obj_get_next_with_same_behavior_id_and_field_f32) - -### Lua Example -`local ObjectValue = obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | -| fieldIndex | `integer` | -| value | `number` | - -### Returns -[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);` - -[:arrow_up_small:](#) - -
- -## [obj_get_next_with_same_behavior_id_and_field_s32](#obj_get_next_with_same_behavior_id_and_field_s32) - -### Lua Example -`local ObjectValue = obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | -| fieldIndex | `integer` | -| value | `integer` | - -### Returns -[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);` - -[:arrow_up_small:](#) - -
- -## [obj_get_temp_spawn_particles_info](#obj_get_temp_spawn_particles_info) - -### Lua Example -`local SpawnParticlesInfoValue = obj_get_temp_spawn_particles_info(modelId)` - -### Parameters -| Field | Type | -| ----- | ---- | -| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | - -### Returns -[SpawnParticlesInfo](structs.md#SpawnParticlesInfo) - -### C Prototype -`struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId);` - -[:arrow_up_small:](#) - -
- -## [obj_has_behavior_id](#obj_has_behavior_id) - -### Lua Example -`local integerValue = obj_has_behavior_id(o, behaviorId)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | -| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | - -### Returns -- `integer` - -### C Prototype -`s32 obj_has_behavior_id(struct Object *o, enum BehaviorId behaviorId);` - -[:arrow_up_small:](#) - -
- -## [obj_has_model_extended](#obj_has_model_extended) - -### Lua Example -`local integerValue = obj_has_model_extended(o, modelId)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | -| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | - -### Returns -- `integer` - -### C Prototype -`s32 obj_has_model_extended(struct Object *o, enum ModelExtendedId modelId);` - -[:arrow_up_small:](#) - -
- -## [obj_is_attackable](#obj_is_attackable) - -### Lua Example -`local booleanValue = obj_is_attackable(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_is_attackable(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_is_breakable_object](#obj_is_breakable_object) - -### Lua Example -`local booleanValue = obj_is_breakable_object(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_is_breakable_object(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_is_bully](#obj_is_bully) - -### Lua Example -`local booleanValue = obj_is_bully(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_is_bully(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_is_coin](#obj_is_coin) - -### Lua Example -`local booleanValue = obj_is_coin(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_is_coin(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_is_exclamation_box](#obj_is_exclamation_box) - -### Lua Example -`local booleanValue = obj_is_exclamation_box(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_is_exclamation_box(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_is_grabbable](#obj_is_grabbable) - -### Lua Example -`local booleanValue = obj_is_grabbable(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_is_grabbable(struct Object *o) ;` - -[:arrow_up_small:](#) - -
- -## [obj_is_mushroom_1up](#obj_is_mushroom_1up) - -### Lua Example -`local booleanValue = obj_is_mushroom_1up(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_is_mushroom_1up(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_is_secret](#obj_is_secret) - -### Lua Example -`local booleanValue = obj_is_secret(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_is_secret(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_is_valid_for_interaction](#obj_is_valid_for_interaction) - -### Lua Example -`local booleanValue = obj_is_valid_for_interaction(o)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | - -### Returns -- `boolean` - -### C Prototype -`bool obj_is_valid_for_interaction(struct Object *o);` - -[:arrow_up_small:](#) - -
- -## [obj_move_xyz](#obj_move_xyz) - -### Lua Example -`obj_move_xyz(o, dx, dy, dz)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | -| dx | `number` | -| dy | `number` | -| dz | `number` | - -### Returns -- None - -### C Prototype -`void obj_move_xyz(struct Object *o, f32 dx, f32 dy, f32 dz);` - -[:arrow_up_small:](#) - -
- -## [obj_set_model_extended](#obj_set_model_extended) - -### Lua Example -`obj_set_model_extended(o, modelId)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | -| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | - -### Returns -- None - -### C Prototype -`void obj_set_model_extended(struct Object *o, enum ModelExtendedId modelId);` - -[:arrow_up_small:](#) - -
- -## [obj_set_vel](#obj_set_vel) - -### Lua Example -`obj_set_vel(o, vx, vy, vz)` - -### Parameters -| Field | Type | -| ----- | ---- | -| o | [Object](structs.md#Object) | -| vx | `number` | -| vy | `number` | -| vz | `number` | - -### Returns -- None - -### C Prototype -`void obj_set_vel(struct Object *o, f32 vx, f32 vy, f32 vz);` - -[:arrow_up_small:](#) - -
- -## [spawn_non_sync_object](#spawn_non_sync_object) - -### Lua Example -`local ObjectValue = spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)` - -### Parameters -| Field | Type | -| ----- | ---- | -| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | -| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | -| x | `number` | -| y | `number` | -| z | `number` | -| objSetupFunction | `Lua Function` () | - -### Returns -[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);` - -[:arrow_up_small:](#) - -
- -## [spawn_sync_object](#spawn_sync_object) - -### Lua Example -`local ObjectValue = spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)` - -### Parameters -| Field | Type | -| ----- | ---- | -| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | -| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | -| x | `number` | -| y | `number` | -| z | `number` | -| objSetupFunction | `Lua Function` () | - -### Returns -[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);` - -[:arrow_up_small:](#) - -
- ---- -# functions from smlua_text_utils.h - -
- - -## [smlua_text_utils_castle_secret_stars_replace](#smlua_text_utils_castle_secret_stars_replace) - -### Lua Example -`smlua_text_utils_castle_secret_stars_replace(name)` - -### Parameters -| Field | Type | -| ----- | ---- | -| name | `string` | - -### Returns -- None - -### C Prototype -`void smlua_text_utils_castle_secret_stars_replace(const char* name);` - -[:arrow_up_small:](#) - -
- -## [smlua_text_utils_course_acts_replace](#smlua_text_utils_course_acts_replace) - -### Lua Example -`smlua_text_utils_course_acts_replace(courseNum, courseName, act1, act2, act3, act4, act5, act6)` - -### Parameters -| Field | Type | -| ----- | ---- | -| courseNum | `integer` | -| courseName | `string` | -| act1 | `string` | -| act2 | `string` | -| act3 | `string` | -| act4 | `string` | -| act5 | `string` | -| act6 | `string` | - -### Returns -- None - -### C Prototype -`void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName, const char* act1, const char* act2, const char* act3, const char* act4, const char* act5, const char* act6);` - -[:arrow_up_small:](#) - -
- -## [smlua_text_utils_dialog_replace](#smlua_text_utils_dialog_replace) - -### Lua Example -`smlua_text_utils_dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str)` - -### Parameters -| Field | Type | -| ----- | ---- | -| dialogId | [enum DialogId](constants.md#enum-DialogId) | -| unused | `integer` | -| linesPerBox | `integer` | -| leftOffset | `integer` | -| width | `integer` | -| str | `string` | - -### Returns -- None - -### C Prototype -`void smlua_text_utils_dialog_replace(enum DialogId dialogId, u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str);` - -[:arrow_up_small:](#) - -
- -## [smlua_text_utils_extra_text_replace](#smlua_text_utils_extra_text_replace) - -### Lua Example -`smlua_text_utils_extra_text_replace(index, text)` - -### Parameters -| Field | Type | -| ----- | ---- | -| index | `integer` | -| text | `string` | - -### Returns -- None - -### C Prototype -`void smlua_text_utils_extra_text_replace(s16 index, const char* text);` - -[:arrow_up_small:](#) - -
- -## [smlua_text_utils_reset_all](#smlua_text_utils_reset_all) - -### Lua Example -`smlua_text_utils_reset_all()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void smlua_text_utils_reset_all(void);` - -[:arrow_up_small:](#) - -
- -## [smlua_text_utils_secret_star_replace](#smlua_text_utils_secret_star_replace) - -### Lua Example -`smlua_text_utils_secret_star_replace(courseNum, courseName)` - -### Parameters -| Field | Type | -| ----- | ---- | -| courseNum | `integer` | -| courseName | `string` | - -### Returns -- None - -### C Prototype -`void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName);` - -[:arrow_up_small:](#) - -
- ---- -# functions from sound_init.h - -
- - -## [disable_background_sound](#disable_background_sound) - -### Lua Example -`disable_background_sound()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void disable_background_sound(void);` - -[:arrow_up_small:](#) - -
- -## [enable_background_sound](#enable_background_sound) - -### Lua Example -`enable_background_sound()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void enable_background_sound(void);` - -[:arrow_up_small:](#) - -
- -## [fadeout_cap_music](#fadeout_cap_music) - -### Lua Example -`fadeout_cap_music()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void fadeout_cap_music(void);` - -[:arrow_up_small:](#) - -
- -## [fadeout_level_music](#fadeout_level_music) - -### Lua Example -`fadeout_level_music(fadeTimer)` - -### Parameters -| Field | Type | -| ----- | ---- | -| fadeTimer | `integer` | - -### Returns -- None - -### C Prototype -`void fadeout_level_music(s16 fadeTimer);` - -[:arrow_up_small:](#) - -
- -## [fadeout_music](#fadeout_music) - -### Lua Example -`fadeout_music(fadeOutTime)` - -### Parameters -| Field | Type | -| ----- | ---- | -| fadeOutTime | `integer` | - -### Returns -- None - -### C Prototype -`void fadeout_music(s16 fadeOutTime);` - -[:arrow_up_small:](#) - -
- -## [lower_background_noise](#lower_background_noise) - -### Lua Example -`lower_background_noise(a)` - -### Parameters -| Field | Type | -| ----- | ---- | -| a | `integer` | - -### Returns -- None - -### C Prototype -`void lower_background_noise(s32 a);` - -[:arrow_up_small:](#) - -
- -## [play_cap_music](#play_cap_music) - -### Lua Example -`play_cap_music(seqArgs)` - -### Parameters -| Field | Type | -| ----- | ---- | -| seqArgs | `integer` | - -### Returns -- None - -### C Prototype -`void play_cap_music(u16 seqArgs);` - -[:arrow_up_small:](#) - -
- -## [play_cutscene_music](#play_cutscene_music) - -### Lua Example -`play_cutscene_music(seqArgs)` - -### Parameters -| Field | Type | -| ----- | ---- | -| seqArgs | `integer` | - -### Returns -- None - -### C Prototype -`void play_cutscene_music(u16 seqArgs);` - -[:arrow_up_small:](#) - -
- -## [play_infinite_stairs_music](#play_infinite_stairs_music) - -### Lua Example -`play_infinite_stairs_music()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void play_infinite_stairs_music(void);` - -[:arrow_up_small:](#) - -
- -## [play_menu_sounds](#play_menu_sounds) - -### Lua Example -`play_menu_sounds(soundMenuFlags)` - -### Parameters -| Field | Type | -| ----- | ---- | -| soundMenuFlags | `integer` | - -### Returns -- None - -### C Prototype -`void play_menu_sounds(s16 soundMenuFlags);` - -[:arrow_up_small:](#) - -
- -## [play_painting_eject_sound](#play_painting_eject_sound) - -### Lua Example -`play_painting_eject_sound()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void play_painting_eject_sound(void);` - -[:arrow_up_small:](#) - -
- -## [play_shell_music](#play_shell_music) - -### Lua Example -`play_shell_music()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void play_shell_music(void);` - -[:arrow_up_small:](#) - -
- -## [raise_background_noise](#raise_background_noise) - -### Lua Example -`raise_background_noise(a)` - -### Parameters -| Field | Type | -| ----- | ---- | -| a | `integer` | - -### Returns -- None - -### C Prototype -`void raise_background_noise(s32 a);` - -[:arrow_up_small:](#) - -
- -## [reset_volume](#reset_volume) - -### Lua Example -`reset_volume()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void reset_volume(void);` - -[:arrow_up_small:](#) - -
- -## [set_background_music](#set_background_music) - -### Lua Example -`set_background_music(a, seqArgs, fadeTimer)` - -### Parameters -| Field | Type | -| ----- | ---- | -| a | `integer` | -| seqArgs | `integer` | -| fadeTimer | `integer` | - -### Returns -- None - -### C Prototype -`void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer);` - -[:arrow_up_small:](#) - -
- -## [stop_cap_music](#stop_cap_music) - -### Lua Example -`stop_cap_music()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void stop_cap_music(void);` - -[:arrow_up_small:](#) - -
- -## [stop_shell_music](#stop_shell_music) - -### Lua Example -`stop_shell_music()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void stop_shell_music(void);` - -[:arrow_up_small:](#) - -
- ---- -# functions from spawn_sound.c - -
- - -## [calc_dist_to_volume_range_1](#calc_dist_to_volume_range_1) - -### Lua Example -`local integerValue = 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:](#) - -
- -## [calc_dist_to_volume_range_2](#calc_dist_to_volume_range_2) - -### Lua Example -`local integerValue = 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:](#) - -
- -## [cur_obj_play_sound_1](#cur_obj_play_sound_1) - -### Lua Example -`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:](#) - -
- -## [cur_obj_play_sound_2](#cur_obj_play_sound_2) - -### Lua Example -`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:](#) - -
- -## [exec_anim_sound_state](#exec_anim_sound_state) - -### Lua Example -`exec_anim_sound_state(soundStates)` - -### Parameters -| Field | Type | -| ----- | ---- | -| soundStates | [SoundState](structs.md#SoundState) | - -### Returns -- None - -### C Prototype -`void exec_anim_sound_state(struct SoundState *soundStates);` - -[:arrow_up_small:](#) -
--- diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index b6e2ec26..fee0a0e5 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -5,6 +5,1239 @@ [< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5] +--- +# functions from smlua_obj_utils.h + +
+ + +## [get_temp_object_hitbox](#get_temp_object_hitbox) + +### Lua Example +`local ObjectHitboxValue = get_temp_object_hitbox()` + +### Parameters +- None + +### Returns +[ObjectHitbox](structs.md#ObjectHitbox) + +### C Prototype +`struct ObjectHitbox* get_temp_object_hitbox(void);` + +[:arrow_up_small:](#) + +
+ +## [get_trajectory](#get_trajectory) + +### Lua Example +`local PointerValue = get_trajectory(name)` + +### Parameters +| Field | Type | +| ----- | ---- | +| name | `string` | + +### Returns +- `Pointer` <`Trajectory`> + +### C Prototype +`Trajectory* get_trajectory(const char* name);` + +[:arrow_up_small:](#) + +
+ +## [obj_check_hitbox_overlap](#obj_check_hitbox_overlap) + +### Lua Example +`local booleanValue = obj_check_hitbox_overlap(o1, o2)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o1 | [Object](structs.md#Object) | +| o2 | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_check_hitbox_overlap(struct Object *o1, struct Object *o2);` + +[:arrow_up_small:](#) + +
+ +## [obj_check_overlap_with_hitbox_params](#obj_check_overlap_with_hitbox_params) + +### Lua Example +`local booleanValue = obj_check_overlap_with_hitbox_params(o, x, y, z, h, r, d)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| x | `number` | +| y | `number` | +| z | `number` | +| h | `number` | +| r | `number` | +| d | `number` | + +### Returns +- `boolean` + +### C Prototype +`bool obj_check_overlap_with_hitbox_params(struct Object *o, f32 x, f32 y, f32 z, f32 h, f32 r, f32 d);` + +[:arrow_up_small:](#) + +
+ +## [obj_count_objects_with_behavior_id](#obj_count_objects_with_behavior_id) + +### Lua Example +`local integerValue = obj_count_objects_with_behavior_id(behaviorId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | + +### Returns +- `integer` + +### C Prototype +`s32 obj_count_objects_with_behavior_id(enum BehaviorId behaviorId);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_first](#obj_get_first) + +### Lua Example +`local ObjectValue = obj_get_first(objList)` + +### Parameters +| Field | Type | +| ----- | ---- | +| objList | [enum ObjectList](constants.md#enum-ObjectList) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_first(enum ObjectList objList);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_first_with_behavior_id](#obj_get_first_with_behavior_id) + +### Lua Example +`local ObjectValue = obj_get_first_with_behavior_id(behaviorId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_first_with_behavior_id(enum BehaviorId behaviorId);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_first_with_behavior_id_and_field_f32](#obj_get_first_with_behavior_id_and_field_f32) + +### Lua Example +`local ObjectValue = obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | +| fieldIndex | `integer` | +| value | `number` | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_first_with_behavior_id_and_field_f32(enum BehaviorId behaviorId, s32 fieldIndex, f32 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_first_with_behavior_id_and_field_s32](#obj_get_first_with_behavior_id_and_field_s32) + +### Lua Example +`local ObjectValue = obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | +| fieldIndex | `integer` | +| value | `integer` | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_first_with_behavior_id_and_field_s32(enum BehaviorId behaviorId, s32 fieldIndex, s32 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_nearest_object_with_behavior_id](#obj_get_nearest_object_with_behavior_id) + +### Lua Example +`local ObjectValue = obj_get_nearest_object_with_behavior_id(o, behaviorId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_nearest_object_with_behavior_id(struct Object *o, enum BehaviorId behaviorId);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_next](#obj_get_next) + +### Lua Example +`local ObjectValue = obj_get_next(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_next(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_next_with_same_behavior_id](#obj_get_next_with_same_behavior_id) + +### Lua Example +`local ObjectValue = obj_get_next_with_same_behavior_id(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_next_with_same_behavior_id(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_next_with_same_behavior_id_and_field_f32](#obj_get_next_with_same_behavior_id_and_field_f32) + +### Lua Example +`local ObjectValue = obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | +| value | `number` | + +### Returns +[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);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_next_with_same_behavior_id_and_field_s32](#obj_get_next_with_same_behavior_id_and_field_s32) + +### Lua Example +`local ObjectValue = obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | +| value | `integer` | + +### Returns +[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);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_temp_spawn_particles_info](#obj_get_temp_spawn_particles_info) + +### Lua Example +`local SpawnParticlesInfoValue = obj_get_temp_spawn_particles_info(modelId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | + +### Returns +[SpawnParticlesInfo](structs.md#SpawnParticlesInfo) + +### C Prototype +`struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId);` + +[:arrow_up_small:](#) + +
+ +## [obj_has_behavior_id](#obj_has_behavior_id) + +### Lua Example +`local integerValue = obj_has_behavior_id(o, behaviorId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | + +### Returns +- `integer` + +### C Prototype +`s32 obj_has_behavior_id(struct Object *o, enum BehaviorId behaviorId);` + +[:arrow_up_small:](#) + +
+ +## [obj_has_model_extended](#obj_has_model_extended) + +### Lua Example +`local integerValue = obj_has_model_extended(o, modelId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | + +### Returns +- `integer` + +### C Prototype +`s32 obj_has_model_extended(struct Object *o, enum ModelExtendedId modelId);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_attackable](#obj_is_attackable) + +### Lua Example +`local booleanValue = obj_is_attackable(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_attackable(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_breakable_object](#obj_is_breakable_object) + +### Lua Example +`local booleanValue = obj_is_breakable_object(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_breakable_object(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_bully](#obj_is_bully) + +### Lua Example +`local booleanValue = obj_is_bully(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_bully(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_coin](#obj_is_coin) + +### Lua Example +`local booleanValue = obj_is_coin(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_coin(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_exclamation_box](#obj_is_exclamation_box) + +### Lua Example +`local booleanValue = obj_is_exclamation_box(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_exclamation_box(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_grabbable](#obj_is_grabbable) + +### Lua Example +`local booleanValue = obj_is_grabbable(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_grabbable(struct Object *o) ;` + +[:arrow_up_small:](#) + +
+ +## [obj_is_mushroom_1up](#obj_is_mushroom_1up) + +### Lua Example +`local booleanValue = obj_is_mushroom_1up(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_mushroom_1up(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_secret](#obj_is_secret) + +### Lua Example +`local booleanValue = obj_is_secret(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_secret(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_valid_for_interaction](#obj_is_valid_for_interaction) + +### Lua Example +`local booleanValue = obj_is_valid_for_interaction(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_valid_for_interaction(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_move_xyz](#obj_move_xyz) + +### Lua Example +`obj_move_xyz(o, dx, dy, dz)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| dx | `number` | +| dy | `number` | +| dz | `number` | + +### Returns +- None + +### C Prototype +`void obj_move_xyz(struct Object *o, f32 dx, f32 dy, f32 dz);` + +[:arrow_up_small:](#) + +
+ +## [obj_set_model_extended](#obj_set_model_extended) + +### Lua Example +`obj_set_model_extended(o, modelId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | + +### Returns +- None + +### C Prototype +`void obj_set_model_extended(struct Object *o, enum ModelExtendedId modelId);` + +[:arrow_up_small:](#) + +
+ +## [obj_set_vel](#obj_set_vel) + +### Lua Example +`obj_set_vel(o, vx, vy, vz)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| vx | `number` | +| vy | `number` | +| vz | `number` | + +### Returns +- None + +### C Prototype +`void obj_set_vel(struct Object *o, f32 vx, f32 vy, f32 vz);` + +[:arrow_up_small:](#) + +
+ +## [spawn_non_sync_object](#spawn_non_sync_object) + +### Lua Example +`local ObjectValue = spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | +| x | `number` | +| y | `number` | +| z | `number` | +| objSetupFunction | `Lua Function` () | + +### Returns +[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);` + +[:arrow_up_small:](#) + +
+ +## [spawn_sync_object](#spawn_sync_object) + +### Lua Example +`local ObjectValue = spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | +| x | `number` | +| y | `number` | +| z | `number` | +| objSetupFunction | `Lua Function` () | + +### Returns +[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);` + +[:arrow_up_small:](#) + +
+ +--- +# functions from smlua_text_utils.h + +
+ + +## [smlua_text_utils_castle_secret_stars_replace](#smlua_text_utils_castle_secret_stars_replace) + +### Lua Example +`smlua_text_utils_castle_secret_stars_replace(name)` + +### Parameters +| Field | Type | +| ----- | ---- | +| name | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_castle_secret_stars_replace(const char* name);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_course_acts_replace](#smlua_text_utils_course_acts_replace) + +### Lua Example +`smlua_text_utils_course_acts_replace(courseNum, courseName, act1, act2, act3, act4, act5, act6)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | +| courseName | `string` | +| act1 | `string` | +| act2 | `string` | +| act3 | `string` | +| act4 | `string` | +| act5 | `string` | +| act6 | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName, const char* act1, const char* act2, const char* act3, const char* act4, const char* act5, const char* act6);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_dialog_replace](#smlua_text_utils_dialog_replace) + +### Lua Example +`smlua_text_utils_dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dialogId | [enum DialogId](constants.md#enum-DialogId) | +| unused | `integer` | +| linesPerBox | `integer` | +| leftOffset | `integer` | +| width | `integer` | +| str | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_dialog_replace(enum DialogId dialogId, u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_extra_text_replace](#smlua_text_utils_extra_text_replace) + +### Lua Example +`smlua_text_utils_extra_text_replace(index, text)` + +### Parameters +| Field | Type | +| ----- | ---- | +| index | `integer` | +| text | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_extra_text_replace(s16 index, const char* text);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_reset_all](#smlua_text_utils_reset_all) + +### Lua Example +`smlua_text_utils_reset_all()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void smlua_text_utils_reset_all(void);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_secret_star_replace](#smlua_text_utils_secret_star_replace) + +### Lua Example +`smlua_text_utils_secret_star_replace(courseNum, courseName)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | +| courseName | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName);` + +[:arrow_up_small:](#) + +
+ +--- +# functions from sound_init.h + +
+ + +## [disable_background_sound](#disable_background_sound) + +### Lua Example +`disable_background_sound()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void disable_background_sound(void);` + +[:arrow_up_small:](#) + +
+ +## [enable_background_sound](#enable_background_sound) + +### Lua Example +`enable_background_sound()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void enable_background_sound(void);` + +[:arrow_up_small:](#) + +
+ +## [fadeout_cap_music](#fadeout_cap_music) + +### Lua Example +`fadeout_cap_music()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void fadeout_cap_music(void);` + +[:arrow_up_small:](#) + +
+ +## [fadeout_level_music](#fadeout_level_music) + +### Lua Example +`fadeout_level_music(fadeTimer)` + +### Parameters +| Field | Type | +| ----- | ---- | +| fadeTimer | `integer` | + +### Returns +- None + +### C Prototype +`void fadeout_level_music(s16 fadeTimer);` + +[:arrow_up_small:](#) + +
+ +## [fadeout_music](#fadeout_music) + +### Lua Example +`fadeout_music(fadeOutTime)` + +### Parameters +| Field | Type | +| ----- | ---- | +| fadeOutTime | `integer` | + +### Returns +- None + +### C Prototype +`void fadeout_music(s16 fadeOutTime);` + +[:arrow_up_small:](#) + +
+ +## [lower_background_noise](#lower_background_noise) + +### Lua Example +`lower_background_noise(a)` + +### Parameters +| Field | Type | +| ----- | ---- | +| a | `integer` | + +### Returns +- None + +### C Prototype +`void lower_background_noise(s32 a);` + +[:arrow_up_small:](#) + +
+ +## [play_cap_music](#play_cap_music) + +### Lua Example +`play_cap_music(seqArgs)` + +### Parameters +| Field | Type | +| ----- | ---- | +| seqArgs | `integer` | + +### Returns +- None + +### C Prototype +`void play_cap_music(u16 seqArgs);` + +[:arrow_up_small:](#) + +
+ +## [play_cutscene_music](#play_cutscene_music) + +### Lua Example +`play_cutscene_music(seqArgs)` + +### Parameters +| Field | Type | +| ----- | ---- | +| seqArgs | `integer` | + +### Returns +- None + +### C Prototype +`void play_cutscene_music(u16 seqArgs);` + +[:arrow_up_small:](#) + +
+ +## [play_infinite_stairs_music](#play_infinite_stairs_music) + +### Lua Example +`play_infinite_stairs_music()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void play_infinite_stairs_music(void);` + +[:arrow_up_small:](#) + +
+ +## [play_menu_sounds](#play_menu_sounds) + +### Lua Example +`play_menu_sounds(soundMenuFlags)` + +### Parameters +| Field | Type | +| ----- | ---- | +| soundMenuFlags | `integer` | + +### Returns +- None + +### C Prototype +`void play_menu_sounds(s16 soundMenuFlags);` + +[:arrow_up_small:](#) + +
+ +## [play_painting_eject_sound](#play_painting_eject_sound) + +### Lua Example +`play_painting_eject_sound()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void play_painting_eject_sound(void);` + +[:arrow_up_small:](#) + +
+ +## [play_shell_music](#play_shell_music) + +### Lua Example +`play_shell_music()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void play_shell_music(void);` + +[:arrow_up_small:](#) + +
+ +## [raise_background_noise](#raise_background_noise) + +### Lua Example +`raise_background_noise(a)` + +### Parameters +| Field | Type | +| ----- | ---- | +| a | `integer` | + +### Returns +- None + +### C Prototype +`void raise_background_noise(s32 a);` + +[:arrow_up_small:](#) + +
+ +## [reset_volume](#reset_volume) + +### Lua Example +`reset_volume()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void reset_volume(void);` + +[:arrow_up_small:](#) + +
+ +## [set_background_music](#set_background_music) + +### Lua Example +`set_background_music(a, seqArgs, fadeTimer)` + +### Parameters +| Field | Type | +| ----- | ---- | +| a | `integer` | +| seqArgs | `integer` | +| fadeTimer | `integer` | + +### Returns +- None + +### C Prototype +`void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer);` + +[:arrow_up_small:](#) + +
+ +## [stop_cap_music](#stop_cap_music) + +### Lua Example +`stop_cap_music()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void stop_cap_music(void);` + +[:arrow_up_small:](#) + +
+ +## [stop_shell_music](#stop_shell_music) + +### Lua Example +`stop_shell_music()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void stop_shell_music(void);` + +[:arrow_up_small:](#) + +
+ +--- +# functions from spawn_sound.c + +
+ + +## [calc_dist_to_volume_range_1](#calc_dist_to_volume_range_1) + +### Lua Example +`local integerValue = 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:](#) + +
+ +## [calc_dist_to_volume_range_2](#calc_dist_to_volume_range_2) + +### Lua Example +`local integerValue = 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:](#) + +
+ +## [cur_obj_play_sound_1](#cur_obj_play_sound_1) + +### Lua Example +`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:](#) + +
+ +## [cur_obj_play_sound_2](#cur_obj_play_sound_2) + +### Lua Example +`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:](#) + +
+ +## [exec_anim_sound_state](#exec_anim_sound_state) + +### Lua Example +`exec_anim_sound_state(soundStates)` + +### Parameters +| Field | Type | +| ----- | ---- | +| soundStates | [SoundState](structs.md#SoundState) | + +### Returns +- None + +### C Prototype +`void exec_anim_sound_state(struct SoundState *soundStates);` + +[:arrow_up_small:](#) + +
+ --- # functions from surface_collision.h diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 80d89200..0f2f5458 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -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 @@
- 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)
@@ -1046,44 +1082,44 @@
- 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)
@@ -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 @@
- 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)
- 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)
- 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)
- 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)
diff --git a/docs/lua/structs.md b/docs/lua/structs.md index de2630f6..9df2d9ce 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -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) | | diff --git a/src/pc/lua/smlua_cobject.c b/src/pc/lua/smlua_cobject.c index 52db2345..6153f05a 100644 --- a/src/pc/lua/smlua_cobject.c +++ b/src/pc/lua/smlua_cobject.c @@ -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: diff --git a/src/pc/lua/smlua_cobject.h b/src/pc/lua/smlua_cobject.h index a1fa1028..865cf3fc 100644 --- a/src/pc/lua/smlua_cobject.h +++ b/src/pc/lua/smlua_cobject.h @@ -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, diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index ee99cb0d..2c799760 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -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 }, }; diff --git a/src/pc/lua/smlua_functions.c b/src/pc/lua/smlua_functions.c index 130899f8..23c60b37 100644 --- a/src/pc/lua/smlua_functions.c +++ b/src/pc/lua/smlua_functions.c @@ -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; diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 69f0439b..b1887887 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -42,24 +42,30 @@ //////////////////////// int smlua_func_arc_to_goal_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "arc_to_goal_pos", 4, top); + return 0; + } f32* a0 = smlua_get_vec3f_from_buffer(); a0[0] = smlua_get_number_field(1, "x"); a0[1] = smlua_get_number_field(1, "y"); a0[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'arc_to_goal_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "arc_to_goal_pos"); return 0; } f32* a1 = smlua_get_vec3f_from_buffer(); a1[0] = smlua_get_number_field(2, "x"); a1[1] = smlua_get_number_field(2, "y"); a1[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'arc_to_goal_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "arc_to_goal_pos"); return 0; } f32 yVel = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'arc_to_goal_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "arc_to_goal_pos"); return 0; } f32 gravity = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'arc_to_goal_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "arc_to_goal_pos"); return 0; } lua_pushinteger(L, arc_to_goal_pos(a0, a1, yVel, gravity)); @@ -75,7 +81,13 @@ int smlua_func_arc_to_goal_pos(lua_State* L) { } int smlua_func_bhv_1up_common_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_common_init", 0, top); + return 0; + } bhv_1up_common_init(); @@ -84,7 +96,13 @@ int smlua_func_bhv_1up_common_init(UNUSED lua_State* L) { } int smlua_func_bhv_1up_hidden_in_pole_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_hidden_in_pole_loop", 0, top); + return 0; + } bhv_1up_hidden_in_pole_loop(); @@ -93,7 +111,13 @@ int smlua_func_bhv_1up_hidden_in_pole_loop(UNUSED lua_State* L) { } int smlua_func_bhv_1up_hidden_in_pole_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_hidden_in_pole_spawner_loop", 0, top); + return 0; + } bhv_1up_hidden_in_pole_spawner_loop(); @@ -102,7 +126,13 @@ int smlua_func_bhv_1up_hidden_in_pole_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_1up_hidden_in_pole_trigger_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_hidden_in_pole_trigger_loop", 0, top); + return 0; + } bhv_1up_hidden_in_pole_trigger_loop(); @@ -111,7 +141,13 @@ int smlua_func_bhv_1up_hidden_in_pole_trigger_loop(UNUSED lua_State* L) { } int smlua_func_bhv_1up_hidden_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_hidden_loop", 0, top); + return 0; + } bhv_1up_hidden_loop(); @@ -120,7 +156,13 @@ int smlua_func_bhv_1up_hidden_loop(UNUSED lua_State* L) { } int smlua_func_bhv_1up_hidden_trigger_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_hidden_trigger_loop", 0, top); + return 0; + } bhv_1up_hidden_trigger_loop(); @@ -129,7 +171,13 @@ int smlua_func_bhv_1up_hidden_trigger_loop(UNUSED lua_State* L) { } int smlua_func_bhv_1up_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_init", 0, top); + return 0; + } bhv_1up_init(); @@ -138,7 +186,13 @@ int smlua_func_bhv_1up_init(UNUSED lua_State* L) { } int smlua_func_bhv_1up_jump_on_approach_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_jump_on_approach_loop", 0, top); + return 0; + } bhv_1up_jump_on_approach_loop(); @@ -147,7 +201,13 @@ int smlua_func_bhv_1up_jump_on_approach_loop(UNUSED lua_State* L) { } int smlua_func_bhv_1up_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_loop", 0, top); + return 0; + } bhv_1up_loop(); @@ -156,7 +216,13 @@ int smlua_func_bhv_1up_loop(UNUSED lua_State* L) { } int smlua_func_bhv_1up_running_away_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_running_away_loop", 0, top); + return 0; + } bhv_1up_running_away_loop(); @@ -165,7 +231,13 @@ int smlua_func_bhv_1up_running_away_loop(UNUSED lua_State* L) { } int smlua_func_bhv_1up_sliding_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_sliding_loop", 0, top); + return 0; + } bhv_1up_sliding_loop(); @@ -174,7 +246,13 @@ int smlua_func_bhv_1up_sliding_loop(UNUSED lua_State* L) { } int smlua_func_bhv_1up_walking_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_1up_walking_loop", 0, top); + return 0; + } bhv_1up_walking_loop(); @@ -183,7 +261,13 @@ int smlua_func_bhv_1up_walking_loop(UNUSED lua_State* L) { } int smlua_func_bhv_act_selector_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_act_selector_init", 0, top); + return 0; + } bhv_act_selector_init(); @@ -192,7 +276,13 @@ int smlua_func_bhv_act_selector_init(UNUSED lua_State* L) { } int smlua_func_bhv_act_selector_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_act_selector_loop", 0, top); + return 0; + } bhv_act_selector_loop(); @@ -201,7 +291,13 @@ int smlua_func_bhv_act_selector_loop(UNUSED lua_State* L) { } int smlua_func_bhv_act_selector_star_type_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_act_selector_star_type_loop", 0, top); + return 0; + } bhv_act_selector_star_type_loop(); @@ -210,7 +306,13 @@ int smlua_func_bhv_act_selector_star_type_loop(UNUSED lua_State* L) { } int smlua_func_bhv_activated_back_and_forth_platform_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_activated_back_and_forth_platform_init", 0, top); + return 0; + } bhv_activated_back_and_forth_platform_init(); @@ -219,7 +321,13 @@ int smlua_func_bhv_activated_back_and_forth_platform_init(UNUSED lua_State* L) { } int smlua_func_bhv_activated_back_and_forth_platform_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_activated_back_and_forth_platform_update", 0, top); + return 0; + } bhv_activated_back_and_forth_platform_update(); @@ -228,7 +336,13 @@ int smlua_func_bhv_activated_back_and_forth_platform_update(UNUSED lua_State* L) } int smlua_func_bhv_alpha_boo_key_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_alpha_boo_key_loop", 0, top); + return 0; + } bhv_alpha_boo_key_loop(); @@ -237,7 +351,13 @@ int smlua_func_bhv_alpha_boo_key_loop(UNUSED lua_State* L) { } int smlua_func_bhv_ambient_sounds_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ambient_sounds_init", 0, top); + return 0; + } bhv_ambient_sounds_init(); @@ -246,7 +366,13 @@ int smlua_func_bhv_ambient_sounds_init(UNUSED lua_State* L) { } int smlua_func_bhv_animated_texture_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_animated_texture_loop", 0, top); + return 0; + } bhv_animated_texture_loop(); @@ -255,7 +381,13 @@ int smlua_func_bhv_animated_texture_loop(UNUSED lua_State* L) { } int smlua_func_bhv_animates_on_floor_switch_press_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_animates_on_floor_switch_press_init", 0, top); + return 0; + } bhv_animates_on_floor_switch_press_init(); @@ -264,7 +396,13 @@ int smlua_func_bhv_animates_on_floor_switch_press_init(UNUSED lua_State* L) { } int smlua_func_bhv_animates_on_floor_switch_press_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_animates_on_floor_switch_press_loop", 0, top); + return 0; + } bhv_animates_on_floor_switch_press_loop(); @@ -273,7 +411,13 @@ int smlua_func_bhv_animates_on_floor_switch_press_loop(UNUSED lua_State* L) { } int smlua_func_bhv_arrow_lift_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_arrow_lift_loop", 0, top); + return 0; + } bhv_arrow_lift_loop(); @@ -282,7 +426,13 @@ int smlua_func_bhv_arrow_lift_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bbh_tilting_trap_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bbh_tilting_trap_platform_loop", 0, top); + return 0; + } bhv_bbh_tilting_trap_platform_loop(); @@ -291,7 +441,13 @@ int smlua_func_bhv_bbh_tilting_trap_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_boo_key_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_boo_key_loop", 0, top); + return 0; + } bhv_beta_boo_key_loop(); @@ -300,7 +456,13 @@ int smlua_func_bhv_beta_boo_key_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_bowser_anchor_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_bowser_anchor_loop", 0, top); + return 0; + } bhv_beta_bowser_anchor_loop(); @@ -309,7 +471,13 @@ int smlua_func_bhv_beta_bowser_anchor_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_chest_bottom_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_chest_bottom_init", 0, top); + return 0; + } bhv_beta_chest_bottom_init(); @@ -318,7 +486,13 @@ int smlua_func_bhv_beta_chest_bottom_init(UNUSED lua_State* L) { } int smlua_func_bhv_beta_chest_bottom_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_chest_bottom_loop", 0, top); + return 0; + } bhv_beta_chest_bottom_loop(); @@ -327,7 +501,13 @@ int smlua_func_bhv_beta_chest_bottom_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_chest_lid_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_chest_lid_loop", 0, top); + return 0; + } bhv_beta_chest_lid_loop(); @@ -336,7 +516,13 @@ int smlua_func_bhv_beta_chest_lid_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_fish_splash_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_fish_splash_spawner_loop", 0, top); + return 0; + } bhv_beta_fish_splash_spawner_loop(); @@ -345,7 +531,13 @@ int smlua_func_bhv_beta_fish_splash_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_holdable_object_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_holdable_object_init", 0, top); + return 0; + } bhv_beta_holdable_object_init(); @@ -354,7 +546,13 @@ int smlua_func_bhv_beta_holdable_object_init(UNUSED lua_State* L) { } int smlua_func_bhv_beta_holdable_object_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_holdable_object_loop", 0, top); + return 0; + } bhv_beta_holdable_object_loop(); @@ -363,7 +561,13 @@ int smlua_func_bhv_beta_holdable_object_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_moving_flames_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_moving_flames_loop", 0, top); + return 0; + } bhv_beta_moving_flames_loop(); @@ -372,7 +576,13 @@ int smlua_func_bhv_beta_moving_flames_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_moving_flames_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_moving_flames_spawn_loop", 0, top); + return 0; + } bhv_beta_moving_flames_spawn_loop(); @@ -381,7 +591,13 @@ int smlua_func_bhv_beta_moving_flames_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_trampoline_spring_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_trampoline_spring_loop", 0, top); + return 0; + } bhv_beta_trampoline_spring_loop(); @@ -390,7 +606,13 @@ int smlua_func_bhv_beta_trampoline_spring_loop(UNUSED lua_State* L) { } int smlua_func_bhv_beta_trampoline_top_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_beta_trampoline_top_loop", 0, top); + return 0; + } bhv_beta_trampoline_top_loop(); @@ -399,7 +621,13 @@ int smlua_func_bhv_beta_trampoline_top_loop(UNUSED lua_State* L) { } int smlua_func_bhv_big_boo_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_big_boo_loop", 0, top); + return 0; + } bhv_big_boo_loop(); @@ -408,7 +636,13 @@ int smlua_func_bhv_big_boo_loop(UNUSED lua_State* L) { } int smlua_func_bhv_big_boulder_generator_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_big_boulder_generator_loop", 0, top); + return 0; + } bhv_big_boulder_generator_loop(); @@ -417,7 +651,13 @@ int smlua_func_bhv_big_boulder_generator_loop(UNUSED lua_State* L) { } int smlua_func_bhv_big_boulder_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_big_boulder_init", 0, top); + return 0; + } bhv_big_boulder_init(); @@ -426,7 +666,13 @@ int smlua_func_bhv_big_boulder_init(UNUSED lua_State* L) { } int smlua_func_bhv_big_boulder_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_big_boulder_loop", 0, top); + return 0; + } bhv_big_boulder_loop(); @@ -435,7 +681,13 @@ int smlua_func_bhv_big_boulder_loop(UNUSED lua_State* L) { } int smlua_func_bhv_big_bully_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_big_bully_init", 0, top); + return 0; + } bhv_big_bully_init(); @@ -444,7 +696,13 @@ int smlua_func_bhv_big_bully_init(UNUSED lua_State* L) { } int smlua_func_bhv_big_bully_with_minions_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_big_bully_with_minions_init", 0, top); + return 0; + } bhv_big_bully_with_minions_init(); @@ -453,7 +711,13 @@ int smlua_func_bhv_big_bully_with_minions_init(UNUSED lua_State* L) { } int smlua_func_bhv_big_bully_with_minions_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_big_bully_with_minions_loop", 0, top); + return 0; + } bhv_big_bully_with_minions_loop(); @@ -462,7 +726,13 @@ int smlua_func_bhv_big_bully_with_minions_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bird_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bird_update", 0, top); + return 0; + } bhv_bird_update(); @@ -471,7 +741,13 @@ int smlua_func_bhv_bird_update(UNUSED lua_State* L) { } int smlua_func_bhv_birds_sound_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_birds_sound_loop", 0, top); + return 0; + } bhv_birds_sound_loop(); @@ -480,7 +756,13 @@ int smlua_func_bhv_birds_sound_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bitfs_sinking_cage_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bitfs_sinking_cage_platform_loop", 0, top); + return 0; + } bhv_bitfs_sinking_cage_platform_loop(); @@ -489,7 +771,13 @@ int smlua_func_bhv_bitfs_sinking_cage_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bitfs_sinking_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bitfs_sinking_platform_loop", 0, top); + return 0; + } bhv_bitfs_sinking_platform_loop(); @@ -498,7 +786,13 @@ int smlua_func_bhv_bitfs_sinking_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_black_smoke_bowser_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_black_smoke_bowser_loop", 0, top); + return 0; + } bhv_black_smoke_bowser_loop(); @@ -507,7 +801,13 @@ int smlua_func_bhv_black_smoke_bowser_loop(UNUSED lua_State* L) { } int smlua_func_bhv_black_smoke_mario_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_black_smoke_mario_loop", 0, top); + return 0; + } bhv_black_smoke_mario_loop(); @@ -516,7 +816,13 @@ int smlua_func_bhv_black_smoke_mario_loop(UNUSED lua_State* L) { } int smlua_func_bhv_black_smoke_upward_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_black_smoke_upward_loop", 0, top); + return 0; + } bhv_black_smoke_upward_loop(); @@ -525,7 +831,13 @@ int smlua_func_bhv_black_smoke_upward_loop(UNUSED lua_State* L) { } int smlua_func_bhv_blue_bowser_flame_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_blue_bowser_flame_init", 0, top); + return 0; + } bhv_blue_bowser_flame_init(); @@ -534,7 +846,13 @@ int smlua_func_bhv_blue_bowser_flame_init(UNUSED lua_State* L) { } int smlua_func_bhv_blue_bowser_flame_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_blue_bowser_flame_loop", 0, top); + return 0; + } bhv_blue_bowser_flame_loop(); @@ -543,7 +861,13 @@ int smlua_func_bhv_blue_bowser_flame_loop(UNUSED lua_State* L) { } int smlua_func_bhv_blue_coin_jumping_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_blue_coin_jumping_loop", 0, top); + return 0; + } bhv_blue_coin_jumping_loop(); @@ -552,7 +876,13 @@ int smlua_func_bhv_blue_coin_jumping_loop(UNUSED lua_State* L) { } int smlua_func_bhv_blue_coin_sliding_jumping_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_blue_coin_sliding_jumping_init", 0, top); + return 0; + } bhv_blue_coin_sliding_jumping_init(); @@ -561,7 +891,13 @@ int smlua_func_bhv_blue_coin_sliding_jumping_init(UNUSED lua_State* L) { } int smlua_func_bhv_blue_coin_sliding_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_blue_coin_sliding_loop", 0, top); + return 0; + } bhv_blue_coin_sliding_loop(); @@ -570,7 +906,13 @@ int smlua_func_bhv_blue_coin_sliding_loop(UNUSED lua_State* L) { } int smlua_func_bhv_blue_coin_switch_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_blue_coin_switch_loop", 0, top); + return 0; + } bhv_blue_coin_switch_loop(); @@ -579,7 +921,13 @@ int smlua_func_bhv_blue_coin_switch_loop(UNUSED lua_State* L) { } int smlua_func_bhv_blue_fish_movement_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_blue_fish_movement_loop", 0, top); + return 0; + } bhv_blue_fish_movement_loop(); @@ -588,7 +936,13 @@ int smlua_func_bhv_blue_fish_movement_loop(UNUSED lua_State* L) { } int smlua_func_bhv_blue_flames_group_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_blue_flames_group_loop", 0, top); + return 0; + } bhv_blue_flames_group_loop(); @@ -597,7 +951,13 @@ int smlua_func_bhv_blue_flames_group_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bob_pit_bowling_ball_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bob_pit_bowling_ball_init", 0, top); + return 0; + } bhv_bob_pit_bowling_ball_init(); @@ -606,7 +966,13 @@ int smlua_func_bhv_bob_pit_bowling_ball_init(UNUSED lua_State* L) { } int smlua_func_bhv_bob_pit_bowling_ball_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bob_pit_bowling_ball_loop", 0, top); + return 0; + } bhv_bob_pit_bowling_ball_loop(); @@ -615,7 +981,13 @@ int smlua_func_bhv_bob_pit_bowling_ball_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bobomb_anchor_mario_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bobomb_anchor_mario_loop", 0, top); + return 0; + } bhv_bobomb_anchor_mario_loop(); @@ -624,7 +996,13 @@ int smlua_func_bhv_bobomb_anchor_mario_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bobomb_buddy_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bobomb_buddy_init", 0, top); + return 0; + } bhv_bobomb_buddy_init(); @@ -633,7 +1011,13 @@ int smlua_func_bhv_bobomb_buddy_init(UNUSED lua_State* L) { } int smlua_func_bhv_bobomb_buddy_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bobomb_buddy_loop", 0, top); + return 0; + } bhv_bobomb_buddy_loop(); @@ -642,7 +1026,13 @@ int smlua_func_bhv_bobomb_buddy_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bobomb_bully_death_smoke_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bobomb_bully_death_smoke_init", 0, top); + return 0; + } bhv_bobomb_bully_death_smoke_init(); @@ -651,7 +1041,13 @@ int smlua_func_bhv_bobomb_bully_death_smoke_init(UNUSED lua_State* L) { } int smlua_func_bhv_bobomb_explosion_bubble_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bobomb_explosion_bubble_init", 0, top); + return 0; + } bhv_bobomb_explosion_bubble_init(); @@ -660,7 +1056,13 @@ int smlua_func_bhv_bobomb_explosion_bubble_init(UNUSED lua_State* L) { } int smlua_func_bhv_bobomb_explosion_bubble_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bobomb_explosion_bubble_loop", 0, top); + return 0; + } bhv_bobomb_explosion_bubble_loop(); @@ -669,7 +1071,13 @@ int smlua_func_bhv_bobomb_explosion_bubble_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bobomb_fuse_smoke_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bobomb_fuse_smoke_init", 0, top); + return 0; + } bhv_bobomb_fuse_smoke_init(); @@ -678,7 +1086,13 @@ int smlua_func_bhv_bobomb_fuse_smoke_init(UNUSED lua_State* L) { } int smlua_func_bhv_bobomb_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bobomb_init", 0, top); + return 0; + } bhv_bobomb_init(); @@ -687,7 +1101,13 @@ int smlua_func_bhv_bobomb_init(UNUSED lua_State* L) { } int smlua_func_bhv_bobomb_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bobomb_loop", 0, top); + return 0; + } bhv_bobomb_loop(); @@ -696,7 +1116,13 @@ int smlua_func_bhv_bobomb_loop(UNUSED lua_State* L) { } int smlua_func_bhv_boo_boss_spawned_bridge_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_boo_boss_spawned_bridge_loop", 0, top); + return 0; + } bhv_boo_boss_spawned_bridge_loop(); @@ -705,7 +1131,13 @@ int smlua_func_bhv_boo_boss_spawned_bridge_loop(UNUSED lua_State* L) { } int smlua_func_bhv_boo_cage_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_boo_cage_init", 0, top); + return 0; + } bhv_boo_cage_init(); @@ -714,7 +1146,13 @@ int smlua_func_bhv_boo_cage_init(UNUSED lua_State* L) { } int smlua_func_bhv_boo_cage_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_boo_cage_loop", 0, top); + return 0; + } bhv_boo_cage_loop(); @@ -723,7 +1161,13 @@ int smlua_func_bhv_boo_cage_loop(UNUSED lua_State* L) { } int smlua_func_bhv_boo_in_castle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_boo_in_castle_loop", 0, top); + return 0; + } bhv_boo_in_castle_loop(); @@ -732,7 +1176,13 @@ int smlua_func_bhv_boo_in_castle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_boo_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_boo_init", 0, top); + return 0; + } bhv_boo_init(); @@ -741,7 +1191,13 @@ int smlua_func_bhv_boo_init(UNUSED lua_State* L) { } int smlua_func_bhv_boo_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_boo_loop", 0, top); + return 0; + } bhv_boo_loop(); @@ -750,7 +1206,13 @@ int smlua_func_bhv_boo_loop(UNUSED lua_State* L) { } int smlua_func_bhv_boo_with_cage_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_boo_with_cage_init", 0, top); + return 0; + } bhv_boo_with_cage_init(); @@ -759,7 +1221,13 @@ int smlua_func_bhv_boo_with_cage_init(UNUSED lua_State* L) { } int smlua_func_bhv_boo_with_cage_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_boo_with_cage_loop", 0, top); + return 0; + } bhv_boo_with_cage_loop(); @@ -768,7 +1236,13 @@ int smlua_func_bhv_boo_with_cage_loop(UNUSED lua_State* L) { } int smlua_func_bhv_book_switch_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_book_switch_loop", 0, top); + return 0; + } bhv_book_switch_loop(); @@ -777,7 +1251,13 @@ int smlua_func_bhv_book_switch_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bookend_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bookend_spawn_loop", 0, top); + return 0; + } bhv_bookend_spawn_loop(); @@ -786,7 +1266,13 @@ int smlua_func_bhv_bookend_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bouncing_fireball_flame_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bouncing_fireball_flame_loop", 0, top); + return 0; + } bhv_bouncing_fireball_flame_loop(); @@ -795,7 +1281,13 @@ int smlua_func_bhv_bouncing_fireball_flame_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bouncing_fireball_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bouncing_fireball_loop", 0, top); + return 0; + } bhv_bouncing_fireball_loop(); @@ -804,7 +1296,13 @@ int smlua_func_bhv_bouncing_fireball_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowling_ball_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowling_ball_init", 0, top); + return 0; + } bhv_bowling_ball_init(); @@ -813,7 +1311,13 @@ int smlua_func_bhv_bowling_ball_init(UNUSED lua_State* L) { } int smlua_func_bhv_bowling_ball_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowling_ball_loop", 0, top); + return 0; + } bhv_bowling_ball_loop(); @@ -822,7 +1326,13 @@ int smlua_func_bhv_bowling_ball_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_body_anchor_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_body_anchor_init", 0, top); + return 0; + } bhv_bowser_body_anchor_init(); @@ -831,7 +1341,13 @@ int smlua_func_bhv_bowser_body_anchor_init(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_body_anchor_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_body_anchor_loop", 0, top); + return 0; + } bhv_bowser_body_anchor_loop(); @@ -840,7 +1356,13 @@ int smlua_func_bhv_bowser_body_anchor_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_bomb_explosion_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_bomb_explosion_loop", 0, top); + return 0; + } bhv_bowser_bomb_explosion_loop(); @@ -849,7 +1371,13 @@ int smlua_func_bhv_bowser_bomb_explosion_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_bomb_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_bomb_loop", 0, top); + return 0; + } bhv_bowser_bomb_loop(); @@ -858,7 +1386,13 @@ int smlua_func_bhv_bowser_bomb_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_bomb_smoke_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_bomb_smoke_loop", 0, top); + return 0; + } bhv_bowser_bomb_smoke_loop(); @@ -867,7 +1401,13 @@ int smlua_func_bhv_bowser_bomb_smoke_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_course_red_coin_star_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_course_red_coin_star_loop", 0, top); + return 0; + } bhv_bowser_course_red_coin_star_loop(); @@ -876,7 +1416,13 @@ int smlua_func_bhv_bowser_course_red_coin_star_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_flame_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_flame_spawn_loop", 0, top); + return 0; + } bhv_bowser_flame_spawn_loop(); @@ -885,7 +1431,13 @@ int smlua_func_bhv_bowser_flame_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_init", 0, top); + return 0; + } bhv_bowser_init(); @@ -894,7 +1446,13 @@ int smlua_func_bhv_bowser_init(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_key_course_exit_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_key_course_exit_loop", 0, top); + return 0; + } bhv_bowser_key_course_exit_loop(); @@ -903,7 +1461,13 @@ int smlua_func_bhv_bowser_key_course_exit_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_key_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_key_init", 0, top); + return 0; + } bhv_bowser_key_init(); @@ -912,7 +1476,13 @@ int smlua_func_bhv_bowser_key_init(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_key_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_key_loop", 0, top); + return 0; + } bhv_bowser_key_loop(); @@ -921,7 +1491,13 @@ int smlua_func_bhv_bowser_key_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_key_unlock_door_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_key_unlock_door_loop", 0, top); + return 0; + } bhv_bowser_key_unlock_door_loop(); @@ -930,7 +1506,13 @@ int smlua_func_bhv_bowser_key_unlock_door_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_loop", 0, top); + return 0; + } bhv_bowser_loop(); @@ -939,7 +1521,13 @@ int smlua_func_bhv_bowser_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_shock_wave_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_shock_wave_loop", 0, top); + return 0; + } bhv_bowser_shock_wave_loop(); @@ -948,7 +1536,13 @@ int smlua_func_bhv_bowser_shock_wave_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_tail_anchor_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_tail_anchor_init", 0, top); + return 0; + } bhv_bowser_tail_anchor_init(); @@ -957,7 +1551,13 @@ int smlua_func_bhv_bowser_tail_anchor_init(UNUSED lua_State* L) { } int smlua_func_bhv_bowser_tail_anchor_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowser_tail_anchor_loop", 0, top); + return 0; + } bhv_bowser_tail_anchor_loop(); @@ -966,7 +1566,13 @@ int smlua_func_bhv_bowser_tail_anchor_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bowsers_sub_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bowsers_sub_loop", 0, top); + return 0; + } bhv_bowsers_sub_loop(); @@ -975,7 +1581,13 @@ int smlua_func_bhv_bowsers_sub_loop(UNUSED lua_State* L) { } int smlua_func_bhv_breakable_box_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_breakable_box_loop", 0, top); + return 0; + } bhv_breakable_box_loop(); @@ -984,7 +1596,13 @@ int smlua_func_bhv_breakable_box_loop(UNUSED lua_State* L) { } int smlua_func_bhv_breakable_box_small_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_breakable_box_small_init", 0, top); + return 0; + } bhv_breakable_box_small_init(); @@ -993,7 +1611,13 @@ int smlua_func_bhv_breakable_box_small_init(UNUSED lua_State* L) { } int smlua_func_bhv_breakable_box_small_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_breakable_box_small_loop", 0, top); + return 0; + } bhv_breakable_box_small_loop(); @@ -1002,7 +1626,13 @@ int smlua_func_bhv_breakable_box_small_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bub_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bub_loop", 0, top); + return 0; + } bhv_bub_loop(); @@ -1011,7 +1641,13 @@ int smlua_func_bhv_bub_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bub_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bub_spawner_loop", 0, top); + return 0; + } bhv_bub_spawner_loop(); @@ -1020,7 +1656,13 @@ int smlua_func_bhv_bub_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bubba_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bubba_loop", 0, top); + return 0; + } bhv_bubba_loop(); @@ -1029,7 +1671,13 @@ int smlua_func_bhv_bubba_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bubble_cannon_barrel_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bubble_cannon_barrel_loop", 0, top); + return 0; + } bhv_bubble_cannon_barrel_loop(); @@ -1038,7 +1686,13 @@ int smlua_func_bhv_bubble_cannon_barrel_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bubble_maybe_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bubble_maybe_loop", 0, top); + return 0; + } bhv_bubble_maybe_loop(); @@ -1047,7 +1701,13 @@ int smlua_func_bhv_bubble_maybe_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bubble_player_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bubble_player_loop", 0, top); + return 0; + } bhv_bubble_player_loop(); @@ -1056,7 +1716,13 @@ int smlua_func_bhv_bubble_player_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bubble_splash_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bubble_splash_init", 0, top); + return 0; + } bhv_bubble_splash_init(); @@ -1065,7 +1731,13 @@ int smlua_func_bhv_bubble_splash_init(UNUSED lua_State* L) { } int smlua_func_bhv_bubble_wave_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bubble_wave_init", 0, top); + return 0; + } bhv_bubble_wave_init(); @@ -1074,7 +1746,13 @@ int smlua_func_bhv_bubble_wave_init(UNUSED lua_State* L) { } int smlua_func_bhv_bullet_bill_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bullet_bill_init", 0, top); + return 0; + } bhv_bullet_bill_init(); @@ -1083,7 +1761,13 @@ int smlua_func_bhv_bullet_bill_init(UNUSED lua_State* L) { } int smlua_func_bhv_bullet_bill_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bullet_bill_loop", 0, top); + return 0; + } bhv_bullet_bill_loop(); @@ -1092,7 +1776,13 @@ int smlua_func_bhv_bullet_bill_loop(UNUSED lua_State* L) { } int smlua_func_bhv_bully_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_bully_loop", 0, top); + return 0; + } bhv_bully_loop(); @@ -1101,7 +1791,13 @@ int smlua_func_bhv_bully_loop(UNUSED lua_State* L) { } int smlua_func_bhv_butterfly_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_butterfly_init", 0, top); + return 0; + } bhv_butterfly_init(); @@ -1110,7 +1806,13 @@ int smlua_func_bhv_butterfly_init(UNUSED lua_State* L) { } int smlua_func_bhv_butterfly_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_butterfly_loop", 0, top); + return 0; + } bhv_butterfly_loop(); @@ -1119,7 +1821,13 @@ int smlua_func_bhv_butterfly_loop(UNUSED lua_State* L) { } int smlua_func_bhv_camera_lakitu_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_camera_lakitu_init", 0, top); + return 0; + } bhv_camera_lakitu_init(); @@ -1128,7 +1836,13 @@ int smlua_func_bhv_camera_lakitu_init(UNUSED lua_State* L) { } int smlua_func_bhv_camera_lakitu_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_camera_lakitu_update", 0, top); + return 0; + } bhv_camera_lakitu_update(); @@ -1137,7 +1851,13 @@ int smlua_func_bhv_camera_lakitu_update(UNUSED lua_State* L) { } int smlua_func_bhv_cannon_barrel_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_cannon_barrel_loop", 0, top); + return 0; + } bhv_cannon_barrel_loop(); @@ -1146,7 +1866,13 @@ int smlua_func_bhv_cannon_barrel_loop(UNUSED lua_State* L) { } int smlua_func_bhv_cannon_base_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_cannon_base_loop", 0, top); + return 0; + } bhv_cannon_base_loop(); @@ -1155,7 +1881,13 @@ int smlua_func_bhv_cannon_base_loop(UNUSED lua_State* L) { } int smlua_func_bhv_cannon_base_unused_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_cannon_base_unused_loop", 0, top); + return 0; + } bhv_cannon_base_unused_loop(); @@ -1164,7 +1896,13 @@ int smlua_func_bhv_cannon_base_unused_loop(UNUSED lua_State* L) { } int smlua_func_bhv_cannon_closed_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_cannon_closed_init", 0, top); + return 0; + } bhv_cannon_closed_init(); @@ -1173,7 +1911,13 @@ int smlua_func_bhv_cannon_closed_init(UNUSED lua_State* L) { } int smlua_func_bhv_cannon_closed_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_cannon_closed_loop", 0, top); + return 0; + } bhv_cannon_closed_loop(); @@ -1182,7 +1926,13 @@ int smlua_func_bhv_cannon_closed_loop(UNUSED lua_State* L) { } int smlua_func_bhv_cap_switch_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_cap_switch_loop", 0, top); + return 0; + } bhv_cap_switch_loop(); @@ -1191,7 +1941,13 @@ int smlua_func_bhv_cap_switch_loop(UNUSED lua_State* L) { } int smlua_func_bhv_castle_cannon_grate_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_castle_cannon_grate_init", 0, top); + return 0; + } bhv_castle_cannon_grate_init(); @@ -1200,7 +1956,13 @@ int smlua_func_bhv_castle_cannon_grate_init(UNUSED lua_State* L) { } int smlua_func_bhv_castle_flag_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_castle_flag_init", 0, top); + return 0; + } bhv_castle_flag_init(); @@ -1209,7 +1971,13 @@ int smlua_func_bhv_castle_flag_init(UNUSED lua_State* L) { } int smlua_func_bhv_castle_floor_trap_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_castle_floor_trap_init", 0, top); + return 0; + } bhv_castle_floor_trap_init(); @@ -1218,7 +1986,13 @@ int smlua_func_bhv_castle_floor_trap_init(UNUSED lua_State* L) { } int smlua_func_bhv_castle_floor_trap_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_castle_floor_trap_loop", 0, top); + return 0; + } bhv_castle_floor_trap_loop(); @@ -1227,7 +2001,13 @@ int smlua_func_bhv_castle_floor_trap_loop(UNUSED lua_State* L) { } int smlua_func_bhv_ccm_touched_star_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ccm_touched_star_spawn_loop", 0, top); + return 0; + } bhv_ccm_touched_star_spawn_loop(); @@ -1236,7 +2016,13 @@ int smlua_func_bhv_ccm_touched_star_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_celebration_star_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_celebration_star_init", 0, top); + return 0; + } bhv_celebration_star_init(); @@ -1245,7 +2031,13 @@ int smlua_func_bhv_celebration_star_init(UNUSED lua_State* L) { } int smlua_func_bhv_celebration_star_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_celebration_star_loop", 0, top); + return 0; + } bhv_celebration_star_loop(); @@ -1254,7 +2046,13 @@ int smlua_func_bhv_celebration_star_loop(UNUSED lua_State* L) { } int smlua_func_bhv_celebration_star_sparkle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_celebration_star_sparkle_loop", 0, top); + return 0; + } bhv_celebration_star_sparkle_loop(); @@ -1263,7 +2061,13 @@ int smlua_func_bhv_celebration_star_sparkle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_chain_chomp_chain_part_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_chain_chomp_chain_part_update", 0, top); + return 0; + } bhv_chain_chomp_chain_part_update(); @@ -1272,7 +2076,13 @@ int smlua_func_bhv_chain_chomp_chain_part_update(UNUSED lua_State* L) { } int smlua_func_bhv_chain_chomp_gate_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_chain_chomp_gate_init", 0, top); + return 0; + } bhv_chain_chomp_gate_init(); @@ -1281,7 +2091,13 @@ int smlua_func_bhv_chain_chomp_gate_init(UNUSED lua_State* L) { } int smlua_func_bhv_chain_chomp_gate_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_chain_chomp_gate_update", 0, top); + return 0; + } bhv_chain_chomp_gate_update(); @@ -1290,7 +2106,13 @@ int smlua_func_bhv_chain_chomp_gate_update(UNUSED lua_State* L) { } int smlua_func_bhv_chain_chomp_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_chain_chomp_update", 0, top); + return 0; + } bhv_chain_chomp_update(); @@ -1299,7 +2121,13 @@ int smlua_func_bhv_chain_chomp_update(UNUSED lua_State* L) { } int smlua_func_bhv_checkerboard_elevator_group_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_checkerboard_elevator_group_init", 0, top); + return 0; + } bhv_checkerboard_elevator_group_init(); @@ -1308,7 +2136,13 @@ int smlua_func_bhv_checkerboard_elevator_group_init(UNUSED lua_State* L) { } int smlua_func_bhv_checkerboard_elevator_group_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_checkerboard_elevator_group_loop", 0, top); + return 0; + } bhv_checkerboard_elevator_group_loop(); @@ -1317,7 +2151,13 @@ int smlua_func_bhv_checkerboard_elevator_group_loop(UNUSED lua_State* L) { } int smlua_func_bhv_checkerboard_platform_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_checkerboard_platform_init", 0, top); + return 0; + } bhv_checkerboard_platform_init(); @@ -1326,7 +2166,13 @@ int smlua_func_bhv_checkerboard_platform_init(UNUSED lua_State* L) { } int smlua_func_bhv_checkerboard_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_checkerboard_platform_loop", 0, top); + return 0; + } bhv_checkerboard_platform_loop(); @@ -1335,7 +2181,13 @@ int smlua_func_bhv_checkerboard_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_chuckya_anchor_mario_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_chuckya_anchor_mario_loop", 0, top); + return 0; + } bhv_chuckya_anchor_mario_loop(); @@ -1344,7 +2196,13 @@ int smlua_func_bhv_chuckya_anchor_mario_loop(UNUSED lua_State* L) { } int smlua_func_bhv_chuckya_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_chuckya_loop", 0, top); + return 0; + } bhv_chuckya_loop(); @@ -1353,7 +2211,13 @@ int smlua_func_bhv_chuckya_loop(UNUSED lua_State* L) { } int smlua_func_bhv_circling_amp_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_circling_amp_init", 0, top); + return 0; + } bhv_circling_amp_init(); @@ -1362,7 +2226,13 @@ int smlua_func_bhv_circling_amp_init(UNUSED lua_State* L) { } int smlua_func_bhv_circling_amp_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_circling_amp_loop", 0, top); + return 0; + } bhv_circling_amp_loop(); @@ -1371,7 +2241,13 @@ int smlua_func_bhv_circling_amp_loop(UNUSED lua_State* L) { } int smlua_func_bhv_clam_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_clam_loop", 0, top); + return 0; + } bhv_clam_loop(); @@ -1380,7 +2256,13 @@ int smlua_func_bhv_clam_loop(UNUSED lua_State* L) { } int smlua_func_bhv_cloud_part_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_cloud_part_update", 0, top); + return 0; + } bhv_cloud_part_update(); @@ -1389,7 +2271,13 @@ int smlua_func_bhv_cloud_part_update(UNUSED lua_State* L) { } int smlua_func_bhv_cloud_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_cloud_update", 0, top); + return 0; + } bhv_cloud_update(); @@ -1398,7 +2286,13 @@ int smlua_func_bhv_cloud_update(UNUSED lua_State* L) { } int smlua_func_bhv_coffin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_coffin_loop", 0, top); + return 0; + } bhv_coffin_loop(); @@ -1407,7 +2301,13 @@ int smlua_func_bhv_coffin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_coffin_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_coffin_spawner_loop", 0, top); + return 0; + } bhv_coffin_spawner_loop(); @@ -1416,7 +2316,13 @@ int smlua_func_bhv_coffin_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_coin_formation_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_coin_formation_init", 0, top); + return 0; + } bhv_coin_formation_init(); @@ -1425,7 +2331,13 @@ int smlua_func_bhv_coin_formation_init(UNUSED lua_State* L) { } int smlua_func_bhv_coin_formation_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_coin_formation_loop", 0, top); + return 0; + } bhv_coin_formation_loop(); @@ -1434,7 +2346,13 @@ int smlua_func_bhv_coin_formation_loop(UNUSED lua_State* L) { } int smlua_func_bhv_coin_formation_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_coin_formation_spawn_loop", 0, top); + return 0; + } bhv_coin_formation_spawn_loop(); @@ -1443,7 +2361,13 @@ int smlua_func_bhv_coin_formation_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_coin_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_coin_init", 0, top); + return 0; + } bhv_coin_init(); @@ -1452,7 +2376,13 @@ int smlua_func_bhv_coin_init(UNUSED lua_State* L) { } int smlua_func_bhv_coin_inside_boo_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_coin_inside_boo_loop", 0, top); + return 0; + } bhv_coin_inside_boo_loop(); @@ -1461,7 +2391,13 @@ int smlua_func_bhv_coin_inside_boo_loop(UNUSED lua_State* L) { } int smlua_func_bhv_coin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_coin_loop", 0, top); + return 0; + } bhv_coin_loop(); @@ -1470,7 +2406,13 @@ int smlua_func_bhv_coin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_coin_sparkles_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_coin_sparkles_loop", 0, top); + return 0; + } bhv_coin_sparkles_loop(); @@ -1479,7 +2421,13 @@ int smlua_func_bhv_coin_sparkles_loop(UNUSED lua_State* L) { } int smlua_func_bhv_collect_star_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_collect_star_init", 0, top); + return 0; + } bhv_collect_star_init(); @@ -1488,7 +2436,13 @@ int smlua_func_bhv_collect_star_init(UNUSED lua_State* L) { } int smlua_func_bhv_collect_star_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_collect_star_loop", 0, top); + return 0; + } bhv_collect_star_loop(); @@ -1497,7 +2451,13 @@ int smlua_func_bhv_collect_star_loop(UNUSED lua_State* L) { } int smlua_func_bhv_controllable_platform_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_controllable_platform_init", 0, top); + return 0; + } bhv_controllable_platform_init(); @@ -1506,7 +2466,13 @@ int smlua_func_bhv_controllable_platform_init(UNUSED lua_State* L) { } int smlua_func_bhv_controllable_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_controllable_platform_loop", 0, top); + return 0; + } bhv_controllable_platform_loop(); @@ -1515,7 +2481,13 @@ int smlua_func_bhv_controllable_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_controllable_platform_sub_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_controllable_platform_sub_loop", 0, top); + return 0; + } bhv_controllable_platform_sub_loop(); @@ -1524,7 +2496,13 @@ int smlua_func_bhv_controllable_platform_sub_loop(UNUSED lua_State* L) { } int smlua_func_bhv_courtyard_boo_triplet_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_courtyard_boo_triplet_init", 0, top); + return 0; + } bhv_courtyard_boo_triplet_init(); @@ -1533,7 +2511,13 @@ int smlua_func_bhv_courtyard_boo_triplet_init(UNUSED lua_State* L) { } int smlua_func_bhv_ddd_moving_pole_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ddd_moving_pole_loop", 0, top); + return 0; + } bhv_ddd_moving_pole_loop(); @@ -1542,7 +2526,13 @@ int smlua_func_bhv_ddd_moving_pole_loop(UNUSED lua_State* L) { } int smlua_func_bhv_ddd_pole_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ddd_pole_init", 0, top); + return 0; + } bhv_ddd_pole_init(); @@ -1551,7 +2541,13 @@ int smlua_func_bhv_ddd_pole_init(UNUSED lua_State* L) { } int smlua_func_bhv_ddd_pole_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ddd_pole_update", 0, top); + return 0; + } bhv_ddd_pole_update(); @@ -1560,7 +2556,13 @@ int smlua_func_bhv_ddd_pole_update(UNUSED lua_State* L) { } int smlua_func_bhv_ddd_warp_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ddd_warp_loop", 0, top); + return 0; + } bhv_ddd_warp_loop(); @@ -1569,7 +2571,13 @@ int smlua_func_bhv_ddd_warp_loop(UNUSED lua_State* L) { } int smlua_func_bhv_decorative_pendulum_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_decorative_pendulum_init", 0, top); + return 0; + } bhv_decorative_pendulum_init(); @@ -1578,7 +2586,13 @@ int smlua_func_bhv_decorative_pendulum_init(UNUSED lua_State* L) { } int smlua_func_bhv_decorative_pendulum_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_decorative_pendulum_loop", 0, top); + return 0; + } bhv_decorative_pendulum_loop(); @@ -1587,7 +2601,13 @@ int smlua_func_bhv_decorative_pendulum_loop(UNUSED lua_State* L) { } int smlua_func_bhv_donut_platform_spawner_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_donut_platform_spawner_update", 0, top); + return 0; + } bhv_donut_platform_spawner_update(); @@ -1596,7 +2616,13 @@ int smlua_func_bhv_donut_platform_spawner_update(UNUSED lua_State* L) { } int smlua_func_bhv_donut_platform_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_donut_platform_update", 0, top); + return 0; + } bhv_donut_platform_update(); @@ -1605,7 +2631,13 @@ int smlua_func_bhv_donut_platform_update(UNUSED lua_State* L) { } int smlua_func_bhv_door_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_door_init", 0, top); + return 0; + } bhv_door_init(); @@ -1614,7 +2646,13 @@ int smlua_func_bhv_door_init(UNUSED lua_State* L) { } int smlua_func_bhv_door_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_door_loop", 0, top); + return 0; + } bhv_door_loop(); @@ -1623,7 +2661,13 @@ int smlua_func_bhv_door_loop(UNUSED lua_State* L) { } int smlua_func_bhv_dorrie_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_dorrie_update", 0, top); + return 0; + } bhv_dorrie_update(); @@ -1632,7 +2676,13 @@ int smlua_func_bhv_dorrie_update(UNUSED lua_State* L) { } int smlua_func_bhv_elevator_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_elevator_init", 0, top); + return 0; + } bhv_elevator_init(); @@ -1641,7 +2691,13 @@ int smlua_func_bhv_elevator_init(UNUSED lua_State* L) { } int smlua_func_bhv_elevator_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_elevator_loop", 0, top); + return 0; + } bhv_elevator_loop(); @@ -1650,7 +2706,13 @@ int smlua_func_bhv_elevator_loop(UNUSED lua_State* L) { } int smlua_func_bhv_end_birds_1_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_end_birds_1_loop", 0, top); + return 0; + } bhv_end_birds_1_loop(); @@ -1659,7 +2721,13 @@ int smlua_func_bhv_end_birds_1_loop(UNUSED lua_State* L) { } int smlua_func_bhv_end_birds_2_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_end_birds_2_loop", 0, top); + return 0; + } bhv_end_birds_2_loop(); @@ -1668,7 +2736,13 @@ int smlua_func_bhv_end_birds_2_loop(UNUSED lua_State* L) { } int smlua_func_bhv_enemy_lakitu_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_enemy_lakitu_update", 0, top); + return 0; + } bhv_enemy_lakitu_update(); @@ -1677,7 +2751,13 @@ int smlua_func_bhv_enemy_lakitu_update(UNUSED lua_State* L) { } int smlua_func_bhv_exclamation_box_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_exclamation_box_init", 0, top); + return 0; + } bhv_exclamation_box_init(); @@ -1686,7 +2766,13 @@ int smlua_func_bhv_exclamation_box_init(UNUSED lua_State* L) { } int smlua_func_bhv_exclamation_box_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_exclamation_box_loop", 0, top); + return 0; + } bhv_exclamation_box_loop(); @@ -1695,7 +2781,13 @@ int smlua_func_bhv_exclamation_box_loop(UNUSED lua_State* L) { } int smlua_func_bhv_explosion_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_explosion_init", 0, top); + return 0; + } bhv_explosion_init(); @@ -1704,7 +2796,13 @@ int smlua_func_bhv_explosion_init(UNUSED lua_State* L) { } int smlua_func_bhv_explosion_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_explosion_loop", 0, top); + return 0; + } bhv_explosion_loop(); @@ -1713,7 +2811,13 @@ int smlua_func_bhv_explosion_loop(UNUSED lua_State* L) { } int smlua_func_bhv_eyerok_boss_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_eyerok_boss_init", 0, top); + return 0; + } bhv_eyerok_boss_init(); @@ -1722,7 +2826,13 @@ int smlua_func_bhv_eyerok_boss_init(UNUSED lua_State* L) { } int smlua_func_bhv_eyerok_boss_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_eyerok_boss_loop", 0, top); + return 0; + } bhv_eyerok_boss_loop(); @@ -1731,7 +2841,13 @@ int smlua_func_bhv_eyerok_boss_loop(UNUSED lua_State* L) { } int smlua_func_bhv_eyerok_hand_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_eyerok_hand_loop", 0, top); + return 0; + } bhv_eyerok_hand_loop(); @@ -1740,7 +2856,13 @@ int smlua_func_bhv_eyerok_hand_loop(UNUSED lua_State* L) { } int smlua_func_bhv_fading_warp_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_fading_warp_loop", 0, top); + return 0; + } bhv_fading_warp_loop(); @@ -1749,7 +2871,13 @@ int smlua_func_bhv_fading_warp_loop(UNUSED lua_State* L) { } int smlua_func_bhv_falling_bowser_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_falling_bowser_platform_loop", 0, top); + return 0; + } bhv_falling_bowser_platform_loop(); @@ -1758,7 +2886,13 @@ int smlua_func_bhv_falling_bowser_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_falling_pillar_hitbox_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_falling_pillar_hitbox_loop", 0, top); + return 0; + } bhv_falling_pillar_hitbox_loop(); @@ -1767,7 +2901,13 @@ int smlua_func_bhv_falling_pillar_hitbox_loop(UNUSED lua_State* L) { } int smlua_func_bhv_falling_pillar_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_falling_pillar_init", 0, top); + return 0; + } bhv_falling_pillar_init(); @@ -1776,7 +2916,13 @@ int smlua_func_bhv_falling_pillar_init(UNUSED lua_State* L) { } int smlua_func_bhv_falling_pillar_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_falling_pillar_loop", 0, top); + return 0; + } bhv_falling_pillar_loop(); @@ -1785,7 +2931,13 @@ int smlua_func_bhv_falling_pillar_loop(UNUSED lua_State* L) { } int smlua_func_bhv_ferris_wheel_axle_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ferris_wheel_axle_init", 0, top); + return 0; + } bhv_ferris_wheel_axle_init(); @@ -1794,7 +2946,13 @@ int smlua_func_bhv_ferris_wheel_axle_init(UNUSED lua_State* L) { } int smlua_func_bhv_ferris_wheel_platform_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ferris_wheel_platform_update", 0, top); + return 0; + } bhv_ferris_wheel_platform_update(); @@ -1803,7 +2961,13 @@ int smlua_func_bhv_ferris_wheel_platform_update(UNUSED lua_State* L) { } int smlua_func_bhv_fire_piranha_plant_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_fire_piranha_plant_init", 0, top); + return 0; + } bhv_fire_piranha_plant_init(); @@ -1812,7 +2976,13 @@ int smlua_func_bhv_fire_piranha_plant_init(UNUSED lua_State* L) { } int smlua_func_bhv_fire_piranha_plant_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_fire_piranha_plant_update", 0, top); + return 0; + } bhv_fire_piranha_plant_update(); @@ -1821,7 +2991,13 @@ int smlua_func_bhv_fire_piranha_plant_update(UNUSED lua_State* L) { } int smlua_func_bhv_fire_spitter_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_fire_spitter_update", 0, top); + return 0; + } bhv_fire_spitter_update(); @@ -1830,7 +3006,13 @@ int smlua_func_bhv_fire_spitter_update(UNUSED lua_State* L) { } int smlua_func_bhv_fish_group_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_fish_group_loop", 0, top); + return 0; + } bhv_fish_group_loop(); @@ -1839,7 +3021,13 @@ int smlua_func_bhv_fish_group_loop(UNUSED lua_State* L) { } int smlua_func_bhv_fish_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_fish_loop", 0, top); + return 0; + } bhv_fish_loop(); @@ -1848,7 +3036,13 @@ int smlua_func_bhv_fish_loop(UNUSED lua_State* L) { } int smlua_func_bhv_fish_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_fish_spawner_loop", 0, top); + return 0; + } bhv_fish_spawner_loop(); @@ -1857,7 +3051,13 @@ int smlua_func_bhv_fish_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_flame_bouncing_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_bouncing_init", 0, top); + return 0; + } bhv_flame_bouncing_init(); @@ -1866,7 +3066,13 @@ int smlua_func_bhv_flame_bouncing_init(UNUSED lua_State* L) { } int smlua_func_bhv_flame_bouncing_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_bouncing_loop", 0, top); + return 0; + } bhv_flame_bouncing_loop(); @@ -1875,7 +3081,13 @@ int smlua_func_bhv_flame_bouncing_loop(UNUSED lua_State* L) { } int smlua_func_bhv_flame_bowser_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_bowser_init", 0, top); + return 0; + } bhv_flame_bowser_init(); @@ -1884,7 +3096,13 @@ int smlua_func_bhv_flame_bowser_init(UNUSED lua_State* L) { } int smlua_func_bhv_flame_bowser_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_bowser_loop", 0, top); + return 0; + } bhv_flame_bowser_loop(); @@ -1893,7 +3111,13 @@ int smlua_func_bhv_flame_bowser_loop(UNUSED lua_State* L) { } int smlua_func_bhv_flame_floating_landing_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_floating_landing_init", 0, top); + return 0; + } bhv_flame_floating_landing_init(); @@ -1902,7 +3126,13 @@ int smlua_func_bhv_flame_floating_landing_init(UNUSED lua_State* L) { } int smlua_func_bhv_flame_floating_landing_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_floating_landing_loop", 0, top); + return 0; + } bhv_flame_floating_landing_loop(); @@ -1911,7 +3141,13 @@ int smlua_func_bhv_flame_floating_landing_loop(UNUSED lua_State* L) { } int smlua_func_bhv_flame_large_burning_out_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_large_burning_out_init", 0, top); + return 0; + } bhv_flame_large_burning_out_init(); @@ -1920,7 +3156,13 @@ int smlua_func_bhv_flame_large_burning_out_init(UNUSED lua_State* L) { } int smlua_func_bhv_flame_mario_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_mario_loop", 0, top); + return 0; + } bhv_flame_mario_loop(); @@ -1929,7 +3171,13 @@ int smlua_func_bhv_flame_mario_loop(UNUSED lua_State* L) { } int smlua_func_bhv_flame_moving_forward_growing_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_moving_forward_growing_init", 0, top); + return 0; + } bhv_flame_moving_forward_growing_init(); @@ -1938,7 +3186,13 @@ int smlua_func_bhv_flame_moving_forward_growing_init(UNUSED lua_State* L) { } int smlua_func_bhv_flame_moving_forward_growing_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flame_moving_forward_growing_loop", 0, top); + return 0; + } bhv_flame_moving_forward_growing_loop(); @@ -1947,7 +3201,13 @@ int smlua_func_bhv_flame_moving_forward_growing_loop(UNUSED lua_State* L) { } int smlua_func_bhv_flamethrower_flame_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flamethrower_flame_loop", 0, top); + return 0; + } bhv_flamethrower_flame_loop(); @@ -1956,7 +3216,13 @@ int smlua_func_bhv_flamethrower_flame_loop(UNUSED lua_State* L) { } int smlua_func_bhv_flamethrower_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flamethrower_loop", 0, top); + return 0; + } bhv_flamethrower_loop(); @@ -1965,7 +3231,13 @@ int smlua_func_bhv_flamethrower_loop(UNUSED lua_State* L) { } int smlua_func_bhv_floating_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_floating_platform_loop", 0, top); + return 0; + } bhv_floating_platform_loop(); @@ -1974,7 +3246,13 @@ int smlua_func_bhv_floating_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_floor_trap_in_castle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_floor_trap_in_castle_loop", 0, top); + return 0; + } bhv_floor_trap_in_castle_loop(); @@ -1983,7 +3261,13 @@ int smlua_func_bhv_floor_trap_in_castle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_fly_guy_flame_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_fly_guy_flame_loop", 0, top); + return 0; + } bhv_fly_guy_flame_loop(); @@ -1992,7 +3276,13 @@ int smlua_func_bhv_fly_guy_flame_loop(UNUSED lua_State* L) { } int smlua_func_bhv_fly_guy_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_fly_guy_update", 0, top); + return 0; + } bhv_fly_guy_update(); @@ -2001,7 +3291,13 @@ int smlua_func_bhv_fly_guy_update(UNUSED lua_State* L) { } int smlua_func_bhv_flying_bookend_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_flying_bookend_loop", 0, top); + return 0; + } bhv_flying_bookend_loop(); @@ -2010,7 +3306,13 @@ int smlua_func_bhv_flying_bookend_loop(UNUSED lua_State* L) { } int smlua_func_bhv_free_bowling_ball_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_free_bowling_ball_init", 0, top); + return 0; + } bhv_free_bowling_ball_init(); @@ -2019,7 +3321,13 @@ int smlua_func_bhv_free_bowling_ball_init(UNUSED lua_State* L) { } int smlua_func_bhv_free_bowling_ball_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_free_bowling_ball_loop", 0, top); + return 0; + } bhv_free_bowling_ball_loop(); @@ -2028,7 +3336,13 @@ int smlua_func_bhv_free_bowling_ball_loop(UNUSED lua_State* L) { } int smlua_func_bhv_generic_bowling_ball_spawner_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_generic_bowling_ball_spawner_init", 0, top); + return 0; + } bhv_generic_bowling_ball_spawner_init(); @@ -2037,7 +3351,13 @@ int smlua_func_bhv_generic_bowling_ball_spawner_init(UNUSED lua_State* L) { } int smlua_func_bhv_generic_bowling_ball_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_generic_bowling_ball_spawner_loop", 0, top); + return 0; + } bhv_generic_bowling_ball_spawner_loop(); @@ -2046,7 +3366,13 @@ int smlua_func_bhv_generic_bowling_ball_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_giant_pole_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_giant_pole_loop", 0, top); + return 0; + } bhv_giant_pole_loop(); @@ -2055,7 +3381,13 @@ int smlua_func_bhv_giant_pole_loop(UNUSED lua_State* L) { } int smlua_func_bhv_golden_coin_sparkles_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_golden_coin_sparkles_loop", 0, top); + return 0; + } bhv_golden_coin_sparkles_loop(); @@ -2064,7 +3396,13 @@ int smlua_func_bhv_golden_coin_sparkles_loop(UNUSED lua_State* L) { } int smlua_func_bhv_goomba_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_goomba_init", 0, top); + return 0; + } bhv_goomba_init(); @@ -2073,7 +3411,13 @@ int smlua_func_bhv_goomba_init(UNUSED lua_State* L) { } int smlua_func_bhv_goomba_triplet_spawner_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_goomba_triplet_spawner_update", 0, top); + return 0; + } bhv_goomba_triplet_spawner_update(); @@ -2082,7 +3426,13 @@ int smlua_func_bhv_goomba_triplet_spawner_update(UNUSED lua_State* L) { } int smlua_func_bhv_goomba_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_goomba_update", 0, top); + return 0; + } bhv_goomba_update(); @@ -2091,7 +3441,13 @@ int smlua_func_bhv_goomba_update(UNUSED lua_State* L) { } int smlua_func_bhv_grand_star_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_grand_star_init", 0, top); + return 0; + } bhv_grand_star_init(); @@ -2100,7 +3456,13 @@ int smlua_func_bhv_grand_star_init(UNUSED lua_State* L) { } int smlua_func_bhv_grand_star_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_grand_star_loop", 0, top); + return 0; + } bhv_grand_star_loop(); @@ -2109,7 +3471,13 @@ int smlua_func_bhv_grand_star_loop(UNUSED lua_State* L) { } int smlua_func_bhv_grindel_thwomp_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_grindel_thwomp_loop", 0, top); + return 0; + } bhv_grindel_thwomp_loop(); @@ -2118,7 +3486,13 @@ int smlua_func_bhv_grindel_thwomp_loop(UNUSED lua_State* L) { } int smlua_func_bhv_ground_sand_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ground_sand_init", 0, top); + return 0; + } bhv_ground_sand_init(); @@ -2127,7 +3501,13 @@ int smlua_func_bhv_ground_sand_init(UNUSED lua_State* L) { } int smlua_func_bhv_ground_snow_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ground_snow_init", 0, top); + return 0; + } bhv_ground_snow_init(); @@ -2136,7 +3516,13 @@ int smlua_func_bhv_ground_snow_init(UNUSED lua_State* L) { } int smlua_func_bhv_haunted_bookshelf_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_haunted_bookshelf_loop", 0, top); + return 0; + } bhv_haunted_bookshelf_loop(); @@ -2145,7 +3531,13 @@ int smlua_func_bhv_haunted_bookshelf_loop(UNUSED lua_State* L) { } int smlua_func_bhv_haunted_bookshelf_manager_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_haunted_bookshelf_manager_loop", 0, top); + return 0; + } bhv_haunted_bookshelf_manager_loop(); @@ -2154,7 +3546,13 @@ int smlua_func_bhv_haunted_bookshelf_manager_loop(UNUSED lua_State* L) { } int smlua_func_bhv_haunted_chair_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_haunted_chair_init", 0, top); + return 0; + } bhv_haunted_chair_init(); @@ -2163,7 +3561,13 @@ int smlua_func_bhv_haunted_chair_init(UNUSED lua_State* L) { } int smlua_func_bhv_haunted_chair_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_haunted_chair_loop", 0, top); + return 0; + } bhv_haunted_chair_loop(); @@ -2172,7 +3576,13 @@ int smlua_func_bhv_haunted_chair_loop(UNUSED lua_State* L) { } int smlua_func_bhv_heave_ho_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_heave_ho_loop", 0, top); + return 0; + } bhv_heave_ho_loop(); @@ -2181,7 +3591,13 @@ int smlua_func_bhv_heave_ho_loop(UNUSED lua_State* L) { } int smlua_func_bhv_heave_ho_throw_mario_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_heave_ho_throw_mario_loop", 0, top); + return 0; + } bhv_heave_ho_throw_mario_loop(); @@ -2190,7 +3606,13 @@ int smlua_func_bhv_heave_ho_throw_mario_loop(UNUSED lua_State* L) { } int smlua_func_bhv_hidden_blue_coin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_hidden_blue_coin_loop", 0, top); + return 0; + } bhv_hidden_blue_coin_loop(); @@ -2199,7 +3621,13 @@ int smlua_func_bhv_hidden_blue_coin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_hidden_object_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_hidden_object_loop", 0, top); + return 0; + } bhv_hidden_object_loop(); @@ -2208,7 +3636,13 @@ int smlua_func_bhv_hidden_object_loop(UNUSED lua_State* L) { } int smlua_func_bhv_hidden_red_coin_star_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_hidden_red_coin_star_init", 0, top); + return 0; + } bhv_hidden_red_coin_star_init(); @@ -2217,7 +3651,13 @@ int smlua_func_bhv_hidden_red_coin_star_init(UNUSED lua_State* L) { } int smlua_func_bhv_hidden_red_coin_star_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_hidden_red_coin_star_loop", 0, top); + return 0; + } bhv_hidden_red_coin_star_loop(); @@ -2226,7 +3666,13 @@ int smlua_func_bhv_hidden_red_coin_star_loop(UNUSED lua_State* L) { } int smlua_func_bhv_hidden_star_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_hidden_star_init", 0, top); + return 0; + } bhv_hidden_star_init(); @@ -2235,7 +3681,13 @@ int smlua_func_bhv_hidden_star_init(UNUSED lua_State* L) { } int smlua_func_bhv_hidden_star_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_hidden_star_loop", 0, top); + return 0; + } bhv_hidden_star_loop(); @@ -2244,7 +3696,13 @@ int smlua_func_bhv_hidden_star_loop(UNUSED lua_State* L) { } int smlua_func_bhv_hidden_star_trigger_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_hidden_star_trigger_loop", 0, top); + return 0; + } bhv_hidden_star_trigger_loop(); @@ -2253,7 +3711,13 @@ int smlua_func_bhv_hidden_star_trigger_loop(UNUSED lua_State* L) { } int smlua_func_bhv_homing_amp_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_homing_amp_init", 0, top); + return 0; + } bhv_homing_amp_init(); @@ -2262,7 +3726,13 @@ int smlua_func_bhv_homing_amp_init(UNUSED lua_State* L) { } int smlua_func_bhv_homing_amp_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_homing_amp_loop", 0, top); + return 0; + } bhv_homing_amp_loop(); @@ -2271,7 +3741,13 @@ int smlua_func_bhv_homing_amp_loop(UNUSED lua_State* L) { } int smlua_func_bhv_hoot_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_hoot_init", 0, top); + return 0; + } bhv_hoot_init(); @@ -2280,7 +3756,13 @@ int smlua_func_bhv_hoot_init(UNUSED lua_State* L) { } int smlua_func_bhv_hoot_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_hoot_loop", 0, top); + return 0; + } bhv_hoot_loop(); @@ -2289,7 +3771,13 @@ int smlua_func_bhv_hoot_loop(UNUSED lua_State* L) { } int smlua_func_bhv_horizontal_grindel_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_horizontal_grindel_init", 0, top); + return 0; + } bhv_horizontal_grindel_init(); @@ -2298,7 +3786,13 @@ int smlua_func_bhv_horizontal_grindel_init(UNUSED lua_State* L) { } int smlua_func_bhv_horizontal_grindel_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_horizontal_grindel_update", 0, top); + return 0; + } bhv_horizontal_grindel_update(); @@ -2307,7 +3801,13 @@ int smlua_func_bhv_horizontal_grindel_update(UNUSED lua_State* L) { } int smlua_func_bhv_idle_water_wave_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_idle_water_wave_loop", 0, top); + return 0; + } bhv_idle_water_wave_loop(); @@ -2316,7 +3816,13 @@ int smlua_func_bhv_idle_water_wave_loop(UNUSED lua_State* L) { } int smlua_func_bhv_init_changing_water_level_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_init_changing_water_level_loop", 0, top); + return 0; + } bhv_init_changing_water_level_loop(); @@ -2325,7 +3831,13 @@ int smlua_func_bhv_init_changing_water_level_loop(UNUSED lua_State* L) { } int smlua_func_bhv_intro_lakitu_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_intro_lakitu_loop", 0, top); + return 0; + } bhv_intro_lakitu_loop(); @@ -2334,7 +3846,13 @@ int smlua_func_bhv_intro_lakitu_loop(UNUSED lua_State* L) { } int smlua_func_bhv_intro_peach_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_intro_peach_loop", 0, top); + return 0; + } bhv_intro_peach_loop(); @@ -2343,7 +3861,13 @@ int smlua_func_bhv_intro_peach_loop(UNUSED lua_State* L) { } int smlua_func_bhv_intro_scene_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_intro_scene_loop", 0, top); + return 0; + } bhv_intro_scene_loop(); @@ -2352,7 +3876,13 @@ int smlua_func_bhv_intro_scene_loop(UNUSED lua_State* L) { } int smlua_func_bhv_invisible_objects_under_bridge_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_invisible_objects_under_bridge_init", 0, top); + return 0; + } bhv_invisible_objects_under_bridge_init(); @@ -2361,7 +3891,13 @@ int smlua_func_bhv_invisible_objects_under_bridge_init(UNUSED lua_State* L) { } int smlua_func_bhv_invisible_objects_under_bridge_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_invisible_objects_under_bridge_loop", 0, top); + return 0; + } bhv_invisible_objects_under_bridge_loop(); @@ -2370,7 +3906,13 @@ int smlua_func_bhv_invisible_objects_under_bridge_loop(UNUSED lua_State* L) { } int smlua_func_bhv_jet_stream_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_jet_stream_loop", 0, top); + return 0; + } bhv_jet_stream_loop(); @@ -2379,7 +3921,13 @@ int smlua_func_bhv_jet_stream_loop(UNUSED lua_State* L) { } int smlua_func_bhv_jet_stream_ring_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_jet_stream_ring_spawner_loop", 0, top); + return 0; + } bhv_jet_stream_ring_spawner_loop(); @@ -2388,7 +3936,13 @@ int smlua_func_bhv_jet_stream_ring_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_jet_stream_water_ring_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_jet_stream_water_ring_init", 0, top); + return 0; + } bhv_jet_stream_water_ring_init(); @@ -2397,7 +3951,13 @@ int smlua_func_bhv_jet_stream_water_ring_init(UNUSED lua_State* L) { } int smlua_func_bhv_jet_stream_water_ring_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_jet_stream_water_ring_loop", 0, top); + return 0; + } bhv_jet_stream_water_ring_loop(); @@ -2406,7 +3966,13 @@ int smlua_func_bhv_jet_stream_water_ring_loop(UNUSED lua_State* L) { } int smlua_func_bhv_jrb_floating_box_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_jrb_floating_box_loop", 0, top); + return 0; + } bhv_jrb_floating_box_loop(); @@ -2415,7 +3981,13 @@ int smlua_func_bhv_jrb_floating_box_loop(UNUSED lua_State* L) { } int smlua_func_bhv_jrb_sliding_box_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_jrb_sliding_box_loop", 0, top); + return 0; + } bhv_jrb_sliding_box_loop(); @@ -2424,7 +3996,13 @@ int smlua_func_bhv_jrb_sliding_box_loop(UNUSED lua_State* L) { } int smlua_func_bhv_jumping_box_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_jumping_box_loop", 0, top); + return 0; + } bhv_jumping_box_loop(); @@ -2433,7 +4011,13 @@ int smlua_func_bhv_jumping_box_loop(UNUSED lua_State* L) { } int smlua_func_bhv_kickable_board_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_kickable_board_loop", 0, top); + return 0; + } bhv_kickable_board_loop(); @@ -2442,7 +4026,13 @@ int smlua_func_bhv_kickable_board_loop(UNUSED lua_State* L) { } int smlua_func_bhv_king_bobomb_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_king_bobomb_loop", 0, top); + return 0; + } bhv_king_bobomb_loop(); @@ -2451,7 +4041,13 @@ int smlua_func_bhv_king_bobomb_loop(UNUSED lua_State* L) { } int smlua_func_bhv_klepto_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_klepto_init", 0, top); + return 0; + } bhv_klepto_init(); @@ -2460,7 +4056,13 @@ int smlua_func_bhv_klepto_init(UNUSED lua_State* L) { } int smlua_func_bhv_klepto_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_klepto_update", 0, top); + return 0; + } bhv_klepto_update(); @@ -2469,7 +4071,13 @@ int smlua_func_bhv_klepto_update(UNUSED lua_State* L) { } int smlua_func_bhv_koopa_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_koopa_init", 0, top); + return 0; + } bhv_koopa_init(); @@ -2478,7 +4086,13 @@ int smlua_func_bhv_koopa_init(UNUSED lua_State* L) { } int smlua_func_bhv_koopa_race_endpoint_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_koopa_race_endpoint_update", 0, top); + return 0; + } bhv_koopa_race_endpoint_update(); @@ -2487,7 +4101,13 @@ int smlua_func_bhv_koopa_race_endpoint_update(UNUSED lua_State* L) { } int smlua_func_bhv_koopa_shell_flame_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_koopa_shell_flame_loop", 0, top); + return 0; + } bhv_koopa_shell_flame_loop(); @@ -2496,7 +4116,13 @@ int smlua_func_bhv_koopa_shell_flame_loop(UNUSED lua_State* L) { } int smlua_func_bhv_koopa_shell_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_koopa_shell_loop", 0, top); + return 0; + } bhv_koopa_shell_loop(); @@ -2505,7 +4131,13 @@ int smlua_func_bhv_koopa_shell_loop(UNUSED lua_State* L) { } int smlua_func_bhv_koopa_shell_underwater_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_koopa_shell_underwater_loop", 0, top); + return 0; + } bhv_koopa_shell_underwater_loop(); @@ -2514,7 +4146,13 @@ int smlua_func_bhv_koopa_shell_underwater_loop(UNUSED lua_State* L) { } int smlua_func_bhv_koopa_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_koopa_update", 0, top); + return 0; + } bhv_koopa_update(); @@ -2523,7 +4161,13 @@ int smlua_func_bhv_koopa_update(UNUSED lua_State* L) { } int smlua_func_bhv_large_bomp_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_large_bomp_init", 0, top); + return 0; + } bhv_large_bomp_init(); @@ -2532,7 +4176,13 @@ int smlua_func_bhv_large_bomp_init(UNUSED lua_State* L) { } int smlua_func_bhv_large_bomp_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_large_bomp_loop", 0, top); + return 0; + } bhv_large_bomp_loop(); @@ -2541,7 +4191,13 @@ int smlua_func_bhv_large_bomp_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_bowser_puzzle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_bowser_puzzle_loop", 0, top); + return 0; + } bhv_lll_bowser_puzzle_loop(); @@ -2550,7 +4206,13 @@ int smlua_func_bhv_lll_bowser_puzzle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_bowser_puzzle_piece_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_bowser_puzzle_piece_loop", 0, top); + return 0; + } bhv_lll_bowser_puzzle_piece_loop(); @@ -2559,7 +4221,13 @@ int smlua_func_bhv_lll_bowser_puzzle_piece_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_drawbridge_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_drawbridge_loop", 0, top); + return 0; + } bhv_lll_drawbridge_loop(); @@ -2568,7 +4236,13 @@ int smlua_func_bhv_lll_drawbridge_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_drawbridge_spawner_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_drawbridge_spawner_init", 0, top); + return 0; + } bhv_lll_drawbridge_spawner_init(); @@ -2577,7 +4251,13 @@ int smlua_func_bhv_lll_drawbridge_spawner_init(UNUSED lua_State* L) { } int smlua_func_bhv_lll_drawbridge_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_drawbridge_spawner_loop", 0, top); + return 0; + } bhv_lll_drawbridge_spawner_loop(); @@ -2586,7 +4266,13 @@ int smlua_func_bhv_lll_drawbridge_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_floating_wood_bridge_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_floating_wood_bridge_loop", 0, top); + return 0; + } bhv_lll_floating_wood_bridge_loop(); @@ -2595,7 +4281,13 @@ int smlua_func_bhv_lll_floating_wood_bridge_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_moving_octagonal_mesh_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_moving_octagonal_mesh_platform_loop", 0, top); + return 0; + } bhv_lll_moving_octagonal_mesh_platform_loop(); @@ -2604,7 +4296,13 @@ int smlua_func_bhv_lll_moving_octagonal_mesh_platform_loop(UNUSED lua_State* L) } int smlua_func_bhv_lll_rolling_log_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_rolling_log_init", 0, top); + return 0; + } bhv_lll_rolling_log_init(); @@ -2613,7 +4311,13 @@ int smlua_func_bhv_lll_rolling_log_init(UNUSED lua_State* L) { } int smlua_func_bhv_lll_rotating_block_fire_bars_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_rotating_block_fire_bars_loop", 0, top); + return 0; + } bhv_lll_rotating_block_fire_bars_loop(); @@ -2622,7 +4326,13 @@ int smlua_func_bhv_lll_rotating_block_fire_bars_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_rotating_hex_flame_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_rotating_hex_flame_loop", 0, top); + return 0; + } bhv_lll_rotating_hex_flame_loop(); @@ -2631,7 +4341,13 @@ int smlua_func_bhv_lll_rotating_hex_flame_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_rotating_hexagonal_ring_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_rotating_hexagonal_ring_loop", 0, top); + return 0; + } bhv_lll_rotating_hexagonal_ring_loop(); @@ -2640,7 +4356,13 @@ int smlua_func_bhv_lll_rotating_hexagonal_ring_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_sinking_rectangular_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_sinking_rectangular_platform_loop", 0, top); + return 0; + } bhv_lll_sinking_rectangular_platform_loop(); @@ -2649,7 +4371,13 @@ int smlua_func_bhv_lll_sinking_rectangular_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_sinking_rock_block_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_sinking_rock_block_loop", 0, top); + return 0; + } bhv_lll_sinking_rock_block_loop(); @@ -2658,7 +4386,13 @@ int smlua_func_bhv_lll_sinking_rock_block_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_sinking_square_platforms_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_sinking_square_platforms_loop", 0, top); + return 0; + } bhv_lll_sinking_square_platforms_loop(); @@ -2667,7 +4401,13 @@ int smlua_func_bhv_lll_sinking_square_platforms_loop(UNUSED lua_State* L) { } int smlua_func_bhv_lll_wood_piece_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_lll_wood_piece_loop", 0, top); + return 0; + } bhv_lll_wood_piece_loop(); @@ -2676,7 +4416,13 @@ int smlua_func_bhv_lll_wood_piece_loop(UNUSED lua_State* L) { } int smlua_func_bhv_mad_piano_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_mad_piano_update", 0, top); + return 0; + } bhv_mad_piano_update(); @@ -2685,7 +4431,13 @@ int smlua_func_bhv_mad_piano_update(UNUSED lua_State* L) { } int smlua_func_bhv_manta_ray_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_manta_ray_init", 0, top); + return 0; + } bhv_manta_ray_init(); @@ -2694,7 +4446,13 @@ int smlua_func_bhv_manta_ray_init(UNUSED lua_State* L) { } int smlua_func_bhv_manta_ray_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_manta_ray_loop", 0, top); + return 0; + } bhv_manta_ray_loop(); @@ -2703,7 +4461,13 @@ int smlua_func_bhv_manta_ray_loop(UNUSED lua_State* L) { } int smlua_func_bhv_manta_ray_water_ring_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_manta_ray_water_ring_init", 0, top); + return 0; + } bhv_manta_ray_water_ring_init(); @@ -2712,7 +4476,13 @@ int smlua_func_bhv_manta_ray_water_ring_init(UNUSED lua_State* L) { } int smlua_func_bhv_manta_ray_water_ring_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_manta_ray_water_ring_loop", 0, top); + return 0; + } bhv_manta_ray_water_ring_loop(); @@ -2721,7 +4491,13 @@ int smlua_func_bhv_manta_ray_water_ring_loop(UNUSED lua_State* L) { } int smlua_func_bhv_menu_button_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_menu_button_init", 0, top); + return 0; + } bhv_menu_button_init(); @@ -2730,7 +4506,13 @@ int smlua_func_bhv_menu_button_init(UNUSED lua_State* L) { } int smlua_func_bhv_menu_button_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_menu_button_loop", 0, top); + return 0; + } bhv_menu_button_loop(); @@ -2739,7 +4521,13 @@ int smlua_func_bhv_menu_button_loop(UNUSED lua_State* L) { } int smlua_func_bhv_menu_button_manager_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_menu_button_manager_init", 0, top); + return 0; + } bhv_menu_button_manager_init(); @@ -2748,7 +4536,13 @@ int smlua_func_bhv_menu_button_manager_init(UNUSED lua_State* L) { } int smlua_func_bhv_menu_button_manager_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_menu_button_manager_loop", 0, top); + return 0; + } bhv_menu_button_manager_loop(); @@ -2757,7 +4551,13 @@ int smlua_func_bhv_menu_button_manager_loop(UNUSED lua_State* L) { } int smlua_func_bhv_merry_go_round_boo_manager_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_merry_go_round_boo_manager_loop", 0, top); + return 0; + } bhv_merry_go_round_boo_manager_loop(); @@ -2766,7 +4566,13 @@ int smlua_func_bhv_merry_go_round_boo_manager_loop(UNUSED lua_State* L) { } int smlua_func_bhv_merry_go_round_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_merry_go_round_loop", 0, top); + return 0; + } bhv_merry_go_round_loop(); @@ -2775,7 +4581,13 @@ int smlua_func_bhv_merry_go_round_loop(UNUSED lua_State* L) { } int smlua_func_bhv_metal_cap_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_metal_cap_init", 0, top); + return 0; + } bhv_metal_cap_init(); @@ -2784,7 +4596,13 @@ int smlua_func_bhv_metal_cap_init(UNUSED lua_State* L) { } int smlua_func_bhv_metal_cap_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_metal_cap_loop", 0, top); + return 0; + } bhv_metal_cap_loop(); @@ -2793,7 +4611,13 @@ int smlua_func_bhv_metal_cap_loop(UNUSED lua_State* L) { } int smlua_func_bhv_mips_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_mips_init", 0, top); + return 0; + } bhv_mips_init(); @@ -2802,7 +4626,13 @@ int smlua_func_bhv_mips_init(UNUSED lua_State* L) { } int smlua_func_bhv_mips_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_mips_loop", 0, top); + return 0; + } bhv_mips_loop(); @@ -2811,7 +4641,13 @@ int smlua_func_bhv_mips_loop(UNUSED lua_State* L) { } int smlua_func_bhv_moat_grills_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_moat_grills_loop", 0, top); + return 0; + } bhv_moat_grills_loop(); @@ -2820,7 +4656,13 @@ int smlua_func_bhv_moat_grills_loop(UNUSED lua_State* L) { } int smlua_func_bhv_moneybag_hidden_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_moneybag_hidden_loop", 0, top); + return 0; + } bhv_moneybag_hidden_loop(); @@ -2829,7 +4671,13 @@ int smlua_func_bhv_moneybag_hidden_loop(UNUSED lua_State* L) { } int smlua_func_bhv_moneybag_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_moneybag_init", 0, top); + return 0; + } bhv_moneybag_init(); @@ -2838,7 +4686,13 @@ int smlua_func_bhv_moneybag_init(UNUSED lua_State* L) { } int smlua_func_bhv_moneybag_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_moneybag_loop", 0, top); + return 0; + } bhv_moneybag_loop(); @@ -2847,7 +4701,13 @@ int smlua_func_bhv_moneybag_loop(UNUSED lua_State* L) { } int smlua_func_bhv_monty_mole_hole_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_monty_mole_hole_update", 0, top); + return 0; + } bhv_monty_mole_hole_update(); @@ -2856,7 +4716,13 @@ int smlua_func_bhv_monty_mole_hole_update(UNUSED lua_State* L) { } int smlua_func_bhv_monty_mole_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_monty_mole_init", 0, top); + return 0; + } bhv_monty_mole_init(); @@ -2865,7 +4731,13 @@ int smlua_func_bhv_monty_mole_init(UNUSED lua_State* L) { } int smlua_func_bhv_monty_mole_rock_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_monty_mole_rock_update", 0, top); + return 0; + } bhv_monty_mole_rock_update(); @@ -2874,7 +4746,13 @@ int smlua_func_bhv_monty_mole_rock_update(UNUSED lua_State* L) { } int smlua_func_bhv_monty_mole_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_monty_mole_update", 0, top); + return 0; + } bhv_monty_mole_update(); @@ -2883,7 +4761,13 @@ int smlua_func_bhv_monty_mole_update(UNUSED lua_State* L) { } int smlua_func_bhv_moving_blue_coin_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_moving_blue_coin_init", 0, top); + return 0; + } bhv_moving_blue_coin_init(); @@ -2892,7 +4776,13 @@ int smlua_func_bhv_moving_blue_coin_init(UNUSED lua_State* L) { } int smlua_func_bhv_moving_blue_coin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_moving_blue_coin_loop", 0, top); + return 0; + } bhv_moving_blue_coin_loop(); @@ -2901,7 +4791,13 @@ int smlua_func_bhv_moving_blue_coin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_moving_yellow_coin_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_moving_yellow_coin_init", 0, top); + return 0; + } bhv_moving_yellow_coin_init(); @@ -2910,7 +4806,13 @@ int smlua_func_bhv_moving_yellow_coin_init(UNUSED lua_State* L) { } int smlua_func_bhv_moving_yellow_coin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_moving_yellow_coin_loop", 0, top); + return 0; + } bhv_moving_yellow_coin_loop(); @@ -2919,7 +4821,13 @@ int smlua_func_bhv_moving_yellow_coin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_mr_blizzard_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_mr_blizzard_init", 0, top); + return 0; + } bhv_mr_blizzard_init(); @@ -2928,7 +4836,13 @@ int smlua_func_bhv_mr_blizzard_init(UNUSED lua_State* L) { } int smlua_func_bhv_mr_blizzard_snowball(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_mr_blizzard_snowball", 0, top); + return 0; + } bhv_mr_blizzard_snowball(); @@ -2937,7 +4851,13 @@ int smlua_func_bhv_mr_blizzard_snowball(UNUSED lua_State* L) { } int smlua_func_bhv_mr_blizzard_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_mr_blizzard_update", 0, top); + return 0; + } bhv_mr_blizzard_update(); @@ -2946,7 +4866,13 @@ int smlua_func_bhv_mr_blizzard_update(UNUSED lua_State* L) { } int smlua_func_bhv_mr_i_body_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_mr_i_body_loop", 0, top); + return 0; + } bhv_mr_i_body_loop(); @@ -2955,7 +4881,13 @@ int smlua_func_bhv_mr_i_body_loop(UNUSED lua_State* L) { } int smlua_func_bhv_mr_i_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_mr_i_loop", 0, top); + return 0; + } bhv_mr_i_loop(); @@ -2964,7 +4896,13 @@ int smlua_func_bhv_mr_i_loop(UNUSED lua_State* L) { } int smlua_func_bhv_mr_i_particle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_mr_i_particle_loop", 0, top); + return 0; + } bhv_mr_i_particle_loop(); @@ -2973,7 +4911,13 @@ int smlua_func_bhv_mr_i_particle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_normal_cap_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_normal_cap_init", 0, top); + return 0; + } bhv_normal_cap_init(); @@ -2982,7 +4926,13 @@ int smlua_func_bhv_normal_cap_init(UNUSED lua_State* L) { } int smlua_func_bhv_normal_cap_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_normal_cap_loop", 0, top); + return 0; + } bhv_normal_cap_loop(); @@ -2991,7 +4941,13 @@ int smlua_func_bhv_normal_cap_loop(UNUSED lua_State* L) { } int smlua_func_bhv_object_bubble_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_object_bubble_init", 0, top); + return 0; + } bhv_object_bubble_init(); @@ -3000,7 +4956,13 @@ int smlua_func_bhv_object_bubble_init(UNUSED lua_State* L) { } int smlua_func_bhv_object_bubble_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_object_bubble_loop", 0, top); + return 0; + } bhv_object_bubble_loop(); @@ -3009,7 +4971,13 @@ int smlua_func_bhv_object_bubble_loop(UNUSED lua_State* L) { } int smlua_func_bhv_object_water_wave_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_object_water_wave_init", 0, top); + return 0; + } bhv_object_water_wave_init(); @@ -3018,7 +4986,13 @@ int smlua_func_bhv_object_water_wave_init(UNUSED lua_State* L) { } int smlua_func_bhv_object_water_wave_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_object_water_wave_loop", 0, top); + return 0; + } bhv_object_water_wave_loop(); @@ -3027,7 +5001,13 @@ int smlua_func_bhv_object_water_wave_loop(UNUSED lua_State* L) { } int smlua_func_bhv_openable_cage_door_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_openable_cage_door_loop", 0, top); + return 0; + } bhv_openable_cage_door_loop(); @@ -3036,7 +5016,13 @@ int smlua_func_bhv_openable_cage_door_loop(UNUSED lua_State* L) { } int smlua_func_bhv_openable_grill_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_openable_grill_loop", 0, top); + return 0; + } bhv_openable_grill_loop(); @@ -3045,7 +5031,13 @@ int smlua_func_bhv_openable_grill_loop(UNUSED lua_State* L) { } int smlua_func_bhv_orange_number_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_orange_number_init", 0, top); + return 0; + } bhv_orange_number_init(); @@ -3054,7 +5046,13 @@ int smlua_func_bhv_orange_number_init(UNUSED lua_State* L) { } int smlua_func_bhv_orange_number_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_orange_number_loop", 0, top); + return 0; + } bhv_orange_number_loop(); @@ -3063,7 +5061,13 @@ int smlua_func_bhv_orange_number_loop(UNUSED lua_State* L) { } int smlua_func_bhv_particle_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_particle_init", 0, top); + return 0; + } bhv_particle_init(); @@ -3072,7 +5076,13 @@ int smlua_func_bhv_particle_init(UNUSED lua_State* L) { } int smlua_func_bhv_particle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_particle_loop", 0, top); + return 0; + } bhv_particle_loop(); @@ -3081,7 +5091,13 @@ int smlua_func_bhv_particle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_penguin_race_finish_line_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_penguin_race_finish_line_update", 0, top); + return 0; + } bhv_penguin_race_finish_line_update(); @@ -3090,7 +5106,13 @@ int smlua_func_bhv_penguin_race_finish_line_update(UNUSED lua_State* L) { } int smlua_func_bhv_penguin_race_shortcut_check_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_penguin_race_shortcut_check_update", 0, top); + return 0; + } bhv_penguin_race_shortcut_check_update(); @@ -3099,7 +5121,13 @@ int smlua_func_bhv_penguin_race_shortcut_check_update(UNUSED lua_State* L) { } int smlua_func_bhv_piranha_particle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_piranha_particle_loop", 0, top); + return 0; + } bhv_piranha_particle_loop(); @@ -3108,7 +5136,13 @@ int smlua_func_bhv_piranha_particle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_piranha_plant_bubble_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_piranha_plant_bubble_loop", 0, top); + return 0; + } bhv_piranha_plant_bubble_loop(); @@ -3117,7 +5151,13 @@ int smlua_func_bhv_piranha_plant_bubble_loop(UNUSED lua_State* L) { } int smlua_func_bhv_piranha_plant_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_piranha_plant_loop", 0, top); + return 0; + } bhv_piranha_plant_loop(); @@ -3126,7 +5166,13 @@ int smlua_func_bhv_piranha_plant_loop(UNUSED lua_State* L) { } int smlua_func_bhv_piranha_plant_waking_bubbles_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_piranha_plant_waking_bubbles_loop", 0, top); + return 0; + } bhv_piranha_plant_waking_bubbles_loop(); @@ -3135,7 +5181,13 @@ int smlua_func_bhv_piranha_plant_waking_bubbles_loop(UNUSED lua_State* L) { } int smlua_func_bhv_platform_normals_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_platform_normals_init", 0, top); + return 0; + } bhv_platform_normals_init(); @@ -3144,7 +5196,13 @@ int smlua_func_bhv_platform_normals_init(UNUSED lua_State* L) { } int smlua_func_bhv_platform_on_track_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_platform_on_track_init", 0, top); + return 0; + } bhv_platform_on_track_init(); @@ -3153,7 +5211,13 @@ int smlua_func_bhv_platform_on_track_init(UNUSED lua_State* L) { } int smlua_func_bhv_platform_on_track_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_platform_on_track_update", 0, top); + return 0; + } bhv_platform_on_track_update(); @@ -3162,7 +5226,13 @@ int smlua_func_bhv_platform_on_track_update(UNUSED lua_State* L) { } int smlua_func_bhv_play_music_track_when_touched_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_play_music_track_when_touched_loop", 0, top); + return 0; + } bhv_play_music_track_when_touched_loop(); @@ -3171,7 +5241,13 @@ int smlua_func_bhv_play_music_track_when_touched_loop(UNUSED lua_State* L) { } int smlua_func_bhv_pokey_body_part_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pokey_body_part_update", 0, top); + return 0; + } bhv_pokey_body_part_update(); @@ -3180,7 +5256,13 @@ int smlua_func_bhv_pokey_body_part_update(UNUSED lua_State* L) { } int smlua_func_bhv_pokey_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pokey_update", 0, top); + return 0; + } bhv_pokey_update(); @@ -3189,7 +5271,13 @@ int smlua_func_bhv_pokey_update(UNUSED lua_State* L) { } int smlua_func_bhv_pole_base_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pole_base_loop", 0, top); + return 0; + } bhv_pole_base_loop(); @@ -3198,7 +5286,13 @@ int smlua_func_bhv_pole_base_loop(UNUSED lua_State* L) { } int smlua_func_bhv_pole_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pole_init", 0, top); + return 0; + } bhv_pole_init(); @@ -3207,7 +5301,13 @@ int smlua_func_bhv_pole_init(UNUSED lua_State* L) { } int smlua_func_bhv_pound_tiny_star_particle_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pound_tiny_star_particle_init", 0, top); + return 0; + } bhv_pound_tiny_star_particle_init(); @@ -3216,7 +5316,13 @@ int smlua_func_bhv_pound_tiny_star_particle_init(UNUSED lua_State* L) { } int smlua_func_bhv_pound_tiny_star_particle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pound_tiny_star_particle_loop", 0, top); + return 0; + } bhv_pound_tiny_star_particle_loop(); @@ -3225,7 +5331,13 @@ int smlua_func_bhv_pound_tiny_star_particle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_pound_white_puffs_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pound_white_puffs_init", 0, top); + return 0; + } bhv_pound_white_puffs_init(); @@ -3234,7 +5346,13 @@ int smlua_func_bhv_pound_white_puffs_init(UNUSED lua_State* L) { } int smlua_func_bhv_punch_tiny_triangle_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_punch_tiny_triangle_init", 0, top); + return 0; + } bhv_punch_tiny_triangle_init(); @@ -3243,7 +5361,13 @@ int smlua_func_bhv_punch_tiny_triangle_init(UNUSED lua_State* L) { } int smlua_func_bhv_punch_tiny_triangle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_punch_tiny_triangle_loop", 0, top); + return 0; + } bhv_punch_tiny_triangle_loop(); @@ -3252,7 +5376,13 @@ int smlua_func_bhv_punch_tiny_triangle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_purple_switch_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_purple_switch_loop", 0, top); + return 0; + } bhv_purple_switch_loop(); @@ -3261,7 +5391,13 @@ int smlua_func_bhv_purple_switch_loop(UNUSED lua_State* L) { } int smlua_func_bhv_pushable_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pushable_loop", 0, top); + return 0; + } bhv_pushable_loop(); @@ -3270,7 +5406,13 @@ int smlua_func_bhv_pushable_loop(UNUSED lua_State* L) { } int smlua_func_bhv_pyramid_elevator_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pyramid_elevator_init", 0, top); + return 0; + } bhv_pyramid_elevator_init(); @@ -3279,7 +5421,13 @@ int smlua_func_bhv_pyramid_elevator_init(UNUSED lua_State* L) { } int smlua_func_bhv_pyramid_elevator_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pyramid_elevator_loop", 0, top); + return 0; + } bhv_pyramid_elevator_loop(); @@ -3288,7 +5436,13 @@ int smlua_func_bhv_pyramid_elevator_loop(UNUSED lua_State* L) { } int smlua_func_bhv_pyramid_elevator_trajectory_marker_ball_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pyramid_elevator_trajectory_marker_ball_loop", 0, top); + return 0; + } bhv_pyramid_elevator_trajectory_marker_ball_loop(); @@ -3297,7 +5451,13 @@ int smlua_func_bhv_pyramid_elevator_trajectory_marker_ball_loop(UNUSED lua_State } int smlua_func_bhv_pyramid_pillar_touch_detector_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pyramid_pillar_touch_detector_loop", 0, top); + return 0; + } bhv_pyramid_pillar_touch_detector_loop(); @@ -3306,7 +5466,13 @@ int smlua_func_bhv_pyramid_pillar_touch_detector_loop(UNUSED lua_State* L) { } int smlua_func_bhv_pyramid_top_fragment_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pyramid_top_fragment_init", 0, top); + return 0; + } bhv_pyramid_top_fragment_init(); @@ -3315,7 +5481,13 @@ int smlua_func_bhv_pyramid_top_fragment_init(UNUSED lua_State* L) { } int smlua_func_bhv_pyramid_top_fragment_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pyramid_top_fragment_loop", 0, top); + return 0; + } bhv_pyramid_top_fragment_loop(); @@ -3324,7 +5496,13 @@ int smlua_func_bhv_pyramid_top_fragment_loop(UNUSED lua_State* L) { } int smlua_func_bhv_pyramid_top_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pyramid_top_init", 0, top); + return 0; + } bhv_pyramid_top_init(); @@ -3333,7 +5511,13 @@ int smlua_func_bhv_pyramid_top_init(UNUSED lua_State* L) { } int smlua_func_bhv_pyramid_top_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_pyramid_top_loop", 0, top); + return 0; + } bhv_pyramid_top_loop(); @@ -3342,7 +5526,13 @@ int smlua_func_bhv_pyramid_top_loop(UNUSED lua_State* L) { } int smlua_func_bhv_racing_penguin_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_racing_penguin_init", 0, top); + return 0; + } bhv_racing_penguin_init(); @@ -3351,7 +5541,13 @@ int smlua_func_bhv_racing_penguin_init(UNUSED lua_State* L) { } int smlua_func_bhv_racing_penguin_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_racing_penguin_update", 0, top); + return 0; + } bhv_racing_penguin_update(); @@ -3360,7 +5556,13 @@ int smlua_func_bhv_racing_penguin_update(UNUSED lua_State* L) { } int smlua_func_bhv_recovery_heart_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_recovery_heart_loop", 0, top); + return 0; + } bhv_recovery_heart_loop(); @@ -3369,7 +5571,13 @@ int smlua_func_bhv_recovery_heart_loop(UNUSED lua_State* L) { } int smlua_func_bhv_red_coin_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_red_coin_init", 0, top); + return 0; + } bhv_red_coin_init(); @@ -3378,7 +5586,13 @@ int smlua_func_bhv_red_coin_init(UNUSED lua_State* L) { } int smlua_func_bhv_red_coin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_red_coin_loop", 0, top); + return 0; + } bhv_red_coin_loop(); @@ -3387,7 +5601,13 @@ int smlua_func_bhv_red_coin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_red_coin_star_marker_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_red_coin_star_marker_init", 0, top); + return 0; + } bhv_red_coin_star_marker_init(); @@ -3396,7 +5616,13 @@ int smlua_func_bhv_red_coin_star_marker_init(UNUSED lua_State* L) { } int smlua_func_bhv_respawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_respawner_loop", 0, top); + return 0; + } bhv_respawner_loop(); @@ -3405,7 +5631,13 @@ int smlua_func_bhv_respawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_rolling_log_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_rolling_log_loop", 0, top); + return 0; + } bhv_rolling_log_loop(); @@ -3414,7 +5646,13 @@ int smlua_func_bhv_rolling_log_loop(UNUSED lua_State* L) { } int smlua_func_bhv_rotating_clock_arm_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_rotating_clock_arm_loop", 0, top); + return 0; + } bhv_rotating_clock_arm_loop(); @@ -3423,7 +5661,13 @@ int smlua_func_bhv_rotating_clock_arm_loop(UNUSED lua_State* L) { } int smlua_func_bhv_rotating_exclamation_box_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_rotating_exclamation_box_loop", 0, top); + return 0; + } bhv_rotating_exclamation_box_loop(); @@ -3432,7 +5676,13 @@ int smlua_func_bhv_rotating_exclamation_box_loop(UNUSED lua_State* L) { } int smlua_func_bhv_rotating_octagonal_plat_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_rotating_octagonal_plat_init", 0, top); + return 0; + } bhv_rotating_octagonal_plat_init(); @@ -3441,7 +5691,13 @@ int smlua_func_bhv_rotating_octagonal_plat_init(UNUSED lua_State* L) { } int smlua_func_bhv_rotating_octagonal_plat_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_rotating_octagonal_plat_loop", 0, top); + return 0; + } bhv_rotating_octagonal_plat_loop(); @@ -3450,7 +5706,13 @@ int smlua_func_bhv_rotating_octagonal_plat_loop(UNUSED lua_State* L) { } int smlua_func_bhv_rotating_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_rotating_platform_loop", 0, top); + return 0; + } bhv_rotating_platform_loop(); @@ -3459,7 +5721,13 @@ int smlua_func_bhv_rotating_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_rr_cruiser_wing_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_rr_cruiser_wing_init", 0, top); + return 0; + } bhv_rr_cruiser_wing_init(); @@ -3468,7 +5736,13 @@ int smlua_func_bhv_rr_cruiser_wing_init(UNUSED lua_State* L) { } int smlua_func_bhv_rr_cruiser_wing_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_rr_cruiser_wing_loop", 0, top); + return 0; + } bhv_rr_cruiser_wing_loop(); @@ -3477,7 +5751,13 @@ int smlua_func_bhv_rr_cruiser_wing_loop(UNUSED lua_State* L) { } int smlua_func_bhv_rr_rotating_bridge_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_rr_rotating_bridge_platform_loop", 0, top); + return 0; + } bhv_rr_rotating_bridge_platform_loop(); @@ -3486,7 +5766,13 @@ int smlua_func_bhv_rr_rotating_bridge_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_sand_sound_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sand_sound_loop", 0, top); + return 0; + } bhv_sand_sound_loop(); @@ -3495,7 +5781,13 @@ int smlua_func_bhv_sand_sound_loop(UNUSED lua_State* L) { } int smlua_func_bhv_scuttlebug_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_scuttlebug_loop", 0, top); + return 0; + } bhv_scuttlebug_loop(); @@ -3504,7 +5796,13 @@ int smlua_func_bhv_scuttlebug_loop(UNUSED lua_State* L) { } int smlua_func_bhv_scuttlebug_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_scuttlebug_spawn_loop", 0, top); + return 0; + } bhv_scuttlebug_spawn_loop(); @@ -3513,7 +5811,13 @@ int smlua_func_bhv_scuttlebug_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_seaweed_bundle_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_seaweed_bundle_init", 0, top); + return 0; + } bhv_seaweed_bundle_init(); @@ -3522,7 +5826,13 @@ int smlua_func_bhv_seaweed_bundle_init(UNUSED lua_State* L) { } int smlua_func_bhv_seaweed_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_seaweed_init", 0, top); + return 0; + } bhv_seaweed_init(); @@ -3531,7 +5841,13 @@ int smlua_func_bhv_seaweed_init(UNUSED lua_State* L) { } int smlua_func_bhv_seesaw_platform_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_seesaw_platform_init", 0, top); + return 0; + } bhv_seesaw_platform_init(); @@ -3540,7 +5856,13 @@ int smlua_func_bhv_seesaw_platform_init(UNUSED lua_State* L) { } int smlua_func_bhv_seesaw_platform_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_seesaw_platform_update", 0, top); + return 0; + } bhv_seesaw_platform_update(); @@ -3549,7 +5871,13 @@ int smlua_func_bhv_seesaw_platform_update(UNUSED lua_State* L) { } int smlua_func_bhv_shallow_water_splash_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_shallow_water_splash_init", 0, top); + return 0; + } bhv_shallow_water_splash_init(); @@ -3558,7 +5886,13 @@ int smlua_func_bhv_shallow_water_splash_init(UNUSED lua_State* L) { } int smlua_func_bhv_ship_part_3_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ship_part_3_loop", 0, top); + return 0; + } bhv_ship_part_3_loop(); @@ -3567,7 +5901,13 @@ int smlua_func_bhv_ship_part_3_loop(UNUSED lua_State* L) { } int smlua_func_bhv_skeeter_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_skeeter_update", 0, top); + return 0; + } bhv_skeeter_update(); @@ -3576,7 +5916,13 @@ int smlua_func_bhv_skeeter_update(UNUSED lua_State* L) { } int smlua_func_bhv_skeeter_wave_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_skeeter_wave_update", 0, top); + return 0; + } bhv_skeeter_wave_update(); @@ -3585,7 +5931,13 @@ int smlua_func_bhv_skeeter_wave_update(UNUSED lua_State* L) { } int smlua_func_bhv_sl_snowman_wind_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sl_snowman_wind_loop", 0, top); + return 0; + } bhv_sl_snowman_wind_loop(); @@ -3594,7 +5946,13 @@ int smlua_func_bhv_sl_snowman_wind_loop(UNUSED lua_State* L) { } int smlua_func_bhv_sl_walking_penguin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sl_walking_penguin_loop", 0, top); + return 0; + } bhv_sl_walking_penguin_loop(); @@ -3603,7 +5961,13 @@ int smlua_func_bhv_sl_walking_penguin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_sliding_plat_2_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sliding_plat_2_init", 0, top); + return 0; + } bhv_sliding_plat_2_init(); @@ -3612,7 +5976,13 @@ int smlua_func_bhv_sliding_plat_2_init(UNUSED lua_State* L) { } int smlua_func_bhv_sliding_plat_2_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sliding_plat_2_loop", 0, top); + return 0; + } bhv_sliding_plat_2_loop(); @@ -3621,7 +5991,13 @@ int smlua_func_bhv_sliding_plat_2_loop(UNUSED lua_State* L) { } int smlua_func_bhv_sliding_snow_mound_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sliding_snow_mound_loop", 0, top); + return 0; + } bhv_sliding_snow_mound_loop(); @@ -3630,7 +6006,13 @@ int smlua_func_bhv_sliding_snow_mound_loop(UNUSED lua_State* L) { } int smlua_func_bhv_small_bomp_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_small_bomp_init", 0, top); + return 0; + } bhv_small_bomp_init(); @@ -3639,7 +6021,13 @@ int smlua_func_bhv_small_bomp_init(UNUSED lua_State* L) { } int smlua_func_bhv_small_bomp_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_small_bomp_loop", 0, top); + return 0; + } bhv_small_bomp_loop(); @@ -3648,7 +6036,13 @@ int smlua_func_bhv_small_bomp_loop(UNUSED lua_State* L) { } int smlua_func_bhv_small_bubbles_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_small_bubbles_loop", 0, top); + return 0; + } bhv_small_bubbles_loop(); @@ -3657,7 +6051,13 @@ int smlua_func_bhv_small_bubbles_loop(UNUSED lua_State* L) { } int smlua_func_bhv_small_bully_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_small_bully_init", 0, top); + return 0; + } bhv_small_bully_init(); @@ -3666,7 +6066,13 @@ int smlua_func_bhv_small_bully_init(UNUSED lua_State* L) { } int smlua_func_bhv_small_penguin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_small_penguin_loop", 0, top); + return 0; + } bhv_small_penguin_loop(); @@ -3675,7 +6081,13 @@ int smlua_func_bhv_small_penguin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_small_piranha_flame_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_small_piranha_flame_loop", 0, top); + return 0; + } bhv_small_piranha_flame_loop(); @@ -3684,7 +6096,13 @@ int smlua_func_bhv_small_piranha_flame_loop(UNUSED lua_State* L) { } int smlua_func_bhv_small_water_wave_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_small_water_wave_loop", 0, top); + return 0; + } bhv_small_water_wave_loop(); @@ -3693,7 +6111,13 @@ int smlua_func_bhv_small_water_wave_loop(UNUSED lua_State* L) { } int smlua_func_bhv_snow_leaf_particle_spawn_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_snow_leaf_particle_spawn_init", 0, top); + return 0; + } bhv_snow_leaf_particle_spawn_init(); @@ -3702,7 +6126,13 @@ int smlua_func_bhv_snow_leaf_particle_spawn_init(UNUSED lua_State* L) { } int smlua_func_bhv_snow_mound_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_snow_mound_spawn_loop", 0, top); + return 0; + } bhv_snow_mound_spawn_loop(); @@ -3711,7 +6141,13 @@ int smlua_func_bhv_snow_mound_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_snowmans_body_checkpoint_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_snowmans_body_checkpoint_loop", 0, top); + return 0; + } bhv_snowmans_body_checkpoint_loop(); @@ -3720,7 +6156,13 @@ int smlua_func_bhv_snowmans_body_checkpoint_loop(UNUSED lua_State* L) { } int smlua_func_bhv_snowmans_bottom_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_snowmans_bottom_init", 0, top); + return 0; + } bhv_snowmans_bottom_init(); @@ -3729,7 +6171,13 @@ int smlua_func_bhv_snowmans_bottom_init(UNUSED lua_State* L) { } int smlua_func_bhv_snowmans_bottom_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_snowmans_bottom_loop", 0, top); + return 0; + } bhv_snowmans_bottom_loop(); @@ -3738,7 +6186,13 @@ int smlua_func_bhv_snowmans_bottom_loop(UNUSED lua_State* L) { } int smlua_func_bhv_snowmans_head_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_snowmans_head_init", 0, top); + return 0; + } bhv_snowmans_head_init(); @@ -3747,7 +6201,13 @@ int smlua_func_bhv_snowmans_head_init(UNUSED lua_State* L) { } int smlua_func_bhv_snowmans_head_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_snowmans_head_loop", 0, top); + return 0; + } bhv_snowmans_head_loop(); @@ -3756,7 +6216,13 @@ int smlua_func_bhv_snowmans_head_loop(UNUSED lua_State* L) { } int smlua_func_bhv_snufit_balls_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_snufit_balls_loop", 0, top); + return 0; + } bhv_snufit_balls_loop(); @@ -3765,7 +6231,13 @@ int smlua_func_bhv_snufit_balls_loop(UNUSED lua_State* L) { } int smlua_func_bhv_snufit_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_snufit_loop", 0, top); + return 0; + } bhv_snufit_loop(); @@ -3774,7 +6246,13 @@ int smlua_func_bhv_snufit_loop(UNUSED lua_State* L) { } int smlua_func_bhv_sound_spawner_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sound_spawner_init", 0, top); + return 0; + } bhv_sound_spawner_init(); @@ -3783,7 +6261,13 @@ int smlua_func_bhv_sound_spawner_init(UNUSED lua_State* L) { } int smlua_func_bhv_sparkle_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sparkle_spawn_loop", 0, top); + return 0; + } bhv_sparkle_spawn_loop(); @@ -3792,14 +6276,20 @@ int smlua_func_bhv_sparkle_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_spawn_star_no_level_exit(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_spawn_star_no_level_exit", 3, top); + return 0; + } struct Object* object = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'bhv_spawn_star_no_level_exit'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "bhv_spawn_star_no_level_exit"); return 0; } u32 params = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'bhv_spawn_star_no_level_exit'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "bhv_spawn_star_no_level_exit"); return 0; } u8 networkSendEvent = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'bhv_spawn_star_no_level_exit'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "bhv_spawn_star_no_level_exit"); return 0; } bhv_spawn_star_no_level_exit(object, params, networkSendEvent); @@ -3807,7 +6297,13 @@ int smlua_func_bhv_spawn_star_no_level_exit(lua_State* L) { } int smlua_func_bhv_spawned_star_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_spawned_star_init", 0, top); + return 0; + } bhv_spawned_star_init(); @@ -3816,7 +6312,13 @@ int smlua_func_bhv_spawned_star_init(UNUSED lua_State* L) { } int smlua_func_bhv_spawned_star_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_spawned_star_loop", 0, top); + return 0; + } bhv_spawned_star_loop(); @@ -3825,7 +6327,13 @@ int smlua_func_bhv_spawned_star_loop(UNUSED lua_State* L) { } int smlua_func_bhv_spindel_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_spindel_init", 0, top); + return 0; + } bhv_spindel_init(); @@ -3834,7 +6342,13 @@ int smlua_func_bhv_spindel_init(UNUSED lua_State* L) { } int smlua_func_bhv_spindel_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_spindel_loop", 0, top); + return 0; + } bhv_spindel_loop(); @@ -3843,7 +6357,13 @@ int smlua_func_bhv_spindel_loop(UNUSED lua_State* L) { } int smlua_func_bhv_spindrift_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_spindrift_loop", 0, top); + return 0; + } bhv_spindrift_loop(); @@ -3852,7 +6372,13 @@ int smlua_func_bhv_spindrift_loop(UNUSED lua_State* L) { } int smlua_func_bhv_spiny_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_spiny_update", 0, top); + return 0; + } bhv_spiny_update(); @@ -3861,7 +6387,13 @@ int smlua_func_bhv_spiny_update(UNUSED lua_State* L) { } int smlua_func_bhv_squarish_path_moving_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_squarish_path_moving_loop", 0, top); + return 0; + } bhv_squarish_path_moving_loop(); @@ -3870,7 +6402,13 @@ int smlua_func_bhv_squarish_path_moving_loop(UNUSED lua_State* L) { } int smlua_func_bhv_squarish_path_parent_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_squarish_path_parent_init", 0, top); + return 0; + } bhv_squarish_path_parent_init(); @@ -3879,7 +6417,13 @@ int smlua_func_bhv_squarish_path_parent_init(UNUSED lua_State* L) { } int smlua_func_bhv_squarish_path_parent_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_squarish_path_parent_loop", 0, top); + return 0; + } bhv_squarish_path_parent_loop(); @@ -3888,7 +6432,13 @@ int smlua_func_bhv_squarish_path_parent_loop(UNUSED lua_State* L) { } int smlua_func_bhv_squishable_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_squishable_platform_loop", 0, top); + return 0; + } bhv_squishable_platform_loop(); @@ -3897,7 +6447,13 @@ int smlua_func_bhv_squishable_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_ssl_moving_pyramid_wall_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ssl_moving_pyramid_wall_init", 0, top); + return 0; + } bhv_ssl_moving_pyramid_wall_init(); @@ -3906,7 +6462,13 @@ int smlua_func_bhv_ssl_moving_pyramid_wall_init(UNUSED lua_State* L) { } int smlua_func_bhv_ssl_moving_pyramid_wall_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ssl_moving_pyramid_wall_loop", 0, top); + return 0; + } bhv_ssl_moving_pyramid_wall_loop(); @@ -3915,7 +6477,13 @@ int smlua_func_bhv_ssl_moving_pyramid_wall_loop(UNUSED lua_State* L) { } int smlua_func_bhv_star_door_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_star_door_loop", 0, top); + return 0; + } bhv_star_door_loop(); @@ -3924,7 +6492,13 @@ int smlua_func_bhv_star_door_loop(UNUSED lua_State* L) { } int smlua_func_bhv_star_door_loop_2(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_star_door_loop_2", 0, top); + return 0; + } bhv_star_door_loop_2(); @@ -3933,7 +6507,13 @@ int smlua_func_bhv_star_door_loop_2(UNUSED lua_State* L) { } int smlua_func_bhv_star_key_collection_puff_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_star_key_collection_puff_spawner_loop", 0, top); + return 0; + } bhv_star_key_collection_puff_spawner_loop(); @@ -3942,7 +6522,13 @@ int smlua_func_bhv_star_key_collection_puff_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_star_spawn_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_star_spawn_init", 0, top); + return 0; + } bhv_star_spawn_init(); @@ -3951,7 +6537,13 @@ int smlua_func_bhv_star_spawn_init(UNUSED lua_State* L) { } int smlua_func_bhv_star_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_star_spawn_loop", 0, top); + return 0; + } bhv_star_spawn_loop(); @@ -3960,7 +6552,13 @@ int smlua_func_bhv_star_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_static_checkered_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_static_checkered_platform_loop", 0, top); + return 0; + } bhv_static_checkered_platform_loop(); @@ -3969,7 +6567,13 @@ int smlua_func_bhv_static_checkered_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_strong_wind_particle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_strong_wind_particle_loop", 0, top); + return 0; + } bhv_strong_wind_particle_loop(); @@ -3978,7 +6582,13 @@ int smlua_func_bhv_strong_wind_particle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_sunken_ship_part_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sunken_ship_part_loop", 0, top); + return 0; + } bhv_sunken_ship_part_loop(); @@ -3987,7 +6597,13 @@ int smlua_func_bhv_sunken_ship_part_loop(UNUSED lua_State* L) { } int smlua_func_bhv_sushi_shark_collision_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sushi_shark_collision_loop", 0, top); + return 0; + } bhv_sushi_shark_collision_loop(); @@ -3996,7 +6612,13 @@ int smlua_func_bhv_sushi_shark_collision_loop(UNUSED lua_State* L) { } int smlua_func_bhv_sushi_shark_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_sushi_shark_loop", 0, top); + return 0; + } bhv_sushi_shark_loop(); @@ -4005,7 +6627,13 @@ int smlua_func_bhv_sushi_shark_loop(UNUSED lua_State* L) { } int smlua_func_bhv_swing_platform_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_swing_platform_init", 0, top); + return 0; + } bhv_swing_platform_init(); @@ -4014,7 +6642,13 @@ int smlua_func_bhv_swing_platform_init(UNUSED lua_State* L) { } int smlua_func_bhv_swing_platform_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_swing_platform_update", 0, top); + return 0; + } bhv_swing_platform_update(); @@ -4023,7 +6657,13 @@ int smlua_func_bhv_swing_platform_update(UNUSED lua_State* L) { } int smlua_func_bhv_swoop_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_swoop_update", 0, top); + return 0; + } bhv_swoop_update(); @@ -4032,7 +6672,13 @@ int smlua_func_bhv_swoop_update(UNUSED lua_State* L) { } int smlua_func_bhv_tank_fish_group_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tank_fish_group_loop", 0, top); + return 0; + } bhv_tank_fish_group_loop(); @@ -4041,7 +6687,13 @@ int smlua_func_bhv_tank_fish_group_loop(UNUSED lua_State* L) { } int smlua_func_bhv_temp_coin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_temp_coin_loop", 0, top); + return 0; + } bhv_temp_coin_loop(); @@ -4050,7 +6702,13 @@ int smlua_func_bhv_temp_coin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_thi_bowling_ball_spawner_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_thi_bowling_ball_spawner_loop", 0, top); + return 0; + } bhv_thi_bowling_ball_spawner_loop(); @@ -4059,7 +6717,13 @@ int smlua_func_bhv_thi_bowling_ball_spawner_loop(UNUSED lua_State* L) { } int smlua_func_bhv_thi_huge_island_top_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_thi_huge_island_top_loop", 0, top); + return 0; + } bhv_thi_huge_island_top_loop(); @@ -4068,7 +6732,13 @@ int smlua_func_bhv_thi_huge_island_top_loop(UNUSED lua_State* L) { } int smlua_func_bhv_thi_tiny_island_top_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_thi_tiny_island_top_loop", 0, top); + return 0; + } bhv_thi_tiny_island_top_loop(); @@ -4077,7 +6747,13 @@ int smlua_func_bhv_thi_tiny_island_top_loop(UNUSED lua_State* L) { } int smlua_func_bhv_tilting_bowser_lava_platform_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tilting_bowser_lava_platform_init", 0, top); + return 0; + } bhv_tilting_bowser_lava_platform_init(); @@ -4086,7 +6762,13 @@ int smlua_func_bhv_tilting_bowser_lava_platform_init(UNUSED lua_State* L) { } int smlua_func_bhv_tilting_inverted_pyramid_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tilting_inverted_pyramid_loop", 0, top); + return 0; + } bhv_tilting_inverted_pyramid_loop(); @@ -4095,7 +6777,13 @@ int smlua_func_bhv_tilting_inverted_pyramid_loop(UNUSED lua_State* L) { } int smlua_func_bhv_tiny_star_particles_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tiny_star_particles_init", 0, top); + return 0; + } bhv_tiny_star_particles_init(); @@ -4104,7 +6792,13 @@ int smlua_func_bhv_tiny_star_particles_init(UNUSED lua_State* L) { } int smlua_func_bhv_tower_door_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tower_door_loop", 0, top); + return 0; + } bhv_tower_door_loop(); @@ -4113,7 +6807,13 @@ int smlua_func_bhv_tower_door_loop(UNUSED lua_State* L) { } int smlua_func_bhv_tower_platform_group_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tower_platform_group_init", 0, top); + return 0; + } bhv_tower_platform_group_init(); @@ -4122,7 +6822,13 @@ int smlua_func_bhv_tower_platform_group_init(UNUSED lua_State* L) { } int smlua_func_bhv_tower_platform_group_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tower_platform_group_loop", 0, top); + return 0; + } bhv_tower_platform_group_loop(); @@ -4131,7 +6837,13 @@ int smlua_func_bhv_tower_platform_group_loop(UNUSED lua_State* L) { } int smlua_func_bhv_tox_box_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tox_box_loop", 0, top); + return 0; + } bhv_tox_box_loop(); @@ -4140,7 +6852,13 @@ int smlua_func_bhv_tox_box_loop(UNUSED lua_State* L) { } int smlua_func_bhv_track_ball_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_track_ball_update", 0, top); + return 0; + } bhv_track_ball_update(); @@ -4149,7 +6867,13 @@ int smlua_func_bhv_track_ball_update(UNUSED lua_State* L) { } int smlua_func_bhv_treasure_chest_bottom_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_treasure_chest_bottom_init", 0, top); + return 0; + } bhv_treasure_chest_bottom_init(); @@ -4158,7 +6882,13 @@ int smlua_func_bhv_treasure_chest_bottom_init(UNUSED lua_State* L) { } int smlua_func_bhv_treasure_chest_bottom_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_treasure_chest_bottom_loop", 0, top); + return 0; + } bhv_treasure_chest_bottom_loop(); @@ -4167,7 +6897,13 @@ int smlua_func_bhv_treasure_chest_bottom_loop(UNUSED lua_State* L) { } int smlua_func_bhv_treasure_chest_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_treasure_chest_init", 0, top); + return 0; + } bhv_treasure_chest_init(); @@ -4176,7 +6912,13 @@ int smlua_func_bhv_treasure_chest_init(UNUSED lua_State* L) { } int smlua_func_bhv_treasure_chest_jrb_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_treasure_chest_jrb_init", 0, top); + return 0; + } bhv_treasure_chest_jrb_init(); @@ -4185,7 +6927,13 @@ int smlua_func_bhv_treasure_chest_jrb_init(UNUSED lua_State* L) { } int smlua_func_bhv_treasure_chest_jrb_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_treasure_chest_jrb_loop", 0, top); + return 0; + } bhv_treasure_chest_jrb_loop(); @@ -4194,7 +6942,13 @@ int smlua_func_bhv_treasure_chest_jrb_loop(UNUSED lua_State* L) { } int smlua_func_bhv_treasure_chest_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_treasure_chest_loop", 0, top); + return 0; + } bhv_treasure_chest_loop(); @@ -4203,7 +6957,13 @@ int smlua_func_bhv_treasure_chest_loop(UNUSED lua_State* L) { } int smlua_func_bhv_treasure_chest_ship_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_treasure_chest_ship_init", 0, top); + return 0; + } bhv_treasure_chest_ship_init(); @@ -4212,7 +6972,13 @@ int smlua_func_bhv_treasure_chest_ship_init(UNUSED lua_State* L) { } int smlua_func_bhv_treasure_chest_ship_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_treasure_chest_ship_loop", 0, top); + return 0; + } bhv_treasure_chest_ship_loop(); @@ -4221,7 +6987,13 @@ int smlua_func_bhv_treasure_chest_ship_loop(UNUSED lua_State* L) { } int smlua_func_bhv_treasure_chest_top_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_treasure_chest_top_loop", 0, top); + return 0; + } bhv_treasure_chest_top_loop(); @@ -4230,7 +7002,13 @@ int smlua_func_bhv_treasure_chest_top_loop(UNUSED lua_State* L) { } int smlua_func_bhv_tree_snow_or_leaf_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tree_snow_or_leaf_loop", 0, top); + return 0; + } bhv_tree_snow_or_leaf_loop(); @@ -4239,7 +7017,13 @@ int smlua_func_bhv_tree_snow_or_leaf_loop(UNUSED lua_State* L) { } int smlua_func_bhv_triplet_butterfly_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_triplet_butterfly_update", 0, top); + return 0; + } bhv_triplet_butterfly_update(); @@ -4248,7 +7032,13 @@ int smlua_func_bhv_triplet_butterfly_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_2d_rotator_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_2d_rotator_init", 0, top); + return 0; + } bhv_ttc_2d_rotator_init(); @@ -4257,7 +7047,13 @@ int smlua_func_bhv_ttc_2d_rotator_init(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_2d_rotator_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_2d_rotator_update", 0, top); + return 0; + } bhv_ttc_2d_rotator_update(); @@ -4266,7 +7062,13 @@ int smlua_func_bhv_ttc_2d_rotator_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_cog_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_cog_init", 0, top); + return 0; + } bhv_ttc_cog_init(); @@ -4275,7 +7077,13 @@ int smlua_func_bhv_ttc_cog_init(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_cog_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_cog_update", 0, top); + return 0; + } bhv_ttc_cog_update(); @@ -4284,7 +7092,13 @@ int smlua_func_bhv_ttc_cog_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_elevator_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_elevator_init", 0, top); + return 0; + } bhv_ttc_elevator_init(); @@ -4293,7 +7107,13 @@ int smlua_func_bhv_ttc_elevator_init(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_elevator_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_elevator_update", 0, top); + return 0; + } bhv_ttc_elevator_update(); @@ -4302,7 +7122,13 @@ int smlua_func_bhv_ttc_elevator_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_moving_bar_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_moving_bar_init", 0, top); + return 0; + } bhv_ttc_moving_bar_init(); @@ -4311,7 +7137,13 @@ int smlua_func_bhv_ttc_moving_bar_init(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_moving_bar_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_moving_bar_update", 0, top); + return 0; + } bhv_ttc_moving_bar_update(); @@ -4320,7 +7152,13 @@ int smlua_func_bhv_ttc_moving_bar_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_pendulum_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_pendulum_init", 0, top); + return 0; + } bhv_ttc_pendulum_init(); @@ -4329,7 +7167,13 @@ int smlua_func_bhv_ttc_pendulum_init(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_pendulum_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_pendulum_update", 0, top); + return 0; + } bhv_ttc_pendulum_update(); @@ -4338,7 +7182,13 @@ int smlua_func_bhv_ttc_pendulum_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_pit_block_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_pit_block_init", 0, top); + return 0; + } bhv_ttc_pit_block_init(); @@ -4347,7 +7197,13 @@ int smlua_func_bhv_ttc_pit_block_init(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_pit_block_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_pit_block_update", 0, top); + return 0; + } bhv_ttc_pit_block_update(); @@ -4356,7 +7212,13 @@ int smlua_func_bhv_ttc_pit_block_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_rotating_solid_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_rotating_solid_init", 0, top); + return 0; + } bhv_ttc_rotating_solid_init(); @@ -4365,7 +7227,13 @@ int smlua_func_bhv_ttc_rotating_solid_init(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_rotating_solid_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_rotating_solid_update", 0, top); + return 0; + } bhv_ttc_rotating_solid_update(); @@ -4374,7 +7242,13 @@ int smlua_func_bhv_ttc_rotating_solid_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_spinner_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_spinner_update", 0, top); + return 0; + } bhv_ttc_spinner_update(); @@ -4383,7 +7257,13 @@ int smlua_func_bhv_ttc_spinner_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_treadmill_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_treadmill_init", 0, top); + return 0; + } bhv_ttc_treadmill_init(); @@ -4392,7 +7272,13 @@ int smlua_func_bhv_ttc_treadmill_init(UNUSED lua_State* L) { } int smlua_func_bhv_ttc_treadmill_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttc_treadmill_update", 0, top); + return 0; + } bhv_ttc_treadmill_update(); @@ -4401,7 +7287,13 @@ int smlua_func_bhv_ttc_treadmill_update(UNUSED lua_State* L) { } int smlua_func_bhv_ttm_rolling_log_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ttm_rolling_log_init", 0, top); + return 0; + } bhv_ttm_rolling_log_init(); @@ -4410,7 +7302,13 @@ int smlua_func_bhv_ttm_rolling_log_init(UNUSED lua_State* L) { } int smlua_func_bhv_tumbling_bridge_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tumbling_bridge_loop", 0, top); + return 0; + } bhv_tumbling_bridge_loop(); @@ -4419,7 +7317,13 @@ int smlua_func_bhv_tumbling_bridge_loop(UNUSED lua_State* L) { } int smlua_func_bhv_tumbling_bridge_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tumbling_bridge_platform_loop", 0, top); + return 0; + } bhv_tumbling_bridge_platform_loop(); @@ -4428,7 +7332,13 @@ int smlua_func_bhv_tumbling_bridge_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_tuxies_mother_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tuxies_mother_loop", 0, top); + return 0; + } bhv_tuxies_mother_loop(); @@ -4437,7 +7347,13 @@ int smlua_func_bhv_tuxies_mother_loop(UNUSED lua_State* L) { } int smlua_func_bhv_tweester_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tweester_loop", 0, top); + return 0; + } bhv_tweester_loop(); @@ -4446,7 +7362,13 @@ int smlua_func_bhv_tweester_loop(UNUSED lua_State* L) { } int smlua_func_bhv_tweester_sand_particle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_tweester_sand_particle_loop", 0, top); + return 0; + } bhv_tweester_sand_particle_loop(); @@ -4455,7 +7377,13 @@ int smlua_func_bhv_tweester_sand_particle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_ukiki_cage_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ukiki_cage_loop", 0, top); + return 0; + } bhv_ukiki_cage_loop(); @@ -4464,7 +7392,13 @@ int smlua_func_bhv_ukiki_cage_loop(UNUSED lua_State* L) { } int smlua_func_bhv_ukiki_cage_star_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ukiki_cage_star_loop", 0, top); + return 0; + } bhv_ukiki_cage_star_loop(); @@ -4473,7 +7407,13 @@ int smlua_func_bhv_ukiki_cage_star_loop(UNUSED lua_State* L) { } int smlua_func_bhv_ukiki_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ukiki_init", 0, top); + return 0; + } bhv_ukiki_init(); @@ -4482,7 +7422,13 @@ int smlua_func_bhv_ukiki_init(UNUSED lua_State* L) { } int smlua_func_bhv_ukiki_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ukiki_loop", 0, top); + return 0; + } bhv_ukiki_loop(); @@ -4491,7 +7437,13 @@ int smlua_func_bhv_ukiki_loop(UNUSED lua_State* L) { } int smlua_func_bhv_unagi_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_unagi_init", 0, top); + return 0; + } bhv_unagi_init(); @@ -4500,7 +7452,13 @@ int smlua_func_bhv_unagi_init(UNUSED lua_State* L) { } int smlua_func_bhv_unagi_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_unagi_loop", 0, top); + return 0; + } bhv_unagi_loop(); @@ -4509,7 +7467,13 @@ int smlua_func_bhv_unagi_loop(UNUSED lua_State* L) { } int smlua_func_bhv_unagi_subobject_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_unagi_subobject_loop", 0, top); + return 0; + } bhv_unagi_subobject_loop(); @@ -4518,7 +7482,13 @@ int smlua_func_bhv_unagi_subobject_loop(UNUSED lua_State* L) { } int smlua_func_bhv_unused_particle_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_unused_particle_spawn_loop", 0, top); + return 0; + } bhv_unused_particle_spawn_loop(); @@ -4527,7 +7497,13 @@ int smlua_func_bhv_unused_particle_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_unused_poundable_platform(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_unused_poundable_platform", 0, top); + return 0; + } bhv_unused_poundable_platform(); @@ -4536,7 +7512,13 @@ int smlua_func_bhv_unused_poundable_platform(UNUSED lua_State* L) { } int smlua_func_bhv_vanish_cap_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_vanish_cap_init", 0, top); + return 0; + } bhv_vanish_cap_init(); @@ -4545,7 +7527,13 @@ int smlua_func_bhv_vanish_cap_init(UNUSED lua_State* L) { } int smlua_func_bhv_volcano_flames_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_volcano_flames_loop", 0, top); + return 0; + } bhv_volcano_flames_loop(); @@ -4554,7 +7542,13 @@ int smlua_func_bhv_volcano_flames_loop(UNUSED lua_State* L) { } int smlua_func_bhv_volcano_sound_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_volcano_sound_loop", 0, top); + return 0; + } bhv_volcano_sound_loop(); @@ -4563,7 +7557,13 @@ int smlua_func_bhv_volcano_sound_loop(UNUSED lua_State* L) { } int smlua_func_bhv_volcano_trap_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_volcano_trap_loop", 0, top); + return 0; + } bhv_volcano_trap_loop(); @@ -4572,7 +7572,13 @@ int smlua_func_bhv_volcano_trap_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wall_tiny_star_particle_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wall_tiny_star_particle_loop", 0, top); + return 0; + } bhv_wall_tiny_star_particle_loop(); @@ -4581,7 +7587,13 @@ int smlua_func_bhv_wall_tiny_star_particle_loop(UNUSED lua_State* L) { } int smlua_func_bhv_warp_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_warp_loop", 0, top); + return 0; + } bhv_warp_loop(); @@ -4590,7 +7602,13 @@ int smlua_func_bhv_warp_loop(UNUSED lua_State* L) { } int smlua_func_bhv_water_air_bubble_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_air_bubble_init", 0, top); + return 0; + } bhv_water_air_bubble_init(); @@ -4599,7 +7617,13 @@ int smlua_func_bhv_water_air_bubble_init(UNUSED lua_State* L) { } int smlua_func_bhv_water_air_bubble_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_air_bubble_loop", 0, top); + return 0; + } bhv_water_air_bubble_loop(); @@ -4608,7 +7632,13 @@ int smlua_func_bhv_water_air_bubble_loop(UNUSED lua_State* L) { } int smlua_func_bhv_water_bomb_cannon_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_bomb_cannon_loop", 0, top); + return 0; + } bhv_water_bomb_cannon_loop(); @@ -4617,7 +7647,13 @@ int smlua_func_bhv_water_bomb_cannon_loop(UNUSED lua_State* L) { } int smlua_func_bhv_water_bomb_shadow_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_bomb_shadow_update", 0, top); + return 0; + } bhv_water_bomb_shadow_update(); @@ -4626,7 +7662,13 @@ int smlua_func_bhv_water_bomb_shadow_update(UNUSED lua_State* L) { } int smlua_func_bhv_water_bomb_spawner_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_bomb_spawner_update", 0, top); + return 0; + } bhv_water_bomb_spawner_update(); @@ -4635,7 +7677,13 @@ int smlua_func_bhv_water_bomb_spawner_update(UNUSED lua_State* L) { } int smlua_func_bhv_water_bomb_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_bomb_update", 0, top); + return 0; + } bhv_water_bomb_update(); @@ -4644,7 +7692,13 @@ int smlua_func_bhv_water_bomb_update(UNUSED lua_State* L) { } int smlua_func_bhv_water_droplet_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_droplet_loop", 0, top); + return 0; + } bhv_water_droplet_loop(); @@ -4653,7 +7707,13 @@ int smlua_func_bhv_water_droplet_loop(UNUSED lua_State* L) { } int smlua_func_bhv_water_droplet_splash_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_droplet_splash_init", 0, top); + return 0; + } bhv_water_droplet_splash_init(); @@ -4662,7 +7722,13 @@ int smlua_func_bhv_water_droplet_splash_init(UNUSED lua_State* L) { } int smlua_func_bhv_water_level_diamond_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_level_diamond_loop", 0, top); + return 0; + } bhv_water_level_diamond_loop(); @@ -4671,7 +7737,13 @@ int smlua_func_bhv_water_level_diamond_loop(UNUSED lua_State* L) { } int smlua_func_bhv_water_level_pillar_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_level_pillar_init", 0, top); + return 0; + } bhv_water_level_pillar_init(); @@ -4680,7 +7752,13 @@ int smlua_func_bhv_water_level_pillar_init(UNUSED lua_State* L) { } int smlua_func_bhv_water_level_pillar_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_level_pillar_loop", 0, top); + return 0; + } bhv_water_level_pillar_loop(); @@ -4689,7 +7767,13 @@ int smlua_func_bhv_water_level_pillar_loop(UNUSED lua_State* L) { } int smlua_func_bhv_water_mist_2_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_mist_2_loop", 0, top); + return 0; + } bhv_water_mist_2_loop(); @@ -4698,7 +7782,13 @@ int smlua_func_bhv_water_mist_2_loop(UNUSED lua_State* L) { } int smlua_func_bhv_water_mist_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_mist_loop", 0, top); + return 0; + } bhv_water_mist_loop(); @@ -4707,7 +7797,13 @@ int smlua_func_bhv_water_mist_loop(UNUSED lua_State* L) { } int smlua_func_bhv_water_mist_spawn_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_mist_spawn_loop", 0, top); + return 0; + } bhv_water_mist_spawn_loop(); @@ -4716,7 +7812,13 @@ int smlua_func_bhv_water_mist_spawn_loop(UNUSED lua_State* L) { } int smlua_func_bhv_water_splash_spawn_droplets(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_splash_spawn_droplets", 0, top); + return 0; + } bhv_water_splash_spawn_droplets(); @@ -4725,7 +7827,13 @@ int smlua_func_bhv_water_splash_spawn_droplets(UNUSED lua_State* L) { } int smlua_func_bhv_water_waves_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_water_waves_init", 0, top); + return 0; + } bhv_water_waves_init(); @@ -4734,7 +7842,13 @@ int smlua_func_bhv_water_waves_init(UNUSED lua_State* L) { } int smlua_func_bhv_waterfall_sound_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_waterfall_sound_loop", 0, top); + return 0; + } bhv_waterfall_sound_loop(); @@ -4743,7 +7857,13 @@ int smlua_func_bhv_waterfall_sound_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wave_trail_shrink(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wave_trail_shrink", 0, top); + return 0; + } bhv_wave_trail_shrink(); @@ -4752,7 +7872,13 @@ int smlua_func_bhv_wave_trail_shrink(UNUSED lua_State* L) { } int smlua_func_bhv_wdw_express_elevator_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wdw_express_elevator_loop", 0, top); + return 0; + } bhv_wdw_express_elevator_loop(); @@ -4761,7 +7887,13 @@ int smlua_func_bhv_wdw_express_elevator_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wf_breakable_wall_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wf_breakable_wall_loop", 0, top); + return 0; + } bhv_wf_breakable_wall_loop(); @@ -4770,7 +7902,13 @@ int smlua_func_bhv_wf_breakable_wall_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wf_elevator_tower_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wf_elevator_tower_platform_loop", 0, top); + return 0; + } bhv_wf_elevator_tower_platform_loop(); @@ -4779,7 +7917,13 @@ int smlua_func_bhv_wf_elevator_tower_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wf_rotating_wooden_platform_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wf_rotating_wooden_platform_init", 0, top); + return 0; + } bhv_wf_rotating_wooden_platform_init(); @@ -4788,7 +7932,13 @@ int smlua_func_bhv_wf_rotating_wooden_platform_init(UNUSED lua_State* L) { } int smlua_func_bhv_wf_rotating_wooden_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wf_rotating_wooden_platform_loop", 0, top); + return 0; + } bhv_wf_rotating_wooden_platform_loop(); @@ -4797,7 +7947,13 @@ int smlua_func_bhv_wf_rotating_wooden_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wf_sliding_platform_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wf_sliding_platform_init", 0, top); + return 0; + } bhv_wf_sliding_platform_init(); @@ -4806,7 +7962,13 @@ int smlua_func_bhv_wf_sliding_platform_init(UNUSED lua_State* L) { } int smlua_func_bhv_wf_sliding_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wf_sliding_platform_loop", 0, top); + return 0; + } bhv_wf_sliding_platform_loop(); @@ -4815,7 +7977,13 @@ int smlua_func_bhv_wf_sliding_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wf_sliding_tower_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wf_sliding_tower_platform_loop", 0, top); + return 0; + } bhv_wf_sliding_tower_platform_loop(); @@ -4824,7 +7992,13 @@ int smlua_func_bhv_wf_sliding_tower_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wf_solid_tower_platform_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wf_solid_tower_platform_loop", 0, top); + return 0; + } bhv_wf_solid_tower_platform_loop(); @@ -4833,7 +8007,13 @@ int smlua_func_bhv_wf_solid_tower_platform_loop(UNUSED lua_State* L) { } int smlua_func_bhv_whirlpool_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_whirlpool_init", 0, top); + return 0; + } bhv_whirlpool_init(); @@ -4842,7 +8022,13 @@ int smlua_func_bhv_whirlpool_init(UNUSED lua_State* L) { } int smlua_func_bhv_whirlpool_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_whirlpool_loop", 0, top); + return 0; + } bhv_whirlpool_loop(); @@ -4851,7 +8037,13 @@ int smlua_func_bhv_whirlpool_loop(UNUSED lua_State* L) { } int smlua_func_bhv_white_puff_1_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_white_puff_1_loop", 0, top); + return 0; + } bhv_white_puff_1_loop(); @@ -4860,7 +8052,13 @@ int smlua_func_bhv_white_puff_1_loop(UNUSED lua_State* L) { } int smlua_func_bhv_white_puff_2_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_white_puff_2_loop", 0, top); + return 0; + } bhv_white_puff_2_loop(); @@ -4869,7 +8067,13 @@ int smlua_func_bhv_white_puff_2_loop(UNUSED lua_State* L) { } int smlua_func_bhv_white_puff_exploding_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_white_puff_exploding_loop", 0, top); + return 0; + } bhv_white_puff_exploding_loop(); @@ -4878,7 +8082,13 @@ int smlua_func_bhv_white_puff_exploding_loop(UNUSED lua_State* L) { } int smlua_func_bhv_white_puff_smoke_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_white_puff_smoke_init", 0, top); + return 0; + } bhv_white_puff_smoke_init(); @@ -4887,7 +8097,13 @@ int smlua_func_bhv_white_puff_smoke_init(UNUSED lua_State* L) { } int smlua_func_bhv_whomp_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_whomp_loop", 0, top); + return 0; + } bhv_whomp_loop(); @@ -4896,7 +8112,13 @@ int smlua_func_bhv_whomp_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wiggler_body_part_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wiggler_body_part_update", 0, top); + return 0; + } bhv_wiggler_body_part_update(); @@ -4905,7 +8127,13 @@ int smlua_func_bhv_wiggler_body_part_update(UNUSED lua_State* L) { } int smlua_func_bhv_wiggler_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wiggler_update", 0, top); + return 0; + } bhv_wiggler_update(); @@ -4914,7 +8142,13 @@ int smlua_func_bhv_wiggler_update(UNUSED lua_State* L) { } int smlua_func_bhv_wind_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wind_loop", 0, top); + return 0; + } bhv_wind_loop(); @@ -4923,7 +8157,13 @@ int smlua_func_bhv_wind_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wing_cap_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wing_cap_init", 0, top); + return 0; + } bhv_wing_cap_init(); @@ -4932,7 +8172,13 @@ int smlua_func_bhv_wing_cap_init(UNUSED lua_State* L) { } int smlua_func_bhv_wing_vanish_cap_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wing_vanish_cap_loop", 0, top); + return 0; + } bhv_wing_vanish_cap_loop(); @@ -4941,7 +8187,13 @@ int smlua_func_bhv_wing_vanish_cap_loop(UNUSED lua_State* L) { } int smlua_func_bhv_wooden_post_update(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_wooden_post_update", 0, top); + return 0; + } bhv_wooden_post_update(); @@ -4950,7 +8202,13 @@ int smlua_func_bhv_wooden_post_update(UNUSED lua_State* L) { } int smlua_func_bhv_yellow_coin_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_yellow_coin_init", 0, top); + return 0; + } bhv_yellow_coin_init(); @@ -4959,7 +8217,13 @@ int smlua_func_bhv_yellow_coin_init(UNUSED lua_State* L) { } int smlua_func_bhv_yellow_coin_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_yellow_coin_loop", 0, top); + return 0; + } bhv_yellow_coin_loop(); @@ -4968,7 +8232,13 @@ int smlua_func_bhv_yellow_coin_loop(UNUSED lua_State* L) { } int smlua_func_bhv_yoshi_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_yoshi_init", 0, top); + return 0; + } bhv_yoshi_init(); @@ -4977,7 +8247,13 @@ int smlua_func_bhv_yoshi_init(UNUSED lua_State* L) { } int smlua_func_bhv_yoshi_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_yoshi_loop", 0, top); + return 0; + } bhv_yoshi_loop(); @@ -4986,12 +8262,18 @@ int smlua_func_bhv_yoshi_loop(UNUSED lua_State* L) { } int smlua_func_check_if_moving_over_floor(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_if_moving_over_floor", 2, top); + return 0; + } f32 a0 = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_if_moving_over_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_if_moving_over_floor"); return 0; } f32 a1 = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'check_if_moving_over_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "check_if_moving_over_floor"); return 0; } lua_pushinteger(L, check_if_moving_over_floor(a0, a1)); @@ -4999,10 +8281,16 @@ int smlua_func_check_if_moving_over_floor(lua_State* L) { } int smlua_func_clear_particle_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clear_particle_flags", 1, top); + return 0; + } u32 flags = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'clear_particle_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "clear_particle_flags"); return 0; } clear_particle_flags(flags); @@ -5010,14 +8298,20 @@ int smlua_func_clear_particle_flags(lua_State* L) { } int smlua_func_common_anchor_mario_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "common_anchor_mario_behavior", 3, top); + return 0; + } f32 sp28 = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'common_anchor_mario_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "common_anchor_mario_behavior"); return 0; } f32 sp2C = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'common_anchor_mario_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "common_anchor_mario_behavior"); return 0; } s32 sp30 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'common_anchor_mario_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "common_anchor_mario_behavior"); return 0; } common_anchor_mario_behavior(sp28, sp2C, sp30); @@ -5025,18 +8319,24 @@ int smlua_func_common_anchor_mario_behavior(lua_State* L) { } int smlua_func_cur_obj_spawn_strong_wind_particles(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_spawn_strong_wind_particles", 5, top); + return 0; + } s32 windSpread = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_spawn_strong_wind_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_spawn_strong_wind_particles"); return 0; } f32 scale = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_spawn_strong_wind_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_spawn_strong_wind_particles"); return 0; } f32 relPosX = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_spawn_strong_wind_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_spawn_strong_wind_particles"); return 0; } f32 relPosY = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'cur_obj_spawn_strong_wind_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "cur_obj_spawn_strong_wind_particles"); return 0; } f32 relPosZ = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'cur_obj_spawn_strong_wind_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "cur_obj_spawn_strong_wind_particles"); return 0; } cur_obj_spawn_strong_wind_particles(windSpread, scale, relPosX, relPosY, relPosZ); @@ -5045,14 +8345,20 @@ int smlua_func_cur_obj_spawn_strong_wind_particles(lua_State* L) { /* int smlua_func_geo_bits_bowser_coloring(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_bits_bowser_coloring", 3, top); + return 0; + } s32 run = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_bits_bowser_coloring'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_bits_bowser_coloring"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_bits_bowser_coloring'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_bits_bowser_coloring"); return 0; } s32 a2 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_bits_bowser_coloring'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_bits_bowser_coloring"); return 0; } UNIMPLEMENTED -->(L, geo_bits_bowser_coloring(run, node, a2)); @@ -5062,31 +8368,77 @@ int smlua_func_geo_bits_bowser_coloring(lua_State* L) { /* int smlua_func_geo_move_mario_part_from_parent(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_move_mario_part_from_parent", 3, top); + return 0; + } s32 run = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_move_mario_part_from_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_move_mario_part_from_parent"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_move_mario_part_from_parent'"); return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_move_mario_part_from_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_move_mario_part_from_parent"); return 0; } + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(3, "a"); + mtx[0][1] = smlua_get_number_field(3, "b"); + mtx[0][2] = smlua_get_number_field(3, "c"); + mtx[0][3] = smlua_get_number_field(3, "d"); + mtx[1][0] = smlua_get_number_field(3, "e"); + mtx[1][1] = smlua_get_number_field(3, "f"); + mtx[1][2] = smlua_get_number_field(3, "g"); + mtx[1][3] = smlua_get_number_field(3, "h"); + mtx[2][0] = smlua_get_number_field(3, "i"); + mtx[2][1] = smlua_get_number_field(3, "j"); + mtx[2][2] = smlua_get_number_field(3, "k"); + mtx[2][3] = smlua_get_number_field(3, "l"); + mtx[3][0] = smlua_get_number_field(3, "m"); + mtx[3][1] = smlua_get_number_field(3, "n"); + mtx[3][2] = smlua_get_number_field(3, "o"); + mtx[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_move_mario_part_from_parent"); return 0; } UNIMPLEMENTED -->(L, geo_move_mario_part_from_parent(run, node, mtx)); + smlua_push_number_field(3, "a", mtx[0][0]); + smlua_push_number_field(3, "b", mtx[0][1]); + smlua_push_number_field(3, "c", mtx[0][2]); + smlua_push_number_field(3, "d", mtx[0][3]); + smlua_push_number_field(3, "e", mtx[1][0]); + smlua_push_number_field(3, "f", mtx[1][1]); + smlua_push_number_field(3, "g", mtx[1][2]); + smlua_push_number_field(3, "h", mtx[1][3]); + smlua_push_number_field(3, "i", mtx[2][0]); + smlua_push_number_field(3, "j", mtx[2][1]); + smlua_push_number_field(3, "k", mtx[2][2]); + smlua_push_number_field(3, "l", mtx[2][3]); + smlua_push_number_field(3, "m", mtx[3][0]); + smlua_push_number_field(3, "n", mtx[3][1]); + smlua_push_number_field(3, "o", mtx[3][2]); + smlua_push_number_field(3, "p", mtx[3][3]); + return 1; } */ /* int smlua_func_geo_scale_bowser_key(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_scale_bowser_key", 3, top); + return 0; + } s32 run = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_scale_bowser_key'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_scale_bowser_key"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_scale_bowser_key'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_scale_bowser_key"); return 0; } f32 mtx[4][4] = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_scale_bowser_key'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_scale_bowser_key"); return 0; } UNIMPLEMENTED -->(L, geo_scale_bowser_key(run, node, mtx[4][4])); @@ -5096,14 +8448,20 @@ int smlua_func_geo_scale_bowser_key(lua_State* L) { /* int smlua_func_geo_snufit_move_mask(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_snufit_move_mask", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_snufit_move_mask'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_snufit_move_mask"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_snufit_move_mask'"); return 0; } -// Mat4 * c = (Mat4 *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_snufit_move_mask'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_snufit_move_mask"); return 0; } + Mat4 * c = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_snufit_move_mask"); return 0; } UNIMPLEMENTED -->(L, geo_snufit_move_mask(callContext, node, c)); @@ -5113,14 +8471,20 @@ int smlua_func_geo_snufit_move_mask(lua_State* L) { /* int smlua_func_geo_snufit_scale_body(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_snufit_scale_body", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_snufit_scale_body'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_snufit_scale_body"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_snufit_scale_body'"); return 0; } -// Mat4 * c = (Mat4 *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_snufit_scale_body'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_snufit_scale_body"); return 0; } + Mat4 * c = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_snufit_scale_body"); return 0; } UNIMPLEMENTED -->(L, geo_snufit_scale_body(callContext, node, c)); @@ -5130,14 +8494,20 @@ int smlua_func_geo_snufit_scale_body(lua_State* L) { /* int smlua_func_geo_switch_bowser_eyes(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_switch_bowser_eyes", 3, top); + return 0; + } s32 run = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_switch_bowser_eyes'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_switch_bowser_eyes"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_switch_bowser_eyes'"); return 0; } -// Mat4 * mtx = (Mat4 *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_switch_bowser_eyes'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_switch_bowser_eyes"); return 0; } + Mat4 * mtx = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_switch_bowser_eyes"); return 0; } UNIMPLEMENTED -->(L, geo_switch_bowser_eyes(run, node, mtx)); @@ -5147,14 +8517,20 @@ int smlua_func_geo_switch_bowser_eyes(lua_State* L) { /* int smlua_func_geo_switch_tuxie_mother_eyes(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_switch_tuxie_mother_eyes", 3, top); + return 0; + } s32 run = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_switch_tuxie_mother_eyes'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_switch_tuxie_mother_eyes"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_switch_tuxie_mother_eyes'"); return 0; } -// Mat4 * mtx = (Mat4 *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_switch_tuxie_mother_eyes'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_switch_tuxie_mother_eyes"); return 0; } + Mat4 * mtx = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_switch_tuxie_mother_eyes"); return 0; } UNIMPLEMENTED -->(L, geo_switch_tuxie_mother_eyes(run, node, mtx)); @@ -5164,40 +8540,126 @@ int smlua_func_geo_switch_tuxie_mother_eyes(lua_State* L) { /* int smlua_func_geo_update_body_rot_from_parent(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_update_body_rot_from_parent", 3, top); + return 0; + } s32 run = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_update_body_rot_from_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_update_body_rot_from_parent"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_update_body_rot_from_parent'"); return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_update_body_rot_from_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_update_body_rot_from_parent"); return 0; } + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(3, "a"); + mtx[0][1] = smlua_get_number_field(3, "b"); + mtx[0][2] = smlua_get_number_field(3, "c"); + mtx[0][3] = smlua_get_number_field(3, "d"); + mtx[1][0] = smlua_get_number_field(3, "e"); + mtx[1][1] = smlua_get_number_field(3, "f"); + mtx[1][2] = smlua_get_number_field(3, "g"); + mtx[1][3] = smlua_get_number_field(3, "h"); + mtx[2][0] = smlua_get_number_field(3, "i"); + mtx[2][1] = smlua_get_number_field(3, "j"); + mtx[2][2] = smlua_get_number_field(3, "k"); + mtx[2][3] = smlua_get_number_field(3, "l"); + mtx[3][0] = smlua_get_number_field(3, "m"); + mtx[3][1] = smlua_get_number_field(3, "n"); + mtx[3][2] = smlua_get_number_field(3, "o"); + mtx[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_update_body_rot_from_parent"); return 0; } UNIMPLEMENTED -->(L, geo_update_body_rot_from_parent(run, node, mtx)); + smlua_push_number_field(3, "a", mtx[0][0]); + smlua_push_number_field(3, "b", mtx[0][1]); + smlua_push_number_field(3, "c", mtx[0][2]); + smlua_push_number_field(3, "d", mtx[0][3]); + smlua_push_number_field(3, "e", mtx[1][0]); + smlua_push_number_field(3, "f", mtx[1][1]); + smlua_push_number_field(3, "g", mtx[1][2]); + smlua_push_number_field(3, "h", mtx[1][3]); + smlua_push_number_field(3, "i", mtx[2][0]); + smlua_push_number_field(3, "j", mtx[2][1]); + smlua_push_number_field(3, "k", mtx[2][2]); + smlua_push_number_field(3, "l", mtx[2][3]); + smlua_push_number_field(3, "m", mtx[3][0]); + smlua_push_number_field(3, "n", mtx[3][1]); + smlua_push_number_field(3, "o", mtx[3][2]); + smlua_push_number_field(3, "p", mtx[3][3]); + return 1; } */ /* int smlua_func_geo_update_held_mario_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_update_held_mario_pos", 3, top); + return 0; + } s32 run = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_update_held_mario_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_update_held_mario_pos"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_update_held_mario_pos'"); return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_update_held_mario_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_update_held_mario_pos"); return 0; } + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(3, "a"); + mtx[0][1] = smlua_get_number_field(3, "b"); + mtx[0][2] = smlua_get_number_field(3, "c"); + mtx[0][3] = smlua_get_number_field(3, "d"); + mtx[1][0] = smlua_get_number_field(3, "e"); + mtx[1][1] = smlua_get_number_field(3, "f"); + mtx[1][2] = smlua_get_number_field(3, "g"); + mtx[1][3] = smlua_get_number_field(3, "h"); + mtx[2][0] = smlua_get_number_field(3, "i"); + mtx[2][1] = smlua_get_number_field(3, "j"); + mtx[2][2] = smlua_get_number_field(3, "k"); + mtx[2][3] = smlua_get_number_field(3, "l"); + mtx[3][0] = smlua_get_number_field(3, "m"); + mtx[3][1] = smlua_get_number_field(3, "n"); + mtx[3][2] = smlua_get_number_field(3, "o"); + mtx[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_update_held_mario_pos"); return 0; } UNIMPLEMENTED -->(L, geo_update_held_mario_pos(run, node, mtx)); + smlua_push_number_field(3, "a", mtx[0][0]); + smlua_push_number_field(3, "b", mtx[0][1]); + smlua_push_number_field(3, "c", mtx[0][2]); + smlua_push_number_field(3, "d", mtx[0][3]); + smlua_push_number_field(3, "e", mtx[1][0]); + smlua_push_number_field(3, "f", mtx[1][1]); + smlua_push_number_field(3, "g", mtx[1][2]); + smlua_push_number_field(3, "h", mtx[1][3]); + smlua_push_number_field(3, "i", mtx[2][0]); + smlua_push_number_field(3, "j", mtx[2][1]); + smlua_push_number_field(3, "k", mtx[2][2]); + smlua_push_number_field(3, "l", mtx[2][3]); + smlua_push_number_field(3, "m", mtx[3][0]); + smlua_push_number_field(3, "n", mtx[3][1]); + smlua_push_number_field(3, "o", mtx[3][2]); + smlua_push_number_field(3, "p", mtx[3][3]); + return 1; } */ int smlua_func_mario_moving_fast_enough_to_make_piranha_plant_bite(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_moving_fast_enough_to_make_piranha_plant_bite", 0, top); + return 0; + } lua_pushinteger(L, mario_moving_fast_enough_to_make_piranha_plant_bite()); @@ -5206,7 +8668,13 @@ int smlua_func_mario_moving_fast_enough_to_make_piranha_plant_bite(UNUSED lua_St } int smlua_func_obj_set_secondary_camera_focus(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_secondary_camera_focus", 0, top); + return 0; + } obj_set_secondary_camera_focus(); @@ -5215,10 +8683,16 @@ int smlua_func_obj_set_secondary_camera_focus(UNUSED lua_State* L) { } int smlua_func_play_penguin_walking_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_penguin_walking_sound", 1, top); + return 0; + } s32 walk = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_penguin_walking_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_penguin_walking_sound"); return 0; } play_penguin_walking_sound(walk); @@ -5226,14 +8700,20 @@ int smlua_func_play_penguin_walking_sound(lua_State* L) { } int smlua_func_spawn_default_star(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_default_star", 3, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_default_star'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_default_star"); return 0; } f32 y = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_default_star'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_default_star"); return 0; } f32 z = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'spawn_default_star'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_default_star"); return 0; } smlua_push_object(L, LOT_OBJECT, spawn_default_star(x, y, z)); @@ -5241,7 +8721,13 @@ int smlua_func_spawn_default_star(lua_State* L) { } int smlua_func_spawn_mist_from_global(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_mist_from_global", 0, top); + return 0; + } spawn_mist_from_global(); @@ -5250,14 +8736,20 @@ int smlua_func_spawn_mist_from_global(UNUSED lua_State* L) { } int smlua_func_spawn_mist_particles_variable(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_mist_particles_variable", 3, top); + return 0; + } s32 count = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_mist_particles_variable'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_mist_particles_variable"); return 0; } s32 offsetY = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_mist_particles_variable'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_mist_particles_variable"); return 0; } f32 size = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'spawn_mist_particles_variable'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_mist_particles_variable"); return 0; } spawn_mist_particles_variable(count, offsetY, size); @@ -5265,14 +8757,20 @@ int smlua_func_spawn_mist_particles_variable(lua_State* L) { } int smlua_func_spawn_no_exit_star(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_no_exit_star", 3, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_no_exit_star'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_no_exit_star"); return 0; } f32 y = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_no_exit_star'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_no_exit_star"); return 0; } f32 z = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'spawn_no_exit_star'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_no_exit_star"); return 0; } smlua_push_object(L, LOT_OBJECT, spawn_no_exit_star(x, y, z)); @@ -5280,14 +8778,20 @@ int smlua_func_spawn_no_exit_star(lua_State* L) { } int smlua_func_spawn_red_coin_cutscene_star(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_red_coin_cutscene_star", 3, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_red_coin_cutscene_star'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_red_coin_cutscene_star"); return 0; } f32 y = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_red_coin_cutscene_star'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_red_coin_cutscene_star"); return 0; } f32 z = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'spawn_red_coin_cutscene_star'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_red_coin_cutscene_star"); return 0; } smlua_push_object(L, LOT_OBJECT, spawn_red_coin_cutscene_star(x, y, z)); @@ -5295,16 +8799,22 @@ int smlua_func_spawn_red_coin_cutscene_star(lua_State* L) { } int smlua_func_spawn_triangle_break_particles(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_triangle_break_particles", 4, top); + return 0; + } s16 numTris = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_triangle_break_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_triangle_break_particles"); return 0; } s16 triModel = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_triangle_break_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_triangle_break_particles"); return 0; } f32 triSize = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'spawn_triangle_break_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_triangle_break_particles"); return 0; } s16 triAnimState = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'spawn_triangle_break_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_triangle_break_particles"); return 0; } spawn_triangle_break_particles(numTris, triModel, triSize, triAnimState); @@ -5312,12 +8822,18 @@ int smlua_func_spawn_triangle_break_particles(lua_State* L) { } int smlua_func_spawn_wind_particles(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_wind_particles", 2, top); + return 0; + } s16 pitch = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_wind_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_wind_particles"); return 0; } s16 yaw = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_wind_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_wind_particles"); return 0; } spawn_wind_particles(pitch, yaw); @@ -5325,16 +8841,22 @@ int smlua_func_spawn_wind_particles(lua_State* L) { } int smlua_func_tox_box_move(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "tox_box_move", 4, top); + return 0; + } f32 forwardVel = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'tox_box_move'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "tox_box_move"); return 0; } f32 a1 = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'tox_box_move'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "tox_box_move"); return 0; } s16 deltaPitch = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'tox_box_move'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "tox_box_move"); return 0; } s16 deltaRoll = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'tox_box_move'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "tox_box_move"); return 0; } tox_box_move(forwardVel, a1, deltaPitch, deltaRoll); @@ -5342,10 +8864,16 @@ int smlua_func_tox_box_move(lua_State* L) { } int smlua_func_update_angle_from_move_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_angle_from_move_flags", 1, top); + return 0; + } s32 * angle = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_angle_from_move_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_angle_from_move_flags"); return 0; } lua_pushinteger(L, update_angle_from_move_flags(angle)); @@ -5353,7 +8881,13 @@ int smlua_func_update_angle_from_move_flags(lua_State* L) { } int smlua_func_uv_update_scroll(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "uv_update_scroll", 0, top); + return 0; + } uv_update_scroll(); @@ -5362,20 +8896,26 @@ int smlua_func_uv_update_scroll(UNUSED lua_State* L) { } int smlua_func_vec3f_copy_2(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_copy_2", 2, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_copy_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_copy_2"); return 0; } f32* src = smlua_get_vec3f_from_buffer(); src[0] = smlua_get_number_field(2, "x"); src[1] = smlua_get_number_field(2, "y"); src[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_copy_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_copy_2"); return 0; } vec3f_copy_2(dest, src); @@ -5395,10 +8935,16 @@ int smlua_func_vec3f_copy_2(lua_State* L) { ////////////////////// int smlua_func_get_behavior_from_id(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_behavior_from_id", 1, top); + return 0; + } int id = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_behavior_from_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_behavior_from_id"); return 0; } smlua_push_pointer(L, LVT_BEHAVIORSCRIPT_P, (void*)get_behavior_from_id(id)); @@ -5406,10 +8952,16 @@ int smlua_func_get_behavior_from_id(lua_State* L) { } int smlua_func_get_behavior_name_from_id(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_behavior_name_from_id", 1, top); + return 0; + } int id = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_behavior_name_from_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_behavior_name_from_id"); return 0; } lua_pushstring(L, get_behavior_name_from_id(id)); @@ -5417,10 +8969,16 @@ int smlua_func_get_behavior_name_from_id(lua_State* L) { } int smlua_func_get_id_from_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_id_from_behavior", 1, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_id_from_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_id_from_behavior"); return 0; } lua_pushinteger(L, get_id_from_behavior(behavior)); @@ -5428,10 +8986,16 @@ int smlua_func_get_id_from_behavior(lua_State* L) { } int smlua_func_get_id_from_behavior_name(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_id_from_behavior_name", 1, top); + return 0; + } const char* name = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_id_from_behavior_name'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_id_from_behavior_name"); return 0; } lua_pushinteger(L, get_id_from_behavior_name(name)); @@ -5439,10 +9003,16 @@ int smlua_func_get_id_from_behavior_name(lua_State* L) { } int smlua_func_get_id_from_vanilla_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_id_from_vanilla_behavior", 1, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_id_from_vanilla_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_id_from_vanilla_behavior"); return 0; } lua_pushinteger(L, get_id_from_vanilla_behavior(behavior)); @@ -5454,14 +9024,20 @@ int smlua_func_get_id_from_vanilla_behavior(lua_State* L) { ////////////// int smlua_func_approach_camera_height(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_camera_height", 3, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_camera_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_camera_height"); return 0; } f32 goal = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_camera_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_camera_height"); return 0; } f32 inc = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_camera_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_camera_height"); return 0; } approach_camera_height(c, goal, inc); @@ -5469,14 +9045,20 @@ int smlua_func_approach_camera_height(lua_State* L) { } int smlua_func_approach_f32_asymptotic(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_f32_asymptotic", 3, top); + return 0; + } f32 current = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_f32_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_f32_asymptotic"); return 0; } f32 target = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_f32_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_f32_asymptotic"); return 0; } f32 multiplier = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_f32_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_f32_asymptotic"); return 0; } lua_pushnumber(L, approach_f32_asymptotic(current, target, multiplier)); @@ -5484,14 +9066,20 @@ int smlua_func_approach_f32_asymptotic(lua_State* L) { } int smlua_func_approach_f32_asymptotic_bool(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_f32_asymptotic_bool", 3, top); + return 0; + } f32 * current = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_f32_asymptotic_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_f32_asymptotic_bool"); return 0; } f32 target = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_f32_asymptotic_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_f32_asymptotic_bool"); return 0; } f32 multiplier = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_f32_asymptotic_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_f32_asymptotic_bool"); return 0; } lua_pushinteger(L, approach_f32_asymptotic_bool(current, target, multiplier)); @@ -5499,14 +9087,20 @@ int smlua_func_approach_f32_asymptotic_bool(lua_State* L) { } int smlua_func_approach_s16_asymptotic(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_s16_asymptotic", 3, top); + return 0; + } s16 current = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_s16_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_s16_asymptotic"); return 0; } s16 target = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_s16_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_s16_asymptotic"); return 0; } s16 divisor = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_s16_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_s16_asymptotic"); return 0; } lua_pushinteger(L, approach_s16_asymptotic(current, target, divisor)); @@ -5514,14 +9108,20 @@ int smlua_func_approach_s16_asymptotic(lua_State* L) { } int smlua_func_approach_s16_asymptotic_bool(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_s16_asymptotic_bool", 3, top); + return 0; + } s16 * current = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_s16_asymptotic_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_s16_asymptotic_bool"); return 0; } s16 target = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_s16_asymptotic_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_s16_asymptotic_bool"); return 0; } s16 divisor = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_s16_asymptotic_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_s16_asymptotic_bool"); return 0; } lua_pushinteger(L, approach_s16_asymptotic_bool(current, target, divisor)); @@ -5529,26 +9129,32 @@ int smlua_func_approach_s16_asymptotic_bool(lua_State* L) { } int smlua_func_approach_vec3f_asymptotic(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_vec3f_asymptotic", 5, top); + return 0; + } f32* current = smlua_get_vec3f_from_buffer(); current[0] = smlua_get_number_field(1, "x"); current[1] = smlua_get_number_field(1, "y"); current[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_vec3f_asymptotic"); return 0; } f32* target = smlua_get_vec3f_from_buffer(); target[0] = smlua_get_number_field(2, "x"); target[1] = smlua_get_number_field(2, "y"); target[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_vec3f_asymptotic"); return 0; } f32 xMul = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_vec3f_asymptotic"); return 0; } f32 yMul = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "approach_vec3f_asymptotic"); return 0; } f32 zMul = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "approach_vec3f_asymptotic"); return 0; } approach_vec3f_asymptotic(current, target, xMul, yMul, zMul); @@ -5564,20 +9170,26 @@ int smlua_func_approach_vec3f_asymptotic(lua_State* L) { } int smlua_func_calc_abs_dist(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calc_abs_dist", 2, top); + return 0; + } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(1, "x"); a[1] = smlua_get_number_field(1, "y"); a[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calc_abs_dist'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_abs_dist"); return 0; } f32* b = smlua_get_vec3f_from_buffer(); b[0] = smlua_get_number_field(2, "x"); b[1] = smlua_get_number_field(2, "y"); b[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'calc_abs_dist'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calc_abs_dist"); return 0; } lua_pushnumber(L, calc_abs_dist(a, b)); @@ -5593,20 +9205,26 @@ int smlua_func_calc_abs_dist(lua_State* L) { } int smlua_func_calc_hor_dist(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calc_hor_dist", 2, top); + return 0; + } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(1, "x"); a[1] = smlua_get_number_field(1, "y"); a[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calc_hor_dist'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_hor_dist"); return 0; } f32* b = smlua_get_vec3f_from_buffer(); b[0] = smlua_get_number_field(2, "x"); b[1] = smlua_get_number_field(2, "y"); b[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'calc_hor_dist'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calc_hor_dist"); return 0; } lua_pushnumber(L, calc_hor_dist(a, b)); @@ -5622,24 +9240,30 @@ int smlua_func_calc_hor_dist(lua_State* L) { } int smlua_func_calculate_angles(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calculate_angles", 4, top); + return 0; + } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(1, "x"); from[1] = smlua_get_number_field(1, "y"); from[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calculate_angles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calculate_angles"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(2, "x"); to[1] = smlua_get_number_field(2, "y"); to[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'calculate_angles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calculate_angles"); return 0; } s16 * pitch = (s16 *)smlua_to_cpointer(L, 3, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'calculate_angles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "calculate_angles"); return 0; } s16 * yaw = (s16 *)smlua_to_cpointer(L, 4, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'calculate_angles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "calculate_angles"); return 0; } calculate_angles(from, to, pitch, yaw); @@ -5655,20 +9279,26 @@ int smlua_func_calculate_angles(lua_State* L) { } int smlua_func_calculate_pitch(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calculate_pitch", 2, top); + return 0; + } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(1, "x"); from[1] = smlua_get_number_field(1, "y"); from[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calculate_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calculate_pitch"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(2, "x"); to[1] = smlua_get_number_field(2, "y"); to[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'calculate_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calculate_pitch"); return 0; } lua_pushinteger(L, calculate_pitch(from, to)); @@ -5684,20 +9314,26 @@ int smlua_func_calculate_pitch(lua_State* L) { } int smlua_func_calculate_yaw(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calculate_yaw", 2, top); + return 0; + } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(1, "x"); from[1] = smlua_get_number_field(1, "y"); from[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calculate_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calculate_yaw"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(2, "x"); to[1] = smlua_get_number_field(2, "y"); to[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'calculate_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calculate_yaw"); return 0; } lua_pushinteger(L, calculate_yaw(from, to)); @@ -5713,10 +9349,16 @@ int smlua_func_calculate_yaw(lua_State* L) { } int smlua_func_cam_select_alt_mode(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cam_select_alt_mode", 1, top); + return 0; + } s32 angle = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cam_select_alt_mode'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cam_select_alt_mode"); return 0; } lua_pushinteger(L, cam_select_alt_mode(angle)); @@ -5724,14 +9366,20 @@ int smlua_func_cam_select_alt_mode(lua_State* L) { } int smlua_func_camera_approach_f32_symmetric(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_approach_f32_symmetric", 3, top); + return 0; + } f32 value = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_approach_f32_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_approach_f32_symmetric"); return 0; } f32 target = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'camera_approach_f32_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "camera_approach_f32_symmetric"); return 0; } f32 increment = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'camera_approach_f32_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "camera_approach_f32_symmetric"); return 0; } lua_pushnumber(L, camera_approach_f32_symmetric(value, target, increment)); @@ -5739,14 +9387,20 @@ int smlua_func_camera_approach_f32_symmetric(lua_State* L) { } int smlua_func_camera_approach_f32_symmetric_bool(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_approach_f32_symmetric_bool", 3, top); + return 0; + } f32 * current = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_approach_f32_symmetric_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_approach_f32_symmetric_bool"); return 0; } f32 target = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'camera_approach_f32_symmetric_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "camera_approach_f32_symmetric_bool"); return 0; } f32 increment = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'camera_approach_f32_symmetric_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "camera_approach_f32_symmetric_bool"); return 0; } lua_pushinteger(L, camera_approach_f32_symmetric_bool(current, target, increment)); @@ -5754,14 +9408,20 @@ int smlua_func_camera_approach_f32_symmetric_bool(lua_State* L) { } int smlua_func_camera_approach_s16_symmetric_bool(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_approach_s16_symmetric_bool", 3, top); + return 0; + } s16 * current = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_approach_s16_symmetric_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_approach_s16_symmetric_bool"); return 0; } s16 target = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'camera_approach_s16_symmetric_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "camera_approach_s16_symmetric_bool"); return 0; } s16 increment = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'camera_approach_s16_symmetric_bool'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "camera_approach_s16_symmetric_bool"); return 0; } lua_pushinteger(L, camera_approach_s16_symmetric_bool(current, target, increment)); @@ -5769,10 +9429,16 @@ int smlua_func_camera_approach_s16_symmetric_bool(lua_State* L) { } int smlua_func_camera_course_processing(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_course_processing", 1, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_course_processing'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_course_processing"); return 0; } lua_pushinteger(L, camera_course_processing(c)); @@ -5780,10 +9446,16 @@ int smlua_func_camera_course_processing(lua_State* L) { } int smlua_func_camera_set_use_course_specific_settings(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_set_use_course_specific_settings", 1, top); + return 0; + } u8 enable = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_set_use_course_specific_settings'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_set_use_course_specific_settings"); return 0; } camera_set_use_course_specific_settings(enable); @@ -5791,7 +9463,13 @@ int smlua_func_camera_set_use_course_specific_settings(lua_State* L) { } int smlua_func_center_rom_hack_camera(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "center_rom_hack_camera", 0, top); + return 0; + } center_rom_hack_camera(); @@ -5800,24 +9478,30 @@ int smlua_func_center_rom_hack_camera(UNUSED lua_State* L) { } int smlua_func_clamp_pitch(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clamp_pitch", 4, top); + return 0; + } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(1, "x"); from[1] = smlua_get_number_field(1, "y"); from[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'clamp_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "clamp_pitch"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(2, "x"); to[1] = smlua_get_number_field(2, "y"); to[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'clamp_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "clamp_pitch"); return 0; } s16 maxPitch = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'clamp_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "clamp_pitch"); return 0; } s16 minPitch = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'clamp_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "clamp_pitch"); return 0; } lua_pushinteger(L, clamp_pitch(from, to, maxPitch, minPitch)); @@ -5833,28 +9517,34 @@ int smlua_func_clamp_pitch(lua_State* L) { } int smlua_func_clamp_positions_and_find_yaw(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clamp_positions_and_find_yaw", 6, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'clamp_positions_and_find_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "clamp_positions_and_find_yaw"); return 0; } f32* origin = smlua_get_vec3f_from_buffer(); origin[0] = smlua_get_number_field(2, "x"); origin[1] = smlua_get_number_field(2, "y"); origin[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'clamp_positions_and_find_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "clamp_positions_and_find_yaw"); return 0; } f32 xMax = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'clamp_positions_and_find_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "clamp_positions_and_find_yaw"); return 0; } f32 xMin = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'clamp_positions_and_find_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "clamp_positions_and_find_yaw"); return 0; } f32 zMax = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'clamp_positions_and_find_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "clamp_positions_and_find_yaw"); return 0; } f32 zMin = smlua_to_number(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'clamp_positions_and_find_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "clamp_positions_and_find_yaw"); return 0; } lua_pushinteger(L, clamp_positions_and_find_yaw(pos, origin, xMax, xMin, zMax, zMin)); @@ -5870,18 +9560,24 @@ int smlua_func_clamp_positions_and_find_yaw(lua_State* L) { } int smlua_func_collide_with_walls(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "collide_with_walls", 3, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'collide_with_walls'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "collide_with_walls"); return 0; } f32 offsetY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'collide_with_walls'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "collide_with_walls"); return 0; } f32 radius = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'collide_with_walls'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "collide_with_walls"); return 0; } lua_pushinteger(L, collide_with_walls(pos, offsetY, radius)); @@ -5894,16 +9590,22 @@ int smlua_func_collide_with_walls(lua_State* L) { /* int smlua_func_cutscene_event(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cutscene_event", 4, top); + return 0; + } // CameraEvent event = (CameraEvent)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cutscene_event'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cutscene_event"); return 0; } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 2, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cutscene_event'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cutscene_event"); return 0; } s16 start = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cutscene_event'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cutscene_event"); return 0; } s16 end = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'cutscene_event'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "cutscene_event"); return 0; } lua_pushinteger(L, cutscene_event(event, c, start, end)); @@ -5912,12 +9614,18 @@ int smlua_func_cutscene_event(lua_State* L) { */ int smlua_func_cutscene_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cutscene_object", 2, top); + return 0; + } u8 cutscene = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cutscene_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cutscene_object"); return 0; } struct Object* o = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cutscene_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cutscene_object"); return 0; } lua_pushinteger(L, cutscene_object(cutscene, o)); @@ -5925,14 +9633,20 @@ int smlua_func_cutscene_object(lua_State* L) { } int smlua_func_cutscene_object_with_dialog(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cutscene_object_with_dialog", 3, top); + return 0; + } u8 cutscene = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cutscene_object_with_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cutscene_object_with_dialog"); return 0; } struct Object* o = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cutscene_object_with_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cutscene_object_with_dialog"); return 0; } s16 dialogID = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cutscene_object_with_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cutscene_object_with_dialog"); return 0; } lua_pushinteger(L, cutscene_object_with_dialog(cutscene, o, dialogID)); @@ -5940,12 +9654,18 @@ int smlua_func_cutscene_object_with_dialog(lua_State* L) { } int smlua_func_cutscene_object_without_dialog(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cutscene_object_without_dialog", 2, top); + return 0; + } u8 cutscene = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cutscene_object_without_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cutscene_object_without_dialog"); return 0; } struct Object* o = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cutscene_object_without_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cutscene_object_without_dialog"); return 0; } lua_pushinteger(L, cutscene_object_without_dialog(cutscene, o)); @@ -5953,10 +9673,16 @@ int smlua_func_cutscene_object_without_dialog(lua_State* L) { } int smlua_func_cutscene_set_fov_shake_preset(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cutscene_set_fov_shake_preset", 1, top); + return 0; + } u8 preset = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cutscene_set_fov_shake_preset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cutscene_set_fov_shake_preset"); return 0; } cutscene_set_fov_shake_preset(preset); @@ -5964,12 +9690,18 @@ int smlua_func_cutscene_set_fov_shake_preset(lua_State* L) { } int smlua_func_cutscene_spawn_obj(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cutscene_spawn_obj", 2, top); + return 0; + } u32 obj = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cutscene_spawn_obj'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cutscene_spawn_obj"); return 0; } s16 frame = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cutscene_spawn_obj'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cutscene_spawn_obj"); return 0; } lua_pushinteger(L, cutscene_spawn_obj(obj, frame)); @@ -5977,14 +9709,20 @@ int smlua_func_cutscene_spawn_obj(lua_State* L) { } int smlua_func_find_c_buttons_pressed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_c_buttons_pressed", 3, top); + return 0; + } u16 currentState = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_c_buttons_pressed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_c_buttons_pressed"); return 0; } u16 buttonsPressed = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_c_buttons_pressed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_c_buttons_pressed"); return 0; } u16 buttonsDown = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_c_buttons_pressed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_c_buttons_pressed"); return 0; } lua_pushinteger(L, find_c_buttons_pressed(currentState, buttonsPressed, buttonsDown)); @@ -5992,10 +9730,16 @@ int smlua_func_find_c_buttons_pressed(lua_State* L) { } int smlua_func_find_mario_floor_and_ceil(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_mario_floor_and_ceil", 1, top); + return 0; + } struct PlayerGeometry* pg = (struct PlayerGeometry*)smlua_to_cobject(L, 1, LOT_PLAYERGEOMETRY); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_mario_floor_and_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_mario_floor_and_ceil"); return 0; } find_mario_floor_and_ceil(pg); @@ -6004,14 +9748,20 @@ int smlua_func_find_mario_floor_and_ceil(lua_State* L) { /* int smlua_func_geo_camera_fov(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_camera_fov", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_camera_fov'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_camera_fov"); return 0; } struct GraphNode* g = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_camera_fov'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_camera_fov"); return 0; } // void * context = (void *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_camera_fov'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_camera_fov"); return 0; } UNIMPLEMENTED -->(L, geo_camera_fov(callContext, g, context)); @@ -6021,14 +9771,20 @@ int smlua_func_geo_camera_fov(lua_State* L) { /* int smlua_func_geo_camera_main(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_camera_main", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_camera_main'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_camera_main"); return 0; } struct GraphNode* g = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_camera_main'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_camera_main"); return 0; } // void * context = (void *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_camera_main'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_camera_main"); return 0; } UNIMPLEMENTED -->(L, geo_camera_main(callContext, g, context)); @@ -6037,10 +9793,16 @@ int smlua_func_geo_camera_main(lua_State* L) { */ int smlua_func_get_cutscene_from_mario_status(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_cutscene_from_mario_status", 1, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_cutscene_from_mario_status'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_cutscene_from_mario_status"); return 0; } lua_pushinteger(L, get_cutscene_from_mario_status(c)); @@ -6048,10 +9810,16 @@ int smlua_func_get_cutscene_from_mario_status(lua_State* L) { } int smlua_func_handle_c_button_movement(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "handle_c_button_movement", 1, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'handle_c_button_movement'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "handle_c_button_movement"); return 0; } handle_c_button_movement(c); @@ -6059,26 +9827,32 @@ int smlua_func_handle_c_button_movement(lua_State* L) { } int smlua_func_is_range_behind_surface(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_range_behind_surface", 5, top); + return 0; + } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(1, "x"); from[1] = smlua_get_number_field(1, "y"); from[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_range_behind_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_range_behind_surface"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(2, "x"); to[1] = smlua_get_number_field(2, "y"); to[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'is_range_behind_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "is_range_behind_surface"); return 0; } struct Surface* surf = (struct Surface*)smlua_to_cobject(L, 3, LOT_SURFACE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'is_range_behind_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "is_range_behind_surface"); return 0; } s16 range = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'is_range_behind_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "is_range_behind_surface"); return 0; } s16 surfType = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'is_range_behind_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "is_range_behind_surface"); return 0; } lua_pushinteger(L, is_range_behind_surface(from, to, surf, range, surfType)); @@ -6094,14 +9868,20 @@ int smlua_func_is_range_behind_surface(lua_State* L) { } int smlua_func_is_within_100_units_of_mario(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_within_100_units_of_mario", 3, top); + return 0; + } f32 posX = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_within_100_units_of_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_within_100_units_of_mario"); return 0; } f32 posY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'is_within_100_units_of_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "is_within_100_units_of_mario"); return 0; } f32 posZ = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'is_within_100_units_of_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "is_within_100_units_of_mario"); return 0; } lua_pushinteger(L, is_within_100_units_of_mario(posX, posY, posZ)); @@ -6109,10 +9889,16 @@ int smlua_func_is_within_100_units_of_mario(lua_State* L) { } int smlua_func_move_mario_head_c_up(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "move_mario_head_c_up", 1, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'move_mario_head_c_up'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "move_mario_head_c_up"); return 0; } move_mario_head_c_up(c); @@ -6120,46 +9906,52 @@ int smlua_func_move_mario_head_c_up(lua_State* L) { } int smlua_func_next_lakitu_state(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 7)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 7) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "next_lakitu_state", 7, top); + return 0; + } f32* newPos = smlua_get_vec3f_from_buffer(); newPos[0] = smlua_get_number_field(1, "x"); newPos[1] = smlua_get_number_field(1, "y"); newPos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'next_lakitu_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "next_lakitu_state"); return 0; } f32* newFoc = smlua_get_vec3f_from_buffer(); newFoc[0] = smlua_get_number_field(2, "x"); newFoc[1] = smlua_get_number_field(2, "y"); newFoc[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'next_lakitu_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "next_lakitu_state"); return 0; } f32* curPos = smlua_get_vec3f_from_buffer(); curPos[0] = smlua_get_number_field(3, "x"); curPos[1] = smlua_get_number_field(3, "y"); curPos[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'next_lakitu_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "next_lakitu_state"); return 0; } f32* curFoc = smlua_get_vec3f_from_buffer(); curFoc[0] = smlua_get_number_field(4, "x"); curFoc[1] = smlua_get_number_field(4, "y"); curFoc[2] = smlua_get_number_field(4, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'next_lakitu_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "next_lakitu_state"); return 0; } f32* oldPos = smlua_get_vec3f_from_buffer(); oldPos[0] = smlua_get_number_field(5, "x"); oldPos[1] = smlua_get_number_field(5, "y"); oldPos[2] = smlua_get_number_field(5, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'next_lakitu_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "next_lakitu_state"); return 0; } f32* oldFoc = smlua_get_vec3f_from_buffer(); oldFoc[0] = smlua_get_number_field(6, "x"); oldFoc[1] = smlua_get_number_field(6, "y"); oldFoc[2] = smlua_get_number_field(6, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'next_lakitu_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "next_lakitu_state"); return 0; } s16 yaw = smlua_to_integer(L, 7); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'next_lakitu_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "next_lakitu_state"); return 0; } lua_pushinteger(L, next_lakitu_state(newPos, newFoc, curPos, curFoc, oldPos, oldFoc, yaw)); @@ -6191,24 +9983,30 @@ int smlua_func_next_lakitu_state(lua_State* L) { } int smlua_func_obj_rotate_towards_point(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_rotate_towards_point", 6, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_rotate_towards_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_rotate_towards_point"); return 0; } f32* point = smlua_get_vec3f_from_buffer(); point[0] = smlua_get_number_field(2, "x"); point[1] = smlua_get_number_field(2, "y"); point[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_rotate_towards_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_rotate_towards_point"); return 0; } s16 pitchOff = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_rotate_towards_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_rotate_towards_point"); return 0; } s16 yawOff = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_rotate_towards_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_rotate_towards_point"); return 0; } s16 pitchDiv = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_rotate_towards_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_rotate_towards_point"); return 0; } s16 yawDiv = smlua_to_integer(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'obj_rotate_towards_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "obj_rotate_towards_point"); return 0; } obj_rotate_towards_point(o, point, pitchOff, yawOff, pitchDiv, yawDiv); @@ -6220,16 +10018,22 @@ int smlua_func_obj_rotate_towards_point(lua_State* L) { } int smlua_func_object_pos_to_vec3f(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "object_pos_to_vec3f", 2, top); + return 0; + } f32* dst = smlua_get_vec3f_from_buffer(); dst[0] = smlua_get_number_field(1, "x"); dst[1] = smlua_get_number_field(1, "y"); dst[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'object_pos_to_vec3f'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "object_pos_to_vec3f"); return 0; } struct Object* o = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'object_pos_to_vec3f'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "object_pos_to_vec3f"); return 0; } object_pos_to_vec3f(dst, o); @@ -6241,32 +10045,38 @@ int smlua_func_object_pos_to_vec3f(lua_State* L) { } int smlua_func_offset_rotated(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "offset_rotated", 4, top); + return 0; + } f32* dst = smlua_get_vec3f_from_buffer(); dst[0] = smlua_get_number_field(1, "x"); dst[1] = smlua_get_number_field(1, "y"); dst[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'offset_rotated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "offset_rotated"); return 0; } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(2, "x"); from[1] = smlua_get_number_field(2, "y"); from[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'offset_rotated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "offset_rotated"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(3, "x"); to[1] = smlua_get_number_field(3, "y"); to[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'offset_rotated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "offset_rotated"); return 0; } s16* rotation = smlua_get_vec3s_from_buffer(); rotation[0] = smlua_get_integer_field(4, "x"); rotation[1] = smlua_get_integer_field(4, "y"); rotation[2] = smlua_get_integer_field(4, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'offset_rotated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "offset_rotated"); return 0; } offset_rotated(dst, from, to, rotation); @@ -6290,12 +10100,18 @@ int smlua_func_offset_rotated(lua_State* L) { } int smlua_func_offset_yaw_outward_radial(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "offset_yaw_outward_radial", 2, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'offset_yaw_outward_radial'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "offset_yaw_outward_radial"); return 0; } s16 areaYaw = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'offset_yaw_outward_radial'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "offset_yaw_outward_radial"); return 0; } lua_pushinteger(L, offset_yaw_outward_radial(c, areaYaw)); @@ -6303,7 +10119,13 @@ int smlua_func_offset_yaw_outward_radial(lua_State* L) { } int smlua_func_play_camera_buzz_if_c_sideways(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_camera_buzz_if_c_sideways", 0, top); + return 0; + } play_camera_buzz_if_c_sideways(); @@ -6312,7 +10134,13 @@ int smlua_func_play_camera_buzz_if_c_sideways(UNUSED lua_State* L) { } int smlua_func_play_camera_buzz_if_cbutton(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_camera_buzz_if_cbutton", 0, top); + return 0; + } play_camera_buzz_if_cbutton(); @@ -6321,7 +10149,13 @@ int smlua_func_play_camera_buzz_if_cbutton(UNUSED lua_State* L) { } int smlua_func_play_camera_buzz_if_cdown(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_camera_buzz_if_cdown", 0, top); + return 0; + } play_camera_buzz_if_cdown(); @@ -6330,10 +10164,16 @@ int smlua_func_play_camera_buzz_if_cdown(UNUSED lua_State* L) { } int smlua_func_play_cutscene(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_cutscene", 1, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_cutscene'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_cutscene"); return 0; } play_cutscene(c); @@ -6341,7 +10181,13 @@ int smlua_func_play_cutscene(lua_State* L) { } int smlua_func_play_sound_button_change_blocked(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound_button_change_blocked", 0, top); + return 0; + } play_sound_button_change_blocked(); @@ -6350,7 +10196,13 @@ int smlua_func_play_sound_button_change_blocked(UNUSED lua_State* L) { } int smlua_func_play_sound_cbutton_down(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound_cbutton_down", 0, top); + return 0; + } play_sound_cbutton_down(); @@ -6359,7 +10211,13 @@ int smlua_func_play_sound_cbutton_down(UNUSED lua_State* L) { } int smlua_func_play_sound_cbutton_side(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound_cbutton_side", 0, top); + return 0; + } play_sound_cbutton_side(); @@ -6368,7 +10226,13 @@ int smlua_func_play_sound_cbutton_side(UNUSED lua_State* L) { } int smlua_func_play_sound_cbutton_up(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound_cbutton_up", 0, top); + return 0; + } play_sound_cbutton_up(); @@ -6377,7 +10241,13 @@ int smlua_func_play_sound_cbutton_up(UNUSED lua_State* L) { } int smlua_func_play_sound_if_cam_switched_to_lakitu_or_mario(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound_if_cam_switched_to_lakitu_or_mario", 0, top); + return 0; + } play_sound_if_cam_switched_to_lakitu_or_mario(); @@ -6386,7 +10256,13 @@ int smlua_func_play_sound_if_cam_switched_to_lakitu_or_mario(UNUSED lua_State* L } int smlua_func_play_sound_rbutton_changed(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound_rbutton_changed", 0, top); + return 0; + } play_sound_rbutton_changed(); @@ -6395,12 +10271,18 @@ int smlua_func_play_sound_rbutton_changed(UNUSED lua_State* L) { } int smlua_func_radial_camera_input(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "radial_camera_input", 2, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'radial_camera_input'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "radial_camera_input"); return 0; } f32 unused = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'radial_camera_input'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "radial_camera_input"); return 0; } lua_pushinteger(L, radial_camera_input(c, unused)); @@ -6408,20 +10290,26 @@ int smlua_func_radial_camera_input(lua_State* L) { } int smlua_func_random_vec3s(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "random_vec3s", 4, top); + return 0; + } s16* dst = smlua_get_vec3s_from_buffer(); dst[0] = smlua_get_integer_field(1, "x"); dst[1] = smlua_get_integer_field(1, "y"); dst[2] = smlua_get_integer_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'random_vec3s'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "random_vec3s"); return 0; } s16 xRange = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'random_vec3s'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "random_vec3s"); return 0; } s16 yRange = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'random_vec3s'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "random_vec3s"); return 0; } s16 zRange = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'random_vec3s'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "random_vec3s"); return 0; } random_vec3s(dst, xRange, yRange, zRange); @@ -6433,10 +10321,16 @@ int smlua_func_random_vec3s(lua_State* L) { } int smlua_func_reset_camera(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "reset_camera", 1, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'reset_camera'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "reset_camera"); return 0; } reset_camera(c); @@ -6444,20 +10338,26 @@ int smlua_func_reset_camera(lua_State* L) { } int smlua_func_resolve_geometry_collisions(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "resolve_geometry_collisions", 2, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'resolve_geometry_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "resolve_geometry_collisions"); return 0; } f32* lastGood = smlua_get_vec3f_from_buffer(); lastGood[0] = smlua_get_number_field(2, "x"); lastGood[1] = smlua_get_number_field(2, "y"); lastGood[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'resolve_geometry_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "resolve_geometry_collisions"); return 0; } resolve_geometry_collisions(pos, lastGood); @@ -6473,10 +10373,16 @@ int smlua_func_resolve_geometry_collisions(lua_State* L) { } int smlua_func_rom_hack_cam_set_collisions(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "rom_hack_cam_set_collisions", 1, top); + return 0; + } u8 enable = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'rom_hack_cam_set_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "rom_hack_cam_set_collisions"); return 0; } rom_hack_cam_set_collisions(enable); @@ -6484,20 +10390,26 @@ int smlua_func_rom_hack_cam_set_collisions(lua_State* L) { } int smlua_func_rotate_camera_around_walls(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "rotate_camera_around_walls", 4, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'rotate_camera_around_walls'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "rotate_camera_around_walls"); return 0; } f32* cPos = smlua_get_vec3f_from_buffer(); cPos[0] = smlua_get_number_field(2, "x"); cPos[1] = smlua_get_number_field(2, "y"); cPos[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'rotate_camera_around_walls'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "rotate_camera_around_walls"); return 0; } s16 * avoidYaw = (s16 *)smlua_to_cpointer(L, 3, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'rotate_camera_around_walls'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "rotate_camera_around_walls"); return 0; } s16 yawRange = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'rotate_camera_around_walls'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "rotate_camera_around_walls"); return 0; } lua_pushinteger(L, rotate_camera_around_walls(c, cPos, avoidYaw, yawRange)); @@ -6509,22 +10421,28 @@ int smlua_func_rotate_camera_around_walls(lua_State* L) { } int smlua_func_rotate_in_xz(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "rotate_in_xz", 3, top); + return 0; + } f32* dst = smlua_get_vec3f_from_buffer(); dst[0] = smlua_get_number_field(1, "x"); dst[1] = smlua_get_number_field(1, "y"); dst[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'rotate_in_xz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "rotate_in_xz"); return 0; } f32* src = smlua_get_vec3f_from_buffer(); src[0] = smlua_get_number_field(2, "x"); src[1] = smlua_get_number_field(2, "y"); src[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'rotate_in_xz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "rotate_in_xz"); return 0; } s16 yaw = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'rotate_in_xz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "rotate_in_xz"); return 0; } rotate_in_xz(dst, src, yaw); @@ -6540,22 +10458,28 @@ int smlua_func_rotate_in_xz(lua_State* L) { } int smlua_func_rotate_in_yz(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "rotate_in_yz", 3, top); + return 0; + } f32* dst = smlua_get_vec3f_from_buffer(); dst[0] = smlua_get_number_field(1, "x"); dst[1] = smlua_get_number_field(1, "y"); dst[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'rotate_in_yz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "rotate_in_yz"); return 0; } f32* src = smlua_get_vec3f_from_buffer(); src[0] = smlua_get_number_field(2, "x"); src[1] = smlua_get_number_field(2, "y"); src[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'rotate_in_yz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "rotate_in_yz"); return 0; } s16 pitch = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'rotate_in_yz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "rotate_in_yz"); return 0; } rotate_in_yz(dst, src, pitch); @@ -6571,28 +10495,34 @@ int smlua_func_rotate_in_yz(lua_State* L) { } int smlua_func_scale_along_line(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "scale_along_line", 4, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'scale_along_line'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "scale_along_line"); return 0; } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(2, "x"); from[1] = smlua_get_number_field(2, "y"); from[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'scale_along_line'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "scale_along_line"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(3, "x"); to[1] = smlua_get_number_field(3, "y"); to[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'scale_along_line'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "scale_along_line"); return 0; } f32 scale = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'scale_along_line'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "scale_along_line"); return 0; } scale_along_line(dest, from, to, scale); @@ -6612,7 +10542,13 @@ int smlua_func_scale_along_line(lua_State* L) { } int smlua_func_select_mario_cam_mode(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "select_mario_cam_mode", 0, top); + return 0; + } select_mario_cam_mode(); @@ -6621,10 +10557,16 @@ int smlua_func_select_mario_cam_mode(UNUSED lua_State* L) { } int smlua_func_set_cam_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_cam_angle", 1, top); + return 0; + } s32 mode = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_cam_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_cam_angle"); return 0; } lua_pushinteger(L, set_cam_angle(mode)); @@ -6632,14 +10574,20 @@ int smlua_func_set_cam_angle(lua_State* L) { } int smlua_func_set_camera_mode(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_camera_mode", 3, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_camera_mode'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_camera_mode"); return 0; } s16 mode = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_camera_mode'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_camera_mode"); return 0; } s16 frames = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_camera_mode'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_camera_mode"); return 0; } set_camera_mode(c, mode, frames); @@ -6647,16 +10595,22 @@ int smlua_func_set_camera_mode(lua_State* L) { } int smlua_func_set_camera_mode_fixed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_camera_mode_fixed", 4, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_camera_mode_fixed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_camera_mode_fixed"); return 0; } s16 x = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_camera_mode_fixed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_camera_mode_fixed"); return 0; } s16 y = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_camera_mode_fixed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_camera_mode_fixed"); return 0; } s16 z = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'set_camera_mode_fixed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "set_camera_mode_fixed"); return 0; } lua_pushinteger(L, set_camera_mode_fixed(c, x, y, z)); @@ -6664,14 +10618,20 @@ int smlua_func_set_camera_mode_fixed(lua_State* L) { } int smlua_func_set_camera_pitch_shake(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_camera_pitch_shake", 3, top); + return 0; + } s16 mag = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_camera_pitch_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_camera_pitch_shake"); return 0; } s16 decay = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_camera_pitch_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_camera_pitch_shake"); return 0; } s16 inc = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_camera_pitch_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_camera_pitch_shake"); return 0; } set_camera_pitch_shake(mag, decay, inc); @@ -6679,14 +10639,20 @@ int smlua_func_set_camera_pitch_shake(lua_State* L) { } int smlua_func_set_camera_roll_shake(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_camera_roll_shake", 3, top); + return 0; + } s16 mag = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_camera_roll_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_camera_roll_shake"); return 0; } s16 decay = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_camera_roll_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_camera_roll_shake"); return 0; } s16 inc = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_camera_roll_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_camera_roll_shake"); return 0; } set_camera_roll_shake(mag, decay, inc); @@ -6694,10 +10660,16 @@ int smlua_func_set_camera_roll_shake(lua_State* L) { } int smlua_func_set_camera_shake_from_hit(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_camera_shake_from_hit", 1, top); + return 0; + } s16 shake = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_camera_shake_from_hit'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_camera_shake_from_hit"); return 0; } set_camera_shake_from_hit(shake); @@ -6705,16 +10677,22 @@ int smlua_func_set_camera_shake_from_hit(lua_State* L) { } int smlua_func_set_camera_shake_from_point(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_camera_shake_from_point", 4, top); + return 0; + } s16 shake = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_camera_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_camera_shake_from_point"); return 0; } f32 posX = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_camera_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_camera_shake_from_point"); return 0; } f32 posY = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_camera_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_camera_shake_from_point"); return 0; } f32 posZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'set_camera_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "set_camera_shake_from_point"); return 0; } set_camera_shake_from_point(shake, posX, posY, posZ); @@ -6722,14 +10700,20 @@ int smlua_func_set_camera_shake_from_point(lua_State* L) { } int smlua_func_set_camera_yaw_shake(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_camera_yaw_shake", 3, top); + return 0; + } s16 mag = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_camera_yaw_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_camera_yaw_shake"); return 0; } s16 decay = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_camera_yaw_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_camera_yaw_shake"); return 0; } s16 inc = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_camera_yaw_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_camera_yaw_shake"); return 0; } set_camera_yaw_shake(mag, decay, inc); @@ -6737,10 +10721,16 @@ int smlua_func_set_camera_yaw_shake(lua_State* L) { } int smlua_func_set_environmental_camera_shake(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_environmental_camera_shake", 1, top); + return 0; + } s16 shake = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_environmental_camera_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_environmental_camera_shake"); return 0; } set_environmental_camera_shake(shake); @@ -6748,10 +10738,16 @@ int smlua_func_set_environmental_camera_shake(lua_State* L) { } int smlua_func_set_fixed_cam_axis_sa_lobby(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_fixed_cam_axis_sa_lobby", 1, top); + return 0; + } s16 preset = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_fixed_cam_axis_sa_lobby'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_fixed_cam_axis_sa_lobby"); return 0; } set_fixed_cam_axis_sa_lobby(preset); @@ -6759,10 +10755,16 @@ int smlua_func_set_fixed_cam_axis_sa_lobby(lua_State* L) { } int smlua_func_set_fov_function(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_fov_function", 1, top); + return 0; + } u8 func = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_fov_function'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_fov_function"); return 0; } set_fov_function(func); @@ -6770,14 +10772,20 @@ int smlua_func_set_fov_function(lua_State* L) { } int smlua_func_set_fov_shake(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_fov_shake", 3, top); + return 0; + } s16 amplitude = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_fov_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_fov_shake"); return 0; } s16 decay = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_fov_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_fov_shake"); return 0; } s16 shakeSpeed = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_fov_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_fov_shake"); return 0; } set_fov_shake(amplitude, decay, shakeSpeed); @@ -6785,16 +10793,22 @@ int smlua_func_set_fov_shake(lua_State* L) { } int smlua_func_set_fov_shake_from_point_preset(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_fov_shake_from_point_preset", 4, top); + return 0; + } u8 preset = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_fov_shake_from_point_preset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_fov_shake_from_point_preset"); return 0; } f32 posX = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_fov_shake_from_point_preset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_fov_shake_from_point_preset"); return 0; } f32 posY = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_fov_shake_from_point_preset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_fov_shake_from_point_preset"); return 0; } f32 posZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'set_fov_shake_from_point_preset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "set_fov_shake_from_point_preset"); return 0; } set_fov_shake_from_point_preset(preset, posX, posY, posZ); @@ -6802,10 +10816,16 @@ int smlua_func_set_fov_shake_from_point_preset(lua_State* L) { } int smlua_func_set_handheld_shake(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_handheld_shake", 1, top); + return 0; + } u8 mode = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_handheld_shake'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_handheld_shake"); return 0; } set_handheld_shake(mode); @@ -6813,14 +10833,20 @@ int smlua_func_set_handheld_shake(lua_State* L) { } int smlua_func_set_or_approach_f32_asymptotic(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_or_approach_f32_asymptotic", 3, top); + return 0; + } f32 * dst = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_or_approach_f32_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_or_approach_f32_asymptotic"); return 0; } f32 goal = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_or_approach_f32_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_or_approach_f32_asymptotic"); return 0; } f32 scale = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_or_approach_f32_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_or_approach_f32_asymptotic"); return 0; } lua_pushinteger(L, set_or_approach_f32_asymptotic(dst, goal, scale)); @@ -6828,14 +10854,20 @@ int smlua_func_set_or_approach_f32_asymptotic(lua_State* L) { } int smlua_func_set_or_approach_s16_symmetric(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_or_approach_s16_symmetric", 3, top); + return 0; + } s16 * current = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_or_approach_s16_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_or_approach_s16_symmetric"); return 0; } s16 target = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_or_approach_s16_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_or_approach_s16_symmetric"); return 0; } s16 increment = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_or_approach_s16_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_or_approach_s16_symmetric"); return 0; } lua_pushinteger(L, set_or_approach_s16_symmetric(current, target, increment)); @@ -6843,26 +10875,32 @@ int smlua_func_set_or_approach_s16_symmetric(lua_State* L) { } int smlua_func_set_or_approach_vec3f_asymptotic(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_or_approach_vec3f_asymptotic", 5, top); + return 0; + } f32* dst = smlua_get_vec3f_from_buffer(); dst[0] = smlua_get_number_field(1, "x"); dst[1] = smlua_get_number_field(1, "y"); dst[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_or_approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_or_approach_vec3f_asymptotic"); return 0; } f32* goal = smlua_get_vec3f_from_buffer(); goal[0] = smlua_get_number_field(2, "x"); goal[1] = smlua_get_number_field(2, "y"); goal[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_or_approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_or_approach_vec3f_asymptotic"); return 0; } f32 xMul = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_or_approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_or_approach_vec3f_asymptotic"); return 0; } f32 yMul = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'set_or_approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "set_or_approach_vec3f_asymptotic"); return 0; } f32 zMul = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'set_or_approach_vec3f_asymptotic'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "set_or_approach_vec3f_asymptotic"); return 0; } set_or_approach_vec3f_asymptotic(dst, goal, xMul, yMul, zMul); @@ -6878,22 +10916,28 @@ int smlua_func_set_or_approach_vec3f_asymptotic(lua_State* L) { } int smlua_func_set_pitch_shake_from_point(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 7)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 7) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_pitch_shake_from_point", 7, top); + return 0; + } s16 mag = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_pitch_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_pitch_shake_from_point"); return 0; } s16 decay = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_pitch_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_pitch_shake_from_point"); return 0; } s16 inc = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_pitch_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_pitch_shake_from_point"); return 0; } f32 maxDist = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'set_pitch_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "set_pitch_shake_from_point"); return 0; } f32 posX = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'set_pitch_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "set_pitch_shake_from_point"); return 0; } f32 posY = smlua_to_number(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'set_pitch_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "set_pitch_shake_from_point"); return 0; } f32 posZ = smlua_to_number(L, 7); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'set_pitch_shake_from_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "set_pitch_shake_from_point"); return 0; } set_pitch_shake_from_point(mag, decay, inc, maxDist, posX, posY, posZ); @@ -6901,20 +10945,26 @@ int smlua_func_set_pitch_shake_from_point(lua_State* L) { } int smlua_func_shake_camera_handheld(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "shake_camera_handheld", 2, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'shake_camera_handheld'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "shake_camera_handheld"); return 0; } f32* focus = smlua_get_vec3f_from_buffer(); focus[0] = smlua_get_number_field(2, "x"); focus[1] = smlua_get_number_field(2, "y"); focus[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'shake_camera_handheld'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "shake_camera_handheld"); return 0; } shake_camera_handheld(pos, focus); @@ -6930,20 +10980,26 @@ int smlua_func_shake_camera_handheld(lua_State* L) { } int smlua_func_shake_camera_pitch(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "shake_camera_pitch", 2, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'shake_camera_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "shake_camera_pitch"); return 0; } f32* focus = smlua_get_vec3f_from_buffer(); focus[0] = smlua_get_number_field(2, "x"); focus[1] = smlua_get_number_field(2, "y"); focus[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'shake_camera_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "shake_camera_pitch"); return 0; } shake_camera_pitch(pos, focus); @@ -6959,10 +11015,16 @@ int smlua_func_shake_camera_pitch(lua_State* L) { } int smlua_func_shake_camera_roll(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "shake_camera_roll", 1, top); + return 0; + } s16 * roll = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'shake_camera_roll'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "shake_camera_roll"); return 0; } shake_camera_roll(roll); @@ -6970,20 +11032,26 @@ int smlua_func_shake_camera_roll(lua_State* L) { } int smlua_func_shake_camera_yaw(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "shake_camera_yaw", 2, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'shake_camera_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "shake_camera_yaw"); return 0; } f32* focus = smlua_get_vec3f_from_buffer(); focus[0] = smlua_get_number_field(2, "x"); focus[1] = smlua_get_number_field(2, "y"); focus[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'shake_camera_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "shake_camera_yaw"); return 0; } shake_camera_yaw(pos, focus); @@ -6999,10 +11067,16 @@ int smlua_func_shake_camera_yaw(lua_State* L) { } int smlua_func_soft_reset_camera(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "soft_reset_camera", 1, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'soft_reset_camera'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "soft_reset_camera"); return 0; } soft_reset_camera(c); @@ -7010,12 +11084,18 @@ int smlua_func_soft_reset_camera(lua_State* L) { } int smlua_func_start_cutscene(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "start_cutscene", 2, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'start_cutscene'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "start_cutscene"); return 0; } u8 cutscene = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'start_cutscene'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "start_cutscene"); return 0; } start_cutscene(c, cutscene); @@ -7023,10 +11103,16 @@ int smlua_func_start_cutscene(lua_State* L) { } int smlua_func_start_object_cutscene_without_focus(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "start_object_cutscene_without_focus", 1, top); + return 0; + } u8 cutscene = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'start_object_cutscene_without_focus'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "start_object_cutscene_without_focus"); return 0; } lua_pushinteger(L, start_object_cutscene_without_focus(cutscene)); @@ -7034,12 +11120,18 @@ int smlua_func_start_object_cutscene_without_focus(lua_State* L) { } int smlua_func_transition_next_state(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "transition_next_state", 2, top); + return 0; + } struct Camera* c = (struct Camera*)smlua_to_cobject(L, 1, LOT_CAMERA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'transition_next_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "transition_next_state"); return 0; } s16 frames = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'transition_next_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "transition_next_state"); return 0; } transition_next_state(c, frames); @@ -7047,10 +11139,16 @@ int smlua_func_transition_next_state(lua_State* L) { } int smlua_func_trigger_cutscene_dialog(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "trigger_cutscene_dialog", 1, top); + return 0; + } s32 trigger = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'trigger_cutscene_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "trigger_cutscene_dialog"); return 0; } lua_pushinteger(L, trigger_cutscene_dialog(trigger)); @@ -7058,20 +11156,26 @@ int smlua_func_trigger_cutscene_dialog(lua_State* L) { } int smlua_func_vec3f_sub(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_sub", 2, top); + return 0; + } f32* dst = smlua_get_vec3f_from_buffer(); dst[0] = smlua_get_number_field(1, "x"); dst[1] = smlua_get_number_field(1, "y"); dst[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_sub'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_sub"); return 0; } f32* src = smlua_get_vec3f_from_buffer(); src[0] = smlua_get_number_field(2, "x"); src[1] = smlua_get_number_field(2, "y"); src[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_sub'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_sub"); return 0; } vec3f_sub(dst, src); @@ -7087,16 +11191,22 @@ int smlua_func_vec3f_sub(lua_State* L) { } int smlua_func_vec3f_to_object_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_to_object_pos", 2, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_to_object_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_to_object_pos"); return 0; } f32* src = smlua_get_vec3f_from_buffer(); src[0] = smlua_get_number_field(2, "x"); src[1] = smlua_get_number_field(2, "y"); src[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_to_object_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_to_object_pos"); return 0; } vec3f_to_object_pos(o, src); @@ -7108,14 +11218,20 @@ int smlua_func_vec3f_to_object_pos(lua_State* L) { } int smlua_func_warp_camera(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "warp_camera", 3, top); + return 0; + } f32 displacementX = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'warp_camera'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "warp_camera"); return 0; } f32 displacementY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'warp_camera'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "warp_camera"); return 0; } f32 displacementZ = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'warp_camera'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "warp_camera"); return 0; } warp_camera(displacementX, displacementY, displacementZ); @@ -7127,10 +11243,16 @@ int smlua_func_warp_camera(lua_State* L) { ////////////////// int smlua_func_get_character(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_character", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_character'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_character"); return 0; } smlua_push_object(L, LOT_CHARACTER, get_character(m)); @@ -7138,10 +11260,16 @@ int smlua_func_get_character(lua_State* L) { } int smlua_func_get_character_anim_offset(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_character_anim_offset", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_character_anim_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_character_anim_offset"); return 0; } lua_pushnumber(L, get_character_anim_offset(m)); @@ -7149,12 +11277,18 @@ int smlua_func_get_character_anim_offset(lua_State* L) { } int smlua_func_play_character_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_character_sound", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_character_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_character_sound"); return 0; } int characterSound = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_character_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_character_sound"); return 0; } play_character_sound(m, characterSound); @@ -7162,14 +11296,20 @@ int smlua_func_play_character_sound(lua_State* L) { } int smlua_func_play_character_sound_if_no_flag(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_character_sound_if_no_flag", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_character_sound_if_no_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_character_sound_if_no_flag"); return 0; } int characterSound = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_character_sound_if_no_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_character_sound_if_no_flag"); return 0; } u32 flags = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_character_sound_if_no_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_character_sound_if_no_flag"); return 0; } play_character_sound_if_no_flag(m, characterSound, flags); @@ -7177,14 +11317,20 @@ int smlua_func_play_character_sound_if_no_flag(lua_State* L) { } int smlua_func_play_character_sound_offset(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_character_sound_offset", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_character_sound_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_character_sound_offset"); return 0; } int characterSound = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_character_sound_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_character_sound_offset"); return 0; } u32 offset = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_character_sound_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_character_sound_offset"); return 0; } play_character_sound_offset(m, characterSound, offset); @@ -7192,10 +11338,16 @@ int smlua_func_play_character_sound_offset(lua_State* L) { } int smlua_func_update_character_anim_offset(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_character_anim_offset", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_character_anim_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_character_anim_offset"); return 0; } update_character_anim_offset(m); @@ -7207,10 +11359,16 @@ int smlua_func_update_character_anim_offset(lua_State* L) { ///////////////////////// int smlua_func_djui_chat_message_create(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_chat_message_create", 1, top); + return 0; + } const char* message = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_chat_message_create'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_chat_message_create"); return 0; } djui_chat_message_create(message); @@ -7222,7 +11380,13 @@ int smlua_func_djui_chat_message_create(lua_State* L) { ////////////////////// int smlua_func_djui_hud_get_mouse_x(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_get_mouse_x", 0, top); + return 0; + } lua_pushnumber(L, djui_hud_get_mouse_x()); @@ -7231,7 +11395,13 @@ int smlua_func_djui_hud_get_mouse_x(UNUSED lua_State* L) { } int smlua_func_djui_hud_get_mouse_y(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_get_mouse_y", 0, top); + return 0; + } lua_pushnumber(L, djui_hud_get_mouse_y()); @@ -7240,7 +11410,13 @@ int smlua_func_djui_hud_get_mouse_y(UNUSED lua_State* L) { } int smlua_func_djui_hud_get_raw_mouse_x(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_get_raw_mouse_x", 0, top); + return 0; + } lua_pushnumber(L, djui_hud_get_raw_mouse_x()); @@ -7249,7 +11425,13 @@ int smlua_func_djui_hud_get_raw_mouse_x(UNUSED lua_State* L) { } int smlua_func_djui_hud_get_raw_mouse_y(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_get_raw_mouse_y", 0, top); + return 0; + } lua_pushnumber(L, djui_hud_get_raw_mouse_y()); @@ -7258,7 +11440,13 @@ int smlua_func_djui_hud_get_raw_mouse_y(UNUSED lua_State* L) { } int smlua_func_djui_hud_get_screen_height(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_get_screen_height", 0, top); + return 0; + } lua_pushinteger(L, djui_hud_get_screen_height()); @@ -7267,7 +11455,13 @@ int smlua_func_djui_hud_get_screen_height(UNUSED lua_State* L) { } int smlua_func_djui_hud_get_screen_width(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_get_screen_width", 0, top); + return 0; + } lua_pushinteger(L, djui_hud_get_screen_width()); @@ -7276,10 +11470,16 @@ int smlua_func_djui_hud_get_screen_width(UNUSED lua_State* L) { } int smlua_func_djui_hud_measure_text(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_measure_text", 1, top); + return 0; + } const char* message = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_hud_measure_text'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_measure_text"); return 0; } lua_pushnumber(L, djui_hud_measure_text(message)); @@ -7287,16 +11487,22 @@ int smlua_func_djui_hud_measure_text(lua_State* L) { } int smlua_func_djui_hud_print_text(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_print_text", 4, top); + return 0; + } const char* message = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_hud_print_text'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_print_text"); return 0; } float x = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'djui_hud_print_text'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_print_text"); return 0; } float y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'djui_hud_print_text'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "djui_hud_print_text"); return 0; } float scale = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'djui_hud_print_text'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "djui_hud_print_text"); return 0; } djui_hud_print_text(message, x, y, scale); @@ -7304,16 +11510,22 @@ int smlua_func_djui_hud_print_text(lua_State* L) { } int smlua_func_djui_hud_render_rect(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_render_rect", 4, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_hud_render_rect'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_render_rect"); return 0; } f32 y = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'djui_hud_render_rect'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_render_rect"); return 0; } f32 width = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'djui_hud_render_rect'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "djui_hud_render_rect"); return 0; } f32 height = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'djui_hud_render_rect'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "djui_hud_render_rect"); return 0; } djui_hud_render_rect(x, y, width, height); @@ -7321,24 +11533,30 @@ int smlua_func_djui_hud_render_rect(lua_State* L) { } int smlua_func_djui_hud_render_rect_interpolated(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 8)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 8) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_render_rect_interpolated", 8, top); + return 0; + } f32 prevX = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_hud_render_rect_interpolated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_render_rect_interpolated"); return 0; } f32 prevY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'djui_hud_render_rect_interpolated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_render_rect_interpolated"); return 0; } f32 prevWidth = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'djui_hud_render_rect_interpolated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "djui_hud_render_rect_interpolated"); return 0; } f32 prevHeight = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'djui_hud_render_rect_interpolated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "djui_hud_render_rect_interpolated"); return 0; } f32 x = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'djui_hud_render_rect_interpolated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "djui_hud_render_rect_interpolated"); return 0; } f32 y = smlua_to_number(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'djui_hud_render_rect_interpolated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "djui_hud_render_rect_interpolated"); return 0; } f32 width = smlua_to_number(L, 7); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'djui_hud_render_rect_interpolated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "djui_hud_render_rect_interpolated"); return 0; } f32 height = smlua_to_number(L, 8); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 8 for function 'djui_hud_render_rect_interpolated'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 8, "djui_hud_render_rect_interpolated"); return 0; } djui_hud_render_rect_interpolated(prevX, prevY, prevWidth, prevHeight, x, y, width, height); @@ -7346,16 +11564,22 @@ int smlua_func_djui_hud_render_rect_interpolated(lua_State* L) { } int smlua_func_djui_hud_set_color(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_set_color", 4, top); + return 0; + } u8 r = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_hud_set_color'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_set_color"); return 0; } u8 g = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'djui_hud_set_color'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_set_color"); return 0; } u8 b = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'djui_hud_set_color'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "djui_hud_set_color"); return 0; } u8 a = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'djui_hud_set_color'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "djui_hud_set_color"); return 0; } djui_hud_set_color(r, g, b, a); @@ -7363,10 +11587,16 @@ int smlua_func_djui_hud_set_color(lua_State* L) { } int smlua_func_djui_hud_set_font(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_set_font", 1, top); + return 0; + } int fontType = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_hud_set_font'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_set_font"); return 0; } djui_hud_set_font(fontType); @@ -7374,10 +11604,16 @@ int smlua_func_djui_hud_set_font(lua_State* L) { } int smlua_func_djui_hud_set_mouse_locked(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_set_mouse_locked", 1, top); + return 0; + } bool locked = smlua_to_boolean(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_hud_set_mouse_locked'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_set_mouse_locked"); return 0; } djui_hud_set_mouse_locked(locked); @@ -7385,10 +11621,16 @@ int smlua_func_djui_hud_set_mouse_locked(lua_State* L) { } int smlua_func_djui_hud_set_resolution(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_set_resolution", 1, top); + return 0; + } int resolutionType = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_hud_set_resolution'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_set_resolution"); return 0; } djui_hud_set_resolution(resolutionType); @@ -7396,20 +11638,26 @@ int smlua_func_djui_hud_set_resolution(lua_State* L) { } int smlua_func_djui_hud_world_pos_to_screen_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_world_pos_to_screen_pos", 2, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_hud_world_pos_to_screen_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_world_pos_to_screen_pos"); return 0; } f32* out = smlua_get_vec3f_from_buffer(); out[0] = smlua_get_number_field(2, "x"); out[1] = smlua_get_number_field(2, "y"); out[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'djui_hud_world_pos_to_screen_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_world_pos_to_screen_pos"); return 0; } djui_hud_world_pos_to_screen_pos(pos, out); @@ -7429,12 +11677,18 @@ int smlua_func_djui_hud_world_pos_to_screen_pos(lua_State* L) { ////////////////// int smlua_func_djui_popup_create(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_popup_create", 2, top); + return 0; + } const char* message = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'djui_popup_create'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_popup_create"); return 0; } int lines = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'djui_popup_create'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_popup_create"); return 0; } djui_popup_create(message, lines); @@ -7446,14 +11700,20 @@ int smlua_func_djui_popup_create(lua_State* L) { //////////////// int smlua_func_fade_volume_scale(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "fade_volume_scale", 3, top); + return 0; + } u8 player = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'fade_volume_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "fade_volume_scale"); return 0; } u8 targetScale = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'fade_volume_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "fade_volume_scale"); return 0; } u16 fadeDuration = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'fade_volume_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "fade_volume_scale"); return 0; } fade_volume_scale(player, targetScale, fadeDuration); @@ -7461,12 +11721,18 @@ int smlua_func_fade_volume_scale(lua_State* L) { } int smlua_func_fadeout_background_music(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "fadeout_background_music", 2, top); + return 0; + } u16 arg0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'fadeout_background_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "fadeout_background_music"); return 0; } u16 fadeOut = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'fadeout_background_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "fadeout_background_music"); return 0; } fadeout_background_music(arg0, fadeOut); @@ -7474,7 +11740,13 @@ int smlua_func_fadeout_background_music(lua_State* L) { } int smlua_func_get_current_background_music(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_current_background_music", 0, top); + return 0; + } lua_pushinteger(L, get_current_background_music()); @@ -7483,7 +11755,13 @@ int smlua_func_get_current_background_music(UNUSED lua_State* L) { } int smlua_func_get_current_background_music_default_volume(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_current_background_music_default_volume", 0, top); + return 0; + } lua_pushinteger(L, get_current_background_music_default_volume()); @@ -7492,7 +11770,13 @@ int smlua_func_get_current_background_music_default_volume(UNUSED lua_State* L) } int smlua_func_get_current_background_music_max_target_volume(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_current_background_music_max_target_volume", 0, top); + return 0; + } lua_pushinteger(L, get_current_background_music_max_target_volume()); @@ -7501,7 +11785,13 @@ int smlua_func_get_current_background_music_max_target_volume(UNUSED lua_State* } int smlua_func_get_current_background_music_target_volume(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_current_background_music_target_volume", 0, top); + return 0; + } lua_pushinteger(L, get_current_background_music_target_volume()); @@ -7510,7 +11800,13 @@ int smlua_func_get_current_background_music_target_volume(UNUSED lua_State* L) { } int smlua_func_is_current_background_music_volume_lowered(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_current_background_music_volume_lowered", 0, top); + return 0; + } lua_pushinteger(L, is_current_background_music_volume_lowered()); @@ -7519,7 +11815,13 @@ int smlua_func_is_current_background_music_volume_lowered(UNUSED lua_State* L) { } int smlua_func_play_course_clear(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_course_clear", 0, top); + return 0; + } play_course_clear(); @@ -7528,10 +11830,16 @@ int smlua_func_play_course_clear(UNUSED lua_State* L) { } int smlua_func_play_dialog_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_dialog_sound", 1, top); + return 0; + } u8 dialogID = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_dialog_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_dialog_sound"); return 0; } play_dialog_sound(dialogID); @@ -7539,14 +11847,20 @@ int smlua_func_play_dialog_sound(lua_State* L) { } int smlua_func_play_music(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_music", 3, top); + return 0; + } u8 player = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_music"); return 0; } u16 seqArgs = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_music"); return 0; } u16 fadeTimer = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_music"); return 0; } play_music(player, seqArgs, fadeTimer); @@ -7554,7 +11868,13 @@ int smlua_func_play_music(lua_State* L) { } int smlua_func_play_peachs_jingle(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_peachs_jingle", 0, top); + return 0; + } play_peachs_jingle(); @@ -7563,10 +11883,16 @@ int smlua_func_play_peachs_jingle(UNUSED lua_State* L) { } int smlua_func_play_power_star_jingle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_power_star_jingle", 1, top); + return 0; + } u8 arg0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_power_star_jingle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_power_star_jingle"); return 0; } play_power_star_jingle(arg0); @@ -7574,7 +11900,13 @@ int smlua_func_play_power_star_jingle(lua_State* L) { } int smlua_func_play_puzzle_jingle(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_puzzle_jingle", 0, top); + return 0; + } play_puzzle_jingle(); @@ -7583,7 +11915,13 @@ int smlua_func_play_puzzle_jingle(UNUSED lua_State* L) { } int smlua_func_play_race_fanfare(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_race_fanfare", 0, top); + return 0; + } play_race_fanfare(); @@ -7592,16 +11930,22 @@ int smlua_func_play_race_fanfare(UNUSED lua_State* L) { } int smlua_func_play_secondary_music(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_secondary_music", 4, top); + return 0; + } u8 seqId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_secondary_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_secondary_music"); return 0; } u8 bgMusicVolume = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_secondary_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_secondary_music"); return 0; } u8 volume = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_secondary_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_secondary_music"); return 0; } u16 fadeTimer = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'play_secondary_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "play_secondary_music"); return 0; } play_secondary_music(seqId, bgMusicVolume, volume, fadeTimer); @@ -7609,16 +11953,22 @@ int smlua_func_play_secondary_music(lua_State* L) { } int smlua_func_play_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound", 2, top); + return 0; + } s32 soundBits = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_sound"); return 0; } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(2, "x"); pos[1] = smlua_get_number_field(2, "y"); pos[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_sound"); return 0; } play_sound(soundBits, pos); @@ -7630,18 +11980,24 @@ int smlua_func_play_sound(lua_State* L) { } int smlua_func_play_sound_with_freq_scale(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound_with_freq_scale", 3, top); + return 0; + } s32 soundBits = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_sound_with_freq_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_sound_with_freq_scale"); return 0; } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(2, "x"); pos[1] = smlua_get_number_field(2, "y"); pos[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_sound_with_freq_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_sound_with_freq_scale"); return 0; } f32 freqScale = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_sound_with_freq_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_sound_with_freq_scale"); return 0; } play_sound_with_freq_scale(soundBits, pos, freqScale); @@ -7653,7 +12009,13 @@ int smlua_func_play_sound_with_freq_scale(lua_State* L) { } int smlua_func_play_star_fanfare(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_star_fanfare", 0, top); + return 0; + } play_star_fanfare(); @@ -7662,7 +12024,13 @@ int smlua_func_play_star_fanfare(UNUSED lua_State* L) { } int smlua_func_play_toads_jingle(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_toads_jingle", 0, top); + return 0; + } play_toads_jingle(); @@ -7671,12 +12039,18 @@ int smlua_func_play_toads_jingle(UNUSED lua_State* L) { } int smlua_func_seq_player_fade_out(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "seq_player_fade_out", 2, top); + return 0; + } u8 player = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'seq_player_fade_out'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "seq_player_fade_out"); return 0; } u16 fadeDuration = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'seq_player_fade_out'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "seq_player_fade_out"); return 0; } seq_player_fade_out(player, fadeDuration); @@ -7684,14 +12058,20 @@ int smlua_func_seq_player_fade_out(lua_State* L) { } int smlua_func_seq_player_lower_volume(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "seq_player_lower_volume", 3, top); + return 0; + } u8 player = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'seq_player_lower_volume'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "seq_player_lower_volume"); return 0; } u16 fadeDuration = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'seq_player_lower_volume'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "seq_player_lower_volume"); return 0; } u8 percentage = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'seq_player_lower_volume'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "seq_player_lower_volume"); return 0; } seq_player_lower_volume(player, fadeDuration, percentage); @@ -7699,12 +12079,18 @@ int smlua_func_seq_player_lower_volume(lua_State* L) { } int smlua_func_seq_player_unlower_volume(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "seq_player_unlower_volume", 2, top); + return 0; + } u8 player = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'seq_player_unlower_volume'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "seq_player_unlower_volume"); return 0; } u16 fadeDuration = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'seq_player_unlower_volume'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "seq_player_unlower_volume"); return 0; } seq_player_unlower_volume(player, fadeDuration); @@ -7712,10 +12098,16 @@ int smlua_func_seq_player_unlower_volume(lua_State* L) { } int smlua_func_stop_background_music(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stop_background_music", 1, top); + return 0; + } u16 seqId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'stop_background_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "stop_background_music"); return 0; } stop_background_music(seqId); @@ -7723,16 +12115,22 @@ int smlua_func_stop_background_music(lua_State* L) { } int smlua_func_stop_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stop_sound", 2, top); + return 0; + } u32 soundBits = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'stop_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "stop_sound"); return 0; } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(2, "x"); pos[1] = smlua_get_number_field(2, "y"); pos[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'stop_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "stop_sound"); return 0; } stop_sound(soundBits, pos); @@ -7744,14 +12142,20 @@ int smlua_func_stop_sound(lua_State* L) { } int smlua_func_stop_sounds_from_source(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stop_sounds_from_source", 1, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'stop_sounds_from_source'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "stop_sounds_from_source"); return 0; } stop_sounds_from_source(pos); @@ -7763,7 +12167,13 @@ int smlua_func_stop_sounds_from_source(lua_State* L) { } int smlua_func_stop_sounds_in_continuous_banks(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stop_sounds_in_continuous_banks", 0, top); + return 0; + } stop_sounds_in_continuous_banks(); @@ -7776,10 +12186,16 @@ int smlua_func_stop_sounds_in_continuous_banks(UNUSED lua_State* L) { /////////////////// int smlua_func_does_mario_have_normal_cap_on_head(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "does_mario_have_normal_cap_on_head", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'does_mario_have_normal_cap_on_head'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "does_mario_have_normal_cap_on_head"); return 0; } lua_pushinteger(L, does_mario_have_normal_cap_on_head(m)); @@ -7787,10 +12203,16 @@ int smlua_func_does_mario_have_normal_cap_on_head(lua_State* L) { } int smlua_func_get_door_save_file_flag(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_door_save_file_flag", 1, top); + return 0; + } struct Object* door = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_door_save_file_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_door_save_file_flag"); return 0; } lua_pushinteger(L, get_door_save_file_flag(door)); @@ -7798,14 +12220,20 @@ int smlua_func_get_door_save_file_flag(lua_State* L) { } int smlua_func_interact_damage(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "interact_damage", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'interact_damage'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "interact_damage"); return 0; } u32 interactType = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'interact_damage'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "interact_damage"); return 0; } struct Object* o = (struct Object*)smlua_to_cobject(L, 3, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'interact_damage'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "interact_damage"); return 0; } lua_pushinteger(L, interact_damage(m, interactType, o)); @@ -7813,12 +12241,18 @@ int smlua_func_interact_damage(lua_State* L) { } int smlua_func_mario_blow_off_cap(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_blow_off_cap", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_blow_off_cap'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_blow_off_cap"); return 0; } f32 capSpeed = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_blow_off_cap'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_blow_off_cap"); return 0; } mario_blow_off_cap(m, capSpeed); @@ -7826,10 +12260,16 @@ int smlua_func_mario_blow_off_cap(lua_State* L) { } int smlua_func_mario_check_object_grab(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_check_object_grab", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_check_object_grab'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_check_object_grab"); return 0; } lua_pushinteger(L, mario_check_object_grab(m)); @@ -7837,10 +12277,16 @@ int smlua_func_mario_check_object_grab(lua_State* L) { } int smlua_func_mario_drop_held_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_drop_held_object", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_drop_held_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_drop_held_object"); return 0; } mario_drop_held_object(m); @@ -7848,12 +12294,18 @@ int smlua_func_mario_drop_held_object(lua_State* L) { } int smlua_func_mario_get_collided_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_get_collided_object", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_get_collided_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_get_collided_object"); return 0; } u32 interactType = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_get_collided_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_get_collided_object"); return 0; } smlua_push_object(L, LOT_OBJECT, mario_get_collided_object(m, interactType)); @@ -7861,10 +12313,16 @@ int smlua_func_mario_get_collided_object(lua_State* L) { } int smlua_func_mario_grab_used_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_grab_used_object", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_grab_used_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_grab_used_object"); return 0; } mario_grab_used_object(m); @@ -7872,12 +12330,18 @@ int smlua_func_mario_grab_used_object(lua_State* L) { } int smlua_func_mario_lose_cap_to_enemy(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_lose_cap_to_enemy", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_lose_cap_to_enemy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_lose_cap_to_enemy"); return 0; } u32 arg = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_lose_cap_to_enemy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_lose_cap_to_enemy"); return 0; } lua_pushinteger(L, mario_lose_cap_to_enemy(m, arg)); @@ -7885,12 +12349,18 @@ int smlua_func_mario_lose_cap_to_enemy(lua_State* L) { } int smlua_func_mario_obj_angle_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_obj_angle_to_object", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_obj_angle_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_obj_angle_to_object"); return 0; } struct Object* o = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_obj_angle_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_obj_angle_to_object"); return 0; } lua_pushinteger(L, mario_obj_angle_to_object(m, o)); @@ -7898,10 +12368,16 @@ int smlua_func_mario_obj_angle_to_object(lua_State* L) { } int smlua_func_mario_retrieve_cap(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_retrieve_cap", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_retrieve_cap'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_retrieve_cap"); return 0; } mario_retrieve_cap(m); @@ -7909,10 +12385,16 @@ int smlua_func_mario_retrieve_cap(lua_State* L) { } int smlua_func_mario_stop_riding_and_holding(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_stop_riding_and_holding", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_stop_riding_and_holding'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_stop_riding_and_holding"); return 0; } mario_stop_riding_and_holding(m); @@ -7920,10 +12402,16 @@ int smlua_func_mario_stop_riding_and_holding(lua_State* L) { } int smlua_func_mario_stop_riding_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_stop_riding_object", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_stop_riding_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_stop_riding_object"); return 0; } mario_stop_riding_object(m); @@ -7931,10 +12419,16 @@ int smlua_func_mario_stop_riding_object(lua_State* L) { } int smlua_func_mario_throw_held_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_throw_held_object", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_throw_held_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_throw_held_object"); return 0; } mario_throw_held_object(m); @@ -7942,12 +12436,18 @@ int smlua_func_mario_throw_held_object(lua_State* L) { } int smlua_func_passes_pvp_interaction_checks(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "passes_pvp_interaction_checks", 2, top); + return 0; + } struct MarioState* attacker = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'passes_pvp_interaction_checks'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "passes_pvp_interaction_checks"); return 0; } struct MarioState* victim = (struct MarioState*)smlua_to_cobject(L, 2, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'passes_pvp_interaction_checks'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "passes_pvp_interaction_checks"); return 0; } lua_pushinteger(L, passes_pvp_interaction_checks(attacker, victim)); @@ -7955,12 +12455,18 @@ int smlua_func_passes_pvp_interaction_checks(lua_State* L) { } int smlua_func_take_damage_and_knock_back(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "take_damage_and_knock_back", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'take_damage_and_knock_back'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "take_damage_and_knock_back"); return 0; } struct Object* o = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'take_damage_and_knock_back'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "take_damage_and_knock_back"); return 0; } lua_pushinteger(L, take_damage_and_knock_back(m, o)); @@ -7972,14 +12478,20 @@ int smlua_func_take_damage_and_knock_back(lua_State* L) { ////////////////// int smlua_func_get_level_name(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_level_name", 3, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_level_name'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_level_name"); return 0; } s16 levelNum = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_level_name'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_level_name"); return 0; } s16 areaIndex = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'get_level_name'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_level_name"); return 0; } lua_pushstring(L, get_level_name(courseNum, levelNum, areaIndex)); @@ -7987,16 +12499,22 @@ int smlua_func_get_level_name(lua_State* L) { } int smlua_func_get_level_name_ascii(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_level_name_ascii", 4, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_level_name_ascii'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_level_name_ascii"); return 0; } s16 levelNum = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_level_name_ascii'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_level_name_ascii"); return 0; } s16 areaIndex = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'get_level_name_ascii'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_level_name_ascii"); return 0; } s16 charCase = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'get_level_name_ascii'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "get_level_name_ascii"); return 0; } lua_pushstring(L, get_level_name_ascii(courseNum, levelNum, areaIndex, charCase)); @@ -8004,16 +12522,22 @@ int smlua_func_get_level_name_ascii(lua_State* L) { } int smlua_func_get_level_name_sm64(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_level_name_sm64", 4, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_level_name_sm64'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_level_name_sm64"); return 0; } s16 levelNum = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_level_name_sm64'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_level_name_sm64"); return 0; } s16 areaIndex = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'get_level_name_sm64'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_level_name_sm64"); return 0; } s16 charCase = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'get_level_name_sm64'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "get_level_name_sm64"); return 0; } smlua_push_pointer(L, LVT_U8_P, (void*)get_level_name_sm64(courseNum, levelNum, areaIndex, charCase)); @@ -8021,12 +12545,18 @@ int smlua_func_get_level_name_sm64(lua_State* L) { } int smlua_func_get_star_name(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_star_name", 2, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_star_name'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_star_name"); return 0; } s16 starNum = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_star_name'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_star_name"); return 0; } lua_pushstring(L, get_star_name(courseNum, starNum)); @@ -8034,14 +12564,20 @@ int smlua_func_get_star_name(lua_State* L) { } int smlua_func_get_star_name_ascii(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_star_name_ascii", 3, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_star_name_ascii'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_star_name_ascii"); return 0; } s16 starNum = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_star_name_ascii'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_star_name_ascii"); return 0; } s16 charCase = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'get_star_name_ascii'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_star_name_ascii"); return 0; } lua_pushstring(L, get_star_name_ascii(courseNum, starNum, charCase)); @@ -8049,14 +12585,20 @@ int smlua_func_get_star_name_ascii(lua_State* L) { } int smlua_func_get_star_name_sm64(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_star_name_sm64", 3, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_star_name_sm64'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_star_name_sm64"); return 0; } s16 starNum = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_star_name_sm64'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_star_name_sm64"); return 0; } s16 charCase = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'get_star_name_sm64'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_star_name_sm64"); return 0; } smlua_push_pointer(L, LVT_U8_P, (void*)get_star_name_sm64(courseNum, starNum, charCase)); @@ -8068,12 +12610,18 @@ int smlua_func_get_star_name_sm64(lua_State* L) { //////////////////// int smlua_func_level_trigger_warp(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "level_trigger_warp", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'level_trigger_warp'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "level_trigger_warp"); return 0; } s32 warpOp = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'level_trigger_warp'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "level_trigger_warp"); return 0; } lua_pushinteger(L, level_trigger_warp(m, warpOp)); @@ -8085,10 +12633,16 @@ int smlua_func_level_trigger_warp(lua_State* L) { ///////////// int smlua_func_adjust_sound_for_speed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "adjust_sound_for_speed", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'adjust_sound_for_speed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "adjust_sound_for_speed"); return 0; } adjust_sound_for_speed(m); @@ -8096,10 +12650,16 @@ int smlua_func_adjust_sound_for_speed(lua_State* L) { } int smlua_func_check_common_action_exits(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_action_exits", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_action_exits'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_action_exits"); return 0; } lua_pushinteger(L, check_common_action_exits(m)); @@ -8107,10 +12667,16 @@ int smlua_func_check_common_action_exits(lua_State* L) { } int smlua_func_check_common_hold_action_exits(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_hold_action_exits", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_hold_action_exits'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_hold_action_exits"); return 0; } lua_pushinteger(L, check_common_hold_action_exits(m)); @@ -8118,14 +12684,20 @@ int smlua_func_check_common_hold_action_exits(lua_State* L) { } int smlua_func_drop_and_set_mario_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "drop_and_set_mario_action", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'drop_and_set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "drop_and_set_mario_action"); return 0; } u32 action = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'drop_and_set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "drop_and_set_mario_action"); return 0; } u32 actionArg = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'drop_and_set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "drop_and_set_mario_action"); return 0; } lua_pushinteger(L, drop_and_set_mario_action(m, action, actionArg)); @@ -8133,10 +12705,16 @@ int smlua_func_drop_and_set_mario_action(lua_State* L) { } int smlua_func_execute_mario_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "execute_mario_action", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'execute_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "execute_mario_action"); return 0; } lua_pushinteger(L, execute_mario_action(o)); @@ -8144,14 +12722,20 @@ int smlua_func_execute_mario_action(lua_State* L) { } int smlua_func_find_floor_height_relative_polar(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_floor_height_relative_polar", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_floor_height_relative_polar'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_floor_height_relative_polar"); return 0; } s16 angleFromMario = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_floor_height_relative_polar'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_floor_height_relative_polar"); return 0; } f32 distFromMario = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_floor_height_relative_polar'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_floor_height_relative_polar"); return 0; } lua_pushnumber(L, find_floor_height_relative_polar(m, angleFromMario, distFromMario)); @@ -8159,12 +12743,18 @@ int smlua_func_find_floor_height_relative_polar(lua_State* L) { } int smlua_func_find_floor_slope(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_floor_slope", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_floor_slope'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_floor_slope"); return 0; } s16 yawOffset = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_floor_slope'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_floor_slope"); return 0; } lua_pushinteger(L, find_floor_slope(m, yawOffset)); @@ -8172,18 +12762,24 @@ int smlua_func_find_floor_slope(lua_State* L) { } int smlua_func_find_mario_anim_flags_and_translation(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_mario_anim_flags_and_translation", 3, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_mario_anim_flags_and_translation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_mario_anim_flags_and_translation"); return 0; } s32 yaw = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_mario_anim_flags_and_translation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_mario_anim_flags_and_translation"); return 0; } s16* translation = smlua_get_vec3s_from_buffer(); translation[0] = smlua_get_integer_field(3, "x"); translation[1] = smlua_get_integer_field(3, "y"); translation[2] = smlua_get_integer_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_mario_anim_flags_and_translation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_mario_anim_flags_and_translation"); return 0; } lua_pushinteger(L, find_mario_anim_flags_and_translation(o, yaw, translation)); @@ -8195,10 +12791,16 @@ int smlua_func_find_mario_anim_flags_and_translation(lua_State* L) { } int smlua_func_force_idle_state(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "force_idle_state", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'force_idle_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "force_idle_state"); return 0; } lua_pushinteger(L, force_idle_state(m)); @@ -8206,16 +12808,22 @@ int smlua_func_force_idle_state(lua_State* L) { } int smlua_func_hurt_and_set_mario_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hurt_and_set_mario_action", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'hurt_and_set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "hurt_and_set_mario_action"); return 0; } u32 action = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'hurt_and_set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "hurt_and_set_mario_action"); return 0; } u32 actionArg = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'hurt_and_set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "hurt_and_set_mario_action"); return 0; } s16 hurtCounter = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'hurt_and_set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "hurt_and_set_mario_action"); return 0; } lua_pushinteger(L, hurt_and_set_mario_action(m, action, actionArg, hurtCounter)); @@ -8223,10 +12831,16 @@ int smlua_func_hurt_and_set_mario_action(lua_State* L) { } int smlua_func_init_single_mario(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "init_single_mario", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'init_single_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "init_single_mario"); return 0; } init_single_mario(m); @@ -8234,10 +12848,16 @@ int smlua_func_init_single_mario(lua_State* L) { } int smlua_func_is_anim_at_end(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_anim_at_end", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_anim_at_end'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_anim_at_end"); return 0; } lua_pushinteger(L, is_anim_at_end(m)); @@ -8245,10 +12865,16 @@ int smlua_func_is_anim_at_end(lua_State* L) { } int smlua_func_is_anim_past_end(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_anim_past_end", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_anim_past_end'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_anim_past_end"); return 0; } lua_pushinteger(L, is_anim_past_end(m)); @@ -8256,12 +12882,18 @@ int smlua_func_is_anim_past_end(lua_State* L) { } int smlua_func_is_anim_past_frame(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_anim_past_frame", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_anim_past_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_anim_past_frame"); return 0; } s16 animFrame = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'is_anim_past_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "is_anim_past_frame"); return 0; } lua_pushinteger(L, is_anim_past_frame(m, animFrame)); @@ -8269,10 +12901,16 @@ int smlua_func_is_anim_past_frame(lua_State* L) { } int smlua_func_mario_can_bubble(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_can_bubble", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_can_bubble'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_can_bubble"); return 0; } lua_pushboolean(L, mario_can_bubble(m)); @@ -8280,12 +12918,18 @@ int smlua_func_mario_can_bubble(lua_State* L) { } int smlua_func_mario_facing_downhill(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_facing_downhill", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_facing_downhill'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_facing_downhill"); return 0; } s32 turnYaw = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_facing_downhill'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_facing_downhill"); return 0; } lua_pushinteger(L, mario_facing_downhill(m, turnYaw)); @@ -8293,10 +12937,16 @@ int smlua_func_mario_facing_downhill(lua_State* L) { } int smlua_func_mario_floor_is_slippery(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_floor_is_slippery", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_floor_is_slippery'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_floor_is_slippery"); return 0; } lua_pushinteger(L, mario_floor_is_slippery(m)); @@ -8304,10 +12954,16 @@ int smlua_func_mario_floor_is_slippery(lua_State* L) { } int smlua_func_mario_floor_is_slope(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_floor_is_slope", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_floor_is_slope'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_floor_is_slope"); return 0; } lua_pushinteger(L, mario_floor_is_slope(m)); @@ -8315,10 +12971,16 @@ int smlua_func_mario_floor_is_slope(lua_State* L) { } int smlua_func_mario_floor_is_steep(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_floor_is_steep", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_floor_is_steep'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_floor_is_steep"); return 0; } lua_pushinteger(L, mario_floor_is_steep(m)); @@ -8326,10 +12988,16 @@ int smlua_func_mario_floor_is_steep(lua_State* L) { } int smlua_func_mario_get_floor_class(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_get_floor_class", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_get_floor_class'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_get_floor_class"); return 0; } lua_pushinteger(L, mario_get_floor_class(m)); @@ -8337,10 +13005,16 @@ int smlua_func_mario_get_floor_class(lua_State* L) { } int smlua_func_mario_get_terrain_sound_addend(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_get_terrain_sound_addend", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_get_terrain_sound_addend'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_get_terrain_sound_addend"); return 0; } lua_pushinteger(L, mario_get_terrain_sound_addend(m)); @@ -8348,10 +13022,16 @@ int smlua_func_mario_get_terrain_sound_addend(lua_State* L) { } int smlua_func_mario_set_bubbled(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_set_bubbled", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_set_bubbled'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_set_bubbled"); return 0; } mario_set_bubbled(m); @@ -8359,12 +13039,18 @@ int smlua_func_mario_set_bubbled(lua_State* L) { } int smlua_func_mario_set_forward_vel(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_set_forward_vel", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_set_forward_vel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_set_forward_vel"); return 0; } f32 speed = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_set_forward_vel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_set_forward_vel"); return 0; } mario_set_forward_vel(m, speed); @@ -8372,12 +13058,18 @@ int smlua_func_mario_set_forward_vel(lua_State* L) { } int smlua_func_mario_update_wall(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_update_wall", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_update_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_update_wall"); return 0; } struct WallCollisionData* wcd = (struct WallCollisionData*)smlua_to_cobject(L, 2, LOT_WALLCOLLISIONDATA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_update_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_update_wall"); return 0; } mario_update_wall(m, wcd); @@ -8385,14 +13077,20 @@ int smlua_func_mario_update_wall(lua_State* L) { } int smlua_func_play_mario_action_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_mario_action_sound", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_mario_action_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_mario_action_sound"); return 0; } u32 soundBits = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_mario_action_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_mario_action_sound"); return 0; } u32 waveParticleType = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_mario_action_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_mario_action_sound"); return 0; } play_mario_action_sound(m, soundBits, waveParticleType); @@ -8400,12 +13098,18 @@ int smlua_func_play_mario_action_sound(lua_State* L) { } int smlua_func_play_mario_heavy_landing_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_mario_heavy_landing_sound", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_mario_heavy_landing_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_mario_heavy_landing_sound"); return 0; } u32 soundBits = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_mario_heavy_landing_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_mario_heavy_landing_sound"); return 0; } play_mario_heavy_landing_sound(m, soundBits); @@ -8413,12 +13117,18 @@ int smlua_func_play_mario_heavy_landing_sound(lua_State* L) { } int smlua_func_play_mario_heavy_landing_sound_once(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_mario_heavy_landing_sound_once", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_mario_heavy_landing_sound_once'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_mario_heavy_landing_sound_once"); return 0; } u32 soundBits = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_mario_heavy_landing_sound_once'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_mario_heavy_landing_sound_once"); return 0; } play_mario_heavy_landing_sound_once(m, soundBits); @@ -8426,10 +13136,16 @@ int smlua_func_play_mario_heavy_landing_sound_once(lua_State* L) { } int smlua_func_play_mario_jump_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_mario_jump_sound", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_mario_jump_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_mario_jump_sound"); return 0; } play_mario_jump_sound(m); @@ -8437,12 +13153,18 @@ int smlua_func_play_mario_jump_sound(lua_State* L) { } int smlua_func_play_mario_landing_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_mario_landing_sound", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_mario_landing_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_mario_landing_sound"); return 0; } u32 soundBits = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_mario_landing_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_mario_landing_sound"); return 0; } play_mario_landing_sound(m, soundBits); @@ -8450,12 +13172,18 @@ int smlua_func_play_mario_landing_sound(lua_State* L) { } int smlua_func_play_mario_landing_sound_once(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_mario_landing_sound_once", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_mario_landing_sound_once'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_mario_landing_sound_once"); return 0; } u32 soundBits = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_mario_landing_sound_once'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_mario_landing_sound_once"); return 0; } play_mario_landing_sound_once(m, soundBits); @@ -8463,14 +13191,20 @@ int smlua_func_play_mario_landing_sound_once(lua_State* L) { } int smlua_func_play_mario_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_mario_sound", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_mario_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_mario_sound"); return 0; } s32 primarySoundBits = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_mario_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_mario_sound"); return 0; } s32 scondarySoundBits = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_mario_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_mario_sound"); return 0; } play_mario_sound(m, primarySoundBits, scondarySoundBits); @@ -8478,14 +13212,20 @@ int smlua_func_play_mario_sound(lua_State* L) { } int smlua_func_play_sound_and_spawn_particles(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound_and_spawn_particles", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_sound_and_spawn_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_sound_and_spawn_particles"); return 0; } u32 soundBits = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_sound_and_spawn_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_sound_and_spawn_particles"); return 0; } u32 waveParticleType = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_sound_and_spawn_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_sound_and_spawn_particles"); return 0; } play_sound_and_spawn_particles(m, soundBits, waveParticleType); @@ -8493,14 +13233,20 @@ int smlua_func_play_sound_and_spawn_particles(lua_State* L) { } int smlua_func_play_sound_if_no_flag(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_sound_if_no_flag", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_sound_if_no_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_sound_if_no_flag"); return 0; } u32 soundBits = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_sound_if_no_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_sound_if_no_flag"); return 0; } u32 flags = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_sound_if_no_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_sound_if_no_flag"); return 0; } play_sound_if_no_flag(m, soundBits, flags); @@ -8508,18 +13254,24 @@ int smlua_func_play_sound_if_no_flag(lua_State* L) { } int smlua_func_resolve_and_return_wall_collisions(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "resolve_and_return_wall_collisions", 3, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'resolve_and_return_wall_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "resolve_and_return_wall_collisions"); return 0; } f32 offset = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'resolve_and_return_wall_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "resolve_and_return_wall_collisions"); return 0; } f32 radius = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'resolve_and_return_wall_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "resolve_and_return_wall_collisions"); return 0; } smlua_push_object(L, LOT_SURFACE, resolve_and_return_wall_collisions(pos, offset, radius)); @@ -8531,20 +13283,26 @@ int smlua_func_resolve_and_return_wall_collisions(lua_State* L) { } int smlua_func_resolve_and_return_wall_collisions_data(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "resolve_and_return_wall_collisions_data", 4, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'resolve_and_return_wall_collisions_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "resolve_and_return_wall_collisions_data"); return 0; } f32 offset = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'resolve_and_return_wall_collisions_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "resolve_and_return_wall_collisions_data"); return 0; } f32 radius = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'resolve_and_return_wall_collisions_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "resolve_and_return_wall_collisions_data"); return 0; } struct WallCollisionData* collisionData = (struct WallCollisionData*)smlua_to_cobject(L, 4, LOT_WALLCOLLISIONDATA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'resolve_and_return_wall_collisions_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "resolve_and_return_wall_collisions_data"); return 0; } resolve_and_return_wall_collisions_data(pos, offset, radius, collisionData); @@ -8556,10 +13314,16 @@ int smlua_func_resolve_and_return_wall_collisions_data(lua_State* L) { } int smlua_func_return_mario_anim_y_translation(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "return_mario_anim_y_translation", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'return_mario_anim_y_translation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "return_mario_anim_y_translation"); return 0; } lua_pushinteger(L, return_mario_anim_y_translation(m)); @@ -8567,12 +13331,18 @@ int smlua_func_return_mario_anim_y_translation(lua_State* L) { } int smlua_func_set_anim_to_frame(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_anim_to_frame", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_anim_to_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_anim_to_frame"); return 0; } s16 animFrame = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_anim_to_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_anim_to_frame"); return 0; } set_anim_to_frame(m, animFrame); @@ -8580,10 +13350,16 @@ int smlua_func_set_anim_to_frame(lua_State* L) { } int smlua_func_set_jump_from_landing(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_jump_from_landing", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_jump_from_landing'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_jump_from_landing"); return 0; } lua_pushinteger(L, set_jump_from_landing(m)); @@ -8591,14 +13367,20 @@ int smlua_func_set_jump_from_landing(lua_State* L) { } int smlua_func_set_jumping_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_jumping_action", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_jumping_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_jumping_action"); return 0; } u32 action = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_jumping_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_jumping_action"); return 0; } u32 actionArg = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_jumping_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_jumping_action"); return 0; } lua_pushinteger(L, set_jumping_action(m, action, actionArg)); @@ -8606,14 +13388,20 @@ int smlua_func_set_jumping_action(lua_State* L) { } int smlua_func_set_mario_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_mario_action", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_mario_action"); return 0; } u32 action = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_mario_action"); return 0; } u32 actionArg = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_mario_action"); return 0; } lua_pushinteger(L, set_mario_action(m, action, actionArg)); @@ -8621,14 +13409,20 @@ int smlua_func_set_mario_action(lua_State* L) { } int smlua_func_set_mario_anim_with_accel(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_mario_anim_with_accel", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_mario_anim_with_accel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_mario_anim_with_accel"); return 0; } s32 targetAnimID = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_mario_anim_with_accel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_mario_anim_with_accel"); return 0; } s32 accel = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_mario_anim_with_accel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_mario_anim_with_accel"); return 0; } lua_pushinteger(L, set_mario_anim_with_accel(m, targetAnimID, accel)); @@ -8636,12 +13430,18 @@ int smlua_func_set_mario_anim_with_accel(lua_State* L) { } int smlua_func_set_mario_animation(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_mario_animation", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_mario_animation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_mario_animation"); return 0; } s32 targetAnimID = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_mario_animation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_mario_animation"); return 0; } lua_pushinteger(L, set_mario_animation(m, targetAnimID)); @@ -8649,14 +13449,20 @@ int smlua_func_set_mario_animation(lua_State* L) { } int smlua_func_set_mario_particle_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_mario_particle_flags", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_mario_particle_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_mario_particle_flags"); return 0; } u32 flags = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_mario_particle_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_mario_particle_flags"); return 0; } u8 clear = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_mario_particle_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_mario_particle_flags"); return 0; } set_mario_particle_flags(m, flags, clear); @@ -8664,14 +13470,20 @@ int smlua_func_set_mario_particle_flags(lua_State* L) { } int smlua_func_set_mario_y_vel_based_on_fspeed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_mario_y_vel_based_on_fspeed", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_mario_y_vel_based_on_fspeed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_mario_y_vel_based_on_fspeed"); return 0; } f32 initialVelY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_mario_y_vel_based_on_fspeed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_mario_y_vel_based_on_fspeed"); return 0; } f32 multiplier = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_mario_y_vel_based_on_fspeed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_mario_y_vel_based_on_fspeed"); return 0; } set_mario_y_vel_based_on_fspeed(m, initialVelY, multiplier); @@ -8679,10 +13491,16 @@ int smlua_func_set_mario_y_vel_based_on_fspeed(lua_State* L) { } int smlua_func_set_steep_jump_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_steep_jump_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_steep_jump_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_steep_jump_action"); return 0; } set_steep_jump_action(m); @@ -8690,10 +13508,16 @@ int smlua_func_set_steep_jump_action(lua_State* L) { } int smlua_func_set_water_plunge_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_water_plunge_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_water_plunge_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_water_plunge_action"); return 0; } lua_pushinteger(L, set_water_plunge_action(m)); @@ -8701,10 +13525,16 @@ int smlua_func_set_water_plunge_action(lua_State* L) { } int smlua_func_transition_submerged_to_walking(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "transition_submerged_to_walking", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'transition_submerged_to_walking'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "transition_submerged_to_walking"); return 0; } lua_pushinteger(L, transition_submerged_to_walking(m)); @@ -8712,10 +13542,16 @@ int smlua_func_transition_submerged_to_walking(lua_State* L) { } int smlua_func_update_mario_pos_for_anim(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_mario_pos_for_anim", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_mario_pos_for_anim'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_mario_pos_for_anim"); return 0; } update_mario_pos_for_anim(m); @@ -8723,10 +13559,16 @@ int smlua_func_update_mario_pos_for_anim(lua_State* L) { } int smlua_func_update_mario_sound_and_camera(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_mario_sound_and_camera", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_mario_sound_and_camera'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_mario_sound_and_camera"); return 0; } update_mario_sound_and_camera(m); @@ -8735,18 +13577,24 @@ int smlua_func_update_mario_sound_and_camera(lua_State* L) { /* int smlua_func_vec3f_find_ceil(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_find_ceil", 3, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_find_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_find_ceil"); return 0; } f32 height = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_find_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_find_ceil"); return 0; } // struct Surface** ceil = (struct Surface**)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_find_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_find_ceil"); return 0; } lua_pushnumber(L, vec3f_find_ceil(pos, height, ceil)); @@ -8760,18 +13608,24 @@ int smlua_func_vec3f_find_ceil(lua_State* L) { /* int smlua_func_vec3f_mario_ceil(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_mario_ceil", 3, top); + return 0; + } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(1, "x"); pos[1] = smlua_get_number_field(1, "y"); pos[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_mario_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_mario_ceil"); return 0; } f32 height = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_mario_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_mario_ceil"); return 0; } // struct Surface** ceil = (struct Surface**)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_mario_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_mario_ceil"); return 0; } lua_pushnumber(L, vec3f_mario_ceil(pos, height, ceil)); @@ -8788,10 +13642,16 @@ int smlua_func_vec3f_mario_ceil(lua_State* L) { ////////////////////////////// int smlua_func_check_common_airborne_cancels(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_airborne_cancels", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_airborne_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_airborne_cancels"); return 0; } extern s32 check_common_airborne_cancels(struct MarioState *m); lua_pushinteger(L, check_common_airborne_cancels(m)); @@ -8800,12 +13660,18 @@ int smlua_func_check_common_airborne_cancels(lua_State* L) { } int smlua_func_check_fall_damage(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_fall_damage", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_fall_damage'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_fall_damage"); return 0; } u32 hardFallAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'check_fall_damage'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "check_fall_damage"); return 0; } extern s32 check_fall_damage(struct MarioState *m, u32 hardFallAction); lua_pushinteger(L, check_fall_damage(m, hardFallAction)); @@ -8814,12 +13680,18 @@ int smlua_func_check_fall_damage(lua_State* L) { } int smlua_func_check_fall_damage_or_get_stuck(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_fall_damage_or_get_stuck", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_fall_damage_or_get_stuck'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_fall_damage_or_get_stuck"); return 0; } u32 hardFallAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'check_fall_damage_or_get_stuck'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "check_fall_damage_or_get_stuck"); return 0; } extern s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction); lua_pushinteger(L, check_fall_damage_or_get_stuck(m, hardFallAction)); @@ -8828,10 +13700,16 @@ int smlua_func_check_fall_damage_or_get_stuck(lua_State* L) { } int smlua_func_check_horizontal_wind(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_horizontal_wind", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_horizontal_wind'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_horizontal_wind"); return 0; } extern s32 check_horizontal_wind(struct MarioState *m); lua_pushinteger(L, check_horizontal_wind(m)); @@ -8840,10 +13718,16 @@ int smlua_func_check_horizontal_wind(lua_State* L) { } int smlua_func_check_kick_or_dive_in_air(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_kick_or_dive_in_air", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_kick_or_dive_in_air'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_kick_or_dive_in_air"); return 0; } extern s32 check_kick_or_dive_in_air(struct MarioState *m); lua_pushinteger(L, check_kick_or_dive_in_air(m)); @@ -8852,10 +13736,16 @@ int smlua_func_check_kick_or_dive_in_air(lua_State* L) { } int smlua_func_check_wall_kick(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_wall_kick", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_wall_kick'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_wall_kick"); return 0; } extern s32 check_wall_kick(struct MarioState *m); lua_pushinteger(L, check_wall_kick(m)); @@ -8864,16 +13754,22 @@ int smlua_func_check_wall_kick(lua_State* L) { } int smlua_func_common_air_action_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "common_air_action_step", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'common_air_action_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "common_air_action_step"); return 0; } u32 landAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'common_air_action_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "common_air_action_step"); return 0; } s32 animation = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'common_air_action_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "common_air_action_step"); return 0; } u32 stepArg = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'common_air_action_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "common_air_action_step"); return 0; } extern u32 common_air_action_step(struct MarioState *m, u32 landAction, s32 animation, u32 stepArg); lua_pushinteger(L, common_air_action_step(m, landAction, animation, stepArg)); @@ -8882,18 +13778,24 @@ int smlua_func_common_air_action_step(lua_State* L) { } int smlua_func_common_air_knockback_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "common_air_knockback_step", 5, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'common_air_knockback_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "common_air_knockback_step"); return 0; } u32 landAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'common_air_knockback_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "common_air_knockback_step"); return 0; } u32 hardFallAction = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'common_air_knockback_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "common_air_knockback_step"); return 0; } s32 animation = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'common_air_knockback_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "common_air_knockback_step"); return 0; } f32 speed = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'common_air_knockback_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "common_air_knockback_step"); return 0; } extern u32 common_air_knockback_step(struct MarioState *m, u32 landAction, u32 hardFallAction, s32 animation, f32 speed); lua_pushinteger(L, common_air_knockback_step(m, landAction, hardFallAction, animation, speed)); @@ -8902,10 +13804,16 @@ int smlua_func_common_air_knockback_step(lua_State* L) { } int smlua_func_lava_boost_on_wall(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "lava_boost_on_wall", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'lava_boost_on_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "lava_boost_on_wall"); return 0; } extern s32 lava_boost_on_wall(struct MarioState *m); lua_pushinteger(L, lava_boost_on_wall(m)); @@ -8914,10 +13822,16 @@ int smlua_func_lava_boost_on_wall(lua_State* L) { } int smlua_func_mario_execute_airborne_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_execute_airborne_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_execute_airborne_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_execute_airborne_action"); return 0; } extern s32 mario_execute_airborne_action(struct MarioState *m); lua_pushinteger(L, mario_execute_airborne_action(m)); @@ -8926,10 +13840,16 @@ int smlua_func_mario_execute_airborne_action(lua_State* L) { } int smlua_func_play_far_fall_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_far_fall_sound", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_far_fall_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_far_fall_sound"); return 0; } extern void play_far_fall_sound(struct MarioState *m); play_far_fall_sound(m); @@ -8938,16 +13858,22 @@ int smlua_func_play_far_fall_sound(lua_State* L) { } int smlua_func_play_flip_sounds(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_flip_sounds", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_flip_sounds'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_flip_sounds"); return 0; } s16 frame1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_flip_sounds'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_flip_sounds"); return 0; } s16 frame2 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_flip_sounds'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_flip_sounds"); return 0; } s16 frame3 = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'play_flip_sounds'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "play_flip_sounds"); return 0; } extern void play_flip_sounds(struct MarioState *m, s16 frame1, s16 frame2, s16 frame3); play_flip_sounds(m, frame1, frame2, frame3); @@ -8956,10 +13882,16 @@ int smlua_func_play_flip_sounds(lua_State* L) { } int smlua_func_play_knockback_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_knockback_sound", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_knockback_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_knockback_sound"); return 0; } extern void play_knockback_sound(struct MarioState *m); play_knockback_sound(m); @@ -8968,10 +13900,16 @@ int smlua_func_play_knockback_sound(lua_State* L) { } int smlua_func_should_get_stuck_in_ground(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "should_get_stuck_in_ground", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'should_get_stuck_in_ground'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "should_get_stuck_in_ground"); return 0; } extern s32 should_get_stuck_in_ground(struct MarioState *m); lua_pushinteger(L, should_get_stuck_in_ground(m)); @@ -8980,10 +13918,16 @@ int smlua_func_should_get_stuck_in_ground(lua_State* L) { } int smlua_func_update_air_with_turn(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_air_with_turn", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_air_with_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_air_with_turn"); return 0; } extern void update_air_with_turn(struct MarioState *m); update_air_with_turn(m); @@ -8992,10 +13936,16 @@ int smlua_func_update_air_with_turn(lua_State* L) { } int smlua_func_update_air_without_turn(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_air_without_turn", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_air_without_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_air_without_turn"); return 0; } extern void update_air_without_turn(struct MarioState *m); update_air_without_turn(m); @@ -9004,10 +13954,16 @@ int smlua_func_update_air_without_turn(lua_State* L) { } int smlua_func_update_flying(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_flying", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_flying'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_flying"); return 0; } extern void update_flying(struct MarioState *m); update_flying(m); @@ -9016,10 +13972,16 @@ int smlua_func_update_flying(lua_State* L) { } int smlua_func_update_flying_pitch(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_flying_pitch", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_flying_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_flying_pitch"); return 0; } extern void update_flying_pitch(struct MarioState *m); update_flying_pitch(m); @@ -9028,10 +13990,16 @@ int smlua_func_update_flying_pitch(lua_State* L) { } int smlua_func_update_flying_yaw(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_flying_yaw", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_flying_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_flying_yaw"); return 0; } extern void update_flying_yaw(struct MarioState *m); update_flying_yaw(m); @@ -9040,10 +14008,16 @@ int smlua_func_update_flying_yaw(lua_State* L) { } int smlua_func_update_lava_boost_or_twirling(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_lava_boost_or_twirling", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_lava_boost_or_twirling'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_lava_boost_or_twirling"); return 0; } extern void update_lava_boost_or_twirling(struct MarioState *m); update_lava_boost_or_twirling(m); @@ -9056,10 +14030,16 @@ int smlua_func_update_lava_boost_or_twirling(lua_State* L) { /////////////////////////////// int smlua_func_add_tree_leaf_particles(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "add_tree_leaf_particles", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'add_tree_leaf_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "add_tree_leaf_particles"); return 0; } extern void add_tree_leaf_particles(struct MarioState *m); add_tree_leaf_particles(m); @@ -9068,10 +14048,16 @@ int smlua_func_add_tree_leaf_particles(lua_State* L) { } int smlua_func_check_common_automatic_cancels(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_automatic_cancels", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_automatic_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_automatic_cancels"); return 0; } extern s32 check_common_automatic_cancels(struct MarioState *m); lua_pushinteger(L, check_common_automatic_cancels(m)); @@ -9080,10 +14066,16 @@ int smlua_func_check_common_automatic_cancels(lua_State* L) { } int smlua_func_climb_up_ledge(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "climb_up_ledge", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'climb_up_ledge'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "climb_up_ledge"); return 0; } extern void climb_up_ledge(struct MarioState *m); climb_up_ledge(m); @@ -9092,10 +14084,16 @@ int smlua_func_climb_up_ledge(lua_State* L) { } int smlua_func_let_go_of_ledge(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "let_go_of_ledge", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'let_go_of_ledge'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "let_go_of_ledge"); return 0; } extern s32 let_go_of_ledge(struct MarioState *m); lua_pushinteger(L, let_go_of_ledge(m)); @@ -9104,10 +14102,16 @@ int smlua_func_let_go_of_ledge(lua_State* L) { } int smlua_func_mario_execute_automatic_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_execute_automatic_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_execute_automatic_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_execute_automatic_action"); return 0; } extern s32 mario_execute_automatic_action(struct MarioState *m); lua_pushinteger(L, mario_execute_automatic_action(m)); @@ -9116,16 +14120,22 @@ int smlua_func_mario_execute_automatic_action(lua_State* L) { } int smlua_func_perform_hanging_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "perform_hanging_step", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'perform_hanging_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "perform_hanging_step"); return 0; } f32* nextPos = smlua_get_vec3f_from_buffer(); nextPos[0] = smlua_get_number_field(2, "x"); nextPos[1] = smlua_get_number_field(2, "y"); nextPos[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'perform_hanging_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "perform_hanging_step"); return 0; } extern s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos); lua_pushinteger(L, perform_hanging_step(m, nextPos)); @@ -9138,12 +14148,18 @@ int smlua_func_perform_hanging_step(lua_State* L) { } int smlua_func_play_climbing_sounds(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_climbing_sounds", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_climbing_sounds'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_climbing_sounds"); return 0; } s32 b = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_climbing_sounds'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_climbing_sounds"); return 0; } extern void play_climbing_sounds(struct MarioState *m, s32 b); play_climbing_sounds(m, b); @@ -9152,12 +14168,18 @@ int smlua_func_play_climbing_sounds(lua_State* L) { } int smlua_func_set_pole_position(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_pole_position", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_pole_position'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_pole_position"); return 0; } f32 offsetY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_pole_position'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_pole_position"); return 0; } extern s32 set_pole_position(struct MarioState *m, f32 offsetY); lua_pushinteger(L, set_pole_position(m, offsetY)); @@ -9166,10 +14188,16 @@ int smlua_func_set_pole_position(lua_State* L) { } int smlua_func_update_hang_moving(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_hang_moving", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_hang_moving'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_hang_moving"); return 0; } extern s32 update_hang_moving(struct MarioState *m); lua_pushinteger(L, update_hang_moving(m)); @@ -9178,10 +14206,16 @@ int smlua_func_update_hang_moving(lua_State* L) { } int smlua_func_update_hang_stationary(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_hang_stationary", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_hang_stationary'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_hang_stationary"); return 0; } extern void update_hang_stationary(struct MarioState *m); update_hang_stationary(m); @@ -9190,14 +14224,20 @@ int smlua_func_update_hang_stationary(lua_State* L) { } int smlua_func_update_ledge_climb(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_ledge_climb", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_ledge_climb'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_ledge_climb"); return 0; } s32 animation = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'update_ledge_climb'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "update_ledge_climb"); return 0; } u32 endAction = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'update_ledge_climb'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "update_ledge_climb"); return 0; } extern void update_ledge_climb(struct MarioState *m, s32 animation, u32 endAction); update_ledge_climb(m, animation, endAction); @@ -9206,10 +14246,16 @@ int smlua_func_update_ledge_climb(lua_State* L) { } int smlua_func_update_ledge_climb_camera(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_ledge_climb_camera", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_ledge_climb_camera'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_ledge_climb_camera"); return 0; } extern void update_ledge_climb_camera(struct MarioState *m); update_ledge_climb_camera(m); @@ -9222,7 +14268,13 @@ int smlua_func_update_ledge_climb_camera(lua_State* L) { ////////////////////////////// int smlua_func_bhv_end_peach_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_end_peach_loop", 0, top); + return 0; + } extern void bhv_end_peach_loop(void); @@ -9232,7 +14284,13 @@ int smlua_func_bhv_end_peach_loop(UNUSED lua_State* L) { } int smlua_func_bhv_end_toad_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_end_toad_loop", 0, top); + return 0; + } extern void bhv_end_toad_loop(void); @@ -9242,14 +14300,20 @@ int smlua_func_bhv_end_toad_loop(UNUSED lua_State* L) { } int smlua_func_common_death_handler(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "common_death_handler", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'common_death_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "common_death_handler"); return 0; } s32 animation = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'common_death_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "common_death_handler"); return 0; } s32 frameToDeathWarp = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'common_death_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "common_death_handler"); return 0; } extern s32 common_death_handler(struct MarioState *m, s32 animation, s32 frameToDeathWarp); lua_pushinteger(L, common_death_handler(m, animation, frameToDeathWarp)); @@ -9258,10 +14322,16 @@ int smlua_func_common_death_handler(lua_State* L) { } int smlua_func_cutscene_put_cap_on(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cutscene_put_cap_on", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cutscene_put_cap_on'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cutscene_put_cap_on"); return 0; } extern void cutscene_put_cap_on(struct MarioState *m); cutscene_put_cap_on(m); @@ -9270,10 +14340,16 @@ int smlua_func_cutscene_put_cap_on(lua_State* L) { } int smlua_func_cutscene_take_cap_off(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cutscene_take_cap_off", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cutscene_take_cap_off'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cutscene_take_cap_off"); return 0; } extern void cutscene_take_cap_off(struct MarioState *m); cutscene_take_cap_off(m); @@ -9282,12 +14358,18 @@ int smlua_func_cutscene_take_cap_off(lua_State* L) { } int smlua_func_general_star_dance_handler(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "general_star_dance_handler", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'general_star_dance_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "general_star_dance_handler"); return 0; } s32 isInWater = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'general_star_dance_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "general_star_dance_handler"); return 0; } extern void general_star_dance_handler(struct MarioState *m, s32 isInWater); general_star_dance_handler(m, isInWater); @@ -9296,16 +14378,22 @@ int smlua_func_general_star_dance_handler(lua_State* L) { } int smlua_func_generate_yellow_sparkles(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "generate_yellow_sparkles", 4, top); + return 0; + } s16 x = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'generate_yellow_sparkles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "generate_yellow_sparkles"); return 0; } s16 y = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'generate_yellow_sparkles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "generate_yellow_sparkles"); return 0; } s16 z = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'generate_yellow_sparkles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "generate_yellow_sparkles"); return 0; } f32 radius = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'generate_yellow_sparkles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "generate_yellow_sparkles"); return 0; } extern void generate_yellow_sparkles(s16 x, s16 y, s16 z, f32 radius); generate_yellow_sparkles(x, y, z, radius); @@ -9313,25 +14401,35 @@ int smlua_func_generate_yellow_sparkles(lua_State* L) { return 1; } -/* int smlua_func_get_credits_str_width(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } -// char * str = (char *)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_credits_str_width'"); return 0; } + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_credits_str_width", 1, top); + return 0; + } + + char * str = (char *)smlua_to_cpointer(L, 1, LVT_STRING_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_credits_str_width"); return 0; } extern s32 get_credits_str_width(char *str); lua_pushinteger(L, get_credits_str_width(str)); return 1; } -*/ int smlua_func_get_star_collection_dialog(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_star_collection_dialog", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_star_collection_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_star_collection_dialog"); return 0; } extern s32 get_star_collection_dialog(struct MarioState *m); lua_pushinteger(L, get_star_collection_dialog(m)); @@ -9340,10 +14438,16 @@ int smlua_func_get_star_collection_dialog(lua_State* L) { } int smlua_func_handle_save_menu(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "handle_save_menu", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'handle_save_menu'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "handle_save_menu"); return 0; } extern void handle_save_menu(struct MarioState *m); handle_save_menu(m); @@ -9352,16 +14456,22 @@ int smlua_func_handle_save_menu(lua_State* L) { } int smlua_func_launch_mario_until_land(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "launch_mario_until_land", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'launch_mario_until_land'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "launch_mario_until_land"); return 0; } s32 endAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'launch_mario_until_land'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "launch_mario_until_land"); return 0; } s32 animation = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'launch_mario_until_land'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "launch_mario_until_land"); return 0; } f32 forwardVel = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'launch_mario_until_land'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "launch_mario_until_land"); return 0; } extern s32 launch_mario_until_land(struct MarioState *m, s32 endAction, s32 animation, f32 forwardVel); lua_pushinteger(L, launch_mario_until_land(m, endAction, animation, forwardVel)); @@ -9370,10 +14480,16 @@ int smlua_func_launch_mario_until_land(lua_State* L) { } int smlua_func_mario_execute_cutscene_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_execute_cutscene_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_execute_cutscene_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_execute_cutscene_action"); return 0; } extern s32 mario_execute_cutscene_action(struct MarioState *m); lua_pushinteger(L, mario_execute_cutscene_action(m)); @@ -9382,10 +14498,16 @@ int smlua_func_mario_execute_cutscene_action(lua_State* L) { } int smlua_func_mario_ready_to_speak(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_ready_to_speak", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_ready_to_speak'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_ready_to_speak"); return 0; } extern s32 mario_ready_to_speak(struct MarioState* m); lua_pushinteger(L, mario_ready_to_speak(m)); @@ -9394,7 +14516,13 @@ int smlua_func_mario_ready_to_speak(lua_State* L) { } int smlua_func_print_displaying_credits_entry(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "print_displaying_credits_entry", 0, top); + return 0; + } extern void print_displaying_credits_entry(void); @@ -9404,12 +14532,18 @@ int smlua_func_print_displaying_credits_entry(UNUSED lua_State* L) { } int smlua_func_should_start_or_continue_dialog(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "should_start_or_continue_dialog", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'should_start_or_continue_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "should_start_or_continue_dialog"); return 0; } struct Object* object = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'should_start_or_continue_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "should_start_or_continue_dialog"); return 0; } extern u8 should_start_or_continue_dialog(struct MarioState* m, struct Object* object); lua_pushinteger(L, should_start_or_continue_dialog(m, object)); @@ -9418,20 +14552,26 @@ int smlua_func_should_start_or_continue_dialog(lua_State* L) { } int smlua_func_stuck_in_ground_handler(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stuck_in_ground_handler", 6, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'stuck_in_ground_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "stuck_in_ground_handler"); return 0; } s32 animation = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'stuck_in_ground_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "stuck_in_ground_handler"); return 0; } s32 unstuckFrame = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'stuck_in_ground_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "stuck_in_ground_handler"); return 0; } s32 target2 = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'stuck_in_ground_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "stuck_in_ground_handler"); return 0; } s32 target3 = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'stuck_in_ground_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "stuck_in_ground_handler"); return 0; } s32 endAction = smlua_to_integer(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'stuck_in_ground_handler'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "stuck_in_ground_handler"); return 0; } extern void stuck_in_ground_handler(struct MarioState *m, s32 animation, s32 unstuckFrame, s32 target2, s32 target3, s32 endAction); stuck_in_ground_handler(m, animation, unstuckFrame, target2, target3, endAction); @@ -9444,10 +14584,16 @@ int smlua_func_stuck_in_ground_handler(lua_State* L) { //////////////////////////// int smlua_func_align_with_floor(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "align_with_floor", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'align_with_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "align_with_floor"); return 0; } extern void align_with_floor(struct MarioState *m); align_with_floor(m); @@ -9456,10 +14602,16 @@ int smlua_func_align_with_floor(lua_State* L) { } int smlua_func_analog_stick_held_back(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "analog_stick_held_back", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'analog_stick_held_back'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "analog_stick_held_back"); return 0; } extern s32 analog_stick_held_back(struct MarioState *m); lua_pushinteger(L, analog_stick_held_back(m)); @@ -9468,10 +14620,16 @@ int smlua_func_analog_stick_held_back(lua_State* L) { } int smlua_func_anim_and_audio_for_heavy_walk(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "anim_and_audio_for_heavy_walk", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'anim_and_audio_for_heavy_walk'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "anim_and_audio_for_heavy_walk"); return 0; } extern void anim_and_audio_for_heavy_walk(struct MarioState *m); anim_and_audio_for_heavy_walk(m); @@ -9480,10 +14638,16 @@ int smlua_func_anim_and_audio_for_heavy_walk(lua_State* L) { } int smlua_func_anim_and_audio_for_hold_walk(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "anim_and_audio_for_hold_walk", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'anim_and_audio_for_hold_walk'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "anim_and_audio_for_hold_walk"); return 0; } extern void anim_and_audio_for_hold_walk(struct MarioState *m); anim_and_audio_for_hold_walk(m); @@ -9492,10 +14656,16 @@ int smlua_func_anim_and_audio_for_hold_walk(lua_State* L) { } int smlua_func_anim_and_audio_for_walk(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "anim_and_audio_for_walk", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'anim_and_audio_for_walk'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "anim_and_audio_for_walk"); return 0; } extern void anim_and_audio_for_walk(struct MarioState *m); anim_and_audio_for_walk(m); @@ -9504,12 +14674,18 @@ int smlua_func_anim_and_audio_for_walk(lua_State* L) { } int smlua_func_apply_landing_accel(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "apply_landing_accel", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'apply_landing_accel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "apply_landing_accel"); return 0; } f32 frictionFactor = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'apply_landing_accel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "apply_landing_accel"); return 0; } extern s32 apply_landing_accel(struct MarioState *m, f32 frictionFactor); lua_pushinteger(L, apply_landing_accel(m, frictionFactor)); @@ -9518,10 +14694,16 @@ int smlua_func_apply_landing_accel(lua_State* L) { } int smlua_func_apply_slope_accel(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "apply_slope_accel", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'apply_slope_accel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "apply_slope_accel"); return 0; } extern void apply_slope_accel(struct MarioState *m); apply_slope_accel(m); @@ -9530,12 +14712,18 @@ int smlua_func_apply_slope_accel(lua_State* L) { } int smlua_func_apply_slope_decel(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "apply_slope_decel", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'apply_slope_decel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "apply_slope_decel"); return 0; } f32 decelCoef = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'apply_slope_decel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "apply_slope_decel"); return 0; } extern s32 apply_slope_decel(struct MarioState *m, f32 decelCoef); lua_pushinteger(L, apply_slope_decel(m, decelCoef)); @@ -9544,10 +14732,16 @@ int smlua_func_apply_slope_decel(lua_State* L) { } int smlua_func_begin_braking_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "begin_braking_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'begin_braking_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "begin_braking_action"); return 0; } extern s32 begin_braking_action(struct MarioState *m); lua_pushinteger(L, begin_braking_action(m)); @@ -9556,16 +14750,22 @@ int smlua_func_begin_braking_action(lua_State* L) { } int smlua_func_begin_walking_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "begin_walking_action", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'begin_walking_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "begin_walking_action"); return 0; } f32 forwardVel = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'begin_walking_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "begin_walking_action"); return 0; } u32 action = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'begin_walking_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "begin_walking_action"); return 0; } u32 actionArg = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'begin_walking_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "begin_walking_action"); return 0; } extern s32 begin_walking_action(struct MarioState *m, f32 forwardVel, u32 action, u32 actionArg); lua_pushinteger(L, begin_walking_action(m, forwardVel, action, actionArg)); @@ -9574,10 +14774,16 @@ int smlua_func_begin_walking_action(lua_State* L) { } int smlua_func_check_common_moving_cancels(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_moving_cancels", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_moving_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_moving_cancels"); return 0; } extern s32 check_common_moving_cancels(struct MarioState *m); lua_pushinteger(L, check_common_moving_cancels(m)); @@ -9586,10 +14792,16 @@ int smlua_func_check_common_moving_cancels(lua_State* L) { } int smlua_func_check_ground_dive_or_punch(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_ground_dive_or_punch", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_ground_dive_or_punch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_ground_dive_or_punch"); return 0; } extern s32 check_ground_dive_or_punch(struct MarioState *m); lua_pushinteger(L, check_ground_dive_or_punch(m)); @@ -9598,10 +14810,16 @@ int smlua_func_check_ground_dive_or_punch(lua_State* L) { } int smlua_func_check_ledge_climb_down(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_ledge_climb_down", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_ledge_climb_down'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_ledge_climb_down"); return 0; } extern void check_ledge_climb_down(struct MarioState *m); check_ledge_climb_down(m); @@ -9610,18 +14828,24 @@ int smlua_func_check_ledge_climb_down(lua_State* L) { } int smlua_func_common_ground_knockback_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "common_ground_knockback_action", 5, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'common_ground_knockback_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "common_ground_knockback_action"); return 0; } s32 animation = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'common_ground_knockback_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "common_ground_knockback_action"); return 0; } s32 arg2 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'common_ground_knockback_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "common_ground_knockback_action"); return 0; } s32 arg3 = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'common_ground_knockback_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "common_ground_knockback_action"); return 0; } s32 arg4 = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'common_ground_knockback_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "common_ground_knockback_action"); return 0; } extern s32 common_ground_knockback_action(struct MarioState *m, s32 animation, s32 arg2, s32 arg3, s32 arg4); lua_pushinteger(L, common_ground_knockback_action(m, animation, arg2, arg3, arg4)); @@ -9630,14 +14854,20 @@ int smlua_func_common_ground_knockback_action(lua_State* L) { } int smlua_func_common_landing_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "common_landing_action", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'common_landing_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "common_landing_action"); return 0; } s16 animation = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'common_landing_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "common_landing_action"); return 0; } u32 airAction = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'common_landing_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "common_landing_action"); return 0; } extern u32 common_landing_action(struct MarioState *m, s16 animation, u32 airAction); lua_pushinteger(L, common_landing_action(m, animation, airAction)); @@ -9647,18 +14877,24 @@ int smlua_func_common_landing_action(lua_State* L) { /* int smlua_func_common_landing_cancels(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "common_landing_cancels", 5, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'common_landing_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "common_landing_cancels"); return 0; } struct LandingAction* landingAction = (struct LandingAction*)smlua_to_cobject(L, 2, LOT_LANDINGACTION); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'common_landing_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "common_landing_cancels"); return 0; } // s32 (*setAPressAction)(structMarioState* arg2 = (s32 (*setAPressAction)(structMarioState*)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'common_landing_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "common_landing_cancels"); return 0; } u32 arg3 = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'common_landing_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "common_landing_cancels"); return 0; } // u32) arg4 = (u32))smlua_to_cobject(L, 5, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'common_landing_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "common_landing_cancels"); return 0; } extern s32 common_landing_cancels(struct MarioState *m, struct LandingAction *landingAction, s32 (*setAPressAction)(struct MarioState *, u32, u32)); lua_pushinteger(L, common_landing_cancels(m, landingAction, arg2, arg3, arg4)); @@ -9668,16 +14904,22 @@ int smlua_func_common_landing_cancels(lua_State* L) { */ int smlua_func_common_slide_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "common_slide_action", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'common_slide_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "common_slide_action"); return 0; } u32 endAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'common_slide_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "common_slide_action"); return 0; } u32 airAction = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'common_slide_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "common_slide_action"); return 0; } s32 animation = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'common_slide_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "common_slide_action"); return 0; } extern void common_slide_action(struct MarioState *m, u32 endAction, u32 airAction, s32 animation); common_slide_action(m, endAction, airAction, animation); @@ -9686,18 +14928,24 @@ int smlua_func_common_slide_action(lua_State* L) { } int smlua_func_common_slide_action_with_jump(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "common_slide_action_with_jump", 5, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'common_slide_action_with_jump'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "common_slide_action_with_jump"); return 0; } u32 stopAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'common_slide_action_with_jump'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "common_slide_action_with_jump"); return 0; } u32 jumpAction = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'common_slide_action_with_jump'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "common_slide_action_with_jump"); return 0; } u32 airAction = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'common_slide_action_with_jump'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "common_slide_action_with_jump"); return 0; } s32 animation = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'common_slide_action_with_jump'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "common_slide_action_with_jump"); return 0; } extern s32 common_slide_action_with_jump(struct MarioState *m, u32 stopAction, u32 jumpAction, u32 airAction, s32 animation); lua_pushinteger(L, common_slide_action_with_jump(m, stopAction, jumpAction, airAction, animation)); @@ -9706,10 +14954,16 @@ int smlua_func_common_slide_action_with_jump(lua_State* L) { } int smlua_func_mario_execute_moving_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_execute_moving_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_execute_moving_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_execute_moving_action"); return 0; } extern s32 mario_execute_moving_action(struct MarioState *m); lua_pushinteger(L, mario_execute_moving_action(m)); @@ -9718,14 +14972,20 @@ int smlua_func_mario_execute_moving_action(lua_State* L) { } int smlua_func_play_step_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_step_sound", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_step_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_step_sound"); return 0; } s16 frame1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_step_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_step_sound"); return 0; } s16 frame2 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_step_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_step_sound"); return 0; } extern void play_step_sound(struct MarioState *m, s16 frame1, s16 frame2); play_step_sound(m, frame1, frame2); @@ -9734,16 +14994,22 @@ int smlua_func_play_step_sound(lua_State* L) { } int smlua_func_push_or_sidle_wall(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "push_or_sidle_wall", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'push_or_sidle_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "push_or_sidle_wall"); return 0; } f32* startPos = smlua_get_vec3f_from_buffer(); startPos[0] = smlua_get_number_field(2, "x"); startPos[1] = smlua_get_number_field(2, "y"); startPos[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'push_or_sidle_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "push_or_sidle_wall"); return 0; } extern void push_or_sidle_wall(struct MarioState *m, Vec3f startPos); push_or_sidle_wall(m, startPos); @@ -9756,18 +15022,24 @@ int smlua_func_push_or_sidle_wall(lua_State* L) { } int smlua_func_quicksand_jump_land_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "quicksand_jump_land_action", 5, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'quicksand_jump_land_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "quicksand_jump_land_action"); return 0; } s32 animation1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'quicksand_jump_land_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "quicksand_jump_land_action"); return 0; } s32 animation2 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'quicksand_jump_land_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "quicksand_jump_land_action"); return 0; } u32 endAction = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'quicksand_jump_land_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "quicksand_jump_land_action"); return 0; } u32 airAction = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'quicksand_jump_land_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "quicksand_jump_land_action"); return 0; } extern s32 quicksand_jump_land_action(struct MarioState *m, s32 animation1, s32 animation2, u32 endAction, u32 airAction); lua_pushinteger(L, quicksand_jump_land_action(m, animation1, animation2, endAction, airAction)); @@ -9776,14 +15048,20 @@ int smlua_func_quicksand_jump_land_action(lua_State* L) { } int smlua_func_set_triple_jump_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_triple_jump_action", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_triple_jump_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_triple_jump_action"); return 0; } u32 action = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_triple_jump_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_triple_jump_action"); return 0; } u32 actionArg = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_triple_jump_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_triple_jump_action"); return 0; } extern s32 set_triple_jump_action(struct MarioState *m, UNUSED u32 action, UNUSED u32 actionArg); lua_pushinteger(L, set_triple_jump_action(m, action, actionArg)); @@ -9792,10 +15070,16 @@ int smlua_func_set_triple_jump_action(lua_State* L) { } int smlua_func_should_begin_sliding(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "should_begin_sliding", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'should_begin_sliding'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "should_begin_sliding"); return 0; } extern s32 should_begin_sliding(struct MarioState *m); lua_pushinteger(L, should_begin_sliding(m)); @@ -9804,14 +15088,20 @@ int smlua_func_should_begin_sliding(lua_State* L) { } int smlua_func_slide_bonk(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "slide_bonk", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'slide_bonk'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "slide_bonk"); return 0; } u32 fastAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'slide_bonk'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "slide_bonk"); return 0; } u32 slowAction = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'slide_bonk'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "slide_bonk"); return 0; } extern void slide_bonk(struct MarioState *m, u32 fastAction, u32 slowAction); slide_bonk(m, fastAction, slowAction); @@ -9820,16 +15110,22 @@ int smlua_func_slide_bonk(lua_State* L) { } int smlua_func_stomach_slide_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stomach_slide_action", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'stomach_slide_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "stomach_slide_action"); return 0; } u32 stopAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'stomach_slide_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "stomach_slide_action"); return 0; } u32 airAction = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'stomach_slide_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "stomach_slide_action"); return 0; } s32 animation = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'stomach_slide_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "stomach_slide_action"); return 0; } extern s32 stomach_slide_action(struct MarioState *m, u32 stopAction, u32 airAction, s32 animation); lua_pushinteger(L, stomach_slide_action(m, stopAction, airAction, animation)); @@ -9838,10 +15134,16 @@ int smlua_func_stomach_slide_action(lua_State* L) { } int smlua_func_tilt_body_butt_slide(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "tilt_body_butt_slide", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'tilt_body_butt_slide'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "tilt_body_butt_slide"); return 0; } extern void tilt_body_butt_slide(struct MarioState *m); tilt_body_butt_slide(m); @@ -9850,12 +15152,18 @@ int smlua_func_tilt_body_butt_slide(lua_State* L) { } int smlua_func_tilt_body_ground_shell(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "tilt_body_ground_shell", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'tilt_body_ground_shell'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "tilt_body_ground_shell"); return 0; } s16 startYaw = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'tilt_body_ground_shell'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "tilt_body_ground_shell"); return 0; } extern void tilt_body_ground_shell(struct MarioState *m, s16 startYaw); tilt_body_ground_shell(m, startYaw); @@ -9864,10 +15172,16 @@ int smlua_func_tilt_body_ground_shell(lua_State* L) { } int smlua_func_tilt_body_running(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "tilt_body_running", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'tilt_body_running'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "tilt_body_running"); return 0; } extern s16 tilt_body_running(struct MarioState *m); lua_pushinteger(L, tilt_body_running(m)); @@ -9876,12 +15190,18 @@ int smlua_func_tilt_body_running(lua_State* L) { } int smlua_func_tilt_body_walking(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "tilt_body_walking", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'tilt_body_walking'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "tilt_body_walking"); return 0; } s16 startYaw = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'tilt_body_walking'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "tilt_body_walking"); return 0; } extern void tilt_body_walking(struct MarioState *m, s16 startYaw); tilt_body_walking(m, startYaw); @@ -9890,10 +15210,16 @@ int smlua_func_tilt_body_walking(lua_State* L) { } int smlua_func_update_decelerating_speed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_decelerating_speed", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_decelerating_speed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_decelerating_speed"); return 0; } extern s32 update_decelerating_speed(struct MarioState *m); lua_pushinteger(L, update_decelerating_speed(m)); @@ -9902,10 +15228,16 @@ int smlua_func_update_decelerating_speed(lua_State* L) { } int smlua_func_update_shell_speed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_shell_speed", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_shell_speed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_shell_speed"); return 0; } extern void update_shell_speed(struct MarioState *m); update_shell_speed(m); @@ -9914,12 +15246,18 @@ int smlua_func_update_shell_speed(lua_State* L) { } int smlua_func_update_sliding(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_sliding", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_sliding'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_sliding"); return 0; } f32 stopSpeed = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'update_sliding'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "update_sliding"); return 0; } extern s32 update_sliding(struct MarioState *m, f32 stopSpeed); lua_pushinteger(L, update_sliding(m, stopSpeed)); @@ -9928,14 +15266,20 @@ int smlua_func_update_sliding(lua_State* L) { } int smlua_func_update_sliding_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_sliding_angle", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_sliding_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_sliding_angle"); return 0; } f32 accel = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'update_sliding_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "update_sliding_angle"); return 0; } f32 lossFactor = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'update_sliding_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "update_sliding_angle"); return 0; } extern void update_sliding_angle(struct MarioState *m, f32 accel, f32 lossFactor); update_sliding_angle(m, accel, lossFactor); @@ -9944,10 +15288,16 @@ int smlua_func_update_sliding_angle(lua_State* L) { } int smlua_func_update_walking_speed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_walking_speed", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'update_walking_speed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "update_walking_speed"); return 0; } extern void update_walking_speed(struct MarioState *m); update_walking_speed(m); @@ -9960,14 +15310,20 @@ int smlua_func_update_walking_speed(lua_State* L) { //////////////////////////// int smlua_func_animated_stationary_ground_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "animated_stationary_ground_step", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'animated_stationary_ground_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "animated_stationary_ground_step"); return 0; } s32 animation = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'animated_stationary_ground_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "animated_stationary_ground_step"); return 0; } u32 endAction = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'animated_stationary_ground_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "animated_stationary_ground_step"); return 0; } extern void animated_stationary_ground_step(struct MarioState *m, s32 animation, u32 endAction); animated_stationary_ground_step(m, animation, endAction); @@ -9976,10 +15332,16 @@ int smlua_func_animated_stationary_ground_step(lua_State* L) { } int smlua_func_check_common_object_cancels(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_object_cancels", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_object_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_object_cancels"); return 0; } extern s32 check_common_object_cancels(struct MarioState *m); lua_pushinteger(L, check_common_object_cancels(m)); @@ -9988,10 +15350,16 @@ int smlua_func_check_common_object_cancels(lua_State* L) { } int smlua_func_mario_execute_object_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_execute_object_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_execute_object_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_execute_object_action"); return 0; } extern s32 mario_execute_object_action(struct MarioState *m); lua_pushinteger(L, mario_execute_object_action(m)); @@ -10000,10 +15368,16 @@ int smlua_func_mario_execute_object_action(lua_State* L) { } int smlua_func_mario_update_punch_sequence(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_update_punch_sequence", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_update_punch_sequence'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_update_punch_sequence"); return 0; } extern s32 mario_update_punch_sequence(struct MarioState *m); lua_pushinteger(L, mario_update_punch_sequence(m)); @@ -10016,10 +15390,16 @@ int smlua_func_mario_update_punch_sequence(lua_State* L) { //////////////////////////////// int smlua_func_check_common_hold_idle_cancels(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_hold_idle_cancels", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_hold_idle_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_hold_idle_cancels"); return 0; } extern s32 check_common_hold_idle_cancels(struct MarioState *m); lua_pushinteger(L, check_common_hold_idle_cancels(m)); @@ -10028,10 +15408,16 @@ int smlua_func_check_common_hold_idle_cancels(lua_State* L) { } int smlua_func_check_common_idle_cancels(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_idle_cancels", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_idle_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_idle_cancels"); return 0; } extern s32 check_common_idle_cancels(struct MarioState *m); lua_pushinteger(L, check_common_idle_cancels(m)); @@ -10040,12 +15426,18 @@ int smlua_func_check_common_idle_cancels(lua_State* L) { } int smlua_func_check_common_landing_cancels(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_landing_cancels", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_landing_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_landing_cancels"); return 0; } u32 action = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'check_common_landing_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "check_common_landing_cancels"); return 0; } extern s32 check_common_landing_cancels(struct MarioState *m, u32 action); lua_pushinteger(L, check_common_landing_cancels(m, action)); @@ -10054,10 +15446,16 @@ int smlua_func_check_common_landing_cancels(lua_State* L) { } int smlua_func_check_common_stationary_cancels(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "check_common_stationary_cancels", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'check_common_stationary_cancels'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "check_common_stationary_cancels"); return 0; } extern s32 check_common_stationary_cancels(struct MarioState *m); lua_pushinteger(L, check_common_stationary_cancels(m)); @@ -10066,14 +15464,20 @@ int smlua_func_check_common_stationary_cancels(lua_State* L) { } int smlua_func_landing_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "landing_step", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'landing_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "landing_step"); return 0; } s32 arg1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'landing_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "landing_step"); return 0; } u32 action = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'landing_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "landing_step"); return 0; } extern s32 landing_step(struct MarioState *m, s32 arg1, u32 action); lua_pushinteger(L, landing_step(m, arg1, action)); @@ -10082,10 +15486,16 @@ int smlua_func_landing_step(lua_State* L) { } int smlua_func_mario_execute_stationary_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_execute_stationary_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_execute_stationary_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_execute_stationary_action"); return 0; } extern s32 mario_execute_stationary_action(struct MarioState *m); lua_pushinteger(L, mario_execute_stationary_action(m)); @@ -10094,16 +15504,22 @@ int smlua_func_mario_execute_stationary_action(lua_State* L) { } int smlua_func_play_anim_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_anim_sound", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_anim_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_anim_sound"); return 0; } u32 actionState = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_anim_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_anim_sound"); return 0; } s32 animFrame = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_anim_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_anim_sound"); return 0; } u32 sound = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'play_anim_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "play_anim_sound"); return 0; } extern void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound); play_anim_sound(m, actionState, animFrame, sound); @@ -10112,14 +15528,20 @@ int smlua_func_play_anim_sound(lua_State* L) { } int smlua_func_stopping_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stopping_step", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'stopping_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "stopping_step"); return 0; } s32 animID = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'stopping_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "stopping_step"); return 0; } u32 action = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'stopping_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "stopping_step"); return 0; } extern void stopping_step(struct MarioState *m, s32 animID, u32 action); stopping_step(m, animID, action); @@ -10132,16 +15554,22 @@ int smlua_func_stopping_step(lua_State* L) { /////////////////////////////// int smlua_func_apply_water_current(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "apply_water_current", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'apply_water_current'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "apply_water_current"); return 0; } f32* step = smlua_get_vec3f_from_buffer(); step[0] = smlua_get_number_field(2, "x"); step[1] = smlua_get_number_field(2, "y"); step[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'apply_water_current'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "apply_water_current"); return 0; } extern void apply_water_current(struct MarioState *m, Vec3f step); apply_water_current(m, step); @@ -10154,10 +15582,16 @@ int smlua_func_apply_water_current(lua_State* L) { } int smlua_func_float_surface_gfx(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "float_surface_gfx", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'float_surface_gfx'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "float_surface_gfx"); return 0; } extern void float_surface_gfx(struct MarioState *m); float_surface_gfx(m); @@ -10166,10 +15600,16 @@ int smlua_func_float_surface_gfx(lua_State* L) { } int smlua_func_mario_execute_submerged_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_execute_submerged_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_execute_submerged_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_execute_submerged_action"); return 0; } extern s32 mario_execute_submerged_action(struct MarioState *m); lua_pushinteger(L, mario_execute_submerged_action(m)); @@ -10178,16 +15618,22 @@ int smlua_func_mario_execute_submerged_action(lua_State* L) { } int smlua_func_perform_water_full_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "perform_water_full_step", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'perform_water_full_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "perform_water_full_step"); return 0; } f32* nextPos = smlua_get_vec3f_from_buffer(); nextPos[0] = smlua_get_number_field(2, "x"); nextPos[1] = smlua_get_number_field(2, "y"); nextPos[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'perform_water_full_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "perform_water_full_step"); return 0; } extern u32 perform_water_full_step(struct MarioState *m, Vec3f nextPos); lua_pushinteger(L, perform_water_full_step(m, nextPos)); @@ -10200,10 +15646,16 @@ int smlua_func_perform_water_full_step(lua_State* L) { } int smlua_func_perform_water_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "perform_water_step", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'perform_water_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "perform_water_step"); return 0; } extern u32 perform_water_step(struct MarioState *m); lua_pushinteger(L, perform_water_step(m)); @@ -10212,12 +15664,18 @@ int smlua_func_perform_water_step(lua_State* L) { } int smlua_func_set_swimming_at_surface_particles(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_swimming_at_surface_particles", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_swimming_at_surface_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_swimming_at_surface_particles"); return 0; } u32 particleFlag = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_swimming_at_surface_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_swimming_at_surface_particles"); return 0; } extern void set_swimming_at_surface_particles(struct MarioState *m, u32 particleFlag); set_swimming_at_surface_particles(m, particleFlag); @@ -10230,7 +15688,13 @@ int smlua_func_set_swimming_at_surface_particles(lua_State* L) { ////////////////// int smlua_func_bhv_toad_message_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_toad_message_init", 0, top); + return 0; + } bhv_toad_message_init(); @@ -10239,7 +15703,13 @@ int smlua_func_bhv_toad_message_init(UNUSED lua_State* L) { } int smlua_func_bhv_toad_message_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_toad_message_loop", 0, top); + return 0; + } bhv_toad_message_loop(); @@ -10248,7 +15718,13 @@ int smlua_func_bhv_toad_message_loop(UNUSED lua_State* L) { } int smlua_func_bhv_unlock_door_star_init(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_unlock_door_star_init", 0, top); + return 0; + } bhv_unlock_door_star_init(); @@ -10257,7 +15733,13 @@ int smlua_func_bhv_unlock_door_star_init(UNUSED lua_State* L) { } int smlua_func_bhv_unlock_door_star_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_unlock_door_star_loop", 0, top); + return 0; + } bhv_unlock_door_star_loop(); @@ -10270,7 +15752,13 @@ int smlua_func_bhv_unlock_door_star_loop(UNUSED lua_State* L) { ////////////////// int smlua_func_get_additive_y_vel_for_jumps(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_additive_y_vel_for_jumps", 0, top); + return 0; + } lua_pushnumber(L, get_additive_y_vel_for_jumps()); @@ -10279,22 +15767,28 @@ int smlua_func_get_additive_y_vel_for_jumps(UNUSED lua_State* L) { } int smlua_func_init_bully_collision_data(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 7)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 7) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "init_bully_collision_data", 7, top); + return 0; + } struct BullyCollisionData* data = (struct BullyCollisionData*)smlua_to_cobject(L, 1, LOT_BULLYCOLLISIONDATA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'init_bully_collision_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "init_bully_collision_data"); return 0; } f32 posX = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'init_bully_collision_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "init_bully_collision_data"); return 0; } f32 posZ = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'init_bully_collision_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "init_bully_collision_data"); return 0; } f32 forwardVel = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'init_bully_collision_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "init_bully_collision_data"); return 0; } s16 yaw = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'init_bully_collision_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "init_bully_collision_data"); return 0; } f32 conversionRatio = smlua_to_number(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'init_bully_collision_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "init_bully_collision_data"); return 0; } f32 radius = smlua_to_number(L, 7); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'init_bully_collision_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "init_bully_collision_data"); return 0; } init_bully_collision_data(data, posX, posZ, forwardVel, yaw, conversionRatio, radius); @@ -10302,12 +15796,18 @@ int smlua_func_init_bully_collision_data(lua_State* L) { } int smlua_func_mario_bonk_reflection(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_bonk_reflection", 2, top); + return 0; + } struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_bonk_reflection'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_bonk_reflection"); return 0; } u32 arg1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_bonk_reflection'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_bonk_reflection"); return 0; } mario_bonk_reflection(arg0, arg1); @@ -10315,14 +15815,20 @@ int smlua_func_mario_bonk_reflection(lua_State* L) { } int smlua_func_mario_push_off_steep_floor(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_push_off_steep_floor", 3, top); + return 0; + } struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_push_off_steep_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_push_off_steep_floor"); return 0; } u32 arg1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_push_off_steep_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_push_off_steep_floor"); return 0; } u32 arg2 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mario_push_off_steep_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mario_push_off_steep_floor"); return 0; } lua_pushinteger(L, mario_push_off_steep_floor(arg0, arg1, arg2)); @@ -10330,10 +15836,16 @@ int smlua_func_mario_push_off_steep_floor(lua_State* L) { } int smlua_func_mario_update_moving_sand(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_update_moving_sand", 1, top); + return 0; + } struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_update_moving_sand'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_update_moving_sand"); return 0; } lua_pushinteger(L, mario_update_moving_sand(arg0)); @@ -10341,12 +15853,18 @@ int smlua_func_mario_update_moving_sand(lua_State* L) { } int smlua_func_mario_update_quicksand(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_update_quicksand", 2, top); + return 0; + } struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_update_quicksand'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_update_quicksand"); return 0; } f32 arg1 = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_update_quicksand'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_update_quicksand"); return 0; } lua_pushinteger(L, mario_update_quicksand(arg0, arg1)); @@ -10354,10 +15872,16 @@ int smlua_func_mario_update_quicksand(lua_State* L) { } int smlua_func_mario_update_windy_ground(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_update_windy_ground", 1, top); + return 0; + } struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_update_windy_ground'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_update_windy_ground"); return 0; } lua_pushinteger(L, mario_update_windy_ground(arg0)); @@ -10365,12 +15889,18 @@ int smlua_func_mario_update_windy_ground(lua_State* L) { } int smlua_func_perform_air_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "perform_air_step", 2, top); + return 0; + } struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'perform_air_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "perform_air_step"); return 0; } u32 arg1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'perform_air_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "perform_air_step"); return 0; } lua_pushinteger(L, perform_air_step(arg0, arg1)); @@ -10378,10 +15908,16 @@ int smlua_func_perform_air_step(lua_State* L) { } int smlua_func_perform_ground_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "perform_ground_step", 1, top); + return 0; + } struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'perform_ground_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "perform_ground_step"); return 0; } lua_pushinteger(L, perform_ground_step(arg0)); @@ -10389,10 +15925,16 @@ int smlua_func_perform_ground_step(lua_State* L) { } int smlua_func_set_vel_from_pitch_and_yaw(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_vel_from_pitch_and_yaw", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_vel_from_pitch_and_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_vel_from_pitch_and_yaw"); return 0; } set_vel_from_pitch_and_yaw(m); @@ -10400,10 +15942,16 @@ int smlua_func_set_vel_from_pitch_and_yaw(lua_State* L) { } int smlua_func_stationary_ground_step(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stationary_ground_step", 1, top); + return 0; + } struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'stationary_ground_step'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "stationary_ground_step"); return 0; } lua_pushinteger(L, stationary_ground_step(arg0)); @@ -10411,10 +15959,16 @@ int smlua_func_stationary_ground_step(lua_State* L) { } int smlua_func_stop_and_set_height_to_floor(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stop_and_set_height_to_floor", 1, top); + return 0; + } struct MarioState* arg0 = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'stop_and_set_height_to_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "stop_and_set_height_to_floor"); return 0; } stop_and_set_height_to_floor(arg0); @@ -10425,32 +15979,42 @@ int smlua_func_stop_and_set_height_to_floor(lua_State* L) { // math_util.h // ///////////////// -/* int smlua_func_anim_spline_init(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "anim_spline_init", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'anim_spline_init'"); return 0; } -// Vec4s * keyFrames = (Vec4s *)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'anim_spline_init'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "anim_spline_init"); return 0; } + Vec4s * keyFrames = (Vec4s *)smlua_to_cpointer(L, 2, LVT_COBJECT_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "anim_spline_init"); return 0; } anim_spline_init(m, keyFrames); return 1; } -*/ int smlua_func_anim_spline_poll(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "anim_spline_poll", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'anim_spline_poll'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "anim_spline_poll"); return 0; } f32* result = smlua_get_vec3f_from_buffer(); result[0] = smlua_get_number_field(2, "x"); result[1] = smlua_get_number_field(2, "y"); result[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'anim_spline_poll'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "anim_spline_poll"); return 0; } lua_pushinteger(L, anim_spline_poll(m, result)); @@ -10462,16 +16026,22 @@ int smlua_func_anim_spline_poll(lua_State* L) { } int smlua_func_approach_f32(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_f32", 4, top); + return 0; + } f32 current = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_f32"); return 0; } f32 target = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_f32"); return 0; } f32 inc = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_f32"); return 0; } f32 dec = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'approach_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "approach_f32"); return 0; } lua_pushnumber(L, approach_f32(current, target, inc, dec)); @@ -10479,52 +16049,63 @@ int smlua_func_approach_f32(lua_State* L) { } int smlua_func_approach_s32(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_s32", 4, top); + return 0; + } s32 current = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_s32"); return 0; } s32 target = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_s32"); return 0; } s32 inc = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_s32"); return 0; } s32 dec = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'approach_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "approach_s32"); return 0; } lua_pushinteger(L, approach_s32(current, target, inc, dec)); return 1; } -/* int smlua_func_find_vector_perpendicular_to_plane(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_vector_perpendicular_to_plane", 4, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_vector_perpendicular_to_plane'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_vector_perpendicular_to_plane"); return 0; } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(2, "x"); a[1] = smlua_get_number_field(2, "y"); a[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_vector_perpendicular_to_plane'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_vector_perpendicular_to_plane"); return 0; } f32* b = smlua_get_vec3f_from_buffer(); b[0] = smlua_get_number_field(3, "x"); b[1] = smlua_get_number_field(3, "y"); b[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_vector_perpendicular_to_plane'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_vector_perpendicular_to_plane"); return 0; } f32* c = smlua_get_vec3f_from_buffer(); c[0] = smlua_get_number_field(4, "x"); c[1] = smlua_get_number_field(4, "y"); c[2] = smlua_get_number_field(4, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'find_vector_perpendicular_to_plane'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "find_vector_perpendicular_to_plane"); return 0; } - UNIMPLEMENTED -->(L, find_vector_perpendicular_to_plane(dest, a, b, c)); + find_vector_perpendicular_to_plane(dest, a, b, c); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -10544,22 +16125,60 @@ int smlua_func_find_vector_perpendicular_to_plane(lua_State* L) { return 1; } -*/ -/* int smlua_func_get_pos_from_transform_mtx(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_pos_from_transform_mtx", 3, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_pos_from_transform_mtx'"); return 0; } -// Mat4 objMtx = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_pos_from_transform_mtx'"); return 0; } -// Mat4 camMtx = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'get_pos_from_transform_mtx'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_pos_from_transform_mtx"); return 0; } + + Mat4 objMtx; + objMtx[0][0] = smlua_get_number_field(2, "a"); + objMtx[0][1] = smlua_get_number_field(2, "b"); + objMtx[0][2] = smlua_get_number_field(2, "c"); + objMtx[0][3] = smlua_get_number_field(2, "d"); + objMtx[1][0] = smlua_get_number_field(2, "e"); + objMtx[1][1] = smlua_get_number_field(2, "f"); + objMtx[1][2] = smlua_get_number_field(2, "g"); + objMtx[1][3] = smlua_get_number_field(2, "h"); + objMtx[2][0] = smlua_get_number_field(2, "i"); + objMtx[2][1] = smlua_get_number_field(2, "j"); + objMtx[2][2] = smlua_get_number_field(2, "k"); + objMtx[2][3] = smlua_get_number_field(2, "l"); + objMtx[3][0] = smlua_get_number_field(2, "m"); + objMtx[3][1] = smlua_get_number_field(2, "n"); + objMtx[3][2] = smlua_get_number_field(2, "o"); + objMtx[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_pos_from_transform_mtx"); return 0; } + + Mat4 camMtx; + camMtx[0][0] = smlua_get_number_field(3, "a"); + camMtx[0][1] = smlua_get_number_field(3, "b"); + camMtx[0][2] = smlua_get_number_field(3, "c"); + camMtx[0][3] = smlua_get_number_field(3, "d"); + camMtx[1][0] = smlua_get_number_field(3, "e"); + camMtx[1][1] = smlua_get_number_field(3, "f"); + camMtx[1][2] = smlua_get_number_field(3, "g"); + camMtx[1][3] = smlua_get_number_field(3, "h"); + camMtx[2][0] = smlua_get_number_field(3, "i"); + camMtx[2][1] = smlua_get_number_field(3, "j"); + camMtx[2][2] = smlua_get_number_field(3, "k"); + camMtx[2][3] = smlua_get_number_field(3, "l"); + camMtx[3][0] = smlua_get_number_field(3, "m"); + camMtx[3][1] = smlua_get_number_field(3, "n"); + camMtx[3][2] = smlua_get_number_field(3, "o"); + camMtx[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_pos_from_transform_mtx"); return 0; } get_pos_from_transform_mtx(dest, objMtx, camMtx); @@ -10567,33 +16186,105 @@ int smlua_func_get_pos_from_transform_mtx(lua_State* L) { smlua_push_number_field(1, "y", dest[1]); smlua_push_number_field(1, "z", dest[2]); + smlua_push_number_field(2, "a", objMtx[0][0]); + smlua_push_number_field(2, "b", objMtx[0][1]); + smlua_push_number_field(2, "c", objMtx[0][2]); + smlua_push_number_field(2, "d", objMtx[0][3]); + smlua_push_number_field(2, "e", objMtx[1][0]); + smlua_push_number_field(2, "f", objMtx[1][1]); + smlua_push_number_field(2, "g", objMtx[1][2]); + smlua_push_number_field(2, "h", objMtx[1][3]); + smlua_push_number_field(2, "i", objMtx[2][0]); + smlua_push_number_field(2, "j", objMtx[2][1]); + smlua_push_number_field(2, "k", objMtx[2][2]); + smlua_push_number_field(2, "l", objMtx[2][3]); + smlua_push_number_field(2, "m", objMtx[3][0]); + smlua_push_number_field(2, "n", objMtx[3][1]); + smlua_push_number_field(2, "o", objMtx[3][2]); + smlua_push_number_field(2, "p", objMtx[3][3]); + + smlua_push_number_field(3, "a", camMtx[0][0]); + smlua_push_number_field(3, "b", camMtx[0][1]); + smlua_push_number_field(3, "c", camMtx[0][2]); + smlua_push_number_field(3, "d", camMtx[0][3]); + smlua_push_number_field(3, "e", camMtx[1][0]); + smlua_push_number_field(3, "f", camMtx[1][1]); + smlua_push_number_field(3, "g", camMtx[1][2]); + smlua_push_number_field(3, "h", camMtx[1][3]); + smlua_push_number_field(3, "i", camMtx[2][0]); + smlua_push_number_field(3, "j", camMtx[2][1]); + smlua_push_number_field(3, "k", camMtx[2][2]); + smlua_push_number_field(3, "l", camMtx[2][3]); + smlua_push_number_field(3, "m", camMtx[3][0]); + smlua_push_number_field(3, "n", camMtx[3][1]); + smlua_push_number_field(3, "o", camMtx[3][2]); + smlua_push_number_field(3, "p", camMtx[3][3]); + return 1; } -*/ -/* int smlua_func_mtxf_align_terrain_normal(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_align_terrain_normal'"); return 0; } + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_align_terrain_normal", 4, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_align_terrain_normal"); return 0; } f32* upDir = smlua_get_vec3f_from_buffer(); upDir[0] = smlua_get_number_field(2, "x"); upDir[1] = smlua_get_number_field(2, "y"); upDir[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_align_terrain_normal'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_align_terrain_normal"); return 0; } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(3, "x"); pos[1] = smlua_get_number_field(3, "y"); pos[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mtxf_align_terrain_normal'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mtxf_align_terrain_normal"); return 0; } s16 yaw = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'mtxf_align_terrain_normal'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "mtxf_align_terrain_normal"); return 0; } mtxf_align_terrain_normal(dest, upDir, pos, yaw); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + smlua_push_number_field(2, "x", upDir[0]); smlua_push_number_field(2, "y", upDir[1]); smlua_push_number_field(2, "z", upDir[2]); @@ -10604,155 +16295,557 @@ int smlua_func_mtxf_align_terrain_normal(lua_State* L) { return 1; } -*/ -/* int smlua_func_mtxf_align_terrain_triangle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_align_terrain_triangle'"); return 0; } + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_align_terrain_triangle", 4, top); + return 0; + } + + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(1, "a"); + mtx[0][1] = smlua_get_number_field(1, "b"); + mtx[0][2] = smlua_get_number_field(1, "c"); + mtx[0][3] = smlua_get_number_field(1, "d"); + mtx[1][0] = smlua_get_number_field(1, "e"); + mtx[1][1] = smlua_get_number_field(1, "f"); + mtx[1][2] = smlua_get_number_field(1, "g"); + mtx[1][3] = smlua_get_number_field(1, "h"); + mtx[2][0] = smlua_get_number_field(1, "i"); + mtx[2][1] = smlua_get_number_field(1, "j"); + mtx[2][2] = smlua_get_number_field(1, "k"); + mtx[2][3] = smlua_get_number_field(1, "l"); + mtx[3][0] = smlua_get_number_field(1, "m"); + mtx[3][1] = smlua_get_number_field(1, "n"); + mtx[3][2] = smlua_get_number_field(1, "o"); + mtx[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_align_terrain_triangle"); return 0; } f32* pos = smlua_get_vec3f_from_buffer(); pos[0] = smlua_get_number_field(2, "x"); pos[1] = smlua_get_number_field(2, "y"); pos[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_align_terrain_triangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_align_terrain_triangle"); return 0; } s16 yaw = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mtxf_align_terrain_triangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mtxf_align_terrain_triangle"); return 0; } f32 radius = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'mtxf_align_terrain_triangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "mtxf_align_terrain_triangle"); return 0; } mtxf_align_terrain_triangle(mtx, pos, yaw, radius); + smlua_push_number_field(1, "a", mtx[0][0]); + smlua_push_number_field(1, "b", mtx[0][1]); + smlua_push_number_field(1, "c", mtx[0][2]); + smlua_push_number_field(1, "d", mtx[0][3]); + smlua_push_number_field(1, "e", mtx[1][0]); + smlua_push_number_field(1, "f", mtx[1][1]); + smlua_push_number_field(1, "g", mtx[1][2]); + smlua_push_number_field(1, "h", mtx[1][3]); + smlua_push_number_field(1, "i", mtx[2][0]); + smlua_push_number_field(1, "j", mtx[2][1]); + smlua_push_number_field(1, "k", mtx[2][2]); + smlua_push_number_field(1, "l", mtx[2][3]); + smlua_push_number_field(1, "m", mtx[3][0]); + smlua_push_number_field(1, "n", mtx[3][1]); + smlua_push_number_field(1, "o", mtx[3][2]); + smlua_push_number_field(1, "p", mtx[3][3]); + smlua_push_number_field(2, "x", pos[0]); smlua_push_number_field(2, "y", pos[1]); smlua_push_number_field(2, "z", pos[2]); return 1; } -*/ -/* int smlua_func_mtxf_billboard(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_billboard'"); return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_billboard'"); return 0; } + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_billboard", 4, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_billboard"); return 0; } + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(2, "a"); + mtx[0][1] = smlua_get_number_field(2, "b"); + mtx[0][2] = smlua_get_number_field(2, "c"); + mtx[0][3] = smlua_get_number_field(2, "d"); + mtx[1][0] = smlua_get_number_field(2, "e"); + mtx[1][1] = smlua_get_number_field(2, "f"); + mtx[1][2] = smlua_get_number_field(2, "g"); + mtx[1][3] = smlua_get_number_field(2, "h"); + mtx[2][0] = smlua_get_number_field(2, "i"); + mtx[2][1] = smlua_get_number_field(2, "j"); + mtx[2][2] = smlua_get_number_field(2, "k"); + mtx[2][3] = smlua_get_number_field(2, "l"); + mtx[3][0] = smlua_get_number_field(2, "m"); + mtx[3][1] = smlua_get_number_field(2, "n"); + mtx[3][2] = smlua_get_number_field(2, "o"); + mtx[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_billboard"); return 0; } f32* position = smlua_get_vec3f_from_buffer(); position[0] = smlua_get_number_field(3, "x"); position[1] = smlua_get_number_field(3, "y"); position[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mtxf_billboard'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mtxf_billboard"); return 0; } s16 angle = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'mtxf_billboard'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "mtxf_billboard"); return 0; } mtxf_billboard(dest, mtx, position, angle); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + + smlua_push_number_field(2, "a", mtx[0][0]); + smlua_push_number_field(2, "b", mtx[0][1]); + smlua_push_number_field(2, "c", mtx[0][2]); + smlua_push_number_field(2, "d", mtx[0][3]); + smlua_push_number_field(2, "e", mtx[1][0]); + smlua_push_number_field(2, "f", mtx[1][1]); + smlua_push_number_field(2, "g", mtx[1][2]); + smlua_push_number_field(2, "h", mtx[1][3]); + smlua_push_number_field(2, "i", mtx[2][0]); + smlua_push_number_field(2, "j", mtx[2][1]); + smlua_push_number_field(2, "k", mtx[2][2]); + smlua_push_number_field(2, "l", mtx[2][3]); + smlua_push_number_field(2, "m", mtx[3][0]); + smlua_push_number_field(2, "n", mtx[3][1]); + smlua_push_number_field(2, "o", mtx[3][2]); + smlua_push_number_field(2, "p", mtx[3][3]); + smlua_push_number_field(3, "x", position[0]); smlua_push_number_field(3, "y", position[1]); smlua_push_number_field(3, "z", position[2]); return 1; } -*/ -/* int smlua_func_mtxf_copy(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_copy'"); return 0; } -// Mat4 src = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_copy'"); return 0; } + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_copy", 2, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_copy"); return 0; } + + Mat4 src; + src[0][0] = smlua_get_number_field(2, "a"); + src[0][1] = smlua_get_number_field(2, "b"); + src[0][2] = smlua_get_number_field(2, "c"); + src[0][3] = smlua_get_number_field(2, "d"); + src[1][0] = smlua_get_number_field(2, "e"); + src[1][1] = smlua_get_number_field(2, "f"); + src[1][2] = smlua_get_number_field(2, "g"); + src[1][3] = smlua_get_number_field(2, "h"); + src[2][0] = smlua_get_number_field(2, "i"); + src[2][1] = smlua_get_number_field(2, "j"); + src[2][2] = smlua_get_number_field(2, "k"); + src[2][3] = smlua_get_number_field(2, "l"); + src[3][0] = smlua_get_number_field(2, "m"); + src[3][1] = smlua_get_number_field(2, "n"); + src[3][2] = smlua_get_number_field(2, "o"); + src[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_copy"); return 0; } mtxf_copy(dest, src); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + + smlua_push_number_field(2, "a", src[0][0]); + smlua_push_number_field(2, "b", src[0][1]); + smlua_push_number_field(2, "c", src[0][2]); + smlua_push_number_field(2, "d", src[0][3]); + smlua_push_number_field(2, "e", src[1][0]); + smlua_push_number_field(2, "f", src[1][1]); + smlua_push_number_field(2, "g", src[1][2]); + smlua_push_number_field(2, "h", src[1][3]); + smlua_push_number_field(2, "i", src[2][0]); + smlua_push_number_field(2, "j", src[2][1]); + smlua_push_number_field(2, "k", src[2][2]); + smlua_push_number_field(2, "l", src[2][3]); + smlua_push_number_field(2, "m", src[3][0]); + smlua_push_number_field(2, "n", src[3][1]); + smlua_push_number_field(2, "o", src[3][2]); + smlua_push_number_field(2, "p", src[3][3]); + return 1; } -*/ -/* int smlua_func_mtxf_cylboard(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_cylboard'"); return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_cylboard'"); return 0; } + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_cylboard", 4, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_cylboard"); return 0; } + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(2, "a"); + mtx[0][1] = smlua_get_number_field(2, "b"); + mtx[0][2] = smlua_get_number_field(2, "c"); + mtx[0][3] = smlua_get_number_field(2, "d"); + mtx[1][0] = smlua_get_number_field(2, "e"); + mtx[1][1] = smlua_get_number_field(2, "f"); + mtx[1][2] = smlua_get_number_field(2, "g"); + mtx[1][3] = smlua_get_number_field(2, "h"); + mtx[2][0] = smlua_get_number_field(2, "i"); + mtx[2][1] = smlua_get_number_field(2, "j"); + mtx[2][2] = smlua_get_number_field(2, "k"); + mtx[2][3] = smlua_get_number_field(2, "l"); + mtx[3][0] = smlua_get_number_field(2, "m"); + mtx[3][1] = smlua_get_number_field(2, "n"); + mtx[3][2] = smlua_get_number_field(2, "o"); + mtx[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_cylboard"); return 0; } f32* position = smlua_get_vec3f_from_buffer(); position[0] = smlua_get_number_field(3, "x"); position[1] = smlua_get_number_field(3, "y"); position[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mtxf_cylboard'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mtxf_cylboard"); return 0; } s16 angle = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'mtxf_cylboard'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "mtxf_cylboard"); return 0; } mtxf_cylboard(dest, mtx, position, angle); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + + smlua_push_number_field(2, "a", mtx[0][0]); + smlua_push_number_field(2, "b", mtx[0][1]); + smlua_push_number_field(2, "c", mtx[0][2]); + smlua_push_number_field(2, "d", mtx[0][3]); + smlua_push_number_field(2, "e", mtx[1][0]); + smlua_push_number_field(2, "f", mtx[1][1]); + smlua_push_number_field(2, "g", mtx[1][2]); + smlua_push_number_field(2, "h", mtx[1][3]); + smlua_push_number_field(2, "i", mtx[2][0]); + smlua_push_number_field(2, "j", mtx[2][1]); + smlua_push_number_field(2, "k", mtx[2][2]); + smlua_push_number_field(2, "l", mtx[2][3]); + smlua_push_number_field(2, "m", mtx[3][0]); + smlua_push_number_field(2, "n", mtx[3][1]); + smlua_push_number_field(2, "o", mtx[3][2]); + smlua_push_number_field(2, "p", mtx[3][3]); + smlua_push_number_field(3, "x", position[0]); smlua_push_number_field(3, "y", position[1]); smlua_push_number_field(3, "z", position[2]); return 1; } -*/ -/* int smlua_func_mtxf_identity(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_identity'"); return 0; } + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_identity", 1, top); + return 0; + } + + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(1, "a"); + mtx[0][1] = smlua_get_number_field(1, "b"); + mtx[0][2] = smlua_get_number_field(1, "c"); + mtx[0][3] = smlua_get_number_field(1, "d"); + mtx[1][0] = smlua_get_number_field(1, "e"); + mtx[1][1] = smlua_get_number_field(1, "f"); + mtx[1][2] = smlua_get_number_field(1, "g"); + mtx[1][3] = smlua_get_number_field(1, "h"); + mtx[2][0] = smlua_get_number_field(1, "i"); + mtx[2][1] = smlua_get_number_field(1, "j"); + mtx[2][2] = smlua_get_number_field(1, "k"); + mtx[2][3] = smlua_get_number_field(1, "l"); + mtx[3][0] = smlua_get_number_field(1, "m"); + mtx[3][1] = smlua_get_number_field(1, "n"); + mtx[3][2] = smlua_get_number_field(1, "o"); + mtx[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_identity"); return 0; } mtxf_identity(mtx); + smlua_push_number_field(1, "a", mtx[0][0]); + smlua_push_number_field(1, "b", mtx[0][1]); + smlua_push_number_field(1, "c", mtx[0][2]); + smlua_push_number_field(1, "d", mtx[0][3]); + smlua_push_number_field(1, "e", mtx[1][0]); + smlua_push_number_field(1, "f", mtx[1][1]); + smlua_push_number_field(1, "g", mtx[1][2]); + smlua_push_number_field(1, "h", mtx[1][3]); + smlua_push_number_field(1, "i", mtx[2][0]); + smlua_push_number_field(1, "j", mtx[2][1]); + smlua_push_number_field(1, "k", mtx[2][2]); + smlua_push_number_field(1, "l", mtx[2][3]); + smlua_push_number_field(1, "m", mtx[3][0]); + smlua_push_number_field(1, "n", mtx[3][1]); + smlua_push_number_field(1, "o", mtx[3][2]); + smlua_push_number_field(1, "p", mtx[3][3]); + return 1; } -*/ -/* int smlua_func_mtxf_inverse(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_inverse'"); return 0; } -// Mat4 src = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_inverse'"); return 0; } + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_inverse", 2, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_inverse"); return 0; } + + Mat4 src; + src[0][0] = smlua_get_number_field(2, "a"); + src[0][1] = smlua_get_number_field(2, "b"); + src[0][2] = smlua_get_number_field(2, "c"); + src[0][3] = smlua_get_number_field(2, "d"); + src[1][0] = smlua_get_number_field(2, "e"); + src[1][1] = smlua_get_number_field(2, "f"); + src[1][2] = smlua_get_number_field(2, "g"); + src[1][3] = smlua_get_number_field(2, "h"); + src[2][0] = smlua_get_number_field(2, "i"); + src[2][1] = smlua_get_number_field(2, "j"); + src[2][2] = smlua_get_number_field(2, "k"); + src[2][3] = smlua_get_number_field(2, "l"); + src[3][0] = smlua_get_number_field(2, "m"); + src[3][1] = smlua_get_number_field(2, "n"); + src[3][2] = smlua_get_number_field(2, "o"); + src[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_inverse"); return 0; } mtxf_inverse(dest, src); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + + smlua_push_number_field(2, "a", src[0][0]); + smlua_push_number_field(2, "b", src[0][1]); + smlua_push_number_field(2, "c", src[0][2]); + smlua_push_number_field(2, "d", src[0][3]); + smlua_push_number_field(2, "e", src[1][0]); + smlua_push_number_field(2, "f", src[1][1]); + smlua_push_number_field(2, "g", src[1][2]); + smlua_push_number_field(2, "h", src[1][3]); + smlua_push_number_field(2, "i", src[2][0]); + smlua_push_number_field(2, "j", src[2][1]); + smlua_push_number_field(2, "k", src[2][2]); + smlua_push_number_field(2, "l", src[2][3]); + smlua_push_number_field(2, "m", src[3][0]); + smlua_push_number_field(2, "n", src[3][1]); + smlua_push_number_field(2, "o", src[3][2]); + smlua_push_number_field(2, "p", src[3][3]); + return 1; } -*/ -/* int smlua_func_mtxf_lookat(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_lookat'"); return 0; } + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_lookat", 4, top); + return 0; + } + + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(1, "a"); + mtx[0][1] = smlua_get_number_field(1, "b"); + mtx[0][2] = smlua_get_number_field(1, "c"); + mtx[0][3] = smlua_get_number_field(1, "d"); + mtx[1][0] = smlua_get_number_field(1, "e"); + mtx[1][1] = smlua_get_number_field(1, "f"); + mtx[1][2] = smlua_get_number_field(1, "g"); + mtx[1][3] = smlua_get_number_field(1, "h"); + mtx[2][0] = smlua_get_number_field(1, "i"); + mtx[2][1] = smlua_get_number_field(1, "j"); + mtx[2][2] = smlua_get_number_field(1, "k"); + mtx[2][3] = smlua_get_number_field(1, "l"); + mtx[3][0] = smlua_get_number_field(1, "m"); + mtx[3][1] = smlua_get_number_field(1, "n"); + mtx[3][2] = smlua_get_number_field(1, "o"); + mtx[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_lookat"); return 0; } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(2, "x"); from[1] = smlua_get_number_field(2, "y"); from[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_lookat'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_lookat"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(3, "x"); to[1] = smlua_get_number_field(3, "y"); to[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mtxf_lookat'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mtxf_lookat"); return 0; } s16 roll = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'mtxf_lookat'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "mtxf_lookat"); return 0; } mtxf_lookat(mtx, from, to, roll); + smlua_push_number_field(1, "a", mtx[0][0]); + smlua_push_number_field(1, "b", mtx[0][1]); + smlua_push_number_field(1, "c", mtx[0][2]); + smlua_push_number_field(1, "d", mtx[0][3]); + smlua_push_number_field(1, "e", mtx[1][0]); + smlua_push_number_field(1, "f", mtx[1][1]); + smlua_push_number_field(1, "g", mtx[1][2]); + smlua_push_number_field(1, "h", mtx[1][3]); + smlua_push_number_field(1, "i", mtx[2][0]); + smlua_push_number_field(1, "j", mtx[2][1]); + smlua_push_number_field(1, "k", mtx[2][2]); + smlua_push_number_field(1, "l", mtx[2][3]); + smlua_push_number_field(1, "m", mtx[3][0]); + smlua_push_number_field(1, "n", mtx[3][1]); + smlua_push_number_field(1, "o", mtx[3][2]); + smlua_push_number_field(1, "p", mtx[3][3]); + smlua_push_number_field(2, "x", from[0]); smlua_push_number_field(2, "y", from[1]); smlua_push_number_field(2, "z", from[2]); @@ -10763,84 +16856,270 @@ int smlua_func_mtxf_lookat(lua_State* L) { return 1; } -*/ -/* int smlua_func_mtxf_mul(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_mul'"); return 0; } -// Mat4 a = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_mul'"); return 0; } -// Mat4 b = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mtxf_mul'"); return 0; } + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_mul", 3, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_mul"); return 0; } + + Mat4 a; + a[0][0] = smlua_get_number_field(2, "a"); + a[0][1] = smlua_get_number_field(2, "b"); + a[0][2] = smlua_get_number_field(2, "c"); + a[0][3] = smlua_get_number_field(2, "d"); + a[1][0] = smlua_get_number_field(2, "e"); + a[1][1] = smlua_get_number_field(2, "f"); + a[1][2] = smlua_get_number_field(2, "g"); + a[1][3] = smlua_get_number_field(2, "h"); + a[2][0] = smlua_get_number_field(2, "i"); + a[2][1] = smlua_get_number_field(2, "j"); + a[2][2] = smlua_get_number_field(2, "k"); + a[2][3] = smlua_get_number_field(2, "l"); + a[3][0] = smlua_get_number_field(2, "m"); + a[3][1] = smlua_get_number_field(2, "n"); + a[3][2] = smlua_get_number_field(2, "o"); + a[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_mul"); return 0; } + + Mat4 b; + b[0][0] = smlua_get_number_field(3, "a"); + b[0][1] = smlua_get_number_field(3, "b"); + b[0][2] = smlua_get_number_field(3, "c"); + b[0][3] = smlua_get_number_field(3, "d"); + b[1][0] = smlua_get_number_field(3, "e"); + b[1][1] = smlua_get_number_field(3, "f"); + b[1][2] = smlua_get_number_field(3, "g"); + b[1][3] = smlua_get_number_field(3, "h"); + b[2][0] = smlua_get_number_field(3, "i"); + b[2][1] = smlua_get_number_field(3, "j"); + b[2][2] = smlua_get_number_field(3, "k"); + b[2][3] = smlua_get_number_field(3, "l"); + b[3][0] = smlua_get_number_field(3, "m"); + b[3][1] = smlua_get_number_field(3, "n"); + b[3][2] = smlua_get_number_field(3, "o"); + b[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mtxf_mul"); return 0; } mtxf_mul(dest, a, b); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + + smlua_push_number_field(2, "a", a[0][0]); + smlua_push_number_field(2, "b", a[0][1]); + smlua_push_number_field(2, "c", a[0][2]); + smlua_push_number_field(2, "d", a[0][3]); + smlua_push_number_field(2, "e", a[1][0]); + smlua_push_number_field(2, "f", a[1][1]); + smlua_push_number_field(2, "g", a[1][2]); + smlua_push_number_field(2, "h", a[1][3]); + smlua_push_number_field(2, "i", a[2][0]); + smlua_push_number_field(2, "j", a[2][1]); + smlua_push_number_field(2, "k", a[2][2]); + smlua_push_number_field(2, "l", a[2][3]); + smlua_push_number_field(2, "m", a[3][0]); + smlua_push_number_field(2, "n", a[3][1]); + smlua_push_number_field(2, "o", a[3][2]); + smlua_push_number_field(2, "p", a[3][3]); + + smlua_push_number_field(3, "a", b[0][0]); + smlua_push_number_field(3, "b", b[0][1]); + smlua_push_number_field(3, "c", b[0][2]); + smlua_push_number_field(3, "d", b[0][3]); + smlua_push_number_field(3, "e", b[1][0]); + smlua_push_number_field(3, "f", b[1][1]); + smlua_push_number_field(3, "g", b[1][2]); + smlua_push_number_field(3, "h", b[1][3]); + smlua_push_number_field(3, "i", b[2][0]); + smlua_push_number_field(3, "j", b[2][1]); + smlua_push_number_field(3, "k", b[2][2]); + smlua_push_number_field(3, "l", b[2][3]); + smlua_push_number_field(3, "m", b[3][0]); + smlua_push_number_field(3, "n", b[3][1]); + smlua_push_number_field(3, "o", b[3][2]); + smlua_push_number_field(3, "p", b[3][3]); + return 1; } -*/ -/* int smlua_func_mtxf_mul_vec3s(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_mul_vec3s'"); return 0; } + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_mul_vec3s", 2, top); + return 0; + } + + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(1, "a"); + mtx[0][1] = smlua_get_number_field(1, "b"); + mtx[0][2] = smlua_get_number_field(1, "c"); + mtx[0][3] = smlua_get_number_field(1, "d"); + mtx[1][0] = smlua_get_number_field(1, "e"); + mtx[1][1] = smlua_get_number_field(1, "f"); + mtx[1][2] = smlua_get_number_field(1, "g"); + mtx[1][3] = smlua_get_number_field(1, "h"); + mtx[2][0] = smlua_get_number_field(1, "i"); + mtx[2][1] = smlua_get_number_field(1, "j"); + mtx[2][2] = smlua_get_number_field(1, "k"); + mtx[2][3] = smlua_get_number_field(1, "l"); + mtx[3][0] = smlua_get_number_field(1, "m"); + mtx[3][1] = smlua_get_number_field(1, "n"); + mtx[3][2] = smlua_get_number_field(1, "o"); + mtx[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_mul_vec3s"); return 0; } s16* b = smlua_get_vec3s_from_buffer(); b[0] = smlua_get_integer_field(2, "x"); b[1] = smlua_get_integer_field(2, "y"); b[2] = smlua_get_integer_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_mul_vec3s'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_mul_vec3s"); return 0; } mtxf_mul_vec3s(mtx, b); + smlua_push_number_field(1, "a", mtx[0][0]); + smlua_push_number_field(1, "b", mtx[0][1]); + smlua_push_number_field(1, "c", mtx[0][2]); + smlua_push_number_field(1, "d", mtx[0][3]); + smlua_push_number_field(1, "e", mtx[1][0]); + smlua_push_number_field(1, "f", mtx[1][1]); + smlua_push_number_field(1, "g", mtx[1][2]); + smlua_push_number_field(1, "h", mtx[1][3]); + smlua_push_number_field(1, "i", mtx[2][0]); + smlua_push_number_field(1, "j", mtx[2][1]); + smlua_push_number_field(1, "k", mtx[2][2]); + smlua_push_number_field(1, "l", mtx[2][3]); + smlua_push_number_field(1, "m", mtx[3][0]); + smlua_push_number_field(1, "n", mtx[3][1]); + smlua_push_number_field(1, "o", mtx[3][2]); + smlua_push_number_field(1, "p", mtx[3][3]); + smlua_push_integer_field(2, "x", b[0]); smlua_push_integer_field(2, "y", b[1]); smlua_push_integer_field(2, "z", b[2]); return 1; } -*/ -/* int smlua_func_mtxf_rotate_xy(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } -// Mtx * mtx = (Mtx *)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_rotate_xy'"); return 0; } + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_rotate_xy", 2, top); + return 0; + } + + Mtx * mtx = (Mtx *)smlua_to_cpointer(L, 1, LVT_COBJECT_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_rotate_xy"); return 0; } s16 angle = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_rotate_xy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_rotate_xy"); return 0; } mtxf_rotate_xy(mtx, angle); return 1; } -*/ -/* int smlua_func_mtxf_rotate_xyz_and_translate(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_rotate_xyz_and_translate'"); return 0; } + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_rotate_xyz_and_translate", 3, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_rotate_xyz_and_translate"); return 0; } f32* b = smlua_get_vec3f_from_buffer(); b[0] = smlua_get_number_field(2, "x"); b[1] = smlua_get_number_field(2, "y"); b[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_rotate_xyz_and_translate'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_rotate_xyz_and_translate"); return 0; } s16* c = smlua_get_vec3s_from_buffer(); c[0] = smlua_get_integer_field(3, "x"); c[1] = smlua_get_integer_field(3, "y"); c[2] = smlua_get_integer_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mtxf_rotate_xyz_and_translate'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mtxf_rotate_xyz_and_translate"); return 0; } mtxf_rotate_xyz_and_translate(dest, b, c); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + smlua_push_number_field(2, "x", b[0]); smlua_push_number_field(2, "y", b[1]); smlua_push_number_field(2, "z", b[2]); @@ -10851,29 +17130,67 @@ int smlua_func_mtxf_rotate_xyz_and_translate(lua_State* L) { return 1; } -*/ -/* int smlua_func_mtxf_rotate_zxy_and_translate(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_rotate_zxy_and_translate'"); return 0; } + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_rotate_zxy_and_translate", 3, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_rotate_zxy_and_translate"); return 0; } f32* translate = smlua_get_vec3f_from_buffer(); translate[0] = smlua_get_number_field(2, "x"); translate[1] = smlua_get_number_field(2, "y"); translate[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_rotate_zxy_and_translate'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_rotate_zxy_and_translate"); return 0; } s16* rotate = smlua_get_vec3s_from_buffer(); rotate[0] = smlua_get_integer_field(3, "x"); rotate[1] = smlua_get_integer_field(3, "y"); rotate[2] = smlua_get_integer_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mtxf_rotate_zxy_and_translate'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mtxf_rotate_zxy_and_translate"); return 0; } mtxf_rotate_zxy_and_translate(dest, translate, rotate); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + smlua_push_number_field(2, "x", translate[0]); smlua_push_number_field(2, "y", translate[1]); smlua_push_number_field(2, "z", translate[2]); @@ -10884,121 +17201,293 @@ int smlua_func_mtxf_rotate_zxy_and_translate(lua_State* L) { return 1; } -*/ -/* int smlua_func_mtxf_scale_vec3f(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_scale_vec3f'"); return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_scale_vec3f'"); return 0; } + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_scale_vec3f", 3, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_scale_vec3f"); return 0; } + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(2, "a"); + mtx[0][1] = smlua_get_number_field(2, "b"); + mtx[0][2] = smlua_get_number_field(2, "c"); + mtx[0][3] = smlua_get_number_field(2, "d"); + mtx[1][0] = smlua_get_number_field(2, "e"); + mtx[1][1] = smlua_get_number_field(2, "f"); + mtx[1][2] = smlua_get_number_field(2, "g"); + mtx[1][3] = smlua_get_number_field(2, "h"); + mtx[2][0] = smlua_get_number_field(2, "i"); + mtx[2][1] = smlua_get_number_field(2, "j"); + mtx[2][2] = smlua_get_number_field(2, "k"); + mtx[2][3] = smlua_get_number_field(2, "l"); + mtx[3][0] = smlua_get_number_field(2, "m"); + mtx[3][1] = smlua_get_number_field(2, "n"); + mtx[3][2] = smlua_get_number_field(2, "o"); + mtx[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_scale_vec3f"); return 0; } f32* s = smlua_get_vec3f_from_buffer(); s[0] = smlua_get_number_field(3, "x"); s[1] = smlua_get_number_field(3, "y"); s[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mtxf_scale_vec3f'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mtxf_scale_vec3f"); return 0; } mtxf_scale_vec3f(dest, mtx, s); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + + smlua_push_number_field(2, "a", mtx[0][0]); + smlua_push_number_field(2, "b", mtx[0][1]); + smlua_push_number_field(2, "c", mtx[0][2]); + smlua_push_number_field(2, "d", mtx[0][3]); + smlua_push_number_field(2, "e", mtx[1][0]); + smlua_push_number_field(2, "f", mtx[1][1]); + smlua_push_number_field(2, "g", mtx[1][2]); + smlua_push_number_field(2, "h", mtx[1][3]); + smlua_push_number_field(2, "i", mtx[2][0]); + smlua_push_number_field(2, "j", mtx[2][1]); + smlua_push_number_field(2, "k", mtx[2][2]); + smlua_push_number_field(2, "l", mtx[2][3]); + smlua_push_number_field(2, "m", mtx[3][0]); + smlua_push_number_field(2, "n", mtx[3][1]); + smlua_push_number_field(2, "o", mtx[3][2]); + smlua_push_number_field(2, "p", mtx[3][3]); + smlua_push_number_field(3, "x", s[0]); smlua_push_number_field(3, "y", s[1]); smlua_push_number_field(3, "z", s[2]); return 1; } -*/ -/* int smlua_func_mtxf_to_mtx(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } -// Mtx * dest = (Mtx *)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_to_mtx'"); return 0; } -// Mat4 src = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_to_mtx'"); return 0; } + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_to_mtx", 2, top); + return 0; + } + + Mtx * dest = (Mtx *)smlua_to_cpointer(L, 1, LVT_COBJECT_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_to_mtx"); return 0; } + + Mat4 src; + src[0][0] = smlua_get_number_field(2, "a"); + src[0][1] = smlua_get_number_field(2, "b"); + src[0][2] = smlua_get_number_field(2, "c"); + src[0][3] = smlua_get_number_field(2, "d"); + src[1][0] = smlua_get_number_field(2, "e"); + src[1][1] = smlua_get_number_field(2, "f"); + src[1][2] = smlua_get_number_field(2, "g"); + src[1][3] = smlua_get_number_field(2, "h"); + src[2][0] = smlua_get_number_field(2, "i"); + src[2][1] = smlua_get_number_field(2, "j"); + src[2][2] = smlua_get_number_field(2, "k"); + src[2][3] = smlua_get_number_field(2, "l"); + src[3][0] = smlua_get_number_field(2, "m"); + src[3][1] = smlua_get_number_field(2, "n"); + src[3][2] = smlua_get_number_field(2, "o"); + src[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_to_mtx"); return 0; } mtxf_to_mtx(dest, src); + smlua_push_number_field(2, "a", src[0][0]); + smlua_push_number_field(2, "b", src[0][1]); + smlua_push_number_field(2, "c", src[0][2]); + smlua_push_number_field(2, "d", src[0][3]); + smlua_push_number_field(2, "e", src[1][0]); + smlua_push_number_field(2, "f", src[1][1]); + smlua_push_number_field(2, "g", src[1][2]); + smlua_push_number_field(2, "h", src[1][3]); + smlua_push_number_field(2, "i", src[2][0]); + smlua_push_number_field(2, "j", src[2][1]); + smlua_push_number_field(2, "k", src[2][2]); + smlua_push_number_field(2, "l", src[2][3]); + smlua_push_number_field(2, "m", src[3][0]); + smlua_push_number_field(2, "n", src[3][1]); + smlua_push_number_field(2, "o", src[3][2]); + smlua_push_number_field(2, "p", src[3][3]); + return 1; } -*/ -/* int smlua_func_mtxf_translate(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 dest = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mtxf_translate'"); return 0; } + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mtxf_translate", 2, top); + return 0; + } + + + Mat4 dest; + dest[0][0] = smlua_get_number_field(1, "a"); + dest[0][1] = smlua_get_number_field(1, "b"); + dest[0][2] = smlua_get_number_field(1, "c"); + dest[0][3] = smlua_get_number_field(1, "d"); + dest[1][0] = smlua_get_number_field(1, "e"); + dest[1][1] = smlua_get_number_field(1, "f"); + dest[1][2] = smlua_get_number_field(1, "g"); + dest[1][3] = smlua_get_number_field(1, "h"); + dest[2][0] = smlua_get_number_field(1, "i"); + dest[2][1] = smlua_get_number_field(1, "j"); + dest[2][2] = smlua_get_number_field(1, "k"); + dest[2][3] = smlua_get_number_field(1, "l"); + dest[3][0] = smlua_get_number_field(1, "m"); + dest[3][1] = smlua_get_number_field(1, "n"); + dest[3][2] = smlua_get_number_field(1, "o"); + dest[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_translate"); return 0; } f32* b = smlua_get_vec3f_from_buffer(); b[0] = smlua_get_number_field(2, "x"); b[1] = smlua_get_number_field(2, "y"); b[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mtxf_translate'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mtxf_translate"); return 0; } mtxf_translate(dest, b); + smlua_push_number_field(1, "a", dest[0][0]); + smlua_push_number_field(1, "b", dest[0][1]); + smlua_push_number_field(1, "c", dest[0][2]); + smlua_push_number_field(1, "d", dest[0][3]); + smlua_push_number_field(1, "e", dest[1][0]); + smlua_push_number_field(1, "f", dest[1][1]); + smlua_push_number_field(1, "g", dest[1][2]); + smlua_push_number_field(1, "h", dest[1][3]); + smlua_push_number_field(1, "i", dest[2][0]); + smlua_push_number_field(1, "j", dest[2][1]); + smlua_push_number_field(1, "k", dest[2][2]); + smlua_push_number_field(1, "l", dest[2][3]); + smlua_push_number_field(1, "m", dest[3][0]); + smlua_push_number_field(1, "n", dest[3][1]); + smlua_push_number_field(1, "o", dest[3][2]); + smlua_push_number_field(1, "p", dest[3][3]); + smlua_push_number_field(2, "x", b[0]); smlua_push_number_field(2, "y", b[1]); smlua_push_number_field(2, "z", b[2]); return 1; } -*/ int smlua_func_not_zero(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "not_zero", 2, top); + return 0; + } f32 value = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'not_zero'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "not_zero"); return 0; } f32 replacement = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'not_zero'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "not_zero"); return 0; } lua_pushnumber(L, not_zero(value, replacement)); return 1; } -/* int smlua_func_spline_get_weights(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spline_get_weights", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spline_get_weights'"); return 0; } -// Vec4f result = (Vec4f)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spline_get_weights'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spline_get_weights"); return 0; } + + f32* result = smlua_get_vec4f_from_buffer(); + result[0] = smlua_get_number_field(2, "x"); + result[1] = smlua_get_number_field(2, "y"); + result[2] = smlua_get_number_field(2, "z"); + result[3] = smlua_get_number_field(2, "w"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spline_get_weights"); return 0; } f32 t = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'spline_get_weights'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spline_get_weights"); return 0; } s32 c = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'spline_get_weights'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spline_get_weights"); return 0; } spline_get_weights(m, result, t, c); + smlua_push_number_field(2, "x", result[0]); + smlua_push_number_field(2, "y", result[1]); + smlua_push_number_field(2, "z", result[2]); + smlua_push_number_field(2, "w", result[3]); + return 1; } -*/ -/* int smlua_func_vec3f_add(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_add", 2, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_add'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_add"); return 0; } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(2, "x"); a[1] = smlua_get_number_field(2, "y"); a[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_add'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_add"); return 0; } - UNIMPLEMENTED -->(L, vec3f_add(dest, a)); + vec3f_add(dest, a); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -11010,33 +17499,38 @@ int smlua_func_vec3f_add(lua_State* L) { return 1; } -*/ int smlua_func_vec3f_combine(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_combine", 5, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_combine'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_combine"); return 0; } f32* vecA = smlua_get_vec3f_from_buffer(); vecA[0] = smlua_get_number_field(2, "x"); vecA[1] = smlua_get_number_field(2, "y"); vecA[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_combine'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_combine"); return 0; } f32* vecB = smlua_get_vec3f_from_buffer(); vecB[0] = smlua_get_number_field(3, "x"); vecB[1] = smlua_get_number_field(3, "y"); vecB[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_combine'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_combine"); return 0; } f32 sclA = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'vec3f_combine'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "vec3f_combine"); return 0; } f32 sclB = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'vec3f_combine'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "vec3f_combine"); return 0; } vec3f_combine(dest, vecA, vecB, sclA, sclB); @@ -11055,24 +17549,29 @@ int smlua_func_vec3f_combine(lua_State* L) { return 1; } -/* int smlua_func_vec3f_copy(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_copy", 2, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_copy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_copy"); return 0; } f32* src = smlua_get_vec3f_from_buffer(); src[0] = smlua_get_number_field(2, "x"); src[1] = smlua_get_number_field(2, "y"); src[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_copy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_copy"); return 0; } - UNIMPLEMENTED -->(L, vec3f_copy(dest, src)); + vec3f_copy(dest, src); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -11084,32 +17583,36 @@ int smlua_func_vec3f_copy(lua_State* L) { return 1; } -*/ -/* int smlua_func_vec3f_cross(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_cross", 3, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_cross'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_cross"); return 0; } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(2, "x"); a[1] = smlua_get_number_field(2, "y"); a[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_cross'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_cross"); return 0; } f32* b = smlua_get_vec3f_from_buffer(); b[0] = smlua_get_number_field(3, "x"); b[1] = smlua_get_number_field(3, "y"); b[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_cross'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_cross"); return 0; } - UNIMPLEMENTED -->(L, vec3f_cross(dest, a, b)); + vec3f_cross(dest, a, b); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -11125,32 +17628,36 @@ int smlua_func_vec3f_cross(lua_State* L) { return 1; } -*/ -/* int smlua_func_vec3f_dif(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_dif", 3, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_dif'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_dif"); return 0; } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(2, "x"); a[1] = smlua_get_number_field(2, "y"); a[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_dif'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_dif"); return 0; } f32* b = smlua_get_vec3f_from_buffer(); b[0] = smlua_get_number_field(3, "x"); b[1] = smlua_get_number_field(3, "y"); b[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_dif'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_dif"); return 0; } - UNIMPLEMENTED -->(L, vec3f_dif(dest, a, b)); + vec3f_dif(dest, a, b); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -11166,23 +17673,28 @@ int smlua_func_vec3f_dif(lua_State* L) { return 1; } -*/ int smlua_func_vec3f_dist(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_dist", 2, top); + return 0; + } f32* v1 = smlua_get_vec3f_from_buffer(); v1[0] = smlua_get_number_field(1, "x"); v1[1] = smlua_get_number_field(1, "y"); v1[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_dist'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_dist"); return 0; } f32* v2 = smlua_get_vec3f_from_buffer(); v2[0] = smlua_get_number_field(2, "x"); v2[1] = smlua_get_number_field(2, "y"); v2[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_dist'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_dist"); return 0; } lua_pushnumber(L, vec3f_dist(v1, v2)); @@ -11198,20 +17710,26 @@ int smlua_func_vec3f_dist(lua_State* L) { } int smlua_func_vec3f_dot(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_dot", 2, top); + return 0; + } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(1, "x"); a[1] = smlua_get_number_field(1, "y"); a[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_dot'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_dot"); return 0; } f32* b = smlua_get_vec3f_from_buffer(); b[0] = smlua_get_number_field(2, "x"); b[1] = smlua_get_number_field(2, "y"); b[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_dot'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_dot"); return 0; } lua_pushnumber(L, vec3f_dot(a, b)); @@ -11227,26 +17745,32 @@ int smlua_func_vec3f_dot(lua_State* L) { } int smlua_func_vec3f_get_dist_and_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_get_dist_and_angle", 5, top); + return 0; + } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(1, "x"); from[1] = smlua_get_number_field(1, "y"); from[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_get_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_get_dist_and_angle"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(2, "x"); to[1] = smlua_get_number_field(2, "y"); to[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_get_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_get_dist_and_angle"); return 0; } f32 * dist = (f32 *)smlua_to_cpointer(L, 3, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_get_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_get_dist_and_angle"); return 0; } s16 * pitch = (s16 *)smlua_to_cpointer(L, 4, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'vec3f_get_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "vec3f_get_dist_and_angle"); return 0; } s16 * yaw = (s16 *)smlua_to_cpointer(L, 5, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'vec3f_get_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "vec3f_get_dist_and_angle"); return 0; } vec3f_get_dist_and_angle(from, to, dist, pitch, yaw); @@ -11262,14 +17786,20 @@ int smlua_func_vec3f_get_dist_and_angle(lua_State* L) { } int smlua_func_vec3f_length(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_length", 1, top); + return 0; + } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(1, "x"); a[1] = smlua_get_number_field(1, "y"); a[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_length'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_length"); return 0; } lua_pushnumber(L, vec3f_length(a)); @@ -11280,20 +17810,25 @@ int smlua_func_vec3f_length(lua_State* L) { return 1; } -/* int smlua_func_vec3f_mul(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_mul", 2, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_mul'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_mul"); return 0; } f32 a = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_mul'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_mul"); return 0; } - UNIMPLEMENTED -->(L, vec3f_mul(dest, a)); + vec3f_mul(dest, a); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -11301,20 +17836,24 @@ int smlua_func_vec3f_mul(lua_State* L) { return 1; } -*/ -/* int smlua_func_vec3f_normalize(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_normalize", 1, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_normalize'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_normalize"); return 0; } - UNIMPLEMENTED -->(L, vec3f_normalize(dest)); + vec3f_normalize(dest); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -11322,29 +17861,34 @@ int smlua_func_vec3f_normalize(lua_State* L) { return 1; } -*/ int smlua_func_vec3f_project(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_project", 3, top); + return 0; + } f32* vec = smlua_get_vec3f_from_buffer(); vec[0] = smlua_get_number_field(1, "x"); vec[1] = smlua_get_number_field(1, "y"); vec[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_project'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_project"); return 0; } f32* onto = smlua_get_vec3f_from_buffer(); onto[0] = smlua_get_number_field(2, "x"); onto[1] = smlua_get_number_field(2, "y"); onto[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_project'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_project"); return 0; } f32* out = smlua_get_vec3f_from_buffer(); out[0] = smlua_get_number_field(3, "x"); out[1] = smlua_get_number_field(3, "y"); out[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_project'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_project"); return 0; } vec3f_project(vec, onto, out); @@ -11363,24 +17907,29 @@ int smlua_func_vec3f_project(lua_State* L) { return 1; } -/* int smlua_func_vec3f_rotate_zxy(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_rotate_zxy", 2, top); + return 0; + } f32* v = smlua_get_vec3f_from_buffer(); v[0] = smlua_get_number_field(1, "x"); v[1] = smlua_get_number_field(1, "y"); v[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_rotate_zxy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_rotate_zxy"); return 0; } s16* rotate = smlua_get_vec3s_from_buffer(); rotate[0] = smlua_get_integer_field(2, "x"); rotate[1] = smlua_get_integer_field(2, "y"); rotate[2] = smlua_get_integer_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_rotate_zxy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_rotate_zxy"); return 0; } - UNIMPLEMENTED -->(L, vec3f_rotate_zxy(v, rotate)); + vec3f_rotate_zxy(v, rotate); smlua_push_number_field(1, "x", v[0]); smlua_push_number_field(1, "y", v[1]); @@ -11392,26 +17941,30 @@ int smlua_func_vec3f_rotate_zxy(lua_State* L) { return 1; } -*/ -/* int smlua_func_vec3f_set(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_set", 4, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_set'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_set"); return 0; } f32 x = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_set'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_set"); return 0; } f32 y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_set'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_set"); return 0; } f32 z = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'vec3f_set'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "vec3f_set"); return 0; } - UNIMPLEMENTED -->(L, vec3f_set(dest, x, y, z)); + vec3f_set(dest, x, y, z); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -11419,29 +17972,34 @@ int smlua_func_vec3f_set(lua_State* L) { return 1; } -*/ int smlua_func_vec3f_set_dist_and_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_set_dist_and_angle", 5, top); + return 0; + } f32* from = smlua_get_vec3f_from_buffer(); from[0] = smlua_get_number_field(1, "x"); from[1] = smlua_get_number_field(1, "y"); from[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_set_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_set_dist_and_angle"); return 0; } f32* to = smlua_get_vec3f_from_buffer(); to[0] = smlua_get_number_field(2, "x"); to[1] = smlua_get_number_field(2, "y"); to[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_set_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_set_dist_and_angle"); return 0; } f32 dist = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_set_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_set_dist_and_angle"); return 0; } s16 pitch = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'vec3f_set_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "vec3f_set_dist_and_angle"); return 0; } s16 yaw = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'vec3f_set_dist_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "vec3f_set_dist_and_angle"); return 0; } vec3f_set_dist_and_angle(from, to, dist, pitch, yaw); @@ -11456,30 +18014,35 @@ int smlua_func_vec3f_set_dist_and_angle(lua_State* L) { return 1; } -/* int smlua_func_vec3f_sum(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_sum", 3, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_sum'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_sum"); return 0; } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(2, "x"); a[1] = smlua_get_number_field(2, "y"); a[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_sum'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_sum"); return 0; } f32* b = smlua_get_vec3f_from_buffer(); b[0] = smlua_get_number_field(3, "x"); b[1] = smlua_get_number_field(3, "y"); b[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3f_sum'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3f_sum"); return 0; } - UNIMPLEMENTED -->(L, vec3f_sum(dest, a, b)); + vec3f_sum(dest, a, b); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -11495,26 +18058,30 @@ int smlua_func_vec3f_sum(lua_State* L) { return 1; } -*/ -/* int smlua_func_vec3f_to_vec3s(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3f_to_vec3s", 2, top); + return 0; + } s16* dest = smlua_get_vec3s_from_buffer(); dest[0] = smlua_get_integer_field(1, "x"); dest[1] = smlua_get_integer_field(1, "y"); dest[2] = smlua_get_integer_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3f_to_vec3s'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3f_to_vec3s"); return 0; } f32* a = smlua_get_vec3f_from_buffer(); a[0] = smlua_get_number_field(2, "x"); a[1] = smlua_get_number_field(2, "y"); a[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3f_to_vec3s'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3f_to_vec3s"); return 0; } - UNIMPLEMENTED -->(L, vec3f_to_vec3s(dest, a)); + vec3f_to_vec3s(dest, a); smlua_push_integer_field(1, "x", dest[0]); smlua_push_integer_field(1, "y", dest[1]); @@ -11526,26 +18093,30 @@ int smlua_func_vec3f_to_vec3s(lua_State* L) { return 1; } -*/ -/* int smlua_func_vec3s_add(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3s_add", 2, top); + return 0; + } s16* dest = smlua_get_vec3s_from_buffer(); dest[0] = smlua_get_integer_field(1, "x"); dest[1] = smlua_get_integer_field(1, "y"); dest[2] = smlua_get_integer_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3s_add'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3s_add"); return 0; } s16* a = smlua_get_vec3s_from_buffer(); a[0] = smlua_get_integer_field(2, "x"); a[1] = smlua_get_integer_field(2, "y"); a[2] = smlua_get_integer_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3s_add'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3s_add"); return 0; } - UNIMPLEMENTED -->(L, vec3s_add(dest, a)); + vec3s_add(dest, a); smlua_push_integer_field(1, "x", dest[0]); smlua_push_integer_field(1, "y", dest[1]); @@ -11557,26 +18128,30 @@ int smlua_func_vec3s_add(lua_State* L) { return 1; } -*/ -/* int smlua_func_vec3s_copy(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3s_copy", 2, top); + return 0; + } s16* dest = smlua_get_vec3s_from_buffer(); dest[0] = smlua_get_integer_field(1, "x"); dest[1] = smlua_get_integer_field(1, "y"); dest[2] = smlua_get_integer_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3s_copy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3s_copy"); return 0; } s16* src = smlua_get_vec3s_from_buffer(); src[0] = smlua_get_integer_field(2, "x"); src[1] = smlua_get_integer_field(2, "y"); src[2] = smlua_get_integer_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3s_copy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3s_copy"); return 0; } - UNIMPLEMENTED -->(L, vec3s_copy(dest, src)); + vec3s_copy(dest, src); smlua_push_integer_field(1, "x", dest[0]); smlua_push_integer_field(1, "y", dest[1]); @@ -11588,26 +18163,30 @@ int smlua_func_vec3s_copy(lua_State* L) { return 1; } -*/ -/* int smlua_func_vec3s_set(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3s_set", 4, top); + return 0; + } s16* dest = smlua_get_vec3s_from_buffer(); dest[0] = smlua_get_integer_field(1, "x"); dest[1] = smlua_get_integer_field(1, "y"); dest[2] = smlua_get_integer_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3s_set'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3s_set"); return 0; } s16 x = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3s_set'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3s_set"); return 0; } s16 y = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3s_set'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3s_set"); return 0; } s16 z = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'vec3s_set'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "vec3s_set"); return 0; } - UNIMPLEMENTED -->(L, vec3s_set(dest, x, y, z)); + vec3s_set(dest, x, y, z); smlua_push_integer_field(1, "x", dest[0]); smlua_push_integer_field(1, "y", dest[1]); @@ -11615,63 +18194,36 @@ int smlua_func_vec3s_set(lua_State* L) { return 1; } -*/ -/* -int smlua_func_vec3s_sub(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } - - - s16* dest = smlua_get_vec3s_from_buffer(); - dest[0] = smlua_get_integer_field(1, "x"); - dest[1] = smlua_get_integer_field(1, "y"); - dest[2] = smlua_get_integer_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3s_sub'"); return 0; } - - s16* a = smlua_get_vec3s_from_buffer(); - a[0] = smlua_get_integer_field(2, "x"); - a[1] = smlua_get_integer_field(2, "y"); - a[2] = smlua_get_integer_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3s_sub'"); return 0; } - - UNIMPLEMENTED -->(L, vec3s_sub(dest, a)); - - smlua_push_integer_field(1, "x", dest[0]); - smlua_push_integer_field(1, "y", dest[1]); - smlua_push_integer_field(1, "z", dest[2]); - - smlua_push_integer_field(2, "x", a[0]); - smlua_push_integer_field(2, "y", a[1]); - smlua_push_integer_field(2, "z", a[2]); - - return 1; -} -*/ - -/* int smlua_func_vec3s_sum(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3s_sum", 3, top); + return 0; + } s16* dest = smlua_get_vec3s_from_buffer(); dest[0] = smlua_get_integer_field(1, "x"); dest[1] = smlua_get_integer_field(1, "y"); dest[2] = smlua_get_integer_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3s_sum'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3s_sum"); return 0; } s16* a = smlua_get_vec3s_from_buffer(); a[0] = smlua_get_integer_field(2, "x"); a[1] = smlua_get_integer_field(2, "y"); a[2] = smlua_get_integer_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3s_sum'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3s_sum"); return 0; } s16* b = smlua_get_vec3s_from_buffer(); b[0] = smlua_get_integer_field(3, "x"); b[1] = smlua_get_integer_field(3, "y"); b[2] = smlua_get_integer_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'vec3s_sum'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "vec3s_sum"); return 0; } - UNIMPLEMENTED -->(L, vec3s_sum(dest, a, b)); + vec3s_sum(dest, a, b); smlua_push_integer_field(1, "x", dest[0]); smlua_push_integer_field(1, "y", dest[1]); @@ -11687,26 +18239,30 @@ int smlua_func_vec3s_sum(lua_State* L) { return 1; } -*/ -/* int smlua_func_vec3s_to_vec3f(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "vec3s_to_vec3f", 2, top); + return 0; + } f32* dest = smlua_get_vec3f_from_buffer(); dest[0] = smlua_get_number_field(1, "x"); dest[1] = smlua_get_number_field(1, "y"); dest[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'vec3s_to_vec3f'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "vec3s_to_vec3f"); return 0; } s16* a = smlua_get_vec3s_from_buffer(); a[0] = smlua_get_integer_field(2, "x"); a[1] = smlua_get_integer_field(2, "y"); a[2] = smlua_get_integer_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'vec3s_to_vec3f'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "vec3s_to_vec3f"); return 0; } - UNIMPLEMENTED -->(L, vec3s_to_vec3f(dest, a)); + vec3s_to_vec3f(dest, a); smlua_push_number_field(1, "x", dest[0]); smlua_push_number_field(1, "y", dest[1]); @@ -11718,14 +18274,19 @@ int smlua_func_vec3s_to_vec3f(lua_State* L) { return 1; } -*/ //////////// // misc.h // //////////// int smlua_func_update_all_mario_stars(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "update_all_mario_stars", 0, top); + return 0; + } update_all_mario_stars(); @@ -11738,10 +18299,16 @@ int smlua_func_update_all_mario_stars(UNUSED lua_State* L) { /////////////////// int smlua_func_mod_storage_load(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mod_storage_load", 1, top); + return 0; + } const char* key = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mod_storage_load'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mod_storage_load"); return 0; } lua_pushstring(L, mod_storage_load(key)); @@ -11749,12 +18316,18 @@ int smlua_func_mod_storage_load(lua_State* L) { } int smlua_func_mod_storage_save(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mod_storage_save", 2, top); + return 0; + } const char* key = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mod_storage_save'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mod_storage_save"); return 0; } const char* value = smlua_to_string(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mod_storage_save'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mod_storage_save"); return 0; } lua_pushboolean(L, mod_storage_save(key, value)); @@ -11766,16 +18339,22 @@ int smlua_func_mod_storage_save(lua_State* L) { ////////////////////// int smlua_func_get_network_player_from_area(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_network_player_from_area", 4, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_network_player_from_area'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_network_player_from_area"); return 0; } s16 actNum = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_network_player_from_area'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_network_player_from_area"); return 0; } s16 levelNum = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'get_network_player_from_area'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_network_player_from_area"); return 0; } s16 areaIndex = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'get_network_player_from_area'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "get_network_player_from_area"); return 0; } smlua_push_object(L, LOT_NETWORKPLAYER, get_network_player_from_area(courseNum, actNum, levelNum, areaIndex)); @@ -11783,14 +18362,20 @@ int smlua_func_get_network_player_from_area(lua_State* L) { } int smlua_func_get_network_player_from_level(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_network_player_from_level", 3, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_network_player_from_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_network_player_from_level"); return 0; } s16 actNum = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_network_player_from_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_network_player_from_level"); return 0; } s16 levelNum = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'get_network_player_from_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_network_player_from_level"); return 0; } smlua_push_object(L, LOT_NETWORKPLAYER, get_network_player_from_level(courseNum, actNum, levelNum)); @@ -11798,7 +18383,13 @@ int smlua_func_get_network_player_from_level(lua_State* L) { } int smlua_func_get_network_player_smallest_global(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_network_player_smallest_global", 0, top); + return 0; + } smlua_push_object(L, LOT_NETWORKPLAYER, get_network_player_smallest_global()); @@ -11807,18 +18398,24 @@ int smlua_func_get_network_player_smallest_global(UNUSED lua_State* L) { } int smlua_func_network_player_color_to_palette(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_color_to_palette", 3, top); + return 0; + } struct NetworkPlayer* np = (struct NetworkPlayer*)smlua_to_cobject(L, 1, LOT_NETWORKPLAYER); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'network_player_color_to_palette'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_player_color_to_palette"); return 0; } int part = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'network_player_color_to_palette'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_color_to_palette"); return 0; } u8* color = smlua_get_color_from_buffer(); color[0] = smlua_get_integer_field(3, "r"); color[1] = smlua_get_integer_field(3, "g"); color[2] = smlua_get_integer_field(3, "b"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'network_player_color_to_palette'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_color_to_palette"); return 0; } network_player_color_to_palette(np, part, color); @@ -11830,7 +18427,13 @@ int smlua_func_network_player_color_to_palette(lua_State* L) { } int smlua_func_network_player_connected_count(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_connected_count", 0, top); + return 0; + } lua_pushinteger(L, network_player_connected_count()); @@ -11839,10 +18442,16 @@ int smlua_func_network_player_connected_count(UNUSED lua_State* L) { } int smlua_func_network_player_from_global_index(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_from_global_index", 1, top); + return 0; + } u8 globalIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'network_player_from_global_index'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_player_from_global_index"); return 0; } smlua_push_object(L, LOT_NETWORKPLAYER, network_player_from_global_index(globalIndex)); @@ -11850,18 +18459,24 @@ int smlua_func_network_player_from_global_index(lua_State* L) { } int smlua_func_network_player_palette_to_color(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_palette_to_color", 3, top); + return 0; + } struct NetworkPlayer* np = (struct NetworkPlayer*)smlua_to_cobject(L, 1, LOT_NETWORKPLAYER); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'network_player_palette_to_color'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_player_palette_to_color"); return 0; } int part = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'network_player_palette_to_color'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_palette_to_color"); return 0; } u8* out = smlua_get_color_from_buffer(); out[0] = smlua_get_integer_field(3, "r"); out[1] = smlua_get_integer_field(3, "g"); out[2] = smlua_get_integer_field(3, "b"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'network_player_palette_to_color'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_palette_to_color"); return 0; } network_player_palette_to_color(np, part, out); @@ -11873,20 +18488,26 @@ int smlua_func_network_player_palette_to_color(lua_State* L) { } int smlua_func_network_player_set_description(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_set_description", 6, top); + return 0; + } struct NetworkPlayer* np = (struct NetworkPlayer*)smlua_to_cobject(L, 1, LOT_NETWORKPLAYER); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'network_player_set_description'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_player_set_description"); return 0; } const char* description = smlua_to_string(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'network_player_set_description'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_set_description"); return 0; } u8 r = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'network_player_set_description'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_set_description"); return 0; } u8 g = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'network_player_set_description'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "network_player_set_description"); return 0; } u8 b = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'network_player_set_description'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "network_player_set_description"); return 0; } u8 a = smlua_to_integer(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'network_player_set_description'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "network_player_set_description"); return 0; } network_player_set_description(np, description, r, g, b, a); @@ -11898,10 +18519,16 @@ int smlua_func_network_player_set_description(lua_State* L) { ///////////////////// int smlua_func_network_discord_id_from_local_index(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_discord_id_from_local_index", 1, top); + return 0; + } u8 localIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'network_discord_id_from_local_index'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_discord_id_from_local_index"); return 0; } lua_pushstring(L, network_discord_id_from_local_index(localIndex)); @@ -11909,10 +18536,16 @@ int smlua_func_network_discord_id_from_local_index(lua_State* L) { } int smlua_func_network_get_player_text_color_string(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_get_player_text_color_string", 1, top); + return 0; + } u8 localIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'network_get_player_text_color_string'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_get_player_text_color_string"); return 0; } lua_pushstring(L, network_get_player_text_color_string(localIndex)); @@ -11920,10 +18553,16 @@ int smlua_func_network_get_player_text_color_string(lua_State* L) { } int smlua_func_network_global_index_from_local(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_global_index_from_local", 1, top); + return 0; + } u8 localIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'network_global_index_from_local'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_global_index_from_local"); return 0; } lua_pushinteger(L, network_global_index_from_local(localIndex)); @@ -11931,7 +18570,13 @@ int smlua_func_network_global_index_from_local(lua_State* L) { } int smlua_func_network_is_moderator(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_is_moderator", 0, top); + return 0; + } lua_pushboolean(L, network_is_moderator()); @@ -11940,7 +18585,13 @@ int smlua_func_network_is_moderator(UNUSED lua_State* L) { } int smlua_func_network_is_server(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_is_server", 0, top); + return 0; + } lua_pushboolean(L, network_is_server()); @@ -11949,10 +18600,16 @@ int smlua_func_network_is_server(UNUSED lua_State* L) { } int smlua_func_network_local_index_from_global(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_local_index_from_global", 1, top); + return 0; + } u8 globalIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'network_local_index_from_global'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_local_index_from_global"); return 0; } lua_pushinteger(L, network_local_index_from_global(globalIndex)); @@ -11964,10 +18621,16 @@ int smlua_func_network_local_index_from_global(lua_State* L) { ///////////////////// int smlua_func_absf_2(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "absf_2", 1, top); + return 0; + } f32 f = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'absf_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "absf_2"); return 0; } extern f32 absf_2(f32 f); lua_pushnumber(L, absf_2(f)); @@ -11976,16 +18639,22 @@ int smlua_func_absf_2(lua_State* L) { } int smlua_func_calc_new_obj_vel_and_pos_y(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calc_new_obj_vel_and_pos_y", 4, top); + return 0; + } struct Surface* objFloor = (struct Surface*)smlua_to_cobject(L, 1, LOT_SURFACE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calc_new_obj_vel_and_pos_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_new_obj_vel_and_pos_y"); return 0; } f32 objFloorY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'calc_new_obj_vel_and_pos_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calc_new_obj_vel_and_pos_y"); return 0; } f32 objVelX = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'calc_new_obj_vel_and_pos_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "calc_new_obj_vel_and_pos_y"); return 0; } f32 objVelZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'calc_new_obj_vel_and_pos_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "calc_new_obj_vel_and_pos_y"); return 0; } extern void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ); calc_new_obj_vel_and_pos_y(objFloor, objFloorY, objVelX, objVelZ); @@ -11994,18 +18663,24 @@ int smlua_func_calc_new_obj_vel_and_pos_y(lua_State* L) { } int smlua_func_calc_new_obj_vel_and_pos_y_underwater(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calc_new_obj_vel_and_pos_y_underwater", 5, top); + return 0; + } struct Surface* objFloor = (struct Surface*)smlua_to_cobject(L, 1, LOT_SURFACE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calc_new_obj_vel_and_pos_y_underwater'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_new_obj_vel_and_pos_y_underwater"); return 0; } f32 floorY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'calc_new_obj_vel_and_pos_y_underwater'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calc_new_obj_vel_and_pos_y_underwater"); return 0; } f32 objVelX = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'calc_new_obj_vel_and_pos_y_underwater'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "calc_new_obj_vel_and_pos_y_underwater"); return 0; } f32 objVelZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'calc_new_obj_vel_and_pos_y_underwater'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "calc_new_obj_vel_and_pos_y_underwater"); return 0; } f32 waterY = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'calc_new_obj_vel_and_pos_y_underwater'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "calc_new_obj_vel_and_pos_y_underwater"); return 0; } extern void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, f32 waterY); calc_new_obj_vel_and_pos_y_underwater(objFloor, floorY, objVelX, objVelZ, waterY); @@ -12014,12 +18689,18 @@ int smlua_func_calc_new_obj_vel_and_pos_y_underwater(lua_State* L) { } int smlua_func_calc_obj_friction(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calc_obj_friction", 2, top); + return 0; + } f32 * objFriction = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calc_obj_friction'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_obj_friction"); return 0; } f32 floor_nY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'calc_obj_friction'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "calc_obj_friction"); return 0; } extern void calc_obj_friction(f32 *objFriction, f32 floor_nY); calc_obj_friction(objFriction, floor_nY); @@ -12028,10 +18709,16 @@ int smlua_func_calc_obj_friction(lua_State* L) { } int smlua_func_current_mario_room_check(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "current_mario_room_check", 1, top); + return 0; + } s16 room = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'current_mario_room_check'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "current_mario_room_check"); return 0; } extern s8 current_mario_room_check(s16 room); lua_pushinteger(L, current_mario_room_check(room)); @@ -12041,14 +18728,20 @@ int smlua_func_current_mario_room_check(lua_State* L) { /* int smlua_func_geo_obj_transparency_something(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_obj_transparency_something", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_obj_transparency_something'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_obj_transparency_something"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_obj_transparency_something'"); return 0; } -// Mat4 * mtx = (Mat4 *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_obj_transparency_something'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_obj_transparency_something"); return 0; } + Mat4 * mtx = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_obj_transparency_something"); return 0; } extern Gfx UNUSED *geo_obj_transparency_something(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx); UNIMPLEMENTED -->(L, geo_obj_transparency_something(callContext, node, mtx)); @@ -12058,12 +18751,18 @@ int smlua_func_geo_obj_transparency_something(lua_State* L) { */ int smlua_func_is_nearest_mario_state_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_nearest_mario_state_to_object", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_nearest_mario_state_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_nearest_mario_state_to_object"); return 0; } struct Object* obj = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'is_nearest_mario_state_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "is_nearest_mario_state_to_object"); return 0; } extern u8 is_nearest_mario_state_to_object(struct MarioState *m, struct Object *obj); lua_pushinteger(L, is_nearest_mario_state_to_object(m, obj)); @@ -12072,12 +18771,18 @@ int smlua_func_is_nearest_mario_state_to_object(lua_State* L) { } int smlua_func_is_nearest_player_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_nearest_player_to_object", 2, top); + return 0; + } struct Object* m = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_nearest_player_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_nearest_player_to_object"); return 0; } struct Object* obj = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'is_nearest_player_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "is_nearest_player_to_object"); return 0; } extern u8 is_nearest_player_to_object(struct Object *m, struct Object *obj); lua_pushinteger(L, is_nearest_player_to_object(m, obj)); @@ -12086,7 +18791,13 @@ int smlua_func_is_nearest_player_to_object(lua_State* L) { } int smlua_func_is_other_player_active(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_other_player_active", 0, top); + return 0; + } extern u8 is_other_player_active(void); @@ -12096,10 +18807,16 @@ int smlua_func_is_other_player_active(UNUSED lua_State* L) { } int smlua_func_is_player_active(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_player_active", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_player_active'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_player_active"); return 0; } extern u8 is_player_active(struct MarioState* m); lua_pushinteger(L, is_player_active(m)); @@ -12108,10 +18825,16 @@ int smlua_func_is_player_active(lua_State* L) { } int smlua_func_is_player_in_local_area(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_player_in_local_area", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_player_in_local_area'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_player_in_local_area"); return 0; } extern u8 is_player_in_local_area(struct MarioState* m); lua_pushinteger(L, is_player_in_local_area(m)); @@ -12120,18 +18843,24 @@ int smlua_func_is_player_in_local_area(lua_State* L) { } int smlua_func_is_point_close_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_point_close_to_object", 5, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_point_close_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_point_close_to_object"); return 0; } f32 x = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'is_point_close_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "is_point_close_to_object"); return 0; } f32 y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'is_point_close_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "is_point_close_to_object"); return 0; } f32 z = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'is_point_close_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "is_point_close_to_object"); return 0; } s32 dist = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'is_point_close_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "is_point_close_to_object"); return 0; } extern s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist); lua_pushinteger(L, is_point_close_to_object(obj, x, y, z, dist)); @@ -12140,16 +18869,22 @@ int smlua_func_is_point_close_to_object(lua_State* L) { } int smlua_func_is_point_within_radius_of_any_player(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_point_within_radius_of_any_player", 4, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_point_within_radius_of_any_player'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_point_within_radius_of_any_player"); return 0; } f32 y = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'is_point_within_radius_of_any_player'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "is_point_within_radius_of_any_player"); return 0; } f32 z = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'is_point_within_radius_of_any_player'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "is_point_within_radius_of_any_player"); return 0; } s32 dist = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'is_point_within_radius_of_any_player'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "is_point_within_radius_of_any_player"); return 0; } extern s8 is_point_within_radius_of_any_player(f32 x, f32 y, f32 z, s32 dist); lua_pushinteger(L, is_point_within_radius_of_any_player(x, y, z, dist)); @@ -12158,16 +18893,22 @@ int smlua_func_is_point_within_radius_of_any_player(lua_State* L) { } int smlua_func_is_point_within_radius_of_mario(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_point_within_radius_of_mario", 4, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_point_within_radius_of_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_point_within_radius_of_mario"); return 0; } f32 y = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'is_point_within_radius_of_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "is_point_within_radius_of_mario"); return 0; } f32 z = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'is_point_within_radius_of_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "is_point_within_radius_of_mario"); return 0; } s32 dist = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'is_point_within_radius_of_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "is_point_within_radius_of_mario"); return 0; } extern s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist); lua_pushinteger(L, is_point_within_radius_of_mario(x, y, z, dist)); @@ -12176,10 +18917,16 @@ int smlua_func_is_point_within_radius_of_mario(lua_State* L) { } int smlua_func_nearest_interacting_mario_state_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "nearest_interacting_mario_state_to_object", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'nearest_interacting_mario_state_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_interacting_mario_state_to_object"); return 0; } extern struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj); smlua_push_object(L, LOT_MARIOSTATE, nearest_interacting_mario_state_to_object(obj)); @@ -12188,10 +18935,16 @@ int smlua_func_nearest_interacting_mario_state_to_object(lua_State* L) { } int smlua_func_nearest_interacting_player_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "nearest_interacting_player_to_object", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'nearest_interacting_player_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_interacting_player_to_object"); return 0; } extern struct Object *nearest_interacting_player_to_object(struct Object *obj); smlua_push_object(L, LOT_OBJECT, nearest_interacting_player_to_object(obj)); @@ -12200,10 +18953,16 @@ int smlua_func_nearest_interacting_player_to_object(lua_State* L) { } int smlua_func_nearest_mario_state_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "nearest_mario_state_to_object", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'nearest_mario_state_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_mario_state_to_object"); return 0; } extern struct MarioState* nearest_mario_state_to_object(struct Object *obj); smlua_push_object(L, LOT_MARIOSTATE, nearest_mario_state_to_object(obj)); @@ -12212,10 +18971,16 @@ int smlua_func_nearest_mario_state_to_object(lua_State* L) { } int smlua_func_nearest_player_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "nearest_player_to_object", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'nearest_player_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_player_to_object"); return 0; } extern struct Object* nearest_player_to_object(struct Object *obj); smlua_push_object(L, LOT_OBJECT, nearest_player_to_object(obj)); @@ -12224,10 +18989,16 @@ int smlua_func_nearest_player_to_object(lua_State* L) { } int smlua_func_nearest_possible_mario_state_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "nearest_possible_mario_state_to_object", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'nearest_possible_mario_state_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_possible_mario_state_to_object"); return 0; } extern struct MarioState* nearest_possible_mario_state_to_object(struct Object *obj); smlua_push_object(L, LOT_MARIOSTATE, nearest_possible_mario_state_to_object(obj)); @@ -12236,12 +19007,18 @@ int smlua_func_nearest_possible_mario_state_to_object(lua_State* L) { } int smlua_func_obj_check_floor_death(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_check_floor_death", 2, top); + return 0; + } s16 collisionFlags = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_check_floor_death'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_check_floor_death"); return 0; } struct Surface* floor = (struct Surface*)smlua_to_cobject(L, 2, LOT_SURFACE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_check_floor_death'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_check_floor_death"); return 0; } extern void obj_check_floor_death(s16 collisionFlags, struct Surface *floor); obj_check_floor_death(collisionFlags, floor); @@ -12250,14 +19027,20 @@ int smlua_func_obj_check_floor_death(lua_State* L) { } int smlua_func_obj_check_if_facing_toward_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_check_if_facing_toward_angle", 3, top); + return 0; + } u32 base = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_check_if_facing_toward_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_check_if_facing_toward_angle"); return 0; } u32 goal = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_check_if_facing_toward_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_check_if_facing_toward_angle"); return 0; } s16 range = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_check_if_facing_toward_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_check_if_facing_toward_angle"); return 0; } extern s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range); lua_pushinteger(L, obj_check_if_facing_toward_angle(base, goal, range)); @@ -12266,18 +19049,24 @@ int smlua_func_obj_check_if_facing_toward_angle(lua_State* L) { } int smlua_func_obj_find_wall(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_find_wall", 5, top); + return 0; + } f32 objNewX = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_find_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_find_wall"); return 0; } f32 objY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_find_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_find_wall"); return 0; } f32 objNewZ = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_find_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_find_wall"); return 0; } f32 objVelX = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_find_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_find_wall"); return 0; } f32 objVelZ = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_find_wall'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_find_wall"); return 0; } extern s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ); lua_pushinteger(L, obj_find_wall(objNewX, objY, objNewZ, objVelX, objVelZ)); @@ -12286,22 +19075,28 @@ int smlua_func_obj_find_wall(lua_State* L) { } int smlua_func_obj_find_wall_displacement(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_find_wall_displacement", 5, top); + return 0; + } f32* dist = smlua_get_vec3f_from_buffer(); dist[0] = smlua_get_number_field(1, "x"); dist[1] = smlua_get_number_field(1, "y"); dist[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_find_wall_displacement'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_find_wall_displacement"); return 0; } f32 x = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_find_wall_displacement'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_find_wall_displacement"); return 0; } f32 y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_find_wall_displacement'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_find_wall_displacement"); return 0; } f32 z = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_find_wall_displacement'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_find_wall_displacement"); return 0; } f32 radius = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_find_wall_displacement'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_find_wall_displacement"); return 0; } extern s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius); lua_pushinteger(L, obj_find_wall_displacement(dist, x, y, z, radius)); @@ -12314,12 +19109,18 @@ int smlua_func_obj_find_wall_displacement(lua_State* L) { } int smlua_func_obj_flicker_and_disappear(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_flicker_and_disappear", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_flicker_and_disappear'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_flicker_and_disappear"); return 0; } s16 lifeSpan = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_flicker_and_disappear'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_flicker_and_disappear"); return 0; } extern s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan); lua_pushinteger(L, obj_flicker_and_disappear(obj, lifeSpan)); @@ -12328,7 +19129,13 @@ int smlua_func_obj_flicker_and_disappear(lua_State* L) { } int smlua_func_obj_lava_death(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_lava_death", 0, top); + return 0; + } extern s8 obj_lava_death(void); @@ -12338,10 +19145,16 @@ int smlua_func_obj_lava_death(UNUSED lua_State* L) { } int smlua_func_obj_move_xyz_using_fvel_and_yaw(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_move_xyz_using_fvel_and_yaw", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_move_xyz_using_fvel_and_yaw'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_move_xyz_using_fvel_and_yaw"); return 0; } extern void obj_move_xyz_using_fvel_and_yaw(struct Object *obj); obj_move_xyz_using_fvel_and_yaw(obj); @@ -12350,16 +19163,22 @@ int smlua_func_obj_move_xyz_using_fvel_and_yaw(lua_State* L) { } int smlua_func_obj_orient_graph(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_orient_graph", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_orient_graph'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_orient_graph"); return 0; } f32 normalX = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_orient_graph'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_orient_graph"); return 0; } f32 normalY = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_orient_graph'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_orient_graph"); return 0; } f32 normalZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_orient_graph'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_orient_graph"); return 0; } extern void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ); obj_orient_graph(obj, normalX, normalY, normalZ); @@ -12368,18 +19187,24 @@ int smlua_func_obj_orient_graph(lua_State* L) { } int smlua_func_obj_return_and_displace_home(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_return_and_displace_home", 5, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_return_and_displace_home'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_return_and_displace_home"); return 0; } f32 homeX = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_return_and_displace_home'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_return_and_displace_home"); return 0; } f32 homeY = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_return_and_displace_home'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_return_and_displace_home"); return 0; } f32 homeZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_return_and_displace_home'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_return_and_displace_home"); return 0; } s32 baseDisp = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_return_and_displace_home'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_return_and_displace_home"); return 0; } extern void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp); obj_return_and_displace_home(obj, homeX, homeY, homeZ, baseDisp); @@ -12388,18 +19213,24 @@ int smlua_func_obj_return_and_displace_home(lua_State* L) { } int smlua_func_obj_return_home_if_safe(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_return_home_if_safe", 5, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_return_home_if_safe'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_return_home_if_safe"); return 0; } f32 homeX = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_return_home_if_safe'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_return_home_if_safe"); return 0; } f32 y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_return_home_if_safe'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_return_home_if_safe"); return 0; } f32 homeZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_return_home_if_safe'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_return_home_if_safe"); return 0; } s32 dist = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_return_home_if_safe'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_return_home_if_safe"); return 0; } extern s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist); lua_pushinteger(L, obj_return_home_if_safe(obj, homeX, y, homeZ, dist)); @@ -12408,12 +19239,18 @@ int smlua_func_obj_return_home_if_safe(lua_State* L) { } int smlua_func_obj_spawn_yellow_coins(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_spawn_yellow_coins", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_spawn_yellow_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_yellow_coins"); return 0; } s8 nCoins = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_spawn_yellow_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_yellow_coins"); return 0; } extern void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins); obj_spawn_yellow_coins(obj, nCoins); @@ -12422,12 +19259,18 @@ int smlua_func_obj_spawn_yellow_coins(lua_State* L) { } int smlua_func_obj_splash(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_splash", 2, top); + return 0; + } s32 waterY = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_splash'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_splash"); return 0; } s32 objY = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_splash'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_splash"); return 0; } extern void obj_splash(s32 waterY, s32 objY); obj_splash(waterY, objY); @@ -12436,7 +19279,13 @@ int smlua_func_obj_splash(lua_State* L) { } int smlua_func_obj_update_pos_vel_xz(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_update_pos_vel_xz", 0, top); + return 0; + } extern void obj_update_pos_vel_xz(void); @@ -12446,7 +19295,13 @@ int smlua_func_obj_update_pos_vel_xz(UNUSED lua_State* L) { } int smlua_func_object_step(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "object_step", 0, top); + return 0; + } extern s16 object_step(void); @@ -12456,7 +19311,13 @@ int smlua_func_object_step(UNUSED lua_State* L) { } int smlua_func_object_step_without_floor_orient(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "object_step_without_floor_orient", 0, top); + return 0; + } extern s16 object_step_without_floor_orient(void); @@ -12466,12 +19327,18 @@ int smlua_func_object_step_without_floor_orient(UNUSED lua_State* L) { } int smlua_func_set_object_visibility(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_object_visibility", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_object_visibility'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_object_visibility"); return 0; } s32 dist = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_object_visibility'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_object_visibility"); return 0; } extern void set_object_visibility(struct Object *obj, s32 dist); set_object_visibility(obj, dist); @@ -12480,7 +19347,13 @@ int smlua_func_set_object_visibility(lua_State* L) { } int smlua_func_set_yoshi_as_not_dead(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_yoshi_as_not_dead", 0, top); + return 0; + } extern void set_yoshi_as_not_dead(void); @@ -12490,16 +19363,22 @@ int smlua_func_set_yoshi_as_not_dead(UNUSED lua_State* L) { } int smlua_func_spawn_orange_number(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_orange_number", 4, top); + return 0; + } s8 behParam = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_orange_number'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_orange_number"); return 0; } s16 relX = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_orange_number'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_orange_number"); return 0; } s16 relY = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'spawn_orange_number'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_orange_number"); return 0; } s16 relZ = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'spawn_orange_number'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_orange_number"); return 0; } extern void spawn_orange_number(s8 behParam, s16 relX, s16 relY, s16 relZ); spawn_orange_number(behParam, relX, relY, relZ); @@ -12508,16 +19387,22 @@ int smlua_func_spawn_orange_number(lua_State* L) { } int smlua_func_turn_obj_away_from_steep_floor(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "turn_obj_away_from_steep_floor", 4, top); + return 0; + } struct Surface* objFloor = (struct Surface*)smlua_to_cobject(L, 1, LOT_SURFACE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'turn_obj_away_from_steep_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "turn_obj_away_from_steep_floor"); return 0; } f32 floorY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'turn_obj_away_from_steep_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "turn_obj_away_from_steep_floor"); return 0; } f32 objVelX = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'turn_obj_away_from_steep_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "turn_obj_away_from_steep_floor"); return 0; } f32 objVelZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'turn_obj_away_from_steep_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "turn_obj_away_from_steep_floor"); return 0; } extern s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ); lua_pushinteger(L, turn_obj_away_from_steep_floor(objFloor, floorY, objVelX, objVelZ)); @@ -12526,22 +19411,28 @@ int smlua_func_turn_obj_away_from_steep_floor(lua_State* L) { } int smlua_func_turn_obj_away_from_surface(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 7)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 7) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "turn_obj_away_from_surface", 7, top); + return 0; + } f32 velX = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'turn_obj_away_from_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "turn_obj_away_from_surface"); return 0; } f32 velZ = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'turn_obj_away_from_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "turn_obj_away_from_surface"); return 0; } f32 nX = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'turn_obj_away_from_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "turn_obj_away_from_surface"); return 0; } f32 nY = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'turn_obj_away_from_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "turn_obj_away_from_surface"); return 0; } f32 nZ = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'turn_obj_away_from_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "turn_obj_away_from_surface"); return 0; } f32 * objYawX = (f32 *)smlua_to_cpointer(L, 6, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'turn_obj_away_from_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "turn_obj_away_from_surface"); return 0; } f32 * objYawZ = (f32 *)smlua_to_cpointer(L, 7, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'turn_obj_away_from_surface'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "turn_obj_away_from_surface"); return 0; } extern void turn_obj_away_from_surface(f32 velX, f32 velZ, f32 nX, UNUSED f32 nY, f32 nZ, f32 *objYawX, f32 *objYawZ); turn_obj_away_from_surface(velX, velZ, nX, nY, nZ, objYawX, objYawZ); @@ -12554,14 +19445,20 @@ int smlua_func_turn_obj_away_from_surface(lua_State* L) { /////////////////////// int smlua_func_approach_f32_ptr(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_f32_ptr", 3, top); + return 0; + } f32 * px = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_f32_ptr'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_f32_ptr"); return 0; } f32 target = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_f32_ptr'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_f32_ptr"); return 0; } f32 delta = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_f32_ptr'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_f32_ptr"); return 0; } extern s32 approach_f32_ptr(f32 *px, f32 target, f32 delta); lua_pushinteger(L, approach_f32_ptr(px, target, delta)); @@ -12570,10 +19467,16 @@ int smlua_func_approach_f32_ptr(lua_State* L) { } int smlua_func_cur_obj_init_anim_and_check_if_end(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_init_anim_and_check_if_end", 1, top); + return 0; + } s32 arg0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_init_anim_and_check_if_end'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_anim_and_check_if_end"); return 0; } extern s32 cur_obj_init_anim_and_check_if_end(s32 arg0); lua_pushinteger(L, cur_obj_init_anim_and_check_if_end(arg0)); @@ -12582,12 +19485,18 @@ int smlua_func_cur_obj_init_anim_and_check_if_end(lua_State* L) { } int smlua_func_cur_obj_init_anim_check_frame(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_init_anim_check_frame", 2, top); + return 0; + } s32 arg0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_init_anim_check_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_anim_check_frame"); return 0; } s32 arg1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_init_anim_check_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_init_anim_check_frame"); return 0; } extern s32 cur_obj_init_anim_check_frame(s32 arg0, s32 arg1); lua_pushinteger(L, cur_obj_init_anim_check_frame(arg0, arg1)); @@ -12596,10 +19505,16 @@ int smlua_func_cur_obj_init_anim_check_frame(lua_State* L) { } int smlua_func_cur_obj_init_anim_extend(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_init_anim_extend", 1, top); + return 0; + } s32 arg0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_init_anim_extend'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_anim_extend"); return 0; } extern void cur_obj_init_anim_extend(s32 arg0); cur_obj_init_anim_extend(arg0); @@ -12608,14 +19523,20 @@ int smlua_func_cur_obj_init_anim_extend(lua_State* L) { } int smlua_func_cur_obj_play_sound_at_anim_range(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_play_sound_at_anim_range", 3, top); + return 0; + } s8 arg0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_play_sound_at_anim_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_play_sound_at_anim_range"); return 0; } s8 arg1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_play_sound_at_anim_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_play_sound_at_anim_range"); return 0; } u32 sound = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_play_sound_at_anim_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_play_sound_at_anim_range"); return 0; } extern s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound); lua_pushinteger(L, cur_obj_play_sound_at_anim_range(arg0, arg1, sound)); @@ -12624,10 +19545,16 @@ int smlua_func_cur_obj_play_sound_at_anim_range(lua_State* L) { } int smlua_func_cur_obj_set_anim_if_at_end(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_anim_if_at_end", 1, top); + return 0; + } s32 arg0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_anim_if_at_end'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_anim_if_at_end"); return 0; } extern s32 cur_obj_set_anim_if_at_end(s32 arg0); lua_pushinteger(L, cur_obj_set_anim_if_at_end(arg0)); @@ -12636,12 +19563,18 @@ int smlua_func_cur_obj_set_anim_if_at_end(lua_State* L) { } int smlua_func_cur_obj_spin_all_dimensions(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_spin_all_dimensions", 2, top); + return 0; + } f32 arg0 = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_spin_all_dimensions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_spin_all_dimensions"); return 0; } f32 arg1 = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_spin_all_dimensions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_spin_all_dimensions"); return 0; } extern void cur_obj_spin_all_dimensions(f32 arg0, f32 arg1); cur_obj_spin_all_dimensions(arg0, arg1); @@ -12650,10 +19583,16 @@ int smlua_func_cur_obj_spin_all_dimensions(lua_State* L) { } int smlua_func_obj_act_knockback(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_act_knockback", 1, top); + return 0; + } f32 baseScale = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_act_knockback'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_act_knockback"); return 0; } extern void obj_act_knockback(UNUSED f32 baseScale); obj_act_knockback(baseScale); @@ -12662,10 +19601,16 @@ int smlua_func_obj_act_knockback(lua_State* L) { } int smlua_func_obj_act_squished(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_act_squished", 1, top); + return 0; + } f32 baseScale = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_act_squished'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_act_squished"); return 0; } extern void obj_act_squished(f32 baseScale); obj_act_squished(baseScale); @@ -12674,10 +19619,16 @@ int smlua_func_obj_act_squished(lua_State* L) { } int smlua_func_obj_bounce_off_walls_edges_objects(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_bounce_off_walls_edges_objects", 1, top); + return 0; + } s32 * targetYaw = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_bounce_off_walls_edges_objects'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_bounce_off_walls_edges_objects"); return 0; } extern s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw); lua_pushinteger(L, obj_bounce_off_walls_edges_objects(targetYaw)); @@ -12686,12 +19637,18 @@ int smlua_func_obj_bounce_off_walls_edges_objects(lua_State* L) { } int smlua_func_obj_check_attacks(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_check_attacks", 2, top); + return 0; + } struct ObjectHitbox* hitbox = (struct ObjectHitbox*)smlua_to_cobject(L, 1, LOT_OBJECTHITBOX); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_check_attacks'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_check_attacks"); return 0; } s32 attackedMarioAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_check_attacks'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_check_attacks"); return 0; } extern s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction); lua_pushinteger(L, obj_check_attacks(hitbox, attackedMarioAction)); @@ -12700,10 +19657,16 @@ int smlua_func_obj_check_attacks(lua_State* L) { } int smlua_func_obj_compute_vel_from_move_pitch(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_compute_vel_from_move_pitch", 1, top); + return 0; + } f32 speed = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_compute_vel_from_move_pitch'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_compute_vel_from_move_pitch"); return 0; } extern void obj_compute_vel_from_move_pitch(f32 speed); obj_compute_vel_from_move_pitch(speed); @@ -12712,7 +19675,13 @@ int smlua_func_obj_compute_vel_from_move_pitch(lua_State* L) { } int smlua_func_obj_die_if_above_lava_and_health_non_positive(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_die_if_above_lava_and_health_non_positive", 0, top); + return 0; + } extern s32 obj_die_if_above_lava_and_health_non_positive(void); @@ -12722,7 +19691,13 @@ int smlua_func_obj_die_if_above_lava_and_health_non_positive(UNUSED lua_State* L } int smlua_func_obj_die_if_health_non_positive(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_die_if_health_non_positive", 0, top); + return 0; + } extern void obj_die_if_health_non_positive(void); @@ -12732,12 +19707,18 @@ int smlua_func_obj_die_if_health_non_positive(UNUSED lua_State* L) { } int smlua_func_obj_face_pitch_approach(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_face_pitch_approach", 2, top); + return 0; + } s16 targetPitch = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_face_pitch_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_face_pitch_approach"); return 0; } s16 deltaPitch = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_face_pitch_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_face_pitch_approach"); return 0; } extern s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch); lua_pushinteger(L, obj_face_pitch_approach(targetPitch, deltaPitch)); @@ -12746,12 +19727,18 @@ int smlua_func_obj_face_pitch_approach(lua_State* L) { } int smlua_func_obj_face_roll_approach(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_face_roll_approach", 2, top); + return 0; + } s16 targetRoll = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_face_roll_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_face_roll_approach"); return 0; } s16 deltaRoll = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_face_roll_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_face_roll_approach"); return 0; } extern s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll); lua_pushinteger(L, obj_face_roll_approach(targetRoll, deltaRoll)); @@ -12760,12 +19747,18 @@ int smlua_func_obj_face_roll_approach(lua_State* L) { } int smlua_func_obj_face_yaw_approach(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_face_yaw_approach", 2, top); + return 0; + } s16 targetYaw = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_face_yaw_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_face_yaw_approach"); return 0; } s16 deltaYaw = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_face_yaw_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_face_yaw_approach"); return 0; } extern s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw); lua_pushinteger(L, obj_face_yaw_approach(targetYaw, deltaYaw)); @@ -12774,12 +19767,18 @@ int smlua_func_obj_face_yaw_approach(lua_State* L) { } int smlua_func_obj_forward_vel_approach(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_forward_vel_approach", 2, top); + return 0; + } f32 target = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_forward_vel_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_forward_vel_approach"); return 0; } f32 delta = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_forward_vel_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_forward_vel_approach"); return 0; } extern s32 obj_forward_vel_approach(f32 target, f32 delta); lua_pushinteger(L, obj_forward_vel_approach(target, delta)); @@ -12788,7 +19787,13 @@ int smlua_func_obj_forward_vel_approach(lua_State* L) { } int smlua_func_obj_get_pitch_from_vel(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_pitch_from_vel", 0, top); + return 0; + } extern s16 obj_get_pitch_from_vel(void); @@ -12798,10 +19803,16 @@ int smlua_func_obj_get_pitch_from_vel(UNUSED lua_State* L) { } int smlua_func_obj_get_pitch_to_home(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_pitch_to_home", 1, top); + return 0; + } f32 latDistToHome = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_pitch_to_home'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_pitch_to_home"); return 0; } extern s16 obj_get_pitch_to_home(f32 latDistToHome); lua_pushinteger(L, obj_get_pitch_to_home(latDistToHome)); @@ -12810,14 +19821,20 @@ int smlua_func_obj_get_pitch_to_home(lua_State* L) { } int smlua_func_obj_grow_then_shrink(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_grow_then_shrink", 3, top); + return 0; + } f32 * scaleVel = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_grow_then_shrink'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_grow_then_shrink"); return 0; } f32 shootFireScale = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_grow_then_shrink'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_grow_then_shrink"); return 0; } f32 endScale = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_grow_then_shrink'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_grow_then_shrink"); return 0; } extern s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale); lua_pushinteger(L, obj_grow_then_shrink(scaleVel, shootFireScale, endScale)); @@ -12826,14 +19843,20 @@ int smlua_func_obj_grow_then_shrink(lua_State* L) { } int smlua_func_obj_handle_attacks(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_handle_attacks", 3, top); + return 0; + } struct ObjectHitbox* hitbox = (struct ObjectHitbox*)smlua_to_cobject(L, 1, LOT_OBJECTHITBOX); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_handle_attacks'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_handle_attacks"); return 0; } s32 attackedMarioAction = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_handle_attacks'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_handle_attacks"); return 0; } u8 * attackHandlers = (u8 *)smlua_to_cpointer(L, 3, LVT_U8_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_handle_attacks'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_handle_attacks"); return 0; } extern s32 obj_handle_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction, u8 *attackHandlers); lua_pushinteger(L, obj_handle_attacks(hitbox, attackedMarioAction, attackHandlers)); @@ -12842,14 +19865,20 @@ int smlua_func_obj_handle_attacks(lua_State* L) { } int smlua_func_obj_is_near_to_and_facing_mario(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_near_to_and_facing_mario", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_near_to_and_facing_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_near_to_and_facing_mario"); return 0; } f32 maxDist = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_is_near_to_and_facing_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_is_near_to_and_facing_mario"); return 0; } s16 maxAngleDiff = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_is_near_to_and_facing_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_is_near_to_and_facing_mario"); return 0; } extern s32 obj_is_near_to_and_facing_mario(struct MarioState* m, f32 maxDist, s16 maxAngleDiff); lua_pushinteger(L, obj_is_near_to_and_facing_mario(m, maxDist, maxAngleDiff)); @@ -12858,7 +19887,13 @@ int smlua_func_obj_is_near_to_and_facing_mario(lua_State* L) { } int smlua_func_obj_is_rendering_enabled(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_rendering_enabled", 0, top); + return 0; + } extern s32 obj_is_rendering_enabled(void); @@ -12868,10 +19903,16 @@ int smlua_func_obj_is_rendering_enabled(UNUSED lua_State* L) { } int smlua_func_obj_move_for_one_second(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_move_for_one_second", 1, top); + return 0; + } s32 endAction = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_move_for_one_second'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_move_for_one_second"); return 0; } extern s32 obj_move_for_one_second(s32 endAction); lua_pushinteger(L, obj_move_for_one_second(endAction)); @@ -12880,12 +19921,18 @@ int smlua_func_obj_move_for_one_second(lua_State* L) { } int smlua_func_obj_move_pitch_approach(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_move_pitch_approach", 2, top); + return 0; + } s16 target = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_move_pitch_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_move_pitch_approach"); return 0; } s16 delta = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_move_pitch_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_move_pitch_approach"); return 0; } extern s32 obj_move_pitch_approach(s16 target, s16 delta); lua_pushinteger(L, obj_move_pitch_approach(target, delta)); @@ -12894,10 +19941,16 @@ int smlua_func_obj_move_pitch_approach(lua_State* L) { } int smlua_func_obj_random_fixed_turn(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_random_fixed_turn", 1, top); + return 0; + } s16 delta = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_random_fixed_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_random_fixed_turn"); return 0; } extern s16 obj_random_fixed_turn(s16 delta); lua_pushinteger(L, obj_random_fixed_turn(delta)); @@ -12906,12 +19959,18 @@ int smlua_func_obj_random_fixed_turn(lua_State* L) { } int smlua_func_obj_resolve_collisions_and_turn(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_resolve_collisions_and_turn", 2, top); + return 0; + } s16 targetYaw = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_resolve_collisions_and_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_resolve_collisions_and_turn"); return 0; } s16 turnSpeed = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_resolve_collisions_and_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_resolve_collisions_and_turn"); return 0; } extern s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed); lua_pushinteger(L, obj_resolve_collisions_and_turn(targetYaw, turnSpeed)); @@ -12920,10 +19979,16 @@ int smlua_func_obj_resolve_collisions_and_turn(lua_State* L) { } int smlua_func_obj_resolve_object_collisions(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_resolve_object_collisions", 1, top); + return 0; + } s32 * targetYaw = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_resolve_object_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_resolve_object_collisions"); return 0; } extern s32 obj_resolve_object_collisions(s32 *targetYaw); lua_pushinteger(L, obj_resolve_object_collisions(targetYaw)); @@ -12932,14 +19997,20 @@ int smlua_func_obj_resolve_object_collisions(lua_State* L) { } int smlua_func_obj_roll_to_match_yaw_turn(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_roll_to_match_yaw_turn", 3, top); + return 0; + } s16 targetYaw = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_roll_to_match_yaw_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_roll_to_match_yaw_turn"); return 0; } s16 maxRoll = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_roll_to_match_yaw_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_roll_to_match_yaw_turn"); return 0; } s16 rollSpeed = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_roll_to_match_yaw_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_roll_to_match_yaw_turn"); return 0; } extern void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed); obj_roll_to_match_yaw_turn(targetYaw, maxRoll, rollSpeed); @@ -12948,12 +20019,18 @@ int smlua_func_obj_roll_to_match_yaw_turn(lua_State* L) { } int smlua_func_obj_rotate_yaw_and_bounce_off_walls(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_rotate_yaw_and_bounce_off_walls", 2, top); + return 0; + } s16 targetYaw = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_rotate_yaw_and_bounce_off_walls'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_rotate_yaw_and_bounce_off_walls"); return 0; } s16 turnAmount = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_rotate_yaw_and_bounce_off_walls'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_rotate_yaw_and_bounce_off_walls"); return 0; } extern void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount); obj_rotate_yaw_and_bounce_off_walls(targetYaw, turnAmount); @@ -12962,10 +20039,16 @@ int smlua_func_obj_rotate_yaw_and_bounce_off_walls(lua_State* L) { } int smlua_func_obj_set_dist_from_home(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_dist_from_home", 1, top); + return 0; + } f32 distFromHome = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_dist_from_home'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_dist_from_home"); return 0; } extern void obj_set_dist_from_home(f32 distFromHome); obj_set_dist_from_home(distFromHome); @@ -12974,10 +20057,16 @@ int smlua_func_obj_set_dist_from_home(lua_State* L) { } int smlua_func_obj_set_knockback_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_knockback_action", 1, top); + return 0; + } s32 attackType = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_knockback_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_knockback_action"); return 0; } extern void obj_set_knockback_action(s32 attackType); obj_set_knockback_action(attackType); @@ -12986,7 +20075,13 @@ int smlua_func_obj_set_knockback_action(lua_State* L) { } int smlua_func_obj_set_squished_action(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_squished_action", 0, top); + return 0; + } extern void obj_set_squished_action(void); @@ -12996,22 +20091,28 @@ int smlua_func_obj_set_squished_action(UNUSED lua_State* L) { } int smlua_func_obj_smooth_turn(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 7)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 7) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_smooth_turn", 7, top); + return 0; + } s16 * angleVel = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_smooth_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_smooth_turn"); return 0; } s32 * angle = (s32 *)smlua_to_cpointer(L, 2, LVT_S32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_smooth_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_smooth_turn"); return 0; } s16 targetAngle = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_smooth_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_smooth_turn"); return 0; } f32 targetSpeedProportion = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_smooth_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_smooth_turn"); return 0; } s16 accel = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_smooth_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_smooth_turn"); return 0; } s16 minSpeed = smlua_to_integer(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'obj_smooth_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "obj_smooth_turn"); return 0; } s16 maxSpeed = smlua_to_integer(L, 7); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'obj_smooth_turn'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "obj_smooth_turn"); return 0; } extern s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion, s16 accel, s16 minSpeed, s16 maxSpeed); lua_pushinteger(L, obj_smooth_turn(angleVel, angle, targetAngle, targetSpeedProportion, accel, minSpeed, maxSpeed)); @@ -13020,24 +20121,30 @@ int smlua_func_obj_smooth_turn(lua_State* L) { } int smlua_func_obj_spit_fire(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 8)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 8) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_spit_fire", 8, top); + return 0; + } s16 relativePosX = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_spit_fire'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spit_fire"); return 0; } s16 relativePosY = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_spit_fire'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spit_fire"); return 0; } s16 relativePosZ = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_spit_fire'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spit_fire"); return 0; } f32 scale = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_spit_fire'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_spit_fire"); return 0; } s32 model = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_spit_fire'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_spit_fire"); return 0; } f32 startSpeed = smlua_to_number(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'obj_spit_fire'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "obj_spit_fire"); return 0; } f32 endSpeed = smlua_to_number(L, 7); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'obj_spit_fire'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "obj_spit_fire"); return 0; } s16 movePitch = smlua_to_integer(L, 8); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 8 for function 'obj_spit_fire'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 8, "obj_spit_fire"); return 0; } extern struct Object* obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, s32 model, f32 startSpeed, f32 endSpeed, s16 movePitch); smlua_push_object(L, LOT_OBJECT, obj_spit_fire(relativePosX, relativePosY, relativePosZ, scale, model, startSpeed, endSpeed, movePitch)); @@ -13046,14 +20153,20 @@ int smlua_func_obj_spit_fire(lua_State* L) { } int smlua_func_obj_turn_pitch_toward_mario(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_turn_pitch_toward_mario", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_turn_pitch_toward_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_turn_pitch_toward_mario"); return 0; } f32 targetOffsetY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_turn_pitch_toward_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_turn_pitch_toward_mario"); return 0; } s16 turnAmount = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_turn_pitch_toward_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_turn_pitch_toward_mario"); return 0; } extern s16 obj_turn_pitch_toward_mario(struct MarioState* m, f32 targetOffsetY, s16 turnAmount); lua_pushinteger(L, obj_turn_pitch_toward_mario(m, targetOffsetY, turnAmount)); @@ -13062,7 +20175,13 @@ int smlua_func_obj_turn_pitch_toward_mario(lua_State* L) { } int smlua_func_obj_unused_die(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_unused_die", 0, top); + return 0; + } extern void obj_unused_die(void); @@ -13072,16 +20191,22 @@ int smlua_func_obj_unused_die(UNUSED lua_State* L) { } int smlua_func_obj_update_blinking(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_update_blinking", 4, top); + return 0; + } s32 * blinkTimer = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_update_blinking'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_update_blinking"); return 0; } s16 baseCycleLength = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_update_blinking'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_update_blinking"); return 0; } s16 cycleLengthRange = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_update_blinking'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_update_blinking"); return 0; } s16 blinkLength = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_update_blinking'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_update_blinking"); return 0; } extern void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange, s16 blinkLength); obj_update_blinking(blinkTimer, baseCycleLength, cycleLengthRange, blinkLength); @@ -13090,10 +20215,16 @@ int smlua_func_obj_update_blinking(lua_State* L) { } int smlua_func_obj_update_standard_actions(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_update_standard_actions", 1, top); + return 0; + } f32 scale = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_update_standard_actions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_update_standard_actions"); return 0; } extern s32 obj_update_standard_actions(f32 scale); lua_pushinteger(L, obj_update_standard_actions(scale)); @@ -13102,12 +20233,18 @@ int smlua_func_obj_update_standard_actions(lua_State* L) { } int smlua_func_obj_y_vel_approach(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_y_vel_approach", 2, top); + return 0; + } f32 target = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_y_vel_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_y_vel_approach"); return 0; } f32 delta = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_y_vel_approach'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_y_vel_approach"); return 0; } extern s32 obj_y_vel_approach(f32 target, f32 delta); lua_pushinteger(L, obj_y_vel_approach(target, delta)); @@ -13116,20 +20253,26 @@ int smlua_func_obj_y_vel_approach(lua_State* L) { } int smlua_func_oscillate_toward(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "oscillate_toward", 6, top); + return 0; + } s32 * value = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'oscillate_toward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "oscillate_toward"); return 0; } f32 * vel = (f32 *)smlua_to_cpointer(L, 2, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'oscillate_toward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "oscillate_toward"); return 0; } s32 target = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'oscillate_toward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "oscillate_toward"); return 0; } f32 velCloseToZero = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'oscillate_toward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "oscillate_toward"); return 0; } f32 accel = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'oscillate_toward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "oscillate_toward"); return 0; } f32 slowdown = smlua_to_number(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'oscillate_toward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "oscillate_toward"); return 0; } extern s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel, f32 slowdown); lua_pushinteger(L, oscillate_toward(value, vel, target, velCloseToZero, accel, slowdown)); @@ -13138,16 +20281,22 @@ int smlua_func_oscillate_toward(lua_State* L) { } int smlua_func_platform_on_track_update_pos_or_spawn_ball(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "platform_on_track_update_pos_or_spawn_ball", 4, top); + return 0; + } s32 ballIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'platform_on_track_update_pos_or_spawn_ball'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "platform_on_track_update_pos_or_spawn_ball"); return 0; } f32 x = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'platform_on_track_update_pos_or_spawn_ball'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "platform_on_track_update_pos_or_spawn_ball"); return 0; } f32 y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'platform_on_track_update_pos_or_spawn_ball'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "platform_on_track_update_pos_or_spawn_ball"); return 0; } f32 z = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'platform_on_track_update_pos_or_spawn_ball'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "platform_on_track_update_pos_or_spawn_ball"); return 0; } extern void platform_on_track_update_pos_or_spawn_ball(s32 ballIndex, f32 x, f32 y, f32 z); platform_on_track_update_pos_or_spawn_ball(ballIndex, x, y, z); @@ -13156,12 +20305,18 @@ int smlua_func_platform_on_track_update_pos_or_spawn_ball(lua_State* L) { } int smlua_func_random_linear_offset(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "random_linear_offset", 2, top); + return 0; + } s16 base = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'random_linear_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "random_linear_offset"); return 0; } s16 range = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'random_linear_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "random_linear_offset"); return 0; } extern s16 random_linear_offset(s16 base, s16 range); lua_pushinteger(L, random_linear_offset(base, range)); @@ -13170,14 +20325,20 @@ int smlua_func_random_linear_offset(lua_State* L) { } int smlua_func_random_mod_offset(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "random_mod_offset", 3, top); + return 0; + } s16 base = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'random_mod_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "random_mod_offset"); return 0; } s16 step = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'random_mod_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "random_mod_offset"); return 0; } s16 mod = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'random_mod_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "random_mod_offset"); return 0; } extern s16 random_mod_offset(s16 base, s16 step, s16 mod); lua_pushinteger(L, random_mod_offset(base, step, mod)); @@ -13186,14 +20347,20 @@ int smlua_func_random_mod_offset(lua_State* L) { } int smlua_func_treat_far_home_as_mario(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "treat_far_home_as_mario", 3, top); + return 0; + } f32 threshold = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'treat_far_home_as_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "treat_far_home_as_mario"); return 0; } s32* distanceToPlayer = (s32*)smlua_to_cpointer(L, 2, LVT_S32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'treat_far_home_as_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "treat_far_home_as_mario"); return 0; } s32* angleToPlayer = (s32*)smlua_to_cpointer(L, 3, LVT_S32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'treat_far_home_as_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "treat_far_home_as_mario"); return 0; } extern void treat_far_home_as_mario(f32 threshold, s32* distanceToPlayer, s32* angleToPlayer); treat_far_home_as_mario(threshold, distanceToPlayer, angleToPlayer); @@ -13206,12 +20373,18 @@ int smlua_func_treat_far_home_as_mario(lua_State* L) { ////////////////////// int smlua_func_abs_angle_diff(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "abs_angle_diff", 2, top); + return 0; + } s16 x0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'abs_angle_diff'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "abs_angle_diff"); return 0; } s16 x1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'abs_angle_diff'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "abs_angle_diff"); return 0; } extern s16 abs_angle_diff(s16 x0, s16 x1); lua_pushinteger(L, abs_angle_diff(x0, x1)); @@ -13220,12 +20393,18 @@ int smlua_func_abs_angle_diff(lua_State* L) { } int smlua_func_apply_drag_to_value(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "apply_drag_to_value", 2, top); + return 0; + } f32 * value = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'apply_drag_to_value'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "apply_drag_to_value"); return 0; } f32 dragStrength = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'apply_drag_to_value'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "apply_drag_to_value"); return 0; } extern void apply_drag_to_value(f32 *value, f32 dragStrength); apply_drag_to_value(value, dragStrength); @@ -13234,14 +20413,20 @@ int smlua_func_apply_drag_to_value(lua_State* L) { } int smlua_func_approach_f32_signed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_f32_signed", 3, top); + return 0; + } f32 * value = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_f32_signed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_f32_signed"); return 0; } f32 target = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_f32_signed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_f32_signed"); return 0; } f32 increment = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_f32_signed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_f32_signed"); return 0; } extern s32 approach_f32_signed(f32 *value, f32 target, f32 increment); lua_pushinteger(L, approach_f32_signed(value, target, increment)); @@ -13250,14 +20435,20 @@ int smlua_func_approach_f32_signed(lua_State* L) { } int smlua_func_approach_f32_symmetric(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_f32_symmetric", 3, top); + return 0; + } f32 value = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_f32_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_f32_symmetric"); return 0; } f32 target = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_f32_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_f32_symmetric"); return 0; } f32 increment = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_f32_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_f32_symmetric"); return 0; } extern f32 approach_f32_symmetric(f32 value, f32 target, f32 increment); lua_pushnumber(L, approach_f32_symmetric(value, target, increment)); @@ -13266,14 +20457,20 @@ int smlua_func_approach_f32_symmetric(lua_State* L) { } int smlua_func_approach_s16_symmetric(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "approach_s16_symmetric", 3, top); + return 0; + } s16 value = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'approach_s16_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "approach_s16_symmetric"); return 0; } s16 target = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'approach_s16_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "approach_s16_symmetric"); return 0; } s16 increment = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'approach_s16_symmetric'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "approach_s16_symmetric"); return 0; } extern s16 approach_s16_symmetric(s16 value, s16 target, s16 increment); lua_pushinteger(L, approach_s16_symmetric(value, target, increment)); @@ -13282,7 +20479,13 @@ int smlua_func_approach_s16_symmetric(lua_State* L) { } int smlua_func_bhv_dust_smoke_loop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_dust_smoke_loop", 0, top); + return 0; + } extern void bhv_dust_smoke_loop(void); @@ -13292,7 +20495,13 @@ int smlua_func_bhv_dust_smoke_loop(UNUSED lua_State* L) { } int smlua_func_bhv_init_room(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_init_room", 0, top); + return 0; + } extern void bhv_init_room(void); @@ -13302,10 +20511,16 @@ int smlua_func_bhv_init_room(UNUSED lua_State* L) { } int smlua_func_bit_shift_left(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bit_shift_left", 1, top); + return 0; + } s32 a0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'bit_shift_left'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "bit_shift_left"); return 0; } extern s32 bit_shift_left(s32 a0); lua_pushinteger(L, bit_shift_left(a0)); @@ -13314,10 +20529,16 @@ int smlua_func_bit_shift_left(lua_State* L) { } int smlua_func_chain_segment_init(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "chain_segment_init", 1, top); + return 0; + } struct ChainSegment* segment = (struct ChainSegment*)smlua_to_cobject(L, 1, LOT_CHAINSEGMENT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'chain_segment_init'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "chain_segment_init"); return 0; } extern void chain_segment_init(struct ChainSegment *segment); chain_segment_init(segment); @@ -13326,12 +20547,18 @@ int smlua_func_chain_segment_init(lua_State* L) { } int smlua_func_clear_move_flag(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clear_move_flag", 2, top); + return 0; + } u32 * bitSet = (u32 *)smlua_to_cpointer(L, 1, LVT_U32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'clear_move_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "clear_move_flag"); return 0; } s32 flag = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'clear_move_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "clear_move_flag"); return 0; } extern s32 clear_move_flag(u32 *bitSet, s32 flag); lua_pushinteger(L, clear_move_flag(bitSet, flag)); @@ -13340,10 +20567,16 @@ int smlua_func_clear_move_flag(lua_State* L) { } int smlua_func_clear_time_stop_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clear_time_stop_flags", 1, top); + return 0; + } s32 flags = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'clear_time_stop_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "clear_time_stop_flags"); return 0; } extern void clear_time_stop_flags(s32 flags); clear_time_stop_flags(flags); @@ -13352,10 +20585,16 @@ int smlua_func_clear_time_stop_flags(lua_State* L) { } int smlua_func_count_objects_with_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "count_objects_with_behavior", 1, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'count_objects_with_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "count_objects_with_behavior"); return 0; } extern s32 count_objects_with_behavior(const BehaviorScript *behavior); lua_pushinteger(L, count_objects_with_behavior(behavior)); @@ -13364,7 +20603,13 @@ int smlua_func_count_objects_with_behavior(lua_State* L) { } int smlua_func_count_unimportant_objects(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "count_unimportant_objects", 0, top); + return 0; + } extern s32 count_unimportant_objects(void); @@ -13373,26 +20618,138 @@ int smlua_func_count_unimportant_objects(UNUSED lua_State* L) { return 1; } -/* int smlua_func_create_transformation_from_matrices(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 a0 = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'create_transformation_from_matrices'"); return 0; } -// Mat4 a1 = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'create_transformation_from_matrices'"); return 0; } -// Mat4 a2 = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'create_transformation_from_matrices'"); return 0; } + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "create_transformation_from_matrices", 3, top); + return 0; + } + + + Mat4 a0; + a0[0][0] = smlua_get_number_field(1, "a"); + a0[0][1] = smlua_get_number_field(1, "b"); + a0[0][2] = smlua_get_number_field(1, "c"); + a0[0][3] = smlua_get_number_field(1, "d"); + a0[1][0] = smlua_get_number_field(1, "e"); + a0[1][1] = smlua_get_number_field(1, "f"); + a0[1][2] = smlua_get_number_field(1, "g"); + a0[1][3] = smlua_get_number_field(1, "h"); + a0[2][0] = smlua_get_number_field(1, "i"); + a0[2][1] = smlua_get_number_field(1, "j"); + a0[2][2] = smlua_get_number_field(1, "k"); + a0[2][3] = smlua_get_number_field(1, "l"); + a0[3][0] = smlua_get_number_field(1, "m"); + a0[3][1] = smlua_get_number_field(1, "n"); + a0[3][2] = smlua_get_number_field(1, "o"); + a0[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "create_transformation_from_matrices"); return 0; } + + Mat4 a1; + a1[0][0] = smlua_get_number_field(2, "a"); + a1[0][1] = smlua_get_number_field(2, "b"); + a1[0][2] = smlua_get_number_field(2, "c"); + a1[0][3] = smlua_get_number_field(2, "d"); + a1[1][0] = smlua_get_number_field(2, "e"); + a1[1][1] = smlua_get_number_field(2, "f"); + a1[1][2] = smlua_get_number_field(2, "g"); + a1[1][3] = smlua_get_number_field(2, "h"); + a1[2][0] = smlua_get_number_field(2, "i"); + a1[2][1] = smlua_get_number_field(2, "j"); + a1[2][2] = smlua_get_number_field(2, "k"); + a1[2][3] = smlua_get_number_field(2, "l"); + a1[3][0] = smlua_get_number_field(2, "m"); + a1[3][1] = smlua_get_number_field(2, "n"); + a1[3][2] = smlua_get_number_field(2, "o"); + a1[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "create_transformation_from_matrices"); return 0; } + + Mat4 a2; + a2[0][0] = smlua_get_number_field(3, "a"); + a2[0][1] = smlua_get_number_field(3, "b"); + a2[0][2] = smlua_get_number_field(3, "c"); + a2[0][3] = smlua_get_number_field(3, "d"); + a2[1][0] = smlua_get_number_field(3, "e"); + a2[1][1] = smlua_get_number_field(3, "f"); + a2[1][2] = smlua_get_number_field(3, "g"); + a2[1][3] = smlua_get_number_field(3, "h"); + a2[2][0] = smlua_get_number_field(3, "i"); + a2[2][1] = smlua_get_number_field(3, "j"); + a2[2][2] = smlua_get_number_field(3, "k"); + a2[2][3] = smlua_get_number_field(3, "l"); + a2[3][0] = smlua_get_number_field(3, "m"); + a2[3][1] = smlua_get_number_field(3, "n"); + a2[3][2] = smlua_get_number_field(3, "o"); + a2[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "create_transformation_from_matrices"); return 0; } extern void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2); create_transformation_from_matrices(a0, a1, a2); + smlua_push_number_field(1, "a", a0[0][0]); + smlua_push_number_field(1, "b", a0[0][1]); + smlua_push_number_field(1, "c", a0[0][2]); + smlua_push_number_field(1, "d", a0[0][3]); + smlua_push_number_field(1, "e", a0[1][0]); + smlua_push_number_field(1, "f", a0[1][1]); + smlua_push_number_field(1, "g", a0[1][2]); + smlua_push_number_field(1, "h", a0[1][3]); + smlua_push_number_field(1, "i", a0[2][0]); + smlua_push_number_field(1, "j", a0[2][1]); + smlua_push_number_field(1, "k", a0[2][2]); + smlua_push_number_field(1, "l", a0[2][3]); + smlua_push_number_field(1, "m", a0[3][0]); + smlua_push_number_field(1, "n", a0[3][1]); + smlua_push_number_field(1, "o", a0[3][2]); + smlua_push_number_field(1, "p", a0[3][3]); + + smlua_push_number_field(2, "a", a1[0][0]); + smlua_push_number_field(2, "b", a1[0][1]); + smlua_push_number_field(2, "c", a1[0][2]); + smlua_push_number_field(2, "d", a1[0][3]); + smlua_push_number_field(2, "e", a1[1][0]); + smlua_push_number_field(2, "f", a1[1][1]); + smlua_push_number_field(2, "g", a1[1][2]); + smlua_push_number_field(2, "h", a1[1][3]); + smlua_push_number_field(2, "i", a1[2][0]); + smlua_push_number_field(2, "j", a1[2][1]); + smlua_push_number_field(2, "k", a1[2][2]); + smlua_push_number_field(2, "l", a1[2][3]); + smlua_push_number_field(2, "m", a1[3][0]); + smlua_push_number_field(2, "n", a1[3][1]); + smlua_push_number_field(2, "o", a1[3][2]); + smlua_push_number_field(2, "p", a1[3][3]); + + smlua_push_number_field(3, "a", a2[0][0]); + smlua_push_number_field(3, "b", a2[0][1]); + smlua_push_number_field(3, "c", a2[0][2]); + smlua_push_number_field(3, "d", a2[0][3]); + smlua_push_number_field(3, "e", a2[1][0]); + smlua_push_number_field(3, "f", a2[1][1]); + smlua_push_number_field(3, "g", a2[1][2]); + smlua_push_number_field(3, "h", a2[1][3]); + smlua_push_number_field(3, "i", a2[2][0]); + smlua_push_number_field(3, "j", a2[2][1]); + smlua_push_number_field(3, "k", a2[2][2]); + smlua_push_number_field(3, "l", a2[2][3]); + smlua_push_number_field(3, "m", a2[3][0]); + smlua_push_number_field(3, "n", a2[3][1]); + smlua_push_number_field(3, "o", a2[3][2]); + smlua_push_number_field(3, "p", a2[3][3]); + return 1; } -*/ int smlua_func_cur_obj_abs_y_dist_to_home(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_abs_y_dist_to_home", 0, top); + return 0; + } extern f32 cur_obj_abs_y_dist_to_home(void); @@ -13402,7 +20759,13 @@ int smlua_func_cur_obj_abs_y_dist_to_home(UNUSED lua_State* L) { } int smlua_func_cur_obj_advance_looping_anim(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_advance_looping_anim", 0, top); + return 0; + } extern s32 cur_obj_advance_looping_anim(void); @@ -13412,7 +20775,13 @@ int smlua_func_cur_obj_advance_looping_anim(UNUSED lua_State* L) { } int smlua_func_cur_obj_align_gfx_with_floor(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_align_gfx_with_floor", 0, top); + return 0; + } extern void cur_obj_align_gfx_with_floor(void); @@ -13422,7 +20791,13 @@ int smlua_func_cur_obj_align_gfx_with_floor(UNUSED lua_State* L) { } int smlua_func_cur_obj_angle_to_home(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_angle_to_home", 0, top); + return 0; + } extern s16 cur_obj_angle_to_home(void); @@ -13432,10 +20807,16 @@ int smlua_func_cur_obj_angle_to_home(UNUSED lua_State* L) { } int smlua_func_cur_obj_apply_drag_xz(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_apply_drag_xz", 1, top); + return 0; + } f32 dragStrength = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_apply_drag_xz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_apply_drag_xz"); return 0; } extern void cur_obj_apply_drag_xz(f32 dragStrength); cur_obj_apply_drag_xz(dragStrength); @@ -13444,7 +20825,13 @@ int smlua_func_cur_obj_apply_drag_xz(lua_State* L) { } int smlua_func_cur_obj_become_intangible(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_become_intangible", 0, top); + return 0; + } extern void cur_obj_become_intangible(void); @@ -13454,7 +20841,13 @@ int smlua_func_cur_obj_become_intangible(UNUSED lua_State* L) { } int smlua_func_cur_obj_become_tangible(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_become_tangible", 0, top); + return 0; + } extern void cur_obj_become_tangible(void); @@ -13464,16 +20857,22 @@ int smlua_func_cur_obj_become_tangible(UNUSED lua_State* L) { } int smlua_func_cur_obj_can_mario_activate_textbox(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_can_mario_activate_textbox", 4, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_can_mario_activate_textbox'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_can_mario_activate_textbox"); return 0; } f32 radius = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_can_mario_activate_textbox'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_can_mario_activate_textbox"); return 0; } f32 height = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_can_mario_activate_textbox'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_can_mario_activate_textbox"); return 0; } s32 unused = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'cur_obj_can_mario_activate_textbox'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "cur_obj_can_mario_activate_textbox"); return 0; } extern s32 cur_obj_can_mario_activate_textbox(struct MarioState* m, f32 radius, f32 height, UNUSED s32 unused); lua_pushinteger(L, cur_obj_can_mario_activate_textbox(m, radius, height, unused)); @@ -13482,14 +20881,20 @@ int smlua_func_cur_obj_can_mario_activate_textbox(lua_State* L) { } int smlua_func_cur_obj_can_mario_activate_textbox_2(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_can_mario_activate_textbox_2", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_can_mario_activate_textbox_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_can_mario_activate_textbox_2"); return 0; } f32 radius = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_can_mario_activate_textbox_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_can_mario_activate_textbox_2"); return 0; } f32 height = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_can_mario_activate_textbox_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_can_mario_activate_textbox_2"); return 0; } extern s32 cur_obj_can_mario_activate_textbox_2(struct MarioState* m, f32 radius, f32 height); lua_pushinteger(L, cur_obj_can_mario_activate_textbox_2(m, radius, height)); @@ -13498,10 +20903,16 @@ int smlua_func_cur_obj_can_mario_activate_textbox_2(lua_State* L) { } int smlua_func_cur_obj_change_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_change_action", 1, top); + return 0; + } s32 action = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_change_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_change_action"); return 0; } extern void cur_obj_change_action(s32 action); cur_obj_change_action(action); @@ -13510,10 +20921,16 @@ int smlua_func_cur_obj_change_action(lua_State* L) { } int smlua_func_cur_obj_check_anim_frame(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_check_anim_frame", 1, top); + return 0; + } s32 frame = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_check_anim_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_check_anim_frame"); return 0; } extern s32 cur_obj_check_anim_frame(s32 frame); lua_pushinteger(L, cur_obj_check_anim_frame(frame)); @@ -13522,12 +20939,18 @@ int smlua_func_cur_obj_check_anim_frame(lua_State* L) { } int smlua_func_cur_obj_check_anim_frame_in_range(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_check_anim_frame_in_range", 2, top); + return 0; + } s32 startFrame = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_check_anim_frame_in_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_check_anim_frame_in_range"); return 0; } s32 rangeLength = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_check_anim_frame_in_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_check_anim_frame_in_range"); return 0; } extern s32 cur_obj_check_anim_frame_in_range(s32 startFrame, s32 rangeLength); lua_pushinteger(L, cur_obj_check_anim_frame_in_range(startFrame, rangeLength)); @@ -13536,10 +20959,16 @@ int smlua_func_cur_obj_check_anim_frame_in_range(lua_State* L) { } int smlua_func_cur_obj_check_frame_prior_current_frame(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_check_frame_prior_current_frame", 1, top); + return 0; + } s16 * a0 = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_check_frame_prior_current_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_check_frame_prior_current_frame"); return 0; } extern s32 cur_obj_check_frame_prior_current_frame(s16 *a0); lua_pushinteger(L, cur_obj_check_frame_prior_current_frame(a0)); @@ -13548,7 +20977,13 @@ int smlua_func_cur_obj_check_frame_prior_current_frame(lua_State* L) { } int smlua_func_cur_obj_check_grabbed_mario(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_check_grabbed_mario", 0, top); + return 0; + } extern s32 cur_obj_check_grabbed_mario(void); @@ -13558,7 +20993,13 @@ int smlua_func_cur_obj_check_grabbed_mario(UNUSED lua_State* L) { } int smlua_func_cur_obj_check_if_at_animation_end(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_check_if_at_animation_end", 0, top); + return 0; + } extern s32 cur_obj_check_if_at_animation_end(void); @@ -13568,7 +21009,13 @@ int smlua_func_cur_obj_check_if_at_animation_end(UNUSED lua_State* L) { } int smlua_func_cur_obj_check_if_near_animation_end(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_check_if_near_animation_end", 0, top); + return 0; + } extern s32 cur_obj_check_if_near_animation_end(void); @@ -13578,7 +21025,13 @@ int smlua_func_cur_obj_check_if_near_animation_end(UNUSED lua_State* L) { } int smlua_func_cur_obj_check_interacted(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_check_interacted", 0, top); + return 0; + } extern s32 cur_obj_check_interacted(void); @@ -13588,10 +21041,16 @@ int smlua_func_cur_obj_check_interacted(UNUSED lua_State* L) { } int smlua_func_cur_obj_clear_interact_status_flag(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_clear_interact_status_flag", 1, top); + return 0; + } s32 flag = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_clear_interact_status_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_clear_interact_status_flag"); return 0; } extern s32 cur_obj_clear_interact_status_flag(s32 flag); lua_pushinteger(L, cur_obj_clear_interact_status_flag(flag)); @@ -13600,7 +21059,13 @@ int smlua_func_cur_obj_clear_interact_status_flag(lua_State* L) { } int smlua_func_cur_obj_compute_vel_xz(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_compute_vel_xz", 0, top); + return 0; + } extern void cur_obj_compute_vel_xz(void); @@ -13610,12 +21075,18 @@ int smlua_func_cur_obj_compute_vel_xz(UNUSED lua_State* L) { } int smlua_func_cur_obj_count_objects_with_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_count_objects_with_behavior", 2, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_count_objects_with_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_count_objects_with_behavior"); return 0; } f32 dist = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_count_objects_with_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_count_objects_with_behavior"); return 0; } extern u16 cur_obj_count_objects_with_behavior(const BehaviorScript* behavior, f32 dist); lua_pushinteger(L, cur_obj_count_objects_with_behavior(behavior, dist)); @@ -13624,10 +21095,16 @@ int smlua_func_cur_obj_count_objects_with_behavior(lua_State* L) { } int smlua_func_cur_obj_detect_steep_floor(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_detect_steep_floor", 1, top); + return 0; + } s16 steepAngleDegrees = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_detect_steep_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_detect_steep_floor"); return 0; } extern s32 cur_obj_detect_steep_floor(s16 steepAngleDegrees); lua_pushinteger(L, cur_obj_detect_steep_floor(steepAngleDegrees)); @@ -13636,7 +21113,13 @@ int smlua_func_cur_obj_detect_steep_floor(lua_State* L) { } int smlua_func_cur_obj_disable(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_disable", 0, top); + return 0; + } extern void cur_obj_disable(void); @@ -13646,7 +21129,13 @@ int smlua_func_cur_obj_disable(UNUSED lua_State* L) { } int smlua_func_cur_obj_disable_rendering(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_disable_rendering", 0, top); + return 0; + } extern void cur_obj_disable_rendering(void); @@ -13656,10 +21145,16 @@ int smlua_func_cur_obj_disable_rendering(UNUSED lua_State* L) { } int smlua_func_cur_obj_disable_rendering_and_become_intangible(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_disable_rendering_and_become_intangible", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_disable_rendering_and_become_intangible'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_disable_rendering_and_become_intangible"); return 0; } extern void cur_obj_disable_rendering_and_become_intangible(struct Object *obj); cur_obj_disable_rendering_and_become_intangible(obj); @@ -13668,10 +21163,16 @@ int smlua_func_cur_obj_disable_rendering_and_become_intangible(lua_State* L) { } int smlua_func_cur_obj_dist_to_nearest_object_with_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_dist_to_nearest_object_with_behavior", 1, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_dist_to_nearest_object_with_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_dist_to_nearest_object_with_behavior"); return 0; } extern f32 cur_obj_dist_to_nearest_object_with_behavior(const BehaviorScript *behavior); lua_pushnumber(L, cur_obj_dist_to_nearest_object_with_behavior(behavior)); @@ -13680,7 +21181,13 @@ int smlua_func_cur_obj_dist_to_nearest_object_with_behavior(lua_State* L) { } int smlua_func_cur_obj_enable_rendering(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_enable_rendering", 0, top); + return 0; + } extern void cur_obj_enable_rendering(void); @@ -13690,7 +21197,13 @@ int smlua_func_cur_obj_enable_rendering(UNUSED lua_State* L) { } int smlua_func_cur_obj_enable_rendering_2(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_enable_rendering_2", 0, top); + return 0; + } extern void cur_obj_enable_rendering_2(void); @@ -13700,10 +21213,16 @@ int smlua_func_cur_obj_enable_rendering_2(UNUSED lua_State* L) { } int smlua_func_cur_obj_enable_rendering_and_become_tangible(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_enable_rendering_and_become_tangible", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_enable_rendering_and_become_tangible'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_enable_rendering_and_become_tangible"); return 0; } extern void cur_obj_enable_rendering_and_become_tangible(struct Object *obj); cur_obj_enable_rendering_and_become_tangible(obj); @@ -13712,7 +21231,13 @@ int smlua_func_cur_obj_enable_rendering_and_become_tangible(lua_State* L) { } int smlua_func_cur_obj_enable_rendering_if_mario_in_room(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_enable_rendering_if_mario_in_room", 0, top); + return 0; + } extern void cur_obj_enable_rendering_if_mario_in_room(void); @@ -13722,14 +21247,20 @@ int smlua_func_cur_obj_enable_rendering_if_mario_in_room(UNUSED lua_State* L) { } int smlua_func_cur_obj_end_dialog(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_end_dialog", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_end_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_end_dialog"); return 0; } s32 dialogFlags = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_end_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_end_dialog"); return 0; } s32 dialogResult = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_end_dialog'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_end_dialog"); return 0; } extern void cur_obj_end_dialog(struct MarioState* m, s32 dialogFlags, s32 dialogResult); cur_obj_end_dialog(m, dialogFlags, dialogResult); @@ -13738,7 +21269,13 @@ int smlua_func_cur_obj_end_dialog(lua_State* L) { } int smlua_func_cur_obj_extend_animation_if_at_end(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_extend_animation_if_at_end", 0, top); + return 0; + } extern void cur_obj_extend_animation_if_at_end(void); @@ -13748,12 +21285,18 @@ int smlua_func_cur_obj_extend_animation_if_at_end(UNUSED lua_State* L) { } int smlua_func_cur_obj_find_nearby_held_actor(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_find_nearby_held_actor", 2, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_find_nearby_held_actor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_find_nearby_held_actor"); return 0; } f32 maxDist = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_find_nearby_held_actor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_find_nearby_held_actor"); return 0; } extern struct Object *cur_obj_find_nearby_held_actor(const BehaviorScript *behavior, f32 maxDist); smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearby_held_actor(behavior, maxDist)); @@ -13762,12 +21305,18 @@ int smlua_func_cur_obj_find_nearby_held_actor(lua_State* L) { } int smlua_func_cur_obj_find_nearest_object_with_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_find_nearest_object_with_behavior", 2, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_find_nearest_object_with_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_find_nearest_object_with_behavior"); return 0; } f32 * dist = (f32 *)smlua_to_cpointer(L, 2, LVT_F32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_find_nearest_object_with_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_find_nearest_object_with_behavior"); return 0; } extern struct Object *cur_obj_find_nearest_object_with_behavior(const BehaviorScript *behavior, f32 *dist); smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearest_object_with_behavior(behavior, dist)); @@ -13776,7 +21325,13 @@ int smlua_func_cur_obj_find_nearest_object_with_behavior(lua_State* L) { } int smlua_func_cur_obj_find_nearest_pole(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_find_nearest_pole", 0, top); + return 0; + } extern struct Object* cur_obj_find_nearest_pole(void); @@ -13786,10 +21341,16 @@ int smlua_func_cur_obj_find_nearest_pole(UNUSED lua_State* L) { } int smlua_func_cur_obj_follow_path(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_follow_path", 1, top); + return 0; + } s32 unusedArg = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_follow_path'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_follow_path"); return 0; } extern s32 cur_obj_follow_path(UNUSED s32 unusedArg); lua_pushinteger(L, cur_obj_follow_path(unusedArg)); @@ -13798,12 +21359,18 @@ int smlua_func_cur_obj_follow_path(lua_State* L) { } int smlua_func_cur_obj_forward_vel_approach_upward(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_forward_vel_approach_upward", 2, top); + return 0; + } f32 target = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_forward_vel_approach_upward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_forward_vel_approach_upward"); return 0; } f32 increment = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_forward_vel_approach_upward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_forward_vel_approach_upward"); return 0; } extern void cur_obj_forward_vel_approach_upward(f32 target, f32 increment); cur_obj_forward_vel_approach_upward(target, increment); @@ -13812,7 +21379,13 @@ int smlua_func_cur_obj_forward_vel_approach_upward(lua_State* L) { } int smlua_func_cur_obj_get_dropped(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_get_dropped", 0, top); + return 0; + } extern void cur_obj_get_dropped(void); @@ -13822,14 +21395,20 @@ int smlua_func_cur_obj_get_dropped(UNUSED lua_State* L) { } int smlua_func_cur_obj_get_thrown_or_placed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_get_thrown_or_placed", 3, top); + return 0; + } f32 forwardVel = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_get_thrown_or_placed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_get_thrown_or_placed"); return 0; } f32 velY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_get_thrown_or_placed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_get_thrown_or_placed"); return 0; } s32 thrownAction = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_get_thrown_or_placed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_get_thrown_or_placed"); return 0; } extern void cur_obj_get_thrown_or_placed(f32 forwardVel, f32 velY, s32 thrownAction); cur_obj_get_thrown_or_placed(forwardVel, velY, thrownAction); @@ -13838,10 +21417,16 @@ int smlua_func_cur_obj_get_thrown_or_placed(lua_State* L) { } int smlua_func_cur_obj_has_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_has_behavior", 1, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_has_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_has_behavior"); return 0; } extern s32 cur_obj_has_behavior(const BehaviorScript *behavior); lua_pushinteger(L, cur_obj_has_behavior(behavior)); @@ -13850,10 +21435,16 @@ int smlua_func_cur_obj_has_behavior(lua_State* L) { } int smlua_func_cur_obj_has_model(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_has_model", 1, top); + return 0; + } u16 modelID = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_has_model'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_has_model"); return 0; } extern s32 cur_obj_has_model(u16 modelID); lua_pushinteger(L, cur_obj_has_model(modelID)); @@ -13862,7 +21453,13 @@ int smlua_func_cur_obj_has_model(lua_State* L) { } int smlua_func_cur_obj_hide(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_hide", 0, top); + return 0; + } extern void cur_obj_hide(void); @@ -13872,10 +21469,16 @@ int smlua_func_cur_obj_hide(UNUSED lua_State* L) { } int smlua_func_cur_obj_hide_if_mario_far_away_y(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_hide_if_mario_far_away_y", 1, top); + return 0; + } f32 distY = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_hide_if_mario_far_away_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_hide_if_mario_far_away_y"); return 0; } extern s32 cur_obj_hide_if_mario_far_away_y(f32 distY); lua_pushinteger(L, cur_obj_hide_if_mario_far_away_y(distY)); @@ -13884,7 +21487,13 @@ int smlua_func_cur_obj_hide_if_mario_far_away_y(lua_State* L) { } int smlua_func_cur_obj_if_hit_wall_bounce_away(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_if_hit_wall_bounce_away", 0, top); + return 0; + } extern void cur_obj_if_hit_wall_bounce_away(void); @@ -13894,10 +21503,16 @@ int smlua_func_cur_obj_if_hit_wall_bounce_away(UNUSED lua_State* L) { } int smlua_func_cur_obj_init_animation(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_init_animation", 1, top); + return 0; + } s32 animIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_init_animation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_animation"); return 0; } extern void cur_obj_init_animation(s32 animIndex); cur_obj_init_animation(animIndex); @@ -13906,12 +21521,18 @@ int smlua_func_cur_obj_init_animation(lua_State* L) { } int smlua_func_cur_obj_init_animation_and_anim_frame(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_init_animation_and_anim_frame", 2, top); + return 0; + } s32 animIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_init_animation_and_anim_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_animation_and_anim_frame"); return 0; } s32 animFrame = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_init_animation_and_anim_frame'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_init_animation_and_anim_frame"); return 0; } extern void cur_obj_init_animation_and_anim_frame(s32 animIndex, s32 animFrame); cur_obj_init_animation_and_anim_frame(animIndex, animFrame); @@ -13920,10 +21541,16 @@ int smlua_func_cur_obj_init_animation_and_anim_frame(lua_State* L) { } int smlua_func_cur_obj_init_animation_and_check_if_near_end(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_init_animation_and_check_if_near_end", 1, top); + return 0; + } s32 animIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_init_animation_and_check_if_near_end'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_animation_and_check_if_near_end"); return 0; } extern s32 cur_obj_init_animation_and_check_if_near_end(s32 animIndex); lua_pushinteger(L, cur_obj_init_animation_and_check_if_near_end(animIndex)); @@ -13932,10 +21559,16 @@ int smlua_func_cur_obj_init_animation_and_check_if_near_end(lua_State* L) { } int smlua_func_cur_obj_init_animation_and_extend_if_at_end(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_init_animation_and_extend_if_at_end", 1, top); + return 0; + } s32 animIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_init_animation_and_extend_if_at_end'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_animation_and_extend_if_at_end"); return 0; } extern void cur_obj_init_animation_and_extend_if_at_end(s32 animIndex); cur_obj_init_animation_and_extend_if_at_end(animIndex); @@ -13944,12 +21577,18 @@ int smlua_func_cur_obj_init_animation_and_extend_if_at_end(lua_State* L) { } int smlua_func_cur_obj_init_animation_with_accel_and_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_init_animation_with_accel_and_sound", 2, top); + return 0; + } s32 animIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_init_animation_with_accel_and_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_animation_with_accel_and_sound"); return 0; } f32 accel = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_init_animation_with_accel_and_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_init_animation_with_accel_and_sound"); return 0; } extern void cur_obj_init_animation_with_accel_and_sound(s32 animIndex, f32 accel); cur_obj_init_animation_with_accel_and_sound(animIndex, accel); @@ -13958,10 +21597,16 @@ int smlua_func_cur_obj_init_animation_with_accel_and_sound(lua_State* L) { } int smlua_func_cur_obj_init_animation_with_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_init_animation_with_sound", 1, top); + return 0; + } s32 animIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_init_animation_with_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_init_animation_with_sound"); return 0; } extern void cur_obj_init_animation_with_sound(s32 animIndex); cur_obj_init_animation_with_sound(animIndex); @@ -13970,7 +21615,13 @@ int smlua_func_cur_obj_init_animation_with_sound(lua_State* L) { } int smlua_func_cur_obj_is_any_player_on_platform(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_is_any_player_on_platform", 0, top); + return 0; + } extern s32 cur_obj_is_any_player_on_platform(void); @@ -13980,7 +21631,13 @@ int smlua_func_cur_obj_is_any_player_on_platform(UNUSED lua_State* L) { } int smlua_func_cur_obj_is_mario_ground_pounding_platform(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_is_mario_ground_pounding_platform", 0, top); + return 0; + } extern s32 cur_obj_is_mario_ground_pounding_platform(void); @@ -13990,7 +21647,13 @@ int smlua_func_cur_obj_is_mario_ground_pounding_platform(UNUSED lua_State* L) { } int smlua_func_cur_obj_is_mario_on_platform(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_is_mario_on_platform", 0, top); + return 0; + } extern s32 cur_obj_is_mario_on_platform(void); @@ -14000,7 +21663,13 @@ int smlua_func_cur_obj_is_mario_on_platform(UNUSED lua_State* L) { } int smlua_func_cur_obj_lateral_dist_from_mario_to_home(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_lateral_dist_from_mario_to_home", 0, top); + return 0; + } extern f32 cur_obj_lateral_dist_from_mario_to_home(void); @@ -14010,10 +21679,16 @@ int smlua_func_cur_obj_lateral_dist_from_mario_to_home(UNUSED lua_State* L) { } int smlua_func_cur_obj_lateral_dist_from_obj_to_home(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_lateral_dist_from_obj_to_home", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_lateral_dist_from_obj_to_home'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_lateral_dist_from_obj_to_home"); return 0; } extern f32 cur_obj_lateral_dist_from_obj_to_home(struct Object *obj); lua_pushnumber(L, cur_obj_lateral_dist_from_obj_to_home(obj)); @@ -14022,7 +21697,13 @@ int smlua_func_cur_obj_lateral_dist_from_obj_to_home(lua_State* L) { } int smlua_func_cur_obj_lateral_dist_to_home(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_lateral_dist_to_home", 0, top); + return 0; + } extern f32 cur_obj_lateral_dist_to_home(void); @@ -14032,7 +21713,13 @@ int smlua_func_cur_obj_lateral_dist_to_home(UNUSED lua_State* L) { } int smlua_func_cur_obj_mario_far_away(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_mario_far_away", 0, top); + return 0; + } extern s32 cur_obj_mario_far_away(void); @@ -14042,12 +21729,18 @@ int smlua_func_cur_obj_mario_far_away(UNUSED lua_State* L) { } int smlua_func_cur_obj_move_after_thrown_or_dropped(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_after_thrown_or_dropped", 2, top); + return 0; + } f32 forwardVel = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_move_after_thrown_or_dropped'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_move_after_thrown_or_dropped"); return 0; } f32 velY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_move_after_thrown_or_dropped'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_move_after_thrown_or_dropped"); return 0; } extern void cur_obj_move_after_thrown_or_dropped(f32 forwardVel, f32 velY); cur_obj_move_after_thrown_or_dropped(forwardVel, velY); @@ -14056,10 +21749,16 @@ int smlua_func_cur_obj_move_after_thrown_or_dropped(lua_State* L) { } int smlua_func_cur_obj_move_standard(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_standard", 1, top); + return 0; + } s16 steepSlopeAngleDegrees = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_move_standard'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_move_standard"); return 0; } extern void cur_obj_move_standard(s16 steepSlopeAngleDegrees); cur_obj_move_standard(steepSlopeAngleDegrees); @@ -14068,10 +21767,16 @@ int smlua_func_cur_obj_move_standard(lua_State* L) { } int smlua_func_cur_obj_move_up_and_down(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_up_and_down", 1, top); + return 0; + } s32 a0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_move_up_and_down'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_move_up_and_down"); return 0; } extern s32 cur_obj_move_up_and_down(s32 a0); lua_pushinteger(L, cur_obj_move_up_and_down(a0)); @@ -14080,12 +21785,18 @@ int smlua_func_cur_obj_move_up_and_down(lua_State* L) { } int smlua_func_cur_obj_move_update_ground_air_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_update_ground_air_flags", 2, top); + return 0; + } f32 gravity = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_move_update_ground_air_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_move_update_ground_air_flags"); return 0; } f32 bounciness = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_move_update_ground_air_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_move_update_ground_air_flags"); return 0; } extern void cur_obj_move_update_ground_air_flags(UNUSED f32 gravity, f32 bounciness); cur_obj_move_update_ground_air_flags(gravity, bounciness); @@ -14094,7 +21805,13 @@ int smlua_func_cur_obj_move_update_ground_air_flags(lua_State* L) { } int smlua_func_cur_obj_move_update_underwater_flags(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_update_underwater_flags", 0, top); + return 0; + } extern void cur_obj_move_update_underwater_flags(void); @@ -14104,7 +21821,13 @@ int smlua_func_cur_obj_move_update_underwater_flags(UNUSED lua_State* L) { } int smlua_func_cur_obj_move_using_fvel_and_gravity(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_using_fvel_and_gravity", 0, top); + return 0; + } extern void cur_obj_move_using_fvel_and_gravity(void); @@ -14114,7 +21837,13 @@ int smlua_func_cur_obj_move_using_fvel_and_gravity(UNUSED lua_State* L) { } int smlua_func_cur_obj_move_using_vel(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_using_vel", 0, top); + return 0; + } extern void cur_obj_move_using_vel(void); @@ -14124,7 +21853,13 @@ int smlua_func_cur_obj_move_using_vel(UNUSED lua_State* L) { } int smlua_func_cur_obj_move_using_vel_and_gravity(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_using_vel_and_gravity", 0, top); + return 0; + } extern void cur_obj_move_using_vel_and_gravity(void); @@ -14134,12 +21869,18 @@ int smlua_func_cur_obj_move_using_vel_and_gravity(UNUSED lua_State* L) { } int smlua_func_cur_obj_move_xz(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_xz", 2, top); + return 0; + } f32 steepSlopeNormalY = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_move_xz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_move_xz"); return 0; } s32 careAboutEdgesAndSteepSlopes = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_move_xz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_move_xz"); return 0; } extern s32 cur_obj_move_xz(f32 steepSlopeNormalY, s32 careAboutEdgesAndSteepSlopes); lua_pushinteger(L, cur_obj_move_xz(steepSlopeNormalY, careAboutEdgesAndSteepSlopes)); @@ -14148,7 +21889,13 @@ int smlua_func_cur_obj_move_xz(lua_State* L) { } int smlua_func_cur_obj_move_xz_using_fvel_and_yaw(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_xz_using_fvel_and_yaw", 0, top); + return 0; + } extern void cur_obj_move_xz_using_fvel_and_yaw(void); @@ -14158,14 +21905,20 @@ int smlua_func_cur_obj_move_xz_using_fvel_and_yaw(UNUSED lua_State* L) { } int smlua_func_cur_obj_move_y(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_y", 3, top); + return 0; + } f32 gravity = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_move_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_move_y"); return 0; } f32 bounciness = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_move_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_move_y"); return 0; } f32 buoyancy = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_move_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_move_y"); return 0; } extern void cur_obj_move_y(f32 gravity, f32 bounciness, f32 buoyancy); cur_obj_move_y(gravity, bounciness, buoyancy); @@ -14174,12 +21927,18 @@ int smlua_func_cur_obj_move_y(lua_State* L) { } int smlua_func_cur_obj_move_y_and_get_water_level(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_y_and_get_water_level", 2, top); + return 0; + } f32 gravity = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_move_y_and_get_water_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_move_y_and_get_water_level"); return 0; } f32 buoyancy = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_move_y_and_get_water_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_move_y_and_get_water_level"); return 0; } extern f32 cur_obj_move_y_and_get_water_level(f32 gravity, f32 buoyancy); lua_pushnumber(L, cur_obj_move_y_and_get_water_level(gravity, buoyancy)); @@ -14188,7 +21947,13 @@ int smlua_func_cur_obj_move_y_and_get_water_level(lua_State* L) { } int smlua_func_cur_obj_move_y_with_terminal_vel(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_move_y_with_terminal_vel", 0, top); + return 0; + } extern void cur_obj_move_y_with_terminal_vel(void); @@ -14198,10 +21963,16 @@ int smlua_func_cur_obj_move_y_with_terminal_vel(UNUSED lua_State* L) { } int smlua_func_cur_obj_nearest_object_with_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_nearest_object_with_behavior", 1, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_nearest_object_with_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_nearest_object_with_behavior"); return 0; } extern struct Object *cur_obj_nearest_object_with_behavior(const BehaviorScript *behavior); smlua_push_object(L, LOT_OBJECT, cur_obj_nearest_object_with_behavior(behavior)); @@ -14210,16 +21981,22 @@ int smlua_func_cur_obj_nearest_object_with_behavior(lua_State* L) { } int smlua_func_cur_obj_outside_home_rectangle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_outside_home_rectangle", 4, top); + return 0; + } f32 minX = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_outside_home_rectangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_outside_home_rectangle"); return 0; } f32 maxX = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_outside_home_rectangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_outside_home_rectangle"); return 0; } f32 minZ = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_outside_home_rectangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_outside_home_rectangle"); return 0; } f32 maxZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'cur_obj_outside_home_rectangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "cur_obj_outside_home_rectangle"); return 0; } extern s32 cur_obj_outside_home_rectangle(f32 minX, f32 maxX, f32 minZ, f32 maxZ); lua_pushinteger(L, cur_obj_outside_home_rectangle(minX, maxX, minZ, maxZ)); @@ -14228,10 +22005,16 @@ int smlua_func_cur_obj_outside_home_rectangle(lua_State* L) { } int smlua_func_cur_obj_outside_home_square(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_outside_home_square", 1, top); + return 0; + } f32 halfLength = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_outside_home_square'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_outside_home_square"); return 0; } extern s32 cur_obj_outside_home_square(f32 halfLength); lua_pushinteger(L, cur_obj_outside_home_square(halfLength)); @@ -14240,7 +22023,13 @@ int smlua_func_cur_obj_outside_home_square(lua_State* L) { } int smlua_func_cur_obj_progress_direction_table(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_progress_direction_table", 0, top); + return 0; + } extern s32 cur_obj_progress_direction_table(void); @@ -14250,10 +22039,16 @@ int smlua_func_cur_obj_progress_direction_table(UNUSED lua_State* L) { } int smlua_func_cur_obj_push_mario_away(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_push_mario_away", 1, top); + return 0; + } f32 radius = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_push_mario_away'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_push_mario_away"); return 0; } extern void cur_obj_push_mario_away(f32 radius); cur_obj_push_mario_away(radius); @@ -14262,12 +22057,18 @@ int smlua_func_cur_obj_push_mario_away(lua_State* L) { } int smlua_func_cur_obj_push_mario_away_from_cylinder(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_push_mario_away_from_cylinder", 2, top); + return 0; + } f32 radius = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_push_mario_away_from_cylinder'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_push_mario_away_from_cylinder"); return 0; } f32 extentY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_push_mario_away_from_cylinder'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_push_mario_away_from_cylinder"); return 0; } extern void cur_obj_push_mario_away_from_cylinder(f32 radius, f32 extentY); cur_obj_push_mario_away_from_cylinder(radius, extentY); @@ -14276,7 +22077,13 @@ int smlua_func_cur_obj_push_mario_away_from_cylinder(lua_State* L) { } int smlua_func_cur_obj_reflect_move_angle_off_wall(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_reflect_move_angle_off_wall", 0, top); + return 0; + } extern s16 cur_obj_reflect_move_angle_off_wall(void); @@ -14286,7 +22093,13 @@ int smlua_func_cur_obj_reflect_move_angle_off_wall(UNUSED lua_State* L) { } int smlua_func_cur_obj_reset_timer_and_subaction(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_reset_timer_and_subaction", 0, top); + return 0; + } extern void cur_obj_reset_timer_and_subaction(void); @@ -14296,7 +22109,13 @@ int smlua_func_cur_obj_reset_timer_and_subaction(UNUSED lua_State* L) { } int smlua_func_cur_obj_resolve_wall_collisions(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_resolve_wall_collisions", 0, top); + return 0; + } extern s32 cur_obj_resolve_wall_collisions(void); @@ -14306,7 +22125,13 @@ int smlua_func_cur_obj_resolve_wall_collisions(UNUSED lua_State* L) { } int smlua_func_cur_obj_reverse_animation(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_reverse_animation", 0, top); + return 0; + } extern void cur_obj_reverse_animation(void); @@ -14316,7 +22141,13 @@ int smlua_func_cur_obj_reverse_animation(UNUSED lua_State* L) { } int smlua_func_cur_obj_rotate_face_angle_using_vel(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_rotate_face_angle_using_vel", 0, top); + return 0; + } extern void cur_obj_rotate_face_angle_using_vel(void); @@ -14326,7 +22157,13 @@ int smlua_func_cur_obj_rotate_face_angle_using_vel(UNUSED lua_State* L) { } int smlua_func_cur_obj_rotate_move_angle_using_vel(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_rotate_move_angle_using_vel", 0, top); + return 0; + } extern void cur_obj_rotate_move_angle_using_vel(void); @@ -14336,12 +22173,18 @@ int smlua_func_cur_obj_rotate_move_angle_using_vel(UNUSED lua_State* L) { } int smlua_func_cur_obj_rotate_yaw_toward(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_rotate_yaw_toward", 2, top); + return 0; + } s16 target = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_rotate_yaw_toward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_rotate_yaw_toward"); return 0; } s16 increment = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_rotate_yaw_toward'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_rotate_yaw_toward"); return 0; } extern s32 cur_obj_rotate_yaw_toward(s16 target, s16 increment); lua_pushinteger(L, cur_obj_rotate_yaw_toward(target, increment)); @@ -14350,10 +22193,16 @@ int smlua_func_cur_obj_rotate_yaw_toward(lua_State* L) { } int smlua_func_cur_obj_scale(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_scale", 1, top); + return 0; + } f32 scale = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_scale"); return 0; } extern void cur_obj_scale(f32 scale); cur_obj_scale(scale); @@ -14362,16 +22211,22 @@ int smlua_func_cur_obj_scale(lua_State* L) { } int smlua_func_cur_obj_scale_over_time(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_scale_over_time", 4, top); + return 0; + } s32 a0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_scale_over_time'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_scale_over_time"); return 0; } s32 a1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_scale_over_time'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_scale_over_time"); return 0; } f32 sp10 = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_scale_over_time'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_scale_over_time"); return 0; } f32 sp14 = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'cur_obj_scale_over_time'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "cur_obj_scale_over_time"); return 0; } extern void cur_obj_scale_over_time(s32 a0, s32 a1, f32 sp10, f32 sp14); cur_obj_scale_over_time(a0, a1, sp10, sp14); @@ -14380,10 +22235,16 @@ int smlua_func_cur_obj_scale_over_time(lua_State* L) { } int smlua_func_cur_obj_set_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_behavior", 1, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_behavior"); return 0; } extern void cur_obj_set_behavior(const BehaviorScript *behavior); cur_obj_set_behavior(behavior); @@ -14392,10 +22253,16 @@ int smlua_func_cur_obj_set_behavior(lua_State* L) { } int smlua_func_cur_obj_set_direction_table(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_direction_table", 1, top); + return 0; + } s8 * a0 = (s8 *)smlua_to_cpointer(L, 1, LVT_S8_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_direction_table'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_direction_table"); return 0; } extern s32 cur_obj_set_direction_table(s8 *a0); lua_pushinteger(L, cur_obj_set_direction_table(a0)); @@ -14404,7 +22271,13 @@ int smlua_func_cur_obj_set_direction_table(lua_State* L) { } int smlua_func_cur_obj_set_face_angle_to_move_angle(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_face_angle_to_move_angle", 0, top); + return 0; + } extern void cur_obj_set_face_angle_to_move_angle(void); @@ -14414,14 +22287,20 @@ int smlua_func_cur_obj_set_face_angle_to_move_angle(UNUSED lua_State* L) { } int smlua_func_cur_obj_set_hitbox_and_die_if_attacked(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_hitbox_and_die_if_attacked", 3, top); + return 0; + } struct ObjectHitbox* hitbox = (struct ObjectHitbox*)smlua_to_cobject(L, 1, LOT_OBJECTHITBOX); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_hitbox_and_die_if_attacked'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_hitbox_and_die_if_attacked"); return 0; } s32 deathSound = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_set_hitbox_and_die_if_attacked'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_set_hitbox_and_die_if_attacked"); return 0; } s32 noLootCoins = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_set_hitbox_and_die_if_attacked'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_set_hitbox_and_die_if_attacked"); return 0; } extern s32 cur_obj_set_hitbox_and_die_if_attacked(struct ObjectHitbox *hitbox, s32 deathSound, s32 noLootCoins); lua_pushinteger(L, cur_obj_set_hitbox_and_die_if_attacked(hitbox, deathSound, noLootCoins)); @@ -14430,12 +22309,18 @@ int smlua_func_cur_obj_set_hitbox_and_die_if_attacked(lua_State* L) { } int smlua_func_cur_obj_set_hitbox_radius_and_height(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_hitbox_radius_and_height", 2, top); + return 0; + } f32 radius = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_hitbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_hitbox_radius_and_height"); return 0; } f32 height = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_set_hitbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_set_hitbox_radius_and_height"); return 0; } extern void cur_obj_set_hitbox_radius_and_height(f32 radius, f32 height); cur_obj_set_hitbox_radius_and_height(radius, height); @@ -14444,7 +22329,13 @@ int smlua_func_cur_obj_set_hitbox_radius_and_height(lua_State* L) { } int smlua_func_cur_obj_set_home_once(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_home_once", 0, top); + return 0; + } extern void cur_obj_set_home_once(void); @@ -14454,12 +22345,18 @@ int smlua_func_cur_obj_set_home_once(UNUSED lua_State* L) { } int smlua_func_cur_obj_set_hurtbox_radius_and_height(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_hurtbox_radius_and_height", 2, top); + return 0; + } f32 radius = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_hurtbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_hurtbox_radius_and_height"); return 0; } f32 height = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_set_hurtbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_set_hurtbox_radius_and_height"); return 0; } extern void cur_obj_set_hurtbox_radius_and_height(f32 radius, f32 height); cur_obj_set_hurtbox_radius_and_height(radius, height); @@ -14468,16 +22365,22 @@ int smlua_func_cur_obj_set_hurtbox_radius_and_height(lua_State* L) { } int smlua_func_cur_obj_set_pos_relative(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_pos_relative", 4, top); + return 0; + } struct Object* other = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_pos_relative'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_pos_relative"); return 0; } f32 dleft = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_set_pos_relative'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_set_pos_relative"); return 0; } f32 dy = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_set_pos_relative'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_set_pos_relative"); return 0; } f32 dforward = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'cur_obj_set_pos_relative'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "cur_obj_set_pos_relative"); return 0; } extern void cur_obj_set_pos_relative(struct Object *other, f32 dleft, f32 dy, f32 dforward); cur_obj_set_pos_relative(other, dleft, dy, dforward); @@ -14486,14 +22389,20 @@ int smlua_func_cur_obj_set_pos_relative(lua_State* L) { } int smlua_func_cur_obj_set_pos_relative_to_parent(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_pos_relative_to_parent", 3, top); + return 0; + } f32 dleft = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_pos_relative_to_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_pos_relative_to_parent"); return 0; } f32 dy = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_set_pos_relative_to_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_set_pos_relative_to_parent"); return 0; } f32 dforward = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_set_pos_relative_to_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_set_pos_relative_to_parent"); return 0; } extern void cur_obj_set_pos_relative_to_parent(f32 dleft, f32 dy, f32 dforward); cur_obj_set_pos_relative_to_parent(dleft, dy, dforward); @@ -14502,7 +22411,13 @@ int smlua_func_cur_obj_set_pos_relative_to_parent(lua_State* L) { } int smlua_func_cur_obj_set_pos_to_home(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_pos_to_home", 0, top); + return 0; + } extern void cur_obj_set_pos_to_home(void); @@ -14512,7 +22427,13 @@ int smlua_func_cur_obj_set_pos_to_home(UNUSED lua_State* L) { } int smlua_func_cur_obj_set_pos_to_home_and_stop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_pos_to_home_and_stop", 0, top); + return 0; + } extern void cur_obj_set_pos_to_home_and_stop(void); @@ -14522,7 +22443,13 @@ int smlua_func_cur_obj_set_pos_to_home_and_stop(UNUSED lua_State* L) { } int smlua_func_cur_obj_set_pos_to_home_with_debug(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_pos_to_home_with_debug", 0, top); + return 0; + } extern void cur_obj_set_pos_to_home_with_debug(void); @@ -14532,7 +22459,13 @@ int smlua_func_cur_obj_set_pos_to_home_with_debug(UNUSED lua_State* L) { } int smlua_func_cur_obj_set_pos_via_transform(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_pos_via_transform", 0, top); + return 0; + } extern void cur_obj_set_pos_via_transform(void); @@ -14542,14 +22475,20 @@ int smlua_func_cur_obj_set_pos_via_transform(UNUSED lua_State* L) { } int smlua_func_cur_obj_set_vel_from_mario_vel(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_vel_from_mario_vel", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_vel_from_mario_vel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_vel_from_mario_vel"); return 0; } f32 f12 = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_set_vel_from_mario_vel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_set_vel_from_mario_vel"); return 0; } f32 f14 = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_set_vel_from_mario_vel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_set_vel_from_mario_vel"); return 0; } extern void cur_obj_set_vel_from_mario_vel(struct MarioState* m, f32 f12, f32 f14); cur_obj_set_vel_from_mario_vel(m, f12, f14); @@ -14558,12 +22497,18 @@ int smlua_func_cur_obj_set_vel_from_mario_vel(lua_State* L) { } int smlua_func_cur_obj_set_y_vel_and_animation(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_y_vel_and_animation", 2, top); + return 0; + } f32 sp18 = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_set_y_vel_and_animation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_set_y_vel_and_animation"); return 0; } s32 sp1C = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_set_y_vel_and_animation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_set_y_vel_and_animation"); return 0; } extern void cur_obj_set_y_vel_and_animation(f32 sp18, s32 sp1C); cur_obj_set_y_vel_and_animation(sp18, sp1C); @@ -14572,10 +22517,16 @@ int smlua_func_cur_obj_set_y_vel_and_animation(lua_State* L) { } int smlua_func_cur_obj_shake_screen(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_shake_screen", 1, top); + return 0; + } s32 shake = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_shake_screen'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_shake_screen"); return 0; } extern void cur_obj_shake_screen(s32 shake); cur_obj_shake_screen(shake); @@ -14584,10 +22535,16 @@ int smlua_func_cur_obj_shake_screen(lua_State* L) { } int smlua_func_cur_obj_shake_y(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_shake_y", 1, top); + return 0; + } f32 amount = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_shake_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_shake_y"); return 0; } extern void cur_obj_shake_y(f32 amount); cur_obj_shake_y(amount); @@ -14596,12 +22553,18 @@ int smlua_func_cur_obj_shake_y(lua_State* L) { } int smlua_func_cur_obj_shake_y_until(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_shake_y_until", 2, top); + return 0; + } s32 cycles = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_shake_y_until'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_shake_y_until"); return 0; } s32 amount = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_shake_y_until'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_shake_y_until"); return 0; } extern s32 cur_obj_shake_y_until(s32 cycles, s32 amount); lua_pushinteger(L, cur_obj_shake_y_until(cycles, amount)); @@ -14610,7 +22573,13 @@ int smlua_func_cur_obj_shake_y_until(lua_State* L) { } int smlua_func_cur_obj_spawn_loot_blue_coin(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_spawn_loot_blue_coin", 0, top); + return 0; + } extern void cur_obj_spawn_loot_blue_coin(void); @@ -14620,10 +22589,16 @@ int smlua_func_cur_obj_spawn_loot_blue_coin(UNUSED lua_State* L) { } int smlua_func_cur_obj_spawn_loot_coin_at_mario_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_spawn_loot_coin_at_mario_pos", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_spawn_loot_coin_at_mario_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_spawn_loot_coin_at_mario_pos"); return 0; } extern void cur_obj_spawn_loot_coin_at_mario_pos(struct MarioState* m); cur_obj_spawn_loot_coin_at_mario_pos(m); @@ -14632,10 +22607,16 @@ int smlua_func_cur_obj_spawn_loot_coin_at_mario_pos(lua_State* L) { } int smlua_func_cur_obj_spawn_particles(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_spawn_particles", 1, top); + return 0; + } struct SpawnParticlesInfo* info = (struct SpawnParticlesInfo*)smlua_to_cobject(L, 1, LOT_SPAWNPARTICLESINFO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_spawn_particles'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_spawn_particles"); return 0; } extern void cur_obj_spawn_particles(struct SpawnParticlesInfo *info); cur_obj_spawn_particles(info); @@ -14644,16 +22625,22 @@ int smlua_func_cur_obj_spawn_particles(lua_State* L) { } int smlua_func_cur_obj_spawn_star_at_y_offset(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_spawn_star_at_y_offset", 4, top); + return 0; + } f32 targetX = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_spawn_star_at_y_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_spawn_star_at_y_offset"); return 0; } f32 targetY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_spawn_star_at_y_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_spawn_star_at_y_offset"); return 0; } f32 targetZ = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_spawn_star_at_y_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_spawn_star_at_y_offset"); return 0; } f32 offsetY = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'cur_obj_spawn_star_at_y_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "cur_obj_spawn_star_at_y_offset"); return 0; } extern void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 offsetY); cur_obj_spawn_star_at_y_offset(targetX, targetY, targetZ, offsetY); @@ -14662,12 +22649,18 @@ int smlua_func_cur_obj_spawn_star_at_y_offset(lua_State* L) { } int smlua_func_cur_obj_start_cam_event(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_start_cam_event", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_start_cam_event'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_start_cam_event"); return 0; } s32 cameraEvent = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_start_cam_event'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_start_cam_event"); return 0; } extern void cur_obj_start_cam_event(UNUSED struct Object *obj, s32 cameraEvent); cur_obj_start_cam_event(obj, cameraEvent); @@ -14676,7 +22669,13 @@ int smlua_func_cur_obj_start_cam_event(lua_State* L) { } int smlua_func_cur_obj_unhide(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_unhide", 0, top); + return 0; + } extern void cur_obj_unhide(void); @@ -14686,12 +22685,18 @@ int smlua_func_cur_obj_unhide(UNUSED lua_State* L) { } int smlua_func_cur_obj_unrender_and_reset_state(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_unrender_and_reset_state", 2, top); + return 0; + } s32 sp18 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_unrender_and_reset_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_unrender_and_reset_state"); return 0; } s32 sp1C = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_unrender_and_reset_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_unrender_and_reset_state"); return 0; } extern void cur_obj_unrender_and_reset_state(s32 sp18, s32 sp1C); cur_obj_unrender_and_reset_state(sp18, sp1C); @@ -14700,7 +22705,13 @@ int smlua_func_cur_obj_unrender_and_reset_state(lua_State* L) { } int smlua_func_cur_obj_unused_init_on_floor(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_unused_init_on_floor", 0, top); + return 0; + } extern void cur_obj_unused_init_on_floor(void); @@ -14710,14 +22721,20 @@ int smlua_func_cur_obj_unused_init_on_floor(UNUSED lua_State* L) { } int smlua_func_cur_obj_unused_play_footstep_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_unused_play_footstep_sound", 3, top); + return 0; + } s32 animFrame1 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_unused_play_footstep_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_unused_play_footstep_sound"); return 0; } s32 animFrame2 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_unused_play_footstep_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_unused_play_footstep_sound"); return 0; } s32 sound = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'cur_obj_unused_play_footstep_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "cur_obj_unused_play_footstep_sound"); return 0; } extern void cur_obj_unused_play_footstep_sound(s32 animFrame1, s32 animFrame2, s32 sound); cur_obj_unused_play_footstep_sound(animFrame1, animFrame2, sound); @@ -14726,12 +22743,18 @@ int smlua_func_cur_obj_unused_play_footstep_sound(lua_State* L) { } int smlua_func_cur_obj_unused_resolve_wall_collisions(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_unused_resolve_wall_collisions", 2, top); + return 0; + } f32 offsetY = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_unused_resolve_wall_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_unused_resolve_wall_collisions"); return 0; } f32 radius = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_unused_resolve_wall_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_unused_resolve_wall_collisions"); return 0; } extern void cur_obj_unused_resolve_wall_collisions(f32 offsetY, f32 radius); cur_obj_unused_resolve_wall_collisions(offsetY, radius); @@ -14740,7 +22763,13 @@ int smlua_func_cur_obj_unused_resolve_wall_collisions(lua_State* L) { } int smlua_func_cur_obj_update_floor(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_update_floor", 0, top); + return 0; + } extern void cur_obj_update_floor(void); @@ -14750,10 +22779,16 @@ int smlua_func_cur_obj_update_floor(UNUSED lua_State* L) { } int smlua_func_cur_obj_update_floor_and_resolve_wall_collisions(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_update_floor_and_resolve_wall_collisions", 1, top); + return 0; + } s16 steepSlopeDegrees = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_update_floor_and_resolve_wall_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_update_floor_and_resolve_wall_collisions"); return 0; } extern void cur_obj_update_floor_and_resolve_wall_collisions(s16 steepSlopeDegrees); cur_obj_update_floor_and_resolve_wall_collisions(steepSlopeDegrees); @@ -14762,7 +22797,13 @@ int smlua_func_cur_obj_update_floor_and_resolve_wall_collisions(lua_State* L) { } int smlua_func_cur_obj_update_floor_and_walls(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_update_floor_and_walls", 0, top); + return 0; + } extern void cur_obj_update_floor_and_walls(void); @@ -14772,7 +22813,13 @@ int smlua_func_cur_obj_update_floor_and_walls(UNUSED lua_State* L) { } int smlua_func_cur_obj_update_floor_height(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_update_floor_height", 0, top); + return 0; + } extern void cur_obj_update_floor_height(void); @@ -14782,7 +22829,13 @@ int smlua_func_cur_obj_update_floor_height(UNUSED lua_State* L) { } int smlua_func_cur_obj_update_floor_height_and_get_floor(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_update_floor_height_and_get_floor", 0, top); + return 0; + } extern struct Surface *cur_obj_update_floor_height_and_get_floor(void); @@ -14792,12 +22845,18 @@ int smlua_func_cur_obj_update_floor_height_and_get_floor(UNUSED lua_State* L) { } int smlua_func_cur_obj_wait_then_blink(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_wait_then_blink", 2, top); + return 0; + } s32 timeUntilBlinking = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_wait_then_blink'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_wait_then_blink"); return 0; } s32 numBlinks = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'cur_obj_wait_then_blink'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_wait_then_blink"); return 0; } extern s32 cur_obj_wait_then_blink(s32 timeUntilBlinking, s32 numBlinks); lua_pushinteger(L, cur_obj_wait_then_blink(timeUntilBlinking, numBlinks)); @@ -14806,7 +22865,13 @@ int smlua_func_cur_obj_wait_then_blink(lua_State* L) { } int smlua_func_cur_obj_was_attacked_or_ground_pounded(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_was_attacked_or_ground_pounded", 0, top); + return 0; + } extern s32 cur_obj_was_attacked_or_ground_pounded(void); @@ -14816,7 +22881,13 @@ int smlua_func_cur_obj_was_attacked_or_ground_pounded(UNUSED lua_State* L) { } int smlua_func_cur_obj_within_12k_bounds(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_within_12k_bounds", 0, top); + return 0; + } extern s32 cur_obj_within_12k_bounds(void); @@ -14826,7 +22897,13 @@ int smlua_func_cur_obj_within_12k_bounds(UNUSED lua_State* L) { } int smlua_func_disable_time_stop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "disable_time_stop", 0, top); + return 0; + } extern void disable_time_stop(void); @@ -14836,7 +22913,13 @@ int smlua_func_disable_time_stop(UNUSED lua_State* L) { } int smlua_func_disable_time_stop_including_mario(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "disable_time_stop_including_mario", 0, top); + return 0; + } extern void disable_time_stop_including_mario(void); @@ -14846,16 +22929,22 @@ int smlua_func_disable_time_stop_including_mario(UNUSED lua_State* L) { } int smlua_func_dist_between_object_and_point(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "dist_between_object_and_point", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'dist_between_object_and_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "dist_between_object_and_point"); return 0; } f32 pointX = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'dist_between_object_and_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "dist_between_object_and_point"); return 0; } f32 pointY = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'dist_between_object_and_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "dist_between_object_and_point"); return 0; } f32 pointZ = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'dist_between_object_and_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "dist_between_object_and_point"); return 0; } extern f32 dist_between_object_and_point(struct Object *obj, f32 pointX, f32 pointY, f32 pointZ); lua_pushnumber(L, dist_between_object_and_point(obj, pointX, pointY, pointZ)); @@ -14864,12 +22953,18 @@ int smlua_func_dist_between_object_and_point(lua_State* L) { } int smlua_func_dist_between_objects(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "dist_between_objects", 2, top); + return 0; + } struct Object* obj1 = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'dist_between_objects'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "dist_between_objects"); return 0; } struct Object* obj2 = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'dist_between_objects'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "dist_between_objects"); return 0; } extern f32 dist_between_objects(struct Object *obj1, struct Object *obj2); lua_pushnumber(L, dist_between_objects(obj1, obj2)); @@ -14878,7 +22973,13 @@ int smlua_func_dist_between_objects(lua_State* L) { } int smlua_func_enable_time_stop(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "enable_time_stop", 0, top); + return 0; + } extern void enable_time_stop(void); @@ -14888,7 +22989,13 @@ int smlua_func_enable_time_stop(UNUSED lua_State* L) { } int smlua_func_enable_time_stop_if_alone(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "enable_time_stop_if_alone", 0, top); + return 0; + } extern void enable_time_stop_if_alone(void); @@ -14898,7 +23005,13 @@ int smlua_func_enable_time_stop_if_alone(UNUSED lua_State* L) { } int smlua_func_enable_time_stop_including_mario(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "enable_time_stop_including_mario", 0, top); + return 0; + } extern void enable_time_stop_including_mario(void); @@ -14908,10 +23021,16 @@ int smlua_func_enable_time_stop_including_mario(UNUSED lua_State* L) { } int smlua_func_find_object_with_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_object_with_behavior", 1, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_object_with_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_object_with_behavior"); return 0; } extern struct Object *find_object_with_behavior(const BehaviorScript *behavior); smlua_push_object(L, LOT_OBJECT, find_object_with_behavior(behavior)); @@ -14920,7 +23039,13 @@ int smlua_func_find_object_with_behavior(lua_State* L) { } int smlua_func_find_unimportant_object(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_unimportant_object", 0, top); + return 0; + } extern struct Object *find_unimportant_object(void); @@ -14931,31 +23056,77 @@ int smlua_func_find_unimportant_object(UNUSED lua_State* L) { /* int smlua_func_geo_choose_area_ext(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_choose_area_ext", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_choose_area_ext'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_choose_area_ext"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_choose_area_ext'"); return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_choose_area_ext'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_choose_area_ext"); return 0; } + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(3, "a"); + mtx[0][1] = smlua_get_number_field(3, "b"); + mtx[0][2] = smlua_get_number_field(3, "c"); + mtx[0][3] = smlua_get_number_field(3, "d"); + mtx[1][0] = smlua_get_number_field(3, "e"); + mtx[1][1] = smlua_get_number_field(3, "f"); + mtx[1][2] = smlua_get_number_field(3, "g"); + mtx[1][3] = smlua_get_number_field(3, "h"); + mtx[2][0] = smlua_get_number_field(3, "i"); + mtx[2][1] = smlua_get_number_field(3, "j"); + mtx[2][2] = smlua_get_number_field(3, "k"); + mtx[2][3] = smlua_get_number_field(3, "l"); + mtx[3][0] = smlua_get_number_field(3, "m"); + mtx[3][1] = smlua_get_number_field(3, "n"); + mtx[3][2] = smlua_get_number_field(3, "o"); + mtx[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_choose_area_ext"); return 0; } extern Gfx *geo_choose_area_ext(UNUSED s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx); UNIMPLEMENTED -->(L, geo_choose_area_ext(callContext, node, mtx)); + smlua_push_number_field(3, "a", mtx[0][0]); + smlua_push_number_field(3, "b", mtx[0][1]); + smlua_push_number_field(3, "c", mtx[0][2]); + smlua_push_number_field(3, "d", mtx[0][3]); + smlua_push_number_field(3, "e", mtx[1][0]); + smlua_push_number_field(3, "f", mtx[1][1]); + smlua_push_number_field(3, "g", mtx[1][2]); + smlua_push_number_field(3, "h", mtx[1][3]); + smlua_push_number_field(3, "i", mtx[2][0]); + smlua_push_number_field(3, "j", mtx[2][1]); + smlua_push_number_field(3, "k", mtx[2][2]); + smlua_push_number_field(3, "l", mtx[2][3]); + smlua_push_number_field(3, "m", mtx[3][0]); + smlua_push_number_field(3, "n", mtx[3][1]); + smlua_push_number_field(3, "o", mtx[3][2]); + smlua_push_number_field(3, "p", mtx[3][3]); + return 1; } */ int smlua_func_geo_offset_klepto_debug(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_offset_klepto_debug", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_offset_klepto_debug'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_offset_klepto_debug"); return 0; } struct GraphNode* a1 = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_offset_klepto_debug'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_offset_klepto_debug"); return 0; } s32 sp8 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_offset_klepto_debug'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_offset_klepto_debug"); return 0; } extern s32 geo_offset_klepto_debug(s32 callContext, struct GraphNode *a1, UNUSED s32 sp8); lua_pushinteger(L, geo_offset_klepto_debug(callContext, a1, sp8)); @@ -14965,30 +23136,76 @@ int smlua_func_geo_offset_klepto_debug(lua_State* L) { /* int smlua_func_geo_offset_klepto_held_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_offset_klepto_held_object", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_offset_klepto_held_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_offset_klepto_held_object"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_offset_klepto_held_object'"); return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_offset_klepto_held_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_offset_klepto_held_object"); return 0; } + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(3, "a"); + mtx[0][1] = smlua_get_number_field(3, "b"); + mtx[0][2] = smlua_get_number_field(3, "c"); + mtx[0][3] = smlua_get_number_field(3, "d"); + mtx[1][0] = smlua_get_number_field(3, "e"); + mtx[1][1] = smlua_get_number_field(3, "f"); + mtx[1][2] = smlua_get_number_field(3, "g"); + mtx[1][3] = smlua_get_number_field(3, "h"); + mtx[2][0] = smlua_get_number_field(3, "i"); + mtx[2][1] = smlua_get_number_field(3, "j"); + mtx[2][2] = smlua_get_number_field(3, "k"); + mtx[2][3] = smlua_get_number_field(3, "l"); + mtx[3][0] = smlua_get_number_field(3, "m"); + mtx[3][1] = smlua_get_number_field(3, "n"); + mtx[3][2] = smlua_get_number_field(3, "o"); + mtx[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_offset_klepto_held_object"); return 0; } extern Gfx *geo_offset_klepto_held_object(s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx); UNIMPLEMENTED -->(L, geo_offset_klepto_held_object(callContext, node, mtx)); + smlua_push_number_field(3, "a", mtx[0][0]); + smlua_push_number_field(3, "b", mtx[0][1]); + smlua_push_number_field(3, "c", mtx[0][2]); + smlua_push_number_field(3, "d", mtx[0][3]); + smlua_push_number_field(3, "e", mtx[1][0]); + smlua_push_number_field(3, "f", mtx[1][1]); + smlua_push_number_field(3, "g", mtx[1][2]); + smlua_push_number_field(3, "h", mtx[1][3]); + smlua_push_number_field(3, "i", mtx[2][0]); + smlua_push_number_field(3, "j", mtx[2][1]); + smlua_push_number_field(3, "k", mtx[2][2]); + smlua_push_number_field(3, "l", mtx[2][3]); + smlua_push_number_field(3, "m", mtx[3][0]); + smlua_push_number_field(3, "n", mtx[3][1]); + smlua_push_number_field(3, "o", mtx[3][2]); + smlua_push_number_field(3, "p", mtx[3][3]); + return 1; } */ /* int smlua_func_geo_switch_anim_state(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_switch_anim_state", 2, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_switch_anim_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_switch_anim_state"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_switch_anim_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_switch_anim_state"); return 0; } extern Gfx *geo_switch_anim_state(s32 callContext, struct GraphNode *node); UNIMPLEMENTED -->(L, geo_switch_anim_state(callContext, node)); @@ -14999,12 +23216,18 @@ int smlua_func_geo_switch_anim_state(lua_State* L) { /* int smlua_func_geo_switch_area(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_switch_area", 2, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_switch_area'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_switch_area"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_switch_area'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_switch_area"); return 0; } extern Gfx *geo_switch_area(s32 callContext, struct GraphNode *node); UNIMPLEMENTED -->(L, geo_switch_area(callContext, node)); @@ -15015,14 +23238,20 @@ int smlua_func_geo_switch_area(lua_State* L) { /* int smlua_func_geo_update_layer_transparency(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_update_layer_transparency", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_update_layer_transparency'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_update_layer_transparency"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_update_layer_transparency'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_update_layer_transparency"); return 0; } // void * context = (void *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_update_layer_transparency'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_update_layer_transparency"); return 0; } extern Gfx *geo_update_layer_transparency(s32 callContext, struct GraphNode *node, UNUSED void *context); UNIMPLEMENTED -->(L, geo_update_layer_transparency(callContext, node, context)); @@ -15033,27 +23262,73 @@ int smlua_func_geo_update_layer_transparency(lua_State* L) { /* int smlua_func_geo_update_projectile_pos_from_parent(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_update_projectile_pos_from_parent", 3, top); + return 0; + } s32 callContext = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'geo_update_projectile_pos_from_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "geo_update_projectile_pos_from_parent"); return 0; } struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'geo_update_projectile_pos_from_parent'"); return 0; } -// Mat4 mtx = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'geo_update_projectile_pos_from_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "geo_update_projectile_pos_from_parent"); return 0; } + + Mat4 mtx; + mtx[0][0] = smlua_get_number_field(3, "a"); + mtx[0][1] = smlua_get_number_field(3, "b"); + mtx[0][2] = smlua_get_number_field(3, "c"); + mtx[0][3] = smlua_get_number_field(3, "d"); + mtx[1][0] = smlua_get_number_field(3, "e"); + mtx[1][1] = smlua_get_number_field(3, "f"); + mtx[1][2] = smlua_get_number_field(3, "g"); + mtx[1][3] = smlua_get_number_field(3, "h"); + mtx[2][0] = smlua_get_number_field(3, "i"); + mtx[2][1] = smlua_get_number_field(3, "j"); + mtx[2][2] = smlua_get_number_field(3, "k"); + mtx[2][3] = smlua_get_number_field(3, "l"); + mtx[3][0] = smlua_get_number_field(3, "m"); + mtx[3][1] = smlua_get_number_field(3, "n"); + mtx[3][2] = smlua_get_number_field(3, "o"); + mtx[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "geo_update_projectile_pos_from_parent"); return 0; } extern Gfx *geo_update_projectile_pos_from_parent(s32 callContext, UNUSED struct GraphNode *node, Mat4 mtx); UNIMPLEMENTED -->(L, geo_update_projectile_pos_from_parent(callContext, node, mtx)); + smlua_push_number_field(3, "a", mtx[0][0]); + smlua_push_number_field(3, "b", mtx[0][1]); + smlua_push_number_field(3, "c", mtx[0][2]); + smlua_push_number_field(3, "d", mtx[0][3]); + smlua_push_number_field(3, "e", mtx[1][0]); + smlua_push_number_field(3, "f", mtx[1][1]); + smlua_push_number_field(3, "g", mtx[1][2]); + smlua_push_number_field(3, "h", mtx[1][3]); + smlua_push_number_field(3, "i", mtx[2][0]); + smlua_push_number_field(3, "j", mtx[2][1]); + smlua_push_number_field(3, "k", mtx[2][2]); + smlua_push_number_field(3, "l", mtx[2][3]); + smlua_push_number_field(3, "m", mtx[3][0]); + smlua_push_number_field(3, "n", mtx[3][1]); + smlua_push_number_field(3, "o", mtx[3][2]); + smlua_push_number_field(3, "p", mtx[3][3]); + return 1; } */ int smlua_func_get_object_list_from_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_object_list_from_behavior", 1, top); + return 0; + } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_object_list_from_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_object_list_from_behavior"); return 0; } extern u32 get_object_list_from_behavior(const BehaviorScript *behavior); lua_pushinteger(L, get_object_list_from_behavior(behavior)); @@ -15062,16 +23337,22 @@ int smlua_func_get_object_list_from_behavior(lua_State* L) { } int smlua_func_increment_velocity_toward_range(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "increment_velocity_toward_range", 4, top); + return 0; + } f32 value = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'increment_velocity_toward_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "increment_velocity_toward_range"); return 0; } f32 center = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'increment_velocity_toward_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "increment_velocity_toward_range"); return 0; } f32 zeroThreshold = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'increment_velocity_toward_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "increment_velocity_toward_range"); return 0; } f32 increment = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'increment_velocity_toward_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "increment_velocity_toward_range"); return 0; } extern f32 increment_velocity_toward_range(f32 value, f32 center, f32 zeroThreshold, f32 increment); lua_pushnumber(L, increment_velocity_toward_range(value, center, zeroThreshold, increment)); @@ -15080,12 +23361,18 @@ int smlua_func_increment_velocity_toward_range(lua_State* L) { } int smlua_func_is_item_in_array(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_item_in_array", 2, top); + return 0; + } s8 item = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_item_in_array'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_item_in_array"); return 0; } s8 * array = (s8 *)smlua_to_cpointer(L, 2, LVT_S8_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'is_item_in_array'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "is_item_in_array"); return 0; } extern s32 is_item_in_array(s8 item, s8 *array); lua_pushinteger(L, is_item_in_array(item, array)); @@ -15094,10 +23381,16 @@ int smlua_func_is_item_in_array(lua_State* L) { } int smlua_func_is_mario_moving_fast_or_in_air(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_mario_moving_fast_or_in_air", 1, top); + return 0; + } s32 speedThreshold = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'is_mario_moving_fast_or_in_air'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "is_mario_moving_fast_or_in_air"); return 0; } extern s32 is_mario_moving_fast_or_in_air(s32 speedThreshold); lua_pushinteger(L, is_mario_moving_fast_or_in_air(speedThreshold)); @@ -15106,12 +23399,18 @@ int smlua_func_is_mario_moving_fast_or_in_air(lua_State* L) { } int smlua_func_lateral_dist_between_objects(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "lateral_dist_between_objects", 2, top); + return 0; + } struct Object* obj1 = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'lateral_dist_between_objects'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "lateral_dist_between_objects"); return 0; } struct Object* obj2 = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'lateral_dist_between_objects'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "lateral_dist_between_objects"); return 0; } extern f32 lateral_dist_between_objects(struct Object *obj1, struct Object *obj2); lua_pushnumber(L, lateral_dist_between_objects(obj1, obj2)); @@ -15119,28 +23418,67 @@ int smlua_func_lateral_dist_between_objects(lua_State* L) { return 1; } -/* int smlua_func_linear_mtxf_mul_vec3f(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 m = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'linear_mtxf_mul_vec3f'"); return 0; } + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "linear_mtxf_mul_vec3f", 3, top); + return 0; + } + + + Mat4 m; + m[0][0] = smlua_get_number_field(1, "a"); + m[0][1] = smlua_get_number_field(1, "b"); + m[0][2] = smlua_get_number_field(1, "c"); + m[0][3] = smlua_get_number_field(1, "d"); + m[1][0] = smlua_get_number_field(1, "e"); + m[1][1] = smlua_get_number_field(1, "f"); + m[1][2] = smlua_get_number_field(1, "g"); + m[1][3] = smlua_get_number_field(1, "h"); + m[2][0] = smlua_get_number_field(1, "i"); + m[2][1] = smlua_get_number_field(1, "j"); + m[2][2] = smlua_get_number_field(1, "k"); + m[2][3] = smlua_get_number_field(1, "l"); + m[3][0] = smlua_get_number_field(1, "m"); + m[3][1] = smlua_get_number_field(1, "n"); + m[3][2] = smlua_get_number_field(1, "o"); + m[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "linear_mtxf_mul_vec3f"); return 0; } f32* dst = smlua_get_vec3f_from_buffer(); dst[0] = smlua_get_number_field(2, "x"); dst[1] = smlua_get_number_field(2, "y"); dst[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'linear_mtxf_mul_vec3f'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "linear_mtxf_mul_vec3f"); return 0; } f32* v = smlua_get_vec3f_from_buffer(); v[0] = smlua_get_number_field(3, "x"); v[1] = smlua_get_number_field(3, "y"); v[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'linear_mtxf_mul_vec3f'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "linear_mtxf_mul_vec3f"); return 0; } extern void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v); linear_mtxf_mul_vec3f(m, dst, v); + smlua_push_number_field(1, "a", m[0][0]); + smlua_push_number_field(1, "b", m[0][1]); + smlua_push_number_field(1, "c", m[0][2]); + smlua_push_number_field(1, "d", m[0][3]); + smlua_push_number_field(1, "e", m[1][0]); + smlua_push_number_field(1, "f", m[1][1]); + smlua_push_number_field(1, "g", m[1][2]); + smlua_push_number_field(1, "h", m[1][3]); + smlua_push_number_field(1, "i", m[2][0]); + smlua_push_number_field(1, "j", m[2][1]); + smlua_push_number_field(1, "k", m[2][2]); + smlua_push_number_field(1, "l", m[2][3]); + smlua_push_number_field(1, "m", m[3][0]); + smlua_push_number_field(1, "n", m[3][1]); + smlua_push_number_field(1, "o", m[3][2]); + smlua_push_number_field(1, "p", m[3][3]); + smlua_push_number_field(2, "x", dst[0]); smlua_push_number_field(2, "y", dst[1]); smlua_push_number_field(2, "z", dst[2]); @@ -15151,30 +23489,68 @@ int smlua_func_linear_mtxf_mul_vec3f(lua_State* L) { return 1; } -*/ -/* int smlua_func_linear_mtxf_transpose_mul_vec3f(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 m = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'linear_mtxf_transpose_mul_vec3f'"); return 0; } + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "linear_mtxf_transpose_mul_vec3f", 3, top); + return 0; + } + + + Mat4 m; + m[0][0] = smlua_get_number_field(1, "a"); + m[0][1] = smlua_get_number_field(1, "b"); + m[0][2] = smlua_get_number_field(1, "c"); + m[0][3] = smlua_get_number_field(1, "d"); + m[1][0] = smlua_get_number_field(1, "e"); + m[1][1] = smlua_get_number_field(1, "f"); + m[1][2] = smlua_get_number_field(1, "g"); + m[1][3] = smlua_get_number_field(1, "h"); + m[2][0] = smlua_get_number_field(1, "i"); + m[2][1] = smlua_get_number_field(1, "j"); + m[2][2] = smlua_get_number_field(1, "k"); + m[2][3] = smlua_get_number_field(1, "l"); + m[3][0] = smlua_get_number_field(1, "m"); + m[3][1] = smlua_get_number_field(1, "n"); + m[3][2] = smlua_get_number_field(1, "o"); + m[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "linear_mtxf_transpose_mul_vec3f"); return 0; } f32* dst = smlua_get_vec3f_from_buffer(); dst[0] = smlua_get_number_field(2, "x"); dst[1] = smlua_get_number_field(2, "y"); dst[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'linear_mtxf_transpose_mul_vec3f'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "linear_mtxf_transpose_mul_vec3f"); return 0; } f32* v = smlua_get_vec3f_from_buffer(); v[0] = smlua_get_number_field(3, "x"); v[1] = smlua_get_number_field(3, "y"); v[2] = smlua_get_number_field(3, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'linear_mtxf_transpose_mul_vec3f'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "linear_mtxf_transpose_mul_vec3f"); return 0; } extern void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v); linear_mtxf_transpose_mul_vec3f(m, dst, v); + smlua_push_number_field(1, "a", m[0][0]); + smlua_push_number_field(1, "b", m[0][1]); + smlua_push_number_field(1, "c", m[0][2]); + smlua_push_number_field(1, "d", m[0][3]); + smlua_push_number_field(1, "e", m[1][0]); + smlua_push_number_field(1, "f", m[1][1]); + smlua_push_number_field(1, "g", m[1][2]); + smlua_push_number_field(1, "h", m[1][3]); + smlua_push_number_field(1, "i", m[2][0]); + smlua_push_number_field(1, "j", m[2][1]); + smlua_push_number_field(1, "k", m[2][2]); + smlua_push_number_field(1, "l", m[2][3]); + smlua_push_number_field(1, "m", m[3][0]); + smlua_push_number_field(1, "n", m[3][1]); + smlua_push_number_field(1, "o", m[3][2]); + smlua_push_number_field(1, "p", m[3][3]); + smlua_push_number_field(2, "x", dst[0]); smlua_push_number_field(2, "y", dst[1]); smlua_push_number_field(2, "z", dst[2]); @@ -15185,13 +23561,18 @@ int smlua_func_linear_mtxf_transpose_mul_vec3f(lua_State* L) { return 1; } -*/ int smlua_func_mario_is_dive_sliding(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_is_dive_sliding", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_is_dive_sliding'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_is_dive_sliding"); return 0; } extern s32 mario_is_dive_sliding(struct MarioState* m); lua_pushinteger(L, mario_is_dive_sliding(m)); @@ -15200,10 +23581,16 @@ int smlua_func_mario_is_dive_sliding(lua_State* L) { } int smlua_func_mario_is_in_air_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_is_in_air_action", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_is_in_air_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_is_in_air_action"); return 0; } extern s32 mario_is_in_air_action(struct MarioState* m); lua_pushinteger(L, mario_is_in_air_action(m)); @@ -15212,16 +23599,22 @@ int smlua_func_mario_is_in_air_action(lua_State* L) { } int smlua_func_mario_is_within_rectangle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_is_within_rectangle", 4, top); + return 0; + } s16 minX = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_is_within_rectangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_is_within_rectangle"); return 0; } s16 maxX = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'mario_is_within_rectangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_is_within_rectangle"); return 0; } s16 minZ = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'mario_is_within_rectangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "mario_is_within_rectangle"); return 0; } s16 maxZ = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'mario_is_within_rectangle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "mario_is_within_rectangle"); return 0; } extern s32 mario_is_within_rectangle(s16 minX, s16 maxX, s16 minZ, s16 maxZ); lua_pushinteger(L, mario_is_within_rectangle(minX, maxX, minZ, maxZ)); @@ -15230,10 +23623,16 @@ int smlua_func_mario_is_within_rectangle(lua_State* L) { } int smlua_func_mario_set_flag(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_set_flag", 1, top); + return 0; + } s32 flag = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'mario_set_flag'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_set_flag"); return 0; } extern void mario_set_flag(s32 flag); mario_set_flag(flag); @@ -15242,12 +23641,18 @@ int smlua_func_mario_set_flag(lua_State* L) { } int smlua_func_obj_angle_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_angle_to_object", 2, top); + return 0; + } struct Object* obj1 = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_angle_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_angle_to_object"); return 0; } struct Object* obj2 = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_angle_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_angle_to_object"); return 0; } extern s16 obj_angle_to_object(struct Object *obj1, struct Object *obj2); lua_pushinteger(L, obj_angle_to_object(obj1, obj2)); @@ -15256,14 +23661,20 @@ int smlua_func_obj_angle_to_object(lua_State* L) { } int smlua_func_obj_angle_to_point(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_angle_to_point", 3, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_angle_to_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_angle_to_point"); return 0; } f32 pointX = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_angle_to_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_angle_to_point"); return 0; } f32 pointZ = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_angle_to_point'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_angle_to_point"); return 0; } extern s16 obj_angle_to_point(struct Object *obj, f32 pointX, f32 pointZ); lua_pushinteger(L, obj_angle_to_point(obj, pointX, pointZ)); @@ -15271,29 +23682,107 @@ int smlua_func_obj_angle_to_point(lua_State* L) { return 1; } -/* int smlua_func_obj_apply_scale_to_matrix(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_apply_scale_to_matrix", 3, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_apply_scale_to_matrix'"); return 0; } -// Mat4 dst = (Mat4)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_apply_scale_to_matrix'"); return 0; } -// Mat4 src = (Mat4)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_apply_scale_to_matrix'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_apply_scale_to_matrix"); return 0; } + + Mat4 dst; + dst[0][0] = smlua_get_number_field(2, "a"); + dst[0][1] = smlua_get_number_field(2, "b"); + dst[0][2] = smlua_get_number_field(2, "c"); + dst[0][3] = smlua_get_number_field(2, "d"); + dst[1][0] = smlua_get_number_field(2, "e"); + dst[1][1] = smlua_get_number_field(2, "f"); + dst[1][2] = smlua_get_number_field(2, "g"); + dst[1][3] = smlua_get_number_field(2, "h"); + dst[2][0] = smlua_get_number_field(2, "i"); + dst[2][1] = smlua_get_number_field(2, "j"); + dst[2][2] = smlua_get_number_field(2, "k"); + dst[2][3] = smlua_get_number_field(2, "l"); + dst[3][0] = smlua_get_number_field(2, "m"); + dst[3][1] = smlua_get_number_field(2, "n"); + dst[3][2] = smlua_get_number_field(2, "o"); + dst[3][3] = smlua_get_number_field(2, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_apply_scale_to_matrix"); return 0; } + + Mat4 src; + src[0][0] = smlua_get_number_field(3, "a"); + src[0][1] = smlua_get_number_field(3, "b"); + src[0][2] = smlua_get_number_field(3, "c"); + src[0][3] = smlua_get_number_field(3, "d"); + src[1][0] = smlua_get_number_field(3, "e"); + src[1][1] = smlua_get_number_field(3, "f"); + src[1][2] = smlua_get_number_field(3, "g"); + src[1][3] = smlua_get_number_field(3, "h"); + src[2][0] = smlua_get_number_field(3, "i"); + src[2][1] = smlua_get_number_field(3, "j"); + src[2][2] = smlua_get_number_field(3, "k"); + src[2][3] = smlua_get_number_field(3, "l"); + src[3][0] = smlua_get_number_field(3, "m"); + src[3][1] = smlua_get_number_field(3, "n"); + src[3][2] = smlua_get_number_field(3, "o"); + src[3][3] = smlua_get_number_field(3, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_apply_scale_to_matrix"); return 0; } extern void obj_apply_scale_to_matrix(struct Object *obj, Mat4 dst, Mat4 src); obj_apply_scale_to_matrix(obj, dst, src); + smlua_push_number_field(2, "a", dst[0][0]); + smlua_push_number_field(2, "b", dst[0][1]); + smlua_push_number_field(2, "c", dst[0][2]); + smlua_push_number_field(2, "d", dst[0][3]); + smlua_push_number_field(2, "e", dst[1][0]); + smlua_push_number_field(2, "f", dst[1][1]); + smlua_push_number_field(2, "g", dst[1][2]); + smlua_push_number_field(2, "h", dst[1][3]); + smlua_push_number_field(2, "i", dst[2][0]); + smlua_push_number_field(2, "j", dst[2][1]); + smlua_push_number_field(2, "k", dst[2][2]); + smlua_push_number_field(2, "l", dst[2][3]); + smlua_push_number_field(2, "m", dst[3][0]); + smlua_push_number_field(2, "n", dst[3][1]); + smlua_push_number_field(2, "o", dst[3][2]); + smlua_push_number_field(2, "p", dst[3][3]); + + smlua_push_number_field(3, "a", src[0][0]); + smlua_push_number_field(3, "b", src[0][1]); + smlua_push_number_field(3, "c", src[0][2]); + smlua_push_number_field(3, "d", src[0][3]); + smlua_push_number_field(3, "e", src[1][0]); + smlua_push_number_field(3, "f", src[1][1]); + smlua_push_number_field(3, "g", src[1][2]); + smlua_push_number_field(3, "h", src[1][3]); + smlua_push_number_field(3, "i", src[2][0]); + smlua_push_number_field(3, "j", src[2][1]); + smlua_push_number_field(3, "k", src[2][2]); + smlua_push_number_field(3, "l", src[2][3]); + smlua_push_number_field(3, "m", src[3][0]); + smlua_push_number_field(3, "n", src[3][1]); + smlua_push_number_field(3, "o", src[3][2]); + smlua_push_number_field(3, "p", src[3][3]); + return 1; } -*/ int smlua_func_obj_apply_scale_to_transform(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_apply_scale_to_transform", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_apply_scale_to_transform'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_apply_scale_to_transform"); return 0; } extern void obj_apply_scale_to_transform(struct Object *obj); obj_apply_scale_to_transform(obj); @@ -15302,10 +23791,16 @@ int smlua_func_obj_apply_scale_to_transform(lua_State* L) { } int smlua_func_obj_attack_collided_from_other_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_attack_collided_from_other_object", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_attack_collided_from_other_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_attack_collided_from_other_object"); return 0; } extern s32 obj_attack_collided_from_other_object(struct Object *obj); lua_pushinteger(L, obj_attack_collided_from_other_object(obj)); @@ -15314,10 +23809,16 @@ int smlua_func_obj_attack_collided_from_other_object(lua_State* L) { } int smlua_func_obj_become_tangible(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_become_tangible", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_become_tangible'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_become_tangible"); return 0; } extern void obj_become_tangible(struct Object *obj); obj_become_tangible(obj); @@ -15326,10 +23827,16 @@ int smlua_func_obj_become_tangible(lua_State* L) { } int smlua_func_obj_build_relative_transform(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_build_relative_transform", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_build_relative_transform'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_build_relative_transform"); return 0; } extern void obj_build_relative_transform(struct Object *obj); obj_build_relative_transform(obj); @@ -15338,14 +23845,20 @@ int smlua_func_obj_build_relative_transform(lua_State* L) { } int smlua_func_obj_build_transform_from_pos_and_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_build_transform_from_pos_and_angle", 3, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_build_transform_from_pos_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_build_transform_from_pos_and_angle"); return 0; } s16 posIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_build_transform_from_pos_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_build_transform_from_pos_and_angle"); return 0; } s16 angleIndex = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_build_transform_from_pos_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_build_transform_from_pos_and_angle"); return 0; } extern void obj_build_transform_from_pos_and_angle(struct Object *obj, s16 posIndex, s16 angleIndex); obj_build_transform_from_pos_and_angle(obj, posIndex, angleIndex); @@ -15354,10 +23867,16 @@ int smlua_func_obj_build_transform_from_pos_and_angle(lua_State* L) { } int smlua_func_obj_build_transform_relative_to_parent(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_build_transform_relative_to_parent", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_build_transform_relative_to_parent'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_build_transform_relative_to_parent"); return 0; } extern void obj_build_transform_relative_to_parent(struct Object *obj); obj_build_transform_relative_to_parent(obj); @@ -15366,10 +23885,16 @@ int smlua_func_obj_build_transform_relative_to_parent(lua_State* L) { } int smlua_func_obj_build_vel_from_transform(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_build_vel_from_transform", 1, top); + return 0; + } struct Object* a0 = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_build_vel_from_transform'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_build_vel_from_transform"); return 0; } extern void obj_build_vel_from_transform(struct Object *a0); obj_build_vel_from_transform(a0); @@ -15378,12 +23903,18 @@ int smlua_func_obj_build_vel_from_transform(lua_State* L) { } int smlua_func_obj_check_if_collided_with_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_check_if_collided_with_object", 2, top); + return 0; + } struct Object* obj1 = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_check_if_collided_with_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_check_if_collided_with_object"); return 0; } struct Object* obj2 = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_check_if_collided_with_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_check_if_collided_with_object"); return 0; } extern s32 obj_check_if_collided_with_object(struct Object *obj1, struct Object *obj2); lua_pushinteger(L, obj_check_if_collided_with_object(obj1, obj2)); @@ -15392,12 +23923,18 @@ int smlua_func_obj_check_if_collided_with_object(lua_State* L) { } int smlua_func_obj_copy_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_copy_angle", 2, top); + return 0; + } struct Object* dst = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_copy_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_copy_angle"); return 0; } struct Object* src = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_copy_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_copy_angle"); return 0; } extern void obj_copy_angle(struct Object *dst, struct Object *src); obj_copy_angle(dst, src); @@ -15406,12 +23943,18 @@ int smlua_func_obj_copy_angle(lua_State* L) { } int smlua_func_obj_copy_behavior_params(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_copy_behavior_params", 2, top); + return 0; + } struct Object* dst = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_copy_behavior_params'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_copy_behavior_params"); return 0; } struct Object* src = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_copy_behavior_params'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_copy_behavior_params"); return 0; } extern void obj_copy_behavior_params(struct Object *dst, struct Object *src); obj_copy_behavior_params(dst, src); @@ -15420,12 +23963,18 @@ int smlua_func_obj_copy_behavior_params(lua_State* L) { } int smlua_func_obj_copy_graph_y_offset(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_copy_graph_y_offset", 2, top); + return 0; + } struct Object* dst = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_copy_graph_y_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_copy_graph_y_offset"); return 0; } struct Object* src = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_copy_graph_y_offset'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_copy_graph_y_offset"); return 0; } extern void obj_copy_graph_y_offset(struct Object *dst, struct Object *src); obj_copy_graph_y_offset(dst, src); @@ -15434,12 +23983,18 @@ int smlua_func_obj_copy_graph_y_offset(lua_State* L) { } int smlua_func_obj_copy_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_copy_pos", 2, top); + return 0; + } struct Object* dst = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_copy_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_copy_pos"); return 0; } struct Object* src = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_copy_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_copy_pos"); return 0; } extern void obj_copy_pos(struct Object *dst, struct Object *src); obj_copy_pos(dst, src); @@ -15448,12 +24003,18 @@ int smlua_func_obj_copy_pos(lua_State* L) { } int smlua_func_obj_copy_pos_and_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_copy_pos_and_angle", 2, top); + return 0; + } struct Object* dst = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_copy_pos_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_copy_pos_and_angle"); return 0; } struct Object* src = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_copy_pos_and_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_copy_pos_and_angle"); return 0; } extern void obj_copy_pos_and_angle(struct Object *dst, struct Object *src); obj_copy_pos_and_angle(dst, src); @@ -15462,12 +24023,18 @@ int smlua_func_obj_copy_pos_and_angle(lua_State* L) { } int smlua_func_obj_copy_scale(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_copy_scale", 2, top); + return 0; + } struct Object* dst = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_copy_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_copy_scale"); return 0; } struct Object* src = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_copy_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_copy_scale"); return 0; } extern void obj_copy_scale(struct Object *dst, struct Object *src); obj_copy_scale(dst, src); @@ -15476,10 +24043,16 @@ int smlua_func_obj_copy_scale(lua_State* L) { } int smlua_func_obj_create_transform_from_self(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_create_transform_from_self", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_create_transform_from_self'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_create_transform_from_self"); return 0; } extern void obj_create_transform_from_self(struct Object *obj); obj_create_transform_from_self(obj); @@ -15488,12 +24061,18 @@ int smlua_func_obj_create_transform_from_self(lua_State* L) { } int smlua_func_obj_explode_and_spawn_coins(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_explode_and_spawn_coins", 2, top); + return 0; + } f32 sp18 = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_explode_and_spawn_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_explode_and_spawn_coins"); return 0; } s32 sp1C = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_explode_and_spawn_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_explode_and_spawn_coins"); return 0; } extern void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C); obj_explode_and_spawn_coins(sp18, sp1C); @@ -15502,12 +24081,18 @@ int smlua_func_obj_explode_and_spawn_coins(lua_State* L) { } int smlua_func_obj_has_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_has_behavior", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_has_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_has_behavior"); return 0; } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 2, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_has_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_has_behavior"); return 0; } extern s32 obj_has_behavior(struct Object *obj, const BehaviorScript *behavior); lua_pushinteger(L, obj_has_behavior(obj, behavior)); @@ -15516,12 +24101,18 @@ int smlua_func_obj_has_behavior(lua_State* L) { } int smlua_func_obj_init_animation(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_init_animation", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_init_animation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_init_animation"); return 0; } s32 animIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_init_animation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_init_animation"); return 0; } extern void obj_init_animation(struct Object *obj, s32 animIndex); obj_init_animation(obj, animIndex); @@ -15531,14 +24122,20 @@ int smlua_func_obj_init_animation(lua_State* L) { /* int smlua_func_obj_init_animation_with_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_init_animation_with_sound", 3, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_init_animation_with_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_init_animation_with_sound"); return 0; } // const structAnimation*const* animations = (const structAnimation*const*)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_init_animation_with_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_init_animation_with_sound"); return 0; } s32 animIndex = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_init_animation_with_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_init_animation_with_sound"); return 0; } extern void obj_init_animation_with_sound(struct Object *obj, const struct Animation * const* animations, s32 animIndex); obj_init_animation_with_sound(obj, animations, animIndex); @@ -15548,10 +24145,16 @@ int smlua_func_obj_init_animation_with_sound(lua_State* L) { */ int smlua_func_obj_is_hidden(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_hidden", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_hidden'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_hidden"); return 0; } extern s32 obj_is_hidden(struct Object *obj); lua_pushinteger(L, obj_is_hidden(obj)); @@ -15560,10 +24163,16 @@ int smlua_func_obj_is_hidden(lua_State* L) { } int smlua_func_obj_mark_for_deletion(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_mark_for_deletion", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_mark_for_deletion'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_mark_for_deletion"); return 0; } extern void obj_mark_for_deletion(struct Object *obj); obj_mark_for_deletion(obj); @@ -15572,12 +24181,18 @@ int smlua_func_obj_mark_for_deletion(lua_State* L) { } int smlua_func_obj_pitch_to_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_pitch_to_object", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_pitch_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_pitch_to_object"); return 0; } struct Object* target = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_pitch_to_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_pitch_to_object"); return 0; } extern s16 obj_pitch_to_object(struct Object* obj, struct Object* target); lua_pushinteger(L, obj_pitch_to_object(obj, target)); @@ -15586,12 +24201,18 @@ int smlua_func_obj_pitch_to_object(lua_State* L) { } int smlua_func_obj_scale(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_scale", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_scale"); return 0; } f32 scale = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_scale"); return 0; } extern void obj_scale(struct Object *obj, f32 scale); obj_scale(obj, scale); @@ -15600,14 +24221,20 @@ int smlua_func_obj_scale(lua_State* L) { } int smlua_func_obj_scale_random(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_scale_random", 3, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_scale_random'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_scale_random"); return 0; } f32 rangeLength = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_scale_random'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_scale_random"); return 0; } f32 minScale = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_scale_random'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_scale_random"); return 0; } extern void obj_scale_random(struct Object *obj, f32 rangeLength, f32 minScale); obj_scale_random(obj, rangeLength, minScale); @@ -15616,16 +24243,22 @@ int smlua_func_obj_scale_random(lua_State* L) { } int smlua_func_obj_scale_xyz(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_scale_xyz", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_scale_xyz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_scale_xyz"); return 0; } f32 xScale = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_scale_xyz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_scale_xyz"); return 0; } f32 yScale = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_scale_xyz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_scale_xyz"); return 0; } f32 zScale = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_scale_xyz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_scale_xyz"); return 0; } extern void obj_scale_xyz(struct Object *obj, f32 xScale, f32 yScale, f32 zScale); obj_scale_xyz(obj, xScale, yScale, zScale); @@ -15634,16 +24267,22 @@ int smlua_func_obj_scale_xyz(lua_State* L) { } int smlua_func_obj_set_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_angle", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_angle"); return 0; } s16 pitch = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_angle"); return 0; } s16 yaw = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_angle"); return 0; } s16 roll = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_angle"); return 0; } extern void obj_set_angle(struct Object *obj, s16 pitch, s16 yaw, s16 roll); obj_set_angle(obj, pitch, yaw, roll); @@ -15652,12 +24291,18 @@ int smlua_func_obj_set_angle(lua_State* L) { } int smlua_func_obj_set_behavior(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_behavior", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_behavior"); return 0; } const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 2, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_behavior'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_behavior"); return 0; } extern void obj_set_behavior(struct Object *obj, const BehaviorScript *behavior); obj_set_behavior(obj, behavior); @@ -15666,10 +24311,16 @@ int smlua_func_obj_set_behavior(lua_State* L) { } int smlua_func_obj_set_billboard(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_billboard", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_billboard'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_billboard"); return 0; } extern void obj_set_billboard(struct Object *obj); obj_set_billboard(obj); @@ -15679,12 +24330,18 @@ int smlua_func_obj_set_billboard(lua_State* L) { /* int smlua_func_obj_set_collision_data(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_collision_data", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_collision_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_collision_data"); return 0; } // const void* segAddr = (const void*)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_collision_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_collision_data"); return 0; } extern void obj_set_collision_data(struct Object *obj, const void *segAddr); obj_set_collision_data(obj, segAddr); @@ -15694,10 +24351,16 @@ int smlua_func_obj_set_collision_data(lua_State* L) { */ int smlua_func_obj_set_cylboard(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_cylboard", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_cylboard'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_cylboard"); return 0; } extern void obj_set_cylboard(struct Object *obj); obj_set_cylboard(obj); @@ -15706,16 +24369,22 @@ int smlua_func_obj_set_cylboard(lua_State* L) { } int smlua_func_obj_set_face_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_face_angle", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_face_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_face_angle"); return 0; } s16 pitch = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_face_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_face_angle"); return 0; } s16 yaw = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_face_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_face_angle"); return 0; } s16 roll = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_face_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_face_angle"); return 0; } extern void obj_set_face_angle(struct Object *obj, s16 pitch, s16 yaw, s16 roll); obj_set_face_angle(obj, pitch, yaw, roll); @@ -15724,10 +24393,16 @@ int smlua_func_obj_set_face_angle(lua_State* L) { } int smlua_func_obj_set_face_angle_to_move_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_face_angle_to_move_angle", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_face_angle_to_move_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_face_angle_to_move_angle"); return 0; } extern void obj_set_face_angle_to_move_angle(struct Object *obj); obj_set_face_angle_to_move_angle(obj); @@ -15736,16 +24411,22 @@ int smlua_func_obj_set_face_angle_to_move_angle(lua_State* L) { } int smlua_func_obj_set_gfx_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_gfx_angle", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_gfx_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_gfx_angle"); return 0; } s16 pitch = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_gfx_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_gfx_angle"); return 0; } s16 yaw = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_gfx_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_gfx_angle"); return 0; } s16 roll = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_gfx_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_gfx_angle"); return 0; } extern void obj_set_gfx_angle(struct Object *obj, s16 pitch, s16 yaw, s16 roll); obj_set_gfx_angle(obj, pitch, yaw, roll); @@ -15754,16 +24435,22 @@ int smlua_func_obj_set_gfx_angle(lua_State* L) { } int smlua_func_obj_set_gfx_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_gfx_pos", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_gfx_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_gfx_pos"); return 0; } f32 x = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_gfx_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_gfx_pos"); return 0; } f32 y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_gfx_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_gfx_pos"); return 0; } f32 z = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_gfx_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_gfx_pos"); return 0; } extern void obj_set_gfx_pos(struct Object *obj, f32 x, f32 y, f32 z); obj_set_gfx_pos(obj, x, y, z); @@ -15772,12 +24459,18 @@ int smlua_func_obj_set_gfx_pos(lua_State* L) { } int smlua_func_obj_set_gfx_pos_at_obj_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_gfx_pos_at_obj_pos", 2, top); + return 0; + } struct Object* obj1 = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_gfx_pos_at_obj_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_gfx_pos_at_obj_pos"); return 0; } struct Object* obj2 = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_gfx_pos_at_obj_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_gfx_pos_at_obj_pos"); return 0; } extern void obj_set_gfx_pos_at_obj_pos(struct Object *obj1, struct Object *obj2); obj_set_gfx_pos_at_obj_pos(obj1, obj2); @@ -15786,10 +24479,16 @@ int smlua_func_obj_set_gfx_pos_at_obj_pos(lua_State* L) { } int smlua_func_obj_set_gfx_pos_from_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_gfx_pos_from_pos", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_gfx_pos_from_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_gfx_pos_from_pos"); return 0; } extern void obj_set_gfx_pos_from_pos(struct Object *obj); obj_set_gfx_pos_from_pos(obj); @@ -15798,16 +24497,22 @@ int smlua_func_obj_set_gfx_pos_from_pos(lua_State* L) { } int smlua_func_obj_set_gfx_scale(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_gfx_scale", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_gfx_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_gfx_scale"); return 0; } f32 x = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_gfx_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_gfx_scale"); return 0; } f32 y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_gfx_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_gfx_scale"); return 0; } f32 z = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_gfx_scale'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_gfx_scale"); return 0; } extern void obj_set_gfx_scale(struct Object *obj, f32 x, f32 y, f32 z); obj_set_gfx_scale(obj, x, y, z); @@ -15816,12 +24521,18 @@ int smlua_func_obj_set_gfx_scale(lua_State* L) { } int smlua_func_obj_set_held_state(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_held_state", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_held_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_held_state"); return 0; } const BehaviorScript* heldBehavior = (const BehaviorScript*)smlua_to_cpointer(L, 2, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_held_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_held_state"); return 0; } extern void obj_set_held_state(struct Object *obj, const BehaviorScript *heldBehavior); obj_set_held_state(obj, heldBehavior); @@ -15830,12 +24541,18 @@ int smlua_func_obj_set_held_state(lua_State* L) { } int smlua_func_obj_set_hitbox(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_hitbox", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_hitbox'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_hitbox"); return 0; } struct ObjectHitbox* hitbox = (struct ObjectHitbox*)smlua_to_cobject(L, 2, LOT_OBJECTHITBOX); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_hitbox'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_hitbox"); return 0; } extern void obj_set_hitbox(struct Object *obj, struct ObjectHitbox *hitbox); obj_set_hitbox(obj, hitbox); @@ -15844,14 +24561,20 @@ int smlua_func_obj_set_hitbox(lua_State* L) { } int smlua_func_obj_set_hitbox_radius_and_height(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_hitbox_radius_and_height", 3, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_hitbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_hitbox_radius_and_height"); return 0; } f32 radius = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_hitbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_hitbox_radius_and_height"); return 0; } f32 height = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_hitbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_hitbox_radius_and_height"); return 0; } extern void obj_set_hitbox_radius_and_height(struct Object *o, f32 radius, f32 height); obj_set_hitbox_radius_and_height(o, radius, height); @@ -15860,14 +24583,20 @@ int smlua_func_obj_set_hitbox_radius_and_height(lua_State* L) { } int smlua_func_obj_set_hurtbox_radius_and_height(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_hurtbox_radius_and_height", 3, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_hurtbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_hurtbox_radius_and_height"); return 0; } f32 radius = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_hurtbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_hurtbox_radius_and_height"); return 0; } f32 height = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_hurtbox_radius_and_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_hurtbox_radius_and_height"); return 0; } extern void obj_set_hurtbox_radius_and_height(struct Object *o, f32 radius, f32 height); obj_set_hurtbox_radius_and_height(o, radius, height); @@ -15876,16 +24605,22 @@ int smlua_func_obj_set_hurtbox_radius_and_height(lua_State* L) { } int smlua_func_obj_set_move_angle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_move_angle", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_move_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_move_angle"); return 0; } s16 pitch = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_move_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_move_angle"); return 0; } s16 yaw = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_move_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_move_angle"); return 0; } s16 roll = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_move_angle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_move_angle"); return 0; } extern void obj_set_move_angle(struct Object *obj, s16 pitch, s16 yaw, s16 roll); obj_set_move_angle(obj, pitch, yaw, roll); @@ -15894,16 +24629,22 @@ int smlua_func_obj_set_move_angle(lua_State* L) { } int smlua_func_obj_set_parent_relative_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_parent_relative_pos", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_parent_relative_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_parent_relative_pos"); return 0; } s16 relX = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_parent_relative_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_parent_relative_pos"); return 0; } s16 relY = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_parent_relative_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_parent_relative_pos"); return 0; } s16 relZ = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_parent_relative_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_parent_relative_pos"); return 0; } extern void obj_set_parent_relative_pos(struct Object *obj, s16 relX, s16 relY, s16 relZ); obj_set_parent_relative_pos(obj, relX, relY, relZ); @@ -15912,16 +24653,22 @@ int smlua_func_obj_set_parent_relative_pos(lua_State* L) { } int smlua_func_obj_set_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_pos", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_pos"); return 0; } s16 x = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_pos"); return 0; } s16 y = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_pos"); return 0; } s16 z = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_pos"); return 0; } extern void obj_set_pos(struct Object *obj, s16 x, s16 y, s16 z); obj_set_pos(obj, x, y, z); @@ -15930,18 +24677,24 @@ int smlua_func_obj_set_pos(lua_State* L) { } int smlua_func_obj_set_pos_relative(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_pos_relative", 5, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_pos_relative'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_pos_relative"); return 0; } struct Object* other = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_pos_relative'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_pos_relative"); return 0; } f32 dleft = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_pos_relative'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_pos_relative"); return 0; } f32 dy = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_pos_relative'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_pos_relative"); return 0; } f32 dforward = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_set_pos_relative'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_set_pos_relative"); return 0; } extern void obj_set_pos_relative(struct Object *obj, struct Object *other, f32 dleft, f32 dy, f32 dforward); obj_set_pos_relative(obj, other, dleft, dy, dforward); @@ -15950,10 +24703,16 @@ int smlua_func_obj_set_pos_relative(lua_State* L) { } int smlua_func_obj_set_throw_matrix_from_transform(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_throw_matrix_from_transform", 1, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_throw_matrix_from_transform'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_throw_matrix_from_transform"); return 0; } extern void obj_set_throw_matrix_from_transform(struct Object *obj); obj_set_throw_matrix_from_transform(obj); @@ -15962,16 +24721,22 @@ int smlua_func_obj_set_throw_matrix_from_transform(lua_State* L) { } int smlua_func_obj_spawn_loot_blue_coins(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_spawn_loot_blue_coins", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_spawn_loot_blue_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_blue_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_spawn_loot_blue_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_blue_coins"); return 0; } f32 sp28 = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_spawn_loot_blue_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_blue_coins"); return 0; } s16 posJitter = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_spawn_loot_blue_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_spawn_loot_blue_coins"); return 0; } extern void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter); obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter); @@ -15980,20 +24745,26 @@ int smlua_func_obj_spawn_loot_blue_coins(lua_State* L) { } int smlua_func_obj_spawn_loot_coins(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_spawn_loot_coins", 6, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_spawn_loot_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_spawn_loot_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_coins"); return 0; } f32 sp30 = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_spawn_loot_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_coins"); return 0; } const BehaviorScript* coinBehavior = (const BehaviorScript*)smlua_to_cpointer(L, 4, LVT_BEHAVIORSCRIPT_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_spawn_loot_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_spawn_loot_coins"); return 0; } s16 posJitter = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_spawn_loot_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_spawn_loot_coins"); return 0; } s16 model = smlua_to_integer(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'obj_spawn_loot_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "obj_spawn_loot_coins"); return 0; } extern void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model); obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model); @@ -16002,14 +24773,20 @@ int smlua_func_obj_spawn_loot_coins(lua_State* L) { } int smlua_func_obj_spawn_loot_yellow_coins(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_spawn_loot_yellow_coins", 3, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_spawn_loot_yellow_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_yellow_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_spawn_loot_yellow_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_yellow_coins"); return 0; } f32 sp28 = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_spawn_loot_yellow_coins'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_yellow_coins"); return 0; } extern void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28); obj_spawn_loot_yellow_coins(obj, numCoins, sp28); @@ -16018,14 +24795,20 @@ int smlua_func_obj_spawn_loot_yellow_coins(lua_State* L) { } int smlua_func_obj_translate_local(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_translate_local", 3, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_translate_local'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_translate_local"); return 0; } s16 posIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_translate_local'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_translate_local"); return 0; } s16 localTranslateIndex = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_translate_local'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_translate_local"); return 0; } extern void obj_translate_local(struct Object *obj, s16 posIndex, s16 localTranslateIndex); obj_translate_local(obj, posIndex, localTranslateIndex); @@ -16034,12 +24817,18 @@ int smlua_func_obj_translate_local(lua_State* L) { } int smlua_func_obj_translate_xyz_random(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_translate_xyz_random", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_translate_xyz_random'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_translate_xyz_random"); return 0; } f32 rangeLength = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_translate_xyz_random'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_translate_xyz_random"); return 0; } extern void obj_translate_xyz_random(struct Object *obj, f32 rangeLength); obj_translate_xyz_random(obj, rangeLength); @@ -16048,12 +24837,18 @@ int smlua_func_obj_translate_xyz_random(lua_State* L) { } int smlua_func_obj_translate_xz_random(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_translate_xz_random", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_translate_xz_random'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_translate_xz_random"); return 0; } f32 rangeLength = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_translate_xz_random'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_translate_xz_random"); return 0; } extern void obj_translate_xz_random(struct Object *obj, f32 rangeLength); obj_translate_xz_random(obj, rangeLength); @@ -16062,16 +24857,22 @@ int smlua_func_obj_translate_xz_random(lua_State* L) { } int smlua_func_obj_turn_toward_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_turn_toward_object", 4, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_turn_toward_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_turn_toward_object"); return 0; } struct Object* target = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_turn_toward_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_turn_toward_object"); return 0; } s16 angleIndex = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_turn_toward_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_turn_toward_object"); return 0; } s16 turnAmount = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_turn_toward_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_turn_toward_object"); return 0; } extern s16 obj_turn_toward_object(struct Object *obj, struct Object *target, s16 angleIndex, s16 turnAmount); lua_pushinteger(L, obj_turn_toward_object(obj, target, angleIndex, turnAmount)); @@ -16079,24 +24880,68 @@ int smlua_func_obj_turn_toward_object(lua_State* L) { return 1; } -/* int smlua_func_obj_update_pos_from_parent_transformation(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } -// Mat4 a0 = (Mat4)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_update_pos_from_parent_transformation'"); return 0; } + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_update_pos_from_parent_transformation", 2, top); + return 0; + } + + + Mat4 a0; + a0[0][0] = smlua_get_number_field(1, "a"); + a0[0][1] = smlua_get_number_field(1, "b"); + a0[0][2] = smlua_get_number_field(1, "c"); + a0[0][3] = smlua_get_number_field(1, "d"); + a0[1][0] = smlua_get_number_field(1, "e"); + a0[1][1] = smlua_get_number_field(1, "f"); + a0[1][2] = smlua_get_number_field(1, "g"); + a0[1][3] = smlua_get_number_field(1, "h"); + a0[2][0] = smlua_get_number_field(1, "i"); + a0[2][1] = smlua_get_number_field(1, "j"); + a0[2][2] = smlua_get_number_field(1, "k"); + a0[2][3] = smlua_get_number_field(1, "l"); + a0[3][0] = smlua_get_number_field(1, "m"); + a0[3][1] = smlua_get_number_field(1, "n"); + a0[3][2] = smlua_get_number_field(1, "o"); + a0[3][3] = smlua_get_number_field(1, "p"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_update_pos_from_parent_transformation"); return 0; } struct Object* a1 = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_update_pos_from_parent_transformation'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_update_pos_from_parent_transformation"); return 0; } extern void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1); obj_update_pos_from_parent_transformation(a0, a1); + smlua_push_number_field(1, "a", a0[0][0]); + smlua_push_number_field(1, "b", a0[0][1]); + smlua_push_number_field(1, "c", a0[0][2]); + smlua_push_number_field(1, "d", a0[0][3]); + smlua_push_number_field(1, "e", a0[1][0]); + smlua_push_number_field(1, "f", a0[1][1]); + smlua_push_number_field(1, "g", a0[1][2]); + smlua_push_number_field(1, "h", a0[1][3]); + smlua_push_number_field(1, "i", a0[2][0]); + smlua_push_number_field(1, "j", a0[2][1]); + smlua_push_number_field(1, "k", a0[2][2]); + smlua_push_number_field(1, "l", a0[2][3]); + smlua_push_number_field(1, "m", a0[3][0]); + smlua_push_number_field(1, "n", a0[3][1]); + smlua_push_number_field(1, "o", a0[3][2]); + smlua_push_number_field(1, "p", a0[3][3]); + return 1; } -*/ int smlua_func_player_performed_grab_escape_action(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "player_performed_grab_escape_action", 0, top); + return 0; + } extern s32 player_performed_grab_escape_action(void); @@ -16106,10 +24951,16 @@ int smlua_func_player_performed_grab_escape_action(UNUSED lua_State* L) { } int smlua_func_random_f32_around_zero(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "random_f32_around_zero", 1, top); + return 0; + } f32 diameter = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'random_f32_around_zero'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "random_f32_around_zero"); return 0; } extern f32 random_f32_around_zero(f32 diameter); lua_pushnumber(L, random_f32_around_zero(diameter)); @@ -16118,14 +24969,20 @@ int smlua_func_random_f32_around_zero(lua_State* L) { } int smlua_func_set_mario_interact_hoot_if_in_range(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_mario_interact_hoot_if_in_range", 3, top); + return 0; + } s32 sp0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_mario_interact_hoot_if_in_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_mario_interact_hoot_if_in_range"); return 0; } s32 sp4 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_mario_interact_hoot_if_in_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_mario_interact_hoot_if_in_range"); return 0; } f32 sp8 = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_mario_interact_hoot_if_in_range'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_mario_interact_hoot_if_in_range"); return 0; } extern void set_mario_interact_hoot_if_in_range(UNUSED s32 sp0, UNUSED s32 sp4, f32 sp8); set_mario_interact_hoot_if_in_range(sp0, sp4, sp8); @@ -16134,10 +24991,16 @@ int smlua_func_set_mario_interact_hoot_if_in_range(lua_State* L) { } int smlua_func_set_time_stop_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_time_stop_flags", 1, top); + return 0; + } s32 flags = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_time_stop_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_time_stop_flags"); return 0; } extern void set_time_stop_flags(s32 flags); set_time_stop_flags(flags); @@ -16146,10 +25009,16 @@ int smlua_func_set_time_stop_flags(lua_State* L) { } int smlua_func_set_time_stop_flags_if_alone(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_time_stop_flags_if_alone", 1, top); + return 0; + } s32 flags = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_time_stop_flags_if_alone'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_time_stop_flags_if_alone"); return 0; } extern void set_time_stop_flags_if_alone(s32 flags); set_time_stop_flags_if_alone(flags); @@ -16158,10 +25027,16 @@ int smlua_func_set_time_stop_flags_if_alone(lua_State* L) { } int smlua_func_signum_positive(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "signum_positive", 1, top); + return 0; + } s32 x = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'signum_positive'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "signum_positive"); return 0; } extern s32 signum_positive(s32 x); lua_pushinteger(L, signum_positive(x)); @@ -16170,7 +25045,13 @@ int smlua_func_signum_positive(lua_State* L) { } int smlua_func_spawn_base_star_with_no_lvl_exit(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_base_star_with_no_lvl_exit", 0, top); + return 0; + } extern void spawn_base_star_with_no_lvl_exit(void); @@ -16180,7 +25061,13 @@ int smlua_func_spawn_base_star_with_no_lvl_exit(UNUSED lua_State* L) { } int smlua_func_spawn_mist_particles(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_mist_particles", 0, top); + return 0; + } extern void spawn_mist_particles(void); @@ -16190,10 +25077,16 @@ int smlua_func_spawn_mist_particles(UNUSED lua_State* L) { } int smlua_func_spawn_mist_particles_with_sound(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_mist_particles_with_sound", 1, top); + return 0; + } u32 sp18 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_mist_particles_with_sound'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_mist_particles_with_sound"); return 0; } extern void spawn_mist_particles_with_sound(u32 sp18); spawn_mist_particles_with_sound(sp18); @@ -16202,12 +25095,18 @@ int smlua_func_spawn_mist_particles_with_sound(lua_State* L) { } int smlua_func_spawn_star_with_no_lvl_exit(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_star_with_no_lvl_exit", 2, top); + return 0; + } s32 sp20 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_star_with_no_lvl_exit'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_star_with_no_lvl_exit"); return 0; } s32 sp24 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_star_with_no_lvl_exit'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_star_with_no_lvl_exit"); return 0; } extern struct Object *spawn_star_with_no_lvl_exit(s32 sp20, s32 sp24); smlua_push_object(L, LOT_OBJECT, spawn_star_with_no_lvl_exit(sp20, sp24)); @@ -16216,12 +25115,18 @@ int smlua_func_spawn_star_with_no_lvl_exit(lua_State* L) { } int smlua_func_spawn_water_droplet(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_water_droplet", 2, top); + return 0; + } struct Object* parent = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_water_droplet'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_water_droplet"); return 0; } struct WaterDropletParams* params = (struct WaterDropletParams*)smlua_to_cobject(L, 2, LOT_WATERDROPLETPARAMS); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_water_droplet'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_water_droplet"); return 0; } extern struct Object *spawn_water_droplet(struct Object *parent, struct WaterDropletParams *params); smlua_push_object(L, LOT_OBJECT, spawn_water_droplet(parent, params)); @@ -16230,12 +25135,18 @@ int smlua_func_spawn_water_droplet(lua_State* L) { } int smlua_func_stub_obj_helpers_3(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stub_obj_helpers_3", 2, top); + return 0; + } s32 sp0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'stub_obj_helpers_3'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "stub_obj_helpers_3"); return 0; } s32 sp4 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'stub_obj_helpers_3'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "stub_obj_helpers_3"); return 0; } extern void stub_obj_helpers_3(UNUSED s32 sp0, UNUSED s32 sp4); stub_obj_helpers_3(sp0, sp4); @@ -16244,7 +25155,13 @@ int smlua_func_stub_obj_helpers_3(lua_State* L) { } int smlua_func_stub_obj_helpers_4(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stub_obj_helpers_4", 0, top); + return 0; + } extern void stub_obj_helpers_4(void); @@ -16258,12 +25175,18 @@ int smlua_func_stub_obj_helpers_4(UNUSED lua_State* L) { ///////////////////////////// int smlua_func_set_object_respawn_info_bits(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_object_respawn_info_bits", 2, top); + return 0; + } struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_object_respawn_info_bits'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_object_respawn_info_bits"); return 0; } u8 bits = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_object_respawn_info_bits'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_object_respawn_info_bits"); return 0; } set_object_respawn_info_bits(obj, bits); @@ -16275,12 +25198,18 @@ int smlua_func_set_object_respawn_info_bits(lua_State* L) { /////////////////// int smlua_func_queue_rumble_data(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "queue_rumble_data", 2, top); + return 0; + } s16 a0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'queue_rumble_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "queue_rumble_data"); return 0; } s16 a1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'queue_rumble_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "queue_rumble_data"); return 0; } extern void queue_rumble_data(s16 a0, s16 a1); queue_rumble_data(a0, a1); @@ -16289,14 +25218,20 @@ int smlua_func_queue_rumble_data(lua_State* L) { } int smlua_func_queue_rumble_data_mario(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "queue_rumble_data_mario", 3, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'queue_rumble_data_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "queue_rumble_data_mario"); return 0; } s16 a0 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'queue_rumble_data_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "queue_rumble_data_mario"); return 0; } s16 a1 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'queue_rumble_data_mario'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "queue_rumble_data_mario"); return 0; } extern void queue_rumble_data_mario(struct MarioState* m, s16 a0, s16 a1); queue_rumble_data_mario(m, a0, a1); @@ -16305,14 +25240,20 @@ int smlua_func_queue_rumble_data_mario(lua_State* L) { } int smlua_func_queue_rumble_data_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "queue_rumble_data_object", 3, top); + return 0; + } struct Object* object = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'queue_rumble_data_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "queue_rumble_data_object"); return 0; } s16 a0 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'queue_rumble_data_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "queue_rumble_data_object"); return 0; } s16 a1 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'queue_rumble_data_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "queue_rumble_data_object"); return 0; } extern void queue_rumble_data_object(struct Object* object, s16 a0, s16 a1); queue_rumble_data_object(object, a0, a1); @@ -16321,10 +25262,16 @@ int smlua_func_queue_rumble_data_object(lua_State* L) { } int smlua_func_reset_rumble_timers(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "reset_rumble_timers", 1, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'reset_rumble_timers'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "reset_rumble_timers"); return 0; } extern void reset_rumble_timers(struct MarioState* m); reset_rumble_timers(m); @@ -16333,12 +25280,18 @@ int smlua_func_reset_rumble_timers(lua_State* L) { } int smlua_func_reset_rumble_timers_2(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "reset_rumble_timers_2", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'reset_rumble_timers_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "reset_rumble_timers_2"); return 0; } s32 a0 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'reset_rumble_timers_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "reset_rumble_timers_2"); return 0; } extern void reset_rumble_timers_2(struct MarioState* m, s32 a0); reset_rumble_timers_2(m, a0); @@ -16351,10 +25304,16 @@ int smlua_func_reset_rumble_timers_2(lua_State* L) { ///////////////// int smlua_func_save_file_clear_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_clear_flags", 1, top); + return 0; + } u32 flags = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_clear_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_clear_flags"); return 0; } save_file_clear_flags(flags); @@ -16362,7 +25321,13 @@ int smlua_func_save_file_clear_flags(lua_State* L) { } int smlua_func_save_file_erase_current_backup_save(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_erase_current_backup_save", 0, top); + return 0; + } save_file_erase_current_backup_save(); @@ -16371,14 +25336,20 @@ int smlua_func_save_file_erase_current_backup_save(UNUSED lua_State* L) { } int smlua_func_save_file_get_cap_pos(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_get_cap_pos", 1, top); + return 0; + } s16* capPos = smlua_get_vec3s_from_buffer(); capPos[0] = smlua_get_integer_field(1, "x"); capPos[1] = smlua_get_integer_field(1, "y"); capPos[2] = smlua_get_integer_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_get_cap_pos'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_get_cap_pos"); return 0; } lua_pushinteger(L, save_file_get_cap_pos(capPos)); @@ -16390,12 +25361,18 @@ int smlua_func_save_file_get_cap_pos(lua_State* L) { } int smlua_func_save_file_get_course_coin_score(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_get_course_coin_score", 2, top); + return 0; + } s32 fileIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_get_course_coin_score'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_get_course_coin_score"); return 0; } s32 courseIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'save_file_get_course_coin_score'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "save_file_get_course_coin_score"); return 0; } lua_pushinteger(L, save_file_get_course_coin_score(fileIndex, courseIndex)); @@ -16403,12 +25380,18 @@ int smlua_func_save_file_get_course_coin_score(lua_State* L) { } int smlua_func_save_file_get_course_star_count(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_get_course_star_count", 2, top); + return 0; + } s32 fileIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_get_course_star_count'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_get_course_star_count"); return 0; } s32 courseIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'save_file_get_course_star_count'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "save_file_get_course_star_count"); return 0; } lua_pushinteger(L, save_file_get_course_star_count(fileIndex, courseIndex)); @@ -16416,7 +25399,13 @@ int smlua_func_save_file_get_course_star_count(lua_State* L) { } int smlua_func_save_file_get_flags(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_get_flags", 0, top); + return 0; + } lua_pushinteger(L, save_file_get_flags()); @@ -16425,10 +25414,16 @@ int smlua_func_save_file_get_flags(UNUSED lua_State* L) { } int smlua_func_save_file_get_max_coin_score(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_get_max_coin_score", 1, top); + return 0; + } s32 courseIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_get_max_coin_score'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_get_max_coin_score"); return 0; } lua_pushinteger(L, save_file_get_max_coin_score(courseIndex)); @@ -16436,7 +25431,13 @@ int smlua_func_save_file_get_max_coin_score(lua_State* L) { } int smlua_func_save_file_get_sound_mode(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_get_sound_mode", 0, top); + return 0; + } lua_pushinteger(L, save_file_get_sound_mode()); @@ -16445,12 +25446,18 @@ int smlua_func_save_file_get_sound_mode(UNUSED lua_State* L) { } int smlua_func_save_file_get_star_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_get_star_flags", 2, top); + return 0; + } s32 fileIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_get_star_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_get_star_flags"); return 0; } s32 courseIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'save_file_get_star_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "save_file_get_star_flags"); return 0; } lua_pushinteger(L, save_file_get_star_flags(fileIndex, courseIndex)); @@ -16458,14 +25465,20 @@ int smlua_func_save_file_get_star_flags(lua_State* L) { } int smlua_func_save_file_get_total_star_count(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_get_total_star_count", 3, top); + return 0; + } s32 fileIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_get_total_star_count'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_get_total_star_count"); return 0; } s32 minCourse = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'save_file_get_total_star_count'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "save_file_get_total_star_count"); return 0; } s32 maxCourse = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'save_file_get_total_star_count'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "save_file_get_total_star_count"); return 0; } lua_pushinteger(L, save_file_get_total_star_count(fileIndex, minCourse, maxCourse)); @@ -16473,10 +25486,16 @@ int smlua_func_save_file_get_total_star_count(lua_State* L) { } int smlua_func_save_file_reload(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_reload", 1, top); + return 0; + } u8 load_all = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_reload'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_reload"); return 0; } save_file_reload(load_all); @@ -16484,10 +25503,16 @@ int smlua_func_save_file_reload(lua_State* L) { } int smlua_func_save_file_set_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_set_flags", 1, top); + return 0; + } u32 flags = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_set_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_set_flags"); return 0; } save_file_set_flags(flags); @@ -16495,14 +25520,20 @@ int smlua_func_save_file_set_flags(lua_State* L) { } int smlua_func_save_file_set_star_flags(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_set_star_flags", 3, top); + return 0; + } s32 fileIndex = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_set_star_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_set_star_flags"); return 0; } s32 courseIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'save_file_set_star_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "save_file_set_star_flags"); return 0; } u32 starFlags = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'save_file_set_star_flags'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "save_file_set_star_flags"); return 0; } save_file_set_star_flags(fileIndex, courseIndex, starFlags); @@ -16514,10 +25545,16 @@ int smlua_func_save_file_set_star_flags(lua_State* L) { ///////////////////////// int smlua_func_audio_sample_destroy(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_sample_destroy", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_sample_destroy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_sample_destroy"); return 0; } audio_sample_destroy(audio); @@ -16525,10 +25562,16 @@ int smlua_func_audio_sample_destroy(lua_State* L) { } int smlua_func_audio_sample_load(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_sample_load", 1, top); + return 0; + } const char* filename = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_sample_load'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_sample_load"); return 0; } smlua_push_object(L, LOT_BASSAUDIO, audio_sample_load(filename)); @@ -16536,18 +25579,24 @@ int smlua_func_audio_sample_load(lua_State* L) { } int smlua_func_audio_sample_play(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_sample_play", 3, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_sample_play'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_sample_play"); return 0; } f32* position = smlua_get_vec3f_from_buffer(); position[0] = smlua_get_number_field(2, "x"); position[1] = smlua_get_number_field(2, "y"); position[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'audio_sample_play'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "audio_sample_play"); return 0; } f32 volume = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'audio_sample_play'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "audio_sample_play"); return 0; } audio_sample_play(audio, position, volume); @@ -16559,10 +25608,16 @@ int smlua_func_audio_sample_play(lua_State* L) { } int smlua_func_audio_sample_stop(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_sample_stop", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_sample_stop'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_sample_stop"); return 0; } audio_sample_stop(audio); @@ -16570,10 +25625,16 @@ int smlua_func_audio_sample_stop(lua_State* L) { } int smlua_func_audio_stream_destroy(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_destroy", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_destroy'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_destroy"); return 0; } audio_stream_destroy(audio); @@ -16581,10 +25642,16 @@ int smlua_func_audio_stream_destroy(lua_State* L) { } int smlua_func_audio_stream_get_frequency(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_get_frequency", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_get_frequency'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_get_frequency"); return 0; } lua_pushnumber(L, audio_stream_get_frequency(audio)); @@ -16592,10 +25659,16 @@ int smlua_func_audio_stream_get_frequency(lua_State* L) { } int smlua_func_audio_stream_get_looping(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_get_looping", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_get_looping'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_get_looping"); return 0; } lua_pushboolean(L, audio_stream_get_looping(audio)); @@ -16603,10 +25676,16 @@ int smlua_func_audio_stream_get_looping(lua_State* L) { } int smlua_func_audio_stream_get_position(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_get_position", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_get_position'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_get_position"); return 0; } lua_pushnumber(L, audio_stream_get_position(audio)); @@ -16614,10 +25693,16 @@ int smlua_func_audio_stream_get_position(lua_State* L) { } int smlua_func_audio_stream_get_tempo(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_get_tempo", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_get_tempo'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_get_tempo"); return 0; } lua_pushnumber(L, audio_stream_get_tempo(audio)); @@ -16625,10 +25710,16 @@ int smlua_func_audio_stream_get_tempo(lua_State* L) { } int smlua_func_audio_stream_get_volume(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_get_volume", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_get_volume'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_get_volume"); return 0; } lua_pushnumber(L, audio_stream_get_volume(audio)); @@ -16636,10 +25727,16 @@ int smlua_func_audio_stream_get_volume(lua_State* L) { } int smlua_func_audio_stream_load(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_load", 1, top); + return 0; + } const char* filename = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_load'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_load"); return 0; } smlua_push_object(L, LOT_BASSAUDIO, audio_stream_load(filename)); @@ -16647,10 +25744,16 @@ int smlua_func_audio_stream_load(lua_State* L) { } int smlua_func_audio_stream_load_url(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_load_url", 1, top); + return 0; + } const char* url = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_load_url'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_load_url"); return 0; } smlua_push_object(L, LOT_BASSAUDIO, audio_stream_load_url(url)); @@ -16658,10 +25761,16 @@ int smlua_func_audio_stream_load_url(lua_State* L) { } int smlua_func_audio_stream_pause(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_pause", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_pause'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_pause"); return 0; } audio_stream_pause(audio); @@ -16669,14 +25778,20 @@ int smlua_func_audio_stream_pause(lua_State* L) { } int smlua_func_audio_stream_play(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_play", 3, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_play'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_play"); return 0; } bool restart = smlua_to_boolean(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'audio_stream_play'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "audio_stream_play"); return 0; } f32 volume = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'audio_stream_play'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "audio_stream_play"); return 0; } audio_stream_play(audio, restart, volume); @@ -16684,12 +25799,18 @@ int smlua_func_audio_stream_play(lua_State* L) { } int smlua_func_audio_stream_set_frequency(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_set_frequency", 2, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_set_frequency'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_set_frequency"); return 0; } f32 freq = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'audio_stream_set_frequency'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "audio_stream_set_frequency"); return 0; } audio_stream_set_frequency(audio, freq); @@ -16697,12 +25818,18 @@ int smlua_func_audio_stream_set_frequency(lua_State* L) { } int smlua_func_audio_stream_set_looping(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_set_looping", 2, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_set_looping'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_set_looping"); return 0; } bool looping = smlua_to_boolean(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'audio_stream_set_looping'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "audio_stream_set_looping"); return 0; } audio_stream_set_looping(audio, looping); @@ -16710,12 +25837,18 @@ int smlua_func_audio_stream_set_looping(lua_State* L) { } int smlua_func_audio_stream_set_position(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_set_position", 2, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_set_position'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_set_position"); return 0; } f32 pos = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'audio_stream_set_position'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "audio_stream_set_position"); return 0; } audio_stream_set_position(audio, pos); @@ -16723,16 +25856,22 @@ int smlua_func_audio_stream_set_position(lua_State* L) { } int smlua_func_audio_stream_set_speed(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_set_speed", 4, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_set_speed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_set_speed"); return 0; } f32 initial_freq = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'audio_stream_set_speed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "audio_stream_set_speed"); return 0; } f32 speed = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'audio_stream_set_speed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "audio_stream_set_speed"); return 0; } bool pitch = smlua_to_boolean(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'audio_stream_set_speed'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "audio_stream_set_speed"); return 0; } audio_stream_set_speed(audio, initial_freq, speed, pitch); @@ -16740,12 +25879,18 @@ int smlua_func_audio_stream_set_speed(lua_State* L) { } int smlua_func_audio_stream_set_tempo(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_set_tempo", 2, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_set_tempo'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_set_tempo"); return 0; } f32 tempo = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'audio_stream_set_tempo'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "audio_stream_set_tempo"); return 0; } audio_stream_set_tempo(audio, tempo); @@ -16753,12 +25898,18 @@ int smlua_func_audio_stream_set_tempo(lua_State* L) { } int smlua_func_audio_stream_set_volume(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_set_volume", 2, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_set_volume'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_set_volume"); return 0; } f32 volume = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'audio_stream_set_volume'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "audio_stream_set_volume"); return 0; } audio_stream_set_volume(audio, volume); @@ -16766,10 +25917,16 @@ int smlua_func_audio_stream_set_volume(lua_State* L) { } int smlua_func_audio_stream_stop(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_stop", 1, top); + return 0; + } struct BassAudio* audio = (struct BassAudio*)smlua_to_cobject(L, 1, LOT_BASSAUDIO); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'audio_stream_stop'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_stop"); return 0; } audio_stream_stop(audio); @@ -16777,16 +25934,22 @@ int smlua_func_audio_stream_stop(lua_State* L) { } int smlua_func_smlua_audio_utils_replace_sequence(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_audio_utils_replace_sequence", 4, top); + return 0; + } u8 sequenceId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_audio_utils_replace_sequence'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_audio_utils_replace_sequence"); return 0; } u8 bankId = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'smlua_audio_utils_replace_sequence'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "smlua_audio_utils_replace_sequence"); return 0; } u8 defaultVolume = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'smlua_audio_utils_replace_sequence'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "smlua_audio_utils_replace_sequence"); return 0; } const char* m64Name = smlua_to_string(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'smlua_audio_utils_replace_sequence'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "smlua_audio_utils_replace_sequence"); return 0; } smlua_audio_utils_replace_sequence(sequenceId, bankId, defaultVolume, m64Name); @@ -16794,7 +25957,13 @@ int smlua_func_smlua_audio_utils_replace_sequence(lua_State* L) { } int smlua_func_smlua_audio_utils_reset_all(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_audio_utils_reset_all", 0, top); + return 0; + } smlua_audio_utils_reset_all(); @@ -16807,20 +25976,26 @@ int smlua_func_smlua_audio_utils_reset_all(UNUSED lua_State* L) { ///////////////////////////// int smlua_func_collision_find_surface_on_ray(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "collision_find_surface_on_ray", 6, top); + return 0; + } f32 startX = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'collision_find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "collision_find_surface_on_ray"); return 0; } f32 startY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'collision_find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "collision_find_surface_on_ray"); return 0; } f32 startZ = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'collision_find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "collision_find_surface_on_ray"); return 0; } f32 endX = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'collision_find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "collision_find_surface_on_ray"); return 0; } f32 endY = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'collision_find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "collision_find_surface_on_ray"); return 0; } f32 endZ = smlua_to_number(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'collision_find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "collision_find_surface_on_ray"); return 0; } smlua_push_object(L, LOT_RAYINTERSECTIONINFO, collision_find_surface_on_ray(startX, startY, startZ, endX, endY, endZ)); @@ -16828,7 +26003,13 @@ int smlua_func_collision_find_surface_on_ray(lua_State* L) { } int smlua_func_get_water_surface_pseudo_floor(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_water_surface_pseudo_floor", 0, top); + return 0; + } smlua_push_object(L, LOT_SURFACE, get_water_surface_pseudo_floor()); @@ -16837,10 +26018,16 @@ int smlua_func_get_water_surface_pseudo_floor(UNUSED lua_State* L) { } int smlua_func_smlua_collision_util_get(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_collision_util_get", 1, top); + return 0; + } const char* name = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_collision_util_get'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_collision_util_get"); return 0; } smlua_push_pointer(L, LVT_COLLISION_P, (void*)smlua_collision_util_get(name)); @@ -16852,24 +26039,30 @@ int smlua_func_smlua_collision_util_get(lua_State* L) { ///////////////////////// int smlua_func_level_register(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 8)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 8) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "level_register", 8, top); + return 0; + } const char* scriptEntryName = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'level_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "level_register"); return 0; } s16 courseNum = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'level_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "level_register"); return 0; } const char* fullName = smlua_to_string(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'level_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "level_register"); return 0; } const char* shortName = smlua_to_string(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'level_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "level_register"); return 0; } u32 acousticReach = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'level_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "level_register"); return 0; } u32 echoLevel1 = smlua_to_integer(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'level_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "level_register"); return 0; } u32 echoLevel2 = smlua_to_integer(L, 7); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'level_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "level_register"); return 0; } u32 echoLevel3 = smlua_to_integer(L, 8); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 8 for function 'level_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 8, "level_register"); return 0; } lua_pushinteger(L, level_register(scriptEntryName, courseNum, fullName, shortName, acousticReach, echoLevel1, echoLevel2, echoLevel3)); @@ -16877,10 +26070,16 @@ int smlua_func_level_register(lua_State* L) { } int smlua_func_smlua_level_util_get_info(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_level_util_get_info", 1, top); + return 0; + } s16 levelNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_level_util_get_info'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_level_util_get_info"); return 0; } smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info(levelNum)); @@ -16888,10 +26087,16 @@ int smlua_func_smlua_level_util_get_info(lua_State* L) { } int smlua_func_smlua_level_util_get_info_from_short_name(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_level_util_get_info_from_short_name", 1, top); + return 0; + } char* shortName = (char*)smlua_to_cobject(L, 1, LOT_NONE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_level_util_get_info_from_short_name'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_level_util_get_info_from_short_name"); return 0; } smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info_from_short_name(shortName)); @@ -16899,10 +26104,16 @@ int smlua_func_smlua_level_util_get_info_from_short_name(lua_State* L) { } int smlua_func_warp_exit_level(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "warp_exit_level", 1, top); + return 0; + } s32 aDelay = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'warp_exit_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "warp_exit_level"); return 0; } lua_pushboolean(L, warp_exit_level(aDelay)); @@ -16910,7 +26121,13 @@ int smlua_func_warp_exit_level(lua_State* L) { } int smlua_func_warp_restart_level(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "warp_restart_level", 0, top); + return 0; + } lua_pushboolean(L, warp_restart_level()); @@ -16919,10 +26136,16 @@ int smlua_func_warp_restart_level(UNUSED lua_State* L) { } int smlua_func_warp_to_castle(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "warp_to_castle", 1, top); + return 0; + } s32 aLevel = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'warp_to_castle'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "warp_to_castle"); return 0; } lua_pushboolean(L, warp_to_castle(aLevel)); @@ -16930,14 +26153,20 @@ int smlua_func_warp_to_castle(lua_State* L) { } int smlua_func_warp_to_level(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "warp_to_level", 3, top); + return 0; + } s32 aLevel = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'warp_to_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "warp_to_level"); return 0; } s32 aArea = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'warp_to_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "warp_to_level"); return 0; } s32 aAct = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'warp_to_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "warp_to_level"); return 0; } lua_pushboolean(L, warp_to_level(aLevel, aArea, aAct)); @@ -16945,7 +26174,13 @@ int smlua_func_warp_to_level(lua_State* L) { } int smlua_func_warp_to_start_level(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "warp_to_start_level", 0, top); + return 0; + } lua_pushboolean(L, warp_to_start_level()); @@ -16954,16 +26189,22 @@ int smlua_func_warp_to_start_level(UNUSED lua_State* L) { } int smlua_func_warp_to_warpnode(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "warp_to_warpnode", 4, top); + return 0; + } s32 aLevel = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'warp_to_warpnode'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "warp_to_warpnode"); return 0; } s32 aArea = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'warp_to_warpnode'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "warp_to_warpnode"); return 0; } s32 aAct = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'warp_to_warpnode'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "warp_to_warpnode"); return 0; } s32 aWarpId = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'warp_to_warpnode'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "warp_to_warpnode"); return 0; } lua_pushboolean(L, warp_to_warpnode(aLevel, aArea, aAct, aWarpId)); @@ -16975,14 +26216,20 @@ int smlua_func_warp_to_warpnode(lua_State* L) { //////////////////////// int smlua_func_clamp(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clamp", 3, top); + return 0; + } s32 a = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'clamp'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "clamp"); return 0; } s32 b = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'clamp'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "clamp"); return 0; } s32 c = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'clamp'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "clamp"); return 0; } lua_pushinteger(L, clamp(a, b, c)); @@ -16990,14 +26237,20 @@ int smlua_func_clamp(lua_State* L) { } int smlua_func_clampf(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clampf", 3, top); + return 0; + } f32 a = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'clampf'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "clampf"); return 0; } f32 b = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'clampf'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "clampf"); return 0; } f32 c = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'clampf'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "clampf"); return 0; } lua_pushnumber(L, clampf(a, b, c)); @@ -17005,12 +26258,18 @@ int smlua_func_clampf(lua_State* L) { } int smlua_func_max(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "max", 2, top); + return 0; + } s32 a = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'max'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "max"); return 0; } s32 b = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'max'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "max"); return 0; } lua_pushinteger(L, max(a, b)); @@ -17018,12 +26277,18 @@ int smlua_func_max(lua_State* L) { } int smlua_func_maxf(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "maxf", 2, top); + return 0; + } f32 a = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'maxf'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "maxf"); return 0; } f32 b = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'maxf'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "maxf"); return 0; } lua_pushnumber(L, maxf(a, b)); @@ -17031,12 +26296,18 @@ int smlua_func_maxf(lua_State* L) { } int smlua_func_min(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "min", 2, top); + return 0; + } s32 a = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'min'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "min"); return 0; } s32 b = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'min'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "min"); return 0; } lua_pushinteger(L, min(a, b)); @@ -17044,12 +26315,18 @@ int smlua_func_min(lua_State* L) { } int smlua_func_minf(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "minf", 2, top); + return 0; + } f32 a = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'minf'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "minf"); return 0; } f32 b = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'minf'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "minf"); return 0; } lua_pushnumber(L, minf(a, b)); @@ -17057,10 +26334,16 @@ int smlua_func_minf(lua_State* L) { } int smlua_func_sqr(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "sqr", 1, top); + return 0; + } s32 x = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'sqr'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sqr"); return 0; } lua_pushinteger(L, sqr(x)); @@ -17068,10 +26351,16 @@ int smlua_func_sqr(lua_State* L) { } int smlua_func_sqrf(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "sqrf", 1, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'sqrf'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sqrf"); return 0; } lua_pushnumber(L, sqrf(x)); @@ -17083,16 +26372,22 @@ int smlua_func_sqrf(lua_State* L) { //////////////////////// int smlua_func_add_scroll_target(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "add_scroll_target", 4, top); + return 0; + } u32 index = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'add_scroll_target'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "add_scroll_target"); return 0; } const char* name = smlua_to_string(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'add_scroll_target'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "add_scroll_target"); return 0; } u32 offset = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'add_scroll_target'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "add_scroll_target"); return 0; } u32 size = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'add_scroll_target'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "add_scroll_target"); return 0; } add_scroll_target(index, name, offset, size); @@ -17100,10 +26395,16 @@ int smlua_func_add_scroll_target(lua_State* L) { } int smlua_func_allocate_mario_action(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "allocate_mario_action", 1, top); + return 0; + } u32 actFlags = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'allocate_mario_action'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "allocate_mario_action"); return 0; } lua_pushinteger(L, allocate_mario_action(actFlags)); @@ -17111,10 +26412,16 @@ int smlua_func_allocate_mario_action(lua_State* L) { } int smlua_func_camera_config_enable_analog_cam(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_enable_analog_cam", 1, top); + return 0; + } bool enable = smlua_to_boolean(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_enable_analog_cam'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_enable_analog_cam"); return 0; } camera_config_enable_analog_cam(enable); @@ -17122,10 +26429,16 @@ int smlua_func_camera_config_enable_analog_cam(lua_State* L) { } int smlua_func_camera_config_enable_free_cam(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_enable_free_cam", 1, top); + return 0; + } bool enable = smlua_to_boolean(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_enable_free_cam'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_enable_free_cam"); return 0; } camera_config_enable_free_cam(enable); @@ -17133,10 +26446,16 @@ int smlua_func_camera_config_enable_free_cam(lua_State* L) { } int smlua_func_camera_config_enable_mouse_look(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_enable_mouse_look", 1, top); + return 0; + } bool enable = smlua_to_boolean(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_enable_mouse_look'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_enable_mouse_look"); return 0; } camera_config_enable_mouse_look(enable); @@ -17144,7 +26463,13 @@ int smlua_func_camera_config_enable_mouse_look(lua_State* L) { } int smlua_func_camera_config_get_aggression(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_get_aggression", 0, top); + return 0; + } lua_pushinteger(L, camera_config_get_aggression()); @@ -17153,7 +26478,13 @@ int smlua_func_camera_config_get_aggression(UNUSED lua_State* L) { } int smlua_func_camera_config_get_deceleration(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_get_deceleration", 0, top); + return 0; + } lua_pushinteger(L, camera_config_get_deceleration()); @@ -17162,7 +26493,13 @@ int smlua_func_camera_config_get_deceleration(UNUSED lua_State* L) { } int smlua_func_camera_config_get_pan_level(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_get_pan_level", 0, top); + return 0; + } lua_pushinteger(L, camera_config_get_pan_level()); @@ -17171,7 +26508,13 @@ int smlua_func_camera_config_get_pan_level(UNUSED lua_State* L) { } int smlua_func_camera_config_get_x_sensitivity(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_get_x_sensitivity", 0, top); + return 0; + } lua_pushinteger(L, camera_config_get_x_sensitivity()); @@ -17180,7 +26523,13 @@ int smlua_func_camera_config_get_x_sensitivity(UNUSED lua_State* L) { } int smlua_func_camera_config_get_y_sensitivity(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_get_y_sensitivity", 0, top); + return 0; + } lua_pushinteger(L, camera_config_get_y_sensitivity()); @@ -17189,10 +26538,16 @@ int smlua_func_camera_config_get_y_sensitivity(UNUSED lua_State* L) { } int smlua_func_camera_config_invert_x(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_invert_x", 1, top); + return 0; + } bool invert = smlua_to_boolean(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_invert_x'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_invert_x"); return 0; } camera_config_invert_x(invert); @@ -17200,10 +26555,16 @@ int smlua_func_camera_config_invert_x(lua_State* L) { } int smlua_func_camera_config_invert_y(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_invert_y", 1, top); + return 0; + } bool invert = smlua_to_boolean(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_invert_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_invert_y"); return 0; } camera_config_invert_y(invert); @@ -17211,7 +26572,13 @@ int smlua_func_camera_config_invert_y(lua_State* L) { } int smlua_func_camera_config_is_analog_cam_enabled(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_is_analog_cam_enabled", 0, top); + return 0; + } lua_pushboolean(L, camera_config_is_analog_cam_enabled()); @@ -17220,7 +26587,13 @@ int smlua_func_camera_config_is_analog_cam_enabled(UNUSED lua_State* L) { } int smlua_func_camera_config_is_free_cam_enabled(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_is_free_cam_enabled", 0, top); + return 0; + } lua_pushboolean(L, camera_config_is_free_cam_enabled()); @@ -17229,7 +26602,13 @@ int smlua_func_camera_config_is_free_cam_enabled(UNUSED lua_State* L) { } int smlua_func_camera_config_is_mouse_look_enabled(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_is_mouse_look_enabled", 0, top); + return 0; + } lua_pushboolean(L, camera_config_is_mouse_look_enabled()); @@ -17238,7 +26617,13 @@ int smlua_func_camera_config_is_mouse_look_enabled(UNUSED lua_State* L) { } int smlua_func_camera_config_is_x_inverted(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_is_x_inverted", 0, top); + return 0; + } lua_pushboolean(L, camera_config_is_x_inverted()); @@ -17247,7 +26632,13 @@ int smlua_func_camera_config_is_x_inverted(UNUSED lua_State* L) { } int smlua_func_camera_config_is_y_inverted(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_is_y_inverted", 0, top); + return 0; + } lua_pushboolean(L, camera_config_is_y_inverted()); @@ -17256,10 +26647,16 @@ int smlua_func_camera_config_is_y_inverted(UNUSED lua_State* L) { } int smlua_func_camera_config_set_aggression(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_set_aggression", 1, top); + return 0; + } u32 value = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_set_aggression'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_set_aggression"); return 0; } camera_config_set_aggression(value); @@ -17267,10 +26664,16 @@ int smlua_func_camera_config_set_aggression(lua_State* L) { } int smlua_func_camera_config_set_deceleration(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_set_deceleration", 1, top); + return 0; + } u32 value = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_set_deceleration'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_set_deceleration"); return 0; } camera_config_set_deceleration(value); @@ -17278,10 +26681,16 @@ int smlua_func_camera_config_set_deceleration(lua_State* L) { } int smlua_func_camera_config_set_pan_level(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_set_pan_level", 1, top); + return 0; + } u32 value = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_set_pan_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_set_pan_level"); return 0; } camera_config_set_pan_level(value); @@ -17289,10 +26698,16 @@ int smlua_func_camera_config_set_pan_level(lua_State* L) { } int smlua_func_camera_config_set_x_sensitivity(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_set_x_sensitivity", 1, top); + return 0; + } u32 value = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_set_x_sensitivity'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_set_x_sensitivity"); return 0; } camera_config_set_x_sensitivity(value); @@ -17300,10 +26715,16 @@ int smlua_func_camera_config_set_x_sensitivity(lua_State* L) { } int smlua_func_camera_config_set_y_sensitivity(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_config_set_y_sensitivity", 1, top); + return 0; + } u32 value = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'camera_config_set_y_sensitivity'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_config_set_y_sensitivity"); return 0; } camera_config_set_y_sensitivity(value); @@ -17311,7 +26732,13 @@ int smlua_func_camera_config_set_y_sensitivity(lua_State* L) { } int smlua_func_camera_freeze(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_freeze", 0, top); + return 0; + } camera_freeze(); @@ -17320,7 +26747,13 @@ int smlua_func_camera_freeze(UNUSED lua_State* L) { } int smlua_func_camera_unfreeze(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_unfreeze", 0, top); + return 0; + } camera_unfreeze(); @@ -17329,10 +26762,16 @@ int smlua_func_camera_unfreeze(UNUSED lua_State* L) { } int smlua_func_deref_s32_pointer(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "deref_s32_pointer", 1, top); + return 0; + } s32* pointer = (s32*)smlua_to_cpointer(L, 1, LVT_S32_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'deref_s32_pointer'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "deref_s32_pointer"); return 0; } lua_pushinteger(L, deref_s32_pointer(pointer)); @@ -17340,7 +26779,13 @@ int smlua_func_deref_s32_pointer(lua_State* L) { } int smlua_func_get_current_save_file_num(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_current_save_file_num", 0, top); + return 0; + } lua_pushinteger(L, get_current_save_file_num()); @@ -17349,7 +26794,13 @@ int smlua_func_get_current_save_file_num(UNUSED lua_State* L) { } int smlua_func_get_dialog_box_state(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_dialog_box_state", 0, top); + return 0; + } lua_pushinteger(L, get_dialog_box_state()); @@ -17358,7 +26809,13 @@ int smlua_func_get_dialog_box_state(UNUSED lua_State* L) { } int smlua_func_get_dialog_id(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_dialog_id", 0, top); + return 0; + } lua_pushinteger(L, get_dialog_id()); @@ -17367,10 +26824,16 @@ int smlua_func_get_dialog_id(UNUSED lua_State* L) { } int smlua_func_get_environment_region(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_environment_region", 1, top); + return 0; + } u8 index = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_environment_region'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_environment_region"); return 0; } lua_pushnumber(L, get_environment_region(index)); @@ -17378,12 +26841,18 @@ int smlua_func_get_environment_region(lua_State* L) { } int smlua_func_get_hand_foot_pos_x(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_hand_foot_pos_x", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_hand_foot_pos_x'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_hand_foot_pos_x"); return 0; } u8 index = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_hand_foot_pos_x'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_hand_foot_pos_x"); return 0; } lua_pushnumber(L, get_hand_foot_pos_x(m, index)); @@ -17391,12 +26860,18 @@ int smlua_func_get_hand_foot_pos_x(lua_State* L) { } int smlua_func_get_hand_foot_pos_y(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_hand_foot_pos_y", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_hand_foot_pos_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_hand_foot_pos_y"); return 0; } u8 index = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_hand_foot_pos_y'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_hand_foot_pos_y"); return 0; } lua_pushnumber(L, get_hand_foot_pos_y(m, index)); @@ -17404,12 +26879,18 @@ int smlua_func_get_hand_foot_pos_y(lua_State* L) { } int smlua_func_get_hand_foot_pos_z(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_hand_foot_pos_z", 2, top); + return 0; + } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_hand_foot_pos_z'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_hand_foot_pos_z"); return 0; } u8 index = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'get_hand_foot_pos_z'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_hand_foot_pos_z"); return 0; } lua_pushnumber(L, get_hand_foot_pos_z(m, index)); @@ -17417,7 +26898,13 @@ int smlua_func_get_hand_foot_pos_z(lua_State* L) { } int smlua_func_get_last_star_or_key(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_last_star_or_key", 0, top); + return 0; + } lua_pushinteger(L, get_last_star_or_key()); @@ -17426,7 +26913,13 @@ int smlua_func_get_last_star_or_key(UNUSED lua_State* L) { } int smlua_func_get_network_area_timer(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_network_area_timer", 0, top); + return 0; + } lua_pushinteger(L, get_network_area_timer()); @@ -17435,10 +26928,16 @@ int smlua_func_get_network_area_timer(UNUSED lua_State* L) { } int smlua_func_get_temp_s32_pointer(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_temp_s32_pointer", 1, top); + return 0; + } s32 initialValue = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_temp_s32_pointer'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_temp_s32_pointer"); return 0; } smlua_push_pointer(L, LVT_S32_P, (void*)get_temp_s32_pointer(initialValue)); @@ -17446,10 +26945,16 @@ int smlua_func_get_temp_s32_pointer(lua_State* L) { } int smlua_func_hud_get_value(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hud_get_value", 1, top); + return 0; + } int type = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'hud_get_value'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "hud_get_value"); return 0; } lua_pushinteger(L, hud_get_value(type)); @@ -17457,7 +26962,13 @@ int smlua_func_hud_get_value(lua_State* L) { } int smlua_func_hud_hide(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hud_hide", 0, top); + return 0; + } hud_hide(); @@ -17466,18 +26977,24 @@ int smlua_func_hud_hide(UNUSED lua_State* L) { } int smlua_func_hud_render_power_meter(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hud_render_power_meter", 5, top); + return 0; + } s32 health = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'hud_render_power_meter'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "hud_render_power_meter"); return 0; } f32 x = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'hud_render_power_meter'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "hud_render_power_meter"); return 0; } f32 y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'hud_render_power_meter'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "hud_render_power_meter"); return 0; } f32 width = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'hud_render_power_meter'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "hud_render_power_meter"); return 0; } f32 height = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'hud_render_power_meter'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "hud_render_power_meter"); return 0; } hud_render_power_meter(health, x, y, width, height); @@ -17485,12 +27002,18 @@ int smlua_func_hud_render_power_meter(lua_State* L) { } int smlua_func_hud_set_value(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hud_set_value", 2, top); + return 0; + } int type = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'hud_set_value'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "hud_set_value"); return 0; } s32 value = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'hud_set_value'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "hud_set_value"); return 0; } hud_set_value(type, value); @@ -17498,7 +27021,13 @@ int smlua_func_hud_set_value(lua_State* L) { } int smlua_func_hud_show(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hud_show", 0, top); + return 0; + } hud_show(); @@ -17507,7 +27036,13 @@ int smlua_func_hud_show(UNUSED lua_State* L) { } int smlua_func_is_game_paused(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_game_paused", 0, top); + return 0; + } lua_pushboolean(L, is_game_paused()); @@ -17516,7 +27051,13 @@ int smlua_func_is_game_paused(UNUSED lua_State* L) { } int smlua_func_is_transition_playing(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "is_transition_playing", 0, top); + return 0; + } lua_pushboolean(L, is_transition_playing()); @@ -17525,16 +27066,22 @@ int smlua_func_is_transition_playing(UNUSED lua_State* L) { } int smlua_func_movtexqc_register(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "movtexqc_register", 4, top); + return 0; + } const char* name = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'movtexqc_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "movtexqc_register"); return 0; } s16 level = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'movtexqc_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "movtexqc_register"); return 0; } s16 area = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'movtexqc_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "movtexqc_register"); return 0; } s16 type = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'movtexqc_register'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "movtexqc_register"); return 0; } movtexqc_register(name, level, area, type); @@ -17542,18 +27089,24 @@ int smlua_func_movtexqc_register(lua_State* L) { } int smlua_func_play_transition(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 5)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 5) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_transition", 5, top); + return 0; + } s16 transType = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_transition'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_transition"); return 0; } s16 time = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'play_transition'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "play_transition"); return 0; } u8 red = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'play_transition'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "play_transition"); return 0; } u8 green = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'play_transition'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "play_transition"); return 0; } u8 blue = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'play_transition'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "play_transition"); return 0; } play_transition(transType, time, red, green, blue); @@ -17561,10 +27114,16 @@ int smlua_func_play_transition(lua_State* L) { } int smlua_func_save_file_set_using_backup_slot(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_set_using_backup_slot", 1, top); + return 0; + } bool usingBackupSlot = smlua_to_boolean(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'save_file_set_using_backup_slot'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_set_using_backup_slot"); return 0; } save_file_set_using_backup_slot(usingBackupSlot); @@ -17572,12 +27131,18 @@ int smlua_func_save_file_set_using_backup_slot(lua_State* L) { } int smlua_func_set_environment_region(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_environment_region", 2, top); + return 0; + } u8 index = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_environment_region'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_environment_region"); return 0; } s32 value = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_environment_region'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_environment_region"); return 0; } set_environment_region(index, value); @@ -17585,10 +27150,16 @@ int smlua_func_set_environment_region(lua_State* L) { } int smlua_func_set_last_star_or_key(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_last_star_or_key", 1, top); + return 0; + } u8 value = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_last_star_or_key'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_last_star_or_key"); return 0; } set_last_star_or_key(value); @@ -17596,10 +27167,16 @@ int smlua_func_set_last_star_or_key(lua_State* L) { } int smlua_func_set_override_far(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_override_far", 1, top); + return 0; + } f32 far = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_override_far'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_override_far"); return 0; } set_override_far(far); @@ -17607,10 +27184,16 @@ int smlua_func_set_override_far(lua_State* L) { } int smlua_func_set_override_fov(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_override_fov", 1, top); + return 0; + } f32 fov = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_override_fov'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_override_fov"); return 0; } set_override_fov(fov); @@ -17618,10 +27201,16 @@ int smlua_func_set_override_fov(lua_State* L) { } int smlua_func_set_override_near(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_override_near", 1, top); + return 0; + } f32 near = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_override_near'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_override_near"); return 0; } set_override_near(near); @@ -17633,10 +27222,16 @@ int smlua_func_set_override_near(lua_State* L) { ///////////////////////// int smlua_func_smlua_model_util_get_id(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_model_util_get_id", 1, top); + return 0; + } const char* name = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_model_util_get_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_model_util_get_id"); return 0; } lua_pushinteger(L, smlua_model_util_get_id(name)); @@ -17648,7 +27243,13 @@ int smlua_func_smlua_model_util_get_id(lua_State* L) { /////////////////////// int smlua_func_get_temp_object_hitbox(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_temp_object_hitbox", 0, top); + return 0; + } smlua_push_object(L, LOT_OBJECTHITBOX, get_temp_object_hitbox()); @@ -17657,10 +27258,16 @@ int smlua_func_get_temp_object_hitbox(UNUSED lua_State* L) { } int smlua_func_get_trajectory(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_trajectory", 1, top); + return 0; + } const char* name = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_trajectory'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_trajectory"); return 0; } smlua_push_pointer(L, LVT_TRAJECTORY_P, (void*)get_trajectory(name)); @@ -17668,12 +27275,18 @@ int smlua_func_get_trajectory(lua_State* L) { } int smlua_func_obj_check_hitbox_overlap(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_check_hitbox_overlap", 2, top); + return 0; + } struct Object* o1 = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_check_hitbox_overlap'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_check_hitbox_overlap"); return 0; } struct Object* o2 = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_check_hitbox_overlap'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_check_hitbox_overlap"); return 0; } lua_pushboolean(L, obj_check_hitbox_overlap(o1, o2)); @@ -17681,22 +27294,28 @@ int smlua_func_obj_check_hitbox_overlap(lua_State* L) { } int smlua_func_obj_check_overlap_with_hitbox_params(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 7)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 7) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_check_overlap_with_hitbox_params", 7, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_check_overlap_with_hitbox_params'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_check_overlap_with_hitbox_params"); return 0; } f32 x = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_check_overlap_with_hitbox_params'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_check_overlap_with_hitbox_params"); return 0; } f32 y = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_check_overlap_with_hitbox_params'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_check_overlap_with_hitbox_params"); return 0; } f32 z = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_check_overlap_with_hitbox_params'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_check_overlap_with_hitbox_params"); return 0; } f32 h = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'obj_check_overlap_with_hitbox_params'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "obj_check_overlap_with_hitbox_params"); return 0; } f32 r = smlua_to_number(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'obj_check_overlap_with_hitbox_params'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "obj_check_overlap_with_hitbox_params"); return 0; } f32 d = smlua_to_number(L, 7); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'obj_check_overlap_with_hitbox_params'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "obj_check_overlap_with_hitbox_params"); return 0; } lua_pushboolean(L, obj_check_overlap_with_hitbox_params(o, x, y, z, h, r, d)); @@ -17704,10 +27323,16 @@ int smlua_func_obj_check_overlap_with_hitbox_params(lua_State* L) { } int smlua_func_obj_count_objects_with_behavior_id(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_count_objects_with_behavior_id", 1, top); + return 0; + } int behaviorId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_count_objects_with_behavior_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_count_objects_with_behavior_id"); return 0; } lua_pushinteger(L, obj_count_objects_with_behavior_id(behaviorId)); @@ -17715,10 +27340,16 @@ int smlua_func_obj_count_objects_with_behavior_id(lua_State* L) { } int smlua_func_obj_get_first(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_first", 1, top); + return 0; + } int objList = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_first'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_first"); return 0; } smlua_push_object(L, LOT_OBJECT, obj_get_first(objList)); @@ -17726,10 +27357,16 @@ int smlua_func_obj_get_first(lua_State* L) { } int smlua_func_obj_get_first_with_behavior_id(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_first_with_behavior_id", 1, top); + return 0; + } int behaviorId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_first_with_behavior_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_first_with_behavior_id"); return 0; } smlua_push_object(L, LOT_OBJECT, obj_get_first_with_behavior_id(behaviorId)); @@ -17737,14 +27374,20 @@ int smlua_func_obj_get_first_with_behavior_id(lua_State* L) { } int smlua_func_obj_get_first_with_behavior_id_and_field_f32(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_first_with_behavior_id_and_field_f32", 3, top); + return 0; + } int behaviorId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_first_with_behavior_id_and_field_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_first_with_behavior_id_and_field_f32"); return 0; } s32 fieldIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_get_first_with_behavior_id_and_field_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_get_first_with_behavior_id_and_field_f32"); return 0; } f32 value = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_get_first_with_behavior_id_and_field_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_get_first_with_behavior_id_and_field_f32"); return 0; } smlua_push_object(L, LOT_OBJECT, obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value)); @@ -17752,14 +27395,20 @@ int smlua_func_obj_get_first_with_behavior_id_and_field_f32(lua_State* L) { } int smlua_func_obj_get_first_with_behavior_id_and_field_s32(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_first_with_behavior_id_and_field_s32", 3, top); + return 0; + } int behaviorId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_first_with_behavior_id_and_field_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_first_with_behavior_id_and_field_s32"); return 0; } s32 fieldIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_get_first_with_behavior_id_and_field_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_get_first_with_behavior_id_and_field_s32"); return 0; } s32 value = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_get_first_with_behavior_id_and_field_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_get_first_with_behavior_id_and_field_s32"); return 0; } smlua_push_object(L, LOT_OBJECT, obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value)); @@ -17767,12 +27416,18 @@ int smlua_func_obj_get_first_with_behavior_id_and_field_s32(lua_State* L) { } int smlua_func_obj_get_nearest_object_with_behavior_id(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_nearest_object_with_behavior_id", 2, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_nearest_object_with_behavior_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_nearest_object_with_behavior_id"); return 0; } int behaviorId = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_get_nearest_object_with_behavior_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_get_nearest_object_with_behavior_id"); return 0; } smlua_push_object(L, LOT_OBJECT, obj_get_nearest_object_with_behavior_id(o, behaviorId)); @@ -17780,10 +27435,16 @@ int smlua_func_obj_get_nearest_object_with_behavior_id(lua_State* L) { } int smlua_func_obj_get_next(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_next", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_next'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_next"); return 0; } smlua_push_object(L, LOT_OBJECT, obj_get_next(o)); @@ -17791,10 +27452,16 @@ int smlua_func_obj_get_next(lua_State* L) { } int smlua_func_obj_get_next_with_same_behavior_id(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_next_with_same_behavior_id", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_next_with_same_behavior_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_next_with_same_behavior_id"); return 0; } smlua_push_object(L, LOT_OBJECT, obj_get_next_with_same_behavior_id(o)); @@ -17802,14 +27469,20 @@ int smlua_func_obj_get_next_with_same_behavior_id(lua_State* L) { } int smlua_func_obj_get_next_with_same_behavior_id_and_field_f32(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_next_with_same_behavior_id_and_field_f32", 3, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_next_with_same_behavior_id_and_field_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_next_with_same_behavior_id_and_field_f32"); return 0; } s32 fieldIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_get_next_with_same_behavior_id_and_field_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_get_next_with_same_behavior_id_and_field_f32"); return 0; } f32 value = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_get_next_with_same_behavior_id_and_field_f32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_get_next_with_same_behavior_id_and_field_f32"); return 0; } smlua_push_object(L, LOT_OBJECT, obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value)); @@ -17817,14 +27490,20 @@ int smlua_func_obj_get_next_with_same_behavior_id_and_field_f32(lua_State* L) { } int smlua_func_obj_get_next_with_same_behavior_id_and_field_s32(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_next_with_same_behavior_id_and_field_s32", 3, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_next_with_same_behavior_id_and_field_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_next_with_same_behavior_id_and_field_s32"); return 0; } s32 fieldIndex = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_get_next_with_same_behavior_id_and_field_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_get_next_with_same_behavior_id_and_field_s32"); return 0; } s32 value = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_get_next_with_same_behavior_id_and_field_s32'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_get_next_with_same_behavior_id_and_field_s32"); return 0; } smlua_push_object(L, LOT_OBJECT, obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value)); @@ -17832,10 +27511,16 @@ int smlua_func_obj_get_next_with_same_behavior_id_and_field_s32(lua_State* L) { } int smlua_func_obj_get_temp_spawn_particles_info(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_get_temp_spawn_particles_info", 1, top); + return 0; + } int modelId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_get_temp_spawn_particles_info'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_temp_spawn_particles_info"); return 0; } smlua_push_object(L, LOT_SPAWNPARTICLESINFO, obj_get_temp_spawn_particles_info(modelId)); @@ -17843,12 +27528,18 @@ int smlua_func_obj_get_temp_spawn_particles_info(lua_State* L) { } int smlua_func_obj_has_behavior_id(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_has_behavior_id", 2, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_has_behavior_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_has_behavior_id"); return 0; } int behaviorId = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_has_behavior_id'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_has_behavior_id"); return 0; } lua_pushinteger(L, obj_has_behavior_id(o, behaviorId)); @@ -17856,12 +27547,18 @@ int smlua_func_obj_has_behavior_id(lua_State* L) { } int smlua_func_obj_has_model_extended(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_has_model_extended", 2, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_has_model_extended'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_has_model_extended"); return 0; } int modelId = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_has_model_extended'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_has_model_extended"); return 0; } lua_pushinteger(L, obj_has_model_extended(o, modelId)); @@ -17869,10 +27566,16 @@ int smlua_func_obj_has_model_extended(lua_State* L) { } int smlua_func_obj_is_attackable(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_attackable", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_attackable'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_attackable"); return 0; } lua_pushboolean(L, obj_is_attackable(o)); @@ -17880,10 +27583,16 @@ int smlua_func_obj_is_attackable(lua_State* L) { } int smlua_func_obj_is_breakable_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_breakable_object", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_breakable_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_breakable_object"); return 0; } lua_pushboolean(L, obj_is_breakable_object(o)); @@ -17891,10 +27600,16 @@ int smlua_func_obj_is_breakable_object(lua_State* L) { } int smlua_func_obj_is_bully(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_bully", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_bully'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_bully"); return 0; } lua_pushboolean(L, obj_is_bully(o)); @@ -17902,10 +27617,16 @@ int smlua_func_obj_is_bully(lua_State* L) { } int smlua_func_obj_is_coin(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_coin", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_coin'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_coin"); return 0; } lua_pushboolean(L, obj_is_coin(o)); @@ -17913,10 +27634,16 @@ int smlua_func_obj_is_coin(lua_State* L) { } int smlua_func_obj_is_exclamation_box(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_exclamation_box", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_exclamation_box'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_exclamation_box"); return 0; } lua_pushboolean(L, obj_is_exclamation_box(o)); @@ -17924,10 +27651,16 @@ int smlua_func_obj_is_exclamation_box(lua_State* L) { } int smlua_func_obj_is_grabbable(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_grabbable", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_grabbable'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_grabbable"); return 0; } lua_pushboolean(L, obj_is_grabbable(o)); @@ -17935,10 +27668,16 @@ int smlua_func_obj_is_grabbable(lua_State* L) { } int smlua_func_obj_is_mushroom_1up(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_mushroom_1up", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_mushroom_1up'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_mushroom_1up"); return 0; } lua_pushboolean(L, obj_is_mushroom_1up(o)); @@ -17946,10 +27685,16 @@ int smlua_func_obj_is_mushroom_1up(lua_State* L) { } int smlua_func_obj_is_secret(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_secret", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_secret'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_secret"); return 0; } lua_pushboolean(L, obj_is_secret(o)); @@ -17957,10 +27702,16 @@ int smlua_func_obj_is_secret(lua_State* L) { } int smlua_func_obj_is_valid_for_interaction(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_is_valid_for_interaction", 1, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_is_valid_for_interaction'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_is_valid_for_interaction"); return 0; } lua_pushboolean(L, obj_is_valid_for_interaction(o)); @@ -17968,16 +27719,22 @@ int smlua_func_obj_is_valid_for_interaction(lua_State* L) { } int smlua_func_obj_move_xyz(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_move_xyz", 4, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_move_xyz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_move_xyz"); return 0; } f32 dx = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_move_xyz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_move_xyz"); return 0; } f32 dy = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_move_xyz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_move_xyz"); return 0; } f32 dz = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_move_xyz'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_move_xyz"); return 0; } obj_move_xyz(o, dx, dy, dz); @@ -17985,12 +27742,18 @@ int smlua_func_obj_move_xyz(lua_State* L) { } int smlua_func_obj_set_model_extended(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_model_extended", 2, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_model_extended'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_model_extended"); return 0; } int modelId = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_model_extended'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_model_extended"); return 0; } obj_set_model_extended(o, modelId); @@ -17998,16 +27761,22 @@ int smlua_func_obj_set_model_extended(lua_State* L) { } int smlua_func_obj_set_vel(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_set_vel", 4, top); + return 0; + } struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'obj_set_vel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_vel"); return 0; } f32 vx = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'obj_set_vel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_vel"); return 0; } f32 vy = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'obj_set_vel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_vel"); return 0; } f32 vz = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'obj_set_vel'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_set_vel"); return 0; } obj_set_vel(o, vx, vy, vz); @@ -18015,20 +27784,26 @@ int smlua_func_obj_set_vel(lua_State* L) { } int smlua_func_spawn_non_sync_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_non_sync_object", 6, top); + return 0; + } int behaviorId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_non_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_non_sync_object"); return 0; } int modelId = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_non_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_non_sync_object"); return 0; } f32 x = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'spawn_non_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_non_sync_object"); return 0; } f32 y = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'spawn_non_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_non_sync_object"); return 0; } f32 z = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'spawn_non_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "spawn_non_sync_object"); return 0; } LuaFunction objSetupFunction = smlua_to_lua_function(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'spawn_non_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_non_sync_object"); return 0; } smlua_push_object(L, LOT_OBJECT, spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)); @@ -18036,20 +27811,26 @@ int smlua_func_spawn_non_sync_object(lua_State* L) { } int smlua_func_spawn_sync_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_sync_object", 6, top); + return 0; + } int behaviorId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'spawn_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_sync_object"); return 0; } int modelId = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'spawn_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_sync_object"); return 0; } f32 x = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'spawn_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_sync_object"); return 0; } f32 y = smlua_to_number(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'spawn_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_sync_object"); return 0; } f32 z = smlua_to_number(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'spawn_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "spawn_sync_object"); return 0; } LuaFunction objSetupFunction = smlua_to_lua_function(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'spawn_sync_object'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_sync_object"); return 0; } smlua_push_object(L, LOT_OBJECT, spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)); @@ -18061,10 +27842,16 @@ int smlua_func_spawn_sync_object(lua_State* L) { //////////////////////// int smlua_func_smlua_text_utils_castle_secret_stars_replace(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_text_utils_castle_secret_stars_replace", 1, top); + return 0; + } const char* name = smlua_to_string(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_text_utils_castle_secret_stars_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_text_utils_castle_secret_stars_replace"); return 0; } smlua_text_utils_castle_secret_stars_replace(name); @@ -18072,24 +27859,30 @@ int smlua_func_smlua_text_utils_castle_secret_stars_replace(lua_State* L) { } int smlua_func_smlua_text_utils_course_acts_replace(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 8)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 8) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_text_utils_course_acts_replace", 8, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_text_utils_course_acts_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_text_utils_course_acts_replace"); return 0; } const char* courseName = smlua_to_string(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'smlua_text_utils_course_acts_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "smlua_text_utils_course_acts_replace"); return 0; } const char* act1 = smlua_to_string(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'smlua_text_utils_course_acts_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "smlua_text_utils_course_acts_replace"); return 0; } const char* act2 = smlua_to_string(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'smlua_text_utils_course_acts_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "smlua_text_utils_course_acts_replace"); return 0; } const char* act3 = smlua_to_string(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'smlua_text_utils_course_acts_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "smlua_text_utils_course_acts_replace"); return 0; } const char* act4 = smlua_to_string(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'smlua_text_utils_course_acts_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "smlua_text_utils_course_acts_replace"); return 0; } const char* act5 = smlua_to_string(L, 7); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7 for function 'smlua_text_utils_course_acts_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "smlua_text_utils_course_acts_replace"); return 0; } const char* act6 = smlua_to_string(L, 8); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 8 for function 'smlua_text_utils_course_acts_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 8, "smlua_text_utils_course_acts_replace"); return 0; } smlua_text_utils_course_acts_replace(courseNum, courseName, act1, act2, act3, act4, act5, act6); @@ -18097,20 +27890,26 @@ int smlua_func_smlua_text_utils_course_acts_replace(lua_State* L) { } int smlua_func_smlua_text_utils_dialog_replace(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 6)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_text_utils_dialog_replace", 6, top); + return 0; + } int dialogId = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_text_utils_dialog_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_text_utils_dialog_replace"); return 0; } u32 unused = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'smlua_text_utils_dialog_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "smlua_text_utils_dialog_replace"); return 0; } s8 linesPerBox = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'smlua_text_utils_dialog_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "smlua_text_utils_dialog_replace"); return 0; } s16 leftOffset = smlua_to_integer(L, 4); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'smlua_text_utils_dialog_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "smlua_text_utils_dialog_replace"); return 0; } s16 width = smlua_to_integer(L, 5); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5 for function 'smlua_text_utils_dialog_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "smlua_text_utils_dialog_replace"); return 0; } const char* str = smlua_to_string(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6 for function 'smlua_text_utils_dialog_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "smlua_text_utils_dialog_replace"); return 0; } smlua_text_utils_dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str); @@ -18118,12 +27917,18 @@ int smlua_func_smlua_text_utils_dialog_replace(lua_State* L) { } int smlua_func_smlua_text_utils_extra_text_replace(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_text_utils_extra_text_replace", 2, top); + return 0; + } s16 index = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_text_utils_extra_text_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_text_utils_extra_text_replace"); return 0; } const char* text = smlua_to_string(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'smlua_text_utils_extra_text_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "smlua_text_utils_extra_text_replace"); return 0; } smlua_text_utils_extra_text_replace(index, text); @@ -18131,7 +27936,13 @@ int smlua_func_smlua_text_utils_extra_text_replace(lua_State* L) { } int smlua_func_smlua_text_utils_reset_all(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_text_utils_reset_all", 0, top); + return 0; + } smlua_text_utils_reset_all(); @@ -18140,12 +27951,18 @@ int smlua_func_smlua_text_utils_reset_all(UNUSED lua_State* L) { } int smlua_func_smlua_text_utils_secret_star_replace(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_text_utils_secret_star_replace", 2, top); + return 0; + } s16 courseNum = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'smlua_text_utils_secret_star_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_text_utils_secret_star_replace"); return 0; } const char* courseName = smlua_to_string(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'smlua_text_utils_secret_star_replace'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "smlua_text_utils_secret_star_replace"); return 0; } smlua_text_utils_secret_star_replace(courseNum, courseName); @@ -18157,7 +27974,13 @@ int smlua_func_smlua_text_utils_secret_star_replace(lua_State* L) { ////////////////// int smlua_func_disable_background_sound(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "disable_background_sound", 0, top); + return 0; + } disable_background_sound(); @@ -18166,7 +27989,13 @@ int smlua_func_disable_background_sound(UNUSED lua_State* L) { } int smlua_func_enable_background_sound(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "enable_background_sound", 0, top); + return 0; + } enable_background_sound(); @@ -18175,7 +28004,13 @@ int smlua_func_enable_background_sound(UNUSED lua_State* L) { } int smlua_func_fadeout_cap_music(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "fadeout_cap_music", 0, top); + return 0; + } fadeout_cap_music(); @@ -18184,10 +28019,16 @@ int smlua_func_fadeout_cap_music(UNUSED lua_State* L) { } int smlua_func_fadeout_level_music(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "fadeout_level_music", 1, top); + return 0; + } s16 fadeTimer = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'fadeout_level_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "fadeout_level_music"); return 0; } fadeout_level_music(fadeTimer); @@ -18195,10 +28036,16 @@ int smlua_func_fadeout_level_music(lua_State* L) { } int smlua_func_fadeout_music(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "fadeout_music", 1, top); + return 0; + } s16 fadeOutTime = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'fadeout_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "fadeout_music"); return 0; } fadeout_music(fadeOutTime); @@ -18206,10 +28053,16 @@ int smlua_func_fadeout_music(lua_State* L) { } int smlua_func_lower_background_noise(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "lower_background_noise", 1, top); + return 0; + } s32 a = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'lower_background_noise'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "lower_background_noise"); return 0; } lower_background_noise(a); @@ -18217,10 +28070,16 @@ int smlua_func_lower_background_noise(lua_State* L) { } int smlua_func_play_cap_music(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_cap_music", 1, top); + return 0; + } u16 seqArgs = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_cap_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_cap_music"); return 0; } play_cap_music(seqArgs); @@ -18228,10 +28087,16 @@ int smlua_func_play_cap_music(lua_State* L) { } int smlua_func_play_cutscene_music(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_cutscene_music", 1, top); + return 0; + } u16 seqArgs = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_cutscene_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_cutscene_music"); return 0; } play_cutscene_music(seqArgs); @@ -18239,7 +28104,13 @@ int smlua_func_play_cutscene_music(lua_State* L) { } int smlua_func_play_infinite_stairs_music(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_infinite_stairs_music", 0, top); + return 0; + } play_infinite_stairs_music(); @@ -18248,10 +28119,16 @@ int smlua_func_play_infinite_stairs_music(UNUSED lua_State* L) { } int smlua_func_play_menu_sounds(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_menu_sounds", 1, top); + return 0; + } s16 soundMenuFlags = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'play_menu_sounds'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_menu_sounds"); return 0; } play_menu_sounds(soundMenuFlags); @@ -18259,7 +28136,13 @@ int smlua_func_play_menu_sounds(lua_State* L) { } int smlua_func_play_painting_eject_sound(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_painting_eject_sound", 0, top); + return 0; + } play_painting_eject_sound(); @@ -18268,7 +28151,13 @@ int smlua_func_play_painting_eject_sound(UNUSED lua_State* L) { } int smlua_func_play_shell_music(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "play_shell_music", 0, top); + return 0; + } play_shell_music(); @@ -18277,10 +28166,16 @@ int smlua_func_play_shell_music(UNUSED lua_State* L) { } int smlua_func_raise_background_noise(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "raise_background_noise", 1, top); + return 0; + } s32 a = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'raise_background_noise'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "raise_background_noise"); return 0; } raise_background_noise(a); @@ -18288,7 +28183,13 @@ int smlua_func_raise_background_noise(lua_State* L) { } int smlua_func_reset_volume(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "reset_volume", 0, top); + return 0; + } reset_volume(); @@ -18297,14 +28198,20 @@ int smlua_func_reset_volume(UNUSED lua_State* L) { } int smlua_func_set_background_music(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_background_music", 3, top); + return 0; + } u16 a = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'set_background_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_background_music"); return 0; } u16 seqArgs = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'set_background_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_background_music"); return 0; } s16 fadeTimer = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'set_background_music'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_background_music"); return 0; } set_background_music(a, seqArgs, fadeTimer); @@ -18312,7 +28219,13 @@ int smlua_func_set_background_music(lua_State* L) { } int smlua_func_stop_cap_music(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stop_cap_music", 0, top); + return 0; + } stop_cap_music(); @@ -18321,7 +28234,13 @@ int smlua_func_stop_cap_music(UNUSED lua_State* L) { } int smlua_func_stop_shell_music(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "stop_shell_music", 0, top); + return 0; + } stop_shell_music(); @@ -18334,10 +28253,16 @@ int smlua_func_stop_shell_music(UNUSED lua_State* L) { /////////////////// int smlua_func_calc_dist_to_volume_range_1(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calc_dist_to_volume_range_1", 1, top); + return 0; + } f32 distance = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calc_dist_to_volume_range_1'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_dist_to_volume_range_1"); return 0; } extern s32 calc_dist_to_volume_range_1(f32 distance); lua_pushinteger(L, calc_dist_to_volume_range_1(distance)); @@ -18346,10 +28271,16 @@ int smlua_func_calc_dist_to_volume_range_1(lua_State* L) { } int smlua_func_calc_dist_to_volume_range_2(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "calc_dist_to_volume_range_2", 1, top); + return 0; + } f32 distance = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'calc_dist_to_volume_range_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_dist_to_volume_range_2"); return 0; } extern s32 calc_dist_to_volume_range_2(f32 distance); lua_pushinteger(L, calc_dist_to_volume_range_2(distance)); @@ -18358,10 +28289,16 @@ int smlua_func_calc_dist_to_volume_range_2(lua_State* L) { } int smlua_func_cur_obj_play_sound_1(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_play_sound_1", 1, top); + return 0; + } s32 soundMagic = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_play_sound_1'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_play_sound_1"); return 0; } extern void cur_obj_play_sound_1(s32 soundMagic); cur_obj_play_sound_1(soundMagic); @@ -18370,10 +28307,16 @@ int smlua_func_cur_obj_play_sound_1(lua_State* L) { } int smlua_func_cur_obj_play_sound_2(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_play_sound_2", 1, top); + return 0; + } s32 soundMagic = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'cur_obj_play_sound_2'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_play_sound_2"); return 0; } extern void cur_obj_play_sound_2(s32 soundMagic); cur_obj_play_sound_2(soundMagic); @@ -18382,10 +28325,16 @@ int smlua_func_cur_obj_play_sound_2(lua_State* L) { } int smlua_func_exec_anim_sound_state(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "exec_anim_sound_state", 1, top); + return 0; + } struct SoundState* soundStates = (struct SoundState*)smlua_to_cobject(L, 1, LOT_SOUNDSTATE); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'exec_anim_sound_state'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "exec_anim_sound_state"); return 0; } extern void exec_anim_sound_state(struct SoundState *soundStates); exec_anim_sound_state(soundStates); @@ -18399,16 +28348,22 @@ int smlua_func_exec_anim_sound_state(lua_State* L) { /* int smlua_func_find_ceil(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_ceil", 4, top); + return 0; + } f32 posX = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_ceil"); return 0; } f32 posY = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_ceil"); return 0; } f32 posZ = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_ceil"); return 0; } // struct Surface** pceil = (struct Surface**)smlua_to_cobject(L, 4, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'find_ceil'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "find_ceil"); return 0; } lua_pushnumber(L, find_ceil(posX, posY, posZ, pceil)); @@ -18417,14 +28372,20 @@ int smlua_func_find_ceil(lua_State* L) { */ int smlua_func_find_ceil_height(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_ceil_height", 3, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_ceil_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_ceil_height"); return 0; } f32 y = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_ceil_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_ceil_height"); return 0; } f32 z = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_ceil_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_ceil_height"); return 0; } lua_pushnumber(L, find_ceil_height(x, y, z)); @@ -18433,16 +28394,22 @@ int smlua_func_find_ceil_height(lua_State* L) { /* int smlua_func_find_floor(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_floor", 4, top); + return 0; + } f32 xPos = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_floor"); return 0; } f32 yPos = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_floor"); return 0; } f32 zPos = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_floor"); return 0; } // struct Surface** pfloor = (struct Surface**)smlua_to_cobject(L, 4, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'find_floor'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "find_floor"); return 0; } lua_pushnumber(L, find_floor(xPos, yPos, zPos, pfloor)); @@ -18451,14 +28418,20 @@ int smlua_func_find_floor(lua_State* L) { */ int smlua_func_find_floor_height(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_floor_height", 3, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_floor_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_floor_height"); return 0; } f32 y = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_floor_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_floor_height"); return 0; } f32 z = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_floor_height'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_floor_height"); return 0; } lua_pushnumber(L, find_floor_height(x, y, z)); @@ -18467,16 +28440,22 @@ int smlua_func_find_floor_height(lua_State* L) { /* int smlua_func_find_floor_height_and_data(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_floor_height_and_data", 4, top); + return 0; + } f32 xPos = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_floor_height_and_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_floor_height_and_data"); return 0; } f32 yPos = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_floor_height_and_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_floor_height_and_data"); return 0; } f32 zPos = smlua_to_number(L, 3); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_floor_height_and_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_floor_height_and_data"); return 0; } // struct FloorGeometry** floorGeo = (struct FloorGeometry**)smlua_to_cobject(L, 4, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'find_floor_height_and_data'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "find_floor_height_and_data"); return 0; } lua_pushnumber(L, find_floor_height_and_data(xPos, yPos, zPos, floorGeo)); @@ -18485,12 +28464,18 @@ int smlua_func_find_floor_height_and_data(lua_State* L) { */ int smlua_func_find_poison_gas_level(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_poison_gas_level", 2, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_poison_gas_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_poison_gas_level"); return 0; } f32 z = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_poison_gas_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_poison_gas_level"); return 0; } lua_pushnumber(L, find_poison_gas_level(x, z)); @@ -18499,28 +28484,34 @@ int smlua_func_find_poison_gas_level(lua_State* L) { /* int smlua_func_find_surface_on_ray(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_surface_on_ray", 4, top); + return 0; + } f32* orig = smlua_get_vec3f_from_buffer(); orig[0] = smlua_get_number_field(1, "x"); orig[1] = smlua_get_number_field(1, "y"); orig[2] = smlua_get_number_field(1, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_surface_on_ray"); return 0; } f32* dir = smlua_get_vec3f_from_buffer(); dir[0] = smlua_get_number_field(2, "x"); dir[1] = smlua_get_number_field(2, "y"); dir[2] = smlua_get_number_field(2, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_surface_on_ray"); return 0; } // struct Surface** hit_surface = (struct Surface**)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "find_surface_on_ray"); return 0; } f32* hit_pos = smlua_get_vec3f_from_buffer(); hit_pos[0] = smlua_get_number_field(4, "x"); hit_pos[1] = smlua_get_number_field(4, "y"); hit_pos[2] = smlua_get_number_field(4, "z"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'find_surface_on_ray'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "find_surface_on_ray"); return 0; } find_surface_on_ray(orig, dir, hit_surface, hit_pos); @@ -18541,10 +28532,16 @@ int smlua_func_find_surface_on_ray(lua_State* L) { */ int smlua_func_find_wall_collisions(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_wall_collisions", 1, top); + return 0; + } struct WallCollisionData* colData = (struct WallCollisionData*)smlua_to_cobject(L, 1, LOT_WALLCOLLISIONDATA); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_wall_collisions'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_wall_collisions"); return 0; } lua_pushinteger(L, find_wall_collisions(colData)); @@ -18552,12 +28549,18 @@ int smlua_func_find_wall_collisions(lua_State* L) { } int smlua_func_find_water_level(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "find_water_level", 2, top); + return 0; + } f32 x = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'find_water_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_water_level"); return 0; } f32 z = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'find_water_level'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "find_water_level"); return 0; } lua_pushnumber(L, find_water_level(x, z)); @@ -18569,7 +28572,13 @@ int smlua_func_find_water_level(lua_State* L) { //////////////////// int smlua_func_alloc_surface_pools(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "alloc_surface_pools", 0, top); + return 0; + } alloc_surface_pools(); @@ -18578,7 +28587,13 @@ int smlua_func_alloc_surface_pools(UNUSED lua_State* L) { } int smlua_func_clear_dynamic_surfaces(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clear_dynamic_surfaces", 0, top); + return 0; + } clear_dynamic_surfaces(); @@ -18587,10 +28602,16 @@ int smlua_func_clear_dynamic_surfaces(UNUSED lua_State* L) { } int smlua_func_get_area_terrain_size(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_area_terrain_size", 1, top); + return 0; + } s16 * data = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'get_area_terrain_size'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_area_terrain_size"); return 0; } lua_pushinteger(L, get_area_terrain_size(data)); @@ -18598,16 +28619,22 @@ int smlua_func_get_area_terrain_size(lua_State* L) { } int smlua_func_load_area_terrain(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 4) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "load_area_terrain", 4, top); + return 0; + } s16 index = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'load_area_terrain'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "load_area_terrain"); return 0; } s16 * data = (s16 *)smlua_to_cpointer(L, 2, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'load_area_terrain'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "load_area_terrain"); return 0; } s8 * surfaceRooms = (s8 *)smlua_to_cpointer(L, 3, LVT_S8_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'load_area_terrain'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "load_area_terrain"); return 0; } s16 * macroObjects = (s16 *)smlua_to_cpointer(L, 4, LVT_S16_P); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'load_area_terrain'"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "load_area_terrain"); return 0; } load_area_terrain(index, data, surfaceRooms, macroObjects); @@ -18615,7 +28642,13 @@ int smlua_func_load_area_terrain(lua_State* L) { } int smlua_func_load_object_collision_model(UNUSED lua_State* L) { - if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "load_object_collision_model", 0, top); + return 0; + } load_object_collision_model(); @@ -19488,7 +29521,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "cutscene_take_cap_off", smlua_func_cutscene_take_cap_off); smlua_bind_function(L, "general_star_dance_handler", smlua_func_general_star_dance_handler); smlua_bind_function(L, "generate_yellow_sparkles", smlua_func_generate_yellow_sparkles); - //smlua_bind_function(L, "get_credits_str_width", smlua_func_get_credits_str_width); <--- UNIMPLEMENTED + smlua_bind_function(L, "get_credits_str_width", smlua_func_get_credits_str_width); smlua_bind_function(L, "get_star_collection_dialog", smlua_func_get_star_collection_dialog); smlua_bind_function(L, "handle_save_menu", smlua_func_handle_save_menu); smlua_bind_function(L, "launch_mario_until_land", smlua_func_launch_mario_until_land); @@ -19580,53 +29613,52 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "stop_and_set_height_to_floor", smlua_func_stop_and_set_height_to_floor); // math_util.h - //smlua_bind_function(L, "anim_spline_init", smlua_func_anim_spline_init); <--- UNIMPLEMENTED + smlua_bind_function(L, "anim_spline_init", smlua_func_anim_spline_init); smlua_bind_function(L, "anim_spline_poll", smlua_func_anim_spline_poll); smlua_bind_function(L, "approach_f32", smlua_func_approach_f32); smlua_bind_function(L, "approach_s32", smlua_func_approach_s32); - //smlua_bind_function(L, "find_vector_perpendicular_to_plane", smlua_func_find_vector_perpendicular_to_plane); <--- UNIMPLEMENTED - //smlua_bind_function(L, "get_pos_from_transform_mtx", smlua_func_get_pos_from_transform_mtx); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_align_terrain_normal", smlua_func_mtxf_align_terrain_normal); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_align_terrain_triangle", smlua_func_mtxf_align_terrain_triangle); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_billboard", smlua_func_mtxf_billboard); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_copy", smlua_func_mtxf_copy); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_cylboard", smlua_func_mtxf_cylboard); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_identity", smlua_func_mtxf_identity); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_inverse", smlua_func_mtxf_inverse); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_lookat", smlua_func_mtxf_lookat); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_mul", smlua_func_mtxf_mul); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_mul_vec3s", smlua_func_mtxf_mul_vec3s); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_rotate_xy", smlua_func_mtxf_rotate_xy); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_rotate_xyz_and_translate", smlua_func_mtxf_rotate_xyz_and_translate); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_rotate_zxy_and_translate", smlua_func_mtxf_rotate_zxy_and_translate); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_scale_vec3f", smlua_func_mtxf_scale_vec3f); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_to_mtx", smlua_func_mtxf_to_mtx); <--- UNIMPLEMENTED - //smlua_bind_function(L, "mtxf_translate", smlua_func_mtxf_translate); <--- UNIMPLEMENTED + smlua_bind_function(L, "find_vector_perpendicular_to_plane", smlua_func_find_vector_perpendicular_to_plane); + smlua_bind_function(L, "get_pos_from_transform_mtx", smlua_func_get_pos_from_transform_mtx); + smlua_bind_function(L, "mtxf_align_terrain_normal", smlua_func_mtxf_align_terrain_normal); + smlua_bind_function(L, "mtxf_align_terrain_triangle", smlua_func_mtxf_align_terrain_triangle); + smlua_bind_function(L, "mtxf_billboard", smlua_func_mtxf_billboard); + smlua_bind_function(L, "mtxf_copy", smlua_func_mtxf_copy); + smlua_bind_function(L, "mtxf_cylboard", smlua_func_mtxf_cylboard); + smlua_bind_function(L, "mtxf_identity", smlua_func_mtxf_identity); + smlua_bind_function(L, "mtxf_inverse", smlua_func_mtxf_inverse); + smlua_bind_function(L, "mtxf_lookat", smlua_func_mtxf_lookat); + smlua_bind_function(L, "mtxf_mul", smlua_func_mtxf_mul); + smlua_bind_function(L, "mtxf_mul_vec3s", smlua_func_mtxf_mul_vec3s); + smlua_bind_function(L, "mtxf_rotate_xy", smlua_func_mtxf_rotate_xy); + smlua_bind_function(L, "mtxf_rotate_xyz_and_translate", smlua_func_mtxf_rotate_xyz_and_translate); + smlua_bind_function(L, "mtxf_rotate_zxy_and_translate", smlua_func_mtxf_rotate_zxy_and_translate); + smlua_bind_function(L, "mtxf_scale_vec3f", smlua_func_mtxf_scale_vec3f); + smlua_bind_function(L, "mtxf_to_mtx", smlua_func_mtxf_to_mtx); + smlua_bind_function(L, "mtxf_translate", smlua_func_mtxf_translate); smlua_bind_function(L, "not_zero", smlua_func_not_zero); - //smlua_bind_function(L, "spline_get_weights", smlua_func_spline_get_weights); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3f_add", smlua_func_vec3f_add); <--- UNIMPLEMENTED + smlua_bind_function(L, "spline_get_weights", smlua_func_spline_get_weights); + smlua_bind_function(L, "vec3f_add", smlua_func_vec3f_add); smlua_bind_function(L, "vec3f_combine", smlua_func_vec3f_combine); - //smlua_bind_function(L, "vec3f_copy", smlua_func_vec3f_copy); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3f_cross", smlua_func_vec3f_cross); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3f_dif", smlua_func_vec3f_dif); <--- UNIMPLEMENTED + smlua_bind_function(L, "vec3f_copy", smlua_func_vec3f_copy); + smlua_bind_function(L, "vec3f_cross", smlua_func_vec3f_cross); + smlua_bind_function(L, "vec3f_dif", smlua_func_vec3f_dif); smlua_bind_function(L, "vec3f_dist", smlua_func_vec3f_dist); smlua_bind_function(L, "vec3f_dot", smlua_func_vec3f_dot); smlua_bind_function(L, "vec3f_get_dist_and_angle", smlua_func_vec3f_get_dist_and_angle); smlua_bind_function(L, "vec3f_length", smlua_func_vec3f_length); - //smlua_bind_function(L, "vec3f_mul", smlua_func_vec3f_mul); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3f_normalize", smlua_func_vec3f_normalize); <--- UNIMPLEMENTED + smlua_bind_function(L, "vec3f_mul", smlua_func_vec3f_mul); + smlua_bind_function(L, "vec3f_normalize", smlua_func_vec3f_normalize); smlua_bind_function(L, "vec3f_project", smlua_func_vec3f_project); - //smlua_bind_function(L, "vec3f_rotate_zxy", smlua_func_vec3f_rotate_zxy); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3f_set", smlua_func_vec3f_set); <--- UNIMPLEMENTED + smlua_bind_function(L, "vec3f_rotate_zxy", smlua_func_vec3f_rotate_zxy); + smlua_bind_function(L, "vec3f_set", smlua_func_vec3f_set); smlua_bind_function(L, "vec3f_set_dist_and_angle", smlua_func_vec3f_set_dist_and_angle); - //smlua_bind_function(L, "vec3f_sum", smlua_func_vec3f_sum); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3f_to_vec3s", smlua_func_vec3f_to_vec3s); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3s_add", smlua_func_vec3s_add); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3s_copy", smlua_func_vec3s_copy); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3s_set", smlua_func_vec3s_set); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3s_sub", smlua_func_vec3s_sub); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3s_sum", smlua_func_vec3s_sum); <--- UNIMPLEMENTED - //smlua_bind_function(L, "vec3s_to_vec3f", smlua_func_vec3s_to_vec3f); <--- UNIMPLEMENTED + smlua_bind_function(L, "vec3f_sum", smlua_func_vec3f_sum); + smlua_bind_function(L, "vec3f_to_vec3s", smlua_func_vec3f_to_vec3s); + smlua_bind_function(L, "vec3s_add", smlua_func_vec3s_add); + smlua_bind_function(L, "vec3s_copy", smlua_func_vec3s_copy); + smlua_bind_function(L, "vec3s_set", smlua_func_vec3s_set); + smlua_bind_function(L, "vec3s_sum", smlua_func_vec3s_sum); + smlua_bind_function(L, "vec3s_to_vec3f", smlua_func_vec3s_to_vec3f); // misc.h smlua_bind_function(L, "update_all_mario_stars", smlua_func_update_all_mario_stars); @@ -19756,7 +29788,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "clear_time_stop_flags", smlua_func_clear_time_stop_flags); smlua_bind_function(L, "count_objects_with_behavior", smlua_func_count_objects_with_behavior); smlua_bind_function(L, "count_unimportant_objects", smlua_func_count_unimportant_objects); - //smlua_bind_function(L, "create_transformation_from_matrices", smlua_func_create_transformation_from_matrices); <--- UNIMPLEMENTED + smlua_bind_function(L, "create_transformation_from_matrices", smlua_func_create_transformation_from_matrices); smlua_bind_function(L, "cur_obj_abs_y_dist_to_home", smlua_func_cur_obj_abs_y_dist_to_home); smlua_bind_function(L, "cur_obj_advance_looping_anim", smlua_func_cur_obj_advance_looping_anim); smlua_bind_function(L, "cur_obj_align_gfx_with_floor", smlua_func_cur_obj_align_gfx_with_floor); @@ -19898,15 +29930,15 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "is_item_in_array", smlua_func_is_item_in_array); smlua_bind_function(L, "is_mario_moving_fast_or_in_air", smlua_func_is_mario_moving_fast_or_in_air); smlua_bind_function(L, "lateral_dist_between_objects", smlua_func_lateral_dist_between_objects); - //smlua_bind_function(L, "linear_mtxf_mul_vec3f", smlua_func_linear_mtxf_mul_vec3f); <--- UNIMPLEMENTED - //smlua_bind_function(L, "linear_mtxf_transpose_mul_vec3f", smlua_func_linear_mtxf_transpose_mul_vec3f); <--- UNIMPLEMENTED + smlua_bind_function(L, "linear_mtxf_mul_vec3f", smlua_func_linear_mtxf_mul_vec3f); + smlua_bind_function(L, "linear_mtxf_transpose_mul_vec3f", smlua_func_linear_mtxf_transpose_mul_vec3f); smlua_bind_function(L, "mario_is_dive_sliding", smlua_func_mario_is_dive_sliding); smlua_bind_function(L, "mario_is_in_air_action", smlua_func_mario_is_in_air_action); smlua_bind_function(L, "mario_is_within_rectangle", smlua_func_mario_is_within_rectangle); smlua_bind_function(L, "mario_set_flag", smlua_func_mario_set_flag); smlua_bind_function(L, "obj_angle_to_object", smlua_func_obj_angle_to_object); smlua_bind_function(L, "obj_angle_to_point", smlua_func_obj_angle_to_point); - //smlua_bind_function(L, "obj_apply_scale_to_matrix", smlua_func_obj_apply_scale_to_matrix); <--- UNIMPLEMENTED + smlua_bind_function(L, "obj_apply_scale_to_matrix", smlua_func_obj_apply_scale_to_matrix); smlua_bind_function(L, "obj_apply_scale_to_transform", smlua_func_obj_apply_scale_to_transform); smlua_bind_function(L, "obj_attack_collided_from_other_object", smlua_func_obj_attack_collided_from_other_object); smlua_bind_function(L, "obj_become_tangible", smlua_func_obj_become_tangible); @@ -19960,7 +29992,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "obj_translate_xyz_random", smlua_func_obj_translate_xyz_random); smlua_bind_function(L, "obj_translate_xz_random", smlua_func_obj_translate_xz_random); smlua_bind_function(L, "obj_turn_toward_object", smlua_func_obj_turn_toward_object); - //smlua_bind_function(L, "obj_update_pos_from_parent_transformation", smlua_func_obj_update_pos_from_parent_transformation); <--- UNIMPLEMENTED + smlua_bind_function(L, "obj_update_pos_from_parent_transformation", smlua_func_obj_update_pos_from_parent_transformation); smlua_bind_function(L, "player_performed_grab_escape_action", smlua_func_player_performed_grab_escape_action); smlua_bind_function(L, "random_f32_around_zero", smlua_func_random_f32_around_zero); smlua_bind_function(L, "set_mario_interact_hoot_if_in_range", smlua_func_set_mario_interact_hoot_if_in_range); diff --git a/src/pc/lua/smlua_utils.c b/src/pc/lua/smlua_utils.c index cdeafebb..b18eb1cf 100644 --- a/src/pc/lua/smlua_utils.c +++ b/src/pc/lua/smlua_utils.c @@ -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++]; diff --git a/src/pc/lua/smlua_utils.h b/src/pc/lua/smlua_utils.h index ed2a4e0a..105d456d 100644 --- a/src/pc/lua/smlua_utils.h +++ b/src/pc/lua/smlua_utils.h @@ -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);