Charge the nex in a little different way, by always charging at a set rate. If the...
authorFruitieX <rasse@rasse-laptop.(none)>
Sun, 17 Oct 2010 19:59:53 +0000 (22:59 +0300)
committerFruitieX <rasse@rasse-laptop.(none)>
Sun, 17 Oct 2010 19:59:53 +0000 (22:59 +0300)
14 files changed:
balance25.cfg
balanceLeeStricklin.cfg
balanceNexSVN.cfg
balanceSamual.cfg
balanceXonotic.cfg
qcsrc/client/Defs.qc
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/common/constants.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/w_nex.qc

index 4c335497b950c5d6bf01d6bedac4ea537d4c8e40..ecaab3f3d1759435419a868ebac3a9c53579d967 100644 (file)
@@ -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
index b92e4426c9bb829d2fd6ac26b3c202ee65e71ad6..a2c00ce3729d11761eba9e9fcb31aeb10eedf4a0 100644 (file)
@@ -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
index ebe0a48d159442b9dc01939b72b14af5a0b0818f..284f85c65b79253533d8f03fcc0d7d1e7d7d4a89 100644 (file)
@@ -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
index a9190486d902899fa232cefb0cd32b3e2b093563..aef05391fac32c18d53806c21a5aa051c25ef6b6 100644 (file)
@@ -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
index ac6631836da4a58759fe36cf9f8d80fcf308378f..347111f184d40e1a4b87b31c02a9069d7abb877e 100644 (file)
@@ -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
index 59a7074d7243578d95cd32b57918c9c3cd9a84c5..caab7332292524b54ece81f7ecc2d44806f67f86 100644 (file)
@@ -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;
index f916e843af6120484cfc04fb6f2fa0d3f54d1ed1..9ed7d92e3630a5c6e115c3c044ba98390f7b8fd7 100644 (file)
@@ -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;
index 5f422a03eb0a4b3db660a7ce8b6e13b66ee8acbf..37937c30758dc079e3c66d3de77f63bfe91f57fb 100644 (file)
@@ -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) \
index 5e8dff7dca2645fb81564d3c243c09381ca15a9d..6f0eccfafb8af72f94a556ad5709a0554c0ccfab 100644 (file)
@@ -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;
index 068912d6589f0f94df85fcb6f02d280a821aedbc..65413bd0cadbdf20cfc984faa4bf171d044c7134 100644 (file)
@@ -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();
index d9394deaf26a968573d2331a5c78d87d227a5ccd..f41620f7c0d567fd35c16200dee56128fc9c76b3 100644 (file)
@@ -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;
index 679a1b445b019aadc29bdc713730910a617084ee..d88e0eba1d9b7d426dd88c6cd0235e303ac8c597 100644 (file)
@@ -648,3 +648,5 @@ string deathmessage;
 .float active;
 .float (float act_state) setactive;
 .entity realowner;
+
+.float nex_charge;
index 9df213c1b8b3748ef74551d84b60239865dab0d3..bc90ecac7b40630b16b0fa6c185e8d3e21c8fca9 100644 (file)
@@ -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);
index e4c6347fedf430d3f505b5ce7b66e22815f83409..a50dc11fb9ecb36fc1dfb9a7e029e8d310a5d5a6 100644 (file)
@@ -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"))