From 7105a87a1e5472a77b3f71109017eb15409d87a3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Feb 2016 19:19:18 +0100 Subject: [PATCH] - fixed retrieval of mapsection for polyportals. - render wall portals on one sided lines. --- src/gl/scene/gl_portal.cpp | 7 ++++++- src/gl/scene/gl_sky.cpp | 9 +-------- src/gl/scene/gl_walls.cpp | 19 ++++++++++++++++--- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 2d74af820d..5ce683f571 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -1050,7 +1050,12 @@ void GLLineToLinePortal::DrawContents() for (unsigned i = 0; i < lines.Size(); i++) { - int mapsection = lines[i].seg->linedef->getPortalDestination()->frontsector->subsectors[0]->mapsection; + line_t *line = lines[i].seg->linedef->getPortalDestination(); + subsector_t *sub; + if (line->sidedef[0]->Flags & WALLF_POLYOBJ) + sub = R_PointInSubsector(line->v1->x, line->v1->y); + else sub = line->frontsector->subsectors[0]; + int mapsection = sub->mapsection; currentmapsection[mapsection >> 3] |= 1 << (mapsection & 7); } diff --git a/src/gl/scene/gl_sky.cpp b/src/gl/scene/gl_sky.cpp index c882674dd0..5a5a10a265 100644 --- a/src/gl/scene/gl_sky.cpp +++ b/src/gl/scene/gl_sky.cpp @@ -193,19 +193,12 @@ void GLWall::SkyLine(sector_t *fs, line_t *line) { ASkyViewpoint * skyboxx = line->skybox; GLSkyInfo skyinfo; - GLLineToLineInfo llinfo; int ptype; // JUSTHIT is used as an indicator that a skybox is in use. // This is to avoid recursion - if (line->isVisualPortal()) - { - ptype = PORTALTYPE_LINETOLINE; - llinfo.init(line); - l2l = UniqueLineToLines.Get(&llinfo); - } - else if (!gl_noskyboxes && skyboxx && GLRenderer->mViewActor != skyboxx && !(skyboxx->flags&MF_JUSTHIT)) + if (!gl_noskyboxes && skyboxx && GLRenderer->mViewActor != skyboxx && !(skyboxx->flags&MF_JUSTHIT)) { ptype = PORTALTYPE_SKYBOX; skybox = skyboxx; diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index c8430986f4..5d33670ce9 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -1475,7 +1475,18 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) // sector's sky SkyNormal(frontsector, v1, v2); - if (seg->linedef->skybox == NULL) + if (seg->linedef->isVisualPortal()) + { + GLLineToLineInfo llinfo; + ztop[0] = zceil[0]; + ztop[1] = zceil[1]; + zbottom[0] = zfloor[0]; + zbottom[1] = zfloor[1]; + llinfo.init(seg->linedef); + l2l = UniqueLineToLines.Get(&llinfo); + PutPortal(PORTALTYPE_LINETOLINE); + } + else if (seg->linedef->skybox == NULL && !seg->linedef->isVisualPortal()) { // normal texture gltexture = FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::mid), false, true); @@ -1590,12 +1601,14 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) if (seg->linedef->isVisualPortal() && seg->sidedef == seg->linedef->sidedef[0]) { + GLLineToLineInfo llinfo; ztop[0] = FIXED2FLOAT(bch1); ztop[1] = FIXED2FLOAT(bch2); zbottom[0] = FIXED2FLOAT(bfh1); zbottom[1] = FIXED2FLOAT(bfh2); - - SkyLine(frontsector, seg->linedef); + llinfo.init(seg->linedef); + l2l = UniqueLineToLines.Get(&llinfo); + PutPortal(PORTALTYPE_LINETOLINE); } else if (backsector->e->XFloor.ffloors.Size() || frontsector->e->XFloor.ffloors.Size()) {