1 #ifndef DEATHTYPES_ALL_H
2 #define DEATHTYPES_ALL_H
4 #include "../notifications.qh"
6 REGISTRY(Deathtypes, BITS(8))
7 REGISTER_REGISTRY(RegisterDeathtypes)
10 .entity death_msgmurder;
11 .string death_msgextra;
13 #define REGISTER_DEATHTYPE(id, msg_death, msg_death_by, extra) \
14 REGISTER(RegisterDeathtypes, DEATH, Deathtypes, id, m_id, new(deathtype)) { \
15 this.m_id += DT_FIRST; \
16 this.nent_name = #id; \
17 this.death_msgextra = extra; \
18 if (msg_death != NO_MSG) this.death_msgself = msg_multi_notifs[msg_death - 1]; \
19 if (msg_death_by != NO_MSG) this.death_msgmurder = msg_multi_notifs[msg_death_by - 1]; \
22 const int DEATH_WEAPONMASK = BITS(8);
23 const int HITTYPE_SECONDARY = BITS(1) << 8;
24 /** automatically set by RadiusDamage */
25 const int HITTYPE_SPLASH = BITS(1) << 9;
26 const int HITTYPE_BOUNCE = BITS(1) << 10;
28 const int HITTYPE_RESERVED = BITS(1) << 11;
29 const int HITTYPE_RESERVED2 = BITS(1) << 12;
30 const int DEATH_HITTYPEMASK = HITTYPE_SECONDARY | HITTYPE_SPLASH | HITTYPE_BOUNCE | HITTYPE_RESERVED | HITTYPE_RESERVED2;
31 // normal deaths begin
32 const int DT_FIRST = BIT(13);
34 #define DEATH_ISSPECIAL(t) (t >= DT_FIRST)
35 #define DEATH_IS(t, dt) (DEATH_ISSPECIAL(t) && (Deathtypes[t - DT_FIRST]) == dt)
36 #define DEATH_ENT(t) (DEATH_ISSPECIAL(t) ? (Deathtypes[t - DT_FIRST]) : NULL)
37 #define DEATH_ISVEHICLE(t) (DEATH_ISSPECIAL(t) && (Deathtypes[t - DT_FIRST]).death_msgextra == "vehicle")
38 #define DEATH_ISTURRET(t) (DEATH_ISSPECIAL(t) && (Deathtypes[t - DT_FIRST]).death_msgextra == "turret")
39 #define DEATH_ISMONSTER(t) (DEATH_ISSPECIAL(t) && (Deathtypes[t - DT_FIRST]).death_msgextra == "monster")
40 #define DEATH_WEAPONOF(t) (DEATH_ISSPECIAL(t) ? WEP_Null : get_weaponinfo((t) & DEATH_WEAPONMASK))
41 #define DEATH_ISWEAPON(t, w) (DEATH_WEAPONOF(t) == (w))
43 string Deathtype_Name(int deathtype);