]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
move projectile explosions including precaching into w_*.qc; client/damage.qc now...
authorRudolf Polzer <divverent@alientrap.org>
Sun, 6 Jun 2010 12:25:47 +0000 (14:25 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sun, 6 Jun 2010 12:26:58 +0000 (14:26 +0200)
20 files changed:
qcsrc/client/damage.qc
qcsrc/common/constants.qh
qcsrc/server/defs.qh
qcsrc/server/w_campingrifle.qc
qcsrc/server/w_crylink.qc
qcsrc/server/w_electro.qc
qcsrc/server/w_fireball.qc
qcsrc/server/w_grenadelauncher.qc
qcsrc/server/w_hagar.qc
qcsrc/server/w_hlac.qc
qcsrc/server/w_hook.qc
qcsrc/server/w_laser.qc
qcsrc/server/w_minstanex.qc
qcsrc/server/w_nex.qc
qcsrc/server/w_porto.qc
qcsrc/server/w_rocketlauncher.qc
qcsrc/server/w_seeker.qc
qcsrc/server/w_shotgun.qc
qcsrc/server/w_tuba.qc
qcsrc/server/w_uzi.qc

index 9e90bee2240161c7293450712830d826fac63b53..1b0138f36b0212f950ebf241c5de37892ae91bba 100644 (file)
@@ -1,22 +1,23 @@
 .float silent;
 
+float w_deathtype, w_issilent, w_random;
+vector w_org, w_backoff;
+
 void Ent_DamageInfo(float isNew)
 {
-       float hittype, dmg, rad, edge, thisdmg, forcemul;
-       float issilent;
-       vector force, org, thisforce;
+       float dmg, rad, edge, thisdmg, forcemul;
+       vector force, thisforce;
        entity oldself;
 
        oldself = self;
 
-       hittype = ReadShort();
-
-       issilent = (hittype & 0x8000);
-       hittype = (hittype & 0x7FFF);
+       w_deathtype = ReadShort();
+       w_issilent = (w_deathtype & 0x8000);
+       w_deathtype = (w_deathtype & 0x7FFF);
 
-       org_x = ReadCoord();
-       org_y = ReadCoord();
-       org_z = ReadCoord();
+       w_org_x = ReadCoord();
+       w_org_y = ReadCoord();
+       w_org_z = ReadCoord();
 
        dmg = ReadByte();
        rad = ReadByte();
@@ -34,22 +35,22 @@ void Ent_DamageInfo(float isNew)
        else
                forcemul = 1;
        
-       for(self = findradius(org, rad); self; self = self.chain)
+       for(self = findradius(w_org, rad); self; self = self.chain)
        {
                if(rad)
                {
-                       thisdmg = vlen(self.origin - org) / rad;
+                       thisdmg = vlen(self.origin - w_org) / rad;
                        if(thisdmg >= 1)
                                continue;
                        if(dmg)
                        {
                                thisdmg = dmg + (edge - dmg) * thisdmg;
-                               thisforce = forcemul * vlen(force) * (thisdmg / dmg) * normalize(self.origin - org);
+                               thisforce = forcemul * vlen(force) * (thisdmg / dmg) * normalize(self.origin - w_org);
                        }
                        else
                        {
                                thisdmg = 0;
-                               thisforce = forcemul * vlen(force) * normalize(self.origin - org);
+                               thisforce = forcemul * vlen(force) * normalize(self.origin - w_org);
                        }
                }
                else
@@ -69,276 +70,38 @@ void Ent_DamageInfo(float isNew)
                                //print("pushed ", ftos(num_for_edict(self)), " loose\n");
                        }
 
-               if(issilent)
+               if(w_issilent)
                        self.silent = 1;
 
                if(self.event_damage)
-                       self.event_damage(thisdmg, hittype, org, thisforce);
+                       self.event_damage(thisdmg, w_deathtype, w_org, thisforce);
        }
 
        self = oldself;
 
-       // TODO spawn particle effects and sounds based on hittype
+       // TODO spawn particle effects and sounds based on w_deathtype
        
-       if(!DEATH_ISSPECIAL(hittype))
+       if(!DEATH_ISSPECIAL(w_deathtype))
        {
-               float hitwep, secondary, bounce, headshot;
-               vector org2, backoff;
-               float r;
+               float hitwep;
 
-               hitwep = DEATH_WEAPONOFWEAPONDEATH(hittype);
-               secondary = hittype & HITTYPE_SECONDARY;
-               bounce = hittype & HITTYPE_BOUNCE;
-               headshot = hittype & HITTYPE_HEADSHOT;
-               r = prandom();
+               hitwep = DEATH_WEAPONOFWEAPONDEATH(w_deathtype);
+               w_random = prandom();
 
-               traceline(org - normalize(force) * 16, org + normalize(force) * 16, MOVE_NOMONSTERS, world);
+               traceline(w_org - normalize(force) * 16, w_org + normalize(force) * 16, MOVE_NOMONSTERS, world);
                if(trace_fraction < 1 && hitwep != WEP_NEX && hitwep != WEP_MINSTANEX)
-                       backoff = trace_plane_normal;
+                       w_backoff = trace_plane_normal;
                else
-                       backoff = -1 * normalize(force);
-
-               setorigin(self, org + backoff * 2); // for sound() calls
+                       w_backoff = -1 * normalize(force);
+               setorigin(self, w_org + w_backoff * 2); // for sound() calls
 
-               switch(hitwep)
-               {
-                       case WEP_LASER:
-                               org2 = org + backoff * 6;
-                               pointparticles(particleeffectnum("laser_impact"), org2, backoff * 1000, 1);
-                               if(!issilent)
-                                       sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
-                               break;
-                       case WEP_SHOTGUN:
-                               org2 = org + backoff * 2;
-                               pointparticles(particleeffectnum("shotgun_impact"), org2, backoff * 1000, 1);
-                               if(!issilent)
-                               {
-                                       if(r < 0.05)
-                                               sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
-                                       else if(r < 0.1)
-                                               sound(self, CHAN_PROJECTILE, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
-                                       else if(r < 0.2)
-                                               sound(self, CHAN_PROJECTILE, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
-                               }
-                               break;
-                       case WEP_UZI:
-                               org2 = org + backoff * 2;
-                               pointparticles(particleeffectnum("machinegun_impact"), org2, backoff * 1000, 1);
-                               if(!issilent)
-                                       if(r < 0.05)
-                                               sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
-                                       else if(r < 0.1)
-                                               sound(self, CHAN_PROJECTILE, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
-                                       else if(r < 0.2)
-                                               sound(self, CHAN_PROJECTILE, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
-                               break;
-                       case WEP_GRENADE_LAUNCHER:
-                               org2 = org + backoff * 12;
-                               pointparticles(particleeffectnum("grenade_explode"), org2, '0 0 0', 1);
-                               if(!issilent)
-                                       sound(self, CHAN_PROJECTILE, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
-                               break;
-                       case WEP_ELECTRO:
-                               org2 = org + backoff * 6;
-                               if(secondary)
-                               {
-                                       pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
-                                       if(!issilent)
-                                               sound(self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
-                               }
-                               else
-                               {
-                                       if(bounce)
-                                       {
-                                               // this is sent as "primary bounce" to distinguish it from secondary bounced balls
-                                               pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
-                                               if(!issilent)
-                                                       sound(self, CHAN_PROJECTILE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
-                                       }
-                                       else
-                                       {
-                                               pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
-                                               if(!issilent)
-                                                       sound(self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
-                                       }
-                               }
-                               break;
-                       case WEP_CRYLINK:
-                               org2 = org + backoff * 2;
-                               if(secondary)
-                               {
-                                       pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
-                                       if(!issilent)
-                                               sound(self, CHAN_PROJECTILE, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
-                               }
-                               else
-                               {
-                                       pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
-                                       if(!issilent)
-                                               sound(self, CHAN_PROJECTILE, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
-                               }
-                               break;
-                       case WEP_NEX:
-                               org2 = org + backoff * 6;
-                               pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
-                               if(!issilent)
-                                       sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
-                               break;
-                       case WEP_HAGAR:
-                               org2 = org + backoff * 6;
-                               pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
-                               if(!issilent)
-                               {
-                                       if (r<0.15)
-                                               sound(self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
-                                       else if (r<0.7)
-                                               sound(self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
-                                       else
-                                               sound(self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
-                               }
-                               break;
-                       case WEP_ROCKET_LAUNCHER:
-                               org2 = org + backoff * 12;
-                               pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);
-                               if(!issilent)
-                                       sound(self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
-                               break;
-                       case WEP_PORTO:
-                               print("Since when does Porto send DamageInfo?\n");
-                               break;
-                       case WEP_MINSTANEX:
-                               org2 = org + backoff * 6;
-                               pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
-                               if(!issilent)
-                                       sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
-                               break;
-                       case WEP_HOOK:
-                               org2 = org + backoff * 2;
-                               pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1);
-                               if(!issilent)
-                                       sound(self, CHAN_PROJECTILE, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM);
-                               break;
-                       case WEP_SEEKER:
-                               org2 = org + backoff * 6;
-                               if(secondary)
-                               {
-                                       pointparticles(particleeffectnum("flac_explode"), org2, '0 0 0', 1);
-                                       if(!issilent)
-                                       {
-                                               if (r<0.15)
-                                                       sound(self, CHAN_PROJECTILE, "weapons/flacexp1.wav", 1, ATTN_NORM);
-                                               else if (r<0.7)
-                                                       sound(self, CHAN_PROJECTILE, "weapons/flacexp2.wav", 1, ATTN_NORM);
-                                               else
-                                                       sound(self, CHAN_PROJECTILE, "weapons/flacexp3.wav", 1, ATTN_NORM);
-                                       }
-                               }
-                               else
-                               {
-                                       if(bounce)
-                                       {
-                                               pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
-                                               if(!issilent)
-                                               {
-                                                       if (r<0.15)
-                                                               sound(self, CHAN_PROJECTILE, "weapons/tagexp1.wav", 1, ATTN_NORM);
-                                                       else if (r<0.7)
-                                                               sound(self, CHAN_PROJECTILE, "weapons/tagexp2.wav", 1, ATTN_NORM);
-                                                       else
-                                                               sound(self, CHAN_PROJECTILE, "weapons/tagexp3.wav", 1, ATTN_NORM);
-                                               }
-                                       }
-                                       else if(headshot)
-                                       {
-                                               if(!issilent)
-                                                       sound(self, CHAN_PROJECTILE, "weapons/tag_impact.wav", 1, ATTN_NORM);
-                                       }
-                                       else
-                                       {
-                                               pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
-                                               if(!issilent)
-                                               {
-                                                       if (r<0.15)
-                                                               sound(self, CHAN_PROJECTILE, "weapons/seekerexp1.wav", 1, ATTN_NORM);
-                                                       else if (r<0.7)
-                                                               sound(self, CHAN_PROJECTILE, "weapons/seekerexp2.wav", 1, ATTN_NORM);
-                                                       else
-                                                               sound(self, CHAN_PROJECTILE, "weapons/seekerexp3.wav", 1, ATTN_NORM);
-                                               }
-                                       }
-                               }
-                               break;
-                       case WEP_HLAC:
-                               org2 = org + backoff * 6;
-                               pointparticles(particleeffectnum("laser_impact"), org2, backoff * 1000, 1);
-                               if(!issilent)
-                                       sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
-                               break;
-                       case WEP_CAMPINGRIFLE:
-                               org2 = org + backoff * 2;
-                               pointparticles(particleeffectnum("machinegun_impact"), org2, backoff * 1000, 1);
-                               if(!issilent)
-                               {
-                                       if(r < 0.2)
-                                               sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
-                                       else if(r < 0.4)
-                                               sound(self, CHAN_PROJECTILE, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
-                                       else if(r < 0.5)
-                                               sound(self, CHAN_PROJECTILE, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
-                               }
-                               break;
-                       case WEP_TUBA:
-                               break;
-                       case WEP_FIREBALL:
-                               if(secondary)
-                               {
-                                       // firemine goes out silently
-                               }
-                               else
-                               {
-                                       org2 = org + backoff * 16;
-                                       pointparticles(particleeffectnum("fireball_explode"), org2, '0 0 0', 1);
-                                       if(!issilent)
-                                               sound(self, CHAN_PROJECTILE, "weapons/fireball_impact2.wav", VOL_BASE, ATTN_NORM * 0.25); // long range boom
-                               }
-                               break;
-                       default:
-                               dprint("Unhandled damage of weapon ", ftos(hitwep), "\n");
-                               break;
-               }
+               (get_weaponinfo(hitwep)).weapon_func(WR_IMPACTEFFECT);
        }
 }
 
 void DamageInfo_Precache()
 {
-       precache_sound("weapons/crylink_impact2.wav");
-       precache_sound("weapons/crylink_impact.wav");
-       precache_sound("weapons/electro_impact.wav");
-       precache_sound("weapons/electro_impact_combo.wav");
-       precache_sound("weapons/flacexp1.wav");
-       precache_sound("weapons/flacexp2.wav");
-       precache_sound("weapons/flacexp3.wav");
-       precache_sound("weapons/grenade_impact.wav");
-       precache_sound("weapons/hagexp1.wav");
-       precache_sound("weapons/hagexp2.wav");
-       precache_sound("weapons/hagexp3.wav");
-       precache_sound("weapons/flacexp1.wav");
-       precache_sound("weapons/flacexp2.wav");
-       precache_sound("weapons/flacexp3.wav");
-       precache_sound("weapons/hookbomb_impact.wav");
-       precache_sound("weapons/laserimpact.wav");
-       precache_sound("weapons/neximpact.wav");
-       precache_sound("weapons/ric1.wav");
-       precache_sound("weapons/ric2.wav");
-       precache_sound("weapons/ric3.wav");
-       precache_sound("weapons/rocket_impact.wav");
-       precache_sound("weapons/fireball_impact.wav");
-       precache_sound("weapons/fireball_impact2.wav");
-       precache_sound("weapons/seekerexp1.wav");
-       precache_sound("weapons/seekerexp2.wav");
-       precache_sound("weapons/seekerexp3.wav");
-       precache_sound("weapons/tagexp1.wav");
-       precache_sound("weapons/tagexp2.wav");
-       precache_sound("weapons/tagexp3.wav");
-       precache_sound("weapons/tag_impact.wav");
+       float i;
+       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+               (get_weaponinfo(i)).weapon_func(WR_PRECACHE);
 }
index 2fe55b1688bffd5295e2c9af812e4659f28f8931..2400826042a693e35a7aef016ca598d0ef6e4f65 100644 (file)
@@ -512,3 +512,16 @@ float WATERLEVEL_SWIMMING = 2;
 float WATERLEVEL_SUBMERGED = 3;
 
 float MAX_SHOT_DISTANCE = 32768;
+
+// weapon requests
+float WR_SETUP         = 1; // (SVQC) setup weapon data
+float WR_THINK         = 2; // (SVQC) logic to run every frame
+float WR_CHECKAMMO1    = 3; // (SVQC) checks ammo for weapon
+float WR_CHECKAMMO2    = 4; // (SVQC) checks ammo for weapon
+float WR_AIM           = 5; // (SVQC) runs bot aiming code for this weapon
+float WR_PRECACHE      = 6; // (CSQC and SVQC) precaches models/sounds used by this weapon
+float WR_SUICIDEMESSAGE = 7; // (SVQC) sets w_deathtypestring or leaves it alone (and may inspect w_deathtype for details)
+float WR_KILLMESSAGE    = 8; // (SVQC) sets w_deathtypestring or leaves it alone
+float WR_RELOAD         = 9; // (SVQC) does not need to do anything
+float WR_RESETPLAYER    = 10; // (SVQC) does not need to do anything
+float WR_IMPACTEFFECT  = 11; // (CSQC) impact effect
index 4d701772434caba1f8b589f5179f227e51b1d461..74b4ecea88c17683996b4b65aacca357f00b10fb 100644 (file)
@@ -221,18 +221,6 @@ float WS_DROP                      = 2; // deselecting frame
 float WS_INUSE                 = 3; // fire state
 float WS_READY                 = 4; // idle frame
 
-// weapon requests
-float WR_SETUP             = 1; // setup weapon data
-float WR_THINK             = 2; // logic to run every frame
-float WR_CHECKAMMO1        = 3; // checks ammo for weapon
-float WR_CHECKAMMO2        = 4; // checks ammo for weapon
-float WR_AIM               = 5; // runs bot aiming code for this weapon
-float WR_PRECACHE          = 6; // precaches models/sounds used by this weapon
-float WR_SUICIDEMESSAGE = 7; // sets w_deathtypestring or leaves it alone (and may inspect w_deathtype for details)
-float WR_KILLMESSAGE    = 8; // sets w_deathtypestring or leaves it alone
-float WR_RELOAD         = 9; // does not need to do anything
-float WR_RESETPLAYER    = 10; // does not need to do anything
-
 void weapon_defaultspawnfunc(float wpn);
 
 string w_deathtypestring;
index 174b3c400cc6ef8f3ed2674441c23c5dc6141295..c3c9d52f9b43926370c8af33e53e78714e69e18e 100644 (file)
@@ -298,6 +298,27 @@ float w_campingrifle(float req)
 #ifdef CSQC
 float w_campingrifle(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 2;
+               pointparticles(particleeffectnum("machinegun_impact"), org2, w_backoff * 1000, 1);
+               if(!w_issilent)
+               {
+                       if(w_random < 0.2)
+                               sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
+                       else if(w_random < 0.4)
+                               sound(self, CHAN_PROJECTILE, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
+                       else if(w_random < 0.5)
+                               sound(self, CHAN_PROJECTILE, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
+               }
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/ric1.wav");
+               precache_sound("weapons/ric2.wav");
+               precache_sound("weapons/ric3.wav");
+       }
        return TRUE;
 }
 #endif
index f5450a63d57bd7bd49ac4e6402fdd671ac050c9c..7f6062d3f6a65bd262f0278a5b59f1ee31aa2b42 100644 (file)
@@ -239,6 +239,28 @@ float w_crylink(float req)
 #ifdef CSQC
 float w_crylink(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 2;
+               if(w_deathtype & HITTYPE_SECONDARY)
+               {
+                       pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
+                       if(!w_issilent)
+                               sound(self, CHAN_PROJECTILE, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
+               }
+               else
+               {
+                       pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
+                       if(!w_issilent)
+                               sound(self, CHAN_PROJECTILE, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
+               }
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/crylink_impact2.wav");
+               precache_sound("weapons/crylink_impact.wav");
+       }
        return TRUE;
 }
 #endif
index 974626cca0b92fa3066f2144b3506e06c98b04c1..45168cdacf66fcf60d685f5521ec16f64e2a25aa 100644 (file)
@@ -321,6 +321,38 @@ float w_electro(float req)
 #ifdef CSQC
 float w_electro(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 6;
+               if(w_deathtype & HITTYPE_SECONDARY)
+               {
+                       pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
+                       if(!w_issilent)
+                               sound(self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
+               }
+               else
+               {
+                       if(w_deathtype & HITTYPE_BOUNCE)
+                       {
+                               // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
+                               pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
+                               if(!w_issilent)
+                                       sound(self, CHAN_PROJECTILE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
+                       }
+                       else
+                       {
+                               pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
+                               if(!w_issilent)
+                                       sound(self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
+                       }
+               }
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/electro_impact.wav");
+               precache_sound("weapons/electro_impact_combo.wav");
+       }
        return TRUE;
 }
 #endif
index 0551dbe4cf01a32734cc48c287aee137de098f78..d5c0b13f950fcc72542db32c4cd6a11c917ba122 100644 (file)
@@ -396,6 +396,26 @@ float w_fireball(float req)
 #ifdef CSQC
 float w_fireball(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               if(w_deathtype & HITTYPE_SECONDARY)
+               {
+                       // firemine goes out silently
+               }
+               else
+               {
+                       org2 = w_org + w_backoff * 16;
+                       pointparticles(particleeffectnum("fireball_explode"), org2, '0 0 0', 1);
+                       if(!w_issilent)
+                               sound(self, CHAN_PROJECTILE, "weapons/fireball_impact2.wav", VOL_BASE, ATTN_NORM * 0.25); // long range boom
+               }
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/fireball_impact.wav");
+               precache_sound("weapons/fireball_impact2.wav");
+       }
        return TRUE;
 }
 #endif
index 972c8c249a1b5a744937ab3c4ca8039d4a4d37a0..b340f76c90bc79f2eaa85c0f83076ddddbadce3e 100644 (file)
@@ -240,6 +240,18 @@ float w_glauncher(float req)
 #ifdef CSQC
 float w_glauncher(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 12;
+               pointparticles(particleeffectnum("grenade_explode"), org2, '0 0 0', 1);
+               if(!w_issilent)
+                       sound(self, CHAN_PROJECTILE, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/grenade_impact.wav");
+       }
        return TRUE;
 }
 #endif
index 83e1cf0821965e51242cb6ae23d2d3a06c011f6e..c95a90e5dae9d78cf135fc143ea3c69b1f75cebe 100644 (file)
@@ -166,6 +166,27 @@ float w_hagar(float req)
 #ifdef CSQC
 float w_hagar(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 6;
+               pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
+               if(!w_issilent)
+               {
+                       if (w_random<0.15)
+                               sound(self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
+                       else if (w_random<0.7)
+                               sound(self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
+                       else
+                               sound(self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
+               }
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/hagexp1.wav");
+               precache_sound("weapons/hagexp2.wav");
+               precache_sound("weapons/hagexp3.wav");
+       }
        return TRUE;
 }
 #endif
index ebdd0f99e19e2e1a62750ef69de95e68fb596c34..5fe75ab2ca46bfbdfa0828b564b68aa419e8c060 100644 (file)
@@ -217,6 +217,18 @@ float w_hlac(float req)
 #ifdef CSQC
 float w_hlac(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 6;
+               pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
+               if(!w_issilent)
+                       sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/laserimpact.wav");
+       }
        return TRUE;
 }
 #endif
index 2b639024488cce4a96a914739c3fa779e29c632b..9e5868355991106d4b48cd6feae4171c2903802d 100644 (file)
@@ -253,6 +253,18 @@ float w_hook(float req)
 #ifdef CSQC
 float w_hook(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 2;
+               pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1);
+               if(!w_issilent)
+                       sound(self, CHAN_PROJECTILE, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM);
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/hookbomb_impact.wav");
+       }
        return TRUE;
 }
 #endif
index f8f700b4b96959a38c7ff4d6b587a0f7b31f73a5..a17f2a4c54031886124a3b2bfec6a2c9bf971fe8 100644 (file)
@@ -190,6 +190,18 @@ float w_laser(float req)
 #ifdef CSQC
 float w_laser(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 6;
+               pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
+               if(!w_issilent)
+                       sound(self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/laserimpact.wav");
+       }
        return TRUE;
 }
 #endif
index 837d73dca55c5c885b073daa6a29601a872f7b2d..f28c8581cc5ee3c6fa2550561a6c994f8fcd55a5 100644 (file)
@@ -246,6 +246,18 @@ float w_minstanex(float req)
 #ifdef CSQC
 float w_minstanex(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 6;
+               pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
+               if(!w_issilent)
+                       sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/neximpact.wav");
+       }
        return TRUE;
 }
 #endif
index 24c0af53749b301e482748b89bae76ba8f7af276..c23a47b5d668fbe1b000321698f4404e5dcc260d 100644 (file)
@@ -84,6 +84,18 @@ float w_nex(float req)
 #ifdef CSQC
 float w_nex(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 6;
+               pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
+               if(!w_issilent)
+                       sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/neximpact.wav");
+       }
        return TRUE;
 }
 #endif
index 13847920f3519346aa1a1ad297e3acd99ecc640e..1ab117885b02dde03a068e511da43c681403e366 100644 (file)
@@ -283,6 +283,14 @@ float w_porto(float req)
 #ifdef CSQC
 float w_porto(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               print("Since when does Porto send DamageInfo?\n");
+       }
+       else if(req == WR_PRECACHE)
+       {
+               // nothing to do
+       }
        return TRUE;
 }
 #endif
index 5dd0b319995ca60bbb6bc0d09295dd7574d7bb0e..f6975b3b6a0d13d6903830adc2526c8c9940110f 100644 (file)
@@ -565,6 +565,18 @@ float w_rlauncher(float req)
 #ifdef CSQC
 float w_rlauncher(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 12;
+               pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);
+               if(!w_issilent)
+                       sound(self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/rocket_impact.wav");
+       }
        return TRUE;
 }
 #endif
index cdb4615c731dff66d994878ed74fbb925bca2a08..3b23c211294895996cfd5ca80567b4f5b1fc271d 100644 (file)
@@ -483,6 +483,71 @@ float w_seeker(float req)
 #ifdef CSQC
 float w_seeker(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 6;
+               if(w_deathtype & HITTYPE_SECONDARY)
+               {
+                       pointparticles(particleeffectnum("flac_explode"), org2, '0 0 0', 1);
+                       if(!w_issilent)
+                       {
+                               if (w_random<0.15)
+                                       sound(self, CHAN_PROJECTILE, "weapons/flacexp1.wav", 1, ATTN_NORM);
+                               else if (w_random<0.7)
+                                       sound(self, CHAN_PROJECTILE, "weapons/flacexp2.wav", 1, ATTN_NORM);
+                               else
+                                       sound(self, CHAN_PROJECTILE, "weapons/flacexp3.wav", 1, ATTN_NORM);
+                       }
+               }
+               else
+               {
+                       if(w_deathtype & HITTYPE_BOUNCE)
+                       {
+                               pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
+                               if(!w_issilent)
+                               {
+                                       if (w_random<0.15)
+                                               sound(self, CHAN_PROJECTILE, "weapons/tagexp1.wav", 1, ATTN_NORM);
+                                       else if (w_random<0.7)
+                                               sound(self, CHAN_PROJECTILE, "weapons/tagexp2.wav", 1, ATTN_NORM);
+                                       else
+                                               sound(self, CHAN_PROJECTILE, "weapons/tagexp3.wav", 1, ATTN_NORM);
+                               }
+                       }
+                       else if(w_deathtype & HITTYPE_HEADSHOT)
+                       {
+                               if(!w_issilent)
+                                       sound(self, CHAN_PROJECTILE, "weapons/tag_impact.wav", 1, ATTN_NORM);
+                       }
+                       else
+                       {
+                               pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
+                               if(!w_issilent)
+                               {
+                                       if (w_random<0.15)
+                                               sound(self, CHAN_PROJECTILE, "weapons/seekerexp1.wav", 1, ATTN_NORM);
+                                       else if (w_random<0.7)
+                                               sound(self, CHAN_PROJECTILE, "weapons/seekerexp2.wav", 1, ATTN_NORM);
+                                       else
+                                               sound(self, CHAN_PROJECTILE, "weapons/seekerexp3.wav", 1, ATTN_NORM);
+                               }
+                       }
+               }
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/flacexp1.wav");
+               precache_sound("weapons/flacexp2.wav");
+               precache_sound("weapons/flacexp3.wav");
+               precache_sound("weapons/seekerexp1.wav");
+               precache_sound("weapons/seekerexp2.wav");
+               precache_sound("weapons/seekerexp3.wav");
+               precache_sound("weapons/tagexp1.wav");
+               precache_sound("weapons/tagexp2.wav");
+               precache_sound("weapons/tagexp3.wav");
+               precache_sound("weapons/tag_impact.wav");
+       }
        return TRUE;
 }
 #endif
index d4352c04781629a5a88f29e2864c3b2eb49fafe9..512eb28e8ca1800407a4c838cc02c175d363c805 100644 (file)
@@ -152,6 +152,27 @@ float w_shotgun(float req)
 #ifdef CSQC
 float w_shotgun(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 2;
+               pointparticles(particleeffectnum("shotgun_impact"), org2, w_backoff * 1000, 1);
+               if(!w_issilent)
+               {
+                       if(w_random < 0.05)
+                               sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
+                       else if(w_random < 0.1)
+                               sound(self, CHAN_PROJECTILE, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
+                       else if(w_random < 0.2)
+                               sound(self, CHAN_PROJECTILE, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
+               }
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/ric1.wav");
+               precache_sound("weapons/ric2.wav");
+               precache_sound("weapons/ric3.wav");
+       }
        return TRUE;
 }
 #endif
index 295282f4762277cf45d9f5cad06e91fe0d3ca448..f3b91649159d9aef03eda4e9685cd140f036d184 100644 (file)
@@ -255,6 +255,14 @@ float w_tuba(float req)
 #ifdef CSQC
 float w_tuba(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               // nothing to do here; particles of tuba are handled differently
+       }
+       else if(req == WR_PRECACHE)
+       {
+               // nothing to do
+       }
        return TRUE;
 }
 #endif
index d6ea5c35b6ae3d14e1feaf7c0a5bde05a16c0173..5879b00b8c029a9ddb516d8e7fc5ae9c65108559 100644 (file)
@@ -141,6 +141,25 @@ float w_uzi(float req)
 #ifdef CSQC
 float w_uzi(float req)
 {
+       if(req == WR_IMPACTEFFECT)
+       {
+               vector org2;
+               org2 = w_org + w_backoff * 2;
+               pointparticles(particleeffectnum("machinegun_impact"), org2, w_backoff * 1000, 1);
+               if(!w_issilent)
+                       if(w_random < 0.05)
+                               sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
+                       else if(w_random < 0.1)
+                               sound(self, CHAN_PROJECTILE, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
+                       else if(w_random < 0.2)
+                               sound(self, CHAN_PROJECTILE, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
+       }
+       else if(req == WR_PRECACHE)
+       {
+               precache_sound("weapons/ric1.wav");
+               precache_sound("weapons/ric2.wav");
+               precache_sound("weapons/ric3.wav");
+       }
        return TRUE;
 }
 #endif