- When doing kickback in P_DamageMobj(), choose a random direction if the target and origin are in the exact same spot.

SVN r4069 (trunk)
This commit is contained in:
Randy Heit 2013-02-07 21:02:26 +00:00
parent cdfd671dff
commit c116453158

View file

@ -66,6 +66,7 @@ static FRandom pr_damagemobj ("ActorTakeDamage");
static FRandom pr_lightning ("LightningDamage");
static FRandom pr_poison ("PoisonDamage");
static FRandom pr_switcher ("SwitchTarget");
static FRandom pr_kickbackdir ("KickbackDir");
CVAR (Bool, cl_showsprees, true, CVAR_ARCHIVE)
CVAR (Bool, cl_showmultikills, true, CVAR_ARCHIVE)
@ -1073,9 +1074,18 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
if (kickback)
{
AActor *origin = (source && (flags & DMG_INFLICTOR_IS_PUFF))? source : inflictor;
ang = R_PointToAngle2 (origin->x, origin->y,
target->x, target->y);
// If the origin and target are in exactly the same spot, choose a random direction.
// (Most likely cause is from telefragging somebody during spawning because they
// haven't moved from their spawn spot at all.)
if (origin->x == target->x && origin->y == target->y)
{
ang = pr_kickbackdir.GenRand32();
}
else
{
ang = R_PointToAngle2 (origin->x, origin->y, target->x, target->y);
}
// Calculate this as float to avoid overflows so that the
// clamping that had to be done here can be removed.