X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fdeathtypes%2Fall.qh;h=2169c8bd762bd3abe5e708e1f24e1b8b99333740;hp=2bf1169bf77d9f494f43dd7335ad6dac40a8b59a;hb=e0012447bfce1b551df3dc01b043655aa93dafad;hpb=9dd43f196ca7bc0979f94a0fb0f87cdd82a951c7 diff --git a/qcsrc/common/deathtypes/all.qh b/qcsrc/common/deathtypes/all.qh index 2bf1169bf7..2169c8bd76 100644 --- a/qcsrc/common/deathtypes/all.qh +++ b/qcsrc/common/deathtypes/all.qh @@ -1,22 +1,23 @@ -#ifndef DEATHTYPES_ALL_H -#define DEATHTYPES_ALL_H +#pragma once -#include "../notifications.qh" +#include -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; #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_pure(deathtype)) { \ 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]; \ + this.death_msgself = msg_death; \ + this.death_msgmurder = msg_death_by; \ } const int DEATH_WEAPONMASK = BITS(8); @@ -24,24 +25,21 @@ const int HITTYPE_SECONDARY = BITS(1) << 8; /** automatically set by RadiusDamage */ const int HITTYPE_SPLASH = BITS(1) << 9; const int HITTYPE_BOUNCE = BITS(1) << 10; -// unused yet -const int HITTYPE_RESERVED = BITS(1) << 11; -const int HITTYPE_RESERVED2 = BITS(1) << 12; -const int DEATH_HITTYPEMASK = HITTYPE_SECONDARY | HITTYPE_SPLASH | HITTYPE_BOUNCE | HITTYPE_RESERVED | HITTYPE_RESERVED2; +const int HITTYPE_ARMORPIERCE = BITS(1) << 11; +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[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); #include "all.inc" - -#endif