remove "poor man's autocvars" in sv_main.qc
authorRudolf Polzer <divverent@alientrap.org>
Sat, 4 Dec 2010 13:50:21 +0000 (14:50 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 4 Dec 2010 13:50:21 +0000 (14:50 +0100)
21 files changed:
qcsrc/server/bot/bot.qc
qcsrc/server/bot/bot.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/g_damage.qc
qcsrc/server/monsters/mode_management.qc
qcsrc/server/movelib.qc
qcsrc/server/sv_main.qc
qcsrc/server/t_teleporters.qc
qcsrc/server/teamplay.qc
qcsrc/server/tturrets/system/system_aimprocs.qc
qcsrc/server/tturrets/system/system_damage.qc
qcsrc/server/tturrets/system/system_main.qc
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/w_minelayer.qc
qcsrc/server/w_minstanex.qc
qcsrc/server/w_rocketlauncher.qc
qcsrc/server/w_tuba.qc

index 945600a..fc578c3 100644 (file)
@@ -563,7 +563,7 @@ void bot_serverframe()
        // But don't remove bots immediately on level change, as the real players
        // usually haven't rejoined yet
        bots_would_leave = FALSE;
-       if (teamplay && cvar("bot_vs_human") && (c3==-1 && c4==-1))
+       if (autocvar_teamplay && cvar("bot_vs_human") && (c3==-1 && c4==-1))
                bots = min(ceil(fabs(cvar("bot_vs_human")) * activerealplayers), maxclients - realplayers);
        else if ((realplayers || cvar("bot_join_empty") || (currentbots > 0 && time < 5)))
        {
index 0550431..2f56a48 100644 (file)
@@ -108,7 +108,7 @@ void bot_serverframe();
  * Imports
  */
 
-float sv_maxspeed;
+float autocvar_sv_maxspeed;
 
 void() havocbot_setupbot;
 
index 934aba8..03f496c 100644 (file)
@@ -1346,7 +1346,7 @@ vector havocbot_dodge()
                if (head.owner != self)
                {
                        vl = vlen(head.velocity);
-                       if (vl > sv_maxspeed * 0.3)
+                       if (vl > autocvar_sv_maxspeed * 0.3)
                        {
                                n = normalize(head.velocity);
                                v = self.origin - head.origin;
index a13f4af..173ef23 100644 (file)
@@ -1620,7 +1620,7 @@ void ClientConnect (void)
        GetCvars(0);
 
        // set cvar for team scoreboard
-       stuffcmd(self, strcat("set teamplay ", ftos(teamplay), "\n"));
+       stuffcmd(self, strcat("set teamplay ", ftos(autocvar_teamplay), "\n"));
 
        // notify about available teams
        if(teams_matter)
index b852e3f..7700399 100644 (file)
@@ -1,28 +1,28 @@
 .float race_penalty;
 .float restart_jump;
 
-float sv_accelerate;
-float sv_friction;
-float sv_maxspeed;
-float sv_airaccelerate;
-float sv_maxairspeed;
-float sv_stopspeed;
-float sv_gravity;
+float autocvar_sv_accelerate;
+float autocvar_sv_friction;
+float autocvar_sv_maxspeed;
+float autocvar_sv_airaccelerate;
+float autocvar_sv_maxairspeed;
+float autocvar_sv_stopspeed;
+float autocvar_sv_gravity;
 float sv_airaccel_sideways_friction;
-float sv_airaccel_qw;
-float sv_airstopaccelerate;
-float sv_airstrafeaccelerate;
+float autocvar_sv_airaccel_qw;
+float autocvar_sv_airstopaccelerate;
+float autocvar_sv_airstrafeaccelerate;
 float sv_maxairstrafespeed;
-float sv_airstrafeaccel_qw;
-float sv_aircontrol;
-float sv_aircontrol_power;
-float sv_aircontrol_penalty;
-float sv_warsowbunny_airforwardaccel;
-float sv_warsowbunny_accel;
-float sv_warsowbunny_topspeed;
-float sv_warsowbunny_turnaccel;
-float sv_warsowbunny_backtosideratio;
-float sv_airspeedlimit_nonqw;
+float autocvar_sv_airstrafeaccel_qw;
+float autocvar_sv_aircontrol;
+float autocvar_sv_aircontrol_power;
+float autocvar_sv_aircontrol_penalty;
+float autocvar_sv_warsowbunny_airforwardaccel;
+float autocvar_sv_warsowbunny_accel;
+float autocvar_sv_warsowbunny_topspeed;
+float autocvar_sv_warsowbunny_turnaccel;
+float autocvar_sv_warsowbunny_backtosideratio;
+float autocvar_sv_airspeedlimit_nonqw;
 
 .float ladder_time;
 .entity ladder_entity;
@@ -354,7 +354,7 @@ void RaceCarPhysics()
                vector rigvel_xy, neworigin, up;
                float mt;
 
-               rigvel_z -= frametime * sv_gravity; // 4x gravity plays better
+               rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
                rigvel_xy = vec2(rigvel);
 
                if(g_bugrigs_planar_movement_car_jumping && !g_touchexplode) // touchexplode is a better way to handle collisions
@@ -403,7 +403,7 @@ void RaceCarPhysics()
        }
        else
        {
-               rigvel_z -= frametime * sv_gravity; // 4x gravity plays better
+               rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
                self.velocity = rigvel;
                self.movetype = MOVETYPE_FLY;
        }
@@ -496,7 +496,7 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
                return;
 #endif
 
-       k *= bound(0, wishspeed / sv_maxairspeed, 1);
+       k *= bound(0, wishspeed / autocvar_sv_maxairspeed, 1);
 
        zspeed = self.velocity_z;
        self.velocity_z = 0;
@@ -506,9 +506,9 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
 
        if(dot > 0) // we can't change direction while slowing down
        {
-               k *= pow(dot, sv_aircontrol_power)*frametime;
-               xyspeed = max(0, xyspeed - sv_aircontrol_penalty * sqrt(max(0, 1 - dot*dot)) * k/32);
-               k *= sv_aircontrol;
+               k *= pow(dot, autocvar_sv_aircontrol_power)*frametime;
+               xyspeed = max(0, xyspeed - autocvar_sv_aircontrol_penalty * sqrt(max(0, 1 - dot*dot)) * k/32);
+               k *= autocvar_sv_aircontrol;
                self.velocity = normalize(self.velocity * xyspeed + wishdir * k);
        }
 
@@ -522,7 +522,7 @@ float AdjustAirAccelQW(float accelqw, float factor)
 }
 
 // example config for alternate speed clamping:
-//   sv_airaccel_qw 0.8
+//   autocvar_sv_airaccel_qw 0.8
 //   sv_airaccel_sideways_friction 0
 //   prvm_globalset server speedclamp_mode 1
 //     (or 2)
@@ -608,26 +608,26 @@ void PM_AirAccelerate(vector wishdir, float wishspeed)
 
        if(wishspeed > curspeed * 1.01)
        {
-               wishspeed = min(wishspeed, curspeed + sv_warsowbunny_airforwardaccel * self.stat_sv_maxspeed * frametime);
+               wishspeed = min(wishspeed, curspeed + autocvar_sv_warsowbunny_airforwardaccel * self.stat_sv_maxspeed * frametime);
        }
        else
        {
-               f = max(0, (sv_warsowbunny_topspeed - curspeed) / (sv_warsowbunny_topspeed - self.stat_sv_maxspeed));
-               wishspeed = max(curspeed, self.stat_sv_maxspeed) + sv_warsowbunny_accel * f * self.stat_sv_maxspeed * frametime;
+               f = max(0, (autocvar_sv_warsowbunny_topspeed - curspeed) / (autocvar_sv_warsowbunny_topspeed - self.stat_sv_maxspeed));
+               wishspeed = max(curspeed, self.stat_sv_maxspeed) + autocvar_sv_warsowbunny_accel * f * self.stat_sv_maxspeed * frametime;
        }
        wishvel = wishdir * wishspeed;
        acceldir = wishvel - curvel;
        addspeed = vlen(acceldir);
        acceldir = normalize(acceldir);
 
-       accelspeed = min(addspeed, sv_warsowbunny_turnaccel * self.stat_sv_maxspeed * frametime);
+       accelspeed = min(addspeed, autocvar_sv_warsowbunny_turnaccel * self.stat_sv_maxspeed * frametime);
 
-       if(sv_warsowbunny_backtosideratio < 1)
+       if(autocvar_sv_warsowbunny_backtosideratio < 1)
        {
                curdir = normalize(curvel);
                dot = acceldir * curdir;
                if(dot < 0)
-                       acceldir = acceldir - (1 - sv_warsowbunny_backtosideratio) * dot * curdir;
+                       acceldir = acceldir - (1 - autocvar_sv_warsowbunny_backtosideratio) * dot * curdir;
        }
 
        self.velocity += accelspeed * acceldir;
@@ -716,13 +716,13 @@ void SV_PlayerPhysics()
        maxspd_mod *= autocvar_g_movement_highspeed;
 
        // fix physics stats for g_movement_highspeed
-       self.stat_sv_airaccel_qw = AdjustAirAccelQW(sv_airaccel_qw, maxspd_mod);
-       if(sv_airstrafeaccel_qw)
-               self.stat_sv_airstrafeaccel_qw = AdjustAirAccelQW(sv_airstrafeaccel_qw, maxspd_mod);
+       self.stat_sv_airaccel_qw = AdjustAirAccelQW(autocvar_sv_airaccel_qw, maxspd_mod);
+       if(autocvar_sv_airstrafeaccel_qw)
+               self.stat_sv_airstrafeaccel_qw = AdjustAirAccelQW(autocvar_sv_airstrafeaccel_qw, maxspd_mod);
        else
                self.stat_sv_airstrafeaccel_qw = 0;
-       self.stat_sv_airspeedlimit_nonqw = sv_airspeedlimit_nonqw * maxspd_mod;
-       self.stat_sv_maxspeed = sv_maxspeed * maxspd_mod; // also slow walking
+       self.stat_sv_airspeedlimit_nonqw = autocvar_sv_airspeedlimit_nonqw * maxspd_mod;
+       self.stat_sv_maxspeed = autocvar_sv_maxspeed * maxspd_mod; // also slow walking
 
     if(self.PlayerPhysplug)
         if(self.PlayerPhysplug())
@@ -883,7 +883,7 @@ void SV_PlayerPhysics()
                maxspd_mod = self.spectatorspeed;
        }
 
-       spd = max(self.stat_sv_maxspeed, sv_maxairspeed) * maxspd_mod * swampspd_mod;
+       spd = max(self.stat_sv_maxspeed, autocvar_sv_maxairspeed) * maxspd_mod * swampspd_mod;
        if(self.speed != spd)
        {
                self.speed = spd;
@@ -972,7 +972,7 @@ void SV_PlayerPhysics()
                // noclipping or flying
                self.flags &~= FL_ONGROUND;
 
-               self.velocity = self.velocity * (1 - frametime * sv_friction);
+               self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
                makevectors(self.v_angle);
                //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
                wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z;
@@ -982,7 +982,7 @@ void SV_PlayerPhysics()
                if (wishspeed > self.stat_sv_maxspeed*maxspd_mod)
                        wishspeed = self.stat_sv_maxspeed*maxspd_mod;
                if (time >= self.teleport_time)
-                       PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0, 0);
+                       PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0);
        }
        else if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
@@ -1002,24 +1002,24 @@ void SV_PlayerPhysics()
                wishspeed = wishspeed * 0.7;
 
                // water friction
-               self.velocity = self.velocity * (1 - frametime * sv_friction);
+               self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
 
                // water acceleration
-               PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0, 0);
+               PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0);
        }
        else if (time < self.ladder_time)
        {
                // on a spawnfunc_func_ladder or swimming in spawnfunc_func_water
                self.flags &~= FL_ONGROUND;
 
-               self.velocity = self.velocity * (1 - frametime * sv_friction);
+               self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
                makevectors(self.v_angle);
                //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
                wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z;
                if (self.gravity)
-                       self.velocity_z = self.velocity_z + self.gravity * sv_gravity * frametime;
+                       self.velocity_z = self.velocity_z + self.gravity * autocvar_sv_gravity * frametime;
                else
-                       self.velocity_z = self.velocity_z + sv_gravity * frametime;
+                       self.velocity_z = self.velocity_z + autocvar_sv_gravity * frametime;
                if (self.ladder_entity.classname == "func_water")
                {
                        f = vlen(wishvel);
@@ -1048,7 +1048,7 @@ void SV_PlayerPhysics()
                if (time >= self.teleport_time)
                {
                        // water acceleration
-                       PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0, 0);
+                       PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0);
                }
        }
        else if ((self.items & IT_JETPACK) && self.BUTTON_HOOK && (!cvar("g_jetpack_fuel") || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -1057,7 +1057,7 @@ void SV_PlayerPhysics()
                makevectors(self.v_angle);
                wishvel = v_forward * self.movement_x + v_right * self.movement_y;
                // add remaining speed as Z component
-               maxairspd = sv_maxairspeed*max(1, maxspd_mod);
+               maxairspd = autocvar_sv_maxairspeed*max(1, maxspd_mod);
                // fix speedhacks :P
                wishvel = normalize(wishvel) * min(vlen(wishvel) / maxairspd, 1);
                // add the unused velocity as up component
@@ -1070,7 +1070,7 @@ void SV_PlayerPhysics()
                float a_side, a_up, a_add, a_diff;
                a_side = cvar("g_jetpack_acceleration_side");
                a_up = cvar("g_jetpack_acceleration_up");
-               a_add = cvar("g_jetpack_antigravity") * sv_gravity;
+               a_add = cvar("g_jetpack_antigravity") * autocvar_sv_gravity;
 
                wishvel_x *= a_side;
                wishvel_y *= a_side;
@@ -1119,7 +1119,7 @@ void SV_PlayerPhysics()
 
                float fxy, fz;
                fxy = bound(0, 1 - (self.velocity * normalize(wishvel_x * '1 0 0' + wishvel_y * '0 1 0')) / cvar("g_jetpack_maxspeed_side"), 1);
-               if(wishvel_z - sv_gravity > 0)
+               if(wishvel_z - autocvar_sv_gravity > 0)
                        fz = bound(0, 1 - self.velocity_z / cvar("g_jetpack_maxspeed_up"), 1);
                else
                        fz = bound(0, 1 + self.velocity_z / cvar("g_jetpack_maxspeed_up"), 1);
@@ -1128,7 +1128,7 @@ void SV_PlayerPhysics()
                fvel = vlen(wishvel);
                wishvel_x *= fxy;
                wishvel_y *= fxy;
-               wishvel_z = (wishvel_z - sv_gravity) * fz + sv_gravity;
+               wishvel_z = (wishvel_z - autocvar_sv_gravity) * fz + autocvar_sv_gravity;
 
                fvel = min(1, vlen(wishvel) / best);
                if(cvar("g_jetpack_fuel") && !(self.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -1190,10 +1190,10 @@ void SV_PlayerPhysics()
                f = vlen(v);
                if(f > 0)
                {
-                       if (f < sv_stopspeed)
-                               f = 1 - frametime * (sv_stopspeed / f) * sv_friction;
+                       if (f < autocvar_sv_stopspeed)
+                               f = 1 - frametime * (autocvar_sv_stopspeed / f) * autocvar_sv_friction;
                        else
-                               f = 1 - frametime * sv_friction;
+                               f = 1 - frametime * autocvar_sv_friction;
                        if (f > 0)
                                self.velocity = self.velocity * f;
                        else
@@ -1208,7 +1208,7 @@ void SV_PlayerPhysics()
                if (self.crouch)
                        wishspeed = wishspeed * 0.5;
                if (time >= self.teleport_time)
-                       PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0, 0);
+                       PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0);
        }
        else
        {
@@ -1219,13 +1219,13 @@ void SV_PlayerPhysics()
 
                if(maxspd_mod < 1)
                {
-                       maxairspd = sv_maxairspeed*maxspd_mod;
-                       airaccel = sv_airaccelerate*maxspd_mod;
+                       maxairspd = autocvar_sv_maxairspeed*maxspd_mod;
+                       airaccel = autocvar_sv_airaccelerate*maxspd_mod;
                }
                else
                {
-                       maxairspd = sv_maxairspeed;
-                       airaccel = sv_airaccelerate;
+                       maxairspd = autocvar_sv_maxairspeed;
+                       airaccel = autocvar_sv_airaccelerate;
                }
                // airborn
                makevectors(self.v_angle_y * '0 1 0');
@@ -1251,13 +1251,13 @@ void SV_PlayerPhysics()
                        wishspeed2 = wishspeed;
 
                        // CPM
-                       if(sv_airstopaccelerate)
+                       if(autocvar_sv_airstopaccelerate)
                        {
                                vector curdir;
                                curdir = self.velocity;
                                curdir_z = 0;
                                curdir = normalize(curdir);
-                               airaccel = airaccel + (sv_airstopaccelerate*maxspd_mod - airaccel) * max(0, -(curdir * wishdir));
+                               airaccel = airaccel + (autocvar_sv_airstopaccelerate*maxspd_mod - airaccel) * max(0, -(curdir * wishdir));
                        }
                        // note that for straight forward jumping:
                        // step = accel * frametime * wishspeed0;
@@ -1269,19 +1269,19 @@ void SV_PlayerPhysics()
                        // log dv/dt = logaccel + logmaxspeed + log(1 - accelqw) (when fast)
                        strafity = IsMoveInDirection(self.movement, -90) + IsMoveInDirection(self.movement, +90); // if one is nonzero, other is always zero
                        if(sv_maxairstrafespeed)
-                               wishspeed = min(wishspeed, GeomLerp(sv_maxairspeed*maxspd_mod, strafity, sv_maxairstrafespeed*maxspd_mod));
-                       if(sv_airstrafeaccelerate)
-                               airaccel = GeomLerp(airaccel, strafity, sv_airstrafeaccelerate*maxspd_mod);
+                               wishspeed = min(wishspeed, GeomLerp(autocvar_sv_maxairspeed*maxspd_mod, strafity, sv_maxairstrafespeed*maxspd_mod));
+                       if(autocvar_sv_airstrafeaccelerate)
+                               airaccel = GeomLerp(airaccel, strafity, autocvar_sv_airstrafeaccelerate*maxspd_mod);
                        if(self.stat_sv_airstrafeaccel_qw)
                                airaccelqw = copysign(1-GeomLerp(1-fabs(self.stat_sv_airaccel_qw), strafity, 1-fabs(self.stat_sv_airstrafeaccel_qw)), ((strafity > 0.5) ? self.stat_sv_airstrafeaccel_qw : self.stat_sv_airaccel_qw));
                        // !CPM
 
-                       if(sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement_x != 0)
+                       if(autocvar_sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement_x != 0)
                                PM_AirAccelerate(wishdir, wishspeed);
                        else
                                PM_Accelerate(wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, sv_airaccel_sideways_friction / maxairspd, self.stat_sv_airspeedlimit_nonqw);
 
-                       if(sv_aircontrol)
+                       if(autocvar_sv_aircontrol)
                                CPM_PM_Aircontrol(wishdir, wishspeed2);
                }
        }
index 52f756e..3bec2eb 100644 (file)
@@ -539,13 +539,13 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        }
                        else if(attacker.team == targ.team)
                        {
-                               if(teamplay == 1)
+                               if(autocvar_teamplay == 1)
                                        damage = 0;
                                else if(attacker != targ)
                                {
-                                       if(teamplay == 3)
+                                       if(autocvar_teamplay == 3)
                                                damage = 0;
-                                       else if(teamplay == 4)
+                                       else if(autocvar_teamplay == 4)
                                        {
                                                if(targ.classname == "player" && targ.deadflag == DEAD_NO)
                                                {
index 5b7d80f..f85bbcf 100644 (file)
@@ -143,7 +143,7 @@ void(float c) SV_ChangeTeam =
        if (mode_shirtmustmatchpants || shirt < 0)
                shirt = pants;
        setcolor(self, pants + shirt * 16);
-       if (pants != old && old >= 0 && teamplay && deathmatch)
+       if (pants != old && old >= 0 && autocvar_teamplay && deathmatch)
        {
                T_Damage(self, self, self, 0, 0, " changed teams", DT_TELEFRAG, self.origin, '0 0 0', Obituary_Generic);
                self.frags = 0;
index dd3f43f..89feff9 100644 (file)
@@ -89,10 +89,10 @@ void movelib_move(vector force,float max_velocity,float drag,float theMass,float
     if (self.waterlevel > 1)
     {
         self.velocity = self.velocity + force * (acceleration * deltatime);
-        self.velocity = self.velocity + '0 0 0.05' * sv_gravity * deltatime;
+        self.velocity = self.velocity + '0 0 0.05' * autocvar_sv_gravity * deltatime;
     }
     else
-        self.velocity = self.velocity + '0 0 -1' * sv_gravity * deltatime;
+        self.velocity = self.velocity + '0 0 -1' * autocvar_sv_gravity * deltatime;
 
     mspeed = vlen(self.velocity);
 
@@ -137,7 +137,7 @@ void movelib_update(vector dir,float force)
     old_speed    = vlen(self.velocity);
     old_dir      = normalize(self.velocity);
 
-    //ggravity      =  (sv_gravity / self.mass) * '0 0 100';
+    //ggravity      =  (autocvar_sv_gravity / self.mass) * '0 0 100';
     acceleration =  (force / self.mass) * dir;
     //acceleration -= old_dir * (old_speed / self.mass);
     acceleration -= ggravity;
index e5c4348..aef4031 100644 (file)
@@ -86,7 +86,7 @@ void CreatureFrame (void)
                        if (g_footsteps)
                        if (!gameover)
                        if (self.flags & FL_ONGROUND)
-                       if (vlen(self.velocity) > sv_maxspeed * 0.6)
+                       if (vlen(self.velocity) > autocvar_sv_maxspeed * 0.6)
                        if (!self.deadflag)
                        if (time < self.lastground + 0.2)
                        {
@@ -175,31 +175,6 @@ void StartFrame (void)
 
        WarpZone_StartFrame();
 
-       sv_gravity = cvar("sv_gravity");
-       sv_maxairspeed = cvar("sv_maxairspeed");
-       sv_maxspeed = cvar ("sv_maxspeed");
-       sv_friction = cvar ("sv_friction");
-       sv_accelerate = cvar ("sv_accelerate");
-       sv_airaccelerate = cvar("sv_airaccelerate");
-       sv_airaccel_sideways_friction = cvar("sv_airaccel_sideways_friction");
-       sv_airaccel_qw = cvar("sv_airaccel_qw");
-       sv_stopspeed = cvar ("sv_stopspeed");
-       sv_airstopaccelerate = cvar("sv_airstopaccelerate");
-       sv_airstrafeaccelerate = cvar("sv_airstrafeaccelerate");
-       sv_maxairstrafespeed = cvar("sv_maxairstrafespeed");
-       sv_airstrafeaccel_qw = cvar("sv_airstrafeaccel_qw");
-       sv_aircontrol = cvar("sv_aircontrol");
-       sv_aircontrol_penalty = cvar("sv_aircontrol_penalty");
-       sv_aircontrol_power = cvar("sv_aircontrol_power");
-       sv_warsowbunny_airforwardaccel = cvar("sv_warsowbunny_airforwardaccel");
-       sv_warsowbunny_accel = cvar("sv_warsowbunny_accel");
-       sv_warsowbunny_topspeed = cvar("sv_warsowbunny_topspeed");
-       sv_warsowbunny_turnaccel = cvar("sv_warsowbunny_turnaccel");
-       sv_warsowbunny_backtosideratio = cvar("sv_warsowbunny_backtosideratio");
-       sv_airspeedlimit_nonqw = cvar("sv_airspeedlimit_nonqw");
-       sv_doublejump = cvar("sv_doublejump");
-       teamplay = cvar ("teamplay");
-
        sys_frametime = cvar("sys_ticrate") * cvar("slowmo");
        if(sys_frametime <= 0)
                sys_frametime = 1.0 / 60.0; // somewhat safe fallback
@@ -207,10 +182,10 @@ void StartFrame (void)
        if (timeoutStatus == 1) // just before the timeout (when timeoutStatus will be 2)
                orig_slowmo = cvar("slowmo"); // slowmo will be restored after the timeout
 
-       if(teams_matter && !teamplay)
-               teamplay = 3;
-       if(!teams_matter && teamplay)
-               teamplay = 0;
+       if(teams_matter && !autocvar_teamplay)
+               cvar_set("teamplay", "3"); // this also updates the autocvar
+       if(!teams_matter && autocvar_teamplay)
+               cvar_set("teamplay", "0"); // this also updates the autocvar
 
        skill = cvar("skill");
 
index eba0ea0..4872977 100644 (file)
@@ -33,7 +33,7 @@ float check_tdeath(entity player, vector org, vector telefragmin, vector telefra
        {
                TDEATHLOOP(org)
                {
-                       if not(teamplay && cvar("g_telefrags_teamplay") && head.team == player.team)
+                       if not(autocvar_teamplay && cvar("g_telefrags_teamplay") && head.team == player.team)
                                if(head.classname == "player")
                                        if(head.health >= 1)
                                                return 1;
@@ -48,7 +48,7 @@ void tdeath(entity player, entity teleporter, entity telefragger, vector telefra
        {
                if (player.classname == "player" && player.health >= 1)
                {
-                       if not(teamplay && cvar("g_telefrags_teamplay") && head.team == player.team)
+                       if not(autocvar_teamplay && cvar("g_telefrags_teamplay") && head.team == player.team)
                        {
                                if(head.classname == "player")
                                        if(head.health >= 1)
index 262b5e9..d7a73f7 100644 (file)
@@ -161,13 +161,9 @@ void default_delayedinit()
 void ActivateTeamplay()
 {
        float teamplay_default;
-       teamplay_default = cvar("teamplay_default");
 
-       if(teamplay_default)
-               teamplay = teamplay_default;
-       else
-               teamplay = 3;
-       cvar_set("teamplay", ftos(teamplay));
+       teamplay_default = cvar_or("teamplay_default", 3);
+       cvar_set("teamplay", teamplay_default);
 
        teams_matter = 1;
 }
index 99f18c2..80344a9 100644 (file)
@@ -63,7 +63,7 @@ vector turret_stdproc_aim_generic()
                                vz = self.enemy.velocity_z;
                                for(i = 0; i < impact_time; i += sys_frametime)
                                {
-                                       vz = vz - (sv_gravity * sys_frametime);
+                                       vz = vz - (autocvar_sv_gravity * sys_frametime);
                                        prep_z = prep_z + vz * sys_frametime;
                                }
                        }
index d3e0553..4e9c8a7 100644 (file)
@@ -269,7 +269,7 @@ void turret_stdproc_damage (entity inflictor, entity attacker, float damage, flo
     if not (self.tur_active)
         return;
 
-    if (teamplay != 0)
+    if (autocvar_teamplay != 0)
     if (self.team == attacker.team)
     {
         // This does not happen anymore. Re-enable if you fix that.
index af53db7..f4738fa 100644 (file)
@@ -609,7 +609,7 @@ void turret_think()
     self.nextthink = time + self.ticrate;
 
     // ONS uses somewhat backwards linking.
-    if (teamplay)
+    if (autocvar_teamplay)
     {
         if not (g_onslaught)
             if (self.target)
@@ -918,7 +918,7 @@ float turret_stdproc_init (string cvar_base_name, float csqc_shared, string base
         if not (self.team)
             self.team = 14; // Assume turrets are on the defending side if not explicitly set otehrwize
     }
-    else if not (teamplay)
+    else if not (autocvar_teamplay)
                self.team = MAX_SHOT_DISTANCE; // Group all turrets into the same team, so they dont kill eachother.
        else if(g_onslaught && self.targetname)
        {
index 6f40e0b..e2a6133 100644 (file)
@@ -114,7 +114,7 @@ void racer_align4point()
         self.velocity += normalize(self.origin - trace_endpos) * (vlen(self.velocity) * 1.25);
 
     self.velocity =  self.velocity + (push_vector * frametime);
-    self.velocity_z -= sv_gravity * frametime;
+    self.velocity_z -= autocvar_sv_gravity * frametime;
 
     push_vector_x = (fl_push - bl_push);
     push_vector_x += (fr_push - br_push);
index ee6d397..bd75971 100644 (file)
@@ -295,7 +295,7 @@ void raptor_enter()
     if (clienttype(other) != CLIENTTYPE_REAL)
         return;
 
-    if(teamplay)
+    if(autocvar_teamplay)
         if(self.team)
             if(self.team != other.team)
                 return;
index 056249e..ff43dea 100644 (file)
@@ -430,7 +430,7 @@ void spiderbot_enter()
 
     self.colormod = self.tur_head.colormod = '0 0 0';
 
-    if(teamplay)
+    if(autocvar_teamplay)
     if(self.team)
     if(self.team != other.team)
         return;
@@ -533,7 +533,7 @@ void spiderbot_exit(float eject)
        self.colormap            = 1024;
        self.tur_head.colormap   = 1024;
 
-    if not (teamplay)
+    if not (autocvar_teamplay)
         self.team                = 0;
     else
     {
@@ -697,7 +697,7 @@ void vewhicle_spiderbot_dinit()
     tracebox(self.origin + '0 0 100', spiderbot_MIN, spiderbot_MAX, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
     setorigin(self.spiderbot_spawnpnt,trace_endpos);
 
-    if(self.team && !teamplay)
+    if(self.team && !autocvar_teamplay)
         self.team = 0;
     else
         self.spiderbot_spawnpnt.team = self.team;
index 0a06064..8e0548e 100644 (file)
@@ -314,9 +314,9 @@ float w_minelayer(float req)
                        }
                        float desirabledamage;
                        desirabledamage = enemydamage;
-                       if (teamplay != 1 && time > self.invincible_finished && time > self.spawnshieldtime)
+                       if (autocvar_teamplay != 1 && time > self.invincible_finished && time > self.spawnshieldtime)
                                desirabledamage = desirabledamage - selfdamage * cvar("g_balance_selfdamagepercent");
-                       if (self.team && teamplay != 1)
+                       if (self.team && autocvar_teamplay != 1)
                                desirabledamage = desirabledamage - teamdamage;
 
                        mine = find(world, classname, "mine");
index ce97b02..93e8bfd 100644 (file)
@@ -43,7 +43,7 @@ void W_MinstaNex_Attack (void)
        // teamcolor / hit beam effect
        vector v;
        v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
-       if(teamplay)
+       if(autocvar_teamplay)
        {
            switch(self.team)
            {
index cbc458f..9efd46d 100644 (file)
@@ -349,9 +349,9 @@ float w_rlauncher(float req)
                        }
                        local float desirabledamage;
                        desirabledamage = enemydamage;
-                       if (teamplay != 1 && time > self.invincible_finished && time > self.spawnshieldtime)
+                       if (autocvar_teamplay != 1 && time > self.invincible_finished && time > self.spawnshieldtime)
                                desirabledamage = desirabledamage - selfdamage * cvar("g_balance_selfdamagepercent");
-                       if (self.team && teamplay != 1)
+                       if (self.team && autocvar_teamplay != 1)
                                desirabledamage = desirabledamage - teamdamage;
 
                        missile = find(world, classname, "rocket");
index c9cfdc4..a1b764d 100644 (file)
@@ -46,7 +46,7 @@ float Tuba_GetNote(entity pl, float hittype)
        
        // we support two kinds of tubas, those tuned in Eb and those tuned in C
        // kind of tuba currently is player slot number, or team number if in
-       // teamplay
+       // autocvar_teamplay
        // that way, holes in the range of notes are "plugged"
        if(teams_matter)
        {