mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-18 15:42:34 +00:00
- added DavidPH's A_AlertMonsters range submission.
SVN r3233 (trunk)
This commit is contained in:
parent
4a7567107f
commit
6ba0689b8d
6 changed files with 19 additions and 17 deletions
|
@ -137,15 +137,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_JabDagger)
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_AlertMonsters)
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_AlertMonsters)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_FIXED(maxdist, 0);
|
||||
|
||||
if (self->player != NULL)
|
||||
{
|
||||
P_NoiseAlert(self, self);
|
||||
P_NoiseAlert(self, self, false, maxdist);
|
||||
}
|
||||
else if (self->target != NULL && self->target->player != NULL)
|
||||
{
|
||||
P_NoiseAlert (self->target, self);
|
||||
P_NoiseAlert (self->target, self, false, maxdist);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -624,6 +627,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination)
|
|||
drop->flags |= MF_DROPPED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -115,7 +115,7 @@ void P_RandomChaseDir (AActor *actor);
|
|||
// sound blocking lines cut off traversal.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks)
|
||||
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter, fixed_t maxdist)
|
||||
{
|
||||
int i;
|
||||
line_t* check;
|
||||
|
@ -136,7 +136,8 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
|
|||
// [RH] Set this in the actors in the sector instead of the sector itself.
|
||||
for (actor = sec->thinglist; actor != NULL; actor = actor->snext)
|
||||
{
|
||||
if (actor != soundtarget && (!splash || !(actor->flags4 & MF4_NOSPLASHALERT)))
|
||||
if (actor != soundtarget && (!splash || !(actor->flags4 & MF4_NOSPLASHALERT)) &&
|
||||
(!maxdist || (P_AproxDistance(actor->x - emitter->x, actor->y - emitter->y) <= maxdist)))
|
||||
{
|
||||
actor->LastHeard = soundtarget;
|
||||
}
|
||||
|
@ -179,11 +180,11 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
|
|||
if (check->flags & ML_SOUNDBLOCK)
|
||||
{
|
||||
if (!soundblocks)
|
||||
P_RecursiveSound (other, soundtarget, splash, 1);
|
||||
P_RecursiveSound (other, soundtarget, splash, 1, emitter, maxdist);
|
||||
}
|
||||
else
|
||||
{
|
||||
P_RecursiveSound (other, soundtarget, splash, soundblocks);
|
||||
P_RecursiveSound (other, soundtarget, splash, soundblocks, emitter, maxdist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +200,7 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void P_NoiseAlert (AActor *target, AActor *emitter, bool splash)
|
||||
void P_NoiseAlert (AActor *target, AActor *emitter, bool splash, fixed_t maxdist)
|
||||
{
|
||||
if (emitter == NULL)
|
||||
return;
|
||||
|
@ -208,7 +209,7 @@ void P_NoiseAlert (AActor *target, AActor *emitter, bool splash)
|
|||
return;
|
||||
|
||||
validcount++;
|
||||
P_RecursiveSound (emitter->Sector, target, splash, 0);
|
||||
P_RecursiveSound (emitter->Sector, target, splash, 0, emitter, maxdist);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __P_ENEMY_H__
|
||||
|
||||
#include "thingdef/thingdef.h"
|
||||
#include "tables.h"
|
||||
|
||||
struct sector_t;
|
||||
class AActor;
|
||||
|
@ -46,9 +47,9 @@ struct FLookExParams
|
|||
};
|
||||
|
||||
void P_DaggerAlert (AActor *target, AActor *emitter);
|
||||
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks);
|
||||
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter=NULL, fixed_t maxdist=0);
|
||||
bool P_HitFriend (AActor *self);
|
||||
void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false);
|
||||
void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false, fixed_t maxdist=0);
|
||||
bool P_CheckMeleeRange2 (AActor *actor);
|
||||
bool P_Move (AActor *actor);
|
||||
bool P_TryWalk (AActor *actor);
|
||||
|
|
|
@ -144,11 +144,6 @@ void P_Thing_SetVelocity(AActor *actor, fixed_t vx, fixed_t vy, fixed_t vz, bool
|
|||
void P_RemoveThing(AActor * actor);
|
||||
bool P_Thing_Raise(AActor *thing);
|
||||
|
||||
//
|
||||
// P_ENEMY
|
||||
//
|
||||
void P_NoiseAlert (AActor* target, AActor* emmiter, bool splash);
|
||||
|
||||
|
||||
//
|
||||
// P_MAPUTL
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "d_event.h"
|
||||
#include "c_cvars.h"
|
||||
#include "m_random.h"
|
||||
#include "p_enemy.h"
|
||||
#include "p_local.h"
|
||||
#include "s_sound.h"
|
||||
#include "doomstat.h"
|
||||
|
|
|
@ -171,7 +171,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_TurretLook();
|
||||
action native A_KlaxonBlare();
|
||||
action native A_Countdown();
|
||||
action native A_AlertMonsters();
|
||||
action native A_AlertMonsters(float maxdist = 0);
|
||||
action native A_ClearSoundTarget();
|
||||
action native A_FireAssaultGun();
|
||||
action native A_CheckTerrain();
|
||||
|
|
Loading…
Reference in a new issue