From: TimePath Date: Wed, 7 Oct 2015 10:24:33 +0000 (+1100) Subject: Deathtypes: port to registry X-Git-Tag: xonotic-v0.8.2~1832^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3589bb7872babf0ee489a54c85c9213562c1ffe9;p=xonotic%2Fxonotic-data.pk3dir.git Deathtypes: port to registry --- diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index 7ef7f996b..94560a833 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -6,7 +6,7 @@ #include "../common/vehicles/all.qh" #include "../common/constants.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/effects/effects.qh" #include "../common/movetypes/movetypes.qh" #include "../common/util.qh" @@ -99,7 +99,7 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum) life = bound(autocvar_cl_damageeffect_lifetime_min, thedamage * autocvar_cl_damageeffect_lifetime, autocvar_cl_damageeffect_lifetime_max); - effectname = get_weaponinfo(DEATH_WEAPONOF(type)).netname; + effectname = DEATH_WEAPONOF(type).netname; if(substring(effectname, strlen(effectname) - 5, 5) == "BLOOD") { @@ -221,7 +221,7 @@ void Ent_DamageInfo(float isNew) setorigin(self, w_org + w_backoff * 2); // for sound() calls - switch(w_deathtype) + switch(DEATH_ENT(w_deathtype)) { case DEATH_VH_CRUSH: break; @@ -295,7 +295,7 @@ void Ent_DamageInfo(float isNew) setorigin(self, w_org + w_backoff * 2); // for sound() calls - switch(w_deathtype) + switch(DEATH_ENT(w_deathtype)) { case DEATH_TURRET_EWHEEL: sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN); @@ -345,18 +345,18 @@ void Ent_DamageInfo(float isNew) if(!DEATH_ISSPECIAL(w_deathtype)) if(!hitplayer || rad) // don't show ground impacts for hitscan weapons if a player was hit { - int hitwep = DEATH_WEAPONOFWEAPONDEATH(w_deathtype); + Weapon hitwep = DEATH_WEAPONOF(w_deathtype); w_random = prandom(); traceline(w_org - normalize(force) * 16, w_org + normalize(force) * 16, MOVE_NOMONSTERS, world); - if(trace_fraction < 1 && hitwep != WEP_VORTEX.m_id && hitwep != WEP_VAPORIZER.m_id) + if(trace_fraction < 1 && hitwep != WEP_VORTEX && hitwep != WEP_VAPORIZER) w_backoff = trace_plane_normal; else w_backoff = -1 * normalize(force); setorigin(self, w_org + w_backoff * 2); // for sound() calls if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) { - Weapon w = get_weaponinfo(hitwep); w.wr_impacteffect(w); + hitwep.wr_impacteffect(hitwep); } } } diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index eb577f46b..97119b881 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -11,7 +11,7 @@ #include "../common/buffs/all.qh" #include "../common/constants.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/items/all.qc" #include "../common/mapinfo.qh" #include "../common/nades/all.qh" @@ -1477,7 +1477,7 @@ void HUD_HealthArmor(void) if(autocvar_hud_panel_healtharmor == 2) // combined health and armor display { vector v; - v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON); + v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON.m_id); float x; x = floor(v.x + 1); diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index bc3fb43d6..113815502 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -26,7 +26,7 @@ #include "weapons/projectile.qh" #include "../common/buffs/all.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/effects/effects.qh" #include "../common/mapinfo.qh" #include "../common/monsters/all.qh" @@ -148,8 +148,6 @@ void CSQC_Init(void) // needs to be done so early because of the constants they create static_init(); - CALL_ACCUMULATED_FUNCTION(RegisterNotifications); - CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes); CALL_ACCUMULATED_FUNCTION(RegisterHUD_Panels); // precaches diff --git a/qcsrc/client/progs.inc b/qcsrc/client/progs.inc index ec5c31844..ec19dd5b2 100644 --- a/qcsrc/client/progs.inc +++ b/qcsrc/client/progs.inc @@ -52,6 +52,7 @@ #include "../common/minigames/cl_minigames.qc" #include "../common/buffs/all.qc" +#include "../common/deathtypes/all.qc" #include "../common/items/all.qc" #include "../common/monsters/all.qc" #include "../common/mutators/all.qc" diff --git a/qcsrc/common/deathtypes.qh b/qcsrc/common/deathtypes.qh deleted file mode 100644 index c1e8bd221..000000000 --- a/qcsrc/common/deathtypes.qh +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef DEATHTYPES_H -#define DEATHTYPES_H - -#include "notifications.qh" - -// ================================ -// Deathtypes, reworked by Samual -// ================================ - -int DEATH_SPECIAL_START; -int NORMAL_POS; -int DEATH_MONSTER_FIRST; -int DEATH_MONSTER_LAST; -int DEATH_TURRET_FIRST; -int DEATH_TURRET_LAST; -int DEATH_VHFIRST; -int DEATH_VHLAST; - -#define DEATHTYPES \ - DEATHTYPE(DEATH_AUTOTEAMCHANGE, DEATH_SELF_AUTOTEAMCHANGE, NO_MSG, DEATH_SPECIAL_START) \ - DEATHTYPE(DEATH_BUFF, NO_MSG, DEATH_MURDER_BUFF, NORMAL_POS) \ - DEATHTYPE(DEATH_CAMP, DEATH_SELF_CAMP, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_CHEAT, DEATH_SELF_CHEAT, DEATH_MURDER_CHEAT, NORMAL_POS) \ - DEATHTYPE(DEATH_CUSTOM, DEATH_SELF_CUSTOM, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_DROWN, DEATH_SELF_DROWN, DEATH_MURDER_DROWN, NORMAL_POS) \ - DEATHTYPE(DEATH_FALL, DEATH_SELF_FALL, DEATH_MURDER_FALL, NORMAL_POS) \ - DEATHTYPE(DEATH_FIRE, DEATH_SELF_FIRE, DEATH_MURDER_FIRE, NORMAL_POS) \ - DEATHTYPE(DEATH_GENERIC, DEATH_SELF_GENERIC, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_HURTTRIGGER, DEATH_SELF_VOID, DEATH_MURDER_VOID, NORMAL_POS) \ - DEATHTYPE(DEATH_KILL, DEATH_SELF_SUICIDE, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_LAVA, DEATH_SELF_LAVA, DEATH_MURDER_LAVA, NORMAL_POS) \ - DEATHTYPE(DEATH_MIRRORDAMAGE, DEATH_SELF_BETRAYAL, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_MONSTER_MAGE, DEATH_SELF_MON_MAGE, DEATH_MURDER_MONSTER, DEATH_MONSTER_FIRST) \ - DEATHTYPE(DEATH_MONSTER_SHAMBLER_CLAW, DEATH_SELF_MON_SHAMBLER_CLAW, DEATH_MURDER_MONSTER, NORMAL_POS) \ - DEATHTYPE(DEATH_MONSTER_SHAMBLER_SMASH, DEATH_SELF_MON_SHAMBLER_SMASH, DEATH_MURDER_MONSTER, NORMAL_POS) \ - DEATHTYPE(DEATH_MONSTER_SHAMBLER_ZAP, DEATH_SELF_MON_SHAMBLER_ZAP, DEATH_MURDER_MONSTER, NORMAL_POS) \ - DEATHTYPE(DEATH_MONSTER_SPIDER, DEATH_SELF_MON_SPIDER, DEATH_MURDER_MONSTER, NORMAL_POS) \ - DEATHTYPE(DEATH_MONSTER_WYVERN, DEATH_SELF_MON_WYVERN, DEATH_MURDER_MONSTER, NORMAL_POS) \ - DEATHTYPE(DEATH_MONSTER_ZOMBIE_JUMP, DEATH_SELF_MON_ZOMBIE_JUMP, DEATH_MURDER_MONSTER, NORMAL_POS) \ - DEATHTYPE(DEATH_MONSTER_ZOMBIE_MELEE, DEATH_SELF_MON_ZOMBIE_MELEE, DEATH_MURDER_MONSTER, DEATH_MONSTER_LAST) \ - DEATHTYPE(DEATH_NADE, DEATH_SELF_NADE, DEATH_MURDER_NADE, NORMAL_POS) \ - DEATHTYPE(DEATH_NADE_NAPALM, DEATH_SELF_NADE_NAPALM, DEATH_MURDER_NADE_NAPALM, NORMAL_POS) \ - DEATHTYPE(DEATH_NADE_ICE, DEATH_SELF_NADE_ICE, DEATH_MURDER_NADE_ICE, NORMAL_POS) \ - DEATHTYPE(DEATH_NADE_ICE_FREEZE, DEATH_SELF_NADE_ICE_FREEZE, DEATH_MURDER_NADE_ICE_FREEZE, NORMAL_POS) \ - DEATHTYPE(DEATH_NADE_HEAL, DEATH_SELF_NADE_HEAL, DEATH_MURDER_NADE_HEAL, NORMAL_POS) \ - DEATHTYPE(DEATH_NOAMMO, DEATH_SELF_NOAMMO, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_ROT, DEATH_SELF_ROT, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_SHOOTING_STAR, DEATH_SELF_SHOOTING_STAR, DEATH_MURDER_SHOOTING_STAR, NORMAL_POS) \ - DEATHTYPE(DEATH_SLIME, DEATH_SELF_SLIME, DEATH_MURDER_SLIME, NORMAL_POS) \ - DEATHTYPE(DEATH_SWAMP, DEATH_SELF_SWAMP, DEATH_MURDER_SWAMP, NORMAL_POS) \ - DEATHTYPE(DEATH_TEAMCHANGE, DEATH_SELF_TEAMCHANGE, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TELEFRAG, NO_MSG, DEATH_MURDER_TELEFRAG, NORMAL_POS) \ - DEATHTYPE(DEATH_TOUCHEXPLODE, DEATH_SELF_TOUCHEXPLODE, DEATH_MURDER_TOUCHEXPLODE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET, DEATH_SELF_TURRET, NO_MSG, DEATH_TURRET_FIRST) \ - DEATHTYPE(DEATH_TURRET_EWHEEL, DEATH_SELF_TURRET_EWHEEL, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_FLAC, DEATH_SELF_TURRET_FLAC, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_HELLION, DEATH_SELF_TURRET_HELLION, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_HK, DEATH_SELF_TURRET_HK, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_MACHINEGUN, DEATH_SELF_TURRET_MACHINEGUN, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_MLRS, DEATH_SELF_TURRET_MLRS, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_PHASER, DEATH_SELF_TURRET_PHASER, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_PLASMA, DEATH_SELF_TURRET_PLASMA, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_TESLA, DEATH_SELF_TURRET_TESLA, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_WALK_GUN, DEATH_SELF_TURRET_WALK_GUN, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_WALK_MELEE, DEATH_SELF_TURRET_WALK_MELEE, NO_MSG, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_WALK_ROCKET, DEATH_SELF_TURRET_WALK_ROCKET, NO_MSG, DEATH_TURRET_LAST) \ - DEATHTYPE(DEATH_VH_BUMB_DEATH, DEATH_SELF_VH_BUMB_DEATH, DEATH_MURDER_VH_BUMB_DEATH, DEATH_VHFIRST) \ - DEATHTYPE(DEATH_VH_BUMB_GUN, NO_MSG, DEATH_MURDER_VH_BUMB_GUN, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_CRUSH, DEATH_SELF_VH_CRUSH, DEATH_MURDER_VH_CRUSH, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_RAPT_BOMB, DEATH_SELF_VH_RAPT_BOMB, DEATH_MURDER_VH_RAPT_BOMB, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_RAPT_CANNON, NO_MSG, DEATH_MURDER_VH_RAPT_CANNON, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_RAPT_DEATH, DEATH_SELF_VH_RAPT_DEATH, DEATH_MURDER_VH_RAPT_DEATH, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_RAPT_FRAGMENT, DEATH_SELF_VH_RAPT_BOMB, DEATH_MURDER_VH_RAPT_BOMB, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_SPID_DEATH, DEATH_SELF_VH_SPID_DEATH, DEATH_MURDER_VH_SPID_DEATH, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_SPID_MINIGUN, NO_MSG, DEATH_MURDER_VH_SPID_MINIGUN, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_SPID_ROCKET, DEATH_SELF_VH_SPID_ROCKET, DEATH_MURDER_VH_SPID_ROCKET, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_WAKI_DEATH, DEATH_SELF_VH_WAKI_DEATH, DEATH_MURDER_VH_WAKI_DEATH, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_WAKI_GUN, NO_MSG, DEATH_MURDER_VH_WAKI_GUN, NORMAL_POS) \ - DEATHTYPE(DEATH_VH_WAKI_ROCKET, DEATH_SELF_VH_WAKI_ROCKET, DEATH_MURDER_VH_WAKI_ROCKET, DEATH_VHLAST) \ - DEATHTYPE(DEATH_WEAPON, NO_MSG, NO_MSG, NORMAL_POS) - -#define DT_FIRST 10000 -#define DT_MAX 128 // limit of recursive functions with ACCUMULATE_FUNCTION -int DT_COUNT; - -entity deathtypes[DT_MAX]; -.entity death_msgself; -.entity death_msgmurder; - -#define DEATHTYPE(name,msg_death,msg_death_by,position) \ - int name; \ - void RegisterDeathtype_##name() \ - { \ - SET_FIRST_OR_LAST(position, DT_FIRST, DT_COUNT) \ - SET_FIELD_COUNT(name, DT_FIRST, DT_COUNT) \ - CHECK_MAX_COUNT(name, DT_MAX, DT_COUNT, "deathtypes") \ - \ - entity deathent = spawn(); \ - deathtypes[(name - DT_FIRST)] = deathent; \ - deathent.classname = "deathtype"; \ - deathent.nent_name = #name; \ - if (msg_death != NO_MSG) \ - deathent.death_msgself = msg_multi_notifs[msg_death - 1]; \ - if (msg_death_by != NO_MSG) \ - deathent.death_msgmurder = msg_multi_notifs[msg_death_by - 1]; \ - } \ - ACCUMULATE_FUNCTION(RegisterDeathtypes, RegisterDeathtype_##name) - -DEATHTYPES -#undef DEATHTYPE - -#define DEATH_ISSPECIAL(t) ((t) >= DEATH_SPECIAL_START) -#define DEATH_ISVEHICLE(t) ((t) >= DEATH_VHFIRST && (t) <= DEATH_VHLAST) -#define DEATH_ISTURRET(t) ((t) >= DEATH_TURRET_FIRST && (t) <= DEATH_TURRET_LAST) -#define DEATH_ISMONSTER(t) ((t) >= DEATH_MONSTER_FIRST && (t) <= DEATH_MONSTER_LAST) -#define DEATH_WEAPONOFWEAPONDEATH(t) ((t) & DEATH_WEAPONMASK) -#define DEATH_ISWEAPON(t,w) (!DEATH_ISSPECIAL(t) && DEATH_WEAPONOFWEAPONDEATH(t) == (w)) -#define DEATH_WEAPONOF(t) (DEATH_ISSPECIAL(t) ? 0 : DEATH_WEAPONOFWEAPONDEATH(t)) -#define WEP_VALID(w) ((w) >= WEP_FIRST && (w) <= WEP_LAST) - -string Deathtype_Name(int deathtype) -{ - if(DEATH_ISSPECIAL(deathtype)) - { - entity deathent = deathtypes[(deathtype - DT_FIRST)]; - if (!deathent) { backtrace("Deathtype_Name: Could not find deathtype entity!\n"); return ""; } - return deathent.nent_name; - } - else { return ftos(deathtype); } -} - -const int DEATH_WEAPONMASK = 0xFF; -const int DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths -const int HITTYPE_SECONDARY = 0x100; -const int HITTYPE_SPLASH = 0x200; // automatically set by RadiusDamage -const int HITTYPE_BOUNCE = 0x400; -const int HITTYPE_RESERVED2 = 0x800; -const int HITTYPE_RESERVED = 0x1000; // unused yet -#endif diff --git a/qcsrc/common/deathtypes/all.inc b/qcsrc/common/deathtypes/all.inc new file mode 100644 index 000000000..32d063180 --- /dev/null +++ b/qcsrc/common/deathtypes/all.inc @@ -0,0 +1,61 @@ +REGISTER_DEATHTYPE(AUTOTEAMCHANGE, DEATH_SELF_AUTOTEAMCHANGE, NO_MSG, "") +REGISTER_DEATHTYPE(BUFF, NO_MSG, DEATH_MURDER_BUFF, "") +REGISTER_DEATHTYPE(CAMP, DEATH_SELF_CAMP, NO_MSG, "") +REGISTER_DEATHTYPE(CHEAT, DEATH_SELF_CHEAT, DEATH_MURDER_CHEAT, "") +REGISTER_DEATHTYPE(CUSTOM, DEATH_SELF_CUSTOM, NO_MSG, "") +REGISTER_DEATHTYPE(DROWN, DEATH_SELF_DROWN, DEATH_MURDER_DROWN, "") +REGISTER_DEATHTYPE(FALL, DEATH_SELF_FALL, DEATH_MURDER_FALL, "") +REGISTER_DEATHTYPE(FIRE, DEATH_SELF_FIRE, DEATH_MURDER_FIRE, "") +REGISTER_DEATHTYPE(GENERIC, DEATH_SELF_GENERIC, NO_MSG, "") +REGISTER_DEATHTYPE(HURTTRIGGER, DEATH_SELF_VOID, DEATH_MURDER_VOID, "") +REGISTER_DEATHTYPE(KILL, DEATH_SELF_SUICIDE, NO_MSG, "") +REGISTER_DEATHTYPE(LAVA, DEATH_SELF_LAVA, DEATH_MURDER_LAVA, "") +REGISTER_DEATHTYPE(MIRRORDAMAGE, DEATH_SELF_BETRAYAL, NO_MSG, "") +REGISTER_DEATHTYPE(MONSTER_MAGE, DEATH_SELF_MON_MAGE, DEATH_MURDER_MONSTER, "monster") +REGISTER_DEATHTYPE(MONSTER_SHAMBLER_CLAW, DEATH_SELF_MON_SHAMBLER_CLAW, DEATH_MURDER_MONSTER, "monster") +REGISTER_DEATHTYPE(MONSTER_SHAMBLER_SMASH, DEATH_SELF_MON_SHAMBLER_SMASH, DEATH_MURDER_MONSTER, "monster") +REGISTER_DEATHTYPE(MONSTER_SHAMBLER_ZAP, DEATH_SELF_MON_SHAMBLER_ZAP, DEATH_MURDER_MONSTER, "monster") +REGISTER_DEATHTYPE(MONSTER_SPIDER, DEATH_SELF_MON_SPIDER, DEATH_MURDER_MONSTER, "monster") +REGISTER_DEATHTYPE(MONSTER_WYVERN, DEATH_SELF_MON_WYVERN, DEATH_MURDER_MONSTER, "monster") +REGISTER_DEATHTYPE(MONSTER_ZOMBIE_JUMP, DEATH_SELF_MON_ZOMBIE_JUMP, DEATH_MURDER_MONSTER, "monster") +REGISTER_DEATHTYPE(MONSTER_ZOMBIE_MELEE, DEATH_SELF_MON_ZOMBIE_MELEE, DEATH_MURDER_MONSTER, "monster") +REGISTER_DEATHTYPE(NADE, DEATH_SELF_NADE, DEATH_MURDER_NADE, "") +REGISTER_DEATHTYPE(NADE_NAPALM, DEATH_SELF_NADE_NAPALM, DEATH_MURDER_NADE_NAPALM, "") +REGISTER_DEATHTYPE(NADE_ICE, DEATH_SELF_NADE_ICE, DEATH_MURDER_NADE_ICE, "") +REGISTER_DEATHTYPE(NADE_ICE_FREEZE, DEATH_SELF_NADE_ICE_FREEZE, DEATH_MURDER_NADE_ICE_FREEZE, "") +REGISTER_DEATHTYPE(NADE_HEAL, DEATH_SELF_NADE_HEAL, DEATH_MURDER_NADE_HEAL, "") +REGISTER_DEATHTYPE(NOAMMO, DEATH_SELF_NOAMMO, NO_MSG, "") +REGISTER_DEATHTYPE(ROT, DEATH_SELF_ROT, NO_MSG, "") +REGISTER_DEATHTYPE(SHOOTING_STAR, DEATH_SELF_SHOOTING_STAR, DEATH_MURDER_SHOOTING_STAR, "") +REGISTER_DEATHTYPE(SLIME, DEATH_SELF_SLIME, DEATH_MURDER_SLIME, "") +REGISTER_DEATHTYPE(SWAMP, DEATH_SELF_SWAMP, DEATH_MURDER_SWAMP, "") +REGISTER_DEATHTYPE(TEAMCHANGE, DEATH_SELF_TEAMCHANGE, NO_MSG, "") +REGISTER_DEATHTYPE(TELEFRAG, NO_MSG, DEATH_MURDER_TELEFRAG, "") +REGISTER_DEATHTYPE(TOUCHEXPLODE, DEATH_SELF_TOUCHEXPLODE, DEATH_MURDER_TOUCHEXPLODE, "") +REGISTER_DEATHTYPE(TURRET, DEATH_SELF_TURRET, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_EWHEEL, DEATH_SELF_TURRET_EWHEEL, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_FLAC, DEATH_SELF_TURRET_FLAC, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_HELLION, DEATH_SELF_TURRET_HELLION, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_HK, DEATH_SELF_TURRET_HK, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_MACHINEGUN, DEATH_SELF_TURRET_MACHINEGUN, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_MLRS, DEATH_SELF_TURRET_MLRS, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_PHASER, DEATH_SELF_TURRET_PHASER, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_PLASMA, DEATH_SELF_TURRET_PLASMA, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_TESLA, DEATH_SELF_TURRET_TESLA, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_WALK_GUN, DEATH_SELF_TURRET_WALK_GUN, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_WALK_MELEE, DEATH_SELF_TURRET_WALK_MELEE, NO_MSG, "turret") +REGISTER_DEATHTYPE(TURRET_WALK_ROCKET, DEATH_SELF_TURRET_WALK_ROCKET, NO_MSG, "turret") +REGISTER_DEATHTYPE(VH_BUMB_DEATH, DEATH_SELF_VH_BUMB_DEATH, DEATH_MURDER_VH_BUMB_DEATH, "vehicle") +REGISTER_DEATHTYPE(VH_BUMB_GUN, NO_MSG, DEATH_MURDER_VH_BUMB_GUN, "vehicle") +REGISTER_DEATHTYPE(VH_CRUSH, DEATH_SELF_VH_CRUSH, DEATH_MURDER_VH_CRUSH, "vehicle") +REGISTER_DEATHTYPE(VH_RAPT_BOMB, DEATH_SELF_VH_RAPT_BOMB, DEATH_MURDER_VH_RAPT_BOMB, "vehicle") +REGISTER_DEATHTYPE(VH_RAPT_CANNON, NO_MSG, DEATH_MURDER_VH_RAPT_CANNON, "vehicle") +REGISTER_DEATHTYPE(VH_RAPT_DEATH, DEATH_SELF_VH_RAPT_DEATH, DEATH_MURDER_VH_RAPT_DEATH, "vehicle") +REGISTER_DEATHTYPE(VH_RAPT_FRAGMENT, DEATH_SELF_VH_RAPT_BOMB, DEATH_MURDER_VH_RAPT_BOMB, "vehicle") +REGISTER_DEATHTYPE(VH_SPID_DEATH, DEATH_SELF_VH_SPID_DEATH, DEATH_MURDER_VH_SPID_DEATH, "vehicle") +REGISTER_DEATHTYPE(VH_SPID_MINIGUN, NO_MSG, DEATH_MURDER_VH_SPID_MINIGUN, "vehicle") +REGISTER_DEATHTYPE(VH_SPID_ROCKET, DEATH_SELF_VH_SPID_ROCKET, DEATH_MURDER_VH_SPID_ROCKET, "vehicle") +REGISTER_DEATHTYPE(VH_WAKI_DEATH, DEATH_SELF_VH_WAKI_DEATH, DEATH_MURDER_VH_WAKI_DEATH, "vehicle") +REGISTER_DEATHTYPE(VH_WAKI_GUN, NO_MSG, DEATH_MURDER_VH_WAKI_GUN, "vehicle") +REGISTER_DEATHTYPE(VH_WAKI_ROCKET, DEATH_SELF_VH_WAKI_ROCKET, DEATH_MURDER_VH_WAKI_ROCKET, "vehicle") +REGISTER_DEATHTYPE(WEAPON, NO_MSG, NO_MSG, "") diff --git a/qcsrc/common/deathtypes/all.qc b/qcsrc/common/deathtypes/all.qc new file mode 100644 index 000000000..4fdafa9a8 --- /dev/null +++ b/qcsrc/common/deathtypes/all.qc @@ -0,0 +1,11 @@ +#include "all.qh" + +string Deathtype_Name(int deathtype) +{ + if (DEATH_ISSPECIAL(deathtype)) { + entity deathent = Deathtypes[deathtype - DT_FIRST]; + if (!deathent) { backtrace("Deathtype_Name: Could not find deathtype entity!\n"); return ""; } + return deathent.nent_name; + } + return ftos(deathtype); +} diff --git a/qcsrc/common/deathtypes/all.qh b/qcsrc/common/deathtypes/all.qh new file mode 100644 index 000000000..2bf1169bf --- /dev/null +++ b/qcsrc/common/deathtypes/all.qh @@ -0,0 +1,47 @@ +#ifndef DEATHTYPES_ALL_H +#define DEATHTYPES_ALL_H + +#include "../notifications.qh" + +REGISTRY(Deathtypes, BIT(6)) +REGISTER_REGISTRY(RegisterDeathtypes) + +.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)) { \ + 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]; \ + } + +const int DEATH_WEAPONMASK = BITS(8); +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; +// 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_ISWEAPON(t, w) (DEATH_WEAPONOF(t) == (w)) + +string Deathtype_Name(int deathtype); + +#include "all.inc" + +#endif diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 9952063f6..356b47dbc 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -150,7 +150,7 @@ void M_Mage_Attack_Spike_Explode() self.realowner.mage_spike = world; Send_Effect(EFFECT_EXPLOSION_SMALL, self.origin, '0 0 0', 1); - RadiusDamage (self, self.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), world, world, 0, DEATH_MONSTER_MAGE, other); + RadiusDamage (self, self.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), world, world, 0, DEATH_MONSTER_MAGE.m_id, other); remove (self); } @@ -302,7 +302,7 @@ void M_Mage_Defend_Heal() void M_Mage_Attack_Push() {SELFPARAM(); sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM); - RadiusDamage (self, self, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), world, world, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE, self.enemy); + RadiusDamage (self, self, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), world, world, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE.m_id, self.enemy); Send_Effect(EFFECT_TE_EXPLOSION, self.origin, '0 0 0', 1); setanim(self, self.anim_shoot, true, true, true); diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index 937c83c9e..8a84eeec3 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -68,13 +68,13 @@ void M_Shambler_Attack_Smash() tracebox(self.origin + v_forward * 50, self.mins * 0.5, self.maxs * 0.5, self.origin + v_forward * autocvar_g_monster_shambler_attack_smash_range, MOVE_NORMAL, self); if(trace_ent.takedamage) - Damage(trace_ent, self, self, (autocvar_g_monster_shambler_attack_smash_damage) * MONSTER_SKILLMOD(self), DEATH_MONSTER_SHAMBLER_SMASH, trace_ent.origin, normalize(trace_ent.origin - self.origin)); + Damage(trace_ent, self, self, (autocvar_g_monster_shambler_attack_smash_damage) * MONSTER_SKILLMOD(self), DEATH_MONSTER_SHAMBLER_SMASH.m_id, trace_ent.origin, normalize(trace_ent.origin - self.origin)); } void M_Shambler_Attack_Swing() {SELFPARAM(); float r = (random() < 0.5); - if(r && Monster_Attack_Melee(self.enemy, (autocvar_g_monster_shambler_attack_claw_damage), ((r) ? self.anim_melee2 : self.anim_melee3), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW, true)) + if(r && Monster_Attack_Melee(self.enemy, (autocvar_g_monster_shambler_attack_claw_damage), ((r) ? self.anim_melee2 : self.anim_melee3), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW.m_id, true)) { Monster_Delay(1, 0, 0.5, M_Shambler_Attack_Swing); self.attack_finished_single += 0.5; @@ -102,7 +102,7 @@ void M_Shambler_Attack_Lightning_Explode() for(head = findradius(self.origin, (autocvar_g_monster_shambler_attack_lightning_radius_zap)); head; head = head.chain) if(head != self.realowner) if(head.takedamage) { te_csqc_lightningarc(self.origin, head.origin); - Damage(head, self, self.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(self), DEATH_MONSTER_SHAMBLER_ZAP, head.origin, '0 0 0'); + Damage(head, self, self.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(self), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0'); } self.think = SUB_Remove; @@ -154,7 +154,7 @@ void M_Shambler_Attack_Lightning() gren.bot_dodgerating = (autocvar_g_monster_shambler_attack_lightning_damage); gren.movetype = MOVETYPE_BOUNCE; PROJECTILE_MAKETRIGGER(gren); - gren.projectiledeathtype = DEATH_MONSTER_SHAMBLER_ZAP; + gren.projectiledeathtype = DEATH_MONSTER_SHAMBLER_ZAP.m_id; setorigin(gren, CENTER_OR_VIEWOFS(self)); setsize(gren, '-8 -8 -8', '8 8 8'); gren.scale = 2.5; diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 35a320b9d..c8daa037e 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -73,7 +73,7 @@ METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, bool fir actor.enemy = Monster_FindTarget(actor); actor.attack_range = 60; } - Monster_Attack_Melee(actor.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? self.anim_melee : self.anim_shoot), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER, true); + Monster_Attack_Melee(actor.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? self.anim_melee : self.anim_shoot), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER.m_id, true); weapon_thinkf(actor, WFRAME_FIRE2, 0, w_ready); } } @@ -128,7 +128,7 @@ void M_Spider_Attack_Web() proj.bot_dodgerating = 0; proj.nextthink = time + 5; PROJECTILE_MAKETRIGGER(proj); - proj.projectiledeathtype = DEATH_MONSTER_SPIDER; + proj.projectiledeathtype = DEATH_MONSTER_SPIDER.m_id; setorigin(proj, CENTER_OR_VIEWOFS(self)); //proj.glow_size = 50; diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 102fd6a5c..d709e4514 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -62,7 +62,7 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, bool fir missile.owner = missile.realowner = actor; missile.solid = SOLID_TRIGGER; missile.movetype = MOVETYPE_FLYMISSILE; - missile.projectiledeathtype = DEATH_MONSTER_WYVERN; + missile.projectiledeathtype = DEATH_MONSTER_WYVERN.m_id; setsize(missile, '-6 -6 -6', '6 6 6'); setorigin(missile, actor.origin + actor.view_ofs + v_forward * 14); missile.flags = FL_PROJECTILE; diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index 8425a123a..ef9aa06cb 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -84,7 +84,7 @@ void M_Zombie_Attack_Leap_Touch() { angles_face = vectoangles(self.moveto - self.origin); angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force); - Damage(other, self, self, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(self), DEATH_MONSTER_ZOMBIE_JUMP, other.origin, angles_face); + Damage(other, self, self, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(self), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face); self.touch = Monster_Touch; // instantly turn it off to stop damage spam self.state = 0; } @@ -137,7 +137,7 @@ float M_Zombie_Attack(float attack_type, entity targ) else chosen_anim = self.anim_melee3; - return Monster_Attack_Melee(self.enemy, (autocvar_g_monster_zombie_attack_melee_damage), chosen_anim, self.attack_range, (autocvar_g_monster_zombie_attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE, true); + return Monster_Attack_Melee(self.enemy, (autocvar_g_monster_zombie_attack_melee_damage), chosen_anim, self.attack_range, (autocvar_g_monster_zombie_attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE.m_id, true); } case MONSTER_ATTACK_RANGED: { diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 8b05f781d..940b30f00 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -12,7 +12,7 @@ #include "../weapons/all.qh" #include "../../server/autocvars.qh" #include "../../server/defs.qh" - #include "../deathtypes.qh" + #include "../deathtypes/all.qh" #include "../../server/mutators/mutators_include.qh" #include "../../server/steerlib.qh" #include "../turrets/sv_turrets.qh" @@ -744,7 +744,7 @@ void Monster_Move(float runspeed, float walkspeed, float stpspeed) Unfreeze(self); self.health = 0; if(self.event_damage) - self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE, self.origin, '0 0 0'); + self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0'); } else if ( self.revive_progress <= 0 ) @@ -761,7 +761,7 @@ void Monster_Move(float runspeed, float walkspeed, float stpspeed) { self.last_trace = time + 0.4; - Damage (self, world, world, 2, DEATH_DROWN, self.origin, '0 0 0'); + Damage (self, world, world, 2, DEATH_DROWN.m_id, self.origin, '0 0 0'); self.angles = '90 90 0'; if(random() < 0.5) { @@ -1048,19 +1048,19 @@ void Monster_Dead(entity attacker, float gibbed) void Monster_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) {SELFPARAM(); - if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL && !ITEM_DAMAGE_NEEDKILL(deathtype)) + if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL.m_id && !ITEM_DAMAGE_NEEDKILL(deathtype)) return; - if(self.frozen && deathtype != DEATH_KILL && deathtype != DEATH_NADE_ICE_FREEZE) + if(self.frozen && deathtype != DEATH_KILL.m_id && deathtype != DEATH_NADE_ICE_FREEZE.m_id) return; - //if(time < self.pain_finished && deathtype != DEATH_KILL) + //if(time < self.pain_finished && deathtype != DEATH_KILL.m_id) //return; - if(time < self.spawnshieldtime && deathtype != DEATH_KILL) + if(time < self.spawnshieldtime && deathtype != DEATH_KILL.m_id) return; - if(deathtype == DEATH_FALL && self.draggedby != world) + if(deathtype == DEATH_FALL.m_id && self.draggedby != world) return; vector v; @@ -1088,12 +1088,12 @@ void Monster_Damage(entity inflictor, entity attacker, float damage, int deathty self.dmg_time = time; - if(sound_allowed(MSG_BROADCAST, attacker) && deathtype != DEATH_DROWN) + if(sound_allowed(MSG_BROADCAST, attacker) && deathtype != DEATH_DROWN.m_id) spamsound (self, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER self.velocity += force * self.damageforcescale; - if(deathtype != DEATH_DROWN && take) + if(deathtype != DEATH_DROWN.m_id && take) { Violence_GibSplash_At(hitloc, force, 2, bound(0, take, 200) / 16, self, attacker); if (take > 50) @@ -1104,7 +1104,7 @@ void Monster_Damage(entity inflictor, entity attacker, float damage, int deathty if(self.health <= 0) { - if(deathtype == DEATH_KILL) + if(deathtype == DEATH_KILL.m_id) self.candrop = false; // killed by mobkill command // TODO: fix this? @@ -1113,14 +1113,14 @@ void Monster_Damage(entity inflictor, entity attacker, float damage, int deathty SUB_UseTargets(); self.target2 = self.oldtarget2; // reset to original target on death, incase we respawn - Monster_Dead(attacker, (self.health <= -100 || deathtype == DEATH_KILL)); + Monster_Dead(attacker, (self.health <= -100 || deathtype == DEATH_KILL.m_id)); WaypointSprite_Kill(self.sprite); frag_target = self; MUTATOR_CALLHOOK(MonsterDies, attacker); - if(self.health <= -100 || deathtype == DEATH_KILL) // check if we're already gibbed + if(self.health <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed { Violence_GibSplash(self, 1, 0.5, attacker); @@ -1231,7 +1231,7 @@ void Monster_Think() if(self.monster_lifetime) if(time >= self.monster_lifetime) { - Damage(self, self, self, self.health + self.max_health, DEATH_KILL, self.origin, self.origin); + Damage(self, self, self, self.health + self.max_health, DEATH_KILL.m_id, self.origin, self.origin); return; } diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 9adf1a95b..91dd76b0b 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -1110,8 +1110,8 @@ entity WaypointSprite_AttachCarrier( entity e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, false, icon); if (e) { - WaypointSprite_UpdateMaxHealth(e, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON) * 2); - WaypointSprite_UpdateHealth(e, '1 0 0' * healtharmor_maxdamage(carrier.health, carrier.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON)); + WaypointSprite_UpdateMaxHealth(e, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id) * 2); + WaypointSprite_UpdateHealth(e, '1 0 0' * healtharmor_maxdamage(carrier.health, carrier.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id)); } return e; } diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 01d6cbe55..e5e431004 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -886,4 +886,6 @@ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_First) #include "notifications.inc" ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_Done) +STATIC_INIT(RegisterNotifications) { CALL_ACCUMULATED_FUNCTION(RegisterNotifications); } + #endif diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index af9a6b423..9875dc78e 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -210,7 +210,7 @@ void func_breakable_destroy() _sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); if(self.dmg) - RadiusDamage(self, activator, self.dmg, self.dmg_edge, self.dmg_radius, self, world, self.dmg_force, DEATH_HURTTRIGGER, world); + RadiusDamage(self, activator, self.dmg, self.dmg_edge, self.dmg_radius, self, world, self.dmg_force, DEATH_HURTTRIGGER.m_id, world); if(self.cnt) // TODO pointparticles(self.cnt, self.absmin * 0.5 + self.absmax * 0.5, '0 0 0', self.count); diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index c55754bdb..439d131e7 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -36,14 +36,14 @@ void door_blocked() ) { // KIll Kill Kill!! #ifdef SVQC - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif } else { #ifdef SVQC if((self.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite? - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif // don't change direction for dead or dying stuff @@ -78,7 +78,7 @@ void door_blocked() { //gib dying stuff just to make sure if((self.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite? - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif } @@ -331,7 +331,7 @@ void door_generic_plat_blocked() if((self.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!! #ifdef SVQC - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif } else @@ -339,7 +339,7 @@ void door_generic_plat_blocked() #ifdef SVQC if((self.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite? - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif //Dont chamge direction for dead or dying stuff @@ -358,7 +358,7 @@ void door_generic_plat_blocked() { //gib dying stuff just to make sure if((self.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite? - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif } diff --git a/qcsrc/common/triggers/misc/laser.qc b/qcsrc/common/triggers/misc/laser.qc index 3b9996db6..62af10946 100644 --- a/qcsrc/common/triggers/misc/laser.qc +++ b/qcsrc/common/triggers/misc/laser.qc @@ -119,7 +119,7 @@ void misc_laser_think() if(((self.spawnflags & 8) == 0) == (self.team != hitent.team)) return; if(hitent.takedamage) - Damage(hitent, self, self, ((self.dmg < 0) ? 100000 : (self.dmg * frametime)), DEATH_HURTTRIGGER, hitloc, '0 0 0'); + Damage(hitent, self, self, ((self.dmg < 0) ? 100000 : (self.dmg * frametime)), DEATH_HURTTRIGGER.m_id, hitloc, '0 0 0'); } } diff --git a/qcsrc/common/triggers/platforms.qc b/qcsrc/common/triggers/platforms.qc index dc568cae0..1c8a8bbad 100644 --- a/qcsrc/common/triggers/platforms.qc +++ b/qcsrc/common/triggers/platforms.qc @@ -5,13 +5,13 @@ void generic_plat_blocked() { if(self.dmgtime2 < time) { - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); self.dmgtime2 = time + self.dmgtime; } // Gib dead/dying stuff if(other.deadflag != DEAD_NO) - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif } @@ -150,7 +150,7 @@ void plat_crush() if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!! #ifdef SVQC - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); #endif } else @@ -158,10 +158,10 @@ void plat_crush() #ifdef SVQC if((self.dmg) && (other.takedamage != DAMAGE_NO)) { // Shall we bite? - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); // Gib dead/dying stuff if(other.deadflag != DEAD_NO) - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } #endif diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index 94f2bd26b..4cfa12ea5 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -14,7 +14,7 @@ #include "../../server/autocvars.qh" #include "../../server/constants.qh" #include "../../server/defs.qh" - #include "../deathtypes.qh" + #include "../deathtypes/all.qh" #include "../turrets/sv_turrets.qh" #include "../vehicles/all.qh" #include "../mapinfo.qh" @@ -49,11 +49,11 @@ void tdeath(entity player, entity teleporter, entity telefragger, vector telefra if(IS_PLAYER(head)) if(head.health >= 1) ++tdeath_hit; - Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG, head.origin, '0 0 0'); + Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG.m_id, head.origin, '0 0 0'); } } else // dead bodies and monsters gib themselves instead of telefragging - Damage (telefragger, teleporter, telefragger, 10000, DEATH_TELEFRAG, telefragger.origin, '0 0 0'); + Damage (telefragger, teleporter, telefragger, 10000, DEATH_TELEFRAG.m_id, telefragger.origin, '0 0 0'); } } diff --git a/qcsrc/common/triggers/trigger/hurt.qc b/qcsrc/common/triggers/trigger/hurt.qc index 535ba8500..771b4f064 100644 --- a/qcsrc/common/triggers/trigger/hurt.qc +++ b/qcsrc/common/triggers/trigger/hurt.qc @@ -34,7 +34,7 @@ void trigger_hurt_touch() self.enemy = world; // I still hate you all } - Damage (other, self, own, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, own, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } } else if(other.damagedbytriggers) @@ -42,7 +42,7 @@ void trigger_hurt_touch() if(other.takedamage) { EXACTTRIGGER_TOUCH; - Damage(other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage(other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } } diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index 2ae068d82..5e44c8077 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -5,7 +5,7 @@ #include "../../../warpzonelib/util_server.qh" #include "../../weapons/all.qh" #include "../../../server/defs.qh" - #include "../../deathtypes.qh" + #include "../../deathtypes/all.qh" #endif /* @@ -55,7 +55,7 @@ void swampslug_think(void) // Or we have exited it very recently. // Do the damage and renew the timer. #ifdef SVQC - Damage (self.owner, self, self, self.dmg, DEATH_SWAMP, other.origin, '0 0 0'); + Damage (self.owner, self, self, self.dmg, DEATH_SWAMP.m_id, other.origin, '0 0 0'); #endif self.nextthink = time + self.swamp_interval; diff --git a/qcsrc/common/turrets/turret/ewheel_weapon.qc b/qcsrc/common/turrets/turret/ewheel_weapon.qc index 86444bb48..34e5a5986 100644 --- a/qcsrc/common/turrets/turret/ewheel_weapon.qc +++ b/qcsrc/common/turrets/turret/ewheel_weapon.qc @@ -31,7 +31,7 @@ METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bo turret_do_updates(actor); - entity missile = turret_projectile(SND(LASERGUN_FIRE), 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_BLASTER, true, true); + entity missile = turret_projectile(SND(LASERGUN_FIRE), 1, 0, DEATH_TURRET_EWHEEL.m_id, PROJECTILE_BLASTER, true, true); missile.missile_flags = MIF_SPLASH; Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1); diff --git a/qcsrc/common/turrets/turret/flac_weapon.qc b/qcsrc/common/turrets/turret/flac_weapon.qc index 4c60805d2..834f255da 100644 --- a/qcsrc/common/turrets/turret/flac_weapon.qc +++ b/qcsrc/common/turrets/turret/flac_weapon.qc @@ -32,7 +32,7 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool turret_tag_fire_update(); - entity proj = turret_projectile(SND(HAGAR_FIRE), 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, true, true); + entity proj = turret_projectile(SND(HAGAR_FIRE), 5, 0, DEATH_TURRET_FLAC.m_id, PROJECTILE_HAGAR, true, true); proj.missile_flags = MIF_SPLASH | MIF_PROXY; proj.think = turret_flac_projectile_think_explode; proj.nextthink = time + actor.tur_impacttime + (random() * 0.01 - random() * 0.01); diff --git a/qcsrc/common/turrets/turret/hellion_weapon.qc b/qcsrc/common/turrets/turret/hellion_weapon.qc index 491fa734e..2d754e877 100644 --- a/qcsrc/common/turrets/turret/hellion_weapon.qc +++ b/qcsrc/common/turrets/turret/hellion_weapon.qc @@ -39,7 +39,7 @@ METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, bool fire1, b actor.tur_shotorg = gettaginfo(actor.tur_head, gettagindex(actor.tur_head, "tag_fire2")); } - entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION, PROJECTILE_ROCKET, FALSE, FALSE); + entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION.m_id, PROJECTILE_ROCKET, FALSE, FALSE); te_explosion (missile.origin); missile.think = turret_hellion_missile_think; missile.nextthink = time; diff --git a/qcsrc/common/turrets/turret/hk_weapon.qc b/qcsrc/common/turrets/turret/hk_weapon.qc index 9fe73f830..98bff5757 100644 --- a/qcsrc/common/turrets/turret/hk_weapon.qc +++ b/qcsrc/common/turrets/turret/hk_weapon.qc @@ -36,7 +36,7 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, bool fir actor.tur_head = actor; weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); } - entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HK, PROJECTILE_ROCKET, FALSE, FALSE); + entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, FALSE, FALSE); te_explosion (missile.origin); missile.think = turret_hk_missile_think; diff --git a/qcsrc/common/turrets/turret/machinegun_weapon.qc b/qcsrc/common/turrets/turret/machinegun_weapon.qc index 9b1489829..a20bdb22c 100644 --- a/qcsrc/common/turrets/turret/machinegun_weapon.qc +++ b/qcsrc/common/turrets/turret/machinegun_weapon.qc @@ -30,7 +30,7 @@ METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, bool actor.tur_head = actor; weapon_thinkf(actor, WFRAME_FIRE1, 0, w_ready); } - fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN, 0); + fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0); W_MachineGun_MuzzleFlash(); setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire"); } diff --git a/qcsrc/common/turrets/turret/mlrs_weapon.qc b/qcsrc/common/turrets/turret/mlrs_weapon.qc index 3b420f329..059335913 100644 --- a/qcsrc/common/turrets/turret/mlrs_weapon.qc +++ b/qcsrc/common/turrets/turret/mlrs_weapon.qc @@ -30,7 +30,7 @@ METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1 weapon_thinkf(actor, WFRAME_FIRE1, 0, w_ready); } turret_tag_fire_update(); - entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_MLRS, PROJECTILE_ROCKET, TRUE, TRUE); + entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_MLRS.m_id, PROJECTILE_ROCKET, TRUE, TRUE); missile.nextthink = time + max(actor.tur_impacttime,(actor.shot_radius * 2) / actor.shot_speed); missile.missile_flags = MIF_SPLASH; te_explosion (missile.origin); diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index 2cb036bc5..c4529ae26 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -95,7 +95,7 @@ void beam_think() self.shot_force, this.shot_dmg, 0.75, - DEATH_TURRET_PHASER); + DEATH_TURRET_PHASER.m_id); setself(this); self.scale = vlen(self.owner.tur_shotorg - trace_endpos) / 256; diff --git a/qcsrc/common/turrets/turret/plasma.qc b/qcsrc/common/turrets/turret/plasma.qc index 7c40299aa..318f4e8ae 100644 --- a/qcsrc/common/turrets/turret/plasma.qc +++ b/qcsrc/common/turrets/turret/plasma.qc @@ -31,7 +31,7 @@ METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this)) if(g_instagib) { FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000, - 800, 0, 0, 0, 0, DEATH_TURRET_PLASMA); + 800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id); Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); diff --git a/qcsrc/common/turrets/turret/plasma_dual.qc b/qcsrc/common/turrets/turret/plasma_dual.qc index e1143bc04..387ae44a5 100644 --- a/qcsrc/common/turrets/turret/plasma_dual.qc +++ b/qcsrc/common/turrets/turret/plasma_dual.qc @@ -32,7 +32,7 @@ METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret this)) { if (g_instagib) { FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000, - 800, 0, 0, 0, 0, DEATH_TURRET_PLASMA); + 800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id); Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1); diff --git a/qcsrc/common/turrets/turret/plasma_weapon.qc b/qcsrc/common/turrets/turret/plasma_weapon.qc index 65a663057..2141fe64f 100644 --- a/qcsrc/common/turrets/turret/plasma_weapon.qc +++ b/qcsrc/common/turrets/turret/plasma_weapon.qc @@ -27,7 +27,7 @@ METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bo actor.tur_head = actor; weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); } - entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, true, true); + entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA.m_id, PROJECTILE_ELECTRO_BEAM, true, true); missile.missile_flags = MIF_SPLASH; Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1); } diff --git a/qcsrc/common/turrets/turret/tesla_weapon.qc b/qcsrc/common/turrets/turret/tesla_weapon.qc index 3a8eb1d52..4391472f7 100644 --- a/qcsrc/common/turrets/turret/tesla_weapon.qc +++ b/qcsrc/common/turrets/turret/tesla_weapon.qc @@ -96,7 +96,7 @@ entity toast(entity from, float range, float damage) if (etarget) { te_csqc_lightningarc(from.origin,etarget.origin); - Damage(etarget, self, self, damage, DEATH_TURRET_TESLA, etarget.origin, '0 0 0'); + Damage(etarget, self, self, damage, DEATH_TURRET_TESLA.m_id, etarget.origin, '0 0 0'); etarget.railgunhit = 1; } diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index e629ada79..cbdeb5e8e 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -88,7 +88,7 @@ void walker_melee_do_dmg() { if (turret_validate_target(self, e, self.target_validate_flags)) if (e != self && e.owner != self) - Damage(e, self, self, (autocvar_g_turrets_unit_walker_melee_damage), DEATH_TURRET_WALK_MELEE, '0 0 0', v_forward * (autocvar_g_turrets_unit_walker_melee_force)); + Damage(e, self, self, (autocvar_g_turrets_unit_walker_melee_damage), DEATH_TURRET_WALK_MELEE.m_id, '0 0 0', v_forward * (autocvar_g_turrets_unit_walker_melee_force)); e = e.chain; } @@ -101,7 +101,7 @@ void walker_setnoanim() } void walker_rocket_explode() {SELFPARAM(); - RadiusDamage (self, self.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), self, world, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET, world); + RadiusDamage (self, self.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), self, world, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, world); remove (self); } diff --git a/qcsrc/common/turrets/turret/walker_weapon.qc b/qcsrc/common/turrets/turret/walker_weapon.qc index 9a54f810f..4da45df7f 100644 --- a/qcsrc/common/turrets/turret/walker_weapon.qc +++ b/qcsrc/common/turrets/turret/walker_weapon.qc @@ -28,7 +28,7 @@ METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, bool fir weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); } sound (actor, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM); - fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN, 0); + fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0); Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1); } } diff --git a/qcsrc/common/util-pre.qh b/qcsrc/common/util-pre.qh index ad9be12cb..d1267460c 100644 --- a/qcsrc/common/util-pre.qh +++ b/qcsrc/common/util-pre.qh @@ -114,6 +114,7 @@ #define GETTER(type, name) type GET(name)() { return name; } #define BIT(n) (1 << (n)) +#define BITS(n) (BIT(n) - 1) #ifndef BRANCHLESS_BITSET #define BITSET(var, mask, flag) (flag ? (var) | (mask) : (var) &~ (mask)) #else diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 4b6a346ff..123dc5062 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -7,7 +7,7 @@ #include "../client/mutators/events.qh" #include "mapinfo.qh" #include "notifications.qh" - #include "deathtypes.qh" + #include "deathtypes/all.qh" #elif defined(MENUQC) #elif defined(SVQC) #include "../dpdefs/progsdefs.qh" @@ -17,7 +17,7 @@ #include "../server/defs.qh" #include "../server/mutators/events.qh" #include "notifications.qh" - #include "deathtypes.qh" + #include "deathtypes/all.qh" #include "mapinfo.qh" #endif @@ -1766,7 +1766,7 @@ vector healtharmor_maxdamage(float h, float a, float armorblock, int deathtype) { // NOTE: we'll always choose the SMALLER value... float healthdamage, armordamage, armorideal; - if (deathtype == DEATH_DROWN) // Why should armor help here... + if (DEATH_IS(deathtype, DEATH_DROWN)) // Why should armor help here... armorblock = 0; vector v; healthdamage = (h - 1) / (1 - armorblock); // damage we can take if we could use more health @@ -1789,7 +1789,7 @@ vector healtharmor_maxdamage(float h, float a, float armorblock, int deathtype) vector healtharmor_applydamage(float a, float armorblock, int deathtype, float damage) { vector v; - if (deathtype == DEATH_DROWN) // Why should armor help here... + if (DEATH_IS(deathtype, DEATH_DROWN)) // Why should armor help here... armorblock = 0; v.y = bound(0, damage * armorblock, a); // save v.x = bound(0, damage - v.y, damage); // take diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index c2e41dd94..872729899 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -654,22 +654,22 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, int deatht self.dmg_time = time; // WEAPONTODO - if(DEATH_ISWEAPON(deathtype, WEP_VORTEX.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_VORTEX)) damage *= autocvar_g_vehicles_vortex_damagerate; - if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN)) damage *= autocvar_g_vehicles_machinegun_damagerate; - if(DEATH_ISWEAPON(deathtype, WEP_RIFLE.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_RIFLE)) damage *= autocvar_g_vehicles_rifle_damagerate; - if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER)) damage *= autocvar_g_vehicles_vaporizer_damagerate; - if(DEATH_ISWEAPON(deathtype, WEP_SEEKER.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_SEEKER)) damage *= autocvar_g_vehicles_tag_damagerate; - if(DEATH_WEAPONOFWEAPONDEATH(deathtype)) + if(DEATH_WEAPONOF(deathtype) != WEP_Null) damage *= autocvar_g_vehicles_weapon_damagerate; self.enemy = attacker; @@ -767,7 +767,7 @@ void vehicles_impact(float _minspeed, float _speedfac, float _maxpain) if(_minspeed < wc) { float take = min(_speedfac * wc, _maxpain); - Damage (self, world, world, take, DEATH_FALL, self.origin, '0 0 0'); + Damage (self, world, world, take, DEATH_FALL.m_id, self.origin, '0 0 0'); self.play_time = time + 0.25; //dprint("wc: ", ftos(wc), "\n"); @@ -938,7 +938,7 @@ void vehicles_touch() if(vehicles_crushable(other)) { if(vlen(self.velocity) >= 30) - Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force); + Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force); return; // Dont do selfdamage when hitting "soft targets". } diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index b64ac0203..45003cb29 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -557,7 +557,7 @@ float bumblebee_pilot_frame() { if(autocvar_g_vehicle_bumblebee_raygun) { - Damage(trace_ent, vehic, pilot, autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime, DEATH_GENERIC, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * sys_frametime); + Damage(trace_ent, vehic, pilot, autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime, DEATH_GENERIC.m_id, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * sys_frametime); vehic.vehicle_energy -= autocvar_g_vehicle_bumblebee_raygun_aps * sys_frametime; } else @@ -698,7 +698,7 @@ void bumblebee_blowup() autocvar_g_vehicle_bumblebee_blowup_edgedamage, autocvar_g_vehicle_bumblebee_blowup_radius, self, world, autocvar_g_vehicle_bumblebee_blowup_forceintensity, - DEATH_VH_BUMB_DEATH, world); + DEATH_VH_BUMB_DEATH.m_id, world); sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(EFFECT_EXPLOSION_BIG, (self.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1); diff --git a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc index 79252e13c..722c6852e 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc @@ -25,7 +25,7 @@ void bumblebee_fire_cannon(entity _gun, string _tagname, entity _owner) vehicles_projectile(EFFECT_BIGPLASMA_MUZZLEFLASH.eent_eff_name, SND(VEH_BUMBLEBEE_FIRE), v, normalize(v_forward + randomvec() * autocvar_g_vehicle_bumblebee_cannon_spread) * autocvar_g_vehicle_bumblebee_cannon_speed, autocvar_g_vehicle_bumblebee_cannon_damage, autocvar_g_vehicle_bumblebee_cannon_radius, autocvar_g_vehicle_bumblebee_cannon_force, 0, - DEATH_VH_BUMB_GUN, PROJECTILE_BUMBLE_GUN, 0, true, true, _owner); + DEATH_VH_BUMB_GUN.m_id, PROJECTILE_BUMBLE_GUN, 0, true, true, _owner); } bool bumble_raygun_send(entity this, entity to, float sf) diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 2b5950a25..d860dba11 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -482,7 +482,7 @@ void racer_blowup() autocvar_g_vehicle_racer_blowup_edgedamage, autocvar_g_vehicle_racer_blowup_radius, world, world, autocvar_g_vehicle_racer_blowup_forceintensity, - DEATH_VH_WAKI_DEATH, world); + DEATH_VH_WAKI_DEATH.m_id, world); self.nextthink = time + autocvar_g_vehicle_racer_respawntime; self.think = vehicles_spawn; diff --git a/qcsrc/common/vehicles/vehicle/racer_weapon.qc b/qcsrc/common/vehicles/vehicle/racer_weapon.qc index d5a4c1231..6a2339f1e 100644 --- a/qcsrc/common/vehicles/vehicle/racer_weapon.qc +++ b/qcsrc/common/vehicles/vehicle/racer_weapon.qc @@ -59,7 +59,7 @@ METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, bool fire1, boo entity bolt = vehicles_projectile(EFFECT_RACER_MUZZLEFLASH.eent_eff_name, SND(LASERGUN_FIRE), org, normalize(v_forward + randomvec() * autocvar_g_vehicle_racer_cannon_spread) * autocvar_g_vehicle_racer_cannon_speed, autocvar_g_vehicle_racer_cannon_damage, autocvar_g_vehicle_racer_cannon_radius, autocvar_g_vehicle_racer_cannon_force, 0, - DEATH_VH_WAKI_GUN, PROJECTILE_WAKICANNON, 0, true, true, player); + DEATH_VH_WAKI_GUN.m_id, PROJECTILE_WAKICANNON, 0, true, true, player); bolt.velocity = normalize(dir) * autocvar_g_vehicle_racer_cannon_speed; weapon_thinkf(player, WFRAME_FIRE1, 0, w_ready); } @@ -88,7 +88,7 @@ void racer_fire_rocket(vector org, vector dir, entity trg) entity rocket = vehicles_projectile(EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE), org, dir * autocvar_g_vehicle_racer_rocket_speed, autocvar_g_vehicle_racer_rocket_damage, autocvar_g_vehicle_racer_rocket_radius, autocvar_g_vehicle_racer_rocket_force, 3, - DEATH_VH_WAKI_ROCKET, PROJECTILE_WAKIROCKET, 20, false, false, self.owner); + DEATH_VH_WAKI_ROCKET.m_id, PROJECTILE_WAKIROCKET, 20, false, false, self.owner); rocket.lip = autocvar_g_vehicle_racer_rocket_accel * sys_frametime; rocket.wait = autocvar_g_vehicle_racer_rocket_turnrate; diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 1f623379e..1c5c85b8d 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -524,7 +524,7 @@ void raptor_blowup() {SELFPARAM(); self.deadflag = DEAD_DEAD; self.vehicle_exit(VHEF_NORMAL); - RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH, world); + RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH.m_id, world); self.alpha = -1; self.movetype = MOVETYPE_NONE; diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index 9c2fd0e5f..c53002bd4 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -73,7 +73,7 @@ METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, bool fire1, bo vehicles_projectile(EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, SND(LASERGUN_FIRE), org, normalize(dir + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed, autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force, 0, - DEATH_VH_RAPT_CANNON, PROJECTILE_RAPTORCANNON, 0, true, true, veh ? veh : player); + DEATH_VH_RAPT_CANNON.m_id, PROJECTILE_RAPTORCANNON, 0, true, true, veh ? veh : player); weapon_thinkf(player, WFRAME_FIRE1, 0, w_ready); } } @@ -144,7 +144,7 @@ void raptor_bomblet_boom() RadiusDamage (self, self.realowner, autocvar_g_vehicle_raptor_bomblet_damage, autocvar_g_vehicle_raptor_bomblet_edgedamage, autocvar_g_vehicle_raptor_bomblet_radius, world, world, - autocvar_g_vehicle_raptor_bomblet_force, DEATH_VH_RAPT_BOMB, world); + autocvar_g_vehicle_raptor_bomblet_force, DEATH_VH_RAPT_BOMB.m_id, world); remove(self); } @@ -175,7 +175,7 @@ void raptor_bomb_burst() entity bomblet; float i; - Damage_DamageInfo(self.origin, 0, 0, 0, '0 0 0', DEATH_VH_RAPT_FRAGMENT, 0, self); + Damage_DamageInfo(self.origin, 0, 0, 0, '0 0 0', DEATH_VH_RAPT_FRAGMENT.m_id, 0, self); for(i = 0; i < autocvar_g_vehicle_raptor_bomblets; ++i) { diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index ee79966ef..cf1be2432 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -291,7 +291,7 @@ float spiderbot_frame() v += v_forward * 50; fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration, - autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0); + autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0); sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM); //trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos); @@ -483,7 +483,7 @@ void spiderbot_blowup() SUB_SetFade(g1, time, min(self.respawntime, 10)); SUB_SetFade(g2, time, min(self.respawntime, 10)); - RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_SPID_DEATH, world); + RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_SPID_DEATH.m_id, world); self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1; self.movetype = MOVETYPE_NONE; diff --git a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc index 0960fca2a..421a15a91 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc @@ -219,7 +219,7 @@ void spiderbot_rocket_do() rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE), v, normalize(randomvec() * autocvar_g_vehicle_spiderbot_rocket_spread + v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed, autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1, - DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner); + DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner); crosshair_trace(self.owner); float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos); _dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ; @@ -233,7 +233,7 @@ void spiderbot_rocket_do() rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE), v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed, autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1, - DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, self.owner); + DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, self.owner); crosshair_trace(self.owner); rocket.pos1 = trace_endpos; rocket.nextthink = time; @@ -245,7 +245,7 @@ void spiderbot_rocket_do() rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE), v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed, autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1, - DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner); + DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner); crosshair_trace(self.owner); diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 2c72d380f..57e46bd5c 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -14,7 +14,7 @@ #include "../util.qh" #include "../buffs/all.qh" #include "../../client/autocvars.qh" - #include "../deathtypes.qh" + #include "../deathtypes/all.qh" #include "../../csqcmodellib/interpolate.qh" #include "../movetypes/movetypes.qh" #include "../../client/main.qh" @@ -41,7 +41,7 @@ #include "../../server/constants.qh" #include "../../server/defs.qh" #include "../notifications.qh" - #include "../deathtypes.qh" + #include "../deathtypes/all.qh" #include "../../server/mutators/mutators_include.qh" #include "../mapinfo.qh" #include "../../server/command/common.qh" diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 9912174dd..7ecacb29a 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -10,7 +10,7 @@ #include "weapons/tracing.qh" #include "../common/constants.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/effects/effects.qh" #include "../common/util.qh" @@ -287,7 +287,7 @@ float CheatImpulse(float i) e2 = spawn(); setorigin(e2, e.origin); - RadiusDamage(e2, self, 1000, 0, 128, world, world, 500, DEATH_CHEAT, e); + RadiusDamage(e2, self, 1000, 0, 128, world, world, 500, DEATH_CHEAT.m_id, e); remove(e2); LOG_INFO("404 Sportsmanship not found.\n"); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 0d0d356a9..561180734 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -811,7 +811,7 @@ void ClientKill_Now() if(!self.killindicator_teamchange) { self.vehicle_health = -1; - Damage(self, self, self, 1 , DEATH_KILL, self.origin, '0 0 0'); + Damage(self, self, self, 1 , DEATH_KILL.m_id, self.origin, '0 0 0'); } } @@ -824,7 +824,7 @@ void ClientKill_Now() ClientKill_Now_TeamChange(); if(IS_PLAYER(self)) - Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0'); + Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0'); // now I am sure the player IS dead } @@ -1658,7 +1658,7 @@ void player_regen (void) { if(self.vehicle) vehicles_exit(VHEF_RELEASE); - self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0'); + self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0'); } if (!(self.items & IT_UNLIMITED_WEAPON_AMMO)) @@ -2358,7 +2358,7 @@ void PlayerPreThink (void) { if(self.vehicle) vehicles_exit(VHEF_RELEASE); - self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE, self.origin, '0 0 0'); + self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0'); } else if ( self.revive_progress <= 0 ) Unfreeze(self); @@ -2714,7 +2714,7 @@ void PlayerPostThink (void) */ if(self.waypointsprite_attachedforcarrier) - WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON)); + WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id)); playerdemo_write(); diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index e94ba6283..9e7f8a14b 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -13,7 +13,7 @@ #include "command/common.qh" #include "../common/animdecide.qh" #include "../common/csqcmodel_settings.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/triggers/subs.qh" #include "../common/playerstats.qh" #include "../csqcmodellib/sv_model.qh" @@ -323,7 +323,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0)); } - if(DEATH_ISWEAPON(deathtype, WEP_TUBA.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_TUBA)) { // tuba causes blood to come out of the ears vector ear1, ear2; @@ -434,11 +434,11 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp } if(sound_allowed(MSG_BROADCAST, attacker)) - if((self.health < 2 * WEP_CVAR_PRI(blaster, damage) * autocvar_g_balance_selfdamagepercent + 1) || !((get_weaponinfo(DEATH_WEAPONOF(deathtype))).spawnflags & WEP_FLAG_CANCLIMB) || attacker != self) // WEAPONTODO: create separate limit for pain notification with laser + if((self.health < 2 * WEP_CVAR_PRI(blaster, damage) * autocvar_g_balance_selfdamagepercent + 1) || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || attacker != self) // WEAPONTODO: create separate limit for pain notification with laser if(self.health > 1) // exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two { - if(deathtype == DEATH_FALL) + if(deathtype == DEATH_FALL.m_id) PlayerSound(playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND); else if(self.health > 75) // TODO make a "gentle" version? PlayerSound(playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND); @@ -469,12 +469,12 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp self.dmg_take = self.dmg_take + take;//max(take - 10, 0); self.dmg_inflictor = inflictor; - float abot, vbot, awep; + float abot, vbot; abot = (IS_BOT_CLIENT(attacker)); vbot = (IS_BOT_CLIENT(self)); valid_damage_for_weaponstats = 0; - awep = 0; + Weapon awep = WEP_Null; if(vbot || IS_REAL_CLIENT(self)) if(abot || IS_REAL_CLIENT(attacker)) @@ -482,7 +482,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp if(DIFF_TEAM(self, attacker)) { if(DEATH_ISSPECIAL(deathtype)) - awep = attacker.weapon; + awep = get_weaponinfo(attacker.weapon); else awep = DEATH_WEAPONOF(deathtype); valid_damage_for_weaponstats = 1; @@ -492,7 +492,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp { dh = dh - max(self.health, 0); da = da - max(self.armorvalue, 0); - WeaponStats_LogDamage(awep, abot, self.weapon, vbot, dh + da); + WeaponStats_LogDamage(awep.m_id, abot, self.weapon, vbot, dh + da); MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc); } @@ -508,12 +508,12 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp } if(valid_damage_for_weaponstats) - WeaponStats_LogKill(awep, abot, self.weapon, vbot); + WeaponStats_LogKill(awep.m_id, abot, self.weapon, vbot); if(autocvar_sv_gentle < 1) // TODO make a "gentle" version? if(sound_allowed(MSG_BROADCAST, attacker)) { - if(deathtype == DEATH_DROWN) + if(deathtype == DEATH_DROWN.m_id) PlayerSound(playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND); else PlayerSound(playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND); @@ -528,7 +528,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp defer_ClientKill_Now_TeamChange = true; if(self.classname == "body") - if(deathtype == DEATH_KILL) + if(deathtype == DEATH_KILL.m_id) { // for the lemmings fans, a small harmless explosion Send_Effect(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1); @@ -540,10 +540,10 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp Obituary (attacker, inflictor, self, deathtype); // increment frag counter for used weapon type - int w = DEATH_WEAPONOF(deathtype); - if(WEP_VALID(w)) + Weapon w = DEATH_WEAPONOF(deathtype); + if(w != WEP_Null) if(accuracy_isgooddamage(attacker, self)) - attacker.accuracy.(accuracy_frags[w-1]) += 1; + attacker.accuracy.(accuracy_frags[w.m_id-1]) += 1; MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype); excess = frag_damage; @@ -1273,7 +1273,7 @@ void MoveToTeam(entity client, float team_colour, float type) TeamchangeFrags(client); // move the players frags SetPlayerColors(client, team_colour - 1); // set the players colour - Damage(client, client, client, 100000, DEATH_AUTOTEAMCHANGE, client.origin, '0 0 0'); // kill the player + Damage(client, client, client, 100000, DEATH_AUTOTEAMCHANGE.m_id, client.origin, '0 0 0'); // kill the player lockteams = lockteams_backup; // restore the team lock diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index f849deb6a..c10518232 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -20,7 +20,7 @@ #endif #include "../../common/constants.qh" -#include "../../common/deathtypes.qh" +#include "../../common/deathtypes/all.qh" #include "../../common/mapinfo.qh" #include "../../common/notifications.qh" #include "../../common/teams.qh" diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 5ddea150a..56ad64459 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -392,7 +392,7 @@ void CommonCommand_editmob(int request, entity caller, int argc) if(mon.realowner != caller && autocvar_g_monsters_edit < 2) { print_to(caller, "This monster does not belong to you"); return; } if(!is_visible) { print_to(caller, "You must look at your monster to edit it"); return; } - Damage (mon, world, world, mon.health + mon.max_health + 200, DEATH_KILL, mon.origin, '0 0 0'); + Damage (mon, world, world, mon.health + mon.max_health + 200, DEATH_KILL.m_id, mon.origin, '0 0 0'); print_to(caller, strcat("Your pet '", mon.monster_name, "' has been brutally mutilated")); return; } diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 5cae69239..ca715c722 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -12,7 +12,7 @@ #include "weapons/selection.qh" #include "../common/buffs/all.qh" #include "../common/constants.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/notifications.qh" #include "../common/movetypes/movetypes.qh" #include "../common/playerstats.qh" @@ -98,14 +98,13 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) if(g_weaponarena_random) { // after a frag, exchange the current weapon (or the culprit, if detectable) by a new random weapon - float culprit; - culprit = DEATH_WEAPONOF(deathtype); + Weapon culprit = DEATH_WEAPONOF(deathtype); if(!culprit) - culprit = attacker.weapon; - else if(!(attacker.weapons & WepSet_FromWeapon(culprit))) - culprit = attacker.weapon; + culprit = get_weaponinfo(attacker.weapon); + else if(!(attacker.weapons & WepSet_FromWeapon(culprit.m_id))) + culprit = get_weaponinfo(attacker.weapon); - if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER.m_id) // WEAPONTODO: Shouldn't this be in a mutator? + if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER) // WEAPONTODO: Shouldn't this be in a mutator? { // no exchange } @@ -124,7 +123,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) // all others (including the culprit): remove GiveFrags_randomweapons.weapons &= ~attacker.weapons; - GiveFrags_randomweapons.weapons &= ~WepSet_FromWeapon(culprit); + GiveFrags_randomweapons.weapons &= ~WepSet_FromWeapon(culprit.m_id); // among the remaining ones, choose one by random W_RandomWeapons(GiveFrags_randomweapons, 1); @@ -132,7 +131,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) if(GiveFrags_randomweapons.weapons) { attacker.weapons |= GiveFrags_randomweapons.weapons; - attacker.weapons &= ~WepSet_FromWeapon(culprit); + attacker.weapons &= ~WepSet_FromWeapon(culprit.m_id); } } @@ -203,7 +202,7 @@ void Obituary_SpecialDeath( { if(DEATH_ISSPECIAL(deathtype)) { - entity deathent = deathtypes[(deathtype - DT_FIRST)]; + entity deathent = Deathtypes[deathtype - DT_FIRST]; if (!deathent) { backtrace("Obituary_SpecialDeath: Could not find deathtype entity!\n"); return; } if(murder) @@ -261,12 +260,11 @@ float Obituary_WeaponDeath( string s1, string s2, string s3, float f1, float f2) { - float death_weapon = DEATH_WEAPONOF(deathtype); - if(death_weapon) + Weapon death_weapon = DEATH_WEAPONOF(deathtype); + if (death_weapon != WEP_Null) { w_deathtype = deathtype; - Weapon w = get_weaponinfo(death_weapon); - int death_message = ((murder) ? w.wr_killmessage : w.wr_suicidemessage)(w); + int death_message = ((murder) ? death_weapon.wr_killmessage(death_weapon) : death_weapon.wr_suicidemessage(death_weapon)); w_deathtype = false; if (death_message) @@ -336,13 +334,13 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) { if(DEATH_ISSPECIAL(deathtype)) { - if(deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE) + if(deathtype == DEATH_TEAMCHANGE.m_id || deathtype == DEATH_AUTOTEAMCHANGE.m_id) { Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.team, 0, 0); } else { - switch(deathtype) + switch(DEATH_ENT(deathtype)) { case DEATH_MIRRORDAMAGE: { @@ -473,7 +471,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) } float f3 = 0; - if(deathtype == DEATH_BUFF) + if(deathtype == DEATH_BUFF.m_id) f3 = attacker.buffs; if (!Obituary_WeaponDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker)) @@ -486,7 +484,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) // ============= else { - switch(deathtype) + switch(DEATH_ENT(deathtype)) { // For now, we're just forcing HURTTRIGGER to behave as "DEATH_VOID" and giving it no special options... // Later on you will only be able to make custom messages using DEATH_CUSTOM, @@ -642,7 +640,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d RemoveGrapplingHook(targ); // STOP THAT, you parasite! // special rule: gravity bomb does not hit team mates (other than for disconnecting the hook) - if(DEATH_ISWEAPON(deathtype, WEP_HOOK.m_id) || DEATH_ISWEAPON(deathtype, WEP_TUBA.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_HOOK) || DEATH_ISWEAPON(deathtype, WEP_TUBA)) { if(IS_PLAYER(targ)) if(SAME_TEAM(targ, attacker)) @@ -652,7 +650,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d } } - if(deathtype == DEATH_KILL || deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE) + if(deathtype == DEATH_KILL.m_id || deathtype == DEATH_TEAMCHANGE.m_id || deathtype == DEATH_AUTOTEAMCHANGE.m_id) { // exit the vehicle before killing (fixes a crash) if(IS_PLAYER(targ) && targ.vehicle) @@ -667,14 +665,14 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d targ.flags -= targ.flags & FL_GODMODE; damage = 100000; } - else if(deathtype == DEATH_MIRRORDAMAGE || deathtype == DEATH_NOAMMO) + else if(deathtype == DEATH_MIRRORDAMAGE.m_id || deathtype == DEATH_NOAMMO.m_id) { // no processing } else { // nullify damage if teamplay is on - if(deathtype != DEATH_TELEFRAG) + if(deathtype != DEATH_TELEFRAG.m_id) if(IS_PLAYER(attacker)) { if(IS_PLAYER(targ) && targ != attacker && (IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(targ))) @@ -746,10 +744,10 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d force = frag_force; if(targ.frozen) - if(deathtype != DEATH_HURTTRIGGER && deathtype != DEATH_TEAMCHANGE && deathtype != DEATH_AUTOTEAMCHANGE) + if(deathtype != DEATH_HURTTRIGGER.m_id && deathtype != DEATH_TEAMCHANGE.m_id && deathtype != DEATH_AUTOTEAMCHANGE.m_id) { if(autocvar_g_freezetag_revive_falldamage > 0) - if(deathtype == DEATH_FALL) + if(deathtype == DEATH_FALL.m_id) if(damage >= autocvar_g_freezetag_revive_falldamage) { Unfreeze(targ); @@ -763,7 +761,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d force *= autocvar_g_freezetag_frozen_force; } - if(targ.frozen && deathtype == DEATH_HURTTRIGGER && !autocvar_g_freezetag_frozen_damage_trigger) + if(targ.frozen && deathtype == DEATH_HURTTRIGGER.m_id && !autocvar_g_freezetag_frozen_damage_trigger) { Send_Effect(EFFECT_TELEPORT, targ.origin, '0 0 0', 1); @@ -828,7 +826,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d // count the damage if(attacker) if(!targ.deadflag) - if(deathtype != DEATH_BUFF) + if(deathtype != DEATH_BUFF.m_id) if(targ.takedamage == DAMAGE_AIM) if(targ != attacker) { @@ -844,7 +842,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d { if(damage > 0) { - if(deathtype != DEATH_FIRE) + if(deathtype != DEATH_FIRE.m_id) { if(victim.BUTTON_CHAT) attacker.typehitsound += 1; @@ -865,7 +863,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d } else { - if(deathtype != DEATH_FIRE) + if(deathtype != DEATH_FIRE.m_id) { attacker.typehitsound += 1; } @@ -922,7 +920,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d attacker = attacker_save; force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce; - Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force); + Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE.m_id, attacker.origin, force); } } @@ -952,7 +950,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in total_damage_to_creatures = 0; if(deathtype != (WEP_HOOK.m_id | HITTYPE_SECONDARY | HITTYPE_BOUNCE)) // only send gravity bomb damage once - if(DEATH_WEAPONOF(deathtype) != WEP_TUBA.m_id) // do not send tuba damage (bandwidth hog) + if(DEATH_WEAPONOF(deathtype) != WEP_TUBA) // do not send tuba damage (bandwidth hog) { force = inflictorvelocity; if(vlen(force) == 0) @@ -1110,7 +1108,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in RadiusDamage_running = 0; if(!DEATH_ISSPECIAL(deathtype)) - accuracy_add(attacker, DEATH_WEAPONOF(deathtype), 0, min(coredamage, stat_damagedone)); + accuracy_add(attacker, DEATH_WEAPONOF(deathtype).m_id, 0, min(coredamage, stat_damagedone)); return total_damage_to_creatures; } @@ -1226,7 +1224,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt) } } if(accuracy_isgooddamage(o, e)) - accuracy_add(o, DEATH_WEAPONOF(dt), 0, max(0, totaldamage - mindamage)); + accuracy_add(o, DEATH_WEAPONOF(dt).m_id, 0, max(0, totaldamage - mindamage)); return max(0, totaldamage - mindamage); // can never be negative, but to make sure } else @@ -1240,7 +1238,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt) e.fire_owner = o; e.fire_hitsound = false; if(accuracy_isgooddamage(o, e)) - accuracy_add(o, DEATH_WEAPONOF(dt), 0, d); + accuracy_add(o, DEATH_WEAPONOF(dt).m_id, 0, d); return d; } } @@ -1290,7 +1288,7 @@ void Fire_ApplyDamage(entity e) { t = autocvar_g_balance_firetransfer_time * (e.fire_endtime - time); d = autocvar_g_balance_firetransfer_damage * e.fire_damagepersec * t; - Fire_AddDamage(other, o, d, t, DEATH_FIRE); + Fire_AddDamage(other, o, d, t, DEATH_FIRE.m_id); } } } diff --git a/qcsrc/server/g_damage.qh b/qcsrc/server/g_damage.qh index e7430690e..4df5303b2 100644 --- a/qcsrc/server/g_damage.qh +++ b/qcsrc/server/g_damage.qh @@ -19,7 +19,7 @@ #include "constants.qh" #include "defs.qh" #include "../common/notifications.qh" - #include "../common/deathtypes.qh" + #include "../common/deathtypes/all.qh" #include "mutators/mutators_include.qh" #include "../common/turrets/sv_turrets.qh" #include "../common/vehicles/all.qh" diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index d6ffeeb5d..f72ebc02f 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -21,7 +21,7 @@ #include "weapons/weaponstats.qh" #include "../common/buffs/all.qh" #include "../common/constants.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/effects/effects.qh" #include "../common/mapinfo.qh" #include "../common/monsters/all.qh" @@ -557,8 +557,6 @@ spawnfunc(__init_dedicated_server) // needs to be done so early because of the constants they create static_init(); - CALL_ACCUMULATED_FUNCTION(RegisterNotifications); - CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes); MapInfo_Enumerate(); MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0); @@ -604,7 +602,6 @@ spawnfunc(worldspawn) // needs to be done so early because of the constants they create static_init(); CALL_ACCUMULATED_FUNCTION(RegisterNotifications); - CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes); ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid)); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 57bbd51d0..875cdc412 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -12,7 +12,7 @@ #include "weapons/selection.qh" #include "../common/command/generic.qh" #include "../common/constants.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/mapinfo.qh" #include "../common/notifications.qh" #include "../common/playerstats.qh" diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index 007de3cac..ca8c41e9b 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -135,7 +135,7 @@ void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomo #define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) -#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP)) +#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id)) #define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return diff --git a/qcsrc/server/mutators/gamemode.qh b/qcsrc/server/mutators/gamemode.qh index d2066b9ab..77b959ed7 100644 --- a/qcsrc/server/mutators/gamemode.qh +++ b/qcsrc/server/mutators/gamemode.qh @@ -29,7 +29,7 @@ #include "../weapons/tracing.qh" #include "../weapons/weaponsystem.qh" -#include "../../common/deathtypes.qh" +#include "../../common/deathtypes/all.qh" #include "../../common/notifications.qh" #include "../../common/triggers/teleporters.qh" #include "../../common/triggers/subs.qh" diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index 570fc3801..a368fff78 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -319,7 +319,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage) { if(IS_PLAYER(frag_target)) if(frag_target.deadflag == DEAD_NO) - if(frag_target == frag_attacker || SAME_TEAM(frag_target, frag_attacker) || frag_deathtype == DEATH_FALL) + if(frag_target == frag_attacker || SAME_TEAM(frag_target, frag_attacker) || frag_deathtype == DEATH_FALL.m_id) frag_damage = 0; frag_mirrordamage = 0; diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 108b8dda6..da2e76f8b 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -53,8 +53,8 @@ void ctf_CaptureRecord(entity flag, entity player) void ctf_FlagcarrierWaypoints(entity player) { WaypointSprite_Spawn(WP_FlagCarrier, 0, 0, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_flagcarrier, true, RADARICON_FLAG); - WaypointSprite_UpdateMaxHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON) * 2); - WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON)); + WaypointSprite_UpdateMaxHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id) * 2); + WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id)); WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, WPCOLOR_FLAGCARRIER(player.team)); } @@ -194,7 +194,7 @@ void ctf_CaptureShield_Touch() vector mymid = (self.absmin + self.absmax) * 0.5; vector othermid = (other.absmin + other.absmax) * 0.5; - Damage(other, self, self, 0, DEATH_HURTTRIGGER, mymid, normalize(othermid - mymid) * ctf_captureshield_force); + Damage(other, self, self, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ctf_captureshield_force); if(IS_REAL_CLIENT(other)) { Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED); } } @@ -1518,7 +1518,7 @@ void havocbot_role_ctf_carrier() { // Can't navigate to my own base, suicide! // TODO: drop it and wander around - Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0'); + Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0'); return; } } @@ -1936,7 +1936,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink) // update the health of the flag carrier waypointsprite if(self.wps_flagcarrier) - WaypointSprite_UpdateHealth(self.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON)); + WaypointSprite_UpdateHealth(self.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id)); return false; } @@ -1958,7 +1958,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerDamage) // for changing damage and force values t } else if(frag_target.flagcarried && (frag_target.deadflag == DEAD_NO) && CTF_DIFFTEAM(frag_target, frag_attacker)) // if the target is a flagcarrier { - if(autocvar_g_ctf_flagcarrier_auto_helpme_damage > ('1 0 0' * healtharmor_maxdamage(frag_target.health, frag_target.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON))) + if(autocvar_g_ctf_flagcarrier_auto_helpme_damage > ('1 0 0' * healtharmor_maxdamage(frag_target.health, frag_target.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id))) if(time > frag_target.wps_helpme_time + autocvar_g_ctf_flagcarrier_auto_helpme_time) { frag_target.wps_helpme_time = time; diff --git a/qcsrc/server/mutators/gamemode_cts.qc b/qcsrc/server/mutators/gamemode_cts.qc index f9b478232..04357de9c 100644 --- a/qcsrc/server/mutators/gamemode_cts.qc +++ b/qcsrc/server/mutators/gamemode_cts.qc @@ -267,7 +267,7 @@ MUTATOR_HOOKFUNCTION(cts_FilterItem) MUTATOR_HOOKFUNCTION(cts_PlayerDamage) { - if(frag_target == frag_attacker || frag_deathtype == DEATH_FALL) + if(frag_target == frag_attacker || frag_deathtype == DEATH_FALL.m_id) if(!autocvar_g_cts_selfdamage) frag_damage = 0; diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index e7790c974..d8d792ad6 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -342,7 +342,7 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerDies) // Cases DEATH_TEAMCHANGE and DEATH_AUTOTEAMCHANGE are needed to fix a bug whe // you succeed changing team through the menu: you both really die (gibbing) and get frozen if(ITEM_DAMAGE_NEEDKILL(frag_deathtype) - || frag_deathtype == DEATH_TEAMCHANGE || frag_deathtype == DEATH_AUTOTEAMCHANGE) + || frag_deathtype == DEATH_TEAMCHANGE.m_id || frag_deathtype == DEATH_AUTOTEAMCHANGE.m_id) { // let the player die, he will be automatically frozen when he respawns if(self.frozen != 1) diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index ebfc22bb5..e0415af3c 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -27,7 +27,7 @@ void ons_CaptureShield_Touch() vector mymid = (self.absmin + self.absmax) * 0.5; vector othermid = (other.absmin + other.absmax) * 0.5; - Damage(other, self, self, 0, DEATH_HURTTRIGGER, mymid, normalize(othermid - mymid) * ons_captureshield_force); + Damage(other, self, self, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ons_captureshield_force); if(IS_REAL_CLIENT(other)) { @@ -1100,7 +1100,7 @@ bool Onslaught_CheckWinner() else d = d * tmp_entity.max_health / max(30, 60 * autocvar_timelimit_suddendeath); - Damage(tmp_entity, tmp_entity, tmp_entity, d, DEATH_HURTTRIGGER, tmp_entity.origin, '0 0 0'); + Damage(tmp_entity, tmp_entity, tmp_entity, d, DEATH_HURTTRIGGER.m_id, tmp_entity.origin, '0 0 0'); tmp_entity.sprite.SendFlags |= 16; diff --git a/qcsrc/server/mutators/mutator.qh b/qcsrc/server/mutators/mutator.qh index 39adb175c..8721a2d67 100644 --- a/qcsrc/server/mutators/mutator.qh +++ b/qcsrc/server/mutators/mutator.qh @@ -29,7 +29,7 @@ #include "../weapons/throwing.qh" #include "../weapons/weaponsystem.qh" -#include "../../common/deathtypes.qh" +#include "../../common/deathtypes/all.qh" #include "../../common/notifications.qh" #include "../../common/triggers/teleporters.qh" #include "../../common/triggers/subs.qh" diff --git a/qcsrc/server/mutators/mutator_bloodloss.qc b/qcsrc/server/mutators/mutator_bloodloss.qc index da9a608f0..6c50612a9 100644 --- a/qcsrc/server/mutators/mutator_bloodloss.qc +++ b/qcsrc/server/mutators/mutator_bloodloss.qc @@ -16,7 +16,7 @@ MUTATOR_HOOKFUNCTION(bloodloss_PlayerThink) if(self.vehicle) vehicles_exit(VHEF_RELEASE); if(self.event_damage) - self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0'); + self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0'); self.bloodloss_timer = time + 0.5 + random() * 0.5; } } diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index da47be415..49e7f39e3 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -401,7 +401,7 @@ void buff_SpawnReplacement(entity ent, entity old) void buff_Vengeance_DelayedDamage() {SELFPARAM(); if(self.enemy) - Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF, self.enemy.origin, '0 0 0'); + Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF.m_id, self.enemy.origin, '0 0 0'); remove(self); return; @@ -415,7 +415,7 @@ float buff_Inferno_CalculateTime(float x, float offset_x, float offset_y, float // mutator hooks MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_SplitHealthArmor) { - if(frag_deathtype == DEATH_BUFF) { return false; } + if(frag_deathtype == DEATH_BUFF.m_id) { return false; } if(frag_target.buffs & BUFF_RESISTANCE.m_itemid) { @@ -429,7 +429,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_SplitHealthArmor) MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate) { - if(frag_deathtype == DEATH_BUFF) { return false; } + if(frag_deathtype == DEATH_BUFF.m_id) { return false; } if(frag_target.buffs & BUFF_SPEED.m_itemid) if(frag_target != frag_attacker) @@ -443,7 +443,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate) frag_damage = max(5, frag_target.health - autocvar_g_buffs_medic_survive_health); if(frag_target.buffs & BUFF_JUMP.m_itemid) - if(frag_deathtype == DEATH_FALL) + if(frag_deathtype == DEATH_FALL.m_id) frag_damage = 0; if(frag_target.buffs & BUFF_VENGEANCE.m_itemid) @@ -477,7 +477,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate) frag_target.buff_disability_time = time + autocvar_g_buffs_disability_slowtime; if(frag_attacker.buffs & BUFF_MEDIC.m_itemid) - if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC.m_id) + if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC) if(SAME_TEAM(frag_attacker, frag_target)) if(frag_attacker != frag_target) { @@ -495,13 +495,13 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate) autocvar_g_buffs_inferno_burntime_target_time, autocvar_g_buffs_inferno_burntime_factor ); - Fire_AddDamage(frag_target, frag_attacker, (frag_damage * autocvar_g_buffs_inferno_damagemultiplier) * time, time, DEATH_BUFF); + Fire_AddDamage(frag_target, frag_attacker, (frag_damage * autocvar_g_buffs_inferno_damagemultiplier) * time, time, DEATH_BUFF.m_id); } // this... is ridiculous (TODO: fix!) if(frag_attacker.buffs & BUFF_VAMPIRE.m_itemid) if(!frag_target.vehicle) - if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC.m_id) + if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC) if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype)) if(frag_target.deadflag == DEAD_NO) if(IS_PLAYER(frag_target) || IS_MONSTER(frag_target)) diff --git a/qcsrc/server/mutators/mutator_campcheck.qc b/qcsrc/server/mutators/mutator_campcheck.qc index e4ad5ba19..3b04c43cc 100644 --- a/qcsrc/server/mutators/mutator_campcheck.qc +++ b/qcsrc/server/mutators/mutator_campcheck.qc @@ -58,9 +58,9 @@ MUTATOR_HOOKFUNCTION(campcheck_PlayerThink) { Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_CAMPCHECK); if(self.vehicle) - Damage(self.vehicle, self, self, autocvar_g_campcheck_damage * 2, DEATH_CAMP, self.vehicle.origin, '0 0 0'); + Damage(self.vehicle, self, self, autocvar_g_campcheck_damage * 2, DEATH_CAMP.m_id, self.vehicle.origin, '0 0 0'); else - Damage(self, self, self, bound(0, autocvar_g_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP, self.origin, '0 0 0'); + Damage(self, self, self, bound(0, autocvar_g_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP.m_id, self.origin, '0 0 0'); } self.campcheck_nextcheck = time + autocvar_g_campcheck_interval; self.campcheck_traveled_distance = 0; diff --git a/qcsrc/server/mutators/mutator_instagib.qc b/qcsrc/server/mutators/mutator_instagib.qc index 9f88b2b6e..f6c85d9c1 100644 --- a/qcsrc/server/mutators/mutator_instagib.qc +++ b/qcsrc/server/mutators/mutator_instagib.qc @@ -65,59 +65,59 @@ void instagib_ammocheck() self.instagib_needammo = true; if (self.health <= 5) { - Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 5, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_INSTAGIB_TERMINATED); } else if (self.health <= 10) { - Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 5, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_1); } else if (self.health <= 20) { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_2); } else if (self.health <= 30) { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_3); } else if (self.health <= 40) { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_4); } else if (self.health <= 50) { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_5); } else if (self.health <= 60) { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_6); } else if (self.health <= 70) { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_7); } else if (self.health <= 80) { - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_8); } else if (self.health <= 90) { Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO); - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_9); } else { Send_Notification(NOTIF_ONE_ONLY, self, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO); - Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0'); + Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); } } self.instagib_nextthink = time + 1; @@ -259,11 +259,11 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage) if(IS_PLAYER(frag_target)) { - if(frag_deathtype == DEATH_FALL) + if(frag_deathtype == DEATH_FALL.m_id) frag_damage = 0; // never count fall damage if(!autocvar_g_instagib_damagedbycontents) - switch(frag_deathtype) + switch(DEATH_ENT(frag_deathtype)) { case DEATH_DROWN: case DEATH_SLIME: @@ -273,7 +273,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage) } if(IS_PLAYER(frag_attacker)) - if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id)) + if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER)) { if(frag_target.armorvalue) { @@ -285,7 +285,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage) } } - if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER.m_id)) + if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER)) { if(frag_deathtype & HITTYPE_SECONDARY) { @@ -388,7 +388,7 @@ MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint) MUTATOR_HOOKFUNCTION(instagib_PlayerDies) { - if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id)) + if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER)) frag_damage = 1000; // always gib if it was a vaporizer death return FALSE; diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 4fdbbd353..ec5a649dd 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -131,7 +131,7 @@ void nade_napalm_ball() proj.bot_dodge = true; proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage; proj.movetype = MOVETYPE_BOUNCE; - proj.projectiledeathtype = DEATH_NADE_NAPALM; + proj.projectiledeathtype = DEATH_NADE_NAPALM.m_id; PROJECTILE_MAKETRIGGER(proj); setmodel(proj, MDL_Null); proj.scale = 1;//0.5; @@ -214,7 +214,7 @@ void nade_napalm_boom() fountain.pushltime = fountain.ltime; fountain.team = self.team; fountain.movetype = MOVETYPE_TOSS; - fountain.projectiledeathtype = DEATH_NADE_NAPALM; + fountain.projectiledeathtype = DEATH_NADE_NAPALM.m_id; fountain.bot_dodge = true; fountain.bot_dodgerating = autocvar_g_nades_napalm_fountain_damage; fountain.nade_special_time = time; @@ -315,7 +315,7 @@ void nade_ice_boom() fountain.pushltime = fountain.wait = fountain.ltime; fountain.team = self.team; fountain.movetype = MOVETYPE_TOSS; - fountain.projectiledeathtype = DEATH_NADE_ICE; + fountain.projectiledeathtype = DEATH_NADE_ICE.m_id; fountain.bot_dodge = false; setsize(fountain, '-16 -16 -16', '16 16 16'); fountain.nade_special_time = time+0.3; @@ -424,7 +424,7 @@ void nade_heal_touch() } else if ( health_factor < 0 ) { - Damage(other,self,self.realowner,-health_factor,DEATH_NADE_HEAL,other.origin,'0 0 0'); + Damage(other,self,self.realowner,-health_factor,DEATH_NADE_HEAL.m_id,other.origin,'0 0 0'); } } @@ -597,28 +597,28 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, if(self.nade_type == NADE_TYPE_TRANSLOCATE.m_id || self.nade_type == NADE_TYPE_SPAWN.m_id) return; - if(DEATH_ISWEAPON(deathtype, WEP_BLASTER.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_BLASTER)) { force *= 1.5; damage = 0; } - if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER.m_id) && (deathtype & HITTYPE_SECONDARY)) + if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER) && (deathtype & HITTYPE_SECONDARY)) { force *= 0.5; // too much frag_damage = 0; } - if(DEATH_ISWEAPON(deathtype, WEP_VORTEX.m_id) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER)) { force *= 6; damage = self.max_health * 0.55; } - if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN.m_id) || DEATH_ISWEAPON(deathtype, WEP_HMG.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN) || DEATH_ISWEAPON(deathtype, WEP_HMG)) damage = self.max_health * 0.1; - if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE.m_id) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN.m_id)) // WEAPONTODO + if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO if(deathtype & HITTYPE_SECONDARY) { damage = self.max_health * 0.1; @@ -709,7 +709,7 @@ void toss_nade(entity e, vector _velocity, float _time) _nade.damagedbycontents = true; _nade.angles = vectoangles(_nade.velocity); _nade.flags = FL_PROJECTILE; - _nade.projectiledeathtype = DEATH_NADE; + _nade.projectiledeathtype = DEATH_NADE.m_id; _nade.toss_time = time; _nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX); @@ -825,7 +825,7 @@ void nade_prime() n.nade_time_primed = time; n.think = nade_beep; n.nextthink = max(n.wait - 3, time); - n.projectiledeathtype = DEATH_NADE; + n.projectiledeathtype = DEATH_NADE.m_id; setmodel(fn, MDL_NADE_VIEW); setattachment(fn, self.weaponentity, ""); @@ -1119,7 +1119,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerDamage) if(frag_target.frozen) if(autocvar_g_freezetag_revive_nade) if(frag_attacker == frag_target) - if(frag_deathtype == DEATH_NADE) + if(frag_deathtype == DEATH_NADE.m_id) if(time - frag_inflictor.toss_time <= 0.1) { Unfreeze(frag_target); diff --git a/qcsrc/server/mutators/mutator_overkill.qc b/qcsrc/server/mutators/mutator_overkill.qc index d2086215f..d5b59d26a 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -46,7 +46,7 @@ float ok_CheckWeaponCharge(entity ent, int wep) MUTATOR_HOOKFUNCTION(ok_PlayerDamage_Calculate) { if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target)) - if(DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER.m_id)) + if(DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER)) { frag_damage = 0; diff --git a/qcsrc/server/mutators/mutator_rocketminsta.qc b/qcsrc/server/mutators/mutator_rocketminsta.qc index 07148cc58..7f333d9df 100644 --- a/qcsrc/server/mutators/mutator_rocketminsta.qc +++ b/qcsrc/server/mutators/mutator_rocketminsta.qc @@ -5,12 +5,12 @@ MUTATOR_HOOKFUNCTION(rm, PlayerDamage_Calculate) // we do it this way, so rm can be toggled during the match if(!autocvar_g_rm) { return false; } - if(DEATH_ISWEAPON(frag_deathtype, WEP_DEVASTATOR.m_id)) + if(DEATH_ISWEAPON(frag_deathtype, WEP_DEVASTATOR)) if(frag_attacker == frag_target || frag_target.classname == "nade") frag_damage = 0; if(autocvar_g_rm_laser) - if(DEATH_ISWEAPON(frag_deathtype, WEP_ELECTRO.m_id)) + if(DEATH_ISWEAPON(frag_deathtype, WEP_ELECTRO)) if(frag_attacker == frag_target || (round_handler_IsActive() && !round_handler_IsRoundStarted())) frag_damage = 0; @@ -22,7 +22,7 @@ MUTATOR_HOOKFUNCTION(rm, PlayerDies) // we do it this way, so rm can be toggled during the match if(!autocvar_g_rm) { return false; } - if(DEATH_ISWEAPON(frag_deathtype, WEP_DEVASTATOR.m_id) || DEATH_ISWEAPON(frag_deathtype, WEP_ELECTRO.m_id)) + if(DEATH_ISWEAPON(frag_deathtype, WEP_DEVASTATOR) || DEATH_ISWEAPON(frag_deathtype, WEP_ELECTRO)) frag_damage = 1000; // always gib if it was a vaporizer death return false; diff --git a/qcsrc/server/mutators/mutator_touchexplode.qc b/qcsrc/server/mutators/mutator_touchexplode.qc index faa74bb1d..baf41dedb 100644 --- a/qcsrc/server/mutators/mutator_touchexplode.qc +++ b/qcsrc/server/mutators/mutator_touchexplode.qc @@ -16,7 +16,7 @@ void PlayerTouchExplode(entity p1, entity p2) entity e; e = spawn(); setorigin(e, org); - RadiusDamage(e, world, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_radius, world, world, autocvar_g_touchexplode_force, DEATH_TOUCHEXPLODE, world); + RadiusDamage(e, world, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_radius, world, world, autocvar_g_touchexplode_force, DEATH_TOUCHEXPLODE.m_id, world); remove(e); } diff --git a/qcsrc/server/mutators/mutators_include.qc b/qcsrc/server/mutators/mutators_include.qc index 8564d34c5..d5e47c62f 100644 --- a/qcsrc/server/mutators/mutators_include.qc +++ b/qcsrc/server/mutators/mutators_include.qc @@ -39,7 +39,7 @@ #include "../constants.qh" #include "../defs.qh" #include "../../common/notifications.qh" - #include "../../common/deathtypes.qh" + #include "../../common/deathtypes/all.qh" #include "mutators_include.qh" #include "../../common/turrets/sv_turrets.qh" #include "../../common/vehicles/all.qh" diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 30fa07384..5132db572 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -4,7 +4,7 @@ #include "g_hook.qh" #include "mutators/mutators_include.qh" #include "../common/constants.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/notifications.qh" #include "../common/triggers/teleporters.qh" #include "../common/triggers/subs.qh" @@ -428,7 +428,7 @@ void Portal_Remove(entity portal, float killed) void Portal_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) {SELFPARAM(); - if(deathtype == DEATH_TELEFRAG) + if(deathtype == DEATH_TELEFRAG.m_id) return; if(attacker != self.aiment) if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(self.aiment)) diff --git a/qcsrc/server/progs.inc b/qcsrc/server/progs.inc index adb8cf632..d4a4f1712 100644 --- a/qcsrc/server/progs.inc +++ b/qcsrc/server/progs.inc @@ -97,6 +97,7 @@ #include "../common/triggers/include.qc" #include "../common/util.qc" +#include "../common/deathtypes/all.qc" #include "../common/buffs/all.qc" #include "../common/items/all.qc" #include "../common/monsters/all.qc" diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index fbf1eaa18..8f9dccf91 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -8,7 +8,7 @@ #include "bot/waypoints.qh" #include "bot/navigation.qh" #include "command/getreplies.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/notifications.qh" #include "../common/mapinfo.qh" #include "../warpzonelib/util_server.qh" @@ -704,7 +704,7 @@ void checkpoint_passed() else { if(self.spawnflags & 4) - Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0'); + Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0'); } } diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 138051827..43118d926 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -13,7 +13,7 @@ #include "weapons/csqcprojectile.qh" #include "../common/constants.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/mapinfo.qh" #include "../common/util.qh" @@ -62,7 +62,7 @@ void CreatureFrame (void) if (!self.deadflag) if (self.pain_finished < time) { - Damage (self, world, world, autocvar_g_balance_contents_playerdamage_drowning * autocvar_g_balance_contents_damagerate, DEATH_DROWN, self.origin, '0 0 0'); + Damage (self, world, world, autocvar_g_balance_contents_playerdamage_drowning * autocvar_g_balance_contents_damagerate, DEATH_DROWN.m_id, self.origin, '0 0 0'); self.pain_finished = time + 0.5; } } @@ -76,11 +76,11 @@ void CreatureFrame (void) { if (self.watertype == CONTENT_LAVA) { - Damage (self, world, world, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_LAVA, self.origin, '0 0 0'); + Damage (self, world, world, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_LAVA.m_id, self.origin, '0 0 0'); } else if (self.watertype == CONTENT_SLIME) { - Damage (self, world, world, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_SLIME, self.origin, '0 0 0'); + Damage (self, world, world, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_SLIME.m_id, self.origin, '0 0 0'); } } else @@ -92,7 +92,7 @@ void CreatureFrame (void) self.watersound_finished = time + 0.5; sound (self, CH_PLAYER_SINGLE, SND_LAVA, VOL_BASE, ATTEN_NORM); } - Damage (self, world, world, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_LAVA, self.origin, '0 0 0'); + Damage (self, world, world, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_LAVA.m_id, self.origin, '0 0 0'); } else if (self.watertype == CONTENT_SLIME) { @@ -101,7 +101,7 @@ void CreatureFrame (void) self.watersound_finished = time + 0.5; sound (self, CH_PLAYER_SINGLE, SND_SLIME, VOL_BASE, ATTEN_NORM); } - Damage (self, world, world, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_SLIME, self.origin, '0 0 0'); + Damage (self, world, world, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_SLIME.m_id, self.origin, '0 0 0'); } } } @@ -130,11 +130,11 @@ void CreatureFrame (void) else dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage); if (dm > 0) - Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0'); + Damage (self, world, world, dm, DEATH_FALL.m_id, self.origin, '0 0 0'); } if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed) - Damage (self, world, world, 100000, DEATH_SHOOTING_STAR, self.origin, '0 0 0'); + Damage (self, world, world, 100000, DEATH_SHOOTING_STAR.m_id, self.origin, '0 0 0'); // play stupid sounds if (g_footsteps) if (!gameover) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index e93ee2d7e..90e70171e 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -15,7 +15,7 @@ #include "weapons/weaponsystem.qh" #include "../common/constants.qh" - #include "../common/deathtypes.qh" + #include "../common/deathtypes/all.qh" #include "../common/notifications.qh" #include "../common/triggers/subs.qh" #include "../common/util.qh" diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 6defa736f..dc01b545d 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -12,7 +12,7 @@ #include "mutators/mutators_include.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" #include "../common/teams.qh" void TeamchangeFrags(entity e) @@ -775,7 +775,7 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) LogTeamchange(pl.playerid, pl.team, 2); // log auto join if(pl.deadflag == DEAD_NO) - Damage(pl, pl, pl, 100000, DEATH_TEAMCHANGE, pl.origin, '0 0 0'); + Damage(pl, pl, pl, 100000, DEATH_TEAMCHANGE.m_id, pl.origin, '0 0 0'); } return smallest; @@ -861,7 +861,7 @@ void SV_ChangeTeam(float _color) { // kill player when changing teams if(self.deadflag == DEAD_NO) - Damage(self, self, self, 100000, DEATH_TEAMCHANGE, self.origin, '0 0 0'); + Damage(self, self, self, 100000, DEATH_TEAMCHANGE.m_id, self.origin, '0 0 0'); } } @@ -1002,6 +1002,6 @@ void ShufflePlayerOutOfTeam (float source_team) SetPlayerTeam(selected, smallestteam, source_team, false); if(selected.deadflag == DEAD_NO) - Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0'); + Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE.m_id, selected.origin, '0 0 0'); Send_Notification(NOTIF_ONE, selected, MSG_CENTER, CENTER_DEATH_SELF_AUTOTEAMCHANGE, selected.team); } diff --git a/qcsrc/server/weapons/common.qc b/qcsrc/server/weapons/common.qc index f1720757f..0f1fa9080 100644 --- a/qcsrc/server/weapons/common.qc +++ b/qcsrc/server/weapons/common.qc @@ -3,7 +3,7 @@ #include "../t_items.qh" #include "../../common/constants.qh" -#include "../../common/deathtypes.qh" +#include "../../common/deathtypes/all.qh" #include "../../common/notifications.qh" #include "../../common/util.qh" #include "../../common/weapons/all.qh" @@ -38,7 +38,7 @@ void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception) { - float is_from_contents = (deathtype == DEATH_SLIME || deathtype == DEATH_LAVA); + float is_from_contents = (deathtype == DEATH_SLIME.m_id || deathtype == DEATH_LAVA.m_id); float is_from_owner = (inflictor == projowner); float is_from_exception = (exception != -1);