]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 945600a886b208e6af45bb58aba71cd5d304a4ce..fc578c357e3c4e1e67ad74c84ce86566324462f1 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 0550431e968bd8b31b49a7c7546a89faed272bd5..2f56a48015b10221d07357fe516793635d9c2b4c 100644 (file)
@@ -108,7 +108,7 @@ void bot_serverframe();
  * Imports
  */
 
-float sv_maxspeed;
+float autocvar_sv_maxspeed;
 
 void() havocbot_setupbot;
 
index 934aba87ddc6fd2f175fcbde18459dc3de57f694..03f496c3ada98ae3f5828d78bd92ece4e0481f8d 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 a13f4afbc2d7939142d7999c7daa23377c3742a7..173ef23064ceb645c2f4f2de0de85c1b3cfd465a 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 b852e3f05b8652b6c35a242148167f2180034156..77003999acc3fe58dac12c4bc48f90c49bdc8b6f 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 52f756ea7386810a84aaf30fa670caf7bbc0cc35..3bec2ebc8d87a2616c6fa192446ae57349946fa8 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 5b7d80facae461174a6cae6798eca15d3afd5718..f85bbcf0be54ebbc060fa9d5a12e655c0dba7fab 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 dd3f43f9fe6549ce4dbe1ed8344603746e192c8c..89feff9a49e3bbdf77de224226fd569adf8cfb9f 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 e5c4348346d121a0656fcefbfdfe2a1fc5754134..aef4031b7e1cd26f6de3e29c6a920986f9971fe9 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 eba0ea0681b3ee22edfcc378e7ca1c23f1027b17..48729773db03f29d0ddbc2124171fe53bf9b1ac8 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 262b5e98bae1a6ca4fae3df2d29a0b93f3663cf1..d7a73f7d65f648f9cb41345ea500c79bdab50530 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 99f18c20b0c545ffb42c7eb7f8cc2a240a5058e0..80344a9e1f211bd2501911c7dc6272f39659264b 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 d3e0553db9800452fd252ca40c877b5900f53822..4e9c8a7621943063508275f36f140ca83e011cfe 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 af53db7c62c234f258cfb46919f1dfe29e820960..f4738fa0d8033b2051942b6b5ecf5d69a66d5213 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 6f40e0b4d05b6ca6aa7a2c4e69ec60f0ffcec4ce..e2a61336027fc151d962ff309ecc531a1298372c 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 ee6d3976f6dbfa43ab9b4d9c7ac8cb3f1afed7fe..bd7597110225eeb42afb9c733925c2897a1f121c 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 056249ed53a6bc5f276da85ecbfc38532ab6ace6..ff43dea21ccb14ef68f188a7b584115ab40bc504 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 0a06064632deae27be38ad60391fd434326c480a..8e0548ecf9029d842fd5582701de271e238c02ed 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 ce97b02451210d7db63a342db4eb03254e98b2b8..93e8bfde4d49ea2c7cbcc5c664e81c2320b32d64 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 cbc458f5b91fd780d7625d4095353dea20c57976..9efd46d79dd68a9ec81bccdfe456acde947ec119 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 c9cfdc4a49951c1f848394f1c727132717bb5490..a1b764db0ea220f57ab82599f69294198b70dd25 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)
        {