- 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,16 +1951,31 @@ 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 (linedef->flags & ML_DONTPEGBOTTOM)
{ // bottom of texture at bottom
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat) + (midtexture->GetHeight() << FRACBITS);
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);
}
else
{ // top of texture at top
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat);
if (rowoffset < 0 && midtexture != NULL)
{
rowoffset += midtexture->GetHeight() << FRACBITS;
}
}
}
else
{ // top of texture at top
rw_midtexturemid = MulScale16(frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat);
if (rowoffset < 0 && midtexture != NULL)
{
rowoffset += midtexture->GetHeight() << FRACBITS;
{ // 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)
@ -2096,17 +2111,32 @@ 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 (linedef->flags & ML_DONTPEGTOP)
{ // top of texture at top
rw_toptexturemid = MulScale16 (frontsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat);
if (rowoffset < 0 && toptexture != NULL)
{
rowoffset += toptexture->GetHeight() << FRACBITS;
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);
if (rowoffset < 0 && toptexture != NULL)
{
rowoffset += toptexture->GetHeight() << FRACBITS;
}
}
else
{ // bottom of texture at bottom
rw_toptexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat) + (toptexture->GetHeight() << FRACBITS);
}
}
else
{ // bottom of texture at bottom
rw_toptexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::ceiling) - viewz, yrepeat) + (toptexture->GetHeight() << FRACBITS);
{ // 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)
{
@ -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 (linedef->flags & ML_DONTPEGBOTTOM)
{ // bottom of texture at bottom
rw_bottomtexturemid = rw_frontlowertop;
if (yrepeat >= 0)
{ // normal orientation
if (linedef->flags & ML_DONTPEGBOTTOM)
{ // bottom of texture at bottom
rw_bottomtexturemid = MulScale16(rw_frontlowertop - viewz, yrepeat);
}
else
{ // top of texture at top
rw_bottomtexturemid = MulScale16(backsector->GetPlaneTexZ(sector_t::floor) - viewz, yrepeat);
if (rowoffset < 0 && bottomtexture != NULL)
{
rowoffset += bottomtexture->GetHeight() << FRACBITS;
}
}
}
else
{ // top of texture at top
rw_bottomtexturemid = backsector->GetPlaneTexZ(sector_t::floor);
if (rowoffset < 0 && bottomtexture != NULL)
{
rowoffset += bottomtexture->GetHeight() << FRACBITS;
{ // 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;
}
}
}