- 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
|
|
@ -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 dist;
|
||||
angle_t delta;
|
||||
angle_t angle, pitch;
|
||||
angle_t angle;
|
||||
AActor *target;
|
||||
|
||||
target = actor->tracer;
|
||||
|
|
@ -1577,30 +1578,55 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
|
|||
{ // Turn counter clockwise
|
||||
actor->angle -= delta;
|
||||
}
|
||||
angle = actor->angle >> ANGLETOFINESHIFT;
|
||||
pitch = 0;
|
||||
angle = actor->angle>>ANGLETOFINESHIFT;
|
||||
|
||||
if (!precise)
|
||||
{
|
||||
actor->velx = FixedMul (actor->Speed, finecosine[angle]);
|
||||
actor->vely = FixedMul (actor->Speed, finesine[angle]);
|
||||
|
||||
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
|
||||
{ // Need to seek vertically
|
||||
double dist = MAX(1.0, FVector2(target->x - actor->x, target->y - actor->y).Length());
|
||||
// Aim at a player's eyes and at the middle of the actor for everything else.
|
||||
fixed_t aimheight = target->height/2;
|
||||
if (target->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
|
||||
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
|
||||
{
|
||||
aimheight = static_cast<APlayerPawn *>(target)->ViewHeight;
|
||||
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;
|
||||
}
|
||||
}
|
||||
pitch = R_PointToAngle2(0, actor->z + actor->height/2, xs_CRoundToInt(dist), target->z + aimheight);
|
||||
pitch >>= ANGLETOFINESHIFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle_t pitch;
|
||||
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
|
||||
{ // Need to seek vertically
|
||||
double dist = MAX(1.0, FVector2(target->x - actor->x, target->y - actor->y).Length());
|
||||
// Aim at a player's eyes and at the middle of the actor for everything else.
|
||||
fixed_t aimheight = target->height/2;
|
||||
if (target->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
|
||||
{
|
||||
aimheight = static_cast<APlayerPawn *>(target)->ViewHeight;
|
||||
}
|
||||
pitch = R_PointToAngle2(0, actor->z + actor->height/2, xs_CRoundToInt(dist), target->z + aimheight);
|
||||
pitch >>= ANGLETOFINESHIFT;
|
||||
}
|
||||
|
||||
fixed_t xyscale = FixedMul(actor->Speed, finecosine[pitch]);
|
||||
actor->velz = FixedMul(actor->Speed, finesine[pitch]);
|
||||
actor->velx = FixedMul(xyscale, finecosine[angle]);
|
||||
actor->vely = FixedMul(xyscale, finesine[angle]);
|
||||
}
|
||||
|
||||
fixed_t xyscale = FixedMul(actor->Speed, finecosine[pitch]);
|
||||
actor->velz = FixedMul(actor->Speed, finesine[pitch]);
|
||||
actor->velx = FixedMul(xyscale, finecosine[angle]);
|
||||
actor->vely = FixedMul(xyscale, finesine[angle]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_XYMovement
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue