mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- use proper angle math to calculate a delta
This commit is contained in:
parent
8f94b337ac
commit
d2795e2def
1 changed files with 3 additions and 3 deletions
|
@ -791,9 +791,9 @@ loc_flag:
|
||||||
DExhumedActor* t = sPlayerInput[nPlayer].pTarget;
|
DExhumedActor* t = sPlayerInput[nPlayer].pTarget;
|
||||||
// only autoaim if target is in front of the player.
|
// only autoaim if target is in front of the player.
|
||||||
assert(t->sector());
|
assert(t->sector());
|
||||||
int angletotarget = VecToAngle(t->int_pos().X - pPlayerActor->int_pos().X, t->int_pos().Y - pPlayerActor->int_pos().Y).Buildang();
|
DAngle angletotarget = VecToAngle(t->spr.pos - pPlayerActor->spr.pos);
|
||||||
int anglediff = (pPlayerActor->int_ang() - angletotarget) & 2047;
|
DAngle anglediff = absangle(pPlayerActor->spr.angle, angletotarget);
|
||||||
if (anglediff < 512 || anglediff > 1536)
|
if (anglediff < DAngle90)
|
||||||
{
|
{
|
||||||
target = t;
|
target = t;
|
||||||
h = 0;
|
h = 0;
|
||||||
|
|
Loading…
Reference in a new issue