From: FruitieX Date: Sun, 17 Oct 2010 19:59:53 +0000 (+0300) Subject: Charge the nex in a little different way, by always charging at a set rate. If the... X-Git-Tag: xonotic-v0.1.0preview~291^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7d4817e8d3a289c12d103768b0a89df09c1573d7;p=xonotic%2Fxonotic-data.pk3dir.git Charge the nex in a little different way, by always charging at a set rate. If the player goes faster, this rate gets faster, and can be increased further with the secondary just as before --- diff --git a/balance25.cfg b/balance25.cfg index 4c335497b..ecaab3f3d 100644 --- a/balance25.cfg +++ b/balance25.cfg @@ -430,8 +430,7 @@ set g_balance_nex_primary_damagefalloff_forcehalflife 0 set g_balance_nex_secondary 0 set g_balance_nex_secondary_charge 0 -set g_balance_nex_secondary_charge_rate 200 -set g_balance_nex_secondary_charge_ammo 10 +set g_balance_nex_secondary_charge_rate 0.1 set g_balance_nex_secondary_damage 100 set g_balance_nex_secondary_force 600 set g_balance_nex_secondary_refire 1.5 @@ -442,10 +441,12 @@ set g_balance_nex_secondary_damagefalloff_maxdist 0 set g_balance_nex_secondary_damagefalloff_halflife 0 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_falloff_rate 0.001 +set g_balance_nex_charge 0 +set g_balance_nex_charge_rate 0.1 +set g_balance_nex_charge_shot_multiplier 0.5 +set g_balance_nex_charge_velocity_rate 0.2 +set g_balance_nex_charge_minspeed 400 +set g_balance_nex_charge_maxspeed 1000 // }}} // {{{ minstanex set g_balance_minstanex_refire 1 diff --git a/balanceLeeStricklin.cfg b/balanceLeeStricklin.cfg index b92e4426c..a2c00ce37 100644 --- a/balanceLeeStricklin.cfg +++ b/balanceLeeStricklin.cfg @@ -441,8 +441,7 @@ set g_balance_nex_primary_damagefalloff_forcehalflife 9999999 set g_balance_nex_secondary 0 set g_balance_nex_secondary_charge 0 -set g_balance_nex_secondary_charge_rate 200 -set g_balance_nex_secondary_charge_ammo 10 +set g_balance_nex_secondary_charge_rate 0.1 set g_balance_nex_secondary_damage 80 set g_balance_nex_secondary_force -500 set g_balance_nex_secondary_refire 1.25 @@ -453,10 +452,12 @@ set g_balance_nex_secondary_damagefalloff_maxdist 9999999 set g_balance_nex_secondary_damagefalloff_halflife 9999999 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_falloff_rate 0.001 +set g_balance_nex_charge 0 +set g_balance_nex_charge_rate 0.1 +set g_balance_nex_charge_shot_multiplier 0.5 +set g_balance_nex_charge_velocity_rate 0.2 +set g_balance_nex_charge_minspeed 400 +set g_balance_nex_charge_maxspeed 1000 // }}} // {{{ minstanex set g_balance_minstanex_refire 1 diff --git a/balanceNexSVN.cfg b/balanceNexSVN.cfg index ebe0a48d1..284f85c65 100644 --- a/balanceNexSVN.cfg +++ b/balanceNexSVN.cfg @@ -429,8 +429,7 @@ set g_balance_nex_primary_damagefalloff_forcehalflife 1500 set g_balance_nex_secondary 0 set g_balance_nex_secondary_charge 0 -set g_balance_nex_secondary_charge_rate 200 -set g_balance_nex_secondary_charge_ammo 10 +set g_balance_nex_secondary_charge_rate 0.1 set g_balance_nex_secondary_damage 90 set g_balance_nex_secondary_force 200 set g_balance_nex_secondary_refire 1.5 @@ -441,10 +440,12 @@ set g_balance_nex_secondary_damagefalloff_maxdist 3000 set g_balance_nex_secondary_damagefalloff_halflife 1500 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_falloff_rate 0.001 +set g_balance_nex_charge 0 +set g_balance_nex_charge_rate 0.1 +set g_balance_nex_charge_shot_multiplier 0.5 +set g_balance_nex_charge_velocity_rate 0.2 +set g_balance_nex_charge_minspeed 400 +set g_balance_nex_charge_maxspeed 1000 // }}} // {{{ minstanex set g_balance_minstanex_refire 1 diff --git a/balanceSamual.cfg b/balanceSamual.cfg index a9190486d..aef05391f 100644 --- a/balanceSamual.cfg +++ b/balanceSamual.cfg @@ -430,8 +430,7 @@ set g_balance_nex_primary_damagefalloff_forcehalflife 1500 set g_balance_nex_secondary 0 set g_balance_nex_secondary_charge 0 -set g_balance_nex_secondary_charge_rate 200 -set g_balance_nex_secondary_charge_ammo 10 +set g_balance_nex_secondary_charge_rate 0.1 set g_balance_nex_secondary_damage 90 set g_balance_nex_secondary_force 300 set g_balance_nex_secondary_refire 1.5 @@ -442,10 +441,12 @@ set g_balance_nex_secondary_damagefalloff_maxdist 3000 set g_balance_nex_secondary_damagefalloff_halflife 1500 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_falloff_rate 0.001 +set g_balance_nex_charge 0 +set g_balance_nex_charge_rate 0.1 +set g_balance_nex_charge_shot_multiplier 0.5 +set g_balance_nex_charge_velocity_rate 0.2 +set g_balance_nex_charge_minspeed 400 +set g_balance_nex_charge_maxspeed 1000 // }}} // {{{ minstanex set g_balance_minstanex_refire 1 diff --git a/balanceXonotic.cfg b/balanceXonotic.cfg index ac6631836..347111f18 100644 --- a/balanceXonotic.cfg +++ b/balanceXonotic.cfg @@ -423,29 +423,30 @@ set g_balance_nex_primary_force 500 set g_balance_nex_primary_refire 1 set g_balance_nex_primary_animtime 0.75 set g_balance_nex_primary_ammo 5 -set g_balance_nex_primary_damagefalloff_mindist 500 -set g_balance_nex_primary_damagefalloff_maxdist 4500 -set g_balance_nex_primary_damagefalloff_halflife 2000 +set g_balance_nex_primary_damagefalloff_mindist 1000 +set g_balance_nex_primary_damagefalloff_maxdist 3000 +set g_balance_nex_primary_damagefalloff_halflife 1000 set g_balance_nex_primary_damagefalloff_forcehalflife 2000 set g_balance_nex_secondary 1 set g_balance_nex_secondary_charge 1 -set g_balance_nex_secondary_charge_rate 200 -set g_balance_nex_secondary_charge_ammo 10 -set g_balance_nex_secondary_damage 125 -set g_balance_nex_secondary_force -700 -set g_balance_nex_secondary_refire 1 -set g_balance_nex_secondary_animtime 0.75 +set g_balance_nex_secondary_charge_rate 0.125 +set g_balance_nex_secondary_damage 0 +set g_balance_nex_secondary_force 0 +set g_balance_nex_secondary_refire 0 +set g_balance_nex_secondary_animtime 0 set g_balance_nex_secondary_ammo 5 -set g_balance_nex_secondary_damagefalloff_mindist 500 -set g_balance_nex_secondary_damagefalloff_maxdist 4500 -set g_balance_nex_secondary_damagefalloff_halflife 4000 -set g_balance_nex_secondary_damagefalloff_forcehalflife 4000 +set g_balance_nex_secondary_damagefalloff_mindist 0 +set g_balance_nex_secondary_damagefalloff_maxdist 0 +set g_balance_nex_secondary_damagefalloff_halflife 0 +set g_balance_nex_secondary_damagefalloff_forcehalflife 0 -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_rate 40 +set g_balance_nex_charge 1 +set g_balance_nex_charge_rate 0.075 +set g_balance_nex_charge_shot_multiplier 0.5 +set g_balance_nex_charge_velocity_rate 0.25 +set g_balance_nex_charge_minspeed 400 +set g_balance_nex_charge_maxspeed 1000 // }}} // {{{ minstanex set g_balance_minstanex_refire 1.25 diff --git a/qcsrc/client/Defs.qc b/qcsrc/client/Defs.qc index 59a7074d7..caab73322 100644 --- a/qcsrc/client/Defs.qc +++ b/qcsrc/client/Defs.qc @@ -261,12 +261,4 @@ vector w_org, w_backoff; float campingrifle_scope; float nex_scope; -float nex_velocitydependent; -float nex_minvelocity; -float nex_maxvelocity; -float nex_speed_falloff_rate; -float nex_speed; -float nex_charge; -float nex_charge_rate; - float cr_maxbullets; diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index f916e843a..9ed7d92e3 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -1337,15 +1337,6 @@ float CSQC_Parse_TempEntity() Net_WeaponComplain(); bHandled = true; break; - case TE_CSQC_NEX_VELOCITY: - nex_velocitydependent = ReadByte(); - nex_minvelocity = ReadShort(); - nex_maxvelocity = ReadShort(); - nex_speed_falloff_rate = ReadByte(); - nex_charge = ReadByte(); - nex_charge_rate = ReadByte(); - bHandled = true; - break; case TE_CSQC_CR_MAXBULLETS: cr_maxbullets = ReadByte(); bHandled = true; diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 5f422a03e..37937c307 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -831,15 +831,8 @@ 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 = max(nex_minvelocity, nex_speed - nex_speed_falloff_rate * frametime); - - if (activeweapon == WEP_NEX && button_attack2 && nex_charge && getstati(GetAmmoStat(3))) - nex_speed = min(nex_maxvelocity, nex_speed + nex_charge_rate * frametime); + float nex_charge; + nex_charge = getstatf(STAT_NEX_CHARGE); // ring around crosshair representing bullets left in camping rifle clip if (activeweapon == WEP_CAMPINGRIFLE && cr_maxbullets) @@ -850,12 +843,10 @@ void CSQC_UpdateView(float w, float h) 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 && nex_velocitydependent && nex_speed > nex_minvelocity) // ring around crosshair representing velocity-dependent damage for the nex + else if (activeweapon == WEP_NEX && nex_charge) // ring around crosshair representing velocity-dependent damage for the nex { - 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); + DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring.tga", nex_charge, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE); } #define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \ diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 5e8dff7dc..6f0eccfaf 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -61,8 +61,7 @@ const float TE_CSQC_NOTIFY = 112; const float TE_CSQC_WEAPONCOMPLAIN = 113; const float TE_CSQC_CAMPINGRIFLE_SCOPE = 115; const float TE_CSQC_NEX_SCOPE = 116; -const float TE_CSQC_NEX_VELOCITY = 117; -const float TE_CSQC_CR_MAXBULLETS = 118; +const float TE_CSQC_CR_MAXBULLETS = 117; const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder const float RACE_NET_CHECKPOINT_CLEAR = 1; @@ -310,6 +309,7 @@ const float STAT_NB_METERSTART = 45; const float STAT_SHOTORG = 46; // compressShotOrigin const float STAT_LEADLIMIT = 47; const float STAT_BULLETS_LOADED = 48; +const float STAT_NEX_CHARGE = 49; // see DP source, quakedef.h const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 068912d65..65413bd0c 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -6,18 +6,6 @@ void send_CSQC_teamnagger() { WriteByte(0, TE_CSQC_TEAMNAGGER); } -void send_CSQC_nexvelocity(entity e) { - msg_entity = e; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_NEX_VELOCITY); - WriteByte(MSG_ONE, bound(0, fabs(cvar("g_balance_nex_velocitydependent_halflife")), 1)); - WriteShort(MSG_ONE, cvar("g_balance_nex_velocitydependent_minspeed")); - WriteShort(MSG_ONE, cvar("g_balance_nex_velocitydependent_maxspeed")); - WriteByte(MSG_ONE, cvar("g_balance_nex_velocitydependent_falloff_rate")); - WriteByte(MSG_ONE, cvar("g_balance_nex_secondary_charge")); - WriteByte(MSG_ONE, cvar("g_balance_nex_secondary_charge_rate")); -} - void send_CSQC_cr_maxbullets(entity e) { msg_entity = e; WriteByte(MSG_ONE, SVC_TEMPENTITY); @@ -1607,7 +1595,6 @@ void ClientConnect (void) else if(cvar("sv_teamnagger") && !(cvar("bot_vs_human") && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca send_CSQC_teamnagger(); - send_CSQC_nexvelocity(self); send_CSQC_cr_maxbullets(self); CheatInitClient(); diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index d9394deaf..f41620f7c 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -1326,14 +1326,17 @@ void SV_PlayerPhysics() } } - float f; float xyspeed; - f = cvar("g_balance_nex_velocitydependent_falloff_rate"); 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 = max(cvar("g_balance_nex_velocitydependent_minspeed"), self.nexspeed - f * frametime); + if(self.weapon == WEP_NEX && cvar("g_balance_nex_charge") && cvar("g_balance_nex_charge_velocity_rate") && xyspeed > cvar("g_balance_nex_charge_minspeed")) + { + // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed + xyspeed = min(xyspeed, cvar("g_balance_nex_charge_maxspeed")); + float f; + f = (xyspeed - cvar("g_balance_nex_charge_minspeed")) / (cvar("g_balance_nex_charge_maxspeed") - cvar("g_balance_nex_charge_minspeed")); + // add the extra charge + self.nex_charge += cvar("g_balance_nex_charge_velocity_rate") * f * frametime; + } :end if(self.flags & FL_ONGROUND) self.lastground = time; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 679a1b445..d88e0eba1 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -648,3 +648,5 @@ string deathmessage; .float active; .float (float act_state) setactive; .entity realowner; + +.float nex_charge; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 9df213c1b..bc90ecac7 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -637,6 +637,8 @@ void spawnfunc_worldspawn (void) addstat(STAT_LEADLIMIT, AS_FLOAT, stat_leadlimit); addstat(STAT_BULLETS_LOADED, AS_INT, campingrifle_bulletcounter); + addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge); + // g_movementspeed hack addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw); addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw); diff --git a/qcsrc/server/w_nex.qc b/qcsrc/server/w_nex.qc index e4c6347fe..a50dc11fb 100644 --- a/qcsrc/server/w_nex.qc +++ b/qcsrc/server/w_nex.qc @@ -18,7 +18,7 @@ void SendCSQCNexBeamParticle() { void W_Nex_Attack (float issecondary) { - float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, f; + float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo; if(issecondary) { mydmg = cvar("g_balance_nex_secondary_damage"); @@ -43,12 +43,13 @@ 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"), self.nexspeed); - - // TODO: make it more obvious (through effects, indicator on weapon) that damage increases when speed increases - mydmg *= f; - myforce *= f; - //print("^1Damage: ^7", ftos(mydmg), "\n"); + if(cvar("g_balance_nex_charge")) + { + mydmg *= self.nex_charge; + myforce *= self.nex_charge; + //print("^1Damage: ^7", ftos(mydmg), "\n"); + self.nex_charge *= cvar("g_balance_nex_charge_shot_multiplier"); // do this AFTER setting mydmg/myforce + } W_SetupShot (self, TRUE, 5, "weapons/nexfire.wav", mydmg); @@ -80,6 +81,8 @@ float w_nex(float req) } else if (req == WR_THINK) { + if(cvar("g_balance_nex_charge")) + self.nex_charge = min(1, self.nex_charge + cvar("g_balance_nex_charge_rate") * frametime / W_TICSPERFRAME); if (self.BUTTON_ATCK) { if (weapon_prepareattack(0, cvar("g_balance_nex_primary_refire"))) @@ -94,8 +97,8 @@ float w_nex(float req) { if(self.ammo_cells) { - self.nexspeed = min(cvar("g_balance_nex_velocitydependent_maxspeed"), self.nexspeed + cvar("g_balance_nex_secondary_charge_rate") * frametime / W_TICSPERFRAME); - self.ammo_cells = max(0, self.ammo_cells - cvar("g_balance_nex_secondary_charge_ammo") * frametime / W_TICSPERFRAME); + self.nex_charge = min(1, self.nex_charge + cvar("g_balance_nex_secondary_charge_rate") * frametime / W_TICSPERFRAME); + self.ammo_cells = max(0, self.ammo_cells - cvar("g_balance_nex_secondary_ammo") * frametime / W_TICSPERFRAME); } } else if(cvar("g_balance_nex_secondary"))