From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Thu, 18 Mar 2021 14:02:37 +0000 (+0100) Subject: strafehud: add angle indicator styles and arrows X-Git-Tag: xonotic-v0.8.6~136^2~64 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=009c0438b7b916c93194912ba6ff4429f83074c7;p=xonotic%2Fxonotic-data.pk3dir.git strafehud: add angle indicator styles and arrows --- diff --git a/_hud_common.cfg b/_hud_common.cfg index a62837f5f..e99fb5234 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -145,12 +145,17 @@ seta hud_panel_strafehud_bar_accel_color "0 1 0" "color of the strafe meter acce seta hud_panel_strafehud_bar_accel_alpha "0.3" "opacity of the strafe meter acceleration zone" seta hud_panel_strafehud_bar_overturn_color "1 0 1" "color of the strafe meter overturn zone" seta hud_panel_strafehud_bar_overturn_alpha "0.3" "opacity of the strafe meter overturn zone" +seta hud_panel_strafehud_angle_style "2" "set the angle indicator style: 0 = solid line, 1 = dashed line, 2 = none" +seta hud_panel_strafehud_angle_dashes "4" "determines the amount of dashes if the angle indicator uses a dashed line" seta hud_panel_strafehud_angle_alpha "0.8" "opacity of the indicator showing the player's current angle" seta hud_panel_strafehud_angle_height "1.5" "height of the indicator showing the player's current angle (relative to the panel height)" seta hud_panel_strafehud_angle_width "0.005" "width of the indicator showing the player's current angle (relative to the panel width)" seta hud_panel_strafehud_angle_neutral_color "1 1 0" "color of the indicator showing the player's current angle if the player's angle is within the neutral zone" seta hud_panel_strafehud_angle_accel_color "0 1 1" "color of the indicator showing the player's current angle if the player's angle is within the acceleration zone" seta hud_panel_strafehud_angle_overturn_color "1 0 1" "color of the indicator showing the player's current angle if the player's angle is within the overturn zone" +seta hud_panel_strafehud_angle_arrow "1" "set the angle indicators arrow style: 0 = none, 1 = top, 2 = bottom, 3 = both" +seta hud_panel_strafehud_angle_arrow_height "0.5" "height of the arrow (relative to the panel height)" +seta hud_panel_strafehud_angle_arrow_width "0.03" "width of the arrow (relative to the panel width)" seta hud_panel_strafehud_switch_minspeed "-1" "minimum speed in qu/s at which switch indicators which are used to aid changing strafe direction will be shown (uses physics maxspeed + antiflicker speed if negative)" seta hud_panel_strafehud_switch_active_color "0 1 0" "color of the switch indicator on the current side" seta hud_panel_strafehud_switch_active_alpha "1" "opacity of the switch indicator on the current side" diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index ea391a40a..b22699cfb 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -794,7 +794,40 @@ void HUD_StrafeHUD() if(currentangle_size.x > 0 && currentangle_size.y > 0 && autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha > 0) { - drawfill(panel_pos - eY * ((currentangle_size.y - panel_size.y) / 2) + eX * (currentangle_offset - currentangle_size.x/2), currentangle_size, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + switch(autocvar_hud_panel_strafehud_angle_style) + { + case 0: + drawfill(panel_pos - eY * ((currentangle_size.y - panel_size.y) / 2) + eX * (currentangle_offset - currentangle_size.x/2), currentangle_size, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + break; + case 1: + vector line_size = currentangle_size; + line_size.y = currentangle_size.y / (bound(2, autocvar_hud_panel_strafehud_angle_dashes, 100)*2-1); + for(float i = 0; i < currentangle_size.y; i += line_size.y*2) + { + if(i + line_size.y*2 >= currentangle_size.y) line_size.y = currentangle_size.y - i; + drawfill(panel_pos - eY * ((currentangle_size.y - panel_size.y) / 2 - i) + eX * (currentangle_offset - line_size.x/2), line_size, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + } + break; + case 2: + default: + } + + if(autocvar_hud_panel_strafehud_angle_arrow > 0) + { + vector arrow_size = currentangle_size; + arrow_size.x = max(panel_size.x * autocvar_hud_panel_strafehud_angle_arrow_width, 1); + arrow_size.y = max(panel_size.y * min(autocvar_hud_panel_strafehud_angle_arrow_height, 1), 1); + vector arrow_fragment = '0 0.25 0'; + + for(float i = arrow_size.y; i > 0; i -= arrow_fragment.y) + { + arrow_fragment.x = arrow_size.x * (i/arrow_size.y); + if(autocvar_hud_panel_strafehud_angle_arrow == 1 || autocvar_hud_panel_strafehud_angle_arrow >= 3) + drawfill(panel_pos - eY * ((currentangle_size.y - panel_size.y) / 2 + i) + eX * (currentangle_offset - arrow_fragment.x/2), arrow_fragment, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + if(autocvar_hud_panel_strafehud_angle_arrow >= 2) + drawfill(panel_pos + eY * (-(currentangle_size.y - panel_size.y) / 2 + currentangle_size.y + i - arrow_fragment.y) + eX * (currentangle_offset - arrow_fragment.x/2), arrow_fragment, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + } + } } } } diff --git a/qcsrc/client/hud/panel/strafehud.qh b/qcsrc/client/hud/panel/strafehud.qh index 2fbd9b275..643477e59 100644 --- a/qcsrc/client/hud/panel/strafehud.qh +++ b/qcsrc/client/hud/panel/strafehud.qh @@ -15,12 +15,17 @@ vector autocvar_hud_panel_strafehud_bar_accel_color = '0 1 0'; float autocvar_hud_panel_strafehud_bar_accel_alpha = 0.3; vector autocvar_hud_panel_strafehud_bar_overturn_color = '1 0 1'; float autocvar_hud_panel_strafehud_bar_overturn_alpha = 0.3; +int autocvar_hud_panel_strafehud_angle_style = 2; +int autocvar_hud_panel_strafehud_angle_dashes = 4; float autocvar_hud_panel_strafehud_angle_alpha = 0.8; float autocvar_hud_panel_strafehud_angle_height = 1.5; float autocvar_hud_panel_strafehud_angle_width = 0.005; vector autocvar_hud_panel_strafehud_angle_neutral_color = '1 1 0'; vector autocvar_hud_panel_strafehud_angle_accel_color = '0 1 1'; vector autocvar_hud_panel_strafehud_angle_overturn_color = '1 0 1'; +int autocvar_hud_panel_strafehud_angle_arrow = 1; +float autocvar_hud_panel_strafehud_angle_arrow_height = 0.5; +float autocvar_hud_panel_strafehud_angle_arrow_width = 0.03; float autocvar_hud_panel_strafehud_switch_minspeed = -1; vector autocvar_hud_panel_strafehud_switch_active_color = '0 1 0'; float autocvar_hud_panel_strafehud_switch_active_alpha = 1;