- Make A_MonsterRail() and A_CustomRailgun() aim at the target anyway even

if P_AimLineAttack() decides it has no chance of hitting.

SVN r1942 (trunk)
This commit is contained in:
Randy Heit 2009-10-27 04:16:55 +00:00
commit 1c3de33585
3 changed files with 24 additions and 4 deletions

View file

@ -1179,6 +1179,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
ACTION_PARAM_FLOAT(MaxDiff, 6);
ACTION_PARAM_CLASS(PuffType, 7);
AActor *linetarget;
fixed_t saved_x = self->x;
fixed_t saved_y = self->y;
angle_t saved_angle = self->angle;
@ -1204,8 +1206,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
self->target->x,
self->target->y);
}
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE, NULL, ANGLE_1*60, false, false, false, self->target);
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE, &linetarget, ANGLE_1*60, false, false, false, aim ? self->target : NULL);
if (linetarget == NULL && aim)
{
// We probably won't hit the target, but aim at it anyway so we don't look stupid.
FVector2 xydiff(self->target->x - self->x, self->target->y - self->y);
double zdiff = (self->target->z + (self->target->height>>1)) -
(self->z + (self->height>>1) - self->floorclip);
self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI);
}
// Let the aim trail behind the player
if (aim)
{