- fixed: A_Face* mixed angle and distance values in the same parameter. Fixed by separating these into two.

- removed the intermediate A_Face* functions, except a bare-bones A_FaceTarget as needed by the monster AI code.
This commit is contained in:
Christoph Oelckers 2016-01-28 20:44:10 +01:00
parent 6eb83e99be
commit c5161ee748
2 changed files with 17 additions and 24 deletions

View file

@ -2724,9 +2724,9 @@ enum FAF_Flags
FAF_BOTTOM = 1,
FAF_MIDDLE = 2,
FAF_TOP = 4,
FAF_NODISTFACTOR = 8,
FAF_NODISTFACTOR = 8, // deprecated
};
void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags)
void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags, fixed_t z_add)
{
if (!other)
return;
@ -2799,8 +2799,8 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
target_z = other->Z() + (other->height / 2) + other->GetBobOffset();
if (flags & FAF_TOP)
target_z = other->Z() + (other->height) + other->GetBobOffset();
if (!(flags & FAF_NODISTFACTOR))
target_z += pitch_offset;
target_z += z_add;
double dist_z = target_z - source_z;
double ddist = sqrt(dist.X*dist.X + dist.Y*dist.Y + dist_z*dist_z);
@ -2836,55 +2836,48 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
}
}
void A_FaceTarget(AActor *self, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags)
void A_FaceTarget(AActor *self)
{
A_Face(self, self->target, max_turn, max_pitch, ang_offset, pitch_offset, flags);
}
void A_FaceMaster(AActor *self, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags)
{
A_Face(self, self->master, max_turn, max_pitch, ang_offset, pitch_offset, flags);
}
void A_FaceTracer(AActor *self, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags)
{
A_Face(self, self->tracer, max_turn, max_pitch, ang_offset, pitch_offset, flags);
A_Face(self, self->target);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTarget)
{
ACTION_PARAM_START(5);
ACTION_PARAM_START(6);
ACTION_PARAM_ANGLE(max_turn, 0);
ACTION_PARAM_ANGLE(max_pitch, 1);
ACTION_PARAM_ANGLE(ang_offset, 2);
ACTION_PARAM_ANGLE(pitch_offset, 3);
ACTION_PARAM_INT(flags, 4);
ACTION_PARAM_FIXED(z_add, 5);
A_FaceTarget(self, max_turn, max_pitch, ang_offset, pitch_offset, flags);
A_Face(self, self->target, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_add);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMaster)
{
ACTION_PARAM_START(5);
ACTION_PARAM_START(6);
ACTION_PARAM_ANGLE(max_turn, 0);
ACTION_PARAM_ANGLE(max_pitch, 1);
ACTION_PARAM_ANGLE(ang_offset, 2);
ACTION_PARAM_ANGLE(pitch_offset, 3);
ACTION_PARAM_INT(flags, 4);
ACTION_PARAM_FIXED(z_add, 5);
A_FaceMaster(self, max_turn, max_pitch, ang_offset, pitch_offset, flags);
A_Face(self, self->master, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_add);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTracer)
{
ACTION_PARAM_START(5);
ACTION_PARAM_START(6);
ACTION_PARAM_ANGLE(max_turn, 0);
ACTION_PARAM_ANGLE(max_pitch, 1);
ACTION_PARAM_ANGLE(ang_offset, 2);
ACTION_PARAM_ANGLE(pitch_offset, 3);
ACTION_PARAM_INT(flags, 4);
ACTION_PARAM_FIXED(z_add, 5);
A_FaceTracer(self, max_turn, max_pitch, ang_offset, pitch_offset, flags);
A_Face(self, self->tracer, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_add);
}
//===========================================================================

View file

@ -72,8 +72,8 @@ DECLARE_ACTION(A_FreezeDeathChunks)
DECLARE_ACTION(A_BossDeath)
void A_Chase(AActor *self);
void A_FaceTarget(AActor *actor, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270, angle_t ang_offset = 0, angle_t pitch_offset = 0, int flags = 0);
void A_Face(AActor *self, AActor *other, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270, angle_t ang_offset = 0, angle_t pitch_offset = 0, int flags = 0);
void A_FaceTarget(AActor *actor);
void A_Face(AActor *self, AActor *other, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270, angle_t ang_offset = 0, angle_t pitch_offset = 0, int flags = 0, fixed_t pitch_add = 0);
bool A_RaiseMobj (AActor *, fixed_t speed);
bool A_SinkMobj (AActor *, fixed_t speed);