mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- made the recent change to P_SeekerMissile an option because it affected critical gameplay behavior and may not be used for existing actors.
SVN r2278 (trunk)
This commit is contained in:
parent
a5e422020e
commit
d916127ecf
4 changed files with 47 additions and 19 deletions
|
@ -94,7 +94,7 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer=false);
|
||||||
|
|
||||||
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
|
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
|
||||||
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta);
|
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta);
|
||||||
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax);
|
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise = false);
|
||||||
|
|
||||||
enum EPuffFlags
|
enum EPuffFlags
|
||||||
{
|
{
|
||||||
|
|
|
@ -1543,11 +1543,12 @@ bool AActor::CanSeek(AActor *target) const
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
|
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise)
|
||||||
{
|
{
|
||||||
int dir;
|
int dir;
|
||||||
|
int dist;
|
||||||
angle_t delta;
|
angle_t delta;
|
||||||
angle_t angle, pitch;
|
angle_t angle;
|
||||||
AActor *target;
|
AActor *target;
|
||||||
|
|
||||||
target = actor->tracer;
|
target = actor->tracer;
|
||||||
|
@ -1577,9 +1578,31 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
|
||||||
{ // Turn counter clockwise
|
{ // Turn counter clockwise
|
||||||
actor->angle -= delta;
|
actor->angle -= delta;
|
||||||
}
|
}
|
||||||
angle = actor->angle >> ANGLETOFINESHIFT;
|
angle = actor->angle>>ANGLETOFINESHIFT;
|
||||||
pitch = 0;
|
|
||||||
|
|
||||||
|
if (!precise)
|
||||||
|
{
|
||||||
|
actor->velx = FixedMul (actor->Speed, finecosine[angle]);
|
||||||
|
actor->vely = FixedMul (actor->Speed, finesine[angle]);
|
||||||
|
|
||||||
|
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
|
||||||
|
{
|
||||||
|
if (actor->z + actor->height < target->z ||
|
||||||
|
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;
|
||||||
|
if (dist < 1)
|
||||||
|
{
|
||||||
|
dist = 1;
|
||||||
|
}
|
||||||
|
actor->velz = ((target->z+target->height/2) - (actor->z+actor->height/2)) / dist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
angle_t pitch;
|
||||||
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
|
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
|
||||||
{ // Need to seek vertically
|
{ // Need to seek vertically
|
||||||
double dist = MAX(1.0, FVector2(target->x - actor->x, target->y - actor->y).Length());
|
double dist = MAX(1.0, FVector2(target->x - actor->x, target->y - actor->y).Length());
|
||||||
|
@ -1597,10 +1620,13 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
|
||||||
actor->velz = FixedMul(actor->Speed, finesine[pitch]);
|
actor->velz = FixedMul(actor->Speed, finesine[pitch]);
|
||||||
actor->velx = FixedMul(xyscale, finecosine[angle]);
|
actor->velx = FixedMul(xyscale, finecosine[angle]);
|
||||||
actor->vely = FixedMul(xyscale, finesine[angle]);
|
actor->vely = FixedMul(xyscale, finesine[angle]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_XYMovement
|
// P_XYMovement
|
||||||
//
|
//
|
||||||
|
|
|
@ -346,6 +346,7 @@ static FRandom pr_seekermissile ("SeekerMissile");
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SMF_LOOK = 1,
|
SMF_LOOK = 1,
|
||||||
|
SMF_PRECISE = 2,
|
||||||
};
|
};
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile)
|
||||||
{
|
{
|
||||||
|
@ -360,7 +361,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile)
|
||||||
{
|
{
|
||||||
self->tracer = P_RoughMonsterSearch (self, distance);
|
self->tracer = P_RoughMonsterSearch (self, distance);
|
||||||
}
|
}
|
||||||
P_SeekerMissile(self, clamp<int>(ang1, 0, 90) * ANGLE_1, clamp<int>(ang2, 0, 90) * ANGLE_1);
|
P_SeekerMissile(self, clamp<int>(ang1, 0, 90) * ANGLE_1, clamp<int>(ang2, 0, 90) * ANGLE_1, !!(flags & SMF_PRECISE));
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -79,6 +79,7 @@ const int BF_AFFECTBOSSES = 4;
|
||||||
|
|
||||||
// Flags for A_SeekerMissile
|
// Flags for A_SeekerMissile
|
||||||
const int SMF_LOOK = 1;
|
const int SMF_LOOK = 1;
|
||||||
|
const int SMF_PRECISE = 2;
|
||||||
|
|
||||||
// Activation flags
|
// Activation flags
|
||||||
enum
|
enum
|
||||||
|
|
Loading…
Reference in a new issue