]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch master into Juhu/strafehud-fixes
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sun, 18 Jul 2021 17:41:33 +0000 (19:41 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sun, 18 Jul 2021 17:41:33 +0000 (19:41 +0200)
Fix merge conflict caused by GetSpeedUnit call optimization in master

1  2 
_hud_common.cfg
qcsrc/client/hud/panel/strafehud.qc

diff --cc _hud_common.cfg
Simple merge
index 071e8ebfb4e670dda546eb6b16aa1c3489c98edb,2f0df08213ec3c599888571f4063b77fe99185a8..ba1acb5e7c641be1f7ee474976bd075a97e3d5dd
@@@ -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
              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