mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 00:21:35 +00:00
- 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:
parent
efaa26959e
commit
1c3de33585
3 changed files with 24 additions and 4 deletions
|
@ -1,6 +1,8 @@
|
|||
October 26, 2009
|
||||
- Changes to both A_MonsterRail() and A_CustomRailgun(): Save actor's pitch,
|
||||
use a larger aiming range, and ignore non-targets in P_AimLineAttack().
|
||||
use a larger aiming range, ignore non-targets in P_AimLineAttack(), and
|
||||
aim at the target anyway even if P_AimLineAttack() decides it has no
|
||||
chance of hitting.
|
||||
- Added another parameter to P_AimLineAttack(): A target to be aimed at. If
|
||||
this is non-NULL, then all actors between the shooter and the target will
|
||||
be ignored.
|
||||
|
|
|
@ -2704,6 +2704,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
|
|||
return;
|
||||
|
||||
fixed_t saved_pitch = self->pitch;
|
||||
AActor *linetarget;
|
||||
|
||||
// [RH] Andy Baker's stealth monsters
|
||||
if (self->flags & MF_STEALTH)
|
||||
|
@ -2718,7 +2719,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
|
|||
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, self->target);
|
||||
if (linetarget == NULL)
|
||||
{
|
||||
// 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
|
||||
self->angle = R_PointToAngle2 (self->x,
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue