From a95c6b9644b14f7d3e1cbd4a22b36dd02f5f2b01 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 29 Apr 2016 21:54:29 -0500 Subject: [PATCH] Draw upper/lower textures on two-sided portal lines --- src/r_bsp.cpp | 12 ++++++++---- src/r_segs.cpp | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 88c907e2b..2660fce6e 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -575,7 +575,6 @@ void R_AddLine (seg_t *line) return; vertex_t *v1, *v2; - v1 = line->linedef->v1; v2 = line->linedef->v2; @@ -605,7 +604,7 @@ void R_AddLine (seg_t *line) rw_havehigh = rw_havelow = false; // Single sided line? - if (backsector == NULL || (line->linedef->isVisualPortal() && line->sidedef == line->linedef->sidedef[0])) + if (backsector == NULL) { solid = true; } @@ -636,9 +635,14 @@ void R_AddLine (seg_t *line) WallMost (walllower, backsector->floorplane, &WallC); } + // Portal + if (line->linedef->isVisualPortal() && line->sidedef == line->linedef->sidedef[0]) + { + solid = true; + } // Closed door. - if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) || - (rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2)) + else if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) || + (rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2)) { solid = true; } diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 4c91a1314..69d517b17 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -2016,9 +2016,9 @@ void R_NewWall (bool needlights) midtexture = toptexture = bottomtexture = 0; if (sidedef == linedef->sidedef[0] && - (linedef->isVisualPortal() || (linedef->special == Line_Mirror && r_drawmirrors))) // [ZZ] compatibility with r_drawmirrors cvar that existed way before portals + (linedef->special == Line_Mirror && r_drawmirrors)) // [ZZ] compatibility with r_drawmirrors cvar that existed way before portals { - markfloor = markceiling = true; // act like an 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; } else if (backsector == NULL) @@ -2027,7 +2027,11 @@ void R_NewWall (bool needlights) // a single sided line is terminal, so it must mark ends markfloor = markceiling = true; // [RH] Horizon lines do not need to be textured - if (linedef->special != Line_Horizon) + if (linedef->isVisualPortal()) + { + rw_markportal = true; + } + else if (linedef->special != Line_Horizon) { midtexture = TexMan(sidedef->GetTexture(side_t::mid), true); rw_offset_mid = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid)); @@ -2102,8 +2106,12 @@ void R_NewWall (bool needlights) rw_frontlowertop = backsector->GetPlaneTexZ(sector_t::ceiling); } - if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) || - (rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2)) + if (linedef->isVisualPortal()) + { + markceiling = markfloor = true; + } + else if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) || + (rw_backfz1 >= rw_frontcz1 && rw_backfz2 >= rw_frontcz2)) { // closed door markceiling = markfloor = true; @@ -2260,6 +2268,7 @@ void R_NewWall (bool needlights) rw_bottomtexturemid += rowoffset; } } + rw_markportal = linedef->isVisualPortal(); } // if a floor / ceiling plane is on the wrong side of the view plane,