Add global enabled function

This commit is contained in:
Agent X 2026-02-12 20:58:02 -05:00
parent 5f7f29a5b5
commit b4ab1fd37d
8 changed files with 19 additions and 19 deletions

View file

@ -10699,8 +10699,8 @@ 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_shader_flags_screen(enabled)
--- Enables custom shader flags as a global toggle, useful for disabling without manually going through every effect
function enable_shader_flags_global(enabled)
-- ...
end

View file

@ -7507,13 +7507,13 @@ Sets a value for one of the custom shader flags (`SHADER_FLAG_*`) for the render
<br />
## [enable_shader_flags_screen](#enable_shader_flags_screen)
## [enable_shader_flags_global](#enable_shader_flags_global)
### Description
Enables custom shader flags applying to everything, including HUD elements and menus
Enables custom shader flags as a global toggle, useful for disabling without manually going through every effect
### Lua Example
`enable_shader_flags_screen(enabled)`
`enable_shader_flags_global(enabled)`
### Parameters
| Field | Type |
@ -7524,7 +7524,7 @@ Enables custom shader flags applying to everything, including HUD elements and m
- None
### C Prototype
`void enable_shader_flags_screen(bool enabled);`
`void enable_shader_flags_global(bool enabled);`
[:arrow_up_small:](#)

View file

@ -1918,7 +1918,7 @@
- smlua_gfx_utils.h
- [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)
- [enable_shader_flags_global](functions-6.md#enable_shader_flags_global)
- [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)

View file

@ -128,7 +128,7 @@ 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, 1.0f };
f32 gShaderFlagValues[SHADER_FLAG_MAX] = { 0 };
bool gShaderFlagsScreen = false;
bool gShaderFlagsEnabled = true;
// need inverse camera matrix to compute world space for lighting engine
static Mat4 sInverseCameraMatrix;
@ -1104,7 +1104,7 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
cm->use_2cycle = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE)) == G_CYC_2CYCLE;
cm->use_fog = (rdp.other_mode_l >> 30) == G_BL_CLR_FOG;
cm->light_map = (rsp.geometry_mode & G_LIGHT_MAP_EXT) == G_LIGHT_MAP_EXT;
cm->world_geometry = (v1->world_geometry && v2->world_geometry && v3->world_geometry) || gShaderFlagsScreen;
cm->world_geometry = gShaderFlagsEnabled && (v1->world_geometry && v2->world_geometry && v3->world_geometry);
if (cm->texture_edge) {
cm->use_alpha = true;

View file

@ -28,7 +28,7 @@ extern f32 gFogIntensity;
extern int gShaderFlags[SHADER_FLAG_MAX];
extern f32 gDefaultShaderFlagValues[SHADER_FLAG_MAX];
extern f32 gShaderFlagValues[SHADER_FLAG_MAX];
extern bool gShaderFlagsScreen;
extern bool gShaderFlagsEnabled;
#ifdef __cplusplus
extern "C" {

View file

@ -32296,19 +32296,19 @@ int smlua_func_set_shader_flag_value(lua_State* L) {
return 1;
}
int smlua_func_enable_shader_flags_screen(lua_State* L) {
int smlua_func_enable_shader_flags_global(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_shader_flags_screen", 1, top);
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "enable_shader_flags_global", 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_shader_flags_screen"); return 0; }
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "enable_shader_flags_global"); return 0; }
enable_shader_flags_screen(enabled);
enable_shader_flags_global(enabled);
return 1;
}
@ -38902,7 +38902,7 @@ void smlua_bind_functions_autogen(void) {
// smlua_gfx_utils.h
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, "enable_shader_flags_global", smlua_func_enable_shader_flags_global);
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);

View file

@ -14,8 +14,8 @@ void set_shader_flag_value(enum ShaderFlag flag, f32 value) {
gShaderFlagValues[flag] = value;
}
void enable_shader_flags_screen(bool enabled) {
gShaderFlagsScreen = enabled;
void enable_shader_flags_global(bool enabled) {
gShaderFlagsEnabled = enabled;
}
AT_STARTUP void clear_all_shader_flags(void) {

View file

@ -17,8 +17,8 @@ u32 gfx_get_length_no_sentinel(const Gfx *gfx);
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_shader_flag_value(enum ShaderFlag flag, f32 value);
/* |description|Enables custom shader flags applying to everything, including HUD elements and menus|descriptionEnd| */
void enable_shader_flags_screen(bool enabled);
/* |description|Enables custom shader flags as a global toggle, useful for disabling without manually going through every effect|descriptionEnd| */
void enable_shader_flags_global(bool enabled);
/* |description|Clears all custom shader flags (`SHADER_FLAG_*`) for the renderer|descriptionEnd| */
void clear_all_shader_flags(void);