]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
strafehud: add vertical angle indicator
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Wed, 18 Jan 2023 15:08:01 +0000 (16:08 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Tue, 4 Apr 2023 17:03:26 +0000 (19:03 +0200)
_hud_common.cfg
qcsrc/client/hud/panel/strafehud.qc
qcsrc/client/hud/panel/strafehud.qh

index 655dae3d5a0a17f6df2a356b8b678ecd0baed774..8428b2443e5276c90dd75e7149cfead5a032de44 100644 (file)
@@ -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 ${* ?}"
index e6f03dfa12b61d5970bec5dd860df4e15e8dbf56..bb4dd0cf62c412c1ed2ae275ed122dcde0906b85 100644 (file)
@@ -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
index ba5ae58f66337caf7fa1b88c7529f9ee4bab2952..7622ea48abca9ae9a52b81db2064505b243a8ae3 100644 (file)
@@ -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);