]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/deathtypes/all.qh
Merge branch 'master' into Mario/overkill
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / deathtypes / all.qh
index 9562ab7868c73c696cb1d0526c93461c0afafafd..0466c230ab3b709f40343ce3d2bba3c2c3442894 100644 (file)
@@ -1,22 +1,25 @@
-#ifndef DEATHTYPES_ALL_H
-#define DEATHTYPES_ALL_H
+#pragma once
 
-#include "../notifications.qh"
+#include <common/notifications/all.qh>
 
 REGISTRY(Deathtypes, BITS(8))
-REGISTER_REGISTRY(RegisterDeathtypes)
+#define Deathtypes_from(i) _Deathtypes_from(i, NULL)
+REGISTER_REGISTRY(Deathtypes)
+REGISTRY_CHECK(Deathtypes)
 
 .entity death_msgself;
 .entity death_msgmurder;
 .string death_msgextra;
 
+int dt_identity(int i) { return i; }
+
 #define REGISTER_DEATHTYPE(id, msg_death, msg_death_by, extra) \
-    REGISTER(RegisterDeathtypes, DEATH, Deathtypes, id, m_id, new(deathtype)) { \
+    REGISTER(Deathtypes, DEATH, id, m_id, new_pure(deathtype)) { \
         this.m_id += DT_FIRST; \
         this.nent_name = #id; \
         this.death_msgextra = extra; \
-        if (msg_death       != NO_MSG) this.death_msgself   = msg_multi_notifs[msg_death    - 1]; \
-        if (msg_death_by    != NO_MSG) this.death_msgmurder = msg_multi_notifs[msg_death_by - 1]; \
+        this.death_msgself = msg_death; \
+        this.death_msgmurder = msg_death_by; \
     }
 
 const int DEATH_WEAPONMASK = BITS(8);
@@ -32,16 +35,14 @@ const int DEATH_HITTYPEMASK = HITTYPE_SECONDARY | HITTYPE_SPLASH | HITTYPE_BOUNC
 const int DT_FIRST = BIT(13);
 
 #define DEATH_ISSPECIAL(t)      (t >= DT_FIRST)
-#define DEATH_IS(t, dt)         (DEATH_ISSPECIAL(t) && (Deathtypes[t - DT_FIRST]) == dt)
-#define DEATH_ENT(t)            (DEATH_ISSPECIAL(t) ?  (Deathtypes[t - DT_FIRST]) : NULL)
-#define DEATH_ISVEHICLE(t)      (DEATH_ISSPECIAL(t) && (Deathtypes[t - DT_FIRST]).death_msgextra == "vehicle")
-#define DEATH_ISTURRET(t)       (DEATH_ISSPECIAL(t) && (Deathtypes[t - DT_FIRST]).death_msgextra == "turret")
-#define DEATH_ISMONSTER(t)      (DEATH_ISSPECIAL(t) && (Deathtypes[t - DT_FIRST]).death_msgextra == "monster")
-#define DEATH_WEAPONOF(t)       (DEATH_ISSPECIAL(t) ? WEP_Null : get_weaponinfo((t) & DEATH_WEAPONMASK))
+#define DEATH_IS(t, dt)         (DEATH_ISSPECIAL(t) && (Deathtypes_from(t - DT_FIRST)) == dt)
+#define DEATH_ENT(t)            (DEATH_ISSPECIAL(t) ?  (Deathtypes_from(t - DT_FIRST)) : NULL)
+#define DEATH_ISVEHICLE(t)      (DEATH_ISSPECIAL(t) && (Deathtypes_from(t - DT_FIRST)).death_msgextra == "vehicle")
+#define DEATH_ISTURRET(t)       (DEATH_ISSPECIAL(t) && (Deathtypes_from(t - DT_FIRST)).death_msgextra == "turret")
+#define DEATH_ISMONSTER(t)      (DEATH_ISSPECIAL(t) && (Deathtypes_from(t - DT_FIRST)).death_msgextra == "monster")
+#define DEATH_WEAPONOF(t)       (DEATH_ISSPECIAL(t) ? WEP_Null : Weapons_from((t) & DEATH_WEAPONMASK))
 #define DEATH_ISWEAPON(t, w)    (DEATH_WEAPONOF(t) == (w))
 
 string Deathtype_Name(int deathtype);
 
 #include "all.inc"
-
-#endif