mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- Added SMF_CURSPEED flag for A_SeekerMissile to cause it to use the missile's current speed rather than its Speed property.
SVN r3318 (trunk)
This commit is contained in:
parent
04387a6924
commit
7d502e7789
4 changed files with 15 additions and 9 deletions
|
@ -97,7 +97,7 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer=false);
|
|||
|
||||
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
|
||||
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta);
|
||||
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise = false);
|
||||
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise = false, bool usecurspeed=false);
|
||||
|
||||
enum EPuffFlags
|
||||
{
|
||||
|
|
|
@ -1468,16 +1468,18 @@ bool AActor::CanSeek(AActor *target) const
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise)
|
||||
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise, bool usecurspeed)
|
||||
{
|
||||
int dir;
|
||||
int dist;
|
||||
angle_t delta;
|
||||
angle_t angle;
|
||||
AActor *target;
|
||||
fixed_t speed;
|
||||
|
||||
speed = !usecurspeed ? actor->Speed : xs_CRoundToInt(TVector3<double>(actor->velx, actor->vely, actor->velz).Length());
|
||||
target = actor->tracer;
|
||||
if (target == NULL || actor->Speed == 0 || !actor->CanSeek(target))
|
||||
if (target == NULL || speed == 0 || !actor->CanSeek(target))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1507,8 +1509,8 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci
|
|||
|
||||
if (!precise)
|
||||
{
|
||||
actor->velx = FixedMul (actor->Speed, finecosine[angle]);
|
||||
actor->vely = FixedMul (actor->Speed, finesine[angle]);
|
||||
actor->velx = FixedMul (speed, finecosine[angle]);
|
||||
actor->vely = FixedMul (speed, finesine[angle]);
|
||||
|
||||
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
|
||||
{
|
||||
|
@ -1516,7 +1518,7 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci
|
|||
target->z + target->height < actor->z)
|
||||
{ // Need to seek vertically
|
||||
dist = P_AproxDistance (target->x - actor->x, target->y - actor->y);
|
||||
dist = dist / actor->Speed;
|
||||
dist = dist / speed;
|
||||
if (dist < 1)
|
||||
{
|
||||
dist = 1;
|
||||
|
@ -1541,8 +1543,8 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci
|
|||
pitch >>= ANGLETOFINESHIFT;
|
||||
}
|
||||
|
||||
fixed_t xyscale = FixedMul(actor->Speed, finecosine[pitch]);
|
||||
actor->velz = FixedMul(actor->Speed, finesine[pitch]);
|
||||
fixed_t xyscale = FixedMul(speed, finecosine[pitch]);
|
||||
actor->velz = FixedMul(speed, finesine[pitch]);
|
||||
actor->velx = FixedMul(xyscale, finecosine[angle]);
|
||||
actor->vely = FixedMul(xyscale, finesine[angle]);
|
||||
}
|
||||
|
@ -1872,6 +1874,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
|||
}
|
||||
|
||||
|
||||
|
||||
// Reflect the missile along angle
|
||||
mo->angle = angle;
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
@ -2468,6 +2471,7 @@ void P_NightmareRespawn (AActor *mobj)
|
|||
|
||||
z = mo->z;
|
||||
|
||||
|
||||
// inherit attributes from deceased one
|
||||
mo->SpawnPoint[0] = mobj->SpawnPoint[0];
|
||||
mo->SpawnPoint[1] = mobj->SpawnPoint[1];
|
||||
|
|
|
@ -487,6 +487,7 @@ enum
|
|||
{
|
||||
SMF_LOOK = 1,
|
||||
SMF_PRECISE = 2,
|
||||
SMF_CURSPEED = 4,
|
||||
};
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile)
|
||||
{
|
||||
|
@ -501,7 +502,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile)
|
|||
{
|
||||
self->tracer = P_RoughMonsterSearch (self, distance);
|
||||
}
|
||||
P_SeekerMissile(self, clamp<int>(ang1, 0, 90) * ANGLE_1, clamp<int>(ang2, 0, 90) * ANGLE_1, !!(flags & SMF_PRECISE));
|
||||
P_SeekerMissile(self, clamp<int>(ang1, 0, 90) * ANGLE_1, clamp<int>(ang2, 0, 90) * ANGLE_1, !!(flags & SMF_PRECISE), !!(flags & SMF_CURSPEED));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -124,6 +124,7 @@ const int BF_AFFECTBOSSES = 4;
|
|||
// Flags for A_SeekerMissile
|
||||
const int SMF_LOOK = 1;
|
||||
const int SMF_PRECISE = 2;
|
||||
const int SMF_CURSPEED = 4;
|
||||
|
||||
// Flags for A_CustomPunch
|
||||
const int CPF_USEAMMO = 1;
|
||||
|
|
Loading…
Reference in a new issue