- new renderer: handle light level underflows.

This commit is contained in:
Christoph Oelckers 2021-05-16 18:50:54 +02:00
parent 25d516c36f
commit 5e94eaff8e

View file

@ -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));
}