From 42b7ee8ca819b90f53116f834d6d7327fec30992 Mon Sep 17 00:00:00 2001 From: otta8634 Date: Tue, 24 Sep 2024 21:40:48 +0800 Subject: [PATCH] Add a cvar to control physics hud's movingaverage weighting Previously it was hardcoded as 10 --- _hud_common.cfg | 1 + qcsrc/client/hud/panel/physics.qc | 2 +- qcsrc/client/hud/panel/physics.qh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index e8bbe37c4..2b1ab0178 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -108,6 +108,7 @@ seta hud_panel_engineinfo_framecounter_decimals "0" "amount of decimals to show" seta hud_panel_engineinfo_framecounter_time "0.1" "time between framerate display updates" seta hud_panel_physics_acceleration_movingaverage "1" "use an averaging method for calculating acceleration instead of the real value" +seta hud_panel_physics_acceleration_movingaverage_strength "10" "weighting given to the current value in the movingaverage averaging method" seta hud_panel_physics_acceleration_max_slick "-1" "acceleration progressbar gets completely filled up by this value (in g) while on slick, -1 = same as the normal max" seta hud_panel_physics_update_interval "0.016" "how often (in seconds) numeric values get updated on screen" seta hud_panel_physics_jumpspeed "0" "also show jump speed, replacing the speed unit text" diff --git a/qcsrc/client/hud/panel/physics.qc b/qcsrc/client/hud/panel/physics.qc index 83b432b39..f2133fb72 100644 --- a/qcsrc/client/hud/panel/physics.qc +++ b/qcsrc/client/hud/panel/physics.qc @@ -100,7 +100,7 @@ void HUD_Physics() if(autocvar_hud_panel_physics_acceleration_movingaverage) { - f = bound(0, f * 10, 1); + f = bound(0, f * autocvar_hud_panel_physics_acceleration_movingaverage_strength, 1); acc_avg = acc_avg * (1 - f) + acceleration * f; acceleration = acc_avg; } diff --git a/qcsrc/client/hud/panel/physics.qh b/qcsrc/client/hud/panel/physics.qh index c05207a04..ed3f19861 100644 --- a/qcsrc/client/hud/panel/physics.qh +++ b/qcsrc/client/hud/panel/physics.qh @@ -3,6 +3,7 @@ bool autocvar_hud_panel_physics; float autocvar_hud_panel_physics_acceleration_movingaverage = 1; +float autocvar_hud_panel_physics_acceleration_movingaverage_strength = 10; float autocvar_hud_panel_physics_acceleration_progressbar_mode; float autocvar_hud_panel_physics_acceleration_progressbar_scale; float autocvar_hud_panel_physics_acceleration_progressbar_nonlinear; -- 2.39.2