From 0de9d927d67bd8ac5d90d0801aa0a711361626d5 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 4 Jan 2012 13:41:49 +0100 Subject: [PATCH] damageextraradius for svqc too --- qcsrc/client/Defs.qc | 1 + qcsrc/client/damage.qc | 12 ++++++------ qcsrc/server/defs.qh | 3 +++ qcsrc/server/g_damage.qc | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/qcsrc/client/Defs.qc b/qcsrc/client/Defs.qc index ee721353a..5282910a2 100644 --- a/qcsrc/client/Defs.qc +++ b/qcsrc/client/Defs.qc @@ -238,6 +238,7 @@ float servertime, serverprevtime, serverdeltatime; float ticrate; .float damageforcescale; +#define MIN_DAMAGEEXTRARADIUS 2 #define MAX_DAMAGEEXTRARADIUS 16 .float damageextraradius; .void(float thisdmg, float hittype, vector org, vector thisforce) event_damage; diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index 57d4c5c0e..86df995cc 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -32,15 +32,12 @@ void Ent_DamageInfo(float isNew) for(self = findradius(w_org, rad + MAX_DAMAGEEXTRARADIUS); self; self = self.chain) { - vector p = NearestPointOnBox(self, w_org); - if(vlen(p - w_org) > rad + self.damageextraradius) - continue; - + vector nearest = NearestPointOnBox(self, w_org); if(rad) { - thisdmg = vlen(self.origin - w_org) / rad; + thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad); if(thisdmg >= 1) - thisdmg = 1; + continue; if(dmg) { thisdmg = dmg + (edge - dmg) * thisdmg; @@ -54,6 +51,9 @@ void Ent_DamageInfo(float isNew) } else { + if(vlen(nearest - w_org) > bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)) + continue; + thisdmg = dmg; thisforce = forcemul * force; } diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 62504ef62..0824cb463 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -176,6 +176,9 @@ void setanim(entity e, vector anim, float looping, float override, float restart //.float chasecam; .float damageforcescale; +#define MIN_DAMAGEEXTRARADIUS 2 +#define MAX_DAMAGEEXTRARADIUS 16 +.float damageextraradius; //.float gravity; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 170793a55..bee661f48 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -1001,7 +1001,7 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e stat_damagedone = 0; - targ = WarpZone_FindRadius (blastorigin, rad, FALSE); + targ = WarpZone_FindRadius (blastorigin, rad + MAX_DAMAGEEXTRARADIUS, FALSE); while (targ) { next = targ.chain; @@ -1014,7 +1014,7 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e 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) - 2) / rad); + power = 1 - ((vlen (diff) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad); //bprint(" "); //bprint(ftos(power)); //if (targ == attacker) -- 2.39.2