]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mirceakitsune/damage_effects
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Jan 2012 12:47:29 +0000 (14:47 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Jan 2012 12:47:29 +0000 (14:47 +0200)
qcsrc/client/Defs.qc
qcsrc/client/damage.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc

index 901380c1bb28e130df82c992a1a33a27f289892d..5282910a2ad6288f756e48f599f539bc9e153ac8 100644 (file)
@@ -238,6 +238,9 @@ 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;
 
 // only for Porto
index 635b467a0569e751ddb46c4ac7238973927d3c8b..8784c12eaf5caa2c8c1457ab912c8b10c267921b 100644 (file)
@@ -32,11 +32,12 @@ void Ent_DamageInfo(float isNew)
        else
                forcemul = 1;
        
-       for(self = findradius(w_org, rad); self; self = self.chain)
+       for(self = findradius(w_org, rad + MAX_DAMAGEEXTRARADIUS); self; self = self.chain)
        {
+               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)
                                continue;
                        if(dmg)
@@ -52,6 +53,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 fbd66692ae5dc840a5d3e69f5d4a96c1345ebb39..396279fca6bbe7bc831bc238df24c0e4dbca59c5 100644 (file)
@@ -231,25 +231,25 @@ string Obituary_ExtraFragInfo(entity player) // Extra fragmessage information
 
        // health/armor of attacker (person who killed you)
        if(autocvar_sv_fraginfo_stats && (player.health >= 1))
-               if((autocvar_sv_fraginfo_stats == 2) || !inWarmupStage)
+               if((autocvar_sv_fraginfo_stats == 2) || inWarmupStage)
                        health_output = strcat("^7(Health ^1", ftos(rint(player.health)), "^7 / Armor ^2", ftos(rint(player.armorvalue)), "^7)");
        
        // ping display
        if(autocvar_sv_fraginfo_ping)
-               ping_output = ((clienttype(player) == CLIENTTYPE_BOT) ? "^2Bot" : strcat("Ping ", ((player.ping >= 150) ? "^1" : "^2"), ftos(player.ping), "ms"));
+               ping_output = ((clienttype(player) == CLIENTTYPE_BOT) ? "^2Bot" : strcat("Ping ", ((player.ping >= 150) ? "^1" : "^2"), ftos(rint(player.ping)), "ms"));
                
        // handicap display 
        if(autocvar_sv_fraginfo_handicap) 
        {
                if(autocvar_sv_fraginfo_handicap == 2)  
-                       handicap_output = strcat(output, strcat("Handicap ^2", ((player.cvar_cl_handicap <= 1) ? "Off" : ftos(player.cvar_cl_handicap))));
+                       handicap_output = strcat(output, strcat("Handicap ^2", ((player.cvar_cl_handicap <= 1) ? "Off" : ftos(rint(player.cvar_cl_handicap)))));
                else if(player.cvar_cl_handicap) // with _handicap 1, only show this if there actually is a handicap enabled.   
-                       handicap_output = strcat("Handicap ^2", ftos(player.cvar_cl_handicap));
+                       handicap_output = strcat("Handicap ^2", ftos(rint(player.cvar_cl_handicap)));
        }
        
        // format the string
-       output = strcat(health_output, (health_output ? " ^7(" : ((ping_output || handicap_output) ? "^7(" : "")), 
-               ping_output, ((ping_output && handicap_output) ? "^7 / " : ""), 
+       output = strcat(health_output, (health_output ? ((ping_output || handicap_output) ? " ^7(" : "") : ((ping_output || handicap_output) ? "^7(" : "")), 
+               ping_output, (handicap_output ? "^7 / " : ""), 
                handicap_output, ((ping_output || handicap_output) ? "^7)" : ""));
        
        // add new line to the beginning if there is a message
@@ -1002,7 +1002,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;
@@ -1015,7 +1015,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)