From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sun, 18 Jul 2021 18:02:26 +0000 (+0200) Subject: Merge branch master into Juhu/strafehud-server X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=48a13dc978eab5de3cb5202c8ae54be527ba3c12;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch master into Juhu/strafehud-server Fix merge conflict caused by GetSpeedUnit call optimization in master --- 48a13dc978eab5de3cb5202c8ae54be527ba3c12 diff --cc qcsrc/client/hud/panel/strafehud.qc index 11f5f7042,2f0df0821..80995ac6c --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@@ -850,24 -644,9 +848,25 @@@ void HUD_StrafeHUD( if(startspeed >= 0 && text_alpha > 0 && autocvar_hud_panel_strafehud_startspeed_size > 0) { vector startspeed_size = panel_size; - startspeed_size.y = panel_size.y * min(autocvar_hud_panel_strafehud_startspeed_size, 5); + startspeed_size.y = autocvar_hud_panel_strafehud_startspeed_size; + if(!autocvar_hud_panel_strafehud_uncapped) + startspeed_size.y = min(startspeed_size.y, 10); + startspeed_size.y *= panel_size.y; + if(!autocvar_hud_panel_strafehud_uncapped) + startspeed_size.y = max(startspeed_size.y, 1); + + float text_offset = 0; + if((autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha > 0) || (autocvar_hud_panel_strafehud_bestangle && autocvar_hud_panel_strafehud_bestangle_alpha * panel_fg_alpha > 0)) + { + text_offset = (angleheight_offset - panel_size.y) / 2; + if(arrow_size > 0 && autocvar_hud_panel_strafehud_angle_arrow >= 2) + text_offset += arrow_size; + // make sure text doesn't draw inside the strafehud bar + text_offset = max(text_offset, 0); + } + + string speed_unit = GetSpeedUnit(autocvar_hud_panel_strafehud_unit); - 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 + text_offset), 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 @@@ -918,24 -697,9 +917,25 @@@ if(jumpheight_persistent > 0 && text_alpha > 0 && autocvar_hud_panel_strafehud_jumpheight_size > 0) { vector jumpheight_size = panel_size; - jumpheight_size.y = panel_size.y * min(autocvar_hud_panel_strafehud_jumpheight_size, 5); + jumpheight_size.y = autocvar_hud_panel_strafehud_jumpheight_size; + if(!autocvar_hud_panel_strafehud_uncapped) + jumpheight_size.y = min(jumpheight_size.y, 10); + jumpheight_size.y *= panel_size.y; + if(!autocvar_hud_panel_strafehud_uncapped) + jumpheight_size.y = max(jumpheight_size.y, 1); + + float text_offset = 0; + if((autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha > 0) || (autocvar_hud_panel_strafehud_bestangle && autocvar_hud_panel_strafehud_bestangle_alpha * panel_fg_alpha > 0)) + { + text_offset = (angleheight_offset - panel_size.y) / 2; + if(arrow_size > 0 && autocvar_hud_panel_strafehud_angle_arrow == 1 || autocvar_hud_panel_strafehud_angle_arrow >= 3) + text_offset += arrow_size; + // make sure text doesn't draw inside the strafehud bar + text_offset = max(text_offset, 0); + } + + string length_unit = GetLengthUnit(autocvar_hud_panel_strafehud_unit); - 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 + text_offset), 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