diff --git a/src/portal.cpp b/src/portal.cpp index 3b17eb74a..02ff5e7fd 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -80,14 +80,7 @@ bool P_ClipLineToPortal(line_t* line, line_t* portal, fixed_t viewx, fixed_t vie bool P_CheckPortal(line_t* line) { - if (line->special == Line_Mirror) - { - line->portal = true; - line->portal_mirror = true; - line->portal_passive = true; - line->portal_dst = line; - } - else if (line->special == Line_SetPortal) + if (line->special == Line_SetPortal) { // portal destination is special argument #0 line_t* dst = NULL; @@ -110,28 +103,18 @@ bool P_CheckPortal(line_t* line) if (dst) { - line->portal = true; - line->portal_mirror = false; - line->portal_passive = true;// !!(line->args[2] & PORTAL_VISUAL; (line->special == Line_SetVisualPortal); - line->portal_dst = dst; + line->_portal = true; + //line->portal_passive = true;// !!(line->args[2] & PORTAL_VISUAL; (line->special == Line_SetVisualPortal); + line->_portal_dst = dst; } else { - line->portal = false; - line->portal_mirror = false; - line->portal_passive = false; - line->portal_dst = NULL; + line->_portal = false; + //line->portal_passive = false; + line->_portal_dst = NULL; } } - else - { - line->portal = false; - line->portal_mirror = false; - line->portal_passive = false; - line->portal_dst = NULL; - } - - return (line->portal); + return (line->_portal); } void P_TranslatePortalXY(line_t* src, line_t* dst, fixed_t& x, fixed_t& y) @@ -297,12 +280,12 @@ bool PortalTracer::TraceStep() { li = in->d.line; - if (li->portal && !li->portal_passive) + if (li->isLinePortal()) { if (P_PointOnLineSide(startx-dirx, starty-diry, li)) continue; // we're at the back side of this line - line_t* out = li->portal_dst; + line_t* out = li->getPortalDestination(); this->in = li; this->out = out; diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index e9802e5b1..a6dd7f61b 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -590,7 +590,7 @@ void R_AddLine (seg_t *line) rw_havehigh = rw_havelow = false; // Single sided line? - if (backsector == NULL || (line->linedef->portal && line->sidedef == line->linedef->sidedef[0])) + if (backsector == NULL || (line->linedef->isVisualPortal() && line->sidedef == line->linedef->sidedef[0])) { solid = true; } diff --git a/src/r_defs.h b/src/r_defs.h index fb40a2bd1..901dadcb0 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -988,14 +988,25 @@ struct line_t sector_t *frontsector, *backsector; int validcount; // if == validcount, already checked int locknumber; // [Dusk] lock number for special - line_t *portal_dst; - bool portal; - bool portal_mirror; - bool portal_passive; + line_t *_portal_dst; + bool _portal; + + // returns true if the portal is crossable by actors bool isLinePortal() const { - return portal; + return false; // right now there are no crossable portals + } + + // returns true if the portal needs to be handled by the renderer + bool isVisualPortal() const + { + return _portal; + } + + line_t *getPortalDestination() const + { + return _portal_dst; } }; diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 79b5251c4..59bf12b39 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -2004,8 +2004,7 @@ void R_NewWall (bool needlights) midtexture = toptexture = bottomtexture = 0; if (sidedef == linedef->sidedef[0] && - linedef->portal && - (!linedef->portal_mirror || r_drawmirrors)) // [ZZ] compatibility with r_drawmirrors cvar that existed way before portals + (linedef->isVisualPortal() || (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) rw_markportal = true; @@ -2632,7 +2631,7 @@ void R_StoreWallRange (int start, int stop) { PortalDrawseg pds; pds.src = curline->linedef; - pds.dst = curline->linedef->portal_dst; + pds.dst = curline->linedef->special == Line_Mirror? curline->linedef : curline->linedef->getPortalDestination(); pds.x1 = ds_p->x1; pds.x2 = ds_p->x2; pds.len = pds.x2 - pds.x1; @@ -2653,7 +2652,7 @@ void R_StoreWallRange (int start, int stop) pds.floorclip[i] = RenderTarget->GetHeight()-1; } - pds.mirror = curline->linedef->portal_mirror; + pds.mirror = curline->linedef->special == Line_Mirror; WallPortals.Push(pds); } diff --git a/src/r_things.cpp b/src/r_things.cpp index 003e3a758..682ad5f35 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -31,6 +31,7 @@ #include #include +#include "p_lnspec.h" #include "templates.h" #include "doomdef.h" #include "m_swap.h" @@ -339,11 +340,11 @@ static inline bool R_ClipSpriteColumnWithPortals (fixed_t x, fixed_t y, vissprit if (!seg->curline) continue; line_t* line = seg->curline->linedef; - // divline? wtf, anyway, divlines aren't supposed to be drawn. But I definitely saw NULL linedefs in drawsegs. + // ignore minisegs from GL nodes. if (!line) continue; // check if this line will clip sprites to itself - if (!line->portal) + if (!line->isVisualPortal() && line->special != Line_Mirror) continue; // don't clip sprites with portal's back side (it's transparent) @@ -739,7 +740,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor // [ZZ] Or less definitely not visible (hue) // [ZZ] 10.01.2016: don't try to clip stuff inside a skybox against the current portal. - if (!CurrentPortalInSkybox && CurrentPortal && !!P_PointOnLineSide(thing->X(), thing->Y(), CurrentPortal->dst)) + if (!CurrentPortalInSkybox && CurrentPortal && !!P_PointOnLineSidePrecise(thing->X(), thing->Y(), CurrentPortal->dst)) return; // [RH] Interpolate the sprite's position to make it look smooth