diff --git a/autogen/common.py b/autogen/common.py index 0a7ec9dc4..5a4989c4f 100644 --- a/autogen/common.py +++ b/autogen/common.py @@ -3,7 +3,7 @@ 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'] +mat4_types = ['Mat4'] # Mtx isn't defined in Lua so we can't actually use it here typedef_pointers = ['BehaviorScript', 'ObjectAnimPointer', 'Collision', 'LevelScript', 'Trajectory'] exclude_structs = [ @@ -19,7 +19,7 @@ def get_path(p): def translate_type_to_lvt(ptype): pointerLvl = 0 - + if ptype == "char": ptype = "u8" @@ -30,14 +30,14 @@ def translate_type_to_lvt(ptype): return "LVT_STRING" if "[" in ptype or "{" in ptype: - return "LOT_???" - + return "LVT_???" + # 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" @@ -68,14 +68,14 @@ def translate_type_to_lvt(ptype): 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_???" @@ -108,9 +108,12 @@ def translate_type_to_lvt(ptype): return "LVT_???" def translate_type_to_lot(ptype): + pointerLvl = 0 + lvt = translate_type_to_lvt(ptype) + if ptype == 'void': return 'LOT_NONE' - + if ptype == 'const char*': return 'LOT_NONE' @@ -129,15 +132,21 @@ def translate_type_to_lot(ptype): if 'enum ' in ptype: return 'LOT_NONE' - if ptype == 'bool': + if ptype in usf_types: return 'LOT_NONE' - if ptype in usf_types: + # 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 == 'bool': return 'LOT_NONE' if ptype in vec3_types: return 'LOT_' + ptype.upper() - + if ptype in vec4_types: return 'LOT_' + ptype.upper() @@ -151,19 +160,20 @@ def translate_type_to_lot(ptype): return 'LOT_NONE' if 'struct' in ptype: - if ptype.count('*') > 1: + if pointerLvl > 1: return 'LOT_???' - struct_id = ptype.split(' ')[1].replace('*', '') + struct_id = ptype.split(' ')[1] if struct_id in exclude_structs: return 'LOT_???' return 'LOT_' + struct_id.upper() - if ptype.count('*') == 1 and '???' not in translate_type_to_lvt(ptype): + if pointerLvl > 0 and '???' not in lvt: + # return 'LOT_POINTER /* ' + ptype + ' */' return 'LOT_POINTER' - + return 'LOT_???' def translate_type_to_lua(ptype): @@ -198,7 +208,7 @@ def translate_type_to_lua(ptype): if ptype == 'float': return '`number`', None - + if ptype == 'double': return '`number`', None diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index c1862864b..7a09f0f3a 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -6025,13 +6025,6 @@ function mtxf_mul_vec3s(mtx, b) -- ... end ---- @param mtx Pointer_Mtx ---- @param angle integer ---- Rotates the matrix `mtx` in the XY plane by the given `angle`. Rotating in the XY plane typically means pivoting around the Z axis -function mtxf_rotate_xy(mtx, angle) - -- ... -end - --- @param dest Mat4 --- @param b Vec3f --- @param c Vec3s @@ -6056,13 +6049,6 @@ function mtxf_scale_vec3f(dest, mtx, s) -- ... end ---- @param dest Pointer_Mtx ---- @param src Mat4 ---- Converts the floating-point matrix `src` into a fixed-point (integer-based) matrix suitable for the `Mtx` format, and stores the result in `dest` -function mtxf_to_mtx(dest, src) - -- ... -end - --- @param dest Mat4 --- @param b Vec3f --- Applies a translation to the 4x4 floating-point matrix `dest` by adding the coordinates in the 3D floating-point vector `b`. This shifts any transformed point by `b` @@ -10454,6 +10440,5 @@ end --- @class Pointer_BehaviorScript --- @class Pointer_number --- @class Pointer_Vec4s ---- @class Pointer_Mtx --- @class Pointer_Trajectory --- @class Pointer_Collision diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index c287b7b25..59a198b2c 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -586,8 +586,6 @@ --- @class DisplayListNode --- @field public next DisplayListNode ---- @field public transform Pointer_Mtx ---- @field public transformPrev Pointer_Mtx --- @field public usingCamSpace integer --- @class DjuiColor @@ -2363,7 +2361,6 @@ --- @class Pointer_integer --- @class Pointer_Trajectory --- @class Pointer_LevelScript ---- @class Pointer_Mtx --- @class Pointer_ObjectAnimPointer --- @class Pointer_Collision --- @class Pointer_Mat4 diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 70666691a..b61d5ef4a 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -2937,30 +2937,6 @@ Multiplies the 4x4 floating-point matrix `mtx` by a 3D signed-integer vector `b`
-## [mtxf_rotate_xy](#mtxf_rotate_xy) - -### Description -Rotates the matrix `mtx` in the XY plane by the given `angle`. Rotating in the XY plane typically means pivoting around the Z axis - -### 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) ### Description @@ -3036,30 +3012,6 @@ Scales the 4x4 floating-point matrix `mtx` by the scaling factors found in the 3
-## [mtxf_to_mtx](#mtxf_to_mtx) - -### Description -Converts the floating-point matrix `src` into a fixed-point (integer-based) matrix suitable for the `Mtx` format, and stores the result in `dest` - -### 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) ### Description diff --git a/docs/lua/functions.md b/docs/lua/functions.md index af2d59b73..a5cc268e5 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1168,11 +1168,9 @@ - [mtxf_lookat](functions-4.md#mtxf_lookat) - [mtxf_mul](functions-4.md#mtxf_mul) - [mtxf_mul_vec3s](functions-4.md#mtxf_mul_vec3s) - - [mtxf_rotate_xy](functions-4.md#mtxf_rotate_xy) - [mtxf_rotate_xyz_and_translate](functions-4.md#mtxf_rotate_xyz_and_translate) - [mtxf_rotate_zxy_and_translate](functions-4.md#mtxf_rotate_zxy_and_translate) - [mtxf_scale_vec3f](functions-4.md#mtxf_scale_vec3f) - - [mtxf_to_mtx](functions-4.md#mtxf_to_mtx) - [mtxf_translate](functions-4.md#mtxf_translate) - [not_zero](functions-4.md#not_zero) - [sins](functions-4.md#sins) diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 80a271201..2253e0ce4 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -864,8 +864,6 @@ | Field | Type | Access | | ----- | ---- | ------ | | next | [DisplayListNode](structs.md#DisplayListNode) | | -| transform | `Pointer` <`Mtx`> | | -| transformPrev | `Pointer` <`Mtx`> | | | usingCamSpace | `integer` | | [:arrow_up_small:](#) diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 47489ebd1..3821f5838 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -671,12 +671,12 @@ static struct LuaObjectField sDateTimeFields[LUA_DATE_TIME_FIELD_COUNT] = { { "year", LVT_S32, offsetof(struct DateTime, year), false, LOT_NONE }, }; -#define LUA_DISPLAY_LIST_NODE_FIELD_COUNT 4 +#define LUA_DISPLAY_LIST_NODE_FIELD_COUNT 2 static struct LuaObjectField sDisplayListNodeFields[LUA_DISPLAY_LIST_NODE_FIELD_COUNT] = { // { "displayList", LVT_???, offsetof(struct DisplayListNode, displayList), false, LOT_??? }, <--- UNIMPLEMENTED { "next", LVT_COBJECT_P, offsetof(struct DisplayListNode, next), false, LOT_DISPLAYLISTNODE }, - { "transform", LVT_COBJECT_P, offsetof(struct DisplayListNode, transform), false, LOT_POINTER }, - { "transformPrev", LVT_COBJECT_P, offsetof(struct DisplayListNode, transformPrev), false, LOT_POINTER }, +// { "transform", LVT_???, offsetof(struct DisplayListNode, transform), false, LOT_??? }, <--- UNIMPLEMENTED +// { "transformPrev", LVT_???, offsetof(struct DisplayListNode, transformPrev), false, LOT_??? }, <--- UNIMPLEMENTED { "usingCamSpace", LVT_U8, offsetof(struct DisplayListNode, usingCamSpace), false, LOT_NONE }, }; @@ -981,8 +981,8 @@ static struct LuaObjectField sGraphNodeCameraFields[LUA_GRAPH_NODE_CAMERA_FIELD_ // { "config", LOT_???, offsetof(struct GraphNodeCamera, config), false, LOT_??? }, <--- UNIMPLEMENTED { "fnNode", LVT_COBJECT, offsetof(struct GraphNodeCamera, fnNode), true, LOT_FNGRAPHNODE }, { "focus", LVT_COBJECT, offsetof(struct GraphNodeCamera, focus), true, LOT_VEC3F }, - { "matrixPtr", LVT_COBJECT_P, offsetof(struct GraphNodeCamera, matrixPtr), false, LOT_POINTER }, - { "matrixPtrPrev", LVT_COBJECT_P, offsetof(struct GraphNodeCamera, matrixPtrPrev), true, LOT_POINTER }, + { "matrixPtr", LVT_COBJECT_P, offsetof(struct GraphNodeCamera, matrixPtr), false, LOT_MAT4 }, + { "matrixPtrPrev", LVT_COBJECT_P, offsetof(struct GraphNodeCamera, matrixPtrPrev), true, LOT_MAT4 }, { "pos", LVT_COBJECT, offsetof(struct GraphNodeCamera, pos), true, LOT_VEC3F }, { "prevFocus", LVT_COBJECT, offsetof(struct GraphNodeCamera, prevFocus), true, LOT_VEC3F }, { "prevPos", LVT_COBJECT, offsetof(struct GraphNodeCamera, prevPos), true, LOT_VEC3F }, @@ -1060,8 +1060,8 @@ static struct LuaObjectField sGraphNodeObjectFields[LUA_GRAPH_NODE_OBJECT_FIELD_ { "sharedChild", LVT_COBJECT_P, offsetof(struct GraphNodeObject, sharedChild), true, LOT_GRAPHNODE }, { "skipInViewCheck", LVT_BOOL, offsetof(struct GraphNodeObject, skipInViewCheck), false, LOT_NONE }, { "skipInterpolationTimestamp", LVT_U32, offsetof(struct GraphNodeObject, skipInterpolationTimestamp), true, LOT_NONE }, - { "throwMatrix", LVT_COBJECT_P, offsetof(struct GraphNodeObject, throwMatrix), false, LOT_POINTER }, - { "throwMatrixPrev", LVT_COBJECT_P, offsetof(struct GraphNodeObject, throwMatrixPrev), true, LOT_POINTER }, + { "throwMatrix", LVT_COBJECT_P, offsetof(struct GraphNodeObject, throwMatrix), false, LOT_MAT4 }, + { "throwMatrixPrev", LVT_COBJECT_P, offsetof(struct GraphNodeObject, throwMatrixPrev), true, LOT_MAT4 }, { "unk4C", LVT_COBJECT_P, offsetof(struct GraphNodeObject, unk4C), true, LOT_SPAWNINFO }, }; @@ -1386,7 +1386,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_COBJECT_P, offsetof(struct MarioState, splineKeyframe), false, LOT_POINTER }, + { "splineKeyframe", LVT_COBJECT_P, offsetof(struct MarioState, splineKeyframe), false, LOT_VEC4S }, { "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 }, diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 27108dabf..8f7ac2dc5 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -9141,7 +9141,7 @@ int smlua_func_geo_snufit_move_mask(lua_State* L) { 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 %u for function '%s'", 2, "geo_snufit_move_mask"); return 0; } - Mat4 * c = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + Mat4 * c = (Mat4 *)smlua_to_cobject(L, 3, LOT_MAT4); 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)); @@ -9164,7 +9164,7 @@ int smlua_func_geo_snufit_scale_body(lua_State* L) { 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 %u for function '%s'", 2, "geo_snufit_scale_body"); return 0; } - Mat4 * c = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + Mat4 * c = (Mat4 *)smlua_to_cobject(L, 3, LOT_MAT4); 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)); @@ -9187,7 +9187,7 @@ int smlua_func_geo_switch_bowser_eyes(lua_State* L) { 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 %u for function '%s'", 2, "geo_switch_bowser_eyes"); return 0; } - Mat4 * mtx = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + Mat4 * mtx = (Mat4 *)smlua_to_cobject(L, 3, LOT_MAT4); 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)); @@ -9210,7 +9210,7 @@ int smlua_func_geo_switch_tuxie_mother_eyes(lua_State* L) { 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 %u for function '%s'", 2, "geo_switch_tuxie_mother_eyes"); return 0; } - Mat4 * mtx = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + Mat4 * mtx = (Mat4 *)smlua_to_cobject(L, 3, LOT_MAT4); 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)); @@ -18480,7 +18480,7 @@ int smlua_func_anim_spline_init(lua_State* L) { struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); 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); + Vec4s * keyFrames = (Vec4s *)smlua_to_cobject(L, 2, LOT_VEC4S); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "anim_spline_init"); return 0; } anim_spline_init(m, keyFrames); @@ -19567,6 +19567,7 @@ int smlua_func_mtxf_mul_vec3s(lua_State* L) { return 1; } +/* int smlua_func_mtxf_rotate_xy(lua_State* L) { if (L == NULL) { return 0; } @@ -19576,7 +19577,7 @@ int smlua_func_mtxf_rotate_xy(lua_State* L) { return 0; } - Mtx * mtx = (Mtx *)smlua_to_cpointer(L, 1, LVT_COBJECT_P); +// Mtx * mtx = (Mtx *)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED 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 %u for function '%s'", 2, "mtxf_rotate_xy"); return 0; } @@ -19585,6 +19586,7 @@ int smlua_func_mtxf_rotate_xy(lua_State* L) { return 1; } +*/ int smlua_func_mtxf_rotate_xyz_and_translate(lua_State* L) { if (L == NULL) { return 0; } @@ -19825,6 +19827,7 @@ int smlua_func_mtxf_scale_vec3f(lua_State* L) { return 1; } +/* int smlua_func_mtxf_to_mtx(lua_State* L) { if (L == NULL) { return 0; } @@ -19834,7 +19837,7 @@ int smlua_func_mtxf_to_mtx(lua_State* L) { return 0; } - Mtx * dest = (Mtx *)smlua_to_cpointer(L, 1, LVT_COBJECT_P); +// Mtx * dest = (Mtx *)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mtxf_to_mtx"); return 0; } Mat4 src; @@ -19877,6 +19880,7 @@ int smlua_func_mtxf_to_mtx(lua_State* L) { return 1; } +*/ int smlua_func_mtxf_translate(lua_State* L) { if (L == NULL) { return 0; } @@ -21485,7 +21489,7 @@ int smlua_func_geo_obj_transparency_something(lua_State* L) { 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 %u for function '%s'", 2, "geo_obj_transparency_something"); return 0; } - Mat4 * mtx = (Mat4 *)smlua_to_cpointer(L, 3, LVT_COBJECT_P); + Mat4 * mtx = (Mat4 *)smlua_to_cobject(L, 3, LOT_MAT4); 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); @@ -34650,11 +34654,11 @@ void smlua_bind_functions_autogen(void) { 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_xy", smlua_func_mtxf_rotate_xy); <--- UNIMPLEMENTED 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_to_mtx", smlua_func_mtxf_to_mtx); <--- UNIMPLEMENTED smlua_bind_function(L, "mtxf_translate", smlua_func_mtxf_translate); smlua_bind_function(L, "not_zero", smlua_func_not_zero); smlua_bind_function(L, "sins", smlua_func_sins);