mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
- 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:
parent
cdfd671dff
commit
c116453158
1 changed files with 13 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue