- Fixed: A_Face() should use other instead of self->target when calculating pitch.

SVN r4267 (trunk)
This commit is contained in:
Randy Heit 2013-05-17 00:49:45 +00:00
parent 6922049b83
commit 5b74e1acba

View file

@ -2790,16 +2790,16 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch)
{ {
// [DH] Don't need to do proper fixed->double conversion, since the // [DH] Don't need to do proper fixed->double conversion, since the
// result is only used in a ratio. // result is only used in a ratio.
double dist_x = self->target->x - self->x; double dist_x = other->x - self->x;
double dist_y = self->target->y - self->y; double dist_y = other->y - self->y;
// Positioning ala missile spawning, 32 units above foot level // Positioning ala missile spawning, 32 units above foot level
fixed_t source_z = self->z + 32*FRACUNIT + self->GetBobOffset(); fixed_t source_z = self->z + 32*FRACUNIT + self->GetBobOffset();
fixed_t target_z = self->target->z + 32*FRACUNIT + self->target->GetBobOffset(); fixed_t target_z = other->z + 32*FRACUNIT + other->GetBobOffset();
// If the target z is above the target's head, reposition to the middle of // If the target z is above the target's head, reposition to the middle of
// its body. // its body.
if (target_z >= self->target->z + self->target->height) if (target_z >= other->z + other->height)
{ {
target_z = self->target->z + self->target->height / 2; target_z = other->z + other->height / 2;
} }
double dist_z = target_z - source_z; double dist_z = target_z - source_z;
double dist = sqrt(dist_x*dist_x + dist_y*dist_y + dist_z*dist_z); double dist = sqrt(dist_x*dist_x + dist_y*dist_y + dist_z*dist_z);