From b02c48825fcd881c01d1283798ccc409c2086729 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 17 Jul 2020 17:38:42 +1000 Subject: [PATCH] Calculate desired speed on the client side, alleviates the need for a networked stat --- qcsrc/common/stats.qh | 2 -- qcsrc/ecs/systems/cl_physics.qc | 2 +- qcsrc/ecs/systems/sv_physics.qc | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 153ff98d22..9ecac9f7c0 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -340,8 +340,6 @@ bool autocvar_g_shootfromeye; REGISTER_STAT(SHOOTFROMEYE, bool, autocvar_g_shootfromeye) REGISTER_STAT(SHOOTFROMCENTER, bool, autocvar_g_shootfromcenter) -REGISTER_STAT(MOVEVARS_SPEED, float) - REGISTER_STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, float) REGISTER_STAT(MOVEVARS_AIRCONTROL_PENALTY, float) REGISTER_STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, float) diff --git a/qcsrc/ecs/systems/cl_physics.qc b/qcsrc/ecs/systems/cl_physics.qc index 4d38c574d9..d4718514d2 100644 --- a/qcsrc/ecs/systems/cl_physics.qc +++ b/qcsrc/ecs/systems/cl_physics.qc @@ -26,7 +26,7 @@ void sys_phys_spectator_control(entity this) {} void sys_phys_fixspeed(entity this, float maxspeed_mod) { - float spd = STAT(MOVEVARS_SPEED, this); + float spd = max(PHYS_MAXSPEED(this), PHYS_MAXAIRSPEED(this)) * maxspeed_mod; if (this.speed != spd) { this.speed = spd; string temps = ftos(spd); diff --git a/qcsrc/ecs/systems/sv_physics.qc b/qcsrc/ecs/systems/sv_physics.qc index 196f6f193c..175c57c484 100644 --- a/qcsrc/ecs/systems/sv_physics.qc +++ b/qcsrc/ecs/systems/sv_physics.qc @@ -84,9 +84,6 @@ void sys_phys_spectator_control(entity this) void sys_phys_fixspeed(entity this, float maxspeed_mod) { - float spd = max(PHYS_MAXSPEED(this), PHYS_MAXAIRSPEED(this)) * maxspeed_mod; - STAT(MOVEVARS_SPEED, this) = spd; - if (this.jumpspeedcap_min != autocvar_sv_jumpspeedcap_min) { this.jumpspeedcap_min = autocvar_sv_jumpspeedcap_min; stuffcmd(this, sprintf("\ncl_jumpspeedcap_min \"%s\"\n", autocvar_sv_jumpspeedcap_min)); -- 2.39.2