From 5e94eaff8e88c795e881529673e6a0577e4b0748 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 16 May 2021 18:50:54 +0200 Subject: [PATCH] - new renderer: handle light level underflows. --- source/core/rendering/scene/hw_drawstructs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/rendering/scene/hw_drawstructs.h b/source/core/rendering/scene/hw_drawstructs.h index 3c2609e7a..5a9eeafab 100644 --- a/source/core/rendering/scene/hw_drawstructs.h +++ b/source/core/rendering/scene/hw_drawstructs.h @@ -421,7 +421,7 @@ __forceinline void SetLightAndFog(FRenderState& state, PalEntry fade, int palett { state.EnableFog(0); state.SetFog(0, 0); - state.SetSoftLightLevel(gl_fogmode != 0 && ShadeDiv >= 1 / 1000.f ? 255 - Scale(shade, 255, numshades) : 255); + state.SetSoftLightLevel(gl_fogmode != 0 && ShadeDiv >= 1 / 1000.f ? max(0, 255 - Scale(shade, 255, numshades)) : 255); state.SetLightParms(visibility, ShadeDiv / (numshades - 2)); }