- fixed: P_CheckMissileSpawn's setup for P_TryMove must be done in a way that allows detecting portal transitions.

By setting the position before the call any portal lying between the actual spawn point and the check position would be skipped.
This commit is contained in:
Christoph Oelckers 2017-06-07 22:40:54 +02:00
parent 78061f1cf7
commit 55df3a91ec

View file

@ -6718,6 +6718,8 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
th->tics = 1;
}
DVector3 newpos = th->Pos();
if (maxdist > 0)
{
// move a little forward so an angle can be computed if it immediately explodes
@ -6731,7 +6733,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
advance *= 0.5f;
}
while (advance.XY().LengthSquared() >= maxsquared);
th->SetXYZ(th->Pos() + advance);
newpos += advance;
}
FCheckPosition tm(!!(th->flags2 & MF2_RIP));
@ -6755,7 +6757,9 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
bool MBFGrenade = (!(th->flags & MF_MISSILE) || (th->BounceFlags & BOUNCE_MBF));
// killough 3/15/98: no dropoff (really = don't care for missiles)
if (!(P_TryMove (th, th->Pos(), false, NULL, tm, true)))
auto oldf2 = th->flags2;
th->flags2 &= ~MF2_MCROSS; // The following check is not supposed to activate missile triggers.
if (!(P_TryMove (th, newpos, false, NULL, tm, true)))
{
// [RH] Don't explode ripping missiles that spawn inside something
if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP))
@ -6778,6 +6782,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
return false;
}
}
th->flags2 = oldf2;
th->ClearInterpolation();
return true;
}