From 580c768d0f2e32d2b545fa80c08c515aeb0ca67a Mon Sep 17 00:00:00 2001 From: FruitieX Date: Wed, 13 Oct 2010 02:26:04 +0300 Subject: [PATCH] gradually fade out the "charge" on the nex so if you go fast but hit a wall, you still can do lots of damage for a little while --- balance25.cfg | 1 + balanceLeeStricklin.cfg | 1 + balanceNexSVN.cfg | 1 + balanceSamual.cfg | 1 + balanceXonotic.cfg | 1 + qcsrc/client/Defs.qc | 2 ++ qcsrc/client/Main.qc | 1 + qcsrc/client/View.qc | 16 +++++++++++----- qcsrc/server/cl_client.qc | 1 + qcsrc/server/cl_physics.qc | 11 +++++++++++ qcsrc/server/w_nex.qc | 2 +- 11 files changed, 32 insertions(+), 6 deletions(-) diff --git a/balance25.cfg b/balance25.cfg index 0ed48b3e3..a1c7f05b8 100644 --- a/balance25.cfg +++ b/balance25.cfg @@ -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 diff --git a/balanceLeeStricklin.cfg b/balanceLeeStricklin.cfg index 1120cdbcf..3abe913a3 100644 --- a/balanceLeeStricklin.cfg +++ b/balanceLeeStricklin.cfg @@ -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 diff --git a/balanceNexSVN.cfg b/balanceNexSVN.cfg index 82b0cfc50..0afc3f412 100644 --- a/balanceNexSVN.cfg +++ b/balanceNexSVN.cfg @@ -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 diff --git a/balanceSamual.cfg b/balanceSamual.cfg index 4c9095a1a..d055761d1 100644 --- a/balanceSamual.cfg +++ b/balanceSamual.cfg @@ -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 diff --git a/balanceXonotic.cfg b/balanceXonotic.cfg index 0969851e2..8abc58a01 100644 --- a/balanceXonotic.cfg +++ b/balanceXonotic.cfg @@ -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 diff --git a/qcsrc/client/Defs.qc b/qcsrc/client/Defs.qc index 4e5380f33..6798261eb 100644 --- a/qcsrc/client/Defs.qc +++ b/qcsrc/client/Defs.qc @@ -263,5 +263,7 @@ float nex_scope; float nex_minvelocity; float nex_maxvelocity; +float nex_speed_falloff_factor; +float nex_speed; float cr_maxbullets; diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 9feef58cc..28db128b0 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -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: diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 2fbb07d4e..2c3ce6b8f 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -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); } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index c601d92cd..5c980920b 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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) { diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index 2df6c1c4f..c9531bbc6 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -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; diff --git a/qcsrc/server/w_nex.qc b/qcsrc/server/w_nex.qc index 8acf9f4c6..87d0c88ab 100644 --- a/qcsrc/server/w_nex.qc +++ b/qcsrc/server/w_nex.qc @@ -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; -- 2.39.2