Xonotic
all.qh
Go to the documentation of this file.
1 #pragma once
2 
4 
5 REGISTRY(Deathtypes, BITS(8))
6 REGISTER_REGISTRY(Deathtypes)
7 REGISTRY_CHECK(Deathtypes)
8 
9 REGISTRY_DEFINE_GET(Deathtypes, NULL)
10 
14 
15 #define REGISTER_DEATHTYPE(id, msg_death, msg_death_by, extra) \
16  REGISTER(Deathtypes, DEATH, id, m_id, new_pure(deathtype)) { \
17  this.m_id += DT_FIRST; \
18  this.nent_name = #id; \
19  this.death_msgextra = extra; \
20  this.death_msgself = msg_death; \
21  this.death_msgmurder = msg_death_by; \
22  }
23 
24 const int DEATH_WEAPONMASK = BITS(8);
25 const int HITTYPE_SECONDARY = BITS(1) << 8;
27 const int HITTYPE_SPLASH = BITS(1) << 9;
28 const int HITTYPE_BOUNCE = BITS(1) << 10;
29 const int HITTYPE_ARMORPIERCE = BITS(1) << 11;
30 const int HITTYPE_SOUND = BITS(1) << 12;
31 const int DEATH_HITTYPEMASK = HITTYPE_SECONDARY | HITTYPE_SPLASH | HITTYPE_BOUNCE | HITTYPE_ARMORPIERCE | HITTYPE_SOUND;
32 // normal deaths begin
33 const int DT_FIRST = BIT(13);
34 
35 #define DEATH_ISSPECIAL(t) (t >= DT_FIRST)
36 #define DEATH_IS(t, dt) (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)) == dt)
37 #define DEATH_ENT(t) (DEATH_ISSPECIAL(t) ? (REGISTRY_GET(Deathtypes, t - DT_FIRST)) : NULL)
38 #define DEATH_ISVEHICLE(t) (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "vehicle")
39 #define DEATH_ISTURRET(t) (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "turret")
40 #define DEATH_ISMONSTER(t) (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "monster")
41 #define DEATH_WEAPONOF(t) (DEATH_ISSPECIAL(t) ? WEP_Null : REGISTRY_GET(Weapons, (t) & DEATH_WEAPONMASK))
42 #define DEATH_ISWEAPON(t, w) (DEATH_WEAPONOF(t) == (w))
43 
44 string Deathtype_Name(int deathtype);
45 
46 #include "all.inc"
const int HITTYPE_SPLASH
automatically set by RadiusDamage
Definition: all.qh:27
const int HITTYPE_SOUND
Definition: all.qh:30
REGISTRY(Weapons, 72) STATIC_INIT(WeaponPickup)
Definition: all.qh:28
const int HITTYPE_BOUNCE
Definition: all.qh:28
string death_msgextra
Definition: all.qh:13
entity() spawn
const int DT_FIRST
Definition: all.qh:33
#define REGISTRY_CHECK(id)
Definition: registry.qh:175
entity death_msgself
Definition: all.qh:11
entity death_msgmurder
Definition: all.qh:12
#define REGISTER_REGISTRY(id)
Definition: registry.qh:212
const int DEATH_WEAPONMASK
Definition: all.qh:24
const int HITTYPE_ARMORPIERCE
Definition: all.qh:29
#define REGISTRY_DEFINE_GET(id, null)
Definition: registry.qh:40
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
#define NULL
Definition: post.qh:17
const int HITTYPE_SECONDARY
Definition: all.qh:25
const int DEATH_HITTYPEMASK
Definition: all.qh:31
string Deathtype_Name(int deathtype)
Definition: all.qc:3
#define BITS(n)
Definition: bits.qh:9