- refactoring of R_PointToAngle2 when used to calculate direction between two actors.

This commit is contained in:
Christoph Oelckers 2016-01-10 20:46:26 +01:00
commit 2c0f64cf9f
31 changed files with 92 additions and 115 deletions

View file

@ -276,7 +276,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM);
// turn to face target
angle = R_PointToAngle2 (self->x, self->y, linetarget->x, linetarget->y);
angle = self->AngleTo(linetarget);
if (angle - self->angle > ANG180)
{
if (angle - self->angle < (angle_t)(-ANG90/20))
@ -326,7 +326,8 @@ static void MarinePunch(AActor *self, int damagemul)
if (linetarget)
{
S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM);
self->angle = R_PointToAngle2 (self->x, self->y, linetarget->x, linetarget->y);
self->angle = self->AngleTo(linetarget);
}
}