Calculate desired speed on the client side, alleviates the need for a networked stat 843/head
authorMario <mario.mario@y7mail.com>
Fri, 17 Jul 2020 07:38:42 +0000 (17:38 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 17 Jul 2020 07:38:42 +0000 (17:38 +1000)
qcsrc/common/stats.qh
qcsrc/ecs/systems/cl_physics.qc
qcsrc/ecs/systems/sv_physics.qc

index 153ff98..9ecac9f 100644 (file)
@@ -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)
index 4d38c57..d471851 100644 (file)
@@ -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);
index 196f6f1..175c57c 100644 (file)
@@ -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));