Fix clang/mac compile

This commit is contained in:
MysterD 2022-05-19 19:42:07 -07:00
parent 59e26fbc86
commit de2300f837
13 changed files with 110 additions and 54 deletions

View file

@ -678,7 +678,7 @@ else ifeq ($(COMPILER),clang)
CC := clang
CXX := clang++
CPP := clang++
EXTRA_CFLAGS += -Wno-unused-function -Wno-unused-variable -Wno-unknown-warning-option -Wno-self-assign -Wno-unknown-pragmas
EXTRA_CFLAGS += -Wno-unused-function -Wno-unused-variable -Wno-unknown-warning-option -Wno-self-assign -Wno-unknown-pragmas -Wno-unused-result
else ifeq ($(TARGET_WEB),1) # As in, web PC port
CC := emcc
CXX := emcc

View file

@ -47,6 +47,7 @@ Gfx *geo_num3_switch(s32 callContext, struct GraphNode *node, UNUSED void *conte
switchCase->selectedCase = 10;
}
}
return NULL;
}
extern const Gfx dl_billboard_num3_0[];

View file

@ -3693,6 +3693,11 @@ function get_current_background_music()
-- ...
end
--- @return integer
function get_current_background_music_default_volume()
-- ...
end
--- @return integer
function get_current_background_music_max_target_volume()
-- ...
@ -4232,6 +4237,14 @@ function set_mario_animation(m, targetAnimID)
-- ...
end
--- @param m MarioState
--- @param flags integer
--- @param clear integer
--- @return nil
function set_mario_particle_flags(m, flags, clear)
-- ...
end
--- @param m MarioState
--- @param initialVelY number
--- @param multiplier number
@ -7434,19 +7447,19 @@ function set_environment_region(index, value)
end
--- @param far number
--- @return number
--- @return nil
function set_override_far(far)
-- ...
end
--- @param fov number
--- @return number
--- @return nil
function set_override_fov(fov)
-- ...
end
--- @param near number
--- @return number
--- @return nil
function set_override_near(near)
-- ...
end

View file

@ -2396,6 +2396,24 @@
<br />
## [get_current_background_music_default_volume](#get_current_background_music_default_volume)
### Lua Example
`local integerValue = get_current_background_music_default_volume()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`u8 get_current_background_music_default_volume(void);`
[:arrow_up_small:](#)
<br />
## [get_current_background_music_max_target_volume](#get_current_background_music_max_target_volume)
### Lua Example
@ -4064,6 +4082,28 @@
<br />
## [set_mario_particle_flags](#set_mario_particle_flags)
### Lua Example
`set_mario_particle_flags(m, flags, clear)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| flags | `integer` |
| clear | `integer` |
### Returns
- None
### C Prototype
`void set_mario_particle_flags(struct MarioState* m, u32 flags, u8 clear);`
[:arrow_up_small:](#)
<br />
## [set_mario_y_vel_based_on_fspeed](#set_mario_y_vel_based_on_fspeed)
### Lua Example

View file

@ -5498,7 +5498,7 @@
## [set_override_far](#set_override_far)
### Lua Example
`local numberValue = set_override_far(far)`
`set_override_far(far)`
### Parameters
| Field | Type |
@ -5506,10 +5506,10 @@
| far | `number` |
### Returns
- `number`
- None
### C Prototype
`f32 set_override_far(f32 far);`
`void set_override_far(f32 far);`
[:arrow_up_small:](#)
@ -5518,7 +5518,7 @@
## [set_override_fov](#set_override_fov)
### Lua Example
`local numberValue = set_override_fov(fov)`
`set_override_fov(fov)`
### Parameters
| Field | Type |
@ -5526,10 +5526,10 @@
| fov | `number` |
### Returns
- `number`
- None
### C Prototype
`f32 set_override_fov(f32 fov);`
`void set_override_fov(f32 fov);`
[:arrow_up_small:](#)
@ -5538,7 +5538,7 @@
## [set_override_near](#set_override_near)
### Lua Example
`local numberValue = set_override_near(near)`
`set_override_near(near)`
### Parameters
| Field | Type |
@ -5546,10 +5546,10 @@
| near | `number` |
### Returns
- `number`
- None
### C Prototype
`f32 set_override_near(f32 near);`
`void set_override_near(f32 near);`
[:arrow_up_small:](#)

View file

@ -729,6 +729,7 @@
- [fade_volume_scale](functions-3.md#fade_volume_scale)
- [fadeout_background_music](functions-3.md#fadeout_background_music)
- [get_current_background_music](functions-3.md#get_current_background_music)
- [get_current_background_music_default_volume](functions-3.md#get_current_background_music_default_volume)
- [get_current_background_music_max_target_volume](functions-3.md#get_current_background_music_max_target_volume)
- [get_current_background_music_target_volume](functions-3.md#get_current_background_music_target_volume)
- [is_current_background_music_volume_lowered](functions-3.md#is_current_background_music_volume_lowered)
@ -821,6 +822,7 @@
- [set_mario_action](functions-3.md#set_mario_action)
- [set_mario_anim_with_accel](functions-3.md#set_mario_anim_with_accel)
- [set_mario_animation](functions-3.md#set_mario_animation)
- [set_mario_particle_flags](functions-3.md#set_mario_particle_flags)
- [set_mario_y_vel_based_on_fspeed](functions-3.md#set_mario_y_vel_based_on_fspeed)
- [set_steep_jump_action](functions-3.md#set_steep_jump_action)
- [set_water_plunge_action](functions-3.md#set_water_plunge_action)

View file

@ -7,6 +7,7 @@
#include "pc/utils/misc.h"
#include "src/game/level_update.h"
#include "src/game/hardcoded.h"
#include "src/engine/math_util.h"
#include "audio/external.h"
#include "sounds.h"

View file

@ -624,14 +624,16 @@ static void import_texture(int tile) {
// make sure the texture id is a printable ascii string
bool texidIsPrintable = true;
char* c = (char*)texid;
u16 length = 0;
while (c != NULL && *c != '\0') {
if (*c < 33 || *c > 126) {
texidIsPrintable = false;
break;
}
length++;
c++;
}
if (texidIsPrintable) {
if (texidIsPrintable && length > 0) {
char texname[SYS_MAX_PATH];
snprintf(texname, sizeof(texname), FS_TEXTUREDIR "/%s.png", texid);
load_texture(texname);

View file

@ -178,11 +178,13 @@ int smlua_func_network_send_object(lua_State* L) {
int smlua_func_network_send(lua_State* L) {
if (!smlua_functions_valid_param_count(L, 2)) { return 0; }
network_send_lua_custom(true);
return 1;
}
int smlua_func_network_send_to(lua_State* L) {
if (!smlua_functions_valid_param_count(L, 3)) { return 0; }
network_send_lua_custom(false);
return 1;
}
//////////////

View file

@ -7447,6 +7447,15 @@ int smlua_func_get_current_background_music(UNUSED lua_State* L) {
return 1;
}
int smlua_func_get_current_background_music_default_volume(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
lua_pushinteger(L, get_current_background_music_default_volume());
return 1;
}
int smlua_func_get_current_background_music_max_target_volume(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
@ -8489,6 +8498,21 @@ int smlua_func_set_mario_animation(lua_State* L) {
return 1;
}
int smlua_func_set_mario_particle_flags(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
u32 flags = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
u8 clear = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3"); return 0; }
set_mario_particle_flags(m, flags, clear);
return 1;
}
int smlua_func_set_mario_y_vel_based_on_fspeed(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
@ -15282,7 +15306,7 @@ int smlua_func_set_override_far(lua_State* L) {
f32 far = smlua_to_number(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
lua_pushnumber(L, set_override_far(far));
set_override_far(far);
return 1;
}
@ -15293,7 +15317,7 @@ int smlua_func_set_override_fov(lua_State* L) {
f32 fov = smlua_to_number(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
lua_pushnumber(L, set_override_fov(fov));
set_override_fov(fov);
return 1;
}
@ -15304,7 +15328,7 @@ int smlua_func_set_override_near(lua_State* L) {
f32 near = smlua_to_number(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
lua_pushnumber(L, set_override_near(near));
set_override_near(near);
return 1;
}
@ -16951,6 +16975,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "fade_volume_scale", smlua_func_fade_volume_scale);
smlua_bind_function(L, "fadeout_background_music", smlua_func_fadeout_background_music);
smlua_bind_function(L, "get_current_background_music", smlua_func_get_current_background_music);
smlua_bind_function(L, "get_current_background_music_default_volume", smlua_func_get_current_background_music_default_volume);
smlua_bind_function(L, "get_current_background_music_max_target_volume", smlua_func_get_current_background_music_max_target_volume);
smlua_bind_function(L, "get_current_background_music_target_volume", smlua_func_get_current_background_music_target_volume);
smlua_bind_function(L, "is_current_background_music_volume_lowered", smlua_func_is_current_background_music_volume_lowered);
@ -17037,6 +17062,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "set_mario_action", smlua_func_set_mario_action);
smlua_bind_function(L, "set_mario_anim_with_accel", smlua_func_set_mario_anim_with_accel);
smlua_bind_function(L, "set_mario_animation", smlua_func_set_mario_animation);
smlua_bind_function(L, "set_mario_particle_flags", smlua_func_set_mario_particle_flags);
smlua_bind_function(L, "set_mario_y_vel_based_on_fspeed", smlua_func_set_mario_y_vel_based_on_fspeed);
smlua_bind_function(L, "set_steep_jump_action", smlua_func_set_steep_jump_action);
smlua_bind_function(L, "set_water_plunge_action", smlua_func_set_water_plunge_action);

View file

@ -192,14 +192,14 @@ void set_environment_region(u8 index, s32 value) {
}
}
f32 set_override_fov(f32 fov) {
void set_override_fov(f32 fov) {
gOverrideFOV = fov;
}
f32 set_override_near(f32 near) {
void set_override_near(f32 near) {
gOverrideNear = near;
}
f32 set_override_far(f32 far) {
void set_override_far(f32 far) {
gOverrideFar = far;
}

View file

@ -59,9 +59,9 @@ void movtexqc_register(const char* name, s16 level, s16 area, s16 type);
f32 get_environment_region(u8 index);
void set_environment_region(u8 index, s32 value);
f32 set_override_fov(f32 fov);
f32 set_override_near(f32 near);
f32 set_override_far(f32 far);
void set_override_fov(f32 fov);
void set_override_near(f32 near);
void set_override_far(f32 far);
void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue);

View file

@ -129,37 +129,6 @@ static f32 asins(f32 val) {
return radians_to_sm64(asin(sm64_to_radians(val)));
}
void mtx_to_euler1(Mtx* mat, Vec3s rot) {
if (mat->m[1][1] == 1.0f) {
rot[0] = 0;
rot[1] = atan2(mat->m[1][3], mat->m[3][4]);
rot[2] = 0;
} else if (mat->m[1][1] == -1.0f) {
rot[0] = 0;
rot[1] = atan2(mat->m[1][3], mat->m[3][4]);
rot[2] = 0;
} else {
rot[0] = asin(mat->m[2][1]);
rot[1] = atan2(-mat->m[3][1], mat->m[1][1]);
rot[2] = atan2(-mat->m[2][3], mat->m[2][2]);
}
}
void mtx_to_euler2(Mtx* mat, Vec3s rot) {
if (mat->m[1][1] == 1.0f) {
rot[0] = 0;
rot[1] = atan2(mat->m[3][1], mat->m[4][3]);
rot[2] = 0;
} else if (mat->m[1][1] == -1.0f) {
rot[0] = 0;
rot[1] = atan2(mat->m[3][1], mat->m[4][3]);
rot[2] = 0;
} else {
rot[0] = asin(mat->m[1][2]);
rot[1] = atan2(-mat->m[1][3], mat->m[1][1]);
rot[2] = atan2(-mat->m[3][2], mat->m[2][2]);
}
}
f32 delta_interpolate_f32(f32 start, f32 end, f32 delta) {
return start * (1.0f - delta) + end * delta;
}