Skip to content

Commit 6f7df4e

Browse files
committed
Fixed the uses of P_LineOpening now
1 parent 2733ceb commit 6f7df4e

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

source/p_trace.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,19 @@ static bool PTR_AimTraverse(intercept_t *in, void *context, const divline_t &tra
139139

140140
dist = FixedMul(trace.attackrange, in->frac);
141141

142-
if(li->frontsector->srf.floor.getZAt(edgepos) != li->backsector->srf.floor.getZAt(edgepos))
142+
const sector_t *const frontsector =
143+
li->intflags & MLI_DYNASEGLINE ? R_PointInSubsector(edgepos)->sector : li->frontsector;
144+
const sector_t *const backsector = li->intflags & MLI_DYNASEGLINE ? frontsector : li->backsector;
145+
// IMPORTANT: no portals here, no 1sportalline or edgepos2
146+
147+
if(frontsector->srf.floor.getZAt(edgepos) != backsector->srf.floor.getZAt(edgepos))
143148
{
144149
slope = FixedDiv(clip.open.height.floor - trace.z, dist);
145150
if(slope > trace.bottomslope)
146151
trace.bottomslope = slope;
147152
}
148153

149-
if(li->frontsector->srf.ceiling.getZAt(edgepos) != li->backsector->srf.ceiling.getZAt(edgepos))
154+
if(frontsector->srf.ceiling.getZAt(edgepos) != backsector->srf.ceiling.getZAt(edgepos))
150155
{
151156
slope = FixedDiv(clip.open.height.ceiling - trace.z, dist);
152157
if(slope < trace.topslope)
@@ -368,6 +373,7 @@ static bool PTR_ShootTraverseVanilla(intercept_t *in, void *context, const divli
368373

369374
if(li->flags & ML_TWOSIDED)
370375
{
376+
// NOTE: no polyobjects in vanilla, no worry there. No Hexen demo support either.
371377
clip.open = P_LineOpening(li, nullptr);
372378
fixed_t dist = FixedMul(trace.attackrange, in->frac);
373379
fixed_t slope;
@@ -460,10 +466,8 @@ static bool P_Shoot2SLine(line_t *li, int side, fixed_t dist)
460466
ceilingsame = becomp && P_SlopesEqual(fs, bs, surf_ceil);
461467
}
462468

463-
if((floorsame || (clip.open.height.floor == D_MININT && demo_version >= 406) ||
464-
FixedDiv(clip.open.height.floor - trace.z, dist) <= trace.aimslope) &&
465-
(ceilingsame || (clip.open.height.ceiling == D_MAXINT && demo_version >= 406) ||
466-
FixedDiv(clip.open.height.ceiling - trace.z, dist) >= trace.aimslope))
469+
if((floorsame || FixedDiv(clip.open.height.floor - trace.z, dist) <= trace.aimslope) &&
470+
(ceilingsame || FixedDiv(clip.open.height.ceiling - trace.z, dist) >= trace.aimslope))
467471
{
468472
if(li->special)
469473
P_ShootSpecialLine(trace.thing, li, side);

0 commit comments

Comments
 (0)