diff --git a/src/swrenderer/plane/r_visibleplanelist.cpp b/src/swrenderer/plane/r_visibleplanelist.cpp index 966329e97..b774b2112 100644 --- a/src/swrenderer/plane/r_visibleplanelist.cpp +++ b/src/swrenderer/plane/r_visibleplanelist.cpp @@ -64,33 +64,30 @@ namespace swrenderer return newplane; } - void VisiblePlaneList::Clear(bool fullclear) + void VisiblePlaneList::Clear() { - // Don't clear fake planes if not doing a full clear. - if (!fullclear) + for (int i = 0; i <= MAXVISPLANES; i++) + visplanes[i] = nullptr; + } + + void VisiblePlaneList::ClearKeepFakePlanes() + { + for (int i = 0; i <= MAXVISPLANES - 1; i++) { - for (int i = 0; i <= MAXVISPLANES - 1; i++) + for (VisiblePlane **probe = &visplanes[i]; *probe != nullptr; ) { - for (VisiblePlane **probe = &visplanes[i]; *probe != nullptr; ) - { - if ((*probe)->sky < 0) - { // fake: move past it - probe = &(*probe)->next; - } - else - { // not fake: move from list - VisiblePlane *vis = *probe; - *probe = vis->next; - vis->next = nullptr; - } + if ((*probe)->sky < 0) + { // fake: move past it + probe = &(*probe)->next; + } + else + { // not fake: move from list + VisiblePlane *vis = *probe; + *probe = vis->next; + vis->next = nullptr; } } } - else - { - for (int i = 0; i <= MAXVISPLANES; i++) - visplanes[i] = nullptr; - } } VisiblePlane *VisiblePlaneList::FindPlane(const secplane_t &height, FTextureID picnum, int lightlevel, double Alpha, bool additive, const FTransform &xxform, int sky, FSectorPortal *portal, FDynamicColormap *basecolormap) diff --git a/src/swrenderer/plane/r_visibleplanelist.h b/src/swrenderer/plane/r_visibleplanelist.h index 92f3609e9..3a3134fbd 100644 --- a/src/swrenderer/plane/r_visibleplanelist.h +++ b/src/swrenderer/plane/r_visibleplanelist.h @@ -27,7 +27,8 @@ namespace swrenderer public: static VisiblePlaneList *Instance(); - void Clear(bool fullclear); + void Clear(); + void ClearKeepFakePlanes(); VisiblePlane *FindPlane(const secplane_t &height, FTextureID picnum, int lightlevel, double Alpha, bool additive, const FTransform &xxform, int sky, FSectorPortal *portal, FDynamicColormap *basecolormap); VisiblePlane *GetRange(VisiblePlane *pl, int start, int stop); diff --git a/src/swrenderer/scene/r_portal.cpp b/src/swrenderer/scene/r_portal.cpp index 158ef7062..4d18bcfd4 100644 --- a/src/swrenderer/scene/r_portal.cpp +++ b/src/swrenderer/scene/r_portal.cpp @@ -165,7 +165,7 @@ namespace swrenderer R_SetViewAngle(); validcount++; // Make sure we see all sprites - planes->Clear(false); + planes->ClearKeepFakePlanes(); RenderClipSegment::Instance()->Clear(pl->left, pl->right); WindowLeft = pl->left; WindowRight = pl->right; @@ -408,7 +408,7 @@ namespace swrenderer PortalDrawseg* prevpds = CurrentPortal; CurrentPortal = pds; - VisiblePlaneList::Instance()->Clear(false); + VisiblePlaneList::Instance()->ClearKeepFakePlanes(); RenderClipSegment::Instance()->Clear(pds->x1, pds->x2); WindowLeft = pds->x1; diff --git a/src/swrenderer/scene/r_scene.cpp b/src/swrenderer/scene/r_scene.cpp index 451bd6498..659505f0d 100644 --- a/src/swrenderer/scene/r_scene.cpp +++ b/src/swrenderer/scene/r_scene.cpp @@ -133,7 +133,7 @@ namespace swrenderer // Clear buffers. RenderClipSegment::Instance()->Clear(0, viewwidth); R_ClearDrawSegs(); - VisiblePlaneList::Instance()->Clear(true); + VisiblePlaneList::Instance()->Clear(); RenderTranslucentPass::Clear(); // opening / clipping determination