mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-25 03:22:07 +00:00
Add default values and better function names
Also fixed sizes in reset function
This commit is contained in:
parent
6506af08cb
commit
4459432c64
9 changed files with 55 additions and 53 deletions
|
|
@ -10687,25 +10687,25 @@ end
|
|||
--- @param flag ShaderFlag
|
||||
--- @param enabled boolean
|
||||
--- Enables a custom shader flag (`SHADER_FLAG_*`) for the renderer
|
||||
function enable_gfx_shader_flag(flag, enabled)
|
||||
function enable_shader_flag(flag, enabled)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param flag ShaderFlag
|
||||
--- @param value number
|
||||
--- Sets a value for one of the custom shader flags (`SHADER_FLAG_*`) for the renderer
|
||||
function set_gfx_shader_flag_value(flag, value)
|
||||
function set_shader_flag_value(flag, value)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param enabled boolean
|
||||
--- Enables custom shader flags applying to everything, including HUD elements and menus
|
||||
function enable_gfx_shader_flags_screen(enabled)
|
||||
function enable_shader_flags_screen(enabled)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- Clears all custom shader flags (`SHADER_FLAG_*`) for the renderer
|
||||
function clear_all_gfx_shader_flags()
|
||||
function clear_all_shader_flags()
|
||||
-- ...
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7459,13 +7459,13 @@ Checks if the surface is a painting warp
|
|||
<br />
|
||||
|
||||
|
||||
## [enable_gfx_shader_flag](#enable_gfx_shader_flag)
|
||||
## [enable_shader_flag](#enable_shader_flag)
|
||||
|
||||
### Description
|
||||
Enables a custom shader flag (`SHADER_FLAG_*`) for the renderer
|
||||
|
||||
### Lua Example
|
||||
`enable_gfx_shader_flag(flag, enabled)`
|
||||
`enable_shader_flag(flag, enabled)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
|
|
@ -7477,19 +7477,19 @@ Enables a custom shader flag (`SHADER_FLAG_*`) for the renderer
|
|||
- None
|
||||
|
||||
### C Prototype
|
||||
`void enable_gfx_shader_flag(enum ShaderFlag flag, bool enabled);`
|
||||
`void enable_shader_flag(enum ShaderFlag flag, bool enabled);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [set_gfx_shader_flag_value](#set_gfx_shader_flag_value)
|
||||
## [set_shader_flag_value](#set_shader_flag_value)
|
||||
|
||||
### Description
|
||||
Sets a value for one of the custom shader flags (`SHADER_FLAG_*`) for the renderer
|
||||
|
||||
### Lua Example
|
||||
`set_gfx_shader_flag_value(flag, value)`
|
||||
`set_shader_flag_value(flag, value)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
|
|
@ -7501,19 +7501,19 @@ Sets a value for one of the custom shader flags (`SHADER_FLAG_*`) for the render
|
|||
- None
|
||||
|
||||
### C Prototype
|
||||
`void set_gfx_shader_flag_value(enum ShaderFlag flag, f32 value);`
|
||||
`void set_shader_flag_value(enum ShaderFlag flag, f32 value);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [enable_gfx_shader_flags_screen](#enable_gfx_shader_flags_screen)
|
||||
## [enable_shader_flags_screen](#enable_shader_flags_screen)
|
||||
|
||||
### Description
|
||||
Enables custom shader flags applying to everything, including HUD elements and menus
|
||||
|
||||
### Lua Example
|
||||
`enable_gfx_shader_flags_screen(enabled)`
|
||||
`enable_shader_flags_screen(enabled)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
|
|
@ -7524,19 +7524,19 @@ Enables custom shader flags applying to everything, including HUD elements and m
|
|||
- None
|
||||
|
||||
### C Prototype
|
||||
`void enable_gfx_shader_flags_screen(bool enabled);`
|
||||
`void enable_shader_flags_screen(bool enabled);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [clear_all_gfx_shader_flags](#clear_all_gfx_shader_flags)
|
||||
## [clear_all_shader_flags](#clear_all_shader_flags)
|
||||
|
||||
### Description
|
||||
Clears all custom shader flags (`SHADER_FLAG_*`) for the renderer
|
||||
|
||||
### Lua Example
|
||||
`clear_all_gfx_shader_flags()`
|
||||
`clear_all_shader_flags()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
|
@ -7545,7 +7545,7 @@ Clears all custom shader flags (`SHADER_FLAG_*`) for the renderer
|
|||
- None
|
||||
|
||||
### C Prototype
|
||||
`void clear_all_gfx_shader_flags(void);`
|
||||
`void clear_all_shader_flags(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
|
|||
|
|
@ -1916,10 +1916,10 @@
|
|||
<br />
|
||||
|
||||
- smlua_gfx_utils.h
|
||||
- [enable_gfx_shader_flag](functions-6.md#enable_gfx_shader_flag)
|
||||
- [set_gfx_shader_flag_value](functions-6.md#set_gfx_shader_flag_value)
|
||||
- [enable_gfx_shader_flags_screen](functions-6.md#enable_gfx_shader_flags_screen)
|
||||
- [clear_all_gfx_shader_flags](functions-6.md#clear_all_gfx_shader_flags)
|
||||
- [enable_shader_flag](functions-6.md#enable_shader_flag)
|
||||
- [set_shader_flag_value](functions-6.md#set_shader_flag_value)
|
||||
- [enable_shader_flags_screen](functions-6.md#enable_shader_flags_screen)
|
||||
- [clear_all_shader_flags](functions-6.md#clear_all_shader_flags)
|
||||
- [set_override_fov](functions-6.md#set_override_fov)
|
||||
- [set_override_near](functions-6.md#set_override_near)
|
||||
- [set_override_far](functions-6.md#set_override_far)
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ Color gFogColor = { 0xFF, 0xFF, 0xFF };
|
|||
f32 gFogIntensity = 1;
|
||||
|
||||
int gShaderFlags[SHADER_FLAG_MAX] = { 0 };
|
||||
f32 gDefaultShaderFlagValues[SHADER_FLAG_MAX] = { 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 8.0f };
|
||||
f32 gShaderFlagValues[SHADER_FLAG_MAX] = { 0 };
|
||||
bool gShaderFlagsScreen = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ extern Color gFogColor;
|
|||
extern f32 gFogIntensity;
|
||||
|
||||
extern int gShaderFlags[SHADER_FLAG_MAX];
|
||||
extern f32 gDefaultShaderFlagValues[SHADER_FLAG_MAX];
|
||||
extern f32 gShaderFlagValues[SHADER_FLAG_MAX];
|
||||
extern bool gShaderFlagsScreen;
|
||||
|
||||
|
|
|
|||
|
|
@ -32258,72 +32258,72 @@ int smlua_func_network_player_palette_to_color(lua_State* L) {
|
|||
// smlua_gfx_utils.h //
|
||||
///////////////////////
|
||||
|
||||
int smlua_func_enable_gfx_shader_flag(lua_State* L) {
|
||||
int smlua_func_enable_shader_flag(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", "enable_gfx_shader_flag", 2, top);
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "enable_shader_flag", 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int flag = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "enable_gfx_shader_flag"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "enable_shader_flag"); return 0; }
|
||||
bool enabled = smlua_to_boolean(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "enable_gfx_shader_flag"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "enable_shader_flag"); return 0; }
|
||||
|
||||
enable_gfx_shader_flag(flag, enabled);
|
||||
enable_shader_flag(flag, enabled);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_set_gfx_shader_flag_value(lua_State* L) {
|
||||
int smlua_func_set_shader_flag_value(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", "set_gfx_shader_flag_value", 2, top);
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_shader_flag_value", 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int flag = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_gfx_shader_flag_value"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_shader_flag_value"); return 0; }
|
||||
f32 value = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_gfx_shader_flag_value"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_shader_flag_value"); return 0; }
|
||||
|
||||
set_gfx_shader_flag_value(flag, value);
|
||||
set_shader_flag_value(flag, value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_enable_gfx_shader_flags_screen(lua_State* L) {
|
||||
int smlua_func_enable_shader_flags_screen(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "enable_gfx_shader_flags_screen", 1, top);
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "enable_shader_flags_screen", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool enabled = smlua_to_boolean(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "enable_gfx_shader_flags_screen"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "enable_shader_flags_screen"); return 0; }
|
||||
|
||||
enable_gfx_shader_flags_screen(enabled);
|
||||
enable_shader_flags_screen(enabled);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_clear_all_gfx_shader_flags(UNUSED lua_State* L) {
|
||||
int smlua_func_clear_all_shader_flags(UNUSED lua_State* L) {
|
||||
if (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_all_gfx_shader_flags", 0, top);
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clear_all_shader_flags", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
clear_all_gfx_shader_flags();
|
||||
clear_all_shader_flags();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -38900,10 +38900,10 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "network_player_palette_to_color", smlua_func_network_player_palette_to_color);
|
||||
|
||||
// smlua_gfx_utils.h
|
||||
smlua_bind_function(L, "enable_gfx_shader_flag", smlua_func_enable_gfx_shader_flag);
|
||||
smlua_bind_function(L, "set_gfx_shader_flag_value", smlua_func_set_gfx_shader_flag_value);
|
||||
smlua_bind_function(L, "enable_gfx_shader_flags_screen", smlua_func_enable_gfx_shader_flags_screen);
|
||||
smlua_bind_function(L, "clear_all_gfx_shader_flags", smlua_func_clear_all_gfx_shader_flags);
|
||||
smlua_bind_function(L, "enable_shader_flag", smlua_func_enable_shader_flag);
|
||||
smlua_bind_function(L, "set_shader_flag_value", smlua_func_set_shader_flag_value);
|
||||
smlua_bind_function(L, "enable_shader_flags_screen", smlua_func_enable_shader_flags_screen);
|
||||
smlua_bind_function(L, "clear_all_shader_flags", smlua_func_clear_all_shader_flags);
|
||||
smlua_bind_function(L, "set_override_fov", smlua_func_set_override_fov);
|
||||
smlua_bind_function(L, "set_override_near", smlua_func_set_override_near);
|
||||
smlua_bind_function(L, "set_override_far", smlua_func_set_override_far);
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
#include "smlua_gfx_utils.h"
|
||||
#include "pc/gfx/gfx_pc.h"
|
||||
#include "pc/pc_main.h"
|
||||
#include "game/rendering_graph_node.h"
|
||||
#include "game/skybox.h"
|
||||
#include "geo_commands.h"
|
||||
|
||||
void enable_gfx_shader_flag(enum ShaderFlag flag, bool enabled) {
|
||||
void enable_shader_flag(enum ShaderFlag flag, bool enabled) {
|
||||
if (flag < 0 || flag >= SHADER_FLAG_MAX) { return; }
|
||||
gShaderFlags[flag] = enabled ? 1 : 0;
|
||||
}
|
||||
|
||||
void set_gfx_shader_flag_value(enum ShaderFlag flag, f32 value) {
|
||||
void set_shader_flag_value(enum ShaderFlag flag, f32 value) {
|
||||
if (flag < 0 || flag >= SHADER_FLAG_MAX) { return; }
|
||||
gShaderFlagValues[flag] = value;
|
||||
}
|
||||
|
||||
void enable_gfx_shader_flags_screen(bool enabled) {
|
||||
void enable_shader_flags_screen(bool enabled) {
|
||||
gShaderFlagsScreen = enabled;
|
||||
}
|
||||
|
||||
void clear_all_gfx_shader_flags(void) {
|
||||
memset(gShaderFlags, 0, sizeof(gShaderFlags));
|
||||
memset(gShaderFlagValues, 0, sizeof(gShaderFlagValues));
|
||||
AT_STARTUP void clear_all_shader_flags(void) {
|
||||
memset(gShaderFlags, 0, sizeof(s32) * SHADER_FLAG_MAX);
|
||||
memcpy(gShaderFlagValues, gDefaultShaderFlagValues, sizeof(f32) * SHADER_FLAG_MAX);
|
||||
}
|
||||
|
||||
///
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ Vtx *vtx_allocate_internal(Vtx *vtx, u32 count);
|
|||
u32 gfx_get_length_no_sentinel(const Gfx *gfx);
|
||||
|
||||
/* |description|Enables a custom shader flag (`SHADER_FLAG_*`) for the renderer|descriptionEnd| */
|
||||
void enable_gfx_shader_flag(enum ShaderFlag flag, bool enabled);
|
||||
void enable_shader_flag(enum ShaderFlag flag, bool enabled);
|
||||
/* |description|Sets a value for one of the custom shader flags (`SHADER_FLAG_*`) for the renderer|descriptionEnd| */
|
||||
void set_gfx_shader_flag_value(enum ShaderFlag flag, f32 value);
|
||||
void set_shader_flag_value(enum ShaderFlag flag, f32 value);
|
||||
/* |description|Enables custom shader flags applying to everything, including HUD elements and menus|descriptionEnd| */
|
||||
void enable_gfx_shader_flags_screen(bool enabled);
|
||||
void enable_shader_flags_screen(bool enabled);
|
||||
/* |description|Clears all custom shader flags (`SHADER_FLAG_*`) for the renderer|descriptionEnd| */
|
||||
void clear_all_gfx_shader_flags(void);
|
||||
void clear_all_shader_flags(void);
|
||||
|
||||
/* |description|Sets the override FOV|descriptionEnd| */
|
||||
void set_override_fov(f32 fov);
|
||||
|
|
|
|||
|
|
@ -722,7 +722,7 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
|
|||
color_set(gSkyboxColor, 0xFF, 0xFF, 0xFF);
|
||||
color_set(gFogColor, 0xFF, 0xFF, 0xFF);
|
||||
gFogIntensity = 1.0f;
|
||||
clear_all_gfx_shader_flags();
|
||||
clear_all_shader_flags();
|
||||
gOverrideBackground = -1;
|
||||
gOverrideEnvFx = ENVFX_MODE_NO_OVERRIDE;
|
||||
gRomhackCameraSettings.centering = FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue