- fixed bad sector addressing in flat sprites drawer.

This commit is contained in:
Christoph Oelckers 2021-04-14 19:17:40 +02:00
parent 5c306c61d6
commit 2b1072eb91
2 changed files with 7 additions and 5 deletions

View file

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

View file

@ -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(&sector[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);