- Use a missile's MaxTargetRange property as the range for P_AimLineAttack() inside P_SpawnPlayerMissile().

SVN r4189 (trunk)
This commit is contained in:
Randy Heit 2013-03-20 03:19:02 +00:00
parent 277d59b2bb
commit fc4b0ffe68

View file

@ -5619,11 +5619,11 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
bool nofreeaim)
{
static const int angdiff[3] = { -1<<26, 1<<26, 0 };
int i;
angle_t an = angle;
angle_t pitch;
AActor *linetarget;
int vrange = nofreeaim? ANGLE_1*35 : 0;
AActor *defaultobject = GetDefaultByType(type);
int vrange = nofreeaim ? ANGLE_1*35 : 0;
if (source && source->player && source->player->ReadyWeapon && (source->player->ReadyWeapon->WeaponFlags & WIF_NOAUTOAIM))
{
@ -5634,11 +5634,16 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
}
else // see which target is to be aimed at
{
i = 2;
// [XA] If MaxTargetRange is defined in the spawned projectile, use this as the
// maximum range for the P_AimLineAttack call later; this allows MaxTargetRange
// to function as a "maximum tracer-acquisition range" for seeker missiles.
fixed_t linetargetrange = defaultobject->maxtargetrange > 0 ? defaultobject->maxtargetrange*64 : 16*64*FRACUNIT;
int i = 2;
do
{
an = angle + angdiff[i];
pitch = P_AimLineAttack (source, an, 16*64*FRACUNIT, &linetarget, vrange);
pitch = P_AimLineAttack (source, an, linetargetrange, &linetarget, vrange);
if (source->player != NULL &&
!nofreeaim &&
@ -5660,8 +5665,6 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
}
if (pLineTarget) *pLineTarget = linetarget;
i = GetDefaultByType (type)->flags3;
if (z != ONFLOORZ && z != ONCEILINGZ)
{
// Doom spawns missiles 4 units lower than hitscan attacks for players.