From f8a30e4fd8c16f36036b26de049a455c7bae019f Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Fri, 18 Oct 2024 12:47:24 +1000 Subject: [PATCH] fix some issue with recent prs --- autogen/lua_definitions/functions.lua | 2 +- data/dynos_mgr_builtin.cpp | 2 +- docs/lua/functions-5.md | 6 +++--- docs/lua/functions.md | 2 +- src/engine/math_util.h | 7 ++++--- src/pc/lua/smlua_functions_autogen.c | 12 ++++++------ src/pc/lua/utils/smlua_math_utils.h | 2 +- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 927b1ee9..c96badca 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -8201,7 +8201,7 @@ end --- @param a number --- @param b number --- @return number -function fast_hypot(a, b) +function hypotf(a, b) -- ... end diff --git a/data/dynos_mgr_builtin.cpp b/data/dynos_mgr_builtin.cpp index 96fb22fe..22e3fa6b 100644 --- a/data/dynos_mgr_builtin.cpp +++ b/data/dynos_mgr_builtin.cpp @@ -1398,7 +1398,6 @@ static const void* sDynosBuiltinFuncs[] = { define_builtin(geo_movtex_draw_water_regions_ext), define_builtin(lvl_init_or_update), define_builtin(geo_choose_area_ext), - define_builtin(geo_mario_cap_display_list), // Behaviors define_builtin(bhv_cap_switch_loop), @@ -1976,6 +1975,7 @@ static const void* sDynosBuiltinFuncs[] = { define_builtin(bhv_star_number_loop), define_builtin(spawn_star_number), define_builtin(bhv_ferris_wheel_platform_init), + define_builtin(geo_mario_cap_display_list), }; const void* DynOS_Builtin_Func_GetFromName(const char* aDataName) { diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index 9971063b..74826ced 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -1821,10 +1821,10 @@
-## [fast_hypot](#fast_hypot) +## [hypotf](#hypotf) ### Lua Example -`local numberValue = fast_hypot(a, b)` +`local numberValue = hypotf(a, b)` ### Parameters | Field | Type | @@ -1836,7 +1836,7 @@ - `number` ### C Prototype -`f32 fast_hypot(f32 a, f32 b);` +`f32 hypotf(f32 a, f32 b);` [:arrow_up_small:](#) diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 88e0783a..ce7b3baf 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1718,7 +1718,7 @@ - [clamp](functions-5.md#clamp) - [clampf](functions-5.md#clampf) - [degrees_to_sm64](functions-5.md#degrees_to_sm64) - - [fast_hypot](functions-5.md#fast_hypot) + - [hypotf](functions-5.md#hypotf) - [radians_to_sm64](functions-5.md#radians_to_sm64) - [sm64_to_degrees](functions-5.md#sm64_to_degrees) - [sm64_to_radians](functions-5.md#sm64_to_radians) diff --git a/src/engine/math_util.h b/src/engine/math_util.h index f187948e..f05cff97 100644 --- a/src/engine/math_util.h +++ b/src/engine/math_util.h @@ -52,9 +52,10 @@ f32 coss(s16 sm64Angle); #if defined(__clang__) || defined(__GNUC__) #define absx(x) _Generic((x), \ - f32: __builtin_fabsf(x), \ - default: __builtin_abs(x) \ -) + f32: __builtin_fabsf, \ + double: __builtin_fabs, \ + default: __builtin_abs \ +)(x) #else diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 11ca3cc0..a24cfd88 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -30199,21 +30199,21 @@ int smlua_func_degrees_to_sm64(lua_State* L) { return 1; } -int smlua_func_fast_hypot(lua_State* L) { +int smlua_func_hypotf(lua_State* L) { if (L == NULL) { return 0; } int top = lua_gettop(L); if (top != 2) { - LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "fast_hypot", 2, top); + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hypotf", 2, top); return 0; } f32 a = smlua_to_number(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "fast_hypot"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "hypotf"); return 0; } f32 b = smlua_to_number(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "fast_hypot"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "hypotf"); return 0; } - lua_pushnumber(L, fast_hypot(a, b)); + lua_pushnumber(L, hypotf(a, b)); return 1; } @@ -34873,7 +34873,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "clamp", smlua_func_clamp); smlua_bind_function(L, "clampf", smlua_func_clampf); smlua_bind_function(L, "degrees_to_sm64", smlua_func_degrees_to_sm64); - smlua_bind_function(L, "fast_hypot", smlua_func_fast_hypot); + smlua_bind_function(L, "hypotf", smlua_func_hypotf); smlua_bind_function(L, "radians_to_sm64", smlua_func_radians_to_sm64); smlua_bind_function(L, "sm64_to_degrees", smlua_func_sm64_to_degrees); smlua_bind_function(L, "sm64_to_radians", smlua_func_sm64_to_radians); diff --git a/src/pc/lua/utils/smlua_math_utils.h b/src/pc/lua/utils/smlua_math_utils.h index 38be442b..7d1b4047 100644 --- a/src/pc/lua/utils/smlua_math_utils.h +++ b/src/pc/lua/utils/smlua_math_utils.h @@ -5,7 +5,7 @@ f32 sm64_to_radians(s16 sm64Angle); s16 radians_to_sm64(f32 radiansAngle); f32 sm64_to_degrees(s16 sm64Angle); s16 degrees_to_sm64(f32 degreesAngle); -f32 fast_hypot(f32 a, f32 b); +f32 hypotf(f32 a, f32 b); s32 clamp(s32 a, s32 b, s32 c); f32 clampf(f32 a, f32 b, f32 c);