From bef610d3ff4e94957d0883ef5bce1109556e69d7 Mon Sep 17 00:00:00 2001 From: chromaticpipe Date: Fri, 1 Aug 2025 09:30:32 -0500 Subject: [PATCH] Clamp the lightlevel at the start of HWR_Lighting() Allows secbright to work without shaders --- src/hardware/hw_main.cpp | 6 +++--- src/m_menudefs.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index fa9c87e74..2e64cc7b2 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -418,6 +418,9 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col tint_color.rgba = (colormap != NULL) ? (UINT32)colormap->rgba : GL_DEFAULTMIX; fade_color.rgba = (colormap != NULL) ? (UINT32)colormap->fadergba : GL_DEFAULTFOG; + // Clamp the light level, since it can sometimes go out of the 0-255 range from animations + light_level = CLAMP(SOFTLIGHT(light_level), cv_glsecbright.value, 255); + // Crappy backup coloring if you can't do shaders if (!HWR_UseShader()) { @@ -455,9 +458,6 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col poly_color.s.blue = (UINT8)blue; } - // Clamp the light level, since it can sometimes go out of the 0-255 range from animations - light_level = CLAMP(SOFTLIGHT(light_level), cv_glsecbright.value, 255); - // in palette rendering mode, this is not needed since it properly takes the changes to the palette itself if (!HWR_ShouldUsePaletteRendering()) { diff --git a/src/m_menudefs.c b/src/m_menudefs.c index e5e97820b..aff301a07 100644 --- a/src/m_menudefs.c +++ b/src/m_menudefs.c @@ -1026,7 +1026,7 @@ static const char* OP_OpenGLTooltips[] = "Graphical Shaders.", "Recreates the look of software mode.", "Flash palettes for palette rendering.", - "Minimum shader brightness. This is set in sector brightness values.", + "Sets minimum sector brightness, useful for dark areas", "Bit-depth of textures.", "Filter to use on textures.", "Anisotropic filtering.",