mirror of
				https://github.com/coop-deluxe/sm64coopdx.git
				synced 2025-10-30 08:01:01 +00:00 
			
		
		
		
	fix some issue with recent prs
This commit is contained in:
		
							parent
							
								
									3dd9226bc9
								
							
						
					
					
						commit
						f8a30e4fd8
					
				
					 7 changed files with 17 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -8201,7 +8201,7 @@ end
 | 
			
		|||
--- @param a number
 | 
			
		||||
--- @param b number
 | 
			
		||||
--- @return number
 | 
			
		||||
function fast_hypot(a, b)
 | 
			
		||||
function hypotf(a, b)
 | 
			
		||||
    -- ...
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1821,10 +1821,10 @@
 | 
			
		|||
 | 
			
		||||
<br />
 | 
			
		||||
 | 
			
		||||
## [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:](#)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue