]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
More work on spread handling
authorSamual Lenks <samual@xonotic.org>
Sun, 22 Jul 2012 01:57:25 +0000 (21:57 -0400)
committerSamual Lenks <samual@xonotic.org>
Sun, 22 Jul 2012 01:57:25 +0000 (21:57 -0400)
balance25.cfg
balanceFruitieX.cfg
balanceXPM.cfg
balanceXonotic.cfg
qcsrc/server/autocvars.qh
qcsrc/server/w_laser.qc

index c76f760eb1f3c1c92c42ef9d63e191a973bada1a..978a9875b96df354f00b1402b5de5dbee2fbc1d9 100644 (file)
@@ -235,6 +235,8 @@ set g_balance_laser_primary_force 400
 set g_balance_laser_primary_radius 70
 set g_balance_laser_primary_speed 9000
 set g_balance_laser_primary_spread 0
+set g_balance_laser_primary_spread_max 100
+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
index 2e826476d3344632834389afd2ff097b7b2c1547..0ede467d972cd0295af897ad1adf92ae4ddb2ec8 100644 (file)
@@ -235,6 +235,8 @@ set g_balance_laser_primary_force 150 // this looks insanely low, but actually i
 set g_balance_laser_primary_radius 60
 set g_balance_laser_primary_speed 5000
 set g_balance_laser_primary_spread 0
+set g_balance_laser_primary_spread_max 100
+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
index 609d8fb5b680bc2160091e232cba1057ec612e7b..331051b9764e93d11dc48bc5c3995ea3f31a7738 100644 (file)
@@ -235,6 +235,8 @@ set g_balance_laser_primary_force 300
 set g_balance_laser_primary_radius 70
 set g_balance_laser_primary_speed 6000
 set g_balance_laser_primary_spread 0
+set g_balance_laser_primary_spread_max 100
+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
index c0bb7ac1697e9ceb6118e5ff4e736a5cee492155..cbc82327740a9bd4e69d7a6b965f377b187104ee 100644 (file)
@@ -235,6 +235,8 @@ set g_balance_laser_primary_force 300
 set g_balance_laser_primary_radius 4000
 set g_balance_laser_primary_speed 6000
 set g_balance_laser_primary_spread 0.12
+set g_balance_laser_primary_spread_max 100
+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
index edaae2f1a1cacceac576732ef65892737e850456..53d72131a72929296b9cfe6a346766a2aac39789 100644 (file)
@@ -442,7 +442,9 @@ float autocvar_g_balance_laser_primary_radius;
 float autocvar_g_balance_laser_primary_refire;
 float autocvar_g_balance_laser_primary_shotangle;
 float autocvar_g_balance_laser_primary_speed;
-var float autocvar_g_balance_laser_primary_spread = 0.15;
+float autocvar_g_balance_laser_primary_spread;
+float autocvar_g_balance_laser_primary_spread_max;
+float autocvar_g_balance_laser_primary_spread_min;
 float autocvar_g_balance_laser_secondary;
 float autocvar_g_balance_laser_secondary_animtime;
 float autocvar_g_balance_laser_secondary_damage;
index ed8f0d4ecaca7d87bdbf76f8d1fda4bb5a55f05b..95d9adf7f50fdc62297fd8551926c23488521cc2 100644 (file)
@@ -43,21 +43,24 @@ void W_Laser_Think()
        CSQCProjectile(self, TRUE, PROJECTILE_LASER, TRUE);
 }
 
-// TODO: change this into a macro to run faster (less function calls is better)
-float W_Laser_Shockwave_CheckSpreadAngle(vector targetorg, vector nearest_on_line, vector sw_shotorg, vector sw_shotdir)
+
+float W_Laser_Shockwave_CheckSpreadAngle(vector targetorg, vector nearest_on_line, float distance_on_line, vector sw_shotorg)
 {
        vector angle_to_head = normalize(targetorg - sw_shotorg);
-       vector angle_to_attack = sw_shotdir;
+
+       float spreadlimit = (autocvar_g_balance_laser_primary_spread_min * (1 - distance_on_line) + autocvar_g_balance_laser_primary_spread_max * distance_on_line);
 
        te_lightning2(world, targetorg, nearest_on_line);
+
+       
        
-       if(vlen(targetorg - nearest_on_line) <= autocvar_g_balance_laser_primary_spread)
+       if(vlen(targetorg - nearest_on_line) <= spreadlimit)
                return TRUE;
        else
                return FALSE;
 }
 
-float W_Laser_Shockwave_IsVisible(entity head, vector nearest_on_line, vector sw_shotorg, vector sw_shotdir)
+float W_Laser_Shockwave_IsVisible(entity head, vector nearest_on_line, float distance_on_line, vector sw_shotorg)
 {
        vector nearest_to_attacker = head.WarpZone_findradius_nearest;
        vector center = (head.origin + (head.mins + head.maxs) * 0.5);
@@ -65,14 +68,14 @@ float W_Laser_Shockwave_IsVisible(entity head, vector nearest_on_line, vector sw
        float i;
 
        // STEP ONE: Check if the nearest point is clear
-       if(W_Laser_Shockwave_CheckSpreadAngle(nearest_to_attacker, nearest_on_line, sw_shotorg, sw_shotdir))
+       if(W_Laser_Shockwave_CheckSpreadAngle(nearest_to_attacker, nearest_on_line, distance_on_line, sw_shotorg))
        {
                WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_WORLDONLY, self);
                if(trace_fraction == 1) { return TRUE; } // yes, the nearest point is clear and we can allow the damage
        }
 
        // STEP TWO: Check if shotorg to center point is clear
-       if(W_Laser_Shockwave_CheckSpreadAngle(center, nearest_on_line, sw_shotorg, sw_shotdir))
+       if(W_Laser_Shockwave_CheckSpreadAngle(center, nearest_on_line, distance_on_line, sw_shotorg))
        {
                WarpZone_TraceLine(sw_shotorg, center, MOVE_WORLDONLY, self);
                if(trace_fraction == 1) { return TRUE; } // yes, the center point is clear and we can allow the damage
@@ -82,7 +85,7 @@ float W_Laser_Shockwave_IsVisible(entity head, vector nearest_on_line, vector sw
        for(i=1; i<=8; ++i)
        {
                corner = get_corner_position(head, i);
-               if(W_Laser_Shockwave_CheckSpreadAngle(corner, nearest_on_line, sw_shotorg, sw_shotdir))
+               if(W_Laser_Shockwave_CheckSpreadAngle(corner, nearest_on_line, distance_on_line, sw_shotorg))
                {
                        WarpZone_TraceLine(sw_shotorg, corner, MOVE_WORLDONLY, self);
                        if(trace_fraction == 1) { return TRUE; } // yes, this corner is clear and we can allow the damage
@@ -158,10 +161,10 @@ void W_Laser_Shockwave (void)
 
                        if(vlen(w_shotorg - nearest_to_attacker) <= autocvar_g_balance_laser_primary_radius)
                        {
-                               if(W_Laser_Shockwave_IsVisible(head, nearest_on_line, w_shotorg, w_shotdir))
+                               if(W_Laser_Shockwave_IsVisible(head, nearest_on_line, a, w_shotorg))
                                {
                                        if(autocvar_g_balance_laser_primary_spread)
-                                               final_damage = (final_spread / autocvar_g_balance_laser_primary_spread);
+                                               final_damage = (vlen(center - nearest_on_line) / autocvar_g_balance_laser_primary_spread_max); // todo make this match with the spread check
                                        else
                                                final_damage = 1;