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;
// Single sided line?
if (backsector == NULL)
if (backsector == NULL || (line->linedef->portal && line->sidedef == line->linedef->sidedef[0]))
{
solid = true;
}
@ -654,9 +654,7 @@ void R_AddLine (seg_t *line)
// Window.
solid = false;
}
else if (line->linedef->portal // [ZZ] portals are always drawn, even if there's exactly same sector on both sides
|| backsector->lightlevel != frontsector->lightlevel
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)
|| 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)
{
RenderTarget->DrawLine(x, Ytop, x, Ybottom, color, 0);
RenderTarget->DrawLine(x, Ytop, x, Ybottom+1, color, 0);
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))
{
// 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);
continue;
}
@ -2522,9 +2523,6 @@ static void R_DrawMaskedSegsBehindParticle (const vissprite_t *vis)
for (unsigned int p = InterestingDrawsegs.Size(); p-- > FirstInterestingDrawseg; )
{
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
if (ds->fake) continue;
if (ds->x1 >= x2 || ds->x2 < x1)
@ -2533,7 +2531,9 @@ 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)
{
R_RenderMaskedSegRange (ds, MAX<int> (ds->x1, x1), MIN<int> (ds->x2, x2-1));
// [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));
}
}
}