]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add strafehud to _hud_panelorder and improve a few strafehud corner cases
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 15 Jun 2020 18:39:40 +0000 (20:39 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 15 Jun 2020 18:39:40 +0000 (20:39 +0200)
hud_luma.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
qcsrc/client/hud/panel/strafehud.qc

index dffe9bcc53b99102e9a283ef59522548ed96b4ab..64e6aa4aa1dd0deb5c02fb4bbbd0790e4bbfb9d2 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.86 0.35 0"
 seta hud_progressbar_vehicles_ammo1_color "0.77 0.67 0"
 seta hud_progressbar_vehicles_ammo2_color "0.86 0.35 0"
 
-seta _hud_panelorder "17 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.005000"
index f075a7f6d76e2f501b1ff468fd50245ac755e389..6f1690e5f3519161e614b1322d5b8d40cb5647f4 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
index e033be3c2aac061157b030e7209a4f4b64a15bd3..f120225cdcb6ee3bfc15835a9fb97d30a17ad396 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 25 15 16 18 23 19 20 21 22 24 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
index d018a2c7f8a09173078db86da42cd01b370806e6..d9af6235addae66f11257b450335969587353173 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 18 23 19 20 21 22 24 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
index 2e7f9a47826347f6d4cb665bf84920be99ea32cc..f10fdee648abd230470b5ad51625455cddfcb962 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 18 23 19 20 21 22 24 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
index 51167db1cba649a62b2716ac0f10070bd372399a..e4b6fdb2718d4b648e172507cf0253f1b262fb5c 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
 seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
 
-seta _hud_panelorder "17 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 18 23 19 20 21 22 24 "
+seta _hud_panelorder "17 25 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 18 23 19 20 21 22 24 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
index faf52d762106841d14e166c79652529c7df91bd2..2654180249dea4e001ca0f008776d5f3e17658db 100644 (file)
@@ -88,11 +88,14 @@ void HUD_StrafeHUD()
         float strafehud_indicator_minspeed         = autocvar_hud_panel_strafehud_indicator_minspeed;
 
         // physics
-        float  strafehud_onground                  = strafehud_islocal ? IS_ONGROUND(strafeplayer) : !(strafeplayer.anim_implicit_state & ANIMIMPLICITSTATE_INAIR);
+        bool   strafehud_onground                  = strafehud_islocal ? IS_ONGROUND(strafeplayer) : !(strafeplayer.anim_implicit_state & ANIMIMPLICITSTATE_INAIR);
+        bool   strafehud_strafekeys;
+        bool   strafehud_iswater                   = strafeplayer.waterlevel >= WATERLEVEL_SWIMMING;
         float  strafehud_speed                     = !autocvar__hud_configure ? vlen(vec2(csqcplayer.velocity)) : 1337; // use local csqcmodel entity for this even when spectating, flickers too much otherwise
-        float  strafehud_maxspeed_crouch_mod       = IS_DUCKED(strafeplayer) ? .5 : 1;
+        float  strafehud_maxspeed_crouch_mod       = IS_DUCKED(strafeplayer) && (!strafehud_iswater || IS_ONGROUND(strafeplayer)) ? .5 : 1;
+        float  strafehud_maxspeed_water_mod        = strafehud_iswater ? .7 : 1; // FIXME: water physics are way more complex than this
         float  strafehud_maxspeed_phys             = strafehud_onground ? PHYS_MAXSPEED(strafeplayer) : PHYS_MAXAIRSPEED(strafeplayer);
-        float  strafehud_maxspeed                  = !autocvar__hud_configure ? (strafehud_maxspeed_phys * strafehud_maxspeed_crouch_mod) : 320;
+        float  strafehud_maxspeed                  = !autocvar__hud_configure ? strafehud_maxspeed_phys * strafehud_maxspeed_crouch_mod * strafehud_maxspeed_water_mod : 320;
         float  strafehud_vel_angle                 = vectoangles(strafeplayer.velocity).y;
         float  strafehud_view_angle                = view_angles.y + 180;
         float  strafehud_angle;
@@ -208,6 +211,8 @@ void HUD_StrafeHUD()
             }
         }
 
+        strafehud_strafekeys = fabs(strafehud_wishangle) == 90;
+
         // determine minimum required angle to display full strafe range
         strafehud_range_minangle = fabs(strafehud_wishangle) % 90; // maximum range is 90 degree
         if(strafehud_range_minangle > 45) // minimum angle range is 45
@@ -232,51 +237,48 @@ void HUD_StrafeHUD()
             strafehud_hudangle = bound(1, fabs(autocvar_hud_panel_strafehud_angle), 360) / 2; // limit HUD range to 360 degrees, higher values don't make sense
         }
 
-        // detect strafe turning
-        if(!autocvar__hud_configure)
+        // detect air strafe turning
+        if(strafehud_onground != strafehud_state_onground)
         {
-            if(strafehud_onground != strafehud_state_onground)
-            {
-                strafehud_state_onground_time = time;
-            }
-            strafehud_state_onground = strafehud_onground;
-            if((fabs(strafehud_wishangle) == 90) != strafehud_state_strafekeys)
-            {
-                strafehud_state_strafekeys_time = time;
-            }
-            strafehud_state_strafekeys = fabs(strafehud_wishangle) == 90;
-            if((strafehud_keys & KEY_FORWARD) || (strafehud_keys & KEY_BACKWARD))
+            strafehud_state_onground_time = time;
+        }
+        strafehud_state_onground = strafehud_onground;
+        if(strafehud_strafekeys != strafehud_state_strafekeys)
+        {
+            strafehud_state_strafekeys_time = time;
+        }
+        strafehud_state_strafekeys = strafehud_strafekeys;
+        if((strafehud_keys & KEY_FORWARD) || (strafehud_keys & KEY_BACKWARD) || strafehud_iswater || autocvar__hud_configure)
+        {
+            strafehud_turn = false;
+        }
+        else if(strafehud_onground)
+        {
+            if((time - strafehud_state_onground_time) >= strafehud_timeout_ground)
             {
                 strafehud_turn = false;
             }
-            else if(strafehud_onground)
-            {
-                if((time - strafehud_state_onground_time) >= strafehud_timeout_ground)
-                {
-                    strafehud_turn = false;
-                }
-            }
-            else // air strafe only
+        }
+        else // air strafe only
+        {
+            if(strafehud_strafekeys)
             {
-                if(fabs(strafehud_wishangle) == 90)
-                {
-                    if((time - strafehud_state_onground_time) >= strafehud_timeout_air)
-                    {
-                        strafehud_turn = true; // CPMA turning
-                        strafehud_turnangle = strafehud_wishangle;
-                    }
-                }
-                else if((time - strafehud_state_strafekeys_time) >= strafehud_timeout_strafe)
+                if(((time - strafehud_state_onground_time) >= strafehud_timeout_air) || (strafehud_keys & KEY_JUMP))
                 {
-                    strafehud_turn = false;
+                    strafehud_turn = true; // CPMA turning
+                    strafehud_turnangle = strafehud_wishangle;
                 }
             }
-            if(strafehud_turn)
+            else if((time - strafehud_state_strafekeys_time) >= strafehud_timeout_strafe)
             {
-                strafehud_maxspeed = PHYS_MAXAIRSTRAFESPEED(strafeplayer); // no crouching here because it doesn't affect air strafing
-                strafehud_wishangle = strafehud_turnangle;
+                strafehud_turn = false;
             }
         }
+        if(strafehud_turn)
+        {
+            strafehud_maxspeed = PHYS_MAXAIRSTRAFESPEED(strafeplayer); // no crouching here because it doesn't affect air strafing
+            strafehud_wishangle = strafehud_turnangle;
+        }
 
         strafehud_indicator_minspeed = strafehud_indicator_minspeed < 0 ? strafehud_maxspeed + .1 : strafehud_indicator_minspeed;