From ed16e29aa9ba0affc5313b3173737c5586a43406 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 29 Jun 2015 17:59:31 +0200 Subject: [PATCH] Don't show negative 0 values in the accelerometer --- qcsrc/client/hud.qc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 0d7dce3f5..aea6d9b5d 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -4171,8 +4171,13 @@ void HUD_Physics(void) tmp_size.y = panel_size.y * text_scale; tmp_offset.x = 0; tmp_offset.y = (panel_size.y - tmp_size.y) / 2; + + int decimals = 2; + // workaround for ftos_decimals returning a negative 0 + if(acceleration > -1 / pow(10, decimals) && acceleration < 0) + acceleration = 0; if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 3) - drawstring_aspect(panel_pos + acceleration_offset + tmp_offset, strcat(ftos_decimals(acceleration, 2), "g"), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(panel_pos + acceleration_offset + tmp_offset, strcat(ftos_decimals(acceleration, decimals), "g"), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); draw_endBoldFont(); } -- 2.39.2