From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sun, 18 Jul 2021 17:41:33 +0000 (+0200) Subject: Merge branch master into Juhu/strafehud-fixes X-Git-Tag: xonotic-v0.8.6~136^2~39 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f2d9bf21e6975a88883a287236427f9e485bea34;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch master into Juhu/strafehud-fixes Fix merge conflict caused by GetSpeedUnit call optimization in master --- f2d9bf21e6975a88883a287236427f9e485bea34 diff --cc qcsrc/client/hud/panel/strafehud.qc index 071e8ebfb,2f0df0821..ba1acb5e7 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@@ -840,24 -644,9 +838,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 @@@ -908,24 -697,9 +907,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