From 3e28d53308d34994efacc9eda146a755757fcf32 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 11 Feb 2017 20:27:11 +0100 Subject: [PATCH] Move rw_havelow and rw_havehigh to local function variables --- src/swrenderer/line/r_line.cpp | 47 +++++++++++++++++++--------------- src/swrenderer/line/r_line.h | 2 -- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/swrenderer/line/r_line.cpp b/src/swrenderer/line/r_line.cpp index 6f312664c..d3e292729 100644 --- a/src/swrenderer/line/r_line.cpp +++ b/src/swrenderer/line/r_line.cpp @@ -117,18 +117,17 @@ namespace swrenderer 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(); if (!(clip3d->fake3D & FAKE3D_FAKEBACK)) { 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) { @@ -154,19 +153,6 @@ namespace swrenderer 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(); @@ -254,6 +240,8 @@ namespace swrenderer bool SWRenderLine::IsDoorClosed() const { + if (!mBackSector) return false; + // Portal if (mLineSegment->linedef->isVisualPortal() && mLineSegment->sidedef == mLineSegment->linedef->sidedef[0]) return false; @@ -718,6 +706,26 @@ namespace swrenderer 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) { // Be aware: Line_Horizon does not work properly with sloped planes @@ -726,7 +734,6 @@ namespace swrenderer } else { - RenderPortal *renderportal = Thread->Portal.get(); mCeilingClipped = walltop.Project(mFrontSector->ceilingplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP); mFloorClipped = wallbottom.Project(mFrontSector->floorplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP); } diff --git a/src/swrenderer/line/r_line.h b/src/swrenderer/line/r_line.h index 603812f50..03dc0c8ad 100644 --- a/src/swrenderer/line/r_line.h +++ b/src/swrenderer/line/r_line.h @@ -106,8 +106,6 @@ namespace swrenderer fixed_t rw_offset_bottom; bool rw_prepped; - bool rw_havehigh; - bool rw_havelow; int wallshade; float rw_light;