From 2b1072eb91dcf179eec6a53e806c265f3abbf52f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 Apr 2021 19:17:40 +0200 Subject: [PATCH] - fixed bad sector addressing in flat sprites drawer. --- source/core/rendering/scene/hw_drawstructs.h | 8 +++++--- source/core/rendering/scene/hw_flats.cpp | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/core/rendering/scene/hw_drawstructs.h b/source/core/rendering/scene/hw_drawstructs.h index c7713143e..a166cfdc3 100644 --- a/source/core/rendering/scene/hw_drawstructs.h +++ b/source/core/rendering/scene/hw_drawstructs.h @@ -256,7 +256,8 @@ public: float z; // the z position of the flat (only valid for non-sloped planes) PalEntry fade; - int shade, palette, visibility; + int shade, palette; + float visibility; float alpha; FRenderStyle RenderStyle; int iboindex; @@ -294,7 +295,8 @@ public: spritetype* sprite; PalEntry fade; - int shade, palette, visibility; + int shade, palette; + float visibility; float alpha; FRenderStyle RenderStyle; int modelframe; // : sprite, 1: model, -1:voxel @@ -400,7 +402,7 @@ 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 orgshade, int visibility, float alpha, bool setcolor = true) +__forceinline void SetLightAndFog(FRenderState& state, PalEntry fade, int palette, int orgshade, float visibility, float alpha, bool setcolor = true) { // Fog must be done before the texture so that the texture selector can override it. bool foggy = (GlobalMapFog || (fade & 0xffffff)); diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index 527dacb76..d69a1141d 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -343,7 +343,7 @@ void HWFlat::ProcessFlatSprite(HWDrawInfo* di, spritetype* sprite, sectortype* s z = sprite->z * (1 / -256.f); if (z == di->Viewpoint.Pos.Z) return; // looking right at the edge. - visibility = sectorVisibility(§or[sprite->sectnum]) *(4.f / 5.f); // The factor comes directly from Polymost. What is it with Build and these magic factors? + visibility = sectorVisibility(sector) *(4.f / 5.f); // The factor comes directly from Polymost. What is it with Build and these magic factors? // Weird Build logic that really makes no sense. if ((sprite->cstat & CSTAT_SPRITE_ONE_SIDED) != 0 && (di->Viewpoint.Pos.Z < z) == ((sprite->cstat & CSTAT_SPRITE_YFLIP) == 0)) @@ -355,7 +355,7 @@ void HWFlat::ProcessFlatSprite(HWDrawInfo* di, spritetype* sprite, sectortype* s sec = sector; shade = clamp(sprite->shade, 0, numshades - 1); palette = sprite->pal; - fade = lookups.getFade(sector[sprite->sectnum].floorpal); // fog is per sector. + fade = lookups.getFade(sector->floorpal); // fog is per sector. SetSpriteTranslucency(sprite, alpha, RenderStyle);