From f8529e7ea33e2658ea17b71f08cd475d77151ce1 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 27 Jul 2019 13:52:14 +1000 Subject: [PATCH] Add a hittype for sound-based attacks that cause bleeding to come from ears instead of the body (used by tuba) --- qcsrc/common/deathtypes/all.qh | 5 ++--- qcsrc/common/weapons/weapon/tuba.qc | 2 +- qcsrc/server/player.qc | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/qcsrc/common/deathtypes/all.qh b/qcsrc/common/deathtypes/all.qh index beb8e3e91..2169c8bd7 100644 --- a/qcsrc/common/deathtypes/all.qh +++ b/qcsrc/common/deathtypes/all.qh @@ -26,9 +26,8 @@ const int HITTYPE_SECONDARY = BITS(1) << 8; const int HITTYPE_SPLASH = BITS(1) << 9; const int HITTYPE_BOUNCE = BITS(1) << 10; const int HITTYPE_ARMORPIERCE = BITS(1) << 11; -// unused yet -const int HITTYPE_RESERVED = BITS(1) << 12; -const int DEATH_HITTYPEMASK = HITTYPE_SECONDARY | HITTYPE_SPLASH | HITTYPE_BOUNCE | HITTYPE_ARMORPIERCE | HITTYPE_RESERVED; +const int HITTYPE_SOUND = BITS(1) << 12; +const int DEATH_HITTYPEMASK = HITTYPE_SECONDARY | HITTYPE_SPLASH | HITTYPE_BOUNCE | HITTYPE_ARMORPIERCE | HITTYPE_SOUND; // normal deaths begin const int DT_FIRST = BIT(13); diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index eb7808089..bf5fa0c98 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -268,7 +268,7 @@ void W_Tuba_NoteOn(entity actor, .entity weaponentity, float hittype) vector o; float n = W_Tuba_GetNote(actor, hittype); - hittype = 0; + hittype = HITTYPE_SOUND; if(actor.(weaponentity).tuba_instrument & 1) hittype |= HITTYPE_SECONDARY; if(actor.(weaponentity).tuba_instrument & 2) diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index b8d3c903c..c39f59e72 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -329,9 +329,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1) damage *= 1 - max(0, autocvar_g_spawnshield_blockdamage); - if(DEATH_ISWEAPON(deathtype, WEP_TUBA)) + if(deathtype & HITTYPE_SOUND) // sound based attacks cause bleeding from the ears { - // tuba causes blood to come out of the ears vector ear1, ear2; vector d; float f; -- 2.39.2