mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- Added flag ALF_NOFRIENDS and a friend-basis pointer to P_AimLineAttack().
A_DeathBallImpact uses these to avoid aiming at friends when the death ball bounces. (The pointer is needed because the missile itself does the aiming, not the player that shot it, and missiles are nobody's friends.) SVN r3315 (trunk)
This commit is contained in:
parent
f00f5d2304
commit
48c7423fbf
3 changed files with 16 additions and 8 deletions
|
@ -657,7 +657,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
|
|||
angle = 0;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
P_AimLineAttack (self, angle, 10*64*FRACUNIT, &linetarget);
|
||||
P_AimLineAttack (self, angle, 10*64*FRACUNIT, &linetarget, 0, ALF_NOFRIENDS, NULL, self->target);
|
||||
if (linetarget && self->target != linetarget)
|
||||
{
|
||||
self->tracer = linetarget;
|
||||
|
@ -1277,6 +1277,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
|
|||
AActor *mo;
|
||||
angle_t angle;
|
||||
fixed_t x, y, z;
|
||||
|
||||
fixed_t slope;
|
||||
FSoundID soundid;
|
||||
player_t *player;
|
||||
|
|
|
@ -410,7 +410,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, int flags = 0, AActor *target=NULL);
|
||||
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget = NULL, fixed_t vrange=0, int flags = 0, AActor *target=NULL, AActor *friender=NULL);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -418,6 +418,7 @@ enum
|
|||
ALF_CHECK3D = 2,
|
||||
ALF_CHECKNONSHOOTABLE = 4,
|
||||
ALF_CHECKCONVERSATION = 8,
|
||||
ALF_NOFRIENDS = 16,
|
||||
};
|
||||
|
||||
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, const PClass *pufftype, bool ismelee = false, AActor **victim = NULL);
|
||||
|
|
|
@ -330,7 +330,7 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
|
|||
FBlockLinesIterator it(box);
|
||||
line_t *ld;
|
||||
|
||||
// P_LineOpening requires the thing's z to be the destination ín order to work.
|
||||
// P_LineOpening requires the thing's z to be the destination ú‹ order to work.
|
||||
fixed_t savedz = thing->z;
|
||||
thing->z = z;
|
||||
while ((ld = it.Next()))
|
||||
|
@ -2848,6 +2848,7 @@ struct aim_t
|
|||
fixed_t attackrange;
|
||||
fixed_t shootz; // Height if not aiming up or down
|
||||
AActor* shootthing;
|
||||
AActor* friender; // actor to check friendliness again
|
||||
|
||||
fixed_t toppitch, bottompitch;
|
||||
AActor * linetarget;
|
||||
|
@ -3147,11 +3148,15 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
|
|||
}
|
||||
}
|
||||
|
||||
if (sv_smartaim != 0 && !(flags & ALF_FORCENOSMART))
|
||||
if ((flags & ALF_NOFRIENDS) && th->IsFriend(friender))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (sv_smartaim != 0 && !(flags & ALF_FORCENOSMART))
|
||||
{
|
||||
// try to be a little smarter about what to aim at!
|
||||
// In particular avoid autoaiming at friends amd barrels.
|
||||
if (th->IsFriend(shootthing))
|
||||
// In particular avoid autoaiming at friends and barrels.
|
||||
if (th->IsFriend(friender))
|
||||
{
|
||||
if (sv_smartaim < 2)
|
||||
{
|
||||
|
@ -3160,7 +3165,7 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
|
|||
pitch_friend = thingpitch;
|
||||
}
|
||||
}
|
||||
else if (!(th->flags3&MF3_ISMONSTER) && th->player == NULL)
|
||||
else if (!(th->flags3 & MF3_ISMONSTER) && th->player == NULL)
|
||||
{
|
||||
if (sv_smartaim < 3)
|
||||
{
|
||||
|
@ -3192,7 +3197,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,
|
||||
int flags, AActor *target)
|
||||
int flags, AActor *target, AActor *friender)
|
||||
{
|
||||
fixed_t x2;
|
||||
fixed_t y2;
|
||||
|
@ -3201,6 +3206,7 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
|
|||
angle >>= ANGLETOFINESHIFT;
|
||||
aim.flags = flags;
|
||||
aim.shootthing = t1;
|
||||
aim.friender = (friender == NULL) ? t1 : friender;
|
||||
|
||||
x2 = t1->x + (distance>>FRACBITS)*finecosine[angle];
|
||||
y2 = t1->y + (distance>>FRACBITS)*finesine[angle];
|
||||
|
|
Loading…
Reference in a new issue