- Changes to both A_MonsterRail() and A_CustomRailgun(): Save actor's pitch,

use a larger aiming range, and ignore non-targets in P_AimLineAttack().
- 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.


SVN r1941 (trunk)
This commit is contained in:
Randy Heit 2009-10-27 03:59:29 +00:00
parent 750659a82e
commit efaa26959e
5 changed files with 36 additions and 25 deletions

View File

@ -1,4 +1,9 @@
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().
- 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.
- Added new sound sequence ACS functions:
SoundSequenceOnActor(int tid, string seqname);
SoundSequenceOnSector(int tag, string seqname, int location);

View File

@ -2703,6 +2703,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
if (!self->target)
return;
fixed_t saved_pitch = self->pitch;
// [RH] Andy Baker's stealth monsters
if (self->flags & MF_STEALTH)
{
@ -2716,7 +2718,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
self->target->x,
self->target->y);
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE, NULL, ANGLE_1*60, false, false, false, self->target);
// Let the aim trail behind the player
self->angle = R_PointToAngle2 (self->x,
@ -2730,6 +2732,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
}
P_RailAttack (self, self->GetMissileDamage (0, 1), 0);
self->pitch = saved_pitch;
}
DEFINE_ACTION_FUNCTION(AActor, A_Scream)

View File

@ -394,7 +394,7 @@ void P_FindFloorCeiling (AActor *actor, bool onlymidtex = false);
bool P_ChangeSector (sector_t* sector, int crunch, int amt, int floorOrCeil, bool isreset);
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget = NULL, fixed_t vrange=0, bool forcenosmart=false, bool check3d = false, bool checknonshootable = false);
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget = NULL, fixed_t vrange=0, bool forcenosmart=false, bool check3d = false, bool checknonshootable = false, AActor *target=NULL);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, const PClass *pufftype, bool ismelee = false);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, FName pufftype, bool ismelee = false);
void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch);

View File

@ -2801,7 +2801,7 @@ struct aim_t
bool AimTraverse3DFloors(const divline_t &trace, intercept_t * in);
#endif
void AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, bool checknonshootable = false);
void AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, bool checknonshootable = false, AActor *target=NULL);
};
@ -2918,7 +2918,7 @@ bool aim_t::AimTraverse3DFloors(const divline_t &trace, intercept_t * in)
//
//============================================================================
void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, bool checknonshootable)
void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, bool checknonshootable, AActor *target)
{
FPathTraverse it(startx, starty, endx, endy, PT_ADDLINES|PT_ADDTHINGS);
intercept_t *in;
@ -2973,6 +2973,9 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
if (th == shootthing)
continue; // can't shoot self
if (target != NULL && th != target)
continue; // only care about target, and you're not it
if (!checknonshootable) // For info CCMD, ignore stuff about GHOST and SHOOTABLE flags
{
if (!(th->flags&MF_SHOOTABLE))
@ -3084,8 +3087,8 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
if (sv_smartaim < 2)
{
// friends don't aim at friends (except players), at least not first
thing_friend=th;
pitch_friend=thingpitch;
thing_friend = th;
pitch_friend = thingpitch;
}
}
else if (!(th->flags3&MF3_ISMONSTER) && th->player == NULL)
@ -3093,27 +3096,27 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
if (sv_smartaim < 3)
{
// don't autoaim at barrels and other shootable stuff unless no monsters have been found
thing_other=th;
pitch_other=thingpitch;
thing_other = th;
pitch_other = thingpitch;
}
}
else
{
linetarget=th;
aimpitch=thingpitch;
linetarget = th;
aimpitch = thingpitch;
return;
}
}
else
{
linetarget=th;
aimpitch=thingpitch;
linetarget = th;
aimpitch = thingpitch;
return;
}
if (checknonshootable)
{
linetarget=th;
aimpitch=thingpitch;
linetarget = th;
aimpitch = thingpitch;
}
}
}
@ -3124,7 +3127,7 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
//
//============================================================================
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange, bool forcenosmart, bool check3d, bool checknonshootable)
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange, bool forcenosmart, bool check3d, bool checknonshootable, AActor *target)
{
fixed_t x2;
fixed_t y2;
@ -3193,22 +3196,23 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
}
#endif
aim.AimTraverse (t1->x, t1->y, x2, y2, checknonshootable);
aim.AimTraverse (t1->x, t1->y, x2, y2, checknonshootable, target);
if (!aim.linetarget)
{
if (aim.thing_other)
{
aim.linetarget=aim.thing_other;
aim.aimpitch=aim.pitch_other;
aim.linetarget = aim.thing_other;
aim.aimpitch = aim.pitch_other;
}
else if (aim.thing_friend)
{
aim.linetarget=aim.thing_friend;
aim.aimpitch=aim.pitch_friend;
aim.linetarget = aim.thing_friend;
aim.aimpitch = aim.pitch_friend;
}
}
if (pLineTarget) *pLineTarget = aim.linetarget;
if (pLineTarget)
*pLineTarget = aim.linetarget;
return aim.linetarget ? aim.aimpitch : t1->pitch;
}

View File

@ -1182,6 +1182,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
fixed_t saved_x = self->x;
fixed_t saved_y = self->y;
angle_t saved_angle = self->angle;
fixed_t saved_pitch = self->pitch;
if (aim && self->target == NULL)
{
@ -1198,15 +1199,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
if (aim)
{
self->angle = R_PointToAngle2 (self->x,
self->y,
self->target->x,
self->target->y);
}
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE, NULL, ANGLE_1*60, false, false, false, self->target);
// Let the aim trail behind the player
if (aim)
@ -1242,6 +1240,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
self->x = saved_x;
self->y = saved_y;
self->angle = saved_angle;
self->pitch = saved_pitch;
}
//===========================================================================