]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 0ed48b3e356d53718373dccc9a6832fe821487d1..a1c7f05b86d62bb1aa9099c50e16635b89f75402 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 1120cdbcf137b8c59eec6f484e18feb8f252f32d..3abe913a305443a4e6f959a42f80d259c7c2d6c1 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 82b0cfc50147f8741e5069d9504e33dfc167c13e..0afc3f412b6b99b11d1609f2db06afce7b1b15e8 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 4c9095a1ad7a51e8c49bb328d4343249030c8514..d055761d16d1851f45083c9bfe921d3e8fd0e4b1 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 0969851e25e16f5df5ccc6d22a46cc4180518d43..8abc58a0198045157b80f69f5184fe6a3af67888 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 4e5380f33239755ecf51b85de28c4a73627c30bd..6798261eb3555f9dc1ae707973911428483f32c2 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 9feef58cc8738836ded4e6b168adf4c8e2e8786d..28db128b06d52f379c76bf71d989fb58680926a0 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 2fbb07d4eb524692b5155e9fdc516ff2004122cd..2c3ce6b8f54e898e96e8ab05bb0c14e1b15462a6 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 c601d92cda70d478dd0189c486807a252783f32d..5c980920b7228a5dcc37681bca3e7b3fa855afd1 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 2df6c1c4fefb2ffbad069cb587cd27e82f22bdff..c9531bbc630d45f2cca4bfc2aeb97e5b248e2072 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 8acf9f4c6b12c90727bf1d357f3e06eb8f873e93..87d0c88ab53fae69c7e3a9151c9ed31c2eccbccf 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;