From ee03cdfd1018584521e28c6eb3ecc1b0f483fded Mon Sep 17 00:00:00 2001 From: otta8634 Date: Sat, 18 Jan 2025 15:52:46 +0800 Subject: [PATCH] Undo physics changes related to hash change of 0e542a1e This commit altered how physics code works, changing the hash. This is a regression. The rest of the changes in 0e542a1e didn't update the hash, and logically speaking shouldn't alter how physics works. Undid changes which led to the hash change, at the tiny cost of some lost regained performance. --- .gitlab-ci.yml | 2 +- qcsrc/ecs/systems/physics.qc | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b45e9f27b..7a70b79b2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,7 +45,7 @@ test_compilation_units: test_sv_game: stage: test script: - - export EXPECT=f5fbfbd04a22e781397cfd14db367419 + - export EXPECT=ee6d65824c57cb6d83cba31481a21822 - qcsrc/tools/sv_game-hashtest.sh - exit $? diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index 42fdb5109..d678038a0 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -266,11 +266,8 @@ void sys_phys_simulate(entity this, float dt) } // acceleration - float wishvel_len = vlen(wishvel); - float wishspeed = min(wishvel_len, this.com_phys_vel_max); - - // same as wishdir = normalize(wishvel); but cheaper - const vector wishdir = (wishvel_len ? wishvel / wishvel_len : '0 0 0'); + const vector wishdir = normalize(wishvel); + float wishspeed = min(vlen(wishvel), this.com_phys_vel_max); if (this.com_phys_air) { if (!(this.flags & FL_WATERJUMP)) { -- 2.39.5