diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index bf5cb124eb..e7d24dc36c 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -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; } } + } //============================================================================ diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 19d32626b6..55787c6503 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -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); } diff --git a/src/p_enemy.h b/src/p_enemy.h index f996a0c52e..343ba27e94 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -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); diff --git a/src/p_local.h b/src/p_local.h index 7d3c3d14ce..9e361168d2 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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 diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 8b8c5bcdce..31eb1ac7e0 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -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" diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 720caa858b..251be5e0d3 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -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();