]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Accordeon: fix kill messages
authorRudolf Polzer <divverent@xonotic.org>
Thu, 13 Oct 2011 15:49:44 +0000 (17:49 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 13 Oct 2011 15:49:44 +0000 (17:49 +0200)
qcsrc/common/constants.qh
qcsrc/server/g_damage.qc
qcsrc/server/w_tuba.qc

index c59901b21475b5c7e505aee04a4167dcca0d0cbd..add142d22798664d12b791bb100dc7f5e1188806 100644 (file)
@@ -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
index 7aeda69afee2d07d00a0f4be123a662ce4510889..5a583fc15ad101f07180877866f28641c5247c07 100644 (file)
@@ -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)
index 9623a32b831018d05b97c4785f3bfdee025ae0f5..1ed217851ee176308daeee8d2a1857b50a21ae96 100644 (file)
@@ -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;
 }