gradually fade out the "charge" on the nex so if you go fast but hit a wall, you...
authorFruitieX <rasse@rasse-laptop.(none)>
Tue, 12 Oct 2010 23:26:04 +0000 (02:26 +0300)
committerFruitieX <rasse@rasse-laptop.(none)>
Tue, 12 Oct 2010 23:26:04 +0000 (02:26 +0300)
balance25.cfg
balanceLeeStricklin.cfg
balanceNexSVN.cfg
balanceSamual.cfg
balanceXonotic.cfg
qcsrc/client/Defs.qc
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/w_nex.qc

index 0ed48b3..a1c7f05 100644 (file)
@@ -437,6 +437,7 @@ set g_balance_nex_secondary_damagefalloff_forcehalflife 0
 set g_balance_nex_velocitydependent_halflife 0
 set g_balance_nex_velocitydependent_minspeed 400
 set g_balance_nex_velocitydependent_maxspeed 1000
+set g_balance_nex_velocitydependent_movingavg_factor 0.9
 // }}}
 // {{{ minstanex
 set g_balance_minstanex_refire 1
index 1120cdb..3abe913 100644 (file)
@@ -448,6 +448,7 @@ set g_balance_nex_secondary_damagefalloff_forcehalflife 9999999
 set g_balance_nex_velocitydependent_halflife 0
 set g_balance_nex_velocitydependent_minspeed 400
 set g_balance_nex_velocitydependent_maxspeed 1000
+set g_balance_nex_velocitydependent_movingavg_factor 0.9
 // }}}
 // {{{ minstanex
 set g_balance_minstanex_refire 1
index 82b0cfc..0afc3f4 100644 (file)
@@ -436,6 +436,7 @@ set g_balance_nex_secondary_damagefalloff_forcehalflife 1500
 set g_balance_nex_velocitydependent_halflife 0
 set g_balance_nex_velocitydependent_minspeed 400
 set g_balance_nex_velocitydependent_maxspeed 1000
+set g_balance_nex_velocitydependent_movingavg_factor 0.9
 // }}}
 // {{{ minstanex
 set g_balance_minstanex_refire 1
index 4c9095a..d055761 100644 (file)
@@ -437,6 +437,7 @@ set g_balance_nex_secondary_damagefalloff_forcehalflife 1500
 set g_balance_nex_velocitydependent_halflife 0
 set g_balance_nex_velocitydependent_minspeed 400
 set g_balance_nex_velocitydependent_maxspeed 1000
+set g_balance_nex_velocitydependent_movingavg_factor 0.9
 // }}}
 // {{{ minstanex
 set g_balance_minstanex_refire 1
index 0969851..8abc58a 100644 (file)
@@ -437,6 +437,7 @@ set g_balance_nex_secondary_damagefalloff_forcehalflife 4000
 set g_balance_nex_velocitydependent_halflife -500
 set g_balance_nex_velocitydependent_minspeed 400
 set g_balance_nex_velocitydependent_maxspeed 1000
+set g_balance_nex_velocitydependent_falloff_factor 0.001
 // }}}
 // {{{ minstanex
 set g_balance_minstanex_refire 1.25
index 4e5380f..6798261 100644 (file)
@@ -263,5 +263,7 @@ float nex_scope;
 
 float nex_minvelocity;
 float nex_maxvelocity;
+float nex_speed_falloff_factor;
+float nex_speed;
 
 float cr_maxbullets;
index 9feef58..28db128 100644 (file)
@@ -1354,6 +1354,7 @@ float CSQC_Parse_TempEntity()
                case TE_CSQC_NEX_VELOCITY:
                        nex_minvelocity = ReadShort();
                        nex_maxvelocity = ReadShort();
+                       nex_speed_falloff_factor = ReadShort()/10000;
                        bHandled = true;
                        break;
                case TE_CSQC_CR_MAXBULLETS:
index 2fbb07d..2c3ce6b 100644 (file)
@@ -828,22 +828,28 @@ void CSQC_UpdateView(float w, float h)
 
                                float f, a;
                                wcross_size = drawgetimagesize(wcross_name) * wcross_scale;
+
+                               float xyspeed;
+                               xyspeed = vlen('1 0 0' * pmove_vel_x + '0 1 0' * pmove_vel_y);
+                               if(xyspeed > nex_speed)
+                                       nex_speed = min(xyspeed, nex_maxvelocity);
+                               else
+                                       nex_speed = (1 - nex_speed_falloff_factor) * nex_speed;
+
                                // ring around crosshair representing bullets left in camping rifle clip
                                if (activeweapon == WEP_CAMPINGRIFLE && cr_maxbullets)
                                {
                                        bullets = getstati(STAT_BULLETS_LOADED);
-                                       a = cvar("crosshair_campingrifle_bulletcounter_alpha");
                                        f = bound(0, bullets / cr_maxbullets, 1);
 
+                                       a = cvar("crosshair_campingrifle_bulletcounter_alpha");
                                        DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring.tga", f, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE);
                                }
                                else if (activeweapon == WEP_NEX) // ring around crosshair representing velocity-dependent damage for the nex
                                {
-                                       float curvel;
-                                       a = cvar("crosshair_nexvelocity_alpha");
-                                       curvel = vlen('1 0 0' * pmove_vel_x + '0 1 0' * pmove_vel_y);
-                                       f = bound(0, (curvel - nex_minvelocity) / (nex_maxvelocity - nex_minvelocity), 1);
+                                       f = bound(0, (nex_speed - nex_minvelocity) / (nex_maxvelocity - nex_minvelocity), 1);
 
+                                       a = cvar("crosshair_nexvelocity_alpha");
                                        DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring.tga", f, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE);
                                }
 
index c601d92..5c98092 100644 (file)
@@ -12,6 +12,7 @@ void send_CSQC_nexvelocity(entity e) {
        WriteByte(MSG_ONE, TE_CSQC_NEX_VELOCITY);
        WriteShort(MSG_ONE, cvar("g_balance_nex_velocitydependent_minspeed"));
        WriteShort(MSG_ONE, cvar("g_balance_nex_velocitydependent_maxspeed"));
+       WriteShort(MSG_ONE, cvar("g_balance_nex_velocitydependent_falloff_factor") * 10000);
 }
 
 void send_CSQC_cr_maxbullets(entity e) {
index 2df6c1c..c9531bb 100644 (file)
@@ -37,6 +37,8 @@ float sv_airspeedlimit_nonqw;
 .float multijump_ready;
 .float prevjumpbutton;
 
+.float nexspeed;
+
 /*
 =============
 PlayerJump
@@ -1323,6 +1325,15 @@ void SV_PlayerPhysics()
                        }
                }
        }
+
+       float f;
+       float xyspeed;
+       f = cvar("g_balance_nex_velocitydependent_falloff_factor");
+       xyspeed = vlen('1 0 0' * self.velocity_x + '0 1 0' * self.velocity_y);
+       if(xyspeed > self.nexspeed)
+               self.nexspeed = min(xyspeed, cvar("g_balance_nex_velocitydependent_maxspeed"));
+       else
+               self.nexspeed = (1 - f) * self.nexspeed;
 :end
        if(self.flags & FL_ONGROUND)
                self.lastground = time;
index 8acf9f4..87d0c88 100644 (file)
@@ -43,7 +43,7 @@ void W_Nex_Attack (float issecondary)
        float flying;
        flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
 
-       f = ExponentialFalloff(cvar("g_balance_nex_velocitydependent_minspeed"), cvar("g_balance_nex_velocitydependent_maxspeed"), cvar("g_balance_nex_velocitydependent_halflife"), vlen('1 0 0' * self.velocity_x + '0 1 0' * self.velocity_y));
+       f = ExponentialFalloff(cvar("g_balance_nex_velocitydependent_minspeed"), cvar("g_balance_nex_velocitydependent_maxspeed"), cvar("g_balance_nex_velocitydependent_halflife"), self.nexspeed);
 
        // TODO: make it more obvious (through effects, indicator on weapon) that damage increases when speed increases
        mydmg *= f;