diff --git a/source/core/rendering/scene/hw_drawstructs.h b/source/core/rendering/scene/hw_drawstructs.h index 762a2d4cc..3c2609e7a 100644 --- a/source/core/rendering/scene/hw_drawstructs.h +++ b/source/core/rendering/scene/hw_drawstructs.h @@ -401,15 +401,12 @@ inline void SetSpriteTranslucency(const spritetype* sprite, float& alpha, FRende extern PalEntry GlobalMapFog; extern float GlobalFogDensity; -__forceinline void SetLightAndFog(FRenderState& state, PalEntry fade, int palette, int shade, float visibility, float alpha, bool setcolor = true) +__forceinline void SetLightAndFog(FRenderState& state, PalEntry fade, int palette, int shade, float visibility, float alpha) { // Fog must be done before the texture so that the texture selector can override it. bool foggy = (GlobalMapFog || (fade & 0xffffff)); auto ShadeDiv = lookups.tables[palette].ShadeFactor; - bool shadow = shade >= numshades; - - if (shadow) state.SetObjectColor(0xff000000); // make sure that nothing lights this up again. - else state.SetObjectColor(0xffffffff); + if (shade == 127) state.SetObjectColor(0xff000000); // 127 is generally used for shadow objects that must be black, even in foggy areas. // Disable brightmaps if non-black fog is used. if (ShadeDiv >= 1 / 1000.f && foggy) diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index a4489caf8..7b2025381 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -191,7 +191,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent) if (translucent) state.SetRenderStyle(LegacyRenderStyles[STYLE_Translucent]); state.EnableBrightmap(true); - //state.SetObjectColor(0xffffffff); + state.SetObjectColor(0xffffffff); //state.SetAddColor(0); //state.ApplyTextureManipulation(nullptr); } diff --git a/source/core/rendering/scene/hw_sprites.cpp b/source/core/rendering/scene/hw_sprites.cpp index 0923390ed..a29c9f16f 100644 --- a/source/core/rendering/scene/hw_sprites.cpp +++ b/source/core/rendering/scene/hw_sprites.cpp @@ -109,7 +109,10 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent) else RenderStyle.BlendOp = STYLEOP_Fuzz; // subtractive with models is not going to work. } - SetLightAndFog(state, fade, palette, shade, visibility, alpha, this->shade <= numshades); + SetLightAndFog(state, fade, palette, shade, visibility, alpha); + + if (shade >= numshades) state.SetObjectColor(0xff000000); // make sure that nothing lights this up again. + if (modelframe == 0) { diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 4c528a7a3..c673c26de 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -128,7 +128,7 @@ void HWWall::RenderMirrorSurface(HWDrawInfo *di, FRenderState &state) // Use sphere mapping for this state.SetEffect(EFF_SPHEREMAP); - SetLightAndFog(state, fade, palette, shade, visibility, alpha, false); + SetLightAndFog(state, fade, palette, min(shade, numshades), visibility, alpha); state.SetColor(PalEntry(25, globalr >> 1, globalg >> 1, globalb >> 1)); state.SetRenderStyle(STYLE_Add); @@ -173,8 +173,8 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags) RenderWall(di, state, rflags); state.SetNpotEmulation(0.f, 0.f); - /* none of these functions is in use. state.SetObjectColor(0xffffffff); + /* none of these functions is in use. state.SetObjectColor2(0); state.SetAddColor(0); state.SetTextureMode(tmode);