From d2795e2def052e6688a44c7a65d8ddc093b88dae Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Sep 2022 17:58:11 +0200 Subject: [PATCH] - use proper angle math to calculate a delta --- source/games/exhumed/src/gun.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index e932bfab1..5ab3620cb 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -791,9 +791,9 @@ loc_flag: DExhumedActor* t = sPlayerInput[nPlayer].pTarget; // only autoaim if target is in front of the player. assert(t->sector()); - int angletotarget = VecToAngle(t->int_pos().X - pPlayerActor->int_pos().X, t->int_pos().Y - pPlayerActor->int_pos().Y).Buildang(); - int anglediff = (pPlayerActor->int_ang() - angletotarget) & 2047; - if (anglediff < 512 || anglediff > 1536) + DAngle angletotarget = VecToAngle(t->spr.pos - pPlayerActor->spr.pos); + DAngle anglediff = absangle(pPlayerActor->spr.angle, angletotarget); + if (anglediff < DAngle90) { target = t; h = 0;