From 9af30d92ef82fdb8019e2d209c790faa6cb47b5f Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 19 Jun 2015 22:47:07 +0200 Subject: [PATCH] Add a cvar to allow disabling the averaging method used for calculating acceleration --- _hud_common.cfg | 2 ++ qcsrc/client/autocvars.qh | 1 + qcsrc/client/hud.qc | 9 ++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index 5aa1bbfee..8558e84be 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -38,6 +38,8 @@ seta hud_panel_engineinfo_framecounter_exponentialmovingaverage 1 "use an averag seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight 0.1 "weight of latest data point" seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold 0.5 "threshold for fps change when to update instantly, to make big fps changes update faster" +seta hud_panel_physics_acceleration_movingaverage 1 "use an averaging method for calculating acceleration instead of the real value" + // hud panel aliases alias hud_panel_radar_rotate "toggle hud_panel_radar_rotation 0 1 2 3 4" alias +hud_panel_radar_maximized "cl_cmd hud radar 1" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index e35bf82dd..f28bc552c 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -282,6 +282,7 @@ float autocvar_hud_panel_notify_fontsize; float autocvar_hud_panel_notify_time; float autocvar_hud_panel_notify_icon_aspect; bool autocvar_hud_panel_physics; +float autocvar_hud_panel_physics_acceleration_movingaverage = 1; float autocvar_hud_panel_physics_acceleration_progressbar_mode; float autocvar_hud_panel_physics_acceleration_progressbar_scale; float autocvar_hud_panel_physics_acceleration_progressbar_nonlinear; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 2f828e27f..0d7dce3f5 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -3996,9 +3996,12 @@ void HUD_Physics(void) acc_prevspeed = vel; acc_prevtime = time; - f = bound(0, f * 10, 1); - acc_avg = acc_avg * (1 - f) + acceleration * f; - acceleration = acc_avg; + if(autocvar_hud_panel_physics_acceleration_movingaverage) + { + f = bound(0, f * 10, 1); + acc_avg = acc_avg * (1 - f) + acceleration * f; + acceleration = acc_avg; + } } //compute layout -- 2.39.2