New way of handling the jumping/impact effect, plus clean up the code a lot.
authorSamual <samual@decrux.(none)>
Wed, 23 May 2012 19:06:18 +0000 (15:06 -0400)
committerSamual <samual@decrux.(none)>
Wed, 23 May 2012 19:06:18 +0000 (15:06 -0400)
25 files changed:
qcsrc/server/attic/monsters/monster_zombie.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/func_breakable.qc
qcsrc/server/g_damage.qc
qcsrc/server/tturrets/system/system_main.qc
qcsrc/server/tturrets/units/unit_flac.qc
qcsrc/server/tturrets/units/unit_walker.qc
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicles.qc
qcsrc/server/w_common.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_minelayer.qc
qcsrc/server/w_rocketlauncher.qc
qcsrc/server/w_seeker.qc
qcsrc/server/w_tuba.qc

index c95c2eaf2f819513fee854a5eaaf73ccf9ea426d..17ccd5c3bdbb6a41b893621466707c3a5ca60e06 100644 (file)
@@ -446,8 +446,8 @@ void zombie_standattack_damage()
     //self = self.owner;
 
     setorigin(self,self.owner.origin + v_forward * 32);
-    RadiusDamage(self, self.owner, autocvar_g_monster_zombie_attack_stand_damage,autocvar_g_monster_zombie_attack_stand_damage,16,self, autocvar_g_monster_zombie_attack_stand_force,DEATH_TURRET,world);
-    //float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype, entity directhitentity)
+    RadiusDamage(self, self.owner, autocvar_g_monster_zombie_attack_stand_damage,autocvar_g_monster_zombie_attack_stand_damage,16,self, world, autocvar_g_monster_zombie_attack_stand_force,DEATH_TURRET,world);
+    //float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, float deathtype, entity directhitentity)
 
 
     //self = oldself;
index 2f6a660cb203f4debee868d307f05fd4c018e4d4..deacc0771ddaf1f3371e7ab190a2c090de27e7ff 100644 (file)
@@ -294,7 +294,7 @@ float CheatImpulse(float i)
                                setorigin(e2, org);
                                pointparticles(particleeffectnum("rocket_explode"), org, '0 0 0', 1);
                                sound(e2, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
-                               RadiusDamage(e2, e, 1000, 0, 128, e, 500, DEATH_CHEAT, world);
+                               RadiusDamage(e2, e, 1000, 0, 128, e, world, 500, DEATH_CHEAT, world);
                                remove(e2);
                        }
                        print("404 Sportsmanship not found.\n");
index 704eff0ae00687c5de4402c4dff2a7367d54168e..15e73aef5cac912ab210f90a741f7674b2263196 100644 (file)
@@ -629,7 +629,7 @@ void PlayerTouchExplode(entity p1, entity p2)
        entity e;
        e = spawn();
        setorigin(e, org);
-       RadiusDamage(e, world, g_touchexplode_damage, g_touchexplode_edgedamage, g_touchexplode_radius, world, g_touchexplode_force, DEATH_TOUCHEXPLODE, world);
+       RadiusDamage(e, world, g_touchexplode_damage, g_touchexplode_edgedamage, g_touchexplode_radius, world, world, g_touchexplode_force, DEATH_TOUCHEXPLODE, world);
        remove(e);
 }
 
index 4d29b014faff68c9528bb954d3d51512e88b6d3e..81e60afb3e506e86574e9a0a2fa4079880041ae5 100644 (file)
@@ -167,7 +167,7 @@ void func_breakable_destroy() {
                sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM);
 
        if(self.dmg)
-               RadiusDamage(self, activator, self.dmg, self.dmg_edge, self.dmg_radius, self, self.dmg_force, DEATH_HURTTRIGGER, world);
+               RadiusDamage(self, activator, self.dmg, self.dmg_edge, self.dmg_radius, self, world, self.dmg_force, DEATH_HURTTRIGGER, world);
 
        if(self.cnt)
                pointparticles(self.cnt, self.absmin * 0.5 + self.absmax * 0.5, '0 0 0', self.count);
index afb6cf3f025782dd10570d66750718d55988ab1c..65bde938db5bb47cbb67b184b539eeca1ec4fe29 100644 (file)
@@ -986,7 +986,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
 }
 
 float RadiusDamage_running;
-float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float inflictorselfdamage, float forceintensity, float deathtype, entity directhitentity)
+float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, float deathtype, entity directhitentity)
        // Returns total damage applies to creatures
 {
        entity  targ;
@@ -1032,181 +1032,182 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
        {
                next = targ.chain;
                if ((targ != inflictor) || inflictorselfdamage)
-                       if (ignore != targ) if(targ.takedamage)
+               if (((cantbe != targ) && !mustbe) || (mustbe == targ))
+               if (targ.takedamage)
+               {
+                       vector nearest;
+                       vector diff;
+                       float power;
+
+                       // LordHavoc: measure distance to nearest point on target (not origin)
+                       // (this guarentees 100% damage on a touch impact)
+                       nearest = targ.WarpZone_findradius_nearest;
+                       diff = targ.WarpZone_findradius_dist;
+                       // round up a little on the damage to ensure full damage on impacts
+                       // and turn the distance into a fraction of the radius
+                       power = 1 - ((vlen (diff) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
+                       //bprint(" ");
+                       //bprint(ftos(power));
+                       //if (targ == attacker)
+                       //      print(ftos(power), "\n");
+                       if (power > 0)
                        {
-                               vector nearest;
-                               vector diff;
-                               float power;
-
-                               // LordHavoc: measure distance to nearest point on target (not origin)
-                               // (this guarentees 100% damage on a touch impact)
-                               nearest = targ.WarpZone_findradius_nearest;
-                               diff = targ.WarpZone_findradius_dist;
-                               // round up a little on the damage to ensure full damage on impacts
-                               // and turn the distance into a fraction of the radius
-                               power = 1 - ((vlen (diff) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
-                               //bprint(" ");
-                               //bprint(ftos(power));
-                               //if (targ == attacker)
-                               //      print(ftos(power), "\n");
-                               if (power > 0)
+                               float finaldmg;
+                               if (power > 1)
+                                       power = 1;
+                               finaldmg = coredamage * power + edgedamage * (1 - power);
+                               if (finaldmg > 0)
                                {
-                                       float finaldmg;
-                                       if (power > 1)
-                                               power = 1;
-                                       finaldmg = coredamage * power + edgedamage * (1 - power);
-                                       if (finaldmg > 0)
-                                       {
-                                               float a;
-                                               float c;
-                                               vector hitloc;
-                                               vector myblastorigin;
-                                               vector center;
+                                       float a;
+                                       float c;
+                                       vector hitloc;
+                                       vector myblastorigin;
+                                       vector center;
 
-                                               myblastorigin = WarpZone_TransformOrigin(targ, inflictororigin);
+                                       myblastorigin = WarpZone_TransformOrigin(targ, inflictororigin);
 
-                                               // if it's a player, use the view origin as reference
-                                               if (targ.classname == "player")
-                                                       center = targ.origin + targ.view_ofs;
-                                               else
-                                                       center = targ.origin + (targ.mins + targ.maxs) * 0.5;
+                                       // if it's a player, use the view origin as reference
+                                       if (targ.classname == "player")
+                                               center = targ.origin + targ.view_ofs;
+                                       else
+                                               center = targ.origin + (targ.mins + targ.maxs) * 0.5;
 
-                                               force = normalize(center - myblastorigin);
-                                               force = force * (finaldmg / coredamage) * forceintensity;
-                                               hitloc = nearest;
+                                       force = normalize(center - myblastorigin);
+                                       force = force * (finaldmg / coredamage) * forceintensity;
+                                       hitloc = nearest;
 
-                                               if(targ != directhitentity)
-                                               {
-                                                       float hits;
-                                                       float total;
-                                                       float hitratio;
-                                                       float mininv_f, mininv_d;
+                                       if(targ != directhitentity)
+                                       {
+                                               float hits;
+                                               float total;
+                                               float hitratio;
+                                               float mininv_f, mininv_d;
 
-                                                       // test line of sight to multiple positions on box,
-                                                       // and do damage if any of them hit
-                                                       hits = 0;
+                                               // test line of sight to multiple positions on box,
+                                               // and do damage if any of them hit
+                                               hits = 0;
 
-                                                       // we know: max stddev of hitratio = 1 / (2 * sqrt(n))
-                                                       // so for a given max stddev:
-                                                       // n = (1 / (2 * max stddev of hitratio))^2
+                                               // we know: max stddev of hitratio = 1 / (2 * sqrt(n))
+                                               // so for a given max stddev:
+                                               // n = (1 / (2 * max stddev of hitratio))^2
 
-                                                       mininv_d = (finaldmg * (1-tfloordmg)) / autocvar_g_throughfloor_damage_max_stddev;
-                                                       mininv_f = (vlen(force) * (1-tfloorforce)) / autocvar_g_throughfloor_force_max_stddev;
+                                               mininv_d = (finaldmg * (1-tfloordmg)) / autocvar_g_throughfloor_damage_max_stddev;
+                                               mininv_f = (vlen(force) * (1-tfloorforce)) / autocvar_g_throughfloor_force_max_stddev;
 
-                                                       if(autocvar_g_throughfloor_debug)
-                                                               print(sprintf("THROUGHFLOOR: D=%f F=%f max(dD)=1/%f max(dF)=1/%f", finaldmg, vlen(force), mininv_d, mininv_f));
+                                               if(autocvar_g_throughfloor_debug)
+                                                       print(sprintf("THROUGHFLOOR: D=%f F=%f max(dD)=1/%f max(dF)=1/%f", finaldmg, vlen(force), mininv_d, mininv_f));
 
-                                                       total = 0.25 * pow(max(mininv_f, mininv_d), 2);
+                                               total = 0.25 * pow(max(mininv_f, mininv_d), 2);
 
-                                                       if(autocvar_g_throughfloor_debug)
-                                                               print(sprintf(" steps=%f", total));
+                                               if(autocvar_g_throughfloor_debug)
+                                                       print(sprintf(" steps=%f", total));
 
-                                                       if (targ.classname == "player")
-                                                               total = ceil(bound(autocvar_g_throughfloor_min_steps_player, total, autocvar_g_throughfloor_max_steps_player));
-                                                       else
-                                                               total = ceil(bound(autocvar_g_throughfloor_min_steps_other, total, autocvar_g_throughfloor_max_steps_other));
+                                               if (targ.classname == "player")
+                                                       total = ceil(bound(autocvar_g_throughfloor_min_steps_player, total, autocvar_g_throughfloor_max_steps_player));
+                                               else
+                                                       total = ceil(bound(autocvar_g_throughfloor_min_steps_other, total, autocvar_g_throughfloor_max_steps_other));
 
-                                                       if(autocvar_g_throughfloor_debug)
-                                                               print(sprintf(" steps=%f dD=%f dF=%f", total, finaldmg * (1-tfloordmg) / (2 * sqrt(total)), vlen(force) * (1-tfloorforce) / (2 * sqrt(total))));
+                                               if(autocvar_g_throughfloor_debug)
+                                                       print(sprintf(" steps=%f dD=%f dF=%f", total, finaldmg * (1-tfloordmg) / (2 * sqrt(total)), vlen(force) * (1-tfloorforce) / (2 * sqrt(total))));
 
-                                                       for(c = 0; c < total; ++c)
+                                               for(c = 0; c < total; ++c)
+                                               {
+                                                       //traceline(targ.WarpZone_findradius_findorigin, nearest, MOVE_NOMONSTERS, inflictor);
+                                                       WarpZone_TraceLine(inflictororigin, WarpZone_UnTransformOrigin(targ, nearest), MOVE_NOMONSTERS, inflictor);
+                                                       if (trace_fraction == 1 || trace_ent == targ)
                                                        {
-                                                               //traceline(targ.WarpZone_findradius_findorigin, nearest, MOVE_NOMONSTERS, inflictor);
-                                                               WarpZone_TraceLine(inflictororigin, WarpZone_UnTransformOrigin(targ, nearest), MOVE_NOMONSTERS, inflictor);
-                                                               if (trace_fraction == 1 || trace_ent == targ)
-                                                               {
-                                                                       ++hits;
-                                                                       if (hits > 1)
-                                                                               hitloc = hitloc + nearest;
-                                                                       else
-                                                                               hitloc = nearest;
-                                                               }
-                                                               nearest_x = targ.origin_x + targ.mins_x + random() * targ.size_x;
-                                                               nearest_y = targ.origin_y + targ.mins_y + random() * targ.size_y;
-                                                               nearest_z = targ.origin_z + targ.mins_z + random() * targ.size_z;
+                                                               ++hits;
+                                                               if (hits > 1)
+                                                                       hitloc = hitloc + nearest;
+                                                               else
+                                                                       hitloc = nearest;
                                                        }
+                                                       nearest_x = targ.origin_x + targ.mins_x + random() * targ.size_x;
+                                                       nearest_y = targ.origin_y + targ.mins_y + random() * targ.size_y;
+                                                       nearest_z = targ.origin_z + targ.mins_z + random() * targ.size_z;
+                                               }
 
-                                                       nearest = hitloc * (1 / max(1, hits));
-                                                       hitratio = (hits / total);
-                                                       a = bound(0, tfloordmg + (1-tfloordmg) * hitratio, 1);
-                                                       finaldmg = finaldmg * a;
-                                                       a = bound(0, tfloorforce + (1-tfloorforce) * hitratio, 1);
-                                                       force = force * a;
+                                               nearest = hitloc * (1 / max(1, hits));
+                                               hitratio = (hits / total);
+                                               a = bound(0, tfloordmg + (1-tfloordmg) * hitratio, 1);
+                                               finaldmg = finaldmg * a;
+                                               a = bound(0, tfloorforce + (1-tfloorforce) * hitratio, 1);
+                                               force = force * a;
 
-                                                       if(autocvar_g_throughfloor_debug)
-                                                               print(sprintf(" D=%f F=%f\n", finaldmg, vlen(force)));
-                                               }
+                                               if(autocvar_g_throughfloor_debug)
+                                                       print(sprintf(" D=%f F=%f\n", finaldmg, vlen(force)));
+                                       }
 
-                                               // laser force adjustments :P
-                                               if(DEATH_WEAPONOF(deathtype) == WEP_LASER)
+                                       // laser force adjustments :P
+                                       if(DEATH_WEAPONOF(deathtype) == WEP_LASER)
+                                       {
+                                               if (targ == attacker)
                                                {
-                                                       if (targ == attacker)
+                                                       vector vel;
+
+                                                       float force_zscale;
+                                                       float force_velocitybiasramp;
+                                                       float force_velocitybias;
+
+                                                       force_velocitybiasramp = autocvar_sv_maxspeed;
+                                                       if(deathtype & HITTYPE_SECONDARY)
                                                        {
-                                                               vector vel;
-
-                                                               float force_zscale;
-                                                               float force_velocitybiasramp;
-                                                               float force_velocitybias;
-
-                                                               force_velocitybiasramp = autocvar_sv_maxspeed;
-                                                               if(deathtype & HITTYPE_SECONDARY)
-                                                               {
-                                                                       force_zscale = autocvar_g_balance_laser_secondary_force_zscale;
-                                                                       force_velocitybias = autocvar_g_balance_laser_secondary_force_velocitybias;
-                                                               }
-                                                               else
-                                                               {
-                                                                       force_zscale = autocvar_g_balance_laser_primary_force_zscale;
-                                                                       force_velocitybias = autocvar_g_balance_laser_primary_force_velocitybias;
-                                                               }
-
-                                                               vel = targ.velocity;
-                                                               vel_z = 0;
-                                                               vel = normalize(vel) * bound(0, vlen(vel) / force_velocitybiasramp, 1) * force_velocitybias;
-                                                               force =
-                                                                       vlen(force)
-                                                                       *
-                                                                       normalize(normalize(force) + vel);
-
-                                                               force_z *= force_zscale;
+                                                               force_zscale = autocvar_g_balance_laser_secondary_force_zscale;
+                                                               force_velocitybias = autocvar_g_balance_laser_secondary_force_velocitybias;
                                                        }
                                                        else
                                                        {
-                                                               if(deathtype & HITTYPE_SECONDARY)
-                                                               {
-                                                                       force *= autocvar_g_balance_laser_secondary_force_other_scale;
-                                                               }
-                                                               else
-                                                               {
-                                                                       force *= autocvar_g_balance_laser_primary_force_other_scale;
-                                                               }
+                                                               force_zscale = autocvar_g_balance_laser_primary_force_zscale;
+                                                               force_velocitybias = autocvar_g_balance_laser_primary_force_velocitybias;
                                                        }
-                                               }
 
-                                               //if (targ == attacker)
-                                               //{
-                                               //      print("hits ", ftos(hits), " / ", ftos(total));
-                                               //      print(" finaldmg ", ftos(finaldmg), " force ", vtos(force));
-                                               //      print(" (", ftos(a), ")\n");
-                                               //}
-                                               if(finaldmg || vlen(force))
+                                                       vel = targ.velocity;
+                                                       vel_z = 0;
+                                                       vel = normalize(vel) * bound(0, vlen(vel) / force_velocitybiasramp, 1) * force_velocitybias;
+                                                       force =
+                                                               vlen(force)
+                                                               *
+                                                               normalize(normalize(force) + vel);
+
+                                                       force_z *= force_zscale;
+                                               }
+                                               else
                                                {
-                                                       if(targ.iscreature)
+                                                       if(deathtype & HITTYPE_SECONDARY)
                                                        {
-                                                               total_damage_to_creatures += finaldmg;
-
-                                                               if(accuracy_isgooddamage(attacker, targ))
-                                                                       stat_damagedone += finaldmg;
+                                                               force *= autocvar_g_balance_laser_secondary_force_other_scale;
                                                        }
-
-                                                       if(targ == directhitentity || DEATH_ISSPECIAL(deathtype))
-                                                               Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
                                                        else
-                                                               Damage (targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, nearest, force);
+                                                       {
+                                                               force *= autocvar_g_balance_laser_primary_force_other_scale;
+                                                       }
                                                }
                                        }
+
+                                       //if (targ == attacker)
+                                       //{
+                                       //      print("hits ", ftos(hits), " / ", ftos(total));
+                                       //      print(" finaldmg ", ftos(finaldmg), " force ", vtos(force));
+                                       //      print(" (", ftos(a), ")\n");
+                                       //}
+                                       if(finaldmg || vlen(force))
+                                       {
+                                               if(targ.iscreature)
+                                               {
+                                                       total_damage_to_creatures += finaldmg;
+
+                                                       if(accuracy_isgooddamage(attacker, targ))
+                                                               stat_damagedone += finaldmg;
+                                               }
+
+                                               if(targ == directhitentity || DEATH_ISSPECIAL(deathtype))
+                                                       Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
+                                               else
+                                                       Damage (targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, nearest, force);
+                                       }
                                }
                        }
+               }
                targ = next;
        }
 
@@ -1218,9 +1219,9 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
        return total_damage_to_creatures;
 }
 
-float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype, entity directhitentity)
+float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, float deathtype, entity directhitentity)
 {
-       return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, ignore, FALSE, forceintensity, deathtype, directhitentity);
+       return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, FALSE, forceintensity, deathtype, directhitentity);
 }
 
 .float fire_damagepersec;
index c8bbf537c336ba548310dc896b9680ac41e21f20..12a3fc48ea61fa32c756f817b749a40b7fdc6373 100644 (file)
@@ -148,11 +148,11 @@ void turret_projectile_explode()
     self.event_damage = SUB_Null;    
 #ifdef TURRET_DEBUG
     float d;
-    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, self.owner.shot_force, self.totalfrags, world);
+    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
     self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d;
     self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg;
 #else
-    RadiusDamage (self, self.realowner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, self.owner.shot_force, self.totalfrags, world);
+    RadiusDamage (self, self.realowner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
 #endif
     remove(self);
 }
index 975abbd4c928254ec566a3d8858df8ad67b3f28a..0f51c10d04cf41bb1ed06c6609fda96fb9861c61 100644 (file)
@@ -10,11 +10,11 @@ void turret_flac_projectile_think_explode()
             
 #ifdef TURRET_DEBUG
     float d;
-    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, self.owner.shot_force, self.totalfrags, world);
+    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
     self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d;
     self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg;
 #else
-    RadiusDamage (self, self.realowner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, self.owner.shot_force, self.totalfrags, world);
+    RadiusDamage (self, self.realowner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
 #endif
     remove(self);
 }
index 646fccccb2b8ab7e57751e40e6f26c76e9fdcbc8..6714bf6114d6e439ddb7926f3c58dd4390521619 100644 (file)
@@ -51,7 +51,7 @@ void walker_setnoanim()
 }
 void walker_rocket_explode()
 {
-    RadiusDamage (self, self.owner, autocvar_g_turrets_unit_walker_std_rocket_dmg, 0, autocvar_g_turrets_unit_walker_std_rocket_radius, self, autocvar_g_turrets_unit_walker_std_rocket_force, DEATH_TURRET_WALKER_ROCKET, world);
+    RadiusDamage (self, self.owner, autocvar_g_turrets_unit_walker_std_rocket_dmg, 0, autocvar_g_turrets_unit_walker_std_rocket_radius, self, world, autocvar_g_turrets_unit_walker_std_rocket_force, DEATH_TURRET_WALKER_ROCKET, world);
     remove (self);
 }
 
index c6523e4b83dcd671668bc6afa50db571afb804e7..2bde9a533a649dce2358dd1d9b8f58bdc7fef4bf 100644 (file)
@@ -557,7 +557,7 @@ void racer_blowup()
 
     RadiusDamage (self, self, autocvar_g_vehicle_racer_blowup_coredamage,
                                        autocvar_g_vehicle_racer_blowup_edgedamage,
-                                       autocvar_g_vehicle_racer_blowup_radius, world,
+                                       autocvar_g_vehicle_racer_blowup_radius, world, world,
                                        autocvar_g_vehicle_racer_blowup_forceintensity,
                                        DEATH_WAKIBLOWUP, world);
 
index ad5252dfd868c83a4805d1e75fe2b05c4a25eec8..cccc9b278d7a517f5aaae44b8ab57596f74275bf 100644 (file)
@@ -79,7 +79,7 @@ void raptor_bomblet_boom()
 {
     RadiusDamage (self, self.realowner, autocvar_g_vehicle_raptor_bomblet_damage,
                                     autocvar_g_vehicle_raptor_bomblet_edgedamage,
-                                    autocvar_g_vehicle_raptor_bomblet_radius, world,
+                                    autocvar_g_vehicle_raptor_bomblet_radius, world, world,
                                     autocvar_g_vehicle_raptor_bomblet_force, DEATH_RAPTOR_BOMB, world);
     remove(self);
 }
@@ -554,7 +554,7 @@ void raptor_blowup()
 {
     self.deadflag    = DEAD_DEAD;
     self.vehicle_exit(VHEF_NORMAL);
-    RadiusDamage (self, self, 250, 15, 250, world, 250, DEATH_WAKIBLOWUP, world);
+    RadiusDamage (self, self, 250, 15, 250, world, world, 250, DEATH_WAKIBLOWUP, world);
 
     self.alpha          = -1;
     self.movetype       = MOVETYPE_NONE;
index 913e3316f012ecd2280611c1a2a05c6c6c4b0186..91136ce562bc871f768a936da6cf73a39618f73c 100644 (file)
@@ -566,7 +566,7 @@ void spiderbot_blowup()
     SUB_SetFade(g1, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10));
     SUB_SetFade(g2, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10));
 
-    RadiusDamage (self, self, 250, 15, 250, world, 250, DEATH_SBBLOWUP, world);
+    RadiusDamage (self, self, 250, 15, 250, world, world, 250, DEATH_SBBLOWUP, world);
 
     self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1;
     self.movetype   = MOVETYPE_NONE;
index bfd13a0e7d52941c5494b2104d160b9d20126c73..058ab783f05a48530b2117d18e10fbc784cbd250 100644 (file)
@@ -379,7 +379,7 @@ void vehicles_projectile_explode()
        PROJECTILE_TOUCH;
 
        self.event_damage = SUB_Null;
-    RadiusDamage (self, self.realowner, self.shot_dmg, 0, self.shot_radius, self, self.shot_force, self.totalfrags, other);
+    RadiusDamage (self, self.realowner, self.shot_dmg, 0, self.shot_radius, self, world, self.shot_force, self.totalfrags, other);
 
     remove (self);
 }
index 1cd8b812cee7e1bc324b824d964459269820bd9d..8da19cbec28f10bde4b1f3399bda4e3571c9b830 100644 (file)
@@ -148,7 +148,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
 
                // create a small explosion to throw gibs around (if applicable)
                //setorigin (explosion, hitloc);
-               //RadiusDamage (explosion, self, 10, 0, 50, world, 300, deathtype);
+               //RadiusDamage (explosion, self, 10, 0, 50, world, world, 300, deathtype);
 
                ent.railgunhitloc = '0 0 0';
                ent.railgunhitsolidbackup = SOLID_NOT;
index e748987cb56a9d9a7f2441d32930a0da47ea6084..dbc076981a26dd489df85cfe2497df92ef1916c3 100644 (file)
@@ -69,9 +69,9 @@ void W_Crylink_LinkExplode (entity e, entity e2)
                e.realowner.crylink_lastgroup = world;
 
        if(e.projectiledeathtype & HITTYPE_SECONDARY)
-               RadiusDamage (e, e.realowner, autocvar_g_balance_crylink_secondary_damage * a, autocvar_g_balance_crylink_secondary_edgedamage * a, autocvar_g_balance_crylink_secondary_radius, world, autocvar_g_balance_crylink_secondary_force * a, e.projectiledeathtype, other);
+               RadiusDamage (e, e.realowner, autocvar_g_balance_crylink_secondary_damage * a, autocvar_g_balance_crylink_secondary_edgedamage * a, autocvar_g_balance_crylink_secondary_radius, world, world, autocvar_g_balance_crylink_secondary_force * a, e.projectiledeathtype, other);
        else
-               RadiusDamage (e, e.realowner, autocvar_g_balance_crylink_primary_damage * a, autocvar_g_balance_crylink_primary_edgedamage * a, autocvar_g_balance_crylink_primary_radius, world, autocvar_g_balance_crylink_primary_force * a, e.projectiledeathtype, other);
+               RadiusDamage (e, e.realowner, autocvar_g_balance_crylink_primary_damage * a, autocvar_g_balance_crylink_primary_edgedamage * a, autocvar_g_balance_crylink_primary_radius, world, world, autocvar_g_balance_crylink_primary_force * a, e.projectiledeathtype, other);
 
        W_Crylink_LinkExplode(e.queuenext, e2);
 
@@ -201,7 +201,7 @@ void W_Crylink_LinkJoinEffect_Think()
                                        n = n / autocvar_g_balance_crylink_secondary_shots;
                                        RadiusDamage (e, e.realowner, autocvar_g_balance_crylink_secondary_joinexplode_damage * n,
                                                                        autocvar_g_balance_crylink_secondary_joinexplode_edgedamage * n,
-                                                                       autocvar_g_balance_crylink_secondary_joinexplode_radius * n, e.realowner,
+                                                                       autocvar_g_balance_crylink_secondary_joinexplode_radius * n, e.realowner, world,
                                                                        autocvar_g_balance_crylink_secondary_joinexplode_force * n, e.projectiledeathtype, other);
 
                                        pointparticles(particleeffectnum("crylink_joinexplode"), self.origin, '0 0 0', n);
@@ -214,7 +214,7 @@ void W_Crylink_LinkJoinEffect_Think()
                                        n = n / autocvar_g_balance_crylink_primary_shots;
                                        RadiusDamage (e, e.realowner, autocvar_g_balance_crylink_primary_joinexplode_damage * n,
                                                                        autocvar_g_balance_crylink_primary_joinexplode_edgedamage * n,
-                                                                       autocvar_g_balance_crylink_primary_joinexplode_radius * n, e.realowner,
+                                                                       autocvar_g_balance_crylink_primary_joinexplode_radius * n, e.realowner, world,
                                                                        autocvar_g_balance_crylink_primary_joinexplode_force * n, e.projectiledeathtype, other);
 
                                        pointparticles(particleeffectnum("crylink_joinexplode"), self.origin, '0 0 0', n);
@@ -242,7 +242,7 @@ void W_Crylink_Touch (void)
                f = autocvar_g_balance_crylink_primary_bouncedamagefactor;
        if(a)
                f *= a;
-       if (RadiusDamage (self, self.realowner, autocvar_g_balance_crylink_primary_damage * f, autocvar_g_balance_crylink_primary_edgedamage * f, autocvar_g_balance_crylink_primary_radius, world, autocvar_g_balance_crylink_primary_force * f, self.projectiledeathtype, other) && autocvar_g_balance_crylink_primary_linkexplode)
+       if (RadiusDamage (self, self.realowner, autocvar_g_balance_crylink_primary_damage * f, autocvar_g_balance_crylink_primary_edgedamage * f, autocvar_g_balance_crylink_primary_radius, world, world, autocvar_g_balance_crylink_primary_force * f, self.projectiledeathtype, other) && autocvar_g_balance_crylink_primary_linkexplode)
        {
                if(self == self.realowner.crylink_lastgroup)
                        self.realowner.crylink_lastgroup = world;
@@ -283,7 +283,7 @@ void W_Crylink_Touch2 (void)
                f = autocvar_g_balance_crylink_secondary_bouncedamagefactor;
        if(a)
                f *= a;
-       if (RadiusDamage (self, self.realowner, autocvar_g_balance_crylink_secondary_damage * f, autocvar_g_balance_crylink_secondary_edgedamage * f, autocvar_g_balance_crylink_secondary_radius, world, autocvar_g_balance_crylink_secondary_force * f, self.projectiledeathtype, other) && autocvar_g_balance_crylink_secondary_linkexplode)
+       if (RadiusDamage (self, self.realowner, autocvar_g_balance_crylink_secondary_damage * f, autocvar_g_balance_crylink_secondary_edgedamage * f, autocvar_g_balance_crylink_secondary_radius, world, world, autocvar_g_balance_crylink_secondary_force * f, self.projectiledeathtype, other) && autocvar_g_balance_crylink_secondary_linkexplode)
        {
                if(self == self.realowner.crylink_lastgroup)
                        self.realowner.crylink_lastgroup = world;
index 9b1b96e56547abaf3d4bbff42c89a41bde6c781f..5ebbce99db0b9d5e5c1e862dfd44958ca107257e 100644 (file)
@@ -39,12 +39,12 @@ void W_Plasma_Explode (void)
        self.takedamage = DAMAGE_NO;
        if (self.movetype == MOVETYPE_BOUNCE)
        {
-               RadiusDamage (self, self.realowner, autocvar_g_balance_electro_secondary_damage, autocvar_g_balance_electro_secondary_edgedamage, autocvar_g_balance_electro_secondary_radius, world, autocvar_g_balance_electro_secondary_force, self.projectiledeathtype, other);
+               RadiusDamage (self, self.realowner, autocvar_g_balance_electro_secondary_damage, autocvar_g_balance_electro_secondary_edgedamage, autocvar_g_balance_electro_secondary_radius, world, world, autocvar_g_balance_electro_secondary_force, self.projectiledeathtype, other);
        }
        else
        {
                W_Plasma_TriggerCombo(self.origin, autocvar_g_balance_electro_primary_comboradius, self.realowner);
-               RadiusDamage (self, self.realowner, autocvar_g_balance_electro_primary_damage, autocvar_g_balance_electro_primary_edgedamage, autocvar_g_balance_electro_primary_radius, world, autocvar_g_balance_electro_primary_force, self.projectiledeathtype, other);
+               RadiusDamage (self, self.realowner, autocvar_g_balance_electro_primary_damage, autocvar_g_balance_electro_primary_edgedamage, autocvar_g_balance_electro_primary_radius, world, world, autocvar_g_balance_electro_primary_force, self.projectiledeathtype, other);
        }
 
        remove (self);
@@ -55,7 +55,7 @@ void W_Plasma_Explode_Combo (void)
        W_Plasma_TriggerCombo(self.origin, autocvar_g_balance_electro_combo_comboradius, self.realowner);
 
        self.event_damage = SUB_Null;
-       RadiusDamage (self, self.realowner, autocvar_g_balance_electro_combo_damage, autocvar_g_balance_electro_combo_edgedamage, autocvar_g_balance_electro_combo_radius, world, autocvar_g_balance_electro_combo_force, WEP_ELECTRO | HITTYPE_BOUNCE, world); // use THIS type for a combo because primary can't bounce
+       RadiusDamage (self, self.realowner, autocvar_g_balance_electro_combo_damage, autocvar_g_balance_electro_combo_edgedamage, autocvar_g_balance_electro_combo_radius, world, world, autocvar_g_balance_electro_combo_force, WEP_ELECTRO | HITTYPE_BOUNCE, world); // use THIS type for a combo because primary can't bounce
        remove (self);
 }
 
index 1c950aca4a58ddc2b3e1eff4092008df91a086a7..d3e1d66ed60782fd4f27fabe7f5dc588faded6ba 100644 (file)
@@ -19,7 +19,7 @@ void W_Fireball_Explode (void)
 
        // 1. dist damage
        d = (self.realowner.health + self.realowner.armorvalue);
-       RadiusDamage (self, self.realowner, autocvar_g_balance_fireball_primary_damage, autocvar_g_balance_fireball_primary_edgedamage, autocvar_g_balance_fireball_primary_radius, world, autocvar_g_balance_fireball_primary_force, self.projectiledeathtype, other);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_fireball_primary_damage, autocvar_g_balance_fireball_primary_edgedamage, autocvar_g_balance_fireball_primary_radius, world, world, autocvar_g_balance_fireball_primary_force, self.projectiledeathtype, other);
        if(self.realowner.health + self.realowner.armorvalue >= d)
        if(!self.cnt)
        {
index 352ce883bd255fb49c9ebf0ff95bdb9bf40c06f1..391255d66d257a0646c8198ac2ea088d4688e2fb 100644 (file)
@@ -20,7 +20,7 @@ void W_Grenade_Explode (void)
        if(self.movetype == MOVETYPE_NONE)
                self.velocity = self.oldvelocity;
 
-       RadiusDamage (self, self.realowner, autocvar_g_balance_grenadelauncher_primary_damage, autocvar_g_balance_grenadelauncher_primary_edgedamage, autocvar_g_balance_grenadelauncher_primary_radius, world, autocvar_g_balance_grenadelauncher_primary_force, self.projectiledeathtype, other);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_grenadelauncher_primary_damage, autocvar_g_balance_grenadelauncher_primary_edgedamage, autocvar_g_balance_grenadelauncher_primary_radius, world, world, autocvar_g_balance_grenadelauncher_primary_force, self.projectiledeathtype, other);
 
        remove (self);
 }
@@ -40,7 +40,7 @@ void W_Grenade_Explode2 (void)
        if(self.movetype == MOVETYPE_NONE)
                self.velocity = self.oldvelocity;
 
-       RadiusDamage (self, self.realowner, autocvar_g_balance_grenadelauncher_secondary_damage, autocvar_g_balance_grenadelauncher_secondary_edgedamage, autocvar_g_balance_grenadelauncher_secondary_radius, world, autocvar_g_balance_grenadelauncher_secondary_force, self.projectiledeathtype, other);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_grenadelauncher_secondary_damage, autocvar_g_balance_grenadelauncher_secondary_edgedamage, autocvar_g_balance_grenadelauncher_secondary_radius, world, world, autocvar_g_balance_grenadelauncher_secondary_force, self.projectiledeathtype, other);
 
        remove (self);
 }
index f3a200f1ca230d9b016e07e2803cea15dbf5310e..931072909c0f7d56a36491bf330b8a773d392568 100644 (file)
@@ -7,7 +7,7 @@ REGISTER_WEAPON(HAGAR, w_hagar, IT_ROCKETS, 8, WEP_FLAG_NORMAL | WEP_FLAG_RELOAD
 void W_Hagar_Explode (void)
 {
        self.event_damage = SUB_Null;
-       RadiusDamage (self, self.realowner, autocvar_g_balance_hagar_primary_damage, autocvar_g_balance_hagar_primary_edgedamage, autocvar_g_balance_hagar_primary_radius, world, autocvar_g_balance_hagar_primary_force, self.projectiledeathtype, other);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_hagar_primary_damage, autocvar_g_balance_hagar_primary_edgedamage, autocvar_g_balance_hagar_primary_radius, world, world, autocvar_g_balance_hagar_primary_force, self.projectiledeathtype, other);
 
        remove (self);
 }
@@ -15,7 +15,7 @@ void W_Hagar_Explode (void)
 void W_Hagar_Explode2 (void)
 {
        self.event_damage = SUB_Null;
-       RadiusDamage (self, self.realowner, autocvar_g_balance_hagar_secondary_damage, autocvar_g_balance_hagar_secondary_edgedamage, autocvar_g_balance_hagar_secondary_radius, world, autocvar_g_balance_hagar_secondary_force, self.projectiledeathtype, other);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_hagar_secondary_damage, autocvar_g_balance_hagar_secondary_edgedamage, autocvar_g_balance_hagar_secondary_radius, world, world, autocvar_g_balance_hagar_secondary_force, self.projectiledeathtype, other);
 
        remove (self);
 }
index 62be05f0dcf62a3a8b21bfef514715f9438ca39b..49d68f2c899be04bc83b2adf927ad778f481c324 100644 (file)
@@ -10,9 +10,9 @@ void W_HLAC_Touch (void)
        self.event_damage = SUB_Null;
        
        if(self.projectiledeathtype & HITTYPE_SECONDARY)
-               RadiusDamage (self, self.realowner, autocvar_g_balance_hlac_secondary_damage, autocvar_g_balance_hlac_secondary_edgedamage, autocvar_g_balance_hlac_secondary_radius, world, autocvar_g_balance_hlac_secondary_force, self.projectiledeathtype, other);
+               RadiusDamage (self, self.realowner, autocvar_g_balance_hlac_secondary_damage, autocvar_g_balance_hlac_secondary_edgedamage, autocvar_g_balance_hlac_secondary_radius, world, world, autocvar_g_balance_hlac_secondary_force, self.projectiledeathtype, other);
        else
-               RadiusDamage (self, self.realowner, autocvar_g_balance_hlac_primary_damage, autocvar_g_balance_hlac_primary_edgedamage, autocvar_g_balance_hlac_primary_radius, world, autocvar_g_balance_hlac_primary_force, self.projectiledeathtype, other);
+               RadiusDamage (self, self.realowner, autocvar_g_balance_hlac_primary_damage, autocvar_g_balance_hlac_primary_edgedamage, autocvar_g_balance_hlac_primary_radius, world, world, autocvar_g_balance_hlac_primary_force, self.projectiledeathtype, other);
 
        remove (self);
 }
index 695ac381fe55afcaeb750f2890e313addb6ef915..c419c7993ccfdb76c34e2f75a6ea77385a7b13f9 100644 (file)
@@ -23,9 +23,9 @@ void W_Hook_ExplodeThink (void)
        f = self.dmg_last - dmg_remaining_next;
        self.dmg_last = dmg_remaining_next;
 
-       RadiusDamage (self, self.realowner, self.dmg * f, self.dmg_edge * f, self.dmg_radius, self.realowner, self.dmg_force * f, self.projectiledeathtype, world);
+       RadiusDamage (self, self.realowner, self.dmg * f, self.dmg_edge * f, self.dmg_radius, self.realowner, world, self.dmg_force * f, self.projectiledeathtype, world);
        self.projectiledeathtype |= HITTYPE_BOUNCE;
-       //RadiusDamage (self, world, self.dmg * f, self.dmg_edge * f, self.dmg_radius, world, self.dmg_force * f, self.projectiledeathtype, world);
+       //RadiusDamage (self, world, self.dmg * f, self.dmg_edge * f, self.dmg_radius, world, world, self.dmg_force * f, self.projectiledeathtype, world);
 
        if(dt < self.dmg_duration)
                self.nextthink = time + 0.05; // soon
index 35a82f72a5e1d0a8b9a05ea66ef7dda507d6cc30..0f6ac967206751ba52d18e74146a5024020bc451 100644 (file)
@@ -25,9 +25,9 @@ void W_Laser_Touch (void)
 
        self.event_damage = SUB_Null;
        if (self.dmg)
-               RadiusDamage (self, self.realowner, autocvar_g_balance_laser_secondary_damage, autocvar_g_balance_laser_secondary_edgedamage, autocvar_g_balance_laser_secondary_radius, world, autocvar_g_balance_laser_secondary_force, self.projectiledeathtype, other);
+               RadiusDamage (self, self.realowner, autocvar_g_balance_laser_secondary_damage, autocvar_g_balance_laser_secondary_edgedamage, autocvar_g_balance_laser_secondary_radius, world, world, autocvar_g_balance_laser_secondary_force, self.projectiledeathtype, other);
        else
-               RadiusDamage (self, self.realowner, autocvar_g_balance_laser_primary_damage, autocvar_g_balance_laser_primary_edgedamage, autocvar_g_balance_laser_primary_radius, world, autocvar_g_balance_laser_primary_force, self.projectiledeathtype, other);
+               RadiusDamage (self, self.realowner, autocvar_g_balance_laser_primary_damage, autocvar_g_balance_laser_primary_edgedamage, autocvar_g_balance_laser_primary_radius, world, world, autocvar_g_balance_laser_primary_force, self.projectiledeathtype, other);
 
        remove (self);
 }
@@ -48,124 +48,106 @@ void W_Laser_Shockwave (void)
        // declarations
        float final_damage, final_spread;
        entity head, next, aim_ent;
-       vector nearest, attack_endpos, attack_hitpos, angle_to_head, angle_to_attack, final_force, center;
+       vector nearest, attack_hitpos, angle_to_head, angle_to_attack, final_force, center;
        
        // set up the shot direction
        vector wanted_shot_direction = (v_forward * cos(autocvar_g_balance_laser_primary_shotangle * DEG2RAD) + v_up * sin(autocvar_g_balance_laser_primary_shotangle * DEG2RAD));
        W_SetupShot_Dir(self, wanted_shot_direction, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, autocvar_g_balance_laser_primary_damage);
-       vector targpos = (w_shotorg + (w_shotdir * autocvar_g_balance_laser_primary_jumpradius));
+       vector attack_endpos = (w_shotorg + (w_shotdir * autocvar_g_balance_laser_primary_radius));
 
-       // trace to see if this is a self jump
-       WarpZone_TraceLine(w_shotorg, targpos, FALSE, self);
-       //te_lightning2(world, targpos, w_shotorg);
-
-       if(trace_fraction < 1) // Yes, it is a close range jump
+       // find out what we're pointing at
+       WarpZone_TraceLine(w_shotorg, attack_endpos, FALSE, self);
+       aim_ent = trace_ent;
+       attack_hitpos = trace_endpos;
+       
+       // do the jump explosion now (also handles the impact effect)
+       RadiusDamageForSource(self, trace_endpos, '0 0 0', self, autocvar_g_balance_laser_primary_damage, autocvar_g_balance_laser_primary_edgedamage, autocvar_g_balance_laser_primary_jumpradius, world, self, TRUE, autocvar_g_balance_laser_primary_force, WEP_LASER, world);
+       
+       // also do the firing effect now
+       SendCSQCShockwaveParticle(autocvar_g_balance_laser_primary_spread, attack_hitpos);
+       
+       // did we hit a player directly?
+       if(aim_ent.takedamage)
        {
-               RadiusDamageForSource(self, trace_endpos, '0 0 0', self, autocvar_g_balance_laser_primary_damage, autocvar_g_balance_laser_primary_edgedamage, autocvar_g_balance_laser_primary_jumpradius, world, TRUE, autocvar_g_balance_laser_primary_force, WEP_LASER, world);
-               SendCSQCShockwaveParticle(autocvar_g_balance_laser_primary_spread, trace_endpos);
+               // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
+               if (aim_ent.classname == "player")
+                       center = aim_ent.origin + aim_ent.view_ofs;
+               else
+                       center = aim_ent.origin + (aim_ent.mins + aim_ent.maxs) * 0.5;
+
+               final_force = (normalize(center - attack_hitpos) * autocvar_g_balance_laser_primary_force);
+               Damage(aim_ent, self, self, autocvar_g_balance_laser_primary_damage, WEP_LASER, w_shotorg, final_force);
+               print("Player hit directly via aim!\n");
        }
-       else // No, it's a mid range attack
+
+       // now figure out if I hit anything else than what my aim directly pointed at...
+       head = WarpZone_FindRadius(w_shotorg, autocvar_g_balance_laser_primary_radius, FALSE);
+       while(head)
        {
-               // find out what i'm pointing at
-               targpos = (w_shotorg + (w_shotdir * autocvar_g_balance_laser_primary_radius));
-               WarpZone_TraceLine(w_shotorg, targpos, FALSE, self);
-               
-               //te_lightning2(world, trace_endpos, w_shotorg);
+               next = head.chain;
                
-               aim_ent = trace_ent;
-               attack_hitpos = trace_endpos;
-               //total_attack_range = vlen(w_shotorg - trace_endpos);
-               
-               if(aim_ent.takedamage) // we actually aimed at a player // TODO: not sure if i should detect players like this
+               if((head != self && head != aim_ent) && (head.takedamage))
                {
                        // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
-                       if (aim_ent.classname == "player")
-                               center = aim_ent.origin + aim_ent.view_ofs;
+                       if (head.classname == "player")
+                               center = head.origin + head.view_ofs;
                        else
-                               center = aim_ent.origin + (aim_ent.mins + aim_ent.maxs) * 0.5;
-
-                       final_force = (normalize(center - attack_hitpos) * autocvar_g_balance_laser_primary_force);
-                       Damage(aim_ent, self, self, autocvar_g_balance_laser_primary_damage, WEP_LASER, w_shotorg, final_force);
-                       print("Player hit directly via aim!\n");
-               }
-
-               attack_endpos = w_shotorg + (w_shotdir * autocvar_g_balance_laser_primary_radius);
+                               center = head.origin + (head.mins + head.maxs) * 0.5;
 
-               // now figure out if I hit anything else than what my aim directly pointed at...
-               head = WarpZone_FindRadius(w_shotorg, autocvar_g_balance_laser_primary_radius, FALSE);
-               while(head)
-               {
-                       next = head.chain;
+                       // find the closest point on the enemy to the center of the attack
+                       float h = vlen(center - self.origin);
+                       float ang = acos(dotproduct(normalize(center - self.origin), w_shotdir));
+                       float a = h * cos(ang);
                        
-                       if((head != self && head != aim_ent) && (head.takedamage))
-                       {
-                               // is it in range of the attack?
-                               //nearest = WarpZoneLib_NearestPointOnBox(head.origin + head.mins, head.origin + head.maxs, w_shotorg); // won't this just find the nearest point on the bbox from the attacker? we probably don't want this...
-
-                               // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
-                               if (head.classname == "player")
-                                       center = head.origin + head.view_ofs;
-                               else
-                                       center = head.origin + (head.mins + head.maxs) * 0.5;
+                       // ang = angle between shotdir and h
+                       // h = hypotenuse, which is the distance between attacker to head
+                       // a = adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
 
-                               float ang, h, a;        // ang = angle between h, a
-                                                                       // h = hypotenuse, which is the distance between attacker to head
-                                                                       // a = adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
+                       nearest = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, w_shotorg + a * w_shotdir);
 
-                               h = vlen(center - self.origin);
-                               ang = acos(dotproduct(normalize(center - self.origin), w_shotdir)); // angle between shotdir and h
-
-                               a = h * cos(ang);
-
-                               nearest = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, w_shotorg + a * w_shotdir);
-
-                               if(vlen(w_shotorg - nearest) <= autocvar_g_balance_laser_primary_radius)
+                       if(vlen(w_shotorg - nearest) <= autocvar_g_balance_laser_primary_radius)
+                       {
+                               // is it within the limit of the spread?
+                               nearest = head.WarpZone_findradius_nearest;
+                               angle_to_head = normalize(nearest - w_shotorg);
+                               angle_to_attack = w_shotdir;
+                               final_spread = vlen(angle_to_head - angle_to_attack);
+                               if(final_spread <= autocvar_g_balance_laser_primary_spread)
                                {
-                                       // is it within the limit of the spread?
-                                       nearest = head.WarpZone_findradius_nearest;
-                                       angle_to_head = normalize(nearest - w_shotorg);
-                                       angle_to_attack = w_shotdir;
-                                       final_spread = vlen(angle_to_head - angle_to_attack);
-                                       if(final_spread <= autocvar_g_balance_laser_primary_spread)
-                                       {
-                                               // TODO! we MUST check this, otherwise you can shoot through walls!
-                                               // just how to make sure that if a small part of the player is visible, we'll hit him?
-                                               // we can just do it the cheap way of tracing from shotorg to nearest, but what if there's an obstruction between those points, but the player still sees the enemy...?
-
-                                               // is it visible to the weapon?
-                                               //WarpZone_TraceLine(w_shotorg, nearest, MOVE_WORLDONLY, self);
-                                               //if(trace_fraction == 1)
-                                               //{
-                                                       // finally lets do some damage bitches!
-                                                       if(autocvar_g_balance_laser_primary_spread)
-                                                               final_damage = (final_spread / autocvar_g_balance_laser_primary_spread);
-                                                       else
-                                                               final_damage = 1;
-
-                                                       //final_force = (normalize(nearest - w_shotorg) * autocvar_g_balance_laser_primary_force); // we dont want to use nearest here, because that would result in some rather weird force dirs for the attacker...
-                                                       print(strcat("head.origin: ", vtos(head.origin), ", (w_shotorg + a * w_shotdir): ", vtos(w_shotorg + a * w_shotdir), ".\n"));
-                                                       print("a = ", ftos(a), " h = ", ftos(h), " ang = ", ftos(ang), "\n");
-                                                       final_force = (normalize(center - (w_shotorg + a * w_shotdir)) * autocvar_g_balance_laser_primary_force);
-                                                       final_damage = (autocvar_g_balance_laser_primary_damage * final_damage + autocvar_g_balance_laser_primary_edgedamage * (1 - final_damage));
-                                                       
-                                                       print(strcat("damage: ", ftos(final_damage), ", force: ", vtos(final_force), ".\n"));
-                                                       
-                                                       Damage(head, self, self, final_damage, WEP_LASER, w_shotorg, final_force);
-                                                       
-                                                       print(strcat(vtos(angle_to_head), " - ", vtos(angle_to_attack), ": ", ftos(vlen(angle_to_head - angle_to_attack)), ".\n"));
-                                                       //te_lightning2(world, nearest, w_shotorg);
-                                                       
-                                                       //pointparticles(particleeffectnum("rocket_guide"), w_shotorg, w_shotdir * 1000, 1);
-                                                       //SendCSQCShockwaveParticle(autocvar_g_balance_laser_primary_spread, trace_endpos);
-                                               //}
-                                       }
+                                       // TODO! we MUST check this, otherwise you can shoot through walls!
+                                       // just how to make sure that if a small part of the player is visible, we'll hit him?
+                                       // we can just do it the cheap way of tracing from shotorg to nearest, but what if there's an obstruction between those points, but the player still sees the enemy...?
+
+                                       // is it visible to the weapon?
+                                       //WarpZone_TraceLine(w_shotorg, nearest, MOVE_WORLDONLY, self);
+                                       //if(trace_fraction == 1)
+                                       //{
+                                               // finally lets do some damage bitches!
+                                               if(autocvar_g_balance_laser_primary_spread)
+                                                       final_damage = (final_spread / autocvar_g_balance_laser_primary_spread);
+                                               else
+                                                       final_damage = 1;
+
+                                               //final_force = (normalize(nearest - w_shotorg) * autocvar_g_balance_laser_primary_force); // we dont want to use nearest here, because that would result in some rather weird force dirs for the attacker...
+                                               print(strcat("head.origin: ", vtos(head.origin), ", (w_shotorg + a * w_shotdir): ", vtos(w_shotorg + a * w_shotdir), ".\n"));
+                                               print("a = ", ftos(a), " h = ", ftos(h), " ang = ", ftos(ang), "\n");
+                                               final_force = (normalize(center - (w_shotorg + a * w_shotdir)) * autocvar_g_balance_laser_primary_force);
+                                               final_damage = (autocvar_g_balance_laser_primary_damage * final_damage + autocvar_g_balance_laser_primary_edgedamage * (1 - final_damage));
+                                               
+                                               print(strcat("damage: ", ftos(final_damage), ", force: ", vtos(final_force), ".\n"));
+                                               
+                                               Damage(head, self, self, final_damage, WEP_LASER, head.origin, final_force);
+                                               
+                                               print(strcat(vtos(angle_to_head), " - ", vtos(angle_to_attack), ": ", ftos(vlen(angle_to_head - angle_to_attack)), ".\n"));
+                                               //te_lightning2(world, nearest, w_shotorg);
+                                               
+                                               //pointparticles(particleeffectnum("rocket_guide"), w_shotorg, w_shotdir * 1000, 1);
+                                               //SendCSQCShockwaveParticle(autocvar_g_balance_laser_primary_spread, trace_endpos);
+                                       //}
                                }
                        }
-                       
-                       head = next;
                }
-               SendCSQCShockwaveParticle(autocvar_g_balance_laser_primary_spread, trace_endpos);
-               //pointparticles(particleeffectnum("laser_shockwave_attack"), w_shotorg, w_shotdir * 1000, 1);
+               head = next;
        }
 }
 
index 5bf98d7524ab256e33d1a73938088ec887a2f38f..58c189f1635e7ab8a87b6b6d4a2da19b42f4a1db 100644 (file)
@@ -70,7 +70,7 @@ void W_Mine_Explode ()
        self.event_damage = SUB_Null;
        self.takedamage = DAMAGE_NO;
 
-       RadiusDamage (self, self.realowner, autocvar_g_balance_minelayer_damage, autocvar_g_balance_minelayer_edgedamage, autocvar_g_balance_minelayer_radius, world, autocvar_g_balance_minelayer_force, self.projectiledeathtype, other);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_minelayer_damage, autocvar_g_balance_minelayer_edgedamage, autocvar_g_balance_minelayer_radius, world, world, autocvar_g_balance_minelayer_force, self.projectiledeathtype, other);
 
        if (self.realowner.weapon == WEP_MINE_LAYER)
        {
@@ -97,7 +97,7 @@ void W_Mine_DoRemoteExplode ()
        if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW)
                self.velocity = self.oldvelocity;
 
-       RadiusDamage (self, self.realowner, autocvar_g_balance_minelayer_remote_damage, autocvar_g_balance_minelayer_remote_edgedamage, autocvar_g_balance_minelayer_remote_radius, world, autocvar_g_balance_minelayer_remote_force, self.projectiledeathtype | HITTYPE_BOUNCE, world);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_minelayer_remote_damage, autocvar_g_balance_minelayer_remote_edgedamage, autocvar_g_balance_minelayer_remote_radius, world, world, autocvar_g_balance_minelayer_remote_force, self.projectiledeathtype | HITTYPE_BOUNCE, world);
 
        if (self.realowner.weapon == WEP_MINE_LAYER)
        {
index 42ae90d7466e84c0a46740c9ec2cef614ce873ef..ae1718aba428c5e08e6fcb720c5e8e6c0e6c9c8c 100644 (file)
@@ -28,7 +28,7 @@ void W_Rocket_Explode ()
        self.event_damage = SUB_Null;
        self.takedamage = DAMAGE_NO;
 
-       RadiusDamage (self, self.realowner, autocvar_g_balance_rocketlauncher_damage, autocvar_g_balance_rocketlauncher_edgedamage, autocvar_g_balance_rocketlauncher_radius, world, autocvar_g_balance_rocketlauncher_force, self.projectiledeathtype, other);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_rocketlauncher_damage, autocvar_g_balance_rocketlauncher_edgedamage, autocvar_g_balance_rocketlauncher_radius, world, world, autocvar_g_balance_rocketlauncher_force, self.projectiledeathtype, other);
 
        if (self.realowner.weapon == WEP_ROCKET_LAUNCHER)
        {
@@ -49,7 +49,7 @@ void W_Rocket_DoRemoteExplode ()
        self.event_damage = SUB_Null;
        self.takedamage = DAMAGE_NO;
 
-       RadiusDamage (self, self.realowner, autocvar_g_balance_rocketlauncher_remote_damage, autocvar_g_balance_rocketlauncher_remote_edgedamage, autocvar_g_balance_rocketlauncher_remote_radius, world, autocvar_g_balance_rocketlauncher_remote_force, self.projectiledeathtype | HITTYPE_BOUNCE, world);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_rocketlauncher_remote_damage, autocvar_g_balance_rocketlauncher_remote_edgedamage, autocvar_g_balance_rocketlauncher_remote_radius, world, world, autocvar_g_balance_rocketlauncher_remote_force, self.projectiledeathtype | HITTYPE_BOUNCE, world);
 
        if (self.realowner.weapon == WEP_ROCKET_LAUNCHER)
        {
index f5a3e3b1678fe5e4092700003e838c0c7856e1e2..56efcd91373295041160a8618c0d13d185812896 100644 (file)
@@ -13,7 +13,7 @@ REGISTER_WEAPON(SEEKER, w_seeker, IT_ROCKETS, 8, WEP_FLAG_MUTATORBLOCKED | WEP_F
 void Seeker_Missile_Explode ()
 {
        self.event_damage = SUB_Null;
-       RadiusDamage (self, self.realowner, autocvar_g_balance_seeker_missile_damage, autocvar_g_balance_seeker_missile_edgedamage, autocvar_g_balance_seeker_missile_radius, world, autocvar_g_balance_seeker_missile_force, self.projectiledeathtype, other);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_seeker_missile_damage, autocvar_g_balance_seeker_missile_edgedamage, autocvar_g_balance_seeker_missile_radius, world, world, autocvar_g_balance_seeker_missile_force, self.projectiledeathtype, other);
 
        remove (self);
 }
@@ -223,7 +223,7 @@ void Seeker_Flac_Explode ()
 {
        self.event_damage = SUB_Null;
 
-       RadiusDamage (self, self.realowner, autocvar_g_balance_seeker_flac_damage, autocvar_g_balance_seeker_flac_edgedamage, autocvar_g_balance_seeker_flac_radius, world, autocvar_g_balance_seeker_flac_force, self.projectiledeathtype, other);
+       RadiusDamage (self, self.realowner, autocvar_g_balance_seeker_flac_damage, autocvar_g_balance_seeker_flac_edgedamage, autocvar_g_balance_seeker_flac_radius, world, world, autocvar_g_balance_seeker_flac_force, self.projectiledeathtype, other);
 
        remove (self);
 }
index f19a50208293073f1507fc4bf2beec258456fa13..3a8798627b44dd5542dd302a695c2b8a8c9c0d00 100644 (file)
@@ -313,7 +313,7 @@ void W_Tuba_NoteOn(float hittype)
        self.tuba_note.teleport_time = time + autocvar_g_balance_tuba_refire * 2 * W_WeaponRateFactor(); // so it can get prolonged safely
 
        //sound(self, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation);
-       RadiusDamage(self, self, autocvar_g_balance_tuba_damage, autocvar_g_balance_tuba_edgedamage, autocvar_g_balance_tuba_radius, world, autocvar_g_balance_tuba_force, hittype | WEP_TUBA, world);
+       RadiusDamage(self, self, autocvar_g_balance_tuba_damage, autocvar_g_balance_tuba_edgedamage, autocvar_g_balance_tuba_radius, world, world, autocvar_g_balance_tuba_force, hittype | WEP_TUBA, world);
 
        o = gettaginfo(self.exteriorweaponentity, 0);
        if(time > self.tuba_smoketime)