Move rw_havelow and rw_havehigh to local function variables

This commit is contained in:
Magnus Norddahl 2017-02-11 20:27:11 +01:00
parent 9e2702d885
commit 3e28d53308
2 changed files with 27 additions and 22 deletions

View file

@ -117,18 +117,17 @@ namespace swrenderer
WallT.InitFromLine(Thread, v1->fPos() - ViewPos, v2->fPos() - ViewPos); WallT.InitFromLine(Thread, v1->fPos() - ViewPos, v2->fPos() - ViewPos);
} }
mFrontCeilingZ1 = mFrontSector->ceilingplane.ZatPoint(line->v1);
mFrontFloorZ1 = mFrontSector->floorplane.ZatPoint(line->v1);
mFrontCeilingZ2 = mFrontSector->ceilingplane.ZatPoint(line->v2);
mFrontFloorZ2 = mFrontSector->floorplane.ZatPoint(line->v2);
Clip3DFloors *clip3d = Thread->Clip3D.get(); Clip3DFloors *clip3d = Thread->Clip3D.get();
if (!(clip3d->fake3D & FAKE3D_FAKEBACK)) if (!(clip3d->fake3D & FAKE3D_FAKEBACK))
{ {
mBackSector = line->backsector; mBackSector = line->backsector;
} }
mFrontCeilingZ1 = mFrontSector->ceilingplane.ZatPoint(line->v1);
mFrontFloorZ1 = mFrontSector->floorplane.ZatPoint(line->v1);
mFrontCeilingZ2 = mFrontSector->ceilingplane.ZatPoint(line->v2);
mFrontFloorZ2 = mFrontSector->floorplane.ZatPoint(line->v2);
rw_havehigh = rw_havelow = false;
if (mBackSector) if (mBackSector)
{ {
@ -154,19 +153,6 @@ namespace swrenderer
clip3d->fake3D |= FAKE3D_CLIPTOPFRONT; clip3d->fake3D |= FAKE3D_CLIPTOPFRONT;
} }
} }
// Cannot make these walls solid, because it can result in
// sprite clipping problems for sprites near the wall
if (mFrontCeilingZ1 > mBackCeilingZ1 || mFrontCeilingZ2 > mBackCeilingZ2)
{
rw_havehigh = true;
wallupper.Project(mBackSector->ceilingplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
}
if (mFrontFloorZ1 < mBackFloorZ1 || mFrontFloorZ2 < mBackFloorZ2)
{
rw_havelow = true;
walllower.Project(mBackSector->floorplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
}
} }
mDoorClosed = IsDoorClosed(); mDoorClosed = IsDoorClosed();
@ -254,6 +240,8 @@ namespace swrenderer
bool SWRenderLine::IsDoorClosed() const bool SWRenderLine::IsDoorClosed() const
{ {
if (!mBackSector) return false;
// Portal // Portal
if (mLineSegment->linedef->isVisualPortal() && mLineSegment->sidedef == mLineSegment->linedef->sidedef[0]) return false; if (mLineSegment->linedef->isVisualPortal() && mLineSegment->sidedef == mLineSegment->linedef->sidedef[0]) return false;
@ -718,6 +706,26 @@ namespace swrenderer
void SWRenderLine::SetWallVariables(bool needlights) void SWRenderLine::SetWallVariables(bool needlights)
{ {
RenderPortal *renderportal = Thread->Portal.get();
bool rw_havehigh = false;
bool rw_havelow = false;
if (mBackSector)
{
// Cannot make these walls solid, because it can result in
// sprite clipping problems for sprites near the wall
if (mFrontCeilingZ1 > mBackCeilingZ1 || mFrontCeilingZ2 > mBackCeilingZ2)
{
rw_havehigh = true;
wallupper.Project(mBackSector->ceilingplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
}
if (mFrontFloorZ1 < mBackFloorZ1 || mFrontFloorZ2 < mBackFloorZ2)
{
rw_havelow = true;
walllower.Project(mBackSector->floorplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
}
}
if (mLineSegment->linedef->special == Line_Horizon) if (mLineSegment->linedef->special == Line_Horizon)
{ {
// Be aware: Line_Horizon does not work properly with sloped planes // Be aware: Line_Horizon does not work properly with sloped planes
@ -726,7 +734,6 @@ namespace swrenderer
} }
else else
{ {
RenderPortal *renderportal = Thread->Portal.get();
mCeilingClipped = walltop.Project(mFrontSector->ceilingplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP); mCeilingClipped = walltop.Project(mFrontSector->ceilingplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
mFloorClipped = wallbottom.Project(mFrontSector->floorplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP); mFloorClipped = wallbottom.Project(mFrontSector->floorplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
} }

View file

@ -106,8 +106,6 @@ namespace swrenderer
fixed_t rw_offset_bottom; fixed_t rw_offset_bottom;
bool rw_prepped; bool rw_prepped;
bool rw_havehigh;
bool rw_havelow;
int wallshade; int wallshade;
float rw_light; float rw_light;