Skip to content

Commit

Permalink
- fixed bad assumption about g_visibility == 0 meaning fullbright.
Browse files Browse the repository at this point in the history
This merely means that there should be no fog, but the shade must still be applied.
  • Loading branch information
coelckers committed Feb 19, 2022
1 parent 13c44cc commit f1859c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/core/rendering/scene/hw_setcolor.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f1859c6

Please sign in to comment.