X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_physics.qc;h=5e70e79bd4d29902e71e6a32b247e924e80be631;hp=0051d8759a4d9a3a9384152d53e848d0a8427dc4;hb=07c6b6356a0c24dcc4c3b7468728b6d96014d446;hpb=7fa36597fbf3333bab27dc3cdc1bb550cabfca17 diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index 0051d8759a..5e70e79bd4 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -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; @@ -477,6 +478,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 @@ -509,6 +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)); 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) @@ -644,9 +652,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;