From: Rudolf Polzer Date: Thu, 13 Oct 2011 15:49:44 +0000 (+0200) Subject: Accordeon: fix kill messages X-Git-Tag: xonotic-v0.6.0~40^2~46 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=88bc9dc7c0cc8ba93ff9a2408a9a3b4e762e6067;p=xonotic%2Fxonotic-data.pk3dir.git Accordeon: fix kill messages --- diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index c59901b21..add142d22 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -575,9 +575,9 @@ float DEATH_TURRET_LAST = 10512; float DEATH_WEAPONMASK = 0xFF; float DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths float HITTYPE_SECONDARY = 0x100; -float HITTYPE_SPLASH = 0x200; +float HITTYPE_SPLASH = 0x200; // automatically set by RadiusDamage float HITTYPE_BOUNCE = 0x400; -float HITTYPE_HEADSHOT = 0x800; +float HITTYPE_HEADSHOT = 0x800; // automatically set by Damage (if headshotbonus is set) float HITTYPE_RESERVED = 0x1000; // unused yet // macros to access these diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 7aeda69af..5a583fc15 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -758,26 +758,29 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(targ.takedamage == DAMAGE_AIM) if(targ != attacker) { - if(targ.classname == "player") + if(damage_headshotbonus > 0) { - // HEAD SHOT: - // find height of hit on player axis - // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot - vector headmins, headmaxs, org; - org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker)); - headmins = org + GetHeadshotMins(targ); - headmaxs = org + GetHeadshotMaxs(targ); - if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs)) + if(targ.classname == "player") + { + // HEAD SHOT: + // find height of hit on player axis + // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot + vector headmins, headmaxs, org; + org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker)); + headmins = org + GetHeadshotMins(targ); + headmaxs = org + GetHeadshotMaxs(targ); + if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs)) + { + deathtype |= HITTYPE_HEADSHOT; + } + } + else if(targ.classname == "turret_head") { deathtype |= HITTYPE_HEADSHOT; } + if(deathtype & HITTYPE_HEADSHOT) + damage *= 1 + damage_headshotbonus; } - else if(targ.classname == "turret_head") - { - deathtype |= HITTYPE_HEADSHOT; - } - if(deathtype & HITTYPE_HEADSHOT) - damage *= 1 + damage_headshotbonus; entity victim; if((targ.vehicle_flags & VHF_ISVEHICLE) && targ.owner) diff --git a/qcsrc/server/w_tuba.qc b/qcsrc/server/w_tuba.qc index 9623a32b8..1ed217851 100644 --- a/qcsrc/server/w_tuba.qc +++ b/qcsrc/server/w_tuba.qc @@ -141,10 +141,19 @@ void W_Tuba_Attack(float hittype) { vector o; float n; + W_SetupShot(self, FALSE, 2, "", 0, autocvar_g_balance_tuba_damage); n = Tuba_GetNote(self, hittype); + hittype = 0; + if(self.tuba_instrument & 1) + hittype |= HITTYPE_SECONDARY; + if(self.tuba_instrument & 2) + hittype |= HITTYPE_BOUNCE; + if(self.tuba_instrument & 4) + hittype |= HITTYPE_HEADSHOT; + if(self.tuba_note) { if(self.tuba_note.cnt != n || self.tuba_note.tuba_instrument != self.tuba_instrument) @@ -240,7 +249,7 @@ float w_tuba(float req) } else if (req == WR_RELOAD) { - // TODO switch to alternate instruments :) + // switch to alternate instruments :) if(self.weaponentity.state == WS_READY) { switch(self.tuba_instrument) @@ -280,11 +289,45 @@ float w_tuba(float req) } else if (req == WR_SUICIDEMESSAGE) { - w_deathtypestring = _("%s hurt his own ears with the @!#%%'n Tuba"); + float instr; + instr = 0; + if(w_deathtype & HITTYPE_SECONDARY) + instr |= 1; + if(w_deathtype & HITTYPE_BOUNCE) + instr |= 2; + if(w_deathtype & HITTYPE_HEADSHOT) + instr |= 4; + switch(instr) + { + default: + case 0: // Tuba + w_deathtypestring = _("%s hurt his own ears with the @!#%%'n Tuba"); + break; + case 1: // Accordeon + w_deathtypestring = _("%s hurt his own ears with the @!#%%'n Accordeon"); + break; + } } else if (req == WR_KILLMESSAGE) { - w_deathtypestring = _("%s died of %s's great playing on the @!#%%'n Tuba"); + float instr; + instr = 0; + if(w_deathtype & HITTYPE_SECONDARY) + instr |= 1; + if(w_deathtype & HITTYPE_BOUNCE) + instr |= 2; + if(w_deathtype & HITTYPE_HEADSHOT) + instr |= 4; + switch(instr) + { + default: + case 0: // Tuba + w_deathtypestring = _("%s died of %s's great playing on the @!#%%'n Tuba"); + break; + case 1: // Accordeon + w_deathtypestring = _("%s died of %s's great playing on the @!#%%'n Accordeon"); + break; + } } return TRUE; }