rename sv_speedlimit to sv_airspeedlimit_nonqw
authorRudolf Polzer <divverent@alientrap.org>
Fri, 4 Jun 2010 21:46:53 +0000 (23:46 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 4 Jun 2010 21:46:53 +0000 (23:46 +0200)
qcsrc/common/constants.qh
qcsrc/server/cl_physics.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/sv_main.qc

index d747b70..2fe55b1 100644 (file)
@@ -281,6 +281,7 @@ const float STAT_LEADLIMIT = 47;
 const float STAT_BULLETS_LOADED = 48;
 
 // see DP source, quakedef.h
+const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222;
 const float STAT_MOVEVARS_AIRSTRAFEACCEL_QW = 223;
 const float STAT_MOVEVARS_AIRACCEL_QW = 254;
 
index 5e70e79..3a405c4 100644 (file)
@@ -21,7 +21,7 @@ float sv_warsowbunny_accel;
 float sv_warsowbunny_topspeed;
 float sv_warsowbunny_turnaccel;
 float sv_warsowbunny_backtosideratio;
-float sv_speedlimit;
+float sv_airspeedlimit_nonqw;
 
 .float ladder_time;
 .entity ladder_entity;
@@ -488,7 +488,7 @@ float AdjustAirAccelQW(float accelqw, float factor)
 //   sv_airaccel_sideways_friction 0
 //   prvm_globalset server speedclamp_mode 1
 //     (or 2)
-void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float sidefric)
+void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float sidefric, float speedlimit)
 {
        float vel_straight;
        float vel_z;
@@ -515,8 +515,8 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
        step = accel * frametime * wishspeed0;
 
        vel_xy_current  = vlen(vel_xy);
-       if(sv_speedlimit)
-               accelqw = AdjustAirAccelQW(accelqw, (sv_speedlimit - bound(wishspeed, vel_xy_current, sv_speedlimit)) / max(1, sv_speedlimit - wishspeed));
+       if(speedlimit)
+               accelqw = AdjustAirAccelQW(accelqw, (speedlimit - bound(wishspeed, vel_xy_current, speedlimit)) / max(1, speedlimit - wishspeed));
        vel_xy_forward  = vel_xy_current + bound(0, wishspeed - vel_xy_current, step) * accelqw + step * (1 - accelqw);
        vel_xy_backward = vel_xy_current - bound(0, wishspeed + vel_xy_current, step) * accelqw - step * (1 - accelqw);
        if(vel_xy_backward < 0)
@@ -657,6 +657,7 @@ void SV_PlayerPhysics()
                self.stat_sv_airstrafeaccel_qw = AdjustAirAccelQW(sv_airstrafeaccel_qw, autocvar_g_movement_highspeed);
        else
                self.stat_sv_airstrafeaccel_qw = 0;
+       self.stat_sv_airspeedlimit_nonqw = sv_airspeedlimit_nonqw * autocvar_g_movement_highspeed;
 
     if(self.PlayerPhysplug)
         if(self.PlayerPhysplug())
@@ -932,7 +933,7 @@ void SV_PlayerPhysics()
                if (wishspeed > sv_maxspeed*maxspd_mod)
                        wishspeed = sv_maxspeed*maxspd_mod;
                if (time >= self.teleport_time)
-                       PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0);
+                       PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0, 0);
        }
        else if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
@@ -955,7 +956,7 @@ void SV_PlayerPhysics()
                self.velocity = self.velocity * (1 - frametime * sv_friction);
 
                // water acceleration
-               PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0);
+               PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0, 0);
        }
        else if (time < self.ladder_time)
        {
@@ -998,7 +999,7 @@ void SV_PlayerPhysics()
                if (time >= self.teleport_time)
                {
                        // water acceleration
-                       PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0);
+                       PM_Accelerate(wishdir, wishspeed, wishspeed, 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))
@@ -1158,7 +1159,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);
+                       PM_Accelerate(wishdir, wishspeed, wishspeed, sv_accelerate*maxspd_mod, 1, 0, 0);
        }
        else
        {
@@ -1224,7 +1225,7 @@ void SV_PlayerPhysics()
                        if(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);
+                               PM_Accelerate(wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, sv_airaccel_sideways_friction / maxairspd, self.stat_sv_airspeedlimit_nonqw);
 
                        if(sv_aircontrol)
                                CPM_PM_Aircontrol(wishdir, wishspeed2);
index fec2a09..4d70177 100644 (file)
@@ -536,6 +536,7 @@ float game_starttime; //point in time when the countdown is over
 
 .float stat_sv_airaccel_qw;
 .float stat_sv_airstrafeaccel_qw;
+.float stat_sv_airspeedlimit_nonqw;
 
 void W_Porto_Remove (entity p);
 
index e969146..f873ea7 100644 (file)
@@ -636,6 +636,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_BULLETS_LOADED, AS_INT, campingrifle_bulletcounter);
 
        // 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);
        addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw);
 
index 85ff776..45320f2 100644 (file)
@@ -198,7 +198,7 @@ void StartFrame (void)
        sv_warsowbunny_topspeed = cvar("sv_warsowbunny_topspeed");
        sv_warsowbunny_turnaccel = cvar("sv_warsowbunny_turnaccel");
        sv_warsowbunny_backtosideratio = cvar("sv_warsowbunny_backtosideratio");
-       sv_speedlimit = cvar("sv_speedlimit");
+       sv_airspeedlimit_nonqw = cvar("sv_airspeedlimit_nonqw");
        teamplay = cvar ("teamplay");
        sys_frametime = cvar("sys_ticrate") * cvar("slowmo");
        sv_doublejump = cvar("sv_doublejump");