From: Samual Date: Wed, 23 May 2012 19:06:18 +0000 (-0400) Subject: New way of handling the jumping/impact effect, plus clean up the code a lot. X-Git-Tag: xonotic-v0.8.0~152^2~408^2~82 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=843a085dca954113bc0d04f99eddc919592fd6e7 New way of handling the jumping/impact effect, plus clean up the code a lot. --- diff --git a/qcsrc/server/attic/monsters/monster_zombie.qc b/qcsrc/server/attic/monsters/monster_zombie.qc index c95c2eaf2f..17ccd5c3bd 100644 --- a/qcsrc/server/attic/monsters/monster_zombie.qc +++ b/qcsrc/server/attic/monsters/monster_zombie.qc @@ -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; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 2f6a660cb2..deacc0771d 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -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"); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 704eff0ae0..15e73aef5c 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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); } diff --git a/qcsrc/server/func_breakable.qc b/qcsrc/server/func_breakable.qc index 4d29b014fa..81e60afb3e 100644 --- a/qcsrc/server/func_breakable.qc +++ b/qcsrc/server/func_breakable.qc @@ -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); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index afb6cf3f02..65bde938db 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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; diff --git a/qcsrc/server/tturrets/system/system_main.qc b/qcsrc/server/tturrets/system/system_main.qc index c8bbf537c3..12a3fc48ea 100644 --- a/qcsrc/server/tturrets/system/system_main.qc +++ b/qcsrc/server/tturrets/system/system_main.qc @@ -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); } diff --git a/qcsrc/server/tturrets/units/unit_flac.qc b/qcsrc/server/tturrets/units/unit_flac.qc index 975abbd4c9..0f51c10d04 100644 --- a/qcsrc/server/tturrets/units/unit_flac.qc +++ b/qcsrc/server/tturrets/units/unit_flac.qc @@ -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); } diff --git a/qcsrc/server/tturrets/units/unit_walker.qc b/qcsrc/server/tturrets/units/unit_walker.qc index 646fccccb2..6714bf6114 100644 --- a/qcsrc/server/tturrets/units/unit_walker.qc +++ b/qcsrc/server/tturrets/units/unit_walker.qc @@ -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); } diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index c6523e4b83..2bde9a533a 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -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); diff --git a/qcsrc/server/vehicles/raptor.qc b/qcsrc/server/vehicles/raptor.qc index ad5252dfd8..cccc9b278d 100644 --- a/qcsrc/server/vehicles/raptor.qc +++ b/qcsrc/server/vehicles/raptor.qc @@ -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; diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index 913e3316f0..91136ce562 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -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; diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc index bfd13a0e7d..058ab783f0 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicles.qc @@ -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); } diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index 1cd8b812ce..8da19cbec2 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -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; diff --git a/qcsrc/server/w_crylink.qc b/qcsrc/server/w_crylink.qc index e748987cb5..dbc076981a 100644 --- a/qcsrc/server/w_crylink.qc +++ b/qcsrc/server/w_crylink.qc @@ -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; diff --git a/qcsrc/server/w_electro.qc b/qcsrc/server/w_electro.qc index 9b1b96e565..5ebbce99db 100644 --- a/qcsrc/server/w_electro.qc +++ b/qcsrc/server/w_electro.qc @@ -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); } diff --git a/qcsrc/server/w_fireball.qc b/qcsrc/server/w_fireball.qc index 1c950aca4a..d3e1d66ed6 100644 --- a/qcsrc/server/w_fireball.qc +++ b/qcsrc/server/w_fireball.qc @@ -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) { diff --git a/qcsrc/server/w_grenadelauncher.qc b/qcsrc/server/w_grenadelauncher.qc index 352ce883bd..391255d66d 100644 --- a/qcsrc/server/w_grenadelauncher.qc +++ b/qcsrc/server/w_grenadelauncher.qc @@ -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); } diff --git a/qcsrc/server/w_hagar.qc b/qcsrc/server/w_hagar.qc index f3a200f1ca..931072909c 100644 --- a/qcsrc/server/w_hagar.qc +++ b/qcsrc/server/w_hagar.qc @@ -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); } diff --git a/qcsrc/server/w_hlac.qc b/qcsrc/server/w_hlac.qc index 62be05f0dc..49d68f2c89 100644 --- a/qcsrc/server/w_hlac.qc +++ b/qcsrc/server/w_hlac.qc @@ -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); } diff --git a/qcsrc/server/w_hook.qc b/qcsrc/server/w_hook.qc index 695ac381fe..c419c7993c 100644 --- a/qcsrc/server/w_hook.qc +++ b/qcsrc/server/w_hook.qc @@ -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 diff --git a/qcsrc/server/w_laser.qc b/qcsrc/server/w_laser.qc index 35a82f72a5..0f6ac96720 100644 --- a/qcsrc/server/w_laser.qc +++ b/qcsrc/server/w_laser.qc @@ -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; } } diff --git a/qcsrc/server/w_minelayer.qc b/qcsrc/server/w_minelayer.qc index 5bf98d7524..58c189f163 100644 --- a/qcsrc/server/w_minelayer.qc +++ b/qcsrc/server/w_minelayer.qc @@ -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) { diff --git a/qcsrc/server/w_rocketlauncher.qc b/qcsrc/server/w_rocketlauncher.qc index 42ae90d746..ae1718aba4 100644 --- a/qcsrc/server/w_rocketlauncher.qc +++ b/qcsrc/server/w_rocketlauncher.qc @@ -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) { diff --git a/qcsrc/server/w_seeker.qc b/qcsrc/server/w_seeker.qc index f5a3e3b167..56efcd9137 100644 --- a/qcsrc/server/w_seeker.qc +++ b/qcsrc/server/w_seeker.qc @@ -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); } diff --git a/qcsrc/server/w_tuba.qc b/qcsrc/server/w_tuba.qc index f19a502082..3a8798627b 100644 --- a/qcsrc/server/w_tuba.qc +++ b/qcsrc/server/w_tuba.qc @@ -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)