]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/deathtypes/all.qh
Merge branch 'master' into Lyberta/WaypointIcons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / deathtypes / all.qh
index beb8e3e912221911705429fe210042762ed51cb0..f4b49801872c8be06fff89cd4a04e08dca055312 100644 (file)
@@ -3,10 +3,11 @@
 #include <common/notifications/all.qh>
 
 REGISTRY(Deathtypes, BITS(8))
-#define Deathtypes_from(i) _Deathtypes_from(i, NULL)
 REGISTER_REGISTRY(Deathtypes)
 REGISTRY_CHECK(Deathtypes)
 
+REGISTRY_DEFINE_GET(Deathtypes, NULL)
+
 .entity death_msgself;
 .entity death_msgmurder;
 .string death_msgextra;
@@ -26,19 +27,18 @@ const int HITTYPE_SECONDARY = BITS(1) << 8;
 const int HITTYPE_SPLASH = BITS(1) << 9;
 const int HITTYPE_BOUNCE = BITS(1) << 10;
 const int HITTYPE_ARMORPIERCE = BITS(1) << 11;
-// unused yet
-const int HITTYPE_RESERVED = BITS(1) << 12;
-const int DEATH_HITTYPEMASK = HITTYPE_SECONDARY | HITTYPE_SPLASH | HITTYPE_BOUNCE | HITTYPE_ARMORPIERCE | HITTYPE_RESERVED;
+const int HITTYPE_SOUND = BITS(1) << 12;
+const int DEATH_HITTYPEMASK = HITTYPE_SECONDARY | HITTYPE_SPLASH | HITTYPE_BOUNCE | HITTYPE_ARMORPIERCE | HITTYPE_SOUND;
 // normal deaths begin
 const int DT_FIRST = BIT(13);
 
 #define DEATH_ISSPECIAL(t)      (t >= DT_FIRST)
-#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_IS(t, dt)         (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)) == dt)
+#define DEATH_ENT(t)            (DEATH_ISSPECIAL(t) ?  (REGISTRY_GET(Deathtypes, t - DT_FIRST)) : NULL)
+#define DEATH_ISVEHICLE(t)      (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "vehicle")
+#define DEATH_ISTURRET(t)       (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "turret")
+#define DEATH_ISMONSTER(t)      (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "monster")
+#define DEATH_WEAPONOF(t)       (DEATH_ISSPECIAL(t) ? WEP_Null : REGISTRY_GET(Weapons, (t) & DEATH_WEAPONMASK))
 #define DEATH_ISWEAPON(t, w)    (DEATH_WEAPONOF(t) == (w))
 
 string Deathtype_Name(int deathtype);