From 1107bebfcfef572f4abf0dd61c3f875790388815 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 2 Mar 2013 01:54:40 +0000 Subject: [PATCH] - Redo r4164 fix: Don't clear fake planes when clearing skybox planes. SVN r4172 (trunk) --- src/r_3dfloors.cpp | 2 -- src/r_plane.cpp | 42 ++++++++++++++++++++++++++++++++++-------- src/r_polymost.cpp | 2 +- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/r_3dfloors.cpp b/src/r_3dfloors.cpp index 412a6057a..fbdc34edc 100644 --- a/src/r_3dfloors.cpp +++ b/src/r_3dfloors.cpp @@ -140,7 +140,6 @@ void R_3D_EnterSkybox() height_top = NULL; height_cur = NULL; height_max = -1; - fakeActive = 0; CurrentSkybox++; } @@ -158,7 +157,6 @@ void R_3D_LeaveSkybox() height_top = current.height_top; height_cur = current.height_cur; height_max = current.height_max; - fakeActive = height_top != NULL; CurrentSkybox--; } diff --git a/src/r_plane.cpp b/src/r_plane.cpp index d3c5f8c94..16e9b12e2 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -492,13 +492,39 @@ void R_ClearPlanes (bool fullclear) { int i, max; - // kg3D - we can't just clear planes if there are fake planes - if(!fullclear && fakeActive) return; - - max = fullclear ? MAXVISPLANES : MAXVISPLANES-1; - for (i = 0; i <= max; i++) // new code -- killough - for (*freehead = visplanes[i], visplanes[i] = NULL; *freehead; ) - freehead = &(*freehead)->next; + // Don't clear fake planes if not doing a full clear. + if (!fullclear) + { + for (i = 0; i <= MAXVISPLANES-1; i++) // new code -- killough + { + for (visplane_t **probe = &visplanes[i]; *probe != NULL; ) + { + if ((*probe)->sky < 0) + { // fake: move past it + probe = &(*probe)->next; + } + else + { // not fake: move to freelist + visplane_t *vis = *probe; + *freehead = vis; + *probe = vis->next; + vis->next = NULL; + freehead = &vis->next; + } + } + } + } + else + { + max = fullclear ? MAXVISPLANES : MAXVISPLANES-1; + for (i = 0; i <= MAXVISPLANES; i++) // new code -- killough + { + for (*freehead = visplanes[i], visplanes[i] = NULL; *freehead; ) + { + freehead = &(*freehead)->next; + } + } + } if (fullclear) { @@ -597,7 +623,7 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl skybox = NULL; alpha = FRACUNIT; } - + // New visplane algorithm uses hash table -- killough hash = isskybox ? MAXVISPLANES : visplane_hash (picnum.GetIndex(), lightlevel, height); diff --git a/src/r_polymost.cpp b/src/r_polymost.cpp index 92cec1a6e..e7963faa2 100644 --- a/src/r_polymost.cpp +++ b/src/r_polymost.cpp @@ -1430,7 +1430,7 @@ void RP_Subsector (subsector_t *sub) frontsector->ceiling_yscale, frontsector->ceiling_angle + frontsector->base_ceiling_angle, frontsector->sky, - frontsector->CeilingSkyBox + frontsector->CeilingSkyBox, ) : NULL;*/ basecolormap = frontsector->ColorMap;