]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/damage.qc
Merge remote-tracking branch 'origin/master' into samual/update_effects_tab
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / damage.qc
index ae83d45eea011d890b8b3fd0430866d2b17312ca..bbc8f88043453a3e0338b02fccbfef6d00955ba2 100644 (file)
@@ -39,7 +39,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum)
 {
        // particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
 
-       float life, nearestbone;
+       float life, nearestbone = 0;
        string specstr, effectname;
        entity e;
 
@@ -61,7 +61,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum)
                        continue; // player model bone blacklist
 
                // now choose the bone closest to impact origin
-               if(vlen(hitorg - gettaginfo(self, tagnum)) <= vlen(hitorg - gettaginfo(self, nearestbone)))
+               if(nearestbone == 0 || vlen(hitorg - gettaginfo(self, tagnum)) <= vlen(hitorg - gettaginfo(self, nearestbone)))
                        nearestbone = tagnum;
        }
        gettaginfo(self, nearestbone); // set gettaginfo_name
@@ -113,7 +113,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum)
 
 void Ent_DamageInfo(float isNew)
 {
-       float dmg, rad, edge, thisdmg, forcemul, species, hitplayer;
+       float dmg, rad, edge, thisdmg, forcemul, species, hitplayer = FALSE;
        vector force, thisforce;
        entity oldself;
 
@@ -211,43 +211,43 @@ void Ent_DamageInfo(float isNew)
                
                switch(w_deathtype)
                {
-                       case DEATH_VHCRUSH:
+                       case DEATH_VH_CRUSH:
                                break;
                                
                        // spiderbot
-                       case DEATH_SBMINIGUN:
+                       case DEATH_VH_SPID_MINIGUN:
                                string _snd;
                                _snd = strcat("weapons/ric", ftos(1 + rint(random() * 2)), ".waw");
                                sound(self, CH_SHOTS, _snd, VOL_BASE, ATTN_NORM);
                                pointparticles(particleeffectnum("spiderbot_minigun_impact"), self.origin, w_backoff * 1000, 1);
                                break;
-                       case DEATH_SBROCKET:
+                       case DEATH_VH_SPID_ROCKET:
                                sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
                                pointparticles(particleeffectnum("spiderbot_rocket_explode"), self.origin, w_backoff * 1000, 1);
                                break;
-                       case DEATH_SBBLOWUP:
+                       case DEATH_VH_SPID_DEATH:
                                sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_MIN);
                                pointparticles(particleeffectnum("explosion_big"), self.origin, w_backoff * 1000, 1);
                                break;
             
-                       case DEATH_WAKIGUN:
+                       case DEATH_VH_WAKI_GUN:
                                sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
                                pointparticles(particleeffectnum("wakizashi_gun_impact"), self.origin, w_backoff * 1000, 1);
                                break;
-                       case DEATH_WAKIROCKET:
+                       case DEATH_VH_WAKI_ROCKET:
                                sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
                                pointparticles(particleeffectnum("wakizashi_rocket_explode"), self.origin, w_backoff * 1000, 1);
                                break;
-                       case DEATH_WAKIBLOWUP:
+                       case DEATH_VH_WAKI_DEATH:
                                sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_MIN);
                                pointparticles(particleeffectnum("explosion_big"), self.origin, w_backoff * 1000, 1);
                                break;
                                
-                       case DEATH_RAPTOR_CANNON:
+                       case DEATH_VH_RAPT_CANNON:
                                sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
                                pointparticles(particleeffectnum("raptor_cannon_impact"), self.origin, w_backoff * 1000, 1);
                                break;
-                       case DEATH_RAPTOR_BOMB_SPLIT:
+                       case DEATH_VH_RAPT_FRAGMENT:
                                float i;
                                vector ang, vel;
                                for(i = 1; i < 4; ++i)
@@ -259,15 +259,15 @@ void Ent_DamageInfo(float isNew)
                                sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
                                pointparticles(particleeffectnum("raptor_bomb_spread"), self.origin, w_backoff * 1000, 1);
                                break;
-                       case DEATH_RAPTOR_BOMB:
+                       case DEATH_VH_RAPT_BOMB:
                                sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
                                pointparticles(particleeffectnum("raptor_bomb_impact"), self.origin, w_backoff * 1000, 1);
                                break;
-                       case DEATH_RAPTOR_DEATH:
+                       case DEATH_VH_RAPT_DEATH:
                                sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_MIN);
                                pointparticles(particleeffectnum("explosion_big"), self.origin, w_backoff * 1000, 1);
                                break;
-                       case DEATH_BUMB_GUN:
+                       case DEATH_VH_BUMB_GUN:
                                sound(self, CH_SHOTS, "weapons/fireball_impact2.wav", VOL_BASE, ATTN_NORM);
                                pointparticles(particleeffectnum("bigplasma_impact"), self.origin, w_backoff * 1000, 1);
                                break;
@@ -301,14 +301,14 @@ void Ent_DamageInfo(float isNew)
                                
                         case DEATH_TURRET_MLRS:
                         case DEATH_TURRET_HK:
-                        case DEATH_TURRET_WALKER_ROCKET:
+                        case DEATH_TURRET_WALK_ROCKET:
                         case DEATH_TURRET_HELLION:
                                sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_MIN);
                                pointparticles(particleeffectnum("rocket_explode"), self.origin, w_backoff * 1000, 1);
                                break;
                         
                         case DEATH_TURRET_MACHINEGUN:
-                        case DEATH_TURRET_WALKER_GUN:
+                        case DEATH_TURRET_WALK_GUN:
                                _snd = strcat("weapons/ric", ftos(1 + rint(random() * 2)), ".waw");
                                sound(self, CH_SHOTS, _snd, VOL_BASE, ATTN_NORM);
                                pointparticles(particleeffectnum("machinegun_impact"), self.origin, w_backoff * 1000, 1);
@@ -319,7 +319,7 @@ void Ent_DamageInfo(float isNew)
                                pointparticles(particleeffectnum("electro_impact"), self.origin, w_backoff * 1000, 1);
                                break;
                                                  
-                        case DEATH_TURRET_WALKER_MEELE:
+                        case DEATH_TURRET_WALK_MEELE:
                                sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTN_MIN);
                                pointparticles(particleeffectnum("TE_SPARK"), self.origin, w_backoff * 1000, 1);
                                break;