- 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

View file

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