From f1859c69f0b9223ab0e9ccfd5e619ea66bec53a4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Feb 2022 11:30:00 +0100 Subject: [PATCH] - fixed bad assumption about g_visibility == 0 meaning fullbright. This merely means that there should be no fog, but the shade must still be applied. --- source/core/rendering/scene/hw_setcolor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/core/rendering/scene/hw_setcolor.cpp b/source/core/rendering/scene/hw_setcolor.cpp index 95da07f55..ee5d5b84b 100644 --- a/source/core/rendering/scene/hw_setcolor.cpp +++ b/source/core/rendering/scene/hw_setcolor.cpp @@ -101,7 +101,7 @@ void HWDrawInfo::SetFog(FRenderState &state, int lightlevel, float visibility, b PalEntry fogcolor; float fogdensity; - if (cmap != nullptr && !fullbright) + if (cmap != nullptr && !fullbright && visibility > 0) { fogcolor = cmap->FadeColor; fogdensity = GetFogDensity(lightlevel, fogcolor, cmap->FogDensity, cmap->BlendFactor) * visibility; @@ -163,7 +163,7 @@ void SetLightAndFog(HWDrawInfo* di, FRenderState& state, PalEntry fade, int pale if (!di->isBuildSoftwareLighting() && !foggy) { - bool fullbright = ShadeDiv < 1 / 1000.f || g_visibility == 0 || shade < -numshades; + bool fullbright = ShadeDiv < 1 / 1000.f || shade < -numshades; float inverselight = shade * 255.f / numshades; if (!fullbright) inverselight /= ShadeDiv; int lightlevel = !fullbright ? clamp(int(255 - inverselight), 0, 255) : 255;