Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
all.qh
Go to the documentation of this file.
1#pragma once
2
4
5REGISTRY(Deathtypes, BITS(8))
6REGISTER_REGISTRY(Deathtypes)
7REGISTRY_CHECK(Deathtypes)
8
9REGISTRY_DEFINE_GET(Deathtypes, NULL)
10
16
17#define REGISTER_DEATHTYPE(id, msg_death, msg_death_by, msg_death_ent, msg_death_ent_by, extra) \
18 REGISTER(Deathtypes, DEATH, id, m_id, new_pure(deathtype)) { \
19 this.m_id += DT_FIRST; \
20 this.nent_name = #id; \
21 this.death_msgextra = extra; \
22 this.death_msgself = msg_death; \
23 this.death_msgmurder = msg_death_by; \
24 this.death_msg_ent_self = msg_death_ent; \
25 this.death_msg_ent_murder = msg_death_ent_by; \
26 }
27
28const int DEATH_WEAPONMASK = BITS(8);
29const int HITTYPE_SECONDARY = BIT(8);
30const int HITTYPE_SPLASH = BIT(9); // automatically set by RadiusDamage
31const int HITTYPE_BOUNCE = BIT(10); // set manually after projectile has bounced
32const int HITTYPE_ARMORPIERCE = BIT(11); // ignore armor calculations
33const int HITTYPE_SOUND = BIT(12); // cause bleeding from ears
34const int HITTYPE_SPAM = BIT(13); // set manually after first RadiusDamage, stops effect spam
36// normal deaths begin
37const int DT_FIRST = BIT(14);
38
39#define DEATH_ISSPECIAL(t) (t >= DT_FIRST)
40#define DEATH_IS(t, dt) (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)) == dt)
41#define DEATH_ENT(t) (DEATH_ISSPECIAL(t) ? (REGISTRY_GET(Deathtypes, t - DT_FIRST)) : NULL)
42#define DEATH_ISVEHICLE(t) (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "vehicle")
43#define DEATH_ISTURRET(t) (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "turret")
44#define DEATH_ISMONSTER(t) (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "monster")
45#define DEATH_WEAPONOF(t) (DEATH_ISSPECIAL(t) ? WEP_Null : REGISTRY_GET(Weapons, (t) & DEATH_WEAPONMASK))
46#define DEATH_ISWEAPON(t, w) (DEATH_WEAPONOF(t) == (w))
47
48string Deathtype_Name(int deathtype);
49
50#include "all.inc"
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
#define BITS(n)
Definition bits.qh:9
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
string death_msgextra
Definition all.qh:15
const int HITTYPE_ARMORPIERCE
Definition all.qh:32
entity death_msgmurder
Definition all.qh:12
const int DEATH_WEAPONMASK
Definition all.qh:28
const int DT_FIRST
Definition all.qh:37
const int HITTYPE_BOUNCE
Definition all.qh:31
entity death_msg_ent_self
Definition all.qh:13
entity death_msgself
Definition all.qh:11
const int DEATH_HITTYPEMASK
Definition all.qh:35
const int HITTYPE_SPAM
Definition all.qh:34
string Deathtype_Name(int deathtype)
Definition all.qc:3
const int HITTYPE_SPLASH
Definition all.qh:30
entity death_msg_ent_murder
Definition all.qh:14
const int HITTYPE_SECONDARY
Definition all.qh:29
const int HITTYPE_SOUND
Definition all.qh:33
#define NULL
Definition post.qh:14
#define REGISTER_REGISTRY(id)
Definition registry.qh:229
#define REGISTRY(id, max)
Declare a new registry.
Definition registry.qh:26
#define REGISTRY_CHECK(id)
Definition registry.qh:175
#define REGISTRY_DEFINE_GET(id, null)
Definition registry.qh:40