- some refactoring of P_AproxDistance calls into newly defined AActor method AproxDistance.

The main reason here is to reduce the number of instances where AActor::x and AActor::y are being referenced.
This commit is contained in:
Christoph Oelckers 2016-01-10 17:52:41 +01:00
commit 1e2ce9a622
25 changed files with 1293 additions and 1286 deletions

View file

@ -59,22 +59,16 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
angle = actor->angle>>ANGLETOFINESHIFT;
actor->velx = FixedMul (actor->Speed, finecosine[angle]);
actor->vely = FixedMul (actor->Speed, finesine[angle]);
dist = actor->AproxDistance (target) / actor->Speed;
if (actor->z+actor->height < target->z ||
target->z+target->height < actor->z)
{
dist = P_AproxDistance(target->x-actor->x, target->y-actor->y);
dist = dist/actor->Speed;
if (dist < 1)
{
dist = 1;
}
actor->velz = (target->z - actor->z)/dist;
}
else
{
dist = P_AproxDistance (target->x-actor->x, target->y-actor->y);
dist = dist/actor->Speed;
}
if (target->flags&MF_SHOOTABLE && pr_dragonseek() < 64)
{ // attack the destination mobj if it's attackable
AActor *oldTarget;