From 3160c1f2cba7c15da083e3bdb4607b29f350d959 Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Tue, 23 Mar 2021 21:19:07 +0100 Subject: [PATCH] strafehud: move text indicators so that they don't overlap with the arrows --- qcsrc/client/hud/panel/strafehud.qc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 86827b62b..ce8a1fceb 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -156,6 +156,7 @@ void HUD_StrafeHUD() vector direction_size_vertical = '0 0 0'; vector direction_size_horizontal = '0 0 0'; float range_minangle; + float arrow_size = max(panel_size.y * min(autocvar_hud_panel_strafehud_angle_arrow_size, 10), 0); // there's only one size cvar for the arrows, they will always have a 45° angle to ensure proper rendering without antialiasing // determine whether the player is pressing forwards or backwards keys if(islocal) // if entity is local player @@ -449,7 +450,7 @@ void HUD_StrafeHUD() hidden_width = (360 - hudangle) / hudangle * panel_size.x; // current angle currentangle_size.x = panel_size.x * min(autocvar_hud_panel_strafehud_angle_width, 10); - currentangle_size.y = panel_size.y * min(autocvar_hud_panel_strafehud_angle_height, 10); + currentangle_size.y = max(panel_size.y * min(autocvar_hud_panel_strafehud_angle_height, 10), 0); if(mode == 0) { currentangle_offset = angle/hudangle * panel_size.x; @@ -705,7 +706,6 @@ void HUD_StrafeHUD() if(autocvar_hud_panel_strafehud_angle_arrow > 0) { - float arrow_size = panel_size.y * min(autocvar_hud_panel_strafehud_angle_arrow_size, 10); // there's only one size cvar, arrows always have a 45° angle to ensure proper rendering without antialiasing if(arrow_size > 0) { if(autocvar_hud_panel_strafehud_angle_arrow == 1 || autocvar_hud_panel_strafehud_angle_arrow >= 3) @@ -741,7 +741,7 @@ void HUD_StrafeHUD() { vector startspeed_size = panel_size; startspeed_size.y = panel_size.y * min(autocvar_hud_panel_strafehud_startspeed_size, 10); - drawstring_aspect(panel_pos + eY * panel_size.y, strcat(ftos_decimals(startspeed * speed_conversion_factor, 2), autocvar_hud_panel_strafehud_unit_show ? speed_unit : ""), startspeed_size, autocvar_hud_panel_strafehud_startspeed_color, text_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(panel_pos + eY * (panel_size.y + arrow_size + ((currentangle_size.y - panel_size.y) / 2)), strcat(ftos_decimals(startspeed * speed_conversion_factor, 2), autocvar_hud_panel_strafehud_unit_show ? speed_unit : ""), startspeed_size, autocvar_hud_panel_strafehud_startspeed_color, text_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } } else @@ -793,7 +793,7 @@ void HUD_StrafeHUD() { vector jumpheight_size = panel_size; jumpheight_size.y = panel_size.y * min(autocvar_hud_panel_strafehud_jumpheight_size, 10); - drawstring_aspect(panel_pos - eY * jumpheight_size.y, strcat(ftos_decimals(jumpheight_persistent * length_conversion_factor, length_decimals), autocvar_hud_panel_strafehud_unit_show ? length_unit : ""), jumpheight_size, autocvar_hud_panel_strafehud_jumpheight_color, text_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(panel_pos - eY * (jumpheight_size.y + arrow_size + ((currentangle_size.y - panel_size.y) / 2)), strcat(ftos_decimals(jumpheight_persistent * length_conversion_factor, length_decimals), autocvar_hud_panel_strafehud_unit_show ? length_unit : ""), jumpheight_size, autocvar_hud_panel_strafehud_jumpheight_color, text_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } } else -- 2.39.2