]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Begin moving deathtypes into an ACCUMULATE_FUNCTION list
authorSamual Lenks <samual@xonotic.org>
Thu, 27 Sep 2012 19:13:59 +0000 (15:13 -0400)
committerSamual Lenks <samual@xonotic.org>
Thu, 27 Sep 2012 19:13:59 +0000 (15:13 -0400)
qcsrc/common/constants.qh
qcsrc/server/g_damage.qc

index 5214d519c4a7b3cec750002b72032a595a3f1cf0..6359d622275ff747006c9517bd297d15da76b1c8 100644 (file)
@@ -366,6 +366,7 @@ float SPECIES_RESERVED     = 15;
 // Deathtypes (weapon deathtypes are the IT_* constants below)
 // NOTE: when adding death types, please add an explanation to Docs/spamlog.txt too.
 #define VAR_TO_TEXT2(var) #var
+#define CHECK_FIRST_OR_LAST(input,first,count) if(input) { input = (first + count); }
 #define CHECK_FIELD_COUNT(field,first,count) if(!field) { field = (first + count); ++count; }
 #define CHECK_MAX_DEATHTYPES(name,count) if(count == DT_MAX) { error(strcat("Maximum deathtypes hit: ", VAR_TO_TEXT2(name), ": ", ftos(count), ".\n")); }
 
@@ -373,43 +374,46 @@ float SPECIES_RESERVED     = 15;
 #define DT_MAX 1024 // limit of recursive functions with ACCUMULATE_FUNCTION
 float DT_COUNT;
 
-#define DEATHTYPE(name,type,notification) \
+float DEATH_VHFIRST = DT_FIRST;
+float DEATH_VHLAST = DT_FIRST;
+
+#define DEATHTYPE(name,type,notification,first,last) \
        float name; \
+       float first; \
+       float last; \
        void DecDeathtype_##name() \
        { \
+               CHECK_FIRST_OR_LAST(first, DT_FIRST, DT_COUNT) \
+               CHECK_FIRST_OR_LAST(last, DT_FIRST, DT_COUNT) \
                CHECK_FIELD_COUNT(name, DT_FIRST, DT_COUNT) \
                CHECK_MAX_DEATHTYPES(name, DT_COUNT) \
        }
        //ACCUMULATE_FUNCTION(DecDeathtypes, DecDeathtype_##name)
 
 #define DEATHTYPES \
-       DEATHTYPE(DEATH_SPECIAL_START, MSG_CENTER, FALSE) \
+       DEATHTYPE(DEATH_FALL, FALSE, FALSE, DEATH_SPECIAL_START, FALSE) \
+       DEATHTYPE(DEATH_TELEFRAG, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_DROWN, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_HURTTRIGGER, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_LAVA, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_SLIME, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_KILL, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_NOAMMO, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_SWAMP, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_TEAMCHANGE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_AUTOTEAMCHANGE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_CAMP, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_SHOOTING_STAR, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_ROT, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_MIRRORDAMAGE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_TOUCHEXPLODE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_CHEAT, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_FIRE, FALSE, FALSE, FALSE, FALSE) \
+       DEATHTYPE(DEATH_QUIET, FALSE, FALSE, FALSE, FALSE) \
        #undef DEATHTYPE
 
 DEATHTYPES
 
-float DEATH_SPECIAL_START = 10000;
-float DEATH_FALL = 10000;
-float DEATH_TELEFRAG = 10001;
-float DEATH_DROWN = 10002;
-float DEATH_HURTTRIGGER = 10003;
-float DEATH_LAVA = 10004;
-float DEATH_SLIME = 10005;
-float DEATH_KILL = 10006;
-float DEATH_NOAMMO = 10007;
-float DEATH_SWAMP = 10008;
-float DEATH_TEAMCHANGE = 10009;
-float DEATH_AUTOTEAMCHANGE = 10010;
-float DEATH_CAMP = 10011;
-float DEATH_SHOOTING_STAR = 10012;
-float DEATH_ROT = 10013;
-float DEATH_MIRRORDAMAGE = 10014;
-float DEATH_TOUCHEXPLODE = 10015;
-float DEATH_CHEAT = 10016;
-float DEATH_FIRE = 10017;
-float DEATH_QUIET = 10021;
-
-float  DEATH_VHFIRST       = 10030;
 float  DEATH_VHCRUSH       = 10030;
 float  DEATH_SBMINIGUN     = 10031;
 float  DEATH_SBROCKET      = 10032;
@@ -425,7 +429,6 @@ float  DEATH_BUMB_GUN       = 10041;
 float  DEATH_BUMB_RAY       = 10042;
 float  DEATH_BUMB_RAY_HEAL  = 10043;
 float  DEATH_BUMB_DEATH     = 10044;
-float  DEATH_VHLAST         = 10044;
 #define DEATH_ISVEHICLE(t)  ((t) >= DEATH_VHFIRST && (t) <= DEATH_VHLAST)
 
 float DEATH_GENERIC = 10050;
index f23988c7e8c2c15e97135690e1867cb5af6414e2..2d5807211b62b850530a9bda82af7402a1d42983 100644 (file)
@@ -310,8 +310,8 @@ void LogDeath(string mode, float deathtype, entity killer, entity killed)
 
 void Obituary_Notification(entity notif_target, string s1, string s2, string s3, float deathtype)
 {
-       #define DEATHTYPE(name,type,notification) \
-               { if(deathtype == max(0, name)) { Send_Notification(type, notif_target, notification, s1, s2, s3); return; } }
+       #define DEATHTYPE(name,type,notification,first,last) \
+               { if((deathtype == max(0, name)) && max(0, type) && max(0, notification)) { Send_Notification(type, notif_target, notification, s1, s2, s3); return; } }
 
        DEATHTYPES
        backtrace("Unhandled deathtype. Please notify Samual!\n");