- made P_Move's multiple-step movement portal and teleporter-aware.

This commit is contained in:
Christoph Oelckers 2016-05-20 13:30:10 +02:00
parent 428bd52295
commit bd396ccb7c

View file

@ -538,15 +538,31 @@ bool P_Move (AActor *actor)
tm.FromPMove = true; tm.FromPMove = true;
try_ok = true; DVector2 start = { origx, origy };
for(int i=1; i < steps; i++) DVector2 move = { deltax, deltay };
{ DAngle oldangle = actor->Angles.Yaw;
try_ok = P_TryMove(actor, DVector2(origx + deltax * i / steps, origy + deltay * i / steps), dropoff, NULL, tm);
if (!try_ok) break;
}
// killough 3/15/98: don't jump over dropoffs: try_ok = true;
if (try_ok) try_ok = P_TryMove (actor, DVector2(tryx, tryy), dropoff, NULL, tm); for (int i = 1; i <= steps; i++)
{
DVector2 ptry = start + move * i / steps;
// killough 3/15/98: don't jump over dropoffs:
try_ok = P_TryMove(actor, ptry, dropoff, NULL, tm);
if (!try_ok) break;
// Handle portal transitions just like P_XYMovement.
if (steps > 1 && actor->Pos().XY() != ptry)
{
DAngle anglediff = deltaangle(oldangle, actor->Angles.Yaw);
if (anglediff != 0)
{
move = move.Rotated(anglediff);
oldangle = actor->Angles.Yaw;
}
start = actor->Pos() - move * i / steps;
}
}
// [GrafZahl] Interpolating monster movement as it is done here just looks bad // [GrafZahl] Interpolating monster movement as it is done here just looks bad
// so make it switchable // so make it switchable