- Fix positioning of upside-down textures. Note that wallscan_np2() still needs to be modified

to understand negative yrepeats.

SVN r3974 (trunk)
This commit is contained in:
Randy Heit 2012-12-04 02:42:53 +00:00
parent c845675b9b
commit a57c22981e
1 changed files with 71 additions and 26 deletions

View File

@ -1951,6 +1951,8 @@ void R_NewWall (bool needlights)
rw_midtexturescalex = sidedef->GetTextureXScale(side_t::mid);
rw_midtexturescaley = sidedef->GetTextureYScale(side_t::mid);
yrepeat = FixedMul(midtexture->yScale, rw_midtexturescaley);
if (yrepeat >= 0)
{ // normal orientation
if (linedef->flags & ML_DONTPEGBOTTOM)
{ // bottom of texture at bottom
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat) + (midtexture->GetHeight() << FRACBITS);
@ -1963,6 +1965,19 @@ void R_NewWall (bool needlights)
rowoffset += midtexture->GetHeight() << FRACBITS;
}
}
}
else
{ // upside down
rowoffset = -rowoffset;
if (linedef->flags & ML_DONTPEGBOTTOM)
{ // top of texture at bottom
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat);
}
else
{ // bottom of texture at top
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat) + (midtexture->GetHeight() << FRACBITS);
}
}
if (midtexture->bWorldPanning)
{
rw_midtexturemid += MulScale16(rowoffset, yrepeat);
@ -2096,9 +2111,11 @@ void R_NewWall (bool needlights)
rw_toptexturescalex = sidedef->GetTextureXScale(side_t::top);
rw_toptexturescaley = sidedef->GetTextureYScale(side_t::top);
yrepeat = FixedMul(toptexture->yScale, rw_toptexturescaley);
if (yrepeat >= 0)
{ // normal orientation
if (linedef->flags & ML_DONTPEGTOP)
{ // top of texture at top
rw_toptexturemid = MulScale16 (frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat);
rw_toptexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat);
if (rowoffset < 0 && toptexture != NULL)
{
rowoffset += toptexture->GetHeight() << FRACBITS;
@ -2108,6 +2125,19 @@ void R_NewWall (bool needlights)
{ // bottom of texture at bottom
rw_toptexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat) + (toptexture->GetHeight() << FRACBITS);
}
}
else
{ // upside down
rowoffset = -rowoffset;
if (linedef->flags & ML_DONTPEGTOP)
{ // bottom of texture at top
rw_toptexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat) + (toptexture->GetHeight() << FRACBITS);
}
else
{ // top of texture at bottom
rw_toptexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat);
}
}
if (toptexture->bWorldPanning)
{
rw_toptexturemid += MulScale16(rowoffset, yrepeat);
@ -2126,25 +2156,40 @@ void R_NewWall (bool needlights)
rw_bottomtexturescalex = sidedef->GetTextureXScale(side_t::bottom);
rw_bottomtexturescaley = sidedef->GetTextureYScale(side_t::bottom);
yrepeat = FixedMul(bottomtexture->yScale, rw_bottomtexturescaley);
if (yrepeat >= 0)
{ // normal orientation
if (linedef->flags & ML_DONTPEGBOTTOM)
{ // bottom of texture at bottom
rw_bottomtexturemid = rw_frontlowertop;
rw_bottomtexturemid = MulScale16(rw_frontlowertop - viewz, yrepeat);
}
else
{ // top of texture at top
rw_bottomtexturemid = backsector->GetPlaneTexZ(sector_t::floor);
rw_bottomtexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat);
if (rowoffset < 0 && bottomtexture != NULL)
{
rowoffset += bottomtexture->GetHeight() << FRACBITS;
}
}
}
else
{ // upside down
rowoffset = -rowoffset;
if (linedef->flags & ML_DONTPEGBOTTOM)
{ // top of texture at bottom
rw_bottomtexturemid = MulScale16(rw_frontlowertop - viewz, yrepeat);
}
else
{ // bottom of texture at top
rw_bottomtexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat) + (bottomtexture->GetHeight() << FRACBITS);
}
}
if (bottomtexture->bWorldPanning)
{
rw_bottomtexturemid = MulScale16(rw_bottomtexturemid - viewz + rowoffset, yrepeat);
rw_bottomtexturemid += MulScale16(rowoffset, yrepeat);
}
else
{
rw_bottomtexturemid = MulScale16(rw_bottomtexturemid - viewz, yrepeat) + rowoffset;
rw_bottomtexturemid += rowoffset;
}
}
}