]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Finishing up the spread work by adding new multiplier system for accuracy
authorSamual Lenks <samual@xonotic.org>
Sun, 22 Jul 2012 05:46:12 +0000 (01:46 -0400)
committerSamual Lenks <samual@xonotic.org>
Sun, 22 Jul 2012 05:46:12 +0000 (01:46 -0400)
and distance factoring.

balance25.cfg
balanceFruitieX.cfg
balanceXPM.cfg
balanceXonotic.cfg
qcsrc/client/particles.qc
qcsrc/server/autocvars.qh
qcsrc/server/w_laser.qc

index 978a9875b96df354f00b1402b5de5dbee2fbc1d9..7bfc14376caae2bec114c24656313050884fb6c9 100644 (file)
@@ -240,6 +240,9 @@ set g_balance_laser_primary_spread_min 20
 set g_balance_laser_primary_refire 0.7
 set g_balance_laser_primary_animtime 0.3
 set g_balance_laser_primary_lifetime 30
+set g_balance_laser_primary_multiplier_min 0.5
+set g_balance_laser_primary_multiplier_accuracy 0.5
+set g_balance_laser_primary_multiplier_distance 0.5
 set g_balance_laser_primary_shotangle 0
 set g_balance_laser_primary_delay 0.05
 set g_balance_laser_primary_gauntlet 0
index 0ede467d972cd0295af897ad1adf92ae4ddb2ec8..edfccec3c6cb095bc6e5de19e610f72bf35d9078 100644 (file)
@@ -240,6 +240,9 @@ set g_balance_laser_primary_spread_min 20
 set g_balance_laser_primary_refire 0.6
 set g_balance_laser_primary_animtime 0.4
 set g_balance_laser_primary_lifetime 5
+set g_balance_laser_primary_multiplier_min 0.5
+set g_balance_laser_primary_multiplier_accuracy 0.5
+set g_balance_laser_primary_multiplier_distance 0.5
 set g_balance_laser_primary_shotangle 0
 set g_balance_laser_primary_delay 0
 set g_balance_laser_primary_gauntlet 0
index 331051b9764e93d11dc48bc5c3995ea3f31a7738..5b41c20757b5ceb942ff255e5291dc6661ac51c1 100644 (file)
@@ -240,6 +240,9 @@ set g_balance_laser_primary_spread_min 20
 set g_balance_laser_primary_refire 0.7
 set g_balance_laser_primary_animtime 0.2
 set g_balance_laser_primary_lifetime 5
+set g_balance_laser_primary_multiplier_min 0.5
+set g_balance_laser_primary_multiplier_accuracy 0.5
+set g_balance_laser_primary_multiplier_distance 0.5
 set g_balance_laser_primary_shotangle 0
 set g_balance_laser_primary_delay 0
 set g_balance_laser_primary_gauntlet 0
index cbc82327740a9bd4e69d7a6b965f377b187104ee..82800abeea12955165f3df6099ffc897549da2fc 100644 (file)
@@ -232,7 +232,7 @@ set g_balance_laser_oldprimary 0
 set g_balance_laser_primary_damage 25
 set g_balance_laser_primary_edgedamage 12.5
 set g_balance_laser_primary_force 300
-set g_balance_laser_primary_radius 4000
+set g_balance_laser_primary_radius 1000
 set g_balance_laser_primary_speed 6000
 set g_balance_laser_primary_spread 0.12
 set g_balance_laser_primary_spread_max 100
@@ -240,6 +240,9 @@ set g_balance_laser_primary_spread_min 20
 set g_balance_laser_primary_refire 0.7
 set g_balance_laser_primary_animtime 0.2
 set g_balance_laser_primary_lifetime 5
+set g_balance_laser_primary_multiplier_min 0.5
+set g_balance_laser_primary_multiplier_accuracy 0.6
+set g_balance_laser_primary_multiplier_distance 0.4
 set g_balance_laser_primary_shotangle 0
 set g_balance_laser_primary_delay 0
 set g_balance_laser_primary_gauntlet 0
index d502bcd8e7653ee91510e8bb670d70a78c342151..e4276df83c5b659667be170a13598ebb79c9eb16 100644 (file)
@@ -325,7 +325,7 @@ void Net_ReadShockwaveParticle()
                deviation_y = v_forward_x;
                deviation_z = v_forward_y;
                deviation = deviation * spread;
-               print("v_forward = ", vtos(deviation), ".\n");
+               //print("v_forward = ", vtos(deviation), ".\n");
                deviation = ((shotdir + (right * deviation_y) + (up * deviation_z)) * 1000);
                
                //deviation = W_CalculateSpread(shotdir, spread, 1, cvar("g_projectiles_spread_style"));
index 53d72131a72929296b9cfe6a346766a2aac39789..6a9e05dbda460a597926413aa27ec917b7651dad 100644 (file)
@@ -438,6 +438,9 @@ float autocvar_g_balance_laser_primary_force_velocitybias;
 float autocvar_g_balance_laser_primary_force_zscale;
 var float autocvar_g_balance_laser_primary_jumpradius = 150;
 float autocvar_g_balance_laser_primary_lifetime;
+var float autocvar_g_balance_laser_primary_multiplier_min = 0.5;
+var float autocvar_g_balance_laser_primary_multiplier_accuracy = 0.5;
+var float autocvar_g_balance_laser_primary_multiplier_distance = 0.5;
 float autocvar_g_balance_laser_primary_radius;
 float autocvar_g_balance_laser_primary_refire;
 float autocvar_g_balance_laser_primary_shotangle;
index 287f56df0417c32242d8007d4b569e5e64dfe17c..78a824d2d9bd4c46087a661b2c533604c5dc30d7 100644 (file)
@@ -50,14 +50,14 @@ float W_Laser_Shockwave_CheckSpread(vector targetorg, vector nearest_on_line, ve
        float distance_of_attack = vlen(sw_shotorg - attack_hitpos);
        float distance_from_line = vlen(targetorg - nearest_on_line);
        
-       spreadlimit = (vlen(sw_shotorg - nearest_on_line) / (distance_of_attack ? distance_of_attack : 1));
+       spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
        spreadlimit = (autocvar_g_balance_laser_primary_spread_min * (1 - spreadlimit) + autocvar_g_balance_laser_primary_spread_max * spreadlimit);
        
        if(spreadlimit && (distance_from_line <= spreadlimit))
        {
-               te_lightning2(world, targetorg, nearest_on_line);
-               te_lightning2(world, targetorg, sw_shotorg);
-               print("just in case: ", ftos(distance_from_line), ", ", ftos(spreadlimit), ".\n");
+               //te_lightning2(world, targetorg, nearest_on_line);
+               //te_lightning2(world, targetorg, sw_shotorg);
+               //print("just in case: ", ftos(distance_from_line), ", ", ftos(spreadlimit), ".\n");
                
                return bound(0, (distance_from_line / spreadlimit), 1);
        }
@@ -105,7 +105,7 @@ void W_Laser_Shockwave (void)
        // declarations
        float final_damage, final_spread;
        entity head, next, aim_ent;
-       vector nearest_to_attacker, nearest_on_line, attack_hitpos, final_force, center;
+       vector attack_hitpos, 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));
@@ -154,31 +154,33 @@ void W_Laser_Shockwave (void)
                        float h = vlen(center - self.origin);
                        float ang = acos(dotproduct(normalize(center - self.origin), w_shotdir));
                        float a = h * cos(ang);
-
-                       nearest_on_line = (w_shotorg + a * w_shotdir);
                        
                        // 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
 
-                       nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
+                       vector nearest_on_line = (w_shotorg + a * w_shotdir);
+                       vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
+                       float distance_to_target = vlen(w_shotorg - nearest_to_attacker);
+                       float distance_of_attack = vlen(w_shotorg - attack_hitpos);
 
-                       if(vlen(w_shotorg - nearest_to_attacker) <= autocvar_g_balance_laser_primary_radius)
+                       if(distance_to_target <= autocvar_g_balance_laser_primary_radius)
                        {
                                if(W_Laser_Shockwave_IsVisible(head, nearest_on_line, w_shotorg, attack_hitpos))
                                {
-                                       final_damage = W_Laser_Shockwave_CheckSpread(nearest_to_attacker, nearest_on_line, w_shotorg, attack_hitpos); 
+                                       float multiplier_from_accuracy = (1 - W_Laser_Shockwave_CheckSpread(nearest_to_attacker, nearest_on_line, w_shotorg, attack_hitpos));
+                                       float multiplier_from_distance = (1 - (distance_of_attack ? min(1, (distance_to_target / autocvar_g_balance_laser_primary_radius)) : 1));
+
+                                       float multiplier = max(autocvar_g_balance_laser_primary_multiplier_min, ((multiplier_from_accuracy * autocvar_g_balance_laser_primary_multiplier_accuracy) + (multiplier_from_distance * autocvar_g_balance_laser_primary_multiplier_distance)));
+                                       print("multiplier = ", ftos(multiplier), ", multiplier_from_accuracy = ", ftos(multiplier_from_accuracy), ", multiplier_from_distance = ", ftos(multiplier_from_distance), "\n");
 
-                                       //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("head.origin: ", vtos(head.origin), ", nearest_on_line: ", vtos(nearest_on_line), ".\n"));
+                                       final_force = ((normalize(center - nearest_on_line) * autocvar_g_balance_laser_primary_force) * multiplier);
+                                       final_damage = (autocvar_g_balance_laser_primary_damage * multiplier + autocvar_g_balance_laser_primary_edgedamage * (1 - multiplier));
                                        
                                        print(strcat("damage: ", ftos(final_damage), ", force: ", vtos(final_force), ".\n"));
                                        
                                        Damage(head, self, self, final_damage, WEP_LASER, head.origin, final_force);
-                                       //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);