- When a missile teleports, maintain velocity on the other end.

SVN r3322 (trunk)
This commit is contained in:
Randy Heit 2011-11-28 00:10:04 +00:00
parent 7d348e7148
commit 0897a593c7

View file

@ -110,6 +110,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
sector_t *destsect; sector_t *destsect;
bool resetpitch = false; bool resetpitch = false;
fixed_t floorheight, ceilingheight; fixed_t floorheight, ceilingheight;
fixed_t missilespeed;
oldx = thing->x; oldx = thing->x;
oldy = thing->y; oldy = thing->y;
@ -122,6 +123,10 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
player = NULL; player = NULL;
floorheight = destsect->floorplane.ZatPoint (x, y); floorheight = destsect->floorplane.ZatPoint (x, y);
ceilingheight = destsect->ceilingplane.ZatPoint (x, y); ceilingheight = destsect->ceilingplane.ZatPoint (x, y);
if (thing->flags & MF_MISSILE)
{ // We don't measure z velocity, because it doesn't change.
missilespeed = xs_CRoundToInt(TVector2<double>(thing->velx, thing->vely).Length());
}
if (z == ONFLOORZ) if (z == ONFLOORZ)
{ {
if (player) if (player)
@ -206,8 +211,8 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
if (thing->flags & MF_MISSILE) if (thing->flags & MF_MISSILE)
{ {
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
thing->velx = FixedMul (thing->Speed, finecosine[angle]); thing->velx = FixedMul (missilespeed, finecosine[angle]);
thing->vely = FixedMul (thing->Speed, finesine[angle]); thing->vely = FixedMul (missilespeed, finesine[angle]);
} }
// [BC] && bHaltVelocity. // [BC] && bHaltVelocity.
else if (!keepOrientation && bHaltVelocity) // no fog doesn't alter the player's momentum else if (!keepOrientation && bHaltVelocity) // no fog doesn't alter the player's momentum