From 8e8f6cf5a6fbe6393a0dfd290f728f54d7557274 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 20 Aug 2013 20:33:03 +0200 Subject: [PATCH 1/3] - A_AlertMonsters flags submission by NeuralStunner. --- src/g_strife/a_strifeweapons.cpp | 28 +++++++++++++++++++++++++--- wadsrc/static/actors/actor.txt | 2 +- wadsrc/static/actors/constants.txt | 7 +++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 82560e6f7..d37f0ea5a 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -137,18 +137,40 @@ DEFINE_ACTION_FUNCTION(AActor, A_JabDagger) // //============================================================================ +enum +{ + AMF_TARGETEMITTER = 1, + AMF_TARGETNONPLAYER = 2, + AMF_EMITFROMTARGET = 4, +}; + DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_AlertMonsters) { ACTION_PARAM_START(1); ACTION_PARAM_FIXED(maxdist, 0); + ACTION_PARAM_INT(Flags, 1); - if (self->player != NULL) + AActor * target; + AActor * emitter = self; + + if (self->player != NULL || (Flags & AMF_TARGETEMITTER)) { - P_NoiseAlert(self, self, false, maxdist); + target = self; + } + else if (self->target != NULL && (Flags & AMF_TARGETNONPLAYER)) + { + target = self->target; } else if (self->target != NULL && self->target->player != NULL) { - P_NoiseAlert (self->target, self, false, maxdist); + target = self->target; + } + + if (Flags & AMF_EMITFROMTARGET) emitter = target; + + if (target != NULL && emitter != NULL) + { + P_NoiseAlert(target, emitter, false, maxdist); } } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 3ba47a5c1..73119c941 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -180,7 +180,7 @@ ACTOR Actor native //: Thinker action native A_TurretLook(); action native A_KlaxonBlare(); action native A_Countdown(); - action native A_AlertMonsters(float maxdist = 0); + action native A_AlertMonsters(float maxdist = 0, int flags = 0); action native A_ClearSoundTarget(); action native A_FireAssaultGun(); action native A_CheckTerrain(); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index cd9b088ab..dee498b6a 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -348,5 +348,12 @@ enum CLOFF_NOAIM = CLOFF_NOAIM_VERT|CLOFF_NOAIM_HORZ }; + +// Flags for A_AlertMonsters +const int AMF_TARGETEMITTER = 1; +const int AMF_TARGETNONPLAYER = 2; +const int AMF_EMITFROMTARGET = 4; + + // This is only here to provide one global variable for testing. native int testglobalvar; From ded1715625246695251c1a3adb5b996e044a732c Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sun, 25 Aug 2013 02:11:44 +0200 Subject: [PATCH 2/3] - Merge DUMB commit d31fb2084659b64d07eb0644d9bacfd67059d066 to zdoom. Fixed C++11 compilation error on Mac OS X --- dumb/include/dumb.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dumb/include/dumb.h b/dumb/include/dumb.h index bcd202298..cafcfea3b 100644 --- a/dumb/include/dumb.h +++ b/dumb/include/dumb.h @@ -44,7 +44,7 @@ #define DUMB_VERSION_STR "0.9.3" -#define DUMB_NAME "DUMB v"DUMB_VERSION_STR +#define DUMB_NAME "DUMB v" DUMB_VERSION_STR #define DUMB_YEAR 2005 #define DUMB_MONTH 8 @@ -56,13 +56,13 @@ #define DUMB_DAY_STR1 "7" #if DUMB_MONTH < 10 -#define DUMB_MONTH_STR2 "0"DUMB_MONTH_STR1 +#define DUMB_MONTH_STR2 "0" DUMB_MONTH_STR1 #else #define DUMB_MONTH_STR2 DUMB_MONTH_STR1 #endif #if DUMB_DAY < 10 -#define DUMB_DAY_STR2 "0"DUMB_DAY_STR1 +#define DUMB_DAY_STR2 "0" DUMB_DAY_STR1 #else #define DUMB_DAY_STR2 DUMB_DAY_STR1 #endif @@ -74,7 +74,7 @@ */ #define DUMB_DATE (DUMB_YEAR*10000 + DUMB_MONTH*100 + DUMB_DAY) -#define DUMB_DATE_STR DUMB_DAY_STR1"."DUMB_MONTH_STR1"."DUMB_YEAR_STR4 +#define DUMB_DATE_STR DUMB_DAY_STR1 "." DUMB_MONTH_STR1 "." DUMB_YEAR_STR4 #undef MIN From 7b5084df4491d3d604a8e0e1d112fdddfaeb0a52 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sun, 25 Aug 2013 02:21:21 +0200 Subject: [PATCH 3/3] Shut up warnings from the customized DUMB code. --- dumb/src/it/readmod.c | 4 ++-- dumb/src/it/readxm.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dumb/src/it/readmod.c b/dumb/src/it/readmod.c index 9d105f126..801b1ce76 100644 --- a/dumb/src/it/readmod.c +++ b/dumb/src/it/readmod.c @@ -650,8 +650,8 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict) if ( ( rstrict & 2 ) ) { - long total_sample_size; - long remain; + int32 total_sample_size; + int32 remain; rem = f; f = dumbfile_buffer_mod_2(rem, sigdata->n_samples, sigdata->sample, &total_sample_size, &remain); if (!f) { diff --git a/dumb/src/it/readxm.c b/dumb/src/it/readxm.c index 25ca07108..7b92cb954 100644 --- a/dumb/src/it/readxm.c +++ b/dumb/src/it/readxm.c @@ -436,7 +436,7 @@ static int limit_xm_getc(void *f) -static long limit_xm_getnc(char *ptr, int32 n, void *f) +static int32 limit_xm_getnc(char *ptr, int32 n, void *f) { LIMITED_XM *lx = f; int left;