- fixed texture alignment

Most cases should be correct now.
This commit is contained in:
Christoph Oelckers 2021-03-17 23:29:13 +01:00
parent 47dce8de8c
commit 493294909b

View file

@ -843,7 +843,7 @@ void HWWall::DoUpperTexture(HWDrawInfo* di, walltype* wal, sectortype* frontsect
float topleft, float topright, float bottomleft, float bottomright) float topleft, float topright, float bottomleft, float bottomright)
{ {
// get the alignment reference position. // get the alignment reference position.
int refheight = (wal->cstat & CSTAT_WALL_ALIGN_BOTTOM) ? frontsector->floorz : frontsector->ceilingz; int refheight = (wal->cstat & CSTAT_WALL_ALIGN_BOTTOM) ? frontsector->ceilingz : backsector->ceilingz;
type = RENDERWALL_BOTTOM; type = RENDERWALL_BOTTOM;
DoTexture(di, wal, wal, refheight, topleft, topright, bottomleft, bottomright); DoTexture(di, wal, wal, refheight, topleft, topright, bottomleft, bottomright);
@ -861,19 +861,7 @@ void HWWall::DoLowerTexture(HWDrawInfo* di, walltype* wal, sectortype* frontsect
// get the alignment reference position. // get the alignment reference position.
int refheight; int refheight;
auto refwall = (wall->cstat & CSTAT_WALL_BOTTOM_SWAP) ? &wall[wal->nextwall] : wal; auto refwall = (wall->cstat & CSTAT_WALL_BOTTOM_SWAP) ? &wall[wal->nextwall] : wal;
refheight = (wal->cstat & CSTAT_WALL_ALIGN_BOTTOM) ? frontsector->ceilingz : backsector->floorz;
if ((wal->cstat & CSTAT_WALL_1WAY) && backsector)
{
if ((!(wal->cstat & CSTAT_WALL_BOTTOM_SWAP) && (wal->cstat & CSTAT_WALL_1WAY)) ||
((wal->cstat & CSTAT_WALL_BOTTOM_SWAP) && (wall[wal->nextwall].cstat & CSTAT_WALL_ALIGN_BOTTOM)))
refheight = frontsector->ceilingz;
else
refheight = backsector->floorz;
}
else
{
refheight = (wal->cstat & CSTAT_WALL_ALIGN_BOTTOM) ? frontsector->floorz : frontsector->ceilingz;
}
shade = refwall->shade; shade = refwall->shade;
palette = refwall->pal; palette = refwall->pal;
@ -893,7 +881,23 @@ void HWWall::DoMidTexture(HWDrawInfo* di, walltype* wal,
float bch1, float bch2, float bfh1, float bfh2) float bch1, float bch2, float bfh1, float bfh2)
{ {
float topleft,bottomleft,topright,bottomright; float topleft,bottomleft,topright,bottomright;
float refheight = (wal->cstat & CSTAT_WALL_ALIGN_BOTTOM) ? frontsector->ceilingz : backsector->ceilingz; int refheight;
const int swapit = (wal->cstat & CSTAT_WALL_ALIGN_BOTTOM);
if (wal->cstat & CSTAT_WALL_1WAY)
{
// 1-sided wall
refheight = swapit ? front->ceilingz : back->ceilingz;
}
else
{
// masked wall
if (swapit)
refheight = min(front->floorz, back->floorz);
else
refheight = max(front->ceilingz, back->ceilingz);
}
topleft = std::min(bch1,fch1); topleft = std::min(bch1,fch1);
topright = std::min(bch2,fch2); topright = std::min(bch2,fch2);
@ -1094,5 +1098,6 @@ void HWWall::Process(HWDrawInfo *di, walltype *wal, sectortype* frontsector, sec
} }
} }
} }
globalr = globalg = globalb = 255;
} }