]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
damageextraradius for svqc too
authorRudolf Polzer <divverent@alientrap.org>
Wed, 4 Jan 2012 12:41:49 +0000 (13:41 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 4 Jan 2012 12:41:49 +0000 (13:41 +0100)
qcsrc/client/Defs.qc
qcsrc/client/damage.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc

index ee721353a934bc5cb6d6068966d778ee0d5bce13..5282910a2ad6288f756e48f599f539bc9e153ac8 100644 (file)
@@ -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;
index 57d4c5c0e7da66651f4280e8abdadabea0d6e072..86df995cc3283cc46065cffce629be026fd84206 100644 (file)
@@ -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;
                }
index 62504ef62f89498bf4c2afeedc12932ac841a6f8..0824cb46369434a955d5e5110b437d28dfe0e9f8 100644 (file)
@@ -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;
 
index 170793a5524b0621760b283023dbee138a205132..bee661f48817a75bc114684e1675a395b4cff2ef 100644 (file)
@@ -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)