]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a cvar to control physics hud's movingaverage weighting
authorotta8634 <k9wolf@pm.me>
Tue, 24 Sep 2024 13:40:48 +0000 (21:40 +0800)
committerotta8634 <k9wolf@pm.me>
Tue, 24 Sep 2024 13:40:48 +0000 (21:40 +0800)
Previously it was hardcoded as 10

_hud_common.cfg
qcsrc/client/hud/panel/physics.qc
qcsrc/client/hud/panel/physics.qh

index e8bbe37c49032ffcd280b12e75a1aa9a7706457d..2b1ab01789287cdc2b56ae802754adde619f6dea 100644 (file)
@@ -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"
index 83b432b39433eb8885ecb77e564ec8062aef3d28..f2133fb72bc87b18bce60225fec68a94d2a931ee 100644 (file)
@@ -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;
                }
index c05207a04a554fc1e5969fd8ed53315253d3d43c..ed3f1986151685cf664e78ae0bb6fbba69e7972a 100644 (file)
@@ -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;