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
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)
{
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)
}
else if (req == WR_RELOAD)
{
- // TODO switch to alternate instruments :)
+ // switch to alternate instruments :)
if(self.weaponentity.state == WS_READY)
{
switch(self.tuba_instrument)
}
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;
}