]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Measure acceleration in g (g force)
authorterencehill <piuntn@gmail.com>
Sat, 15 Jan 2011 16:35:38 +0000 (17:35 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 15 Jan 2011 16:37:58 +0000 (17:37 +0100)
defaultXonotic.cfg
qcsrc/client/hud.qc

index bb4474062141c49439e68a4a115fd4f23349e708..99f35382e6c0307aa844924d2b47be6bc9007743 100644 (file)
@@ -1428,7 +1428,7 @@ seta hud_panel_physics_speed_max 1800 "speed progressbar gets filled up complete
 seta hud_panel_physics_speed_vertical 0 "include the speed on the Z-axis"
 seta hud_panel_physics_topspeed 1 "also show top speed"
 seta hud_panel_physics_topspeed_time 4 "how many seconds the top speed takes to fade out"
-seta hud_panel_physics_acceleration_max 2 "acceleration progressbar gets filled up completely by this value"
+seta hud_panel_physics_acceleration_max 1.5 "acceleration progressbar gets completely filled up by this value (in g)"
 seta hud_panel_physics_acceleration_vertical 0 "include the acceleration on the Z-axis"
 
 seta hud_showbinds 1   "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both"
index afdd8b4b751dbf4c23042b70388e0464b789c8be..b029ad450e8d1e8aa006078fcc676647e7b9b95a 100644 (file)
@@ -4255,17 +4255,17 @@ void HUD_Physics(void)
                acceleration = autocvar_hud_panel_physics_acceleration_max * 0.3;
        else
        {
+               // 1 m/s = 0.0254 qu/s; 1 g = 9.80665 m/s^2
                f = time - acc_prevtime;
                if(autocvar_hud_panel_physics_acceleration_vertical)
-                       acceleration = (vlen(pmove_vel) - vlen(acc_prevspeed)) * (1 / f);
+                       acceleration = (vlen(pmove_vel) - vlen(acc_prevspeed)) * (1 / f) * (0.0254 / 9.80665);
                else
-                       acceleration = (vlen(pmove_vel - '0 0 1' * pmove_vel_z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed_z)) * (1 / f);
+                       acceleration = (vlen(pmove_vel - '0 0 1' * pmove_vel_z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed_z)) * (1 / f) * (0.0254 / 9.80665);
                acc_prevspeed = pmove_vel;
                acc_prevtime = time;
 
                f = bound(0, f * 10, 1);
                acc_avg = acc_avg * (1 - f) + acceleration * f;
-               acceleration = acc_avg / getstatf(STAT_MOVEVARS_MAXSPEED);
        }
 
        //compute layout
@@ -4311,7 +4311,6 @@ void HUD_Physics(void)
                HUD_Panel_GetProgressBarColor(speed);
                HUD_Panel_DrawProgressBar(panel_pos + speed_offset, panel_size, "progressbar", speed/max_speed, 0, speed_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
-
        vector tmp_offset, tmp_size;
        tmp_size_x = panel_size_x * 0.75;
        tmp_size_y = panel_size_y;
@@ -4404,7 +4403,7 @@ void HUD_Physics(void)
                        HUD_Panel_GetProgressBarColor(acceleration);
                HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset, panel_size, "progressbar", acceleration/autocvar_hud_panel_physics_acceleration_max, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
-       drawstring_aspect(panel_pos + acceleration_offset, ftos_decimals(acceleration, 3), panel_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawstring_aspect(panel_pos + acceleration_offset, strcat(ftos_decimals(acceleration, 2), "g"), panel_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 }
 
 /*