- 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.
This commit is contained in:
Christoph Oelckers 2022-02-19 11:30:00 +01:00
parent 13c44cc32f
commit f1859c69f0

View file

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