From: terencehill <piuntn@gmail.com>
Date: Mon, 29 Jun 2015 15:59:31 +0000 (+0200)
Subject: Don't show negative 0 values in the accelerometer
X-Git-Tag: xonotic-v0.8.1~52^2~3
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ed16e29aa9ba0affc5313b3173737c5586a43406;p=xonotic%2Fxonotic-data.pk3dir.git

Don't show negative 0 values in the accelerometer
---

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();
 }