]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into divVerent/speedlimit
authorRudolf Polzer <divverent@alientrap.org>
Tue, 25 May 2010 14:57:37 +0000 (16:57 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 25 May 2010 14:57:37 +0000 (16:57 +0200)
qcsrc/server/cl_physics.qc
qcsrc/server/sv_main.qc

index f42e1420916deb3b52e04c9d9801050f8e370bd9..10086bbc43c9d01c7f2d3050187d7b831b022e27 100644 (file)
@@ -21,6 +21,7 @@ float sv_warsowbunny_accel;
 float sv_warsowbunny_topspeed;
 float sv_warsowbunny_turnaccel;
 float sv_warsowbunny_backtosideratio;
+float sv_speedlimit;
 
 .float ladder_time;
 .entity ladder_entity;
@@ -448,6 +449,11 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
        self.velocity_z = zspeed;
 }
 
+float AdjustAirAccelQW(float accelqw, float factor)
+{
+       return copysign(bound(0.000001, 1 - (1 - fabs(accelqw)) * factor, 1), accelqw);
+}
+
 // example config for alternate speed clamping:
 //   sv_airaccel_qw 0.8
 //   sv_airaccel_sideways_friction 0
@@ -480,6 +486,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));
        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)
@@ -616,9 +624,9 @@ void SV_PlayerPhysics()
        string c;
 
        // fix physics stats for g_movement_highspeed
-       self.stat_sv_airaccel_qw = copysign(bound(0, 1-(1-fabs(sv_airaccel_qw))*autocvar_g_movement_highspeed, 1), sv_airaccel_qw);
+       self.stat_sv_airaccel_qw = AdjustAirAccelQW(sv_airaccel_qw, autocvar_g_movement_highspeed);
        if(sv_airstrafeaccel_qw)
-               self.stat_sv_airstrafeaccel_qw = copysign(bound(0.001, 1-(1-fabs(sv_airstrafeaccel_qw))*autocvar_g_movement_highspeed, 1), sv_airstrafeaccel_qw);
+               self.stat_sv_airstrafeaccel_qw = AdjustAirAccelQW(sv_airstrafeaccel_qw, autocvar_g_movement_highspeed);
        else
                self.stat_sv_airstrafeaccel_qw = 0;
 
index 0212fce8a43fa7fe3e78951aa77e273f57e01468..da576360aa259a281578ed4e9530b68f81acdd45 100644 (file)
@@ -198,6 +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");
        teamplay = cvar ("teamplay");
        sys_frametime = cvar("sys_ticrate") * cvar("slowmo");