mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- added A_FaceTracer/A_FaceMaster submission.
SVN r3161 (trunk)
This commit is contained in:
parent
4eaa7b1aaf
commit
b8f4592ad5
2 changed files with 45 additions and 10 deletions
|
@ -2705,11 +2705,13 @@ void A_Chase(AActor *self)
|
|||
//=============================================================================
|
||||
//
|
||||
// A_FaceTarget
|
||||
// A_FaceMaster
|
||||
// A_FaceTracer
|
||||
//
|
||||
//=============================================================================
|
||||
void A_FaceTarget (AActor *self, angle_t max_turn)
|
||||
void A_Face (AActor *self, AActor *other, angle_t max_turn)
|
||||
{
|
||||
if (!self->target)
|
||||
if (!other)
|
||||
return;
|
||||
|
||||
// [RH] Andy Baker's stealth monsters
|
||||
|
@ -2720,15 +2722,15 @@ void A_FaceTarget (AActor *self, angle_t max_turn)
|
|||
|
||||
self->flags &= ~MF_AMBUSH;
|
||||
|
||||
angle_t target_angle = R_PointToAngle2 (self->x, self->y, self->target->x, self->target->y);
|
||||
angle_t other_angle = R_PointToAngle2 (self->x, self->y, other->x, other->y);
|
||||
|
||||
// 0 means no limit. Also, if we turn in a single step anyways, no need to go through the algorithms.
|
||||
// It also means that there is no need to check for going past the target.
|
||||
if (max_turn && (max_turn < (angle_t)abs(self->angle - target_angle)))
|
||||
// It also means that there is no need to check for going past the other.
|
||||
if (max_turn && (max_turn < (angle_t)abs(self->angle - other_angle)))
|
||||
{
|
||||
if (self->angle > target_angle)
|
||||
if (self->angle > other_angle)
|
||||
{
|
||||
if (self->angle - target_angle < ANGLE_180)
|
||||
if (self->angle - other_angle < ANGLE_180)
|
||||
{
|
||||
self->angle -= max_turn;
|
||||
}
|
||||
|
@ -2739,7 +2741,7 @@ void A_FaceTarget (AActor *self, angle_t max_turn)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (target_angle - self->angle < ANGLE_180)
|
||||
if (other_angle - self->angle < ANGLE_180)
|
||||
{
|
||||
self->angle += max_turn;
|
||||
}
|
||||
|
@ -2751,16 +2753,31 @@ void A_FaceTarget (AActor *self, angle_t max_turn)
|
|||
}
|
||||
else
|
||||
{
|
||||
self->angle = target_angle;
|
||||
self->angle = other_angle;
|
||||
}
|
||||
|
||||
// This will never work well if the turn angle is limited.
|
||||
if (max_turn == 0 && (self->angle == target_angle) && self->target->flags & MF_SHADOW)
|
||||
if (max_turn == 0 && (self->angle == other_angle) && other->flags & MF_SHADOW)
|
||||
{
|
||||
self->angle += pr_facetarget.Random2() << 21;
|
||||
}
|
||||
}
|
||||
|
||||
void A_FaceTarget (AActor *self, angle_t max_turn)
|
||||
{
|
||||
A_Face(self, self->target, max_turn);
|
||||
}
|
||||
|
||||
void A_FaceMaster (AActor *self, angle_t max_turn)
|
||||
{
|
||||
A_Face(self, self->master, max_turn);
|
||||
}
|
||||
|
||||
void A_FaceTracer (AActor *self, angle_t max_turn)
|
||||
{
|
||||
A_Face(self, self->tracer, max_turn);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTarget)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
|
@ -2769,6 +2786,22 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTarget)
|
|||
A_FaceTarget(self, max_turn);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMaster)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_ANGLE(max_turn, 0);
|
||||
|
||||
A_FaceMaster(self, max_turn);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTracer)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_ANGLE(max_turn, 0);
|
||||
|
||||
A_FaceTracer(self, max_turn);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// [RH] A_MonsterRail
|
||||
|
|
|
@ -66,6 +66,8 @@ ACTOR Actor native //: Thinker
|
|||
action native A_Look();
|
||||
action native A_Chase(state melee = "*", state missile = "none", int flags = 0);
|
||||
action native A_FaceTarget(float max_turn = 0);
|
||||
action native A_FaceTracer(float max_turn = 0);
|
||||
action native A_FaceMaster(float max_turn = 0);
|
||||
action native A_PosAttack();
|
||||
action native A_Scream();
|
||||
action native A_SPosAttack();
|
||||
|
|
Loading…
Reference in a new issue