From 24776edd133d0a489e16c0ec9941e4137cc06146 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Apr 2016 16:39:58 +0200 Subject: [PATCH] - fixed one of the most glaring omissions in the portal code: The wall clipper completely ignored portals when deciding how to treat a sector boundary, and ended up merging portal with non-portal planes. This check is only active for linedef based portals, due to the large amount of maps that did it wrong with thing based portals. Although it may well be that there are some maps that abuse this omission for linedef portals as well, these are better handled with a compatibility option if the need arises. The main reason this was added is to streamline and optimize the portal handling between renderers in ZDoom and GZDoom. For that both need to show the same general behavior and for linedef portals it is also important to handle the same as in Eternity. --- src/r_bsp.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 4f664d1bc..010f1e72e 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -513,6 +513,23 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, } +bool R_SkyboxCompare(sector_t *frontsector, sector_t *backsector) +{ + AActor *frontc = frontsector->SkyBoxes[sector_t::ceiling]; + AActor *frontf = frontsector->SkyBoxes[sector_t::floor]; + AActor *backc = backsector->SkyBoxes[sector_t::ceiling]; + AActor *backf = backsector->SkyBoxes[sector_t::floor]; + + // return true if any of the planes has a linedef-based portal (unless both sides have the same one. + // Ideally this should also check thing based portals but the omission of this check had been abused to hell and back for those. + // (Note: This may require a compatibility option if some maps ran into this for line based portals as well.) + if (frontc != NULL && (frontc->special1 == SKYBOX_PORTAL || frontc->special1 == SKYBOX_LINKEDPORTAL)) return (frontc != backc); + if (frontf != NULL && (frontf->special1 == SKYBOX_PORTAL || frontf->special1 == SKYBOX_LINKEDPORTAL)) return (frontf != backf); + if (backc != NULL && (backc->special1 == SKYBOX_PORTAL || backc->special1 == SKYBOX_LINKEDPORTAL)) return true; + if (backf != NULL && (backf->special1 == SKYBOX_PORTAL || backf->special1 == SKYBOX_LINKEDPORTAL)) return true; + return false; +} + // // R_AddLine // Clips the given segment @@ -655,6 +672,10 @@ void R_AddLine (seg_t *line) // Window. solid = false; } + else if (R_SkyboxCompare(frontsector, backsector)) + { + solid = false; + } else if (backsector->lightlevel != frontsector->lightlevel || backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor) || backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling)