Fixed trivial bug with two-sided portals not clipping stuff correctly

This commit is contained in:
ZZYZX 2014-12-16 22:54:49 +02:00
parent 29880026a6
commit b3764f4ee2
3 changed files with 8 additions and 10 deletions

View file

@ -589,7 +589,7 @@ void R_AddLine (seg_t *line)
rw_havehigh = rw_havelow = false; rw_havehigh = rw_havelow = false;
// Single sided line? // Single sided line?
if (backsector == NULL) if (backsector == NULL || (line->linedef->portal && line->sidedef == line->linedef->sidedef[0]))
{ {
solid = true; solid = true;
} }
@ -654,9 +654,7 @@ void R_AddLine (seg_t *line)
// Window. // Window.
solid = false; solid = false;
} }
else if (line->linedef->portal // [ZZ] portals are always drawn, even if there's exactly same sector on both sides else if (backsector->lightlevel != frontsector->lightlevel
|| backsector->lightlevel != frontsector->lightlevel
|| backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor) || backsector->GetTexture(sector_t::floor) != frontsector->GetTexture(sector_t::floor)
|| backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling) || backsector->GetTexture(sector_t::ceiling) != frontsector->GetTexture(sector_t::ceiling)
|| curline->sidedef->GetTexture(side_t::mid).isValid() || curline->sidedef->GetTexture(side_t::mid).isValid()

View file

@ -639,7 +639,7 @@ void R_HighlightPortal (PortalDrawseg* pds)
if (x == pds->x1 || x == pds->x2) if (x == pds->x1 || x == pds->x2)
{ {
RenderTarget->DrawLine(x, Ytop, x, Ybottom, color, 0); RenderTarget->DrawLine(x, Ytop, x, Ybottom+1, color, 0);
continue; continue;
} }

View file

@ -2157,7 +2157,8 @@ void R_DrawSprite (vissprite_t *spr)
ds->curline->v1->x - spr->gx, ds->curline->v2->y - ds->curline->v1->y) <= 0)) ds->curline->v1->x - spr->gx, ds->curline->v2->y - ds->curline->v1->y) <= 0))
{ {
// seg is behind sprite, so draw the mid texture if it has one // seg is behind sprite, so draw the mid texture if it has one
if (ds->maskedtexturecol != -1 || ds->bFogBoundary) if (ds->CurrentPortalUniq == CurrentPortalUniq && // [ZZ] instead, portal uniq check is made here
(ds->maskedtexturecol != -1 || ds->bFogBoundary))
R_RenderMaskedSegRange (ds, r1, r2); R_RenderMaskedSegRange (ds, r1, r2);
continue; continue;
} }
@ -2522,9 +2523,6 @@ static void R_DrawMaskedSegsBehindParticle (const vissprite_t *vis)
for (unsigned int p = InterestingDrawsegs.Size(); p-- > FirstInterestingDrawseg; ) for (unsigned int p = InterestingDrawsegs.Size(); p-- > FirstInterestingDrawseg; )
{ {
drawseg_t *ds = &drawsegs[InterestingDrawsegs[p]]; drawseg_t *ds = &drawsegs[InterestingDrawsegs[p]];
// [ZZ] only draw stuff that's inside the same portal as the particle, other portals will care for themselves
if (ds->CurrentPortalUniq != vis->CurrentPortalUniq)
continue;
// kg3D - no fake segs // kg3D - no fake segs
if (ds->fake) continue; if (ds->fake) continue;
if (ds->x1 >= x2 || ds->x2 < x1) if (ds->x1 >= x2 || ds->x2 < x1)
@ -2533,6 +2531,8 @@ static void R_DrawMaskedSegsBehindParticle (const vissprite_t *vis)
} }
if (Scale (ds->siz2 - ds->siz1, (x2 + x1)/2 - ds->sx1, ds->sx2 - ds->sx1) + ds->siz1 < vis->idepth) if (Scale (ds->siz2 - ds->siz1, (x2 + x1)/2 - ds->sx1, ds->sx2 - ds->sx1) + ds->siz1 < vis->idepth)
{ {
// [ZZ] only draw stuff that's inside the same portal as the particle, other portals will care for themselves
if (ds->CurrentPortalUniq == vis->CurrentPortalUniq)
R_RenderMaskedSegRange (ds, MAX<int> (ds->x1, x1), MIN<int> (ds->x2, x2-1)); R_RenderMaskedSegRange (ds, MAX<int> (ds->x1, x1), MIN<int> (ds->x2, x2-1));
} }
} }