X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fdeathtypes%2Fall.qh;h=14304992a2273200878117c54c2eab2397cd80f6;hb=db5233e91c16c5caa82c9c244a0feaeea7aee4c0;hp=2bf1169bf77d9f494f43dd7335ad6dac40a8b59a;hpb=6bb4f10f1ed0f3d39e18c03a3db1dd7c8c74f14d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/deathtypes/all.qh b/qcsrc/common/deathtypes/all.qh index 2bf1169bf..14304992a 100644 --- a/qcsrc/common/deathtypes/all.qh +++ b/qcsrc/common/deathtypes/all.qh @@ -3,20 +3,25 @@ #include "../notifications.qh" -REGISTRY(Deathtypes, BIT(6)) -REGISTER_REGISTRY(RegisterDeathtypes) +REGISTRY(Deathtypes, BITS(8)) +#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(deathtype)) { \ + make_pure(this); \ 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]; \ + if (msg_death != NO_MSG) this.death_msgself = msg_multi_notifs[dt_identity(msg_death - 1)]; \ + if (msg_death_by != NO_MSG) this.death_msgmurder = msg_multi_notifs[dt_identity(msg_death_by - 1)]; \ } const int DEATH_WEAPONMASK = BITS(8); @@ -32,12 +37,12 @@ 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);