From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Wed, 18 Jan 2023 15:08:01 +0000 (+0100) Subject: strafehud: add vertical angle indicator X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5a21d320a5624bd84a35efda3c44ef3c8e5525fd;p=xonotic%2Fxonotic-data.pk3dir.git strafehud: add vertical angle indicator --- diff --git a/_hud_common.cfg b/_hud_common.cfg index 655dae3d5..8428b2443 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -218,6 +218,9 @@ seta hud_panel_strafehud_sonar_volume_start "0.333333" "sound volume of the stra seta hud_panel_strafehud_sonar_volume_range "0.666666" "dynamic volume range of the strafe sonar as you approach the optimal angle" seta hud_panel_strafehud_sonar_pitch_start "0.9" "playback speed of the strafe sonar" seta hud_panel_strafehud_sonar_pitch_range "0.1" "dynamic playback speed range of the strafe sonar as you approach the optimal angle" +seta hud_panel_strafehud_vangle "0" "set to \"1\" to enable the vertical angle indicator" +seta hud_panel_strafehud_vangle_color "0.75 0.75 0.75" "color of the vertical angle text" +seta hud_panel_strafehud_vangle_size "1" "size of the vertical angle text (relative to the panel height)" // hud panel aliases alias quickmenu "cl_cmd hud quickmenu ${* ?}" diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index e6f03dfa1..bb4dd0cf6 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -1057,6 +1057,24 @@ void HUD_StrafeHUD() text_offset_top = max(angle_offset_top, text_offset_top); text_offset_bottom = max(angle_offset_bottom, text_offset_bottom); + // vertical angle for weapon jumps + { + if(autocvar_hud_panel_strafehud_vangle) + { + float vangle = -PHYS_INPUT_ANGLES(strafeplayer).x; + float vangle_height = autocvar_hud_panel_strafehud_vangle_size * panel_size.y; + string vangle_text = strcat(ftos_decimals(vangle, 2), "°"); + + bool was_drawn = StrafeHUD_drawTextIndicator( + vangle_text, vangle_height, + autocvar_hud_panel_strafehud_vangle_color, 1, + time, text_offset_bottom, STRAFEHUD_TEXT_BOTTOM); + + if(was_drawn) + text_offset_bottom += vangle_height; + } + } + draw_beginBoldFont(); // show speed when crossing the start trigger diff --git a/qcsrc/client/hud/panel/strafehud.qh b/qcsrc/client/hud/panel/strafehud.qh index ba5ae58f6..7622ea48a 100644 --- a/qcsrc/client/hud/panel/strafehud.qh +++ b/qcsrc/client/hud/panel/strafehud.qh @@ -67,6 +67,9 @@ float autocvar_hud_panel_strafehud_sonar_volume_start = 0.333333; float autocvar_hud_panel_strafehud_sonar_volume_range = 0.666666; float autocvar_hud_panel_strafehud_sonar_pitch_start = 0.9; float autocvar_hud_panel_strafehud_sonar_pitch_range = 0.1; +bool autocvar_hud_panel_strafehud_vangle = false; +vector autocvar_hud_panel_strafehud_vangle_color = '0.75 0.75 0.75'; +float autocvar_hud_panel_strafehud_vangle_size = 1; void HUD_Panel_DrawStrafeHUD(float, float, float, vector, float, int, int); vector StrafeHUD_mixColors(vector, vector, float);