- calculate a proper opening range when encountering a sector portal on a one-sided line in the sight checking code

This commit is contained in:
Christoph Oelckers 2018-06-25 10:27:02 +02:00
parent a5b4d9d9a9
commit ff1eb7f3f2

View file

@ -151,6 +151,7 @@ public:
void SightCheck::P_SightOpening(SightOpening &open, const line_t *linedef, double x, double y) void SightCheck::P_SightOpening(SightOpening &open, const line_t *linedef, double x, double y)
{ {
open.portalflags = 0; open.portalflags = 0;
open.bottom = open.top = 0;
sector_t *front = linedef->frontsector; sector_t *front = linedef->frontsector;
sector_t *back = linedef->backsector; sector_t *back = linedef->backsector;
@ -159,8 +160,10 @@ void SightCheck::P_SightOpening(SightOpening &open, const line_t *linedef, doubl
// single sided line // single sided line
if (linedef->flags & ML_PORTALCONNECT) if (linedef->flags & ML_PORTALCONNECT)
{ {
if (!front->PortalBlocksSight(sector_t::ceiling)) open.portalflags |= SO_TOPFRONT; if (!front->PortalBlocksSight(sector_t::ceiling)) open.top = LINEOPEN_MAX, open.portalflags |= SO_TOPFRONT;
if (!front->PortalBlocksSight(sector_t::floor)) open.portalflags |= SO_BOTTOMFRONT; if (!front->PortalBlocksSight(sector_t::floor)) open.bottom = LINEOPEN_MIN, open.portalflags |= SO_BOTTOMFRONT;
if (open.top == 0) open.top = front->floorplane.ZatPoint(x, y);
if (open.bottom == 0) open.bottom = front->ceilingplane.ZatPoint(x, y);
} }
open.range = 0; open.range = 0;
@ -224,7 +227,7 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
{ {
// This may not skip P_SightOpening, but only reduce the open range to 0. // This may not skip P_SightOpening, but only reduce the open range to 0.
open.range = 0; open.range = 0;
open.bottom = open.top; if (open.bottom != LINEOPEN_MIN) open.bottom = open.top;
} }
FLinePortal *lport = li->getPortal(); FLinePortal *lport = li->getPortal();