Rename variables and group them a little more how they are used

This commit is contained in:
Magnus Norddahl 2017-02-11 18:00:02 +01:00
parent a52f79055d
commit c17317de24
2 changed files with 177 additions and 178 deletions

View File

@ -67,15 +67,14 @@ namespace swrenderer
bool solid; bool solid;
DVector2 pt1, pt2; DVector2 pt1, pt2;
InSubsector = subsector; mSubsector = subsector;
frontsector = sector; mFrontSector = sector;
backsector = fakebacksector; mBackSector = fakebacksector;
floorplane = linefloorplane; mFloorPlane = linefloorplane;
ceilingplane = lineceilingplane; mCeilingPlane = lineceilingplane;
foggy = infog; foggy = infog;
basecolormap = colormap; basecolormap = colormap;
mLineSegment = line;
curline = line;
pt1 = line->v1->fPos() - ViewPos; pt1 = line->v1->fPos() - ViewPos;
pt2 = line->v2->fPos() - ViewPos; pt2 = line->v2->fPos() - ViewPos;
@ -96,7 +95,7 @@ namespace swrenderer
{ {
if (Thread->ClipSegments->Check(WallC.sx1, WallC.sx2)) if (Thread->ClipSegments->Check(WallC.sx1, WallC.sx2))
{ {
InSubsector->flags |= SSECF_DRAWN; mSubsector->flags |= SSECF_DRAWN;
} }
return; return;
} }
@ -127,18 +126,17 @@ namespace swrenderer
if (!(clip3d->fake3D & FAKE3D_FAKEBACK)) if (!(clip3d->fake3D & FAKE3D_FAKEBACK))
{ {
backsector = line->backsector; mBackSector = line->backsector;
} }
rw_frontcz1 = frontsector->ceilingplane.ZatPoint(line->v1); mFrontCeilingZ1 = mFrontSector->ceilingplane.ZatPoint(line->v1);
rw_frontfz1 = frontsector->floorplane.ZatPoint(line->v1); mFrontFloorZ1 = mFrontSector->floorplane.ZatPoint(line->v1);
rw_frontcz2 = frontsector->ceilingplane.ZatPoint(line->v2); mFrontCeilingZ2 = mFrontSector->ceilingplane.ZatPoint(line->v2);
rw_frontfz2 = frontsector->floorplane.ZatPoint(line->v2); mFrontFloorZ2 = mFrontSector->floorplane.ZatPoint(line->v2);
rw_mustmarkfloor = rw_mustmarkceiling = false;
rw_havehigh = rw_havelow = false; rw_havehigh = rw_havelow = false;
// Single sided line? // Single sided line?
if (backsector == NULL) if (mBackSector == NULL)
{ {
solid = true; solid = true;
} }
@ -147,22 +145,22 @@ namespace swrenderer
// kg3D - its fake, no transfer_heights // kg3D - its fake, no transfer_heights
if (!(clip3d->fake3D & FAKE3D_FAKEBACK)) if (!(clip3d->fake3D & FAKE3D_FAKEBACK))
{ // killough 3/8/98, 4/4/98: hack for invisible ceilings / deep water { // killough 3/8/98, 4/4/98: hack for invisible ceilings / deep water
backsector = Thread->OpaquePass->FakeFlat(backsector, &tempsec, nullptr, nullptr, curline, WallC.sx1, WallC.sx2, rw_frontcz1, rw_frontcz2); mBackSector = Thread->OpaquePass->FakeFlat(mBackSector, &tempsec, nullptr, nullptr, mLineSegment, WallC.sx1, WallC.sx2, mFrontCeilingZ1, mFrontCeilingZ2);
} }
doorclosed = false; // killough 4/16/98 mDoorClosed = false; // killough 4/16/98
rw_backcz1 = backsector->ceilingplane.ZatPoint(line->v1); mBackCeilingZ1 = mBackSector->ceilingplane.ZatPoint(line->v1);
rw_backfz1 = backsector->floorplane.ZatPoint(line->v1); mBackFloorZ1 = mBackSector->floorplane.ZatPoint(line->v1);
rw_backcz2 = backsector->ceilingplane.ZatPoint(line->v2); mBackCeilingZ2 = mBackSector->ceilingplane.ZatPoint(line->v2);
rw_backfz2 = backsector->floorplane.ZatPoint(line->v2); mBackFloorZ2 = mBackSector->floorplane.ZatPoint(line->v2);
if (clip3d->fake3D & FAKE3D_FAKEBACK) if (clip3d->fake3D & FAKE3D_FAKEBACK)
{ {
if (rw_frontfz1 >= rw_backfz1 && rw_frontfz2 >= rw_backfz2) if (mFrontFloorZ1 >= mBackFloorZ1 && mFrontFloorZ2 >= mBackFloorZ2)
{ {
clip3d->fake3D |= FAKE3D_CLIPBOTFRONT; clip3d->fake3D |= FAKE3D_CLIPBOTFRONT;
} }
if (rw_frontcz1 <= rw_backcz1 && rw_frontcz2 <= rw_backcz2) if (mFrontCeilingZ1 <= mBackCeilingZ1 && mFrontCeilingZ2 <= mBackCeilingZ2)
{ {
clip3d->fake3D |= FAKE3D_CLIPTOPFRONT; clip3d->fake3D |= FAKE3D_CLIPTOPFRONT;
} }
@ -170,15 +168,15 @@ namespace swrenderer
// Cannot make these walls solid, because it can result in // Cannot make these walls solid, because it can result in
// sprite clipping problems for sprites near the wall // sprite clipping problems for sprites near the wall
if (rw_frontcz1 > rw_backcz1 || rw_frontcz2 > rw_backcz2) if (mFrontCeilingZ1 > mBackCeilingZ1 || mFrontCeilingZ2 > mBackCeilingZ2)
{ {
rw_havehigh = true; rw_havehigh = true;
wallupper.Project(backsector->ceilingplane, &WallC, curline, renderportal->MirrorFlags & RF_XFLIP); wallupper.Project(mBackSector->ceilingplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
} }
if (rw_frontfz1 < rw_backfz1 || rw_frontfz2 < rw_backfz2) if (mFrontFloorZ1 < mBackFloorZ1 || mFrontFloorZ2 < mBackFloorZ2)
{ {
rw_havelow = true; rw_havelow = true;
walllower.Project(backsector->floorplane, &WallC, curline, renderportal->MirrorFlags & RF_XFLIP); walllower.Project(mBackSector->floorplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
} }
// Portal // Portal
@ -187,21 +185,21 @@ namespace swrenderer
solid = true; solid = true;
} }
// Closed door. // Closed door.
else if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) || else if ((mBackCeilingZ1 <= mFrontFloorZ1 && mBackCeilingZ2 <= mFrontFloorZ2) ||
(rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2)) (mBackFloorZ1 >= mFrontCeilingZ1 && mBackFloorZ2 >= mFrontCeilingZ2))
{ {
solid = true; solid = true;
} }
else if ( else if (
// properly render skies (consider door "open" if both ceilings are sky): // properly render skies (consider door "open" if both ceilings are sky):
(backsector->GetTexture(sector_t::ceiling) != skyflatnum || frontsector->GetTexture(sector_t::ceiling) != skyflatnum) (mBackSector->GetTexture(sector_t::ceiling) != skyflatnum || mFrontSector->GetTexture(sector_t::ceiling) != skyflatnum)
// if door is closed because back is shut: // if door is closed because back is shut:
&& rw_backcz1 <= rw_backfz1 && rw_backcz2 <= rw_backfz2 && mBackCeilingZ1 <= mBackFloorZ1 && mBackCeilingZ2 <= mBackFloorZ2
// preserve a kind of transparent door/lift special effect: // preserve a kind of transparent door/lift special effect:
&& ((rw_backcz1 >= rw_frontcz1 && rw_backcz2 >= rw_frontcz2) || line->sidedef->GetTexture(side_t::top).isValid()) && ((mBackCeilingZ1 >= mFrontCeilingZ1 && mBackCeilingZ2 >= mFrontCeilingZ2) || line->sidedef->GetTexture(side_t::top).isValid())
&& ((rw_backfz1 <= rw_frontfz1 && rw_backfz2 <= rw_frontfz2) || line->sidedef->GetTexture(side_t::bottom).isValid())) && ((mBackFloorZ1 <= mFrontFloorZ1 && mBackFloorZ2 <= mFrontFloorZ2) || line->sidedef->GetTexture(side_t::bottom).isValid()))
{ {
// killough 1/18/98 -- This function is used to fix the automap bug which // killough 1/18/98 -- This function is used to fix the automap bug which
// showed lines behind closed doors simply because the door had a dropoff. // showed lines behind closed doors simply because the door had a dropoff.
@ -211,41 +209,41 @@ namespace swrenderer
// This fixes the automap floor height bug -- killough 1/18/98: // This fixes the automap floor height bug -- killough 1/18/98:
// killough 4/7/98: optimize: save result in doorclosed for use in r_segs.c // killough 4/7/98: optimize: save result in doorclosed for use in r_segs.c
doorclosed = true; mDoorClosed = true;
solid = true; solid = true;
} }
else if (frontsector->ceilingplane != backsector->ceilingplane || else if (mFrontSector->ceilingplane != mBackSector->ceilingplane ||
frontsector->floorplane != backsector->floorplane) mFrontSector->floorplane != mBackSector->floorplane)
{ {
// Window. // Window.
solid = false; solid = false;
} }
else if (SkyboxCompare(frontsector, backsector)) else if (SkyboxCompare(mFrontSector, mBackSector))
{ {
solid = false; solid = false;
} }
else if (backsector->lightlevel != frontsector->lightlevel else if (mBackSector->lightlevel != mFrontSector->lightlevel
|| backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor) || mBackSector->GetTexture(sector_t::floor) != mFrontSector->GetTexture(sector_t::floor)
|| backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling) || mBackSector->GetTexture(sector_t::ceiling) != mFrontSector->GetTexture(sector_t::ceiling)
|| curline->sidedef->GetTexture(side_t::mid).isValid() || mLineSegment->sidedef->GetTexture(side_t::mid).isValid()
// killough 3/7/98: Take flats offsets into account: // killough 3/7/98: Take flats offsets into account:
|| backsector->planes[sector_t::floor].xform != frontsector->planes[sector_t::floor].xform || mBackSector->planes[sector_t::floor].xform != mFrontSector->planes[sector_t::floor].xform
|| backsector->planes[sector_t::ceiling].xform != frontsector->planes[sector_t::ceiling].xform || mBackSector->planes[sector_t::ceiling].xform != mFrontSector->planes[sector_t::ceiling].xform
|| backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor) || mBackSector->GetPlaneLight(sector_t::floor) != mFrontSector->GetPlaneLight(sector_t::floor)
|| backsector->GetPlaneLight(sector_t::ceiling) != frontsector->GetPlaneLight(sector_t::ceiling) || mBackSector->GetPlaneLight(sector_t::ceiling) != mFrontSector->GetPlaneLight(sector_t::ceiling)
|| backsector->GetVisFlags(sector_t::floor) != frontsector->GetVisFlags(sector_t::floor) || mBackSector->GetVisFlags(sector_t::floor) != mFrontSector->GetVisFlags(sector_t::floor)
|| backsector->GetVisFlags(sector_t::ceiling) != frontsector->GetVisFlags(sector_t::ceiling) || mBackSector->GetVisFlags(sector_t::ceiling) != mFrontSector->GetVisFlags(sector_t::ceiling)
// [RH] Also consider colormaps // [RH] Also consider colormaps
|| backsector->ColorMap != frontsector->ColorMap || mBackSector->ColorMap != mFrontSector->ColorMap
// kg3D - and fake lights // kg3D - and fake lights
|| (frontsector->e && frontsector->e->XFloor.lightlist.Size()) || (mFrontSector->e && mFrontSector->e->XFloor.lightlist.Size())
|| (backsector->e && backsector->e->XFloor.lightlist.Size()) || (mBackSector->e && mBackSector->e->XFloor.lightlist.Size())
) )
{ {
solid = false; solid = false;
@ -258,11 +256,11 @@ namespace swrenderer
// When using GL nodes, do a clipping test for these lines so we can // When using GL nodes, do a clipping test for these lines so we can
// mark their subsectors as visible for automap texturing. // mark their subsectors as visible for automap texturing.
if (hasglnodes && !(InSubsector->flags & SSECF_DRAWN)) if (hasglnodes && !(mSubsector->flags & SSECF_DRAWN))
{ {
if (Thread->ClipSegments->Check(WallC.sx1, WallC.sx2)) if (Thread->ClipSegments->Check(WallC.sx1, WallC.sx2))
{ {
InSubsector->flags |= SSECF_DRAWN; mSubsector->flags |= SSECF_DRAWN;
} }
} }
return; return;
@ -279,15 +277,15 @@ namespace swrenderer
} }
else else
{ {
rw_ceilstat = walltop.Project(frontsector->ceilingplane, &WallC, curline, renderportal->MirrorFlags & RF_XFLIP); mCeilingClipped = walltop.Project(mFrontSector->ceilingplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
rw_floorstat = wallbottom.Project(frontsector->floorplane, &WallC, curline, renderportal->MirrorFlags & RF_XFLIP); mFloorClipped = wallbottom.Project(mFrontSector->floorplane, &WallC, mLineSegment, renderportal->MirrorFlags & RF_XFLIP);
} }
bool visible = Thread->ClipSegments->Clip(WallC.sx1, WallC.sx2, solid, this); bool visible = Thread->ClipSegments->Clip(WallC.sx1, WallC.sx2, solid, this);
if (visible) if (visible)
{ {
InSubsector->flags |= SSECF_DRAWN; mSubsector->flags |= SSECF_DRAWN;
} }
} }
@ -325,6 +323,8 @@ namespace swrenderer
SetWallVariables(true); SetWallVariables(true);
} }
side_t *sidedef = mLineSegment->sidedef;
rw_offset = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid)); rw_offset = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid));
rw_light = rw_lightleft + rw_lightstep * (start - WallC.sx1); rw_light = rw_lightleft + rw_lightstep * (start - WallC.sx1);
@ -347,7 +347,7 @@ namespace swrenderer
draw_segment->siz2 = 1 / WallC.sz2; draw_segment->siz2 = 1 / WallC.sz2;
draw_segment->x1 = start; draw_segment->x1 = start;
draw_segment->x2 = stop; draw_segment->x2 = stop;
draw_segment->curline = curline; draw_segment->curline = mLineSegment;
draw_segment->bFogBoundary = false; draw_segment->bFogBoundary = false;
draw_segment->bFakeBoundary = false; draw_segment->bFakeBoundary = false;
draw_segment->foggy = foggy; draw_segment->foggy = foggy;
@ -366,7 +366,7 @@ namespace swrenderer
{ {
draw_segment->silhouette = SIL_BOTH; draw_segment->silhouette = SIL_BOTH;
} }
else if (backsector == NULL) else if (mBackSector == NULL)
{ {
draw_segment->sprtopclip = Thread->FrameMemory->AllocMemory<short>(stop - start); draw_segment->sprtopclip = Thread->FrameMemory->AllocMemory<short>(stop - start);
draw_segment->sprbottomclip = Thread->FrameMemory->AllocMemory<short>(stop - start); draw_segment->sprbottomclip = Thread->FrameMemory->AllocMemory<short>(stop - start);
@ -379,14 +379,14 @@ namespace swrenderer
// two sided line // two sided line
draw_segment->silhouette = 0; draw_segment->silhouette = 0;
if (rw_frontfz1 > rw_backfz1 || rw_frontfz2 > rw_backfz2 || if (mFrontFloorZ1 > mBackFloorZ1 || mFrontFloorZ2 > mBackFloorZ2 ||
backsector->floorplane.PointOnSide(ViewPos) < 0) mBackSector->floorplane.PointOnSide(ViewPos) < 0)
{ {
draw_segment->silhouette = SIL_BOTTOM; draw_segment->silhouette = SIL_BOTTOM;
} }
if (rw_frontcz1 < rw_backcz1 || rw_frontcz2 < rw_backcz2 || if (mFrontCeilingZ1 < mBackCeilingZ1 || mFrontCeilingZ2 < mBackCeilingZ2 ||
backsector->ceilingplane.PointOnSide(ViewPos) < 0) mBackSector->ceilingplane.PointOnSide(ViewPos) < 0)
{ {
draw_segment->silhouette |= SIL_TOP; draw_segment->silhouette |= SIL_TOP;
} }
@ -400,13 +400,13 @@ namespace swrenderer
// killough 4/7/98: make doorclosed external variable // killough 4/7/98: make doorclosed external variable
{ {
if (doorclosed || (rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2)) if (mDoorClosed || (mBackCeilingZ1 <= mFrontFloorZ1 && mBackCeilingZ2 <= mFrontFloorZ2))
{ {
draw_segment->sprbottomclip = Thread->FrameMemory->AllocMemory<short>(stop - start); draw_segment->sprbottomclip = Thread->FrameMemory->AllocMemory<short>(stop - start);
memset(draw_segment->sprbottomclip, -1, (stop - start) * sizeof(short)); memset(draw_segment->sprbottomclip, -1, (stop - start) * sizeof(short));
draw_segment->silhouette |= SIL_BOTTOM; draw_segment->silhouette |= SIL_BOTTOM;
} }
if (doorclosed || (rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2)) if (mDoorClosed || (mBackFloorZ1 >= mFrontCeilingZ1 && mBackFloorZ2 >= mFrontCeilingZ2))
{ // killough 1/17/98, 2/8/98 { // killough 1/17/98, 2/8/98
draw_segment->sprtopclip = Thread->FrameMemory->AllocMemory<short>(stop - start); draw_segment->sprtopclip = Thread->FrameMemory->AllocMemory<short>(stop - start);
fillshort(draw_segment->sprtopclip, stop - start, viewheight); fillshort(draw_segment->sprtopclip, stop - start, viewheight);
@ -414,18 +414,18 @@ namespace swrenderer
} }
} }
if (!draw_segment->fake && r_3dfloors && backsector->e && backsector->e->XFloor.ffloors.Size()) { if (!draw_segment->fake && r_3dfloors && mBackSector->e && mBackSector->e->XFloor.ffloors.Size()) {
for (i = 0; i < (int)backsector->e->XFloor.ffloors.Size(); i++) { for (i = 0; i < (int)mBackSector->e->XFloor.ffloors.Size(); i++) {
F3DFloor *rover = backsector->e->XFloor.ffloors[i]; F3DFloor *rover = mBackSector->e->XFloor.ffloors[i];
if (rover->flags & FF_RENDERSIDES && (!(rover->flags & FF_INVERTSIDES) || rover->flags & FF_ALLSIDES)) { if (rover->flags & FF_RENDERSIDES && (!(rover->flags & FF_INVERTSIDES) || rover->flags & FF_ALLSIDES)) {
draw_segment->bFakeBoundary |= 1; draw_segment->bFakeBoundary |= 1;
break; break;
} }
} }
} }
if (!draw_segment->fake && r_3dfloors && frontsector->e && frontsector->e->XFloor.ffloors.Size()) { if (!draw_segment->fake && r_3dfloors && mFrontSector->e && mFrontSector->e->XFloor.ffloors.Size()) {
for (i = 0; i < (int)frontsector->e->XFloor.ffloors.Size(); i++) { for (i = 0; i < (int)mFrontSector->e->XFloor.ffloors.Size(); i++) {
F3DFloor *rover = frontsector->e->XFloor.ffloors[i]; F3DFloor *rover = mFrontSector->e->XFloor.ffloors[i];
if (rover->flags & FF_RENDERSIDES && (rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES)) { if (rover->flags & FF_RENDERSIDES && (rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES)) {
draw_segment->bFakeBoundary |= 2; draw_segment->bFakeBoundary |= 2;
break; break;
@ -436,9 +436,9 @@ namespace swrenderer
if (!draw_segment->fake) if (!draw_segment->fake)
// allocate space for masked texture tables, if needed // allocate space for masked texture tables, if needed
// [RH] Don't just allocate the space; fill it in too. // [RH] Don't just allocate the space; fill it in too.
if ((TexMan(sidedef->GetTexture(side_t::mid), true)->UseType != FTexture::TEX_Null || draw_segment->bFakeBoundary || IsFogBoundary(frontsector, backsector)) && if ((TexMan(sidedef->GetTexture(side_t::mid), true)->UseType != FTexture::TEX_Null || draw_segment->bFakeBoundary || IsFogBoundary(mFrontSector, mBackSector)) &&
(rw_ceilstat != ProjectedWallCull::OutsideBelow || !sidedef->GetTexture(side_t::top).isValid()) && (mCeilingClipped != ProjectedWallCull::OutsideBelow || !sidedef->GetTexture(side_t::top).isValid()) &&
(rw_floorstat != ProjectedWallCull::OutsideAbove || !sidedef->GetTexture(side_t::bottom).isValid()) && (mFloorClipped != ProjectedWallCull::OutsideAbove || !sidedef->GetTexture(side_t::bottom).isValid()) &&
(WallC.sz1 >= TOO_CLOSE_Z && WallC.sz2 >= TOO_CLOSE_Z)) (WallC.sz1 >= TOO_CLOSE_Z && WallC.sz2 >= TOO_CLOSE_Z))
{ {
float *swal; float *swal;
@ -451,7 +451,7 @@ namespace swrenderer
draw_segment->bkup = Thread->FrameMemory->AllocMemory<short>(stop - start); draw_segment->bkup = Thread->FrameMemory->AllocMemory<short>(stop - start);
memcpy(draw_segment->bkup, &Thread->OpaquePass->ceilingclip[start], sizeof(short)*(stop - start)); memcpy(draw_segment->bkup, &Thread->OpaquePass->ceilingclip[start], sizeof(short)*(stop - start));
draw_segment->bFogBoundary = IsFogBoundary(frontsector, backsector); draw_segment->bFogBoundary = IsFogBoundary(mFrontSector, mBackSector);
if (sidedef->GetTexture(side_t::mid).isValid() || draw_segment->bFakeBoundary) if (sidedef->GetTexture(side_t::mid).isValid() || draw_segment->bFakeBoundary)
{ {
if (sidedef->GetTexture(side_t::mid).isValid()) if (sidedef->GetTexture(side_t::mid).isValid())
@ -507,13 +507,13 @@ namespace swrenderer
// not from the current subsector, which is what the current wallshade value // not from the current subsector, which is what the current wallshade value
// comes from. We make an exeption for polyobjects, however, since their "home" // comes from. We make an exeption for polyobjects, however, since their "home"
// sector should be whichever one they move into. // sector should be whichever one they move into.
if (curline->sidedef->Flags & WALLF_POLYOBJ) if (mLineSegment->sidedef->Flags & WALLF_POLYOBJ)
{ {
draw_segment->shade = wallshade; draw_segment->shade = wallshade;
} }
else else
{ {
draw_segment->shade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, curline->frontsector->lightlevel) + R_ActualExtraLight(foggy)); draw_segment->shade = LIGHT2SHADE(mLineSegment->sidedef->GetLightLevel(foggy, mLineSegment->frontsector->lightlevel) + R_ActualExtraLight(foggy));
} }
if (draw_segment->bFogBoundary || draw_segment->maskedtexturecol != nullptr) if (draw_segment->bFogBoundary || draw_segment->maskedtexturecol != nullptr)
@ -526,9 +526,9 @@ namespace swrenderer
// render it // render it
if (markceiling) if (markceiling)
{ {
if (ceilingplane) if (mCeilingPlane)
{ // killough 4/11/98: add NULL ptr checks { // killough 4/11/98: add NULL ptr checks
ceilingplane = Thread->PlaneList->GetRange(ceilingplane, start, stop); mCeilingPlane = Thread->PlaneList->GetRange(mCeilingPlane, start, stop);
} }
else else
{ {
@ -538,9 +538,9 @@ namespace swrenderer
if (markfloor) if (markfloor)
{ {
if (floorplane) if (mFloorPlane)
{ // killough 4/11/98: add NULL ptr checks { // killough 4/11/98: add NULL ptr checks
floorplane = Thread->PlaneList->GetRange(floorplane, start, stop); mFloorPlane = Thread->PlaneList->GetRange(mFloorPlane, start, stop);
} }
else else
{ {
@ -568,7 +568,7 @@ namespace swrenderer
memcpy(draw_segment->sprbottomclip, &Thread->OpaquePass->floorclip[start], sizeof(short)*(stop - start)); memcpy(draw_segment->sprbottomclip, &Thread->OpaquePass->floorclip[start], sizeof(short)*(stop - start));
} }
if (maskedtexture && curline->sidedef->GetTexture(side_t::mid).isValid()) if (maskedtexture && mLineSegment->sidedef->GetTexture(side_t::mid).isValid())
{ {
draw_segment->silhouette |= SIL_TOP | SIL_BOTTOM; draw_segment->silhouette |= SIL_TOP | SIL_BOTTOM;
} }
@ -577,12 +577,12 @@ namespace swrenderer
// [ZZ] Only if not an active mirror // [ZZ] Only if not an active mirror
if (!rw_markportal) if (!rw_markportal)
{ {
RenderDecal::RenderDecals(Thread, curline->sidedef, draw_segment, wallshade, rw_lightleft, rw_lightstep, curline, WallC, foggy, basecolormap, walltop.ScreenY, wallbottom.ScreenY); RenderDecal::RenderDecals(Thread, mLineSegment->sidedef, draw_segment, wallshade, rw_lightleft, rw_lightstep, mLineSegment, WallC, foggy, basecolormap, walltop.ScreenY, wallbottom.ScreenY);
} }
if (rw_markportal) if (rw_markportal)
{ {
Thread->Portal->AddLinePortal(curline->linedef, draw_segment->x1, draw_segment->x2, draw_segment->sprtopclip, draw_segment->sprbottomclip); Thread->Portal->AddLinePortal(mLineSegment->linedef, draw_segment->x1, draw_segment->x2, draw_segment->sprtopclip, draw_segment->sprbottomclip);
} }
return (clip3d->fake3D & FAKE3D_FAKEMASK) == 0; return (clip3d->fake3D & FAKE3D_FAKEMASK) == 0;
@ -595,8 +595,8 @@ namespace swrenderer
rw_markportal = false; rw_markportal = false;
sidedef = curline->sidedef; side_t *sidedef = mLineSegment->sidedef;
linedef = curline->linedef; line_t *linedef = mLineSegment->linedef;
// mark the segment as visible for auto map // mark the segment as visible for auto map
if (!Thread->Scene->DontMapLines()) linedef->flags |= ML_MAPPED; if (!Thread->Scene->DontMapLines()) linedef->flags |= ML_MAPPED;
@ -609,7 +609,7 @@ namespace swrenderer
markfloor = markceiling = true; // act like a one-sided wall here (todo: check how does this work with transparency) markfloor = markceiling = true; // act like a one-sided wall here (todo: check how does this work with transparency)
rw_markportal = true; rw_markportal = true;
} }
else if (backsector == NULL) else if (mBackSector == NULL)
{ {
// single sided line // single sided line
// a single sided line is terminal, so it must mark ends // a single sided line is terminal, so it must mark ends
@ -631,11 +631,11 @@ namespace swrenderer
{ // normal orientation { // normal orientation
if (linedef->flags & ML_DONTPEGBOTTOM) if (linedef->flags & ML_DONTPEGBOTTOM)
{ // bottom of texture at bottom { // bottom of texture at bottom
rw_midtexturemid = (frontsector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat + midtexture->GetHeight(); rw_midtexturemid = (mFrontSector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat + midtexture->GetHeight();
} }
else else
{ // top of texture at top { // top of texture at top
rw_midtexturemid = (frontsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat; rw_midtexturemid = (mFrontSector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat;
if (rowoffset < 0 && midtexture != NULL) if (rowoffset < 0 && midtexture != NULL)
{ {
rowoffset += midtexture->GetHeight(); rowoffset += midtexture->GetHeight();
@ -647,11 +647,11 @@ namespace swrenderer
rowoffset = -rowoffset; rowoffset = -rowoffset;
if (linedef->flags & ML_DONTPEGBOTTOM) if (linedef->flags & ML_DONTPEGBOTTOM)
{ // top of texture at bottom { // top of texture at bottom
rw_midtexturemid = (frontsector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat; rw_midtexturemid = (mFrontSector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat;
} }
else else
{ // bottom of texture at top { // bottom of texture at top
rw_midtexturemid = (frontsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat + midtexture->GetHeight(); rw_midtexturemid = (mFrontSector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat + midtexture->GetHeight();
} }
} }
if (midtexture->bWorldPanning) if (midtexture->bWorldPanning)
@ -670,95 +670,95 @@ namespace swrenderer
{ // two-sided line { // two-sided line
// hack to allow height changes in outdoor areas // hack to allow height changes in outdoor areas
double rw_frontlowertop = frontsector->GetPlaneTexZ(sector_t::ceiling); double rw_frontlowertop = mFrontSector->GetPlaneTexZ(sector_t::ceiling);
if (frontsector->GetTexture(sector_t::ceiling) == skyflatnum && if (mFrontSector->GetTexture(sector_t::ceiling) == skyflatnum &&
backsector->GetTexture(sector_t::ceiling) == skyflatnum) mBackSector->GetTexture(sector_t::ceiling) == skyflatnum)
{ {
if (rw_havehigh) if (rw_havehigh)
{ // front ceiling is above back ceiling { // front ceiling is above back ceiling
memcpy(&walltop.ScreenY[WallC.sx1], &wallupper.ScreenY[WallC.sx1], (WallC.sx2 - WallC.sx1) * sizeof(walltop.ScreenY[0])); memcpy(&walltop.ScreenY[WallC.sx1], &wallupper.ScreenY[WallC.sx1], (WallC.sx2 - WallC.sx1) * sizeof(walltop.ScreenY[0]));
rw_havehigh = false; rw_havehigh = false;
} }
else if (rw_havelow && frontsector->ceilingplane != backsector->ceilingplane) else if (rw_havelow && mFrontSector->ceilingplane != mBackSector->ceilingplane)
{ // back ceiling is above front ceiling { // back ceiling is above front ceiling
// The check for rw_havelow is not Doom-compliant, but it avoids HoM that // The check for rw_havelow is not Doom-compliant, but it avoids HoM that
// would otherwise occur because there is space made available for this // would otherwise occur because there is space made available for this
// wall but nothing to draw for it. // wall but nothing to draw for it.
// Recalculate walltop so that the wall is clipped by the back sector's // Recalculate walltop so that the wall is clipped by the back sector's
// ceiling instead of the front sector's ceiling. // ceiling instead of the front sector's ceiling.
walltop.Project(backsector->ceilingplane, &WallC, curline, Thread->Portal->MirrorFlags & RF_XFLIP); walltop.Project(mBackSector->ceilingplane, &WallC, mLineSegment, Thread->Portal->MirrorFlags & RF_XFLIP);
} }
// Putting sky ceilings on the front and back of a line alters the way unpegged // Putting sky ceilings on the front and back of a line alters the way unpegged
// positioning works. // positioning works.
rw_frontlowertop = backsector->GetPlaneTexZ(sector_t::ceiling); rw_frontlowertop = mBackSector->GetPlaneTexZ(sector_t::ceiling);
} }
if (linedef->isVisualPortal()) if (linedef->isVisualPortal())
{ {
markceiling = markfloor = true; markceiling = markfloor = true;
} }
else if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) || else if ((mBackCeilingZ1 <= mFrontFloorZ1 && mBackCeilingZ2 <= mFrontFloorZ2) ||
(rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2)) (mBackFloorZ1 >= mFrontCeilingZ1 && mBackFloorZ2 >= mFrontCeilingZ2))
{ {
// closed door // closed door
markceiling = markfloor = true; markceiling = markfloor = true;
} }
else else
{ {
markfloor = rw_mustmarkfloor markfloor =
|| backsector->floorplane != frontsector->floorplane mBackSector->floorplane != mFrontSector->floorplane
|| backsector->lightlevel != frontsector->lightlevel || mBackSector->lightlevel != mFrontSector->lightlevel
|| backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor) || mBackSector->GetTexture(sector_t::floor) != mFrontSector->GetTexture(sector_t::floor)
|| backsector->GetPlaneLight(sector_t::floor) != frontsector->GetPlaneLight(sector_t::floor) || mBackSector->GetPlaneLight(sector_t::floor) != mFrontSector->GetPlaneLight(sector_t::floor)
// killough 3/7/98: Add checks for (x,y) offsets // killough 3/7/98: Add checks for (x,y) offsets
|| backsector->planes[sector_t::floor].xform != frontsector->planes[sector_t::floor].xform || mBackSector->planes[sector_t::floor].xform != mFrontSector->planes[sector_t::floor].xform
|| backsector->GetAlpha(sector_t::floor) != frontsector->GetAlpha(sector_t::floor) || mBackSector->GetAlpha(sector_t::floor) != mFrontSector->GetAlpha(sector_t::floor)
// killough 4/15/98: prevent 2s normals // killough 4/15/98: prevent 2s normals
// from bleeding through deep water // from bleeding through deep water
|| frontsector->heightsec || mFrontSector->heightsec
|| backsector->GetVisFlags(sector_t::floor) != frontsector->GetVisFlags(sector_t::floor) || mBackSector->GetVisFlags(sector_t::floor) != mFrontSector->GetVisFlags(sector_t::floor)
// [RH] Add checks for colormaps // [RH] Add checks for colormaps
|| backsector->ColorMap != frontsector->ColorMap || mBackSector->ColorMap != mFrontSector->ColorMap
// kg3D - add fake lights // kg3D - add fake lights
|| (frontsector->e && frontsector->e->XFloor.lightlist.Size()) || (mFrontSector->e && mFrontSector->e->XFloor.lightlist.Size())
|| (backsector->e && backsector->e->XFloor.lightlist.Size()) || (mBackSector->e && mBackSector->e->XFloor.lightlist.Size())
|| (sidedef->GetTexture(side_t::mid).isValid() && || (sidedef->GetTexture(side_t::mid).isValid() &&
((linedef->flags & (ML_CLIP_MIDTEX | ML_WRAP_MIDTEX)) || ((linedef->flags & (ML_CLIP_MIDTEX | ML_WRAP_MIDTEX)) ||
(sidedef->Flags & (WALLF_CLIP_MIDTEX | WALLF_WRAP_MIDTEX)))) (sidedef->Flags & (WALLF_CLIP_MIDTEX | WALLF_WRAP_MIDTEX))))
; ;
markceiling = (frontsector->GetTexture(sector_t::ceiling) != skyflatnum || markceiling = (mFrontSector->GetTexture(sector_t::ceiling) != skyflatnum ||
backsector->GetTexture(sector_t::ceiling) != skyflatnum) && mBackSector->GetTexture(sector_t::ceiling) != skyflatnum) &&
(rw_mustmarkceiling (
|| backsector->ceilingplane != frontsector->ceilingplane mBackSector->ceilingplane != mFrontSector->ceilingplane
|| backsector->lightlevel != frontsector->lightlevel || mBackSector->lightlevel != mFrontSector->lightlevel
|| backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling) || mBackSector->GetTexture(sector_t::ceiling) != mFrontSector->GetTexture(sector_t::ceiling)
// killough 3/7/98: Add checks for (x,y) offsets // killough 3/7/98: Add checks for (x,y) offsets
|| backsector->planes[sector_t::ceiling].xform != frontsector->planes[sector_t::ceiling].xform || mBackSector->planes[sector_t::ceiling].xform != mFrontSector->planes[sector_t::ceiling].xform
|| backsector->GetAlpha(sector_t::ceiling) != frontsector->GetAlpha(sector_t::ceiling) || mBackSector->GetAlpha(sector_t::ceiling) != mFrontSector->GetAlpha(sector_t::ceiling)
// killough 4/15/98: prevent 2s normals // killough 4/15/98: prevent 2s normals
// from bleeding through fake ceilings // from bleeding through fake ceilings
|| (frontsector->heightsec && frontsector->GetTexture(sector_t::ceiling) != skyflatnum) || (mFrontSector->heightsec && mFrontSector->GetTexture(sector_t::ceiling) != skyflatnum)
|| backsector->GetPlaneLight(sector_t::ceiling) != frontsector->GetPlaneLight(sector_t::ceiling) || mBackSector->GetPlaneLight(sector_t::ceiling) != mFrontSector->GetPlaneLight(sector_t::ceiling)
|| backsector->GetFlags(sector_t::ceiling) != frontsector->GetFlags(sector_t::ceiling) || mBackSector->GetFlags(sector_t::ceiling) != mFrontSector->GetFlags(sector_t::ceiling)
// [RH] Add check for colormaps // [RH] Add check for colormaps
|| backsector->ColorMap != frontsector->ColorMap || mBackSector->ColorMap != mFrontSector->ColorMap
// kg3D - add fake lights // kg3D - add fake lights
|| (frontsector->e && frontsector->e->XFloor.lightlist.Size()) || (mFrontSector->e && mFrontSector->e->XFloor.lightlist.Size())
|| (backsector->e && backsector->e->XFloor.lightlist.Size()) || (mBackSector->e && mBackSector->e->XFloor.lightlist.Size())
|| (sidedef->GetTexture(side_t::mid).isValid() && || (sidedef->GetTexture(side_t::mid).isValid() &&
((linedef->flags & (ML_CLIP_MIDTEX | ML_WRAP_MIDTEX)) || ((linedef->flags & (ML_CLIP_MIDTEX | ML_WRAP_MIDTEX)) ||
@ -779,7 +779,7 @@ namespace swrenderer
{ // normal orientation { // normal orientation
if (linedef->flags & ML_DONTPEGTOP) if (linedef->flags & ML_DONTPEGTOP)
{ // top of texture at top { // top of texture at top
rw_toptexturemid = (frontsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat; rw_toptexturemid = (mFrontSector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat;
if (rowoffset < 0 && toptexture != NULL) if (rowoffset < 0 && toptexture != NULL)
{ {
rowoffset += toptexture->GetHeight(); rowoffset += toptexture->GetHeight();
@ -787,7 +787,7 @@ namespace swrenderer
} }
else else
{ // bottom of texture at bottom { // bottom of texture at bottom
rw_toptexturemid = (backsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat + toptexture->GetHeight(); rw_toptexturemid = (mBackSector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat + toptexture->GetHeight();
} }
} }
else else
@ -795,11 +795,11 @@ namespace swrenderer
rowoffset = -rowoffset; rowoffset = -rowoffset;
if (linedef->flags & ML_DONTPEGTOP) if (linedef->flags & ML_DONTPEGTOP)
{ // bottom of texture at top { // bottom of texture at top
rw_toptexturemid = (frontsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat + toptexture->GetHeight(); rw_toptexturemid = (mFrontSector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat + toptexture->GetHeight();
} }
else else
{ // top of texture at bottom { // top of texture at bottom
rw_toptexturemid = (backsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat; rw_toptexturemid = (mBackSector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat;
} }
} }
if (toptexture->bWorldPanning) if (toptexture->bWorldPanning)
@ -828,7 +828,7 @@ namespace swrenderer
} }
else else
{ // top of texture at top { // top of texture at top
rw_bottomtexturemid = (backsector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat; rw_bottomtexturemid = (mBackSector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat;
if (rowoffset < 0 && bottomtexture != NULL) if (rowoffset < 0 && bottomtexture != NULL)
{ {
rowoffset += bottomtexture->GetHeight(); rowoffset += bottomtexture->GetHeight();
@ -844,7 +844,7 @@ namespace swrenderer
} }
else else
{ // bottom of texture at top { // bottom of texture at top
rw_bottomtexturemid = (backsector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat + bottomtexture->GetHeight(); rw_bottomtexturemid = (mBackSector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat + bottomtexture->GetHeight();
} }
} }
if (bottomtexture->bWorldPanning) if (bottomtexture->bWorldPanning)
@ -863,20 +863,20 @@ namespace swrenderer
// it is definitely invisible and doesn't need to be marked. // it is definitely invisible and doesn't need to be marked.
// killough 3/7/98: add deep water check // killough 3/7/98: add deep water check
if (frontsector->GetHeightSec() == NULL) if (mFrontSector->GetHeightSec() == NULL)
{ {
int planeside; int planeside;
planeside = frontsector->floorplane.PointOnSide(ViewPos); planeside = mFrontSector->floorplane.PointOnSide(ViewPos);
if (frontsector->floorplane.fC() < 0) // 3D floors have the floor backwards if (mFrontSector->floorplane.fC() < 0) // 3D floors have the floor backwards
planeside = -planeside; planeside = -planeside;
if (planeside <= 0) // above view plane if (planeside <= 0) // above view plane
markfloor = false; markfloor = false;
if (frontsector->GetTexture(sector_t::ceiling) != skyflatnum) if (mFrontSector->GetTexture(sector_t::ceiling) != skyflatnum)
{ {
planeside = frontsector->ceilingplane.PointOnSide(ViewPos); planeside = mFrontSector->ceilingplane.PointOnSide(ViewPos);
if (frontsector->ceilingplane.fC() > 0) // 3D floors have the ceiling backwards if (mFrontSector->ceilingplane.fC() > 0) // 3D floors have the ceiling backwards
planeside = -planeside; planeside = -planeside;
if (planeside <= 0) // below view plane if (planeside <= 0) // below view plane
markceiling = false; markceiling = false;
@ -888,7 +888,7 @@ namespace swrenderer
bool segtextured = midtex != NULL || toptexture != NULL || bottomtexture != NULL; bool segtextured = midtex != NULL || toptexture != NULL || bottomtexture != NULL;
// calculate light table // calculate light table
if (needlights && (segtextured || (backsector && IsFogBoundary(frontsector, backsector)))) if (needlights && (segtextured || (mBackSector && IsFogBoundary(mFrontSector, mBackSector))))
{ {
lwallscale = lwallscale =
midtex ? (midtex->Scale.X * sidedef->GetTextureXScale(side_t::mid)) : midtex ? (midtex->Scale.X * sidedef->GetTextureXScale(side_t::mid)) :
@ -901,7 +901,7 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->FixedColormap() == nullptr && cameraLight->FixedLightLevel() < 0) if (cameraLight->FixedColormap() == nullptr && cameraLight->FixedLightLevel() < 0)
{ {
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel) + R_ActualExtraLight(foggy)); wallshade = LIGHT2SHADE(mLineSegment->sidedef->GetLightLevel(foggy, mFrontSector->lightlevel) + R_ActualExtraLight(foggy));
double GlobVis = LightVisibility::Instance()->WallGlobVis(); double GlobVis = LightVisibility::Instance()->WallGlobVis();
rw_lightleft = float(GlobVis / WallC.sz1); rw_lightleft = float(GlobVis / WallC.sz1);
rw_lightstep = float((GlobVis / WallC.sz2 - rw_lightleft) / (WallC.sx2 - WallC.sx1)); rw_lightstep = float((GlobVis / WallC.sz2 - rw_lightleft) / (WallC.sx2 - WallC.sx1));
@ -966,8 +966,8 @@ namespace swrenderer
short bottom = MIN(walltop.ScreenY[x], floorclip[x]); short bottom = MIN(walltop.ScreenY[x], floorclip[x]);
if (top < bottom) if (top < bottom)
{ {
ceilingplane->top[x] = top; mCeilingPlane->top[x] = top;
ceilingplane->bottom[x] = bottom; mCeilingPlane->bottom[x] = bottom;
} }
} }
} }
@ -982,8 +982,8 @@ namespace swrenderer
if (top < bottom) if (top < bottom)
{ {
assert(bottom <= viewheight); assert(bottom <= viewheight);
floorplane->top[x] = top; mFloorPlane->top[x] = top;
floorplane->bottom[x] = bottom; mFloorPlane->bottom[x] = bottom;
} }
} }
} }
@ -1018,19 +1018,19 @@ namespace swrenderer
} }
if (clip3d->fake3D & FAKE3D_FAKEMASK) return; if (clip3d->fake3D & FAKE3D_FAKEMASK) return;
FLightNode *light_list = (curline && curline->sidedef) ? curline->sidedef->lighthead : nullptr; FLightNode *light_list = (mLineSegment && mLineSegment->sidedef) ? mLineSegment->sidedef->lighthead : nullptr;
// draw the wall tiers // draw the wall tiers
if (midtexture) if (midtexture)
{ // one sided line { // one sided line
if (midtexture->UseType != FTexture::TEX_Null && viewactive) if (midtexture->UseType != FTexture::TEX_Null && viewactive)
{ {
rw_pic = midtexture; FTexture *rw_pic = midtexture;
xscale = rw_pic->Scale.X * rw_midtexturescalex; xscale = rw_pic->Scale.X * rw_midtexturescalex;
yscale = rw_pic->Scale.Y * rw_midtexturescaley; yscale = rw_pic->Scale.Y * rw_midtexturescaley;
if (xscale != lwallscale) if (xscale != lwallscale)
{ {
walltexcoords.ProjectPos(curline->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2, WallT); walltexcoords.ProjectPos(mLineSegment->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2, WallT);
lwallscale = xscale; lwallscale = xscale;
} }
if (midtexture->bWorldPanning) if (midtexture->bWorldPanning)
@ -1047,7 +1047,7 @@ namespace swrenderer
} }
RenderWallPart renderWallpart(Thread); RenderWallPart renderWallpart(Thread);
renderWallpart.Render(drawerargs, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallbottom.ScreenY, rw_midtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap); renderWallpart.Render(drawerargs, mFrontSector, mLineSegment, WallC, rw_pic, x1, x2, walltop.ScreenY, wallbottom.ScreenY, rw_midtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
} }
fillshort(ceilingclip + x1, x2 - x1, viewheight); fillshort(ceilingclip + x1, x2 - x1, viewheight);
fillshort(floorclip + x1, x2 - x1, 0xffff); fillshort(floorclip + x1, x2 - x1, 0xffff);
@ -1062,12 +1062,12 @@ namespace swrenderer
} }
if (viewactive) if (viewactive)
{ {
rw_pic = toptexture; FTexture *rw_pic = toptexture;
xscale = rw_pic->Scale.X * rw_toptexturescalex; xscale = rw_pic->Scale.X * rw_toptexturescalex;
yscale = rw_pic->Scale.Y * rw_toptexturescaley; yscale = rw_pic->Scale.Y * rw_toptexturescaley;
if (xscale != lwallscale) if (xscale != lwallscale)
{ {
walltexcoords.ProjectPos(curline->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2, WallT); walltexcoords.ProjectPos(mLineSegment->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2, WallT);
lwallscale = xscale; lwallscale = xscale;
} }
if (toptexture->bWorldPanning) if (toptexture->bWorldPanning)
@ -1084,7 +1084,7 @@ namespace swrenderer
} }
RenderWallPart renderWallpart(Thread); RenderWallPart renderWallpart(Thread);
renderWallpart.Render(drawerargs, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallupper.ScreenY, rw_toptexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap); renderWallpart.Render(drawerargs, mFrontSector, mLineSegment, WallC, rw_pic, x1, x2, walltop.ScreenY, wallupper.ScreenY, rw_toptexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mBackCeilingZ1, mBackCeilingZ2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
} }
memcpy(ceilingclip + x1, wallupper.ScreenY + x1, (x2 - x1) * sizeof(short)); memcpy(ceilingclip + x1, wallupper.ScreenY + x1, (x2 - x1) * sizeof(short));
} }
@ -1102,12 +1102,12 @@ namespace swrenderer
} }
if (viewactive) if (viewactive)
{ {
rw_pic = bottomtexture; FTexture *rw_pic = bottomtexture;
xscale = rw_pic->Scale.X * rw_bottomtexturescalex; xscale = rw_pic->Scale.X * rw_bottomtexturescalex;
yscale = rw_pic->Scale.Y * rw_bottomtexturescaley; yscale = rw_pic->Scale.Y * rw_bottomtexturescaley;
if (xscale != lwallscale) if (xscale != lwallscale)
{ {
walltexcoords.ProjectPos(curline->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2, WallT); walltexcoords.ProjectPos(mLineSegment->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2, WallT);
lwallscale = xscale; lwallscale = xscale;
} }
if (bottomtexture->bWorldPanning) if (bottomtexture->bWorldPanning)
@ -1124,7 +1124,7 @@ namespace swrenderer
} }
RenderWallPart renderWallpart(Thread); RenderWallPart renderWallpart(Thread);
renderWallpart.Render(drawerargs, frontsector, curline, WallC, rw_pic, x1, x2, walllower.ScreenY, wallbottom.ScreenY, rw_bottomtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap); renderWallpart.Render(drawerargs, mFrontSector, mLineSegment, WallC, rw_pic, x1, x2, walllower.ScreenY, wallbottom.ScreenY, rw_bottomtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(mBackFloorZ1, mBackFloorZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
} }
memcpy(floorclip + x1, walllower.ScreenY + x1, (x2 - x1) * sizeof(short)); memcpy(floorclip + x1, walllower.ScreenY + x1, (x2 - x1) * sizeof(short));
} }

View File

@ -65,43 +65,49 @@ namespace swrenderer
bool IsFogBoundary(sector_t *front, sector_t *back) const; bool IsFogBoundary(sector_t *front, sector_t *back) const;
bool SkyboxCompare(sector_t *frontsector, sector_t *backsector) const; bool SkyboxCompare(sector_t *frontsector, sector_t *backsector) const;
subsector_t *InSubsector; // Line variables:
sector_t *frontsector;
sector_t *backsector;
VisiblePlane *floorplane;
VisiblePlane *ceilingplane;
seg_t *curline; subsector_t *mSubsector;
side_t *sidedef; sector_t *mFrontSector;
line_t *linedef; sector_t *mBackSector;
VisiblePlane *mFloorPlane;
VisiblePlane *mCeilingPlane;
seg_t *mLineSegment;
double mBackCeilingZ1;
double mBackCeilingZ2;
double mBackFloorZ1;
double mBackFloorZ2;
double mFrontCeilingZ1;
double mFrontCeilingZ2;
double mFrontFloorZ1;
double mFrontFloorZ2;
bool mDoorClosed;
FWallCoords WallC; FWallCoords WallC;
FWallTmapVals WallT; FWallTmapVals WallT;
double rw_backcz1; bool foggy;
double rw_backcz2; FDynamicColormap *basecolormap;
double rw_backfz1;
double rw_backfz2; // Wall segment variables:
double rw_frontcz1;
double rw_frontcz2;
double rw_frontfz1;
double rw_frontfz2;
fixed_t rw_offset_top; fixed_t rw_offset_top;
fixed_t rw_offset_mid; fixed_t rw_offset_mid;
fixed_t rw_offset_bottom; fixed_t rw_offset_bottom;
ProjectedWallCull rw_ceilstat, rw_floorstat;
bool rw_mustmarkfloor, rw_mustmarkceiling;
bool rw_prepped; bool rw_prepped;
bool rw_markportal; bool rw_markportal;
bool rw_havehigh; bool rw_havehigh;
bool rw_havelow; bool rw_havelow;
int wallshade;
float rw_light; float rw_light;
float rw_lightstep; float rw_lightstep;
float rw_lightleft; float rw_lightleft;
double lwallscale;
fixed_t rw_offset; fixed_t rw_offset;
double rw_midtexturemid; double rw_midtexturemid;
double rw_toptexturemid; double rw_toptexturemid;
@ -113,21 +119,14 @@ namespace swrenderer
double rw_bottomtexturescalex; double rw_bottomtexturescalex;
double rw_bottomtexturescaley; double rw_bottomtexturescaley;
FTexture *rw_pic;
bool doorclosed;
int wallshade;
bool markfloor; // False if the back side is the same plane. bool markfloor; // False if the back side is the same plane.
bool markceiling; bool markceiling;
FTexture *toptexture; FTexture *toptexture;
FTexture *bottomtexture; FTexture *bottomtexture;
FTexture *midtexture; FTexture *midtexture;
bool foggy; ProjectedWallCull mCeilingClipped;
FDynamicColormap *basecolormap; ProjectedWallCull mFloorClipped;
double lwallscale;
ProjectedWallLine walltop; ProjectedWallLine walltop;
ProjectedWallLine wallbottom; ProjectedWallLine wallbottom;