From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Mon, 15 Jun 2020 18:39:40 +0000 (+0200) Subject: add strafehud to _hud_panelorder and improve a few strafehud corner cases X-Git-Tag: xonotic-v0.8.5~738^2~64 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2300468c3570ddd359c377a5471937d8edee4bf1;p=xonotic%2Fxonotic-data.pk3dir.git add strafehud to _hud_panelorder and improve a few strafehud corner cases --- diff --git a/hud_luma.cfg b/hud_luma.cfg index dffe9bcc5..64e6aa4aa 100644 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@ -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" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index f075a7f6d..6f1690e5f 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -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" diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index e033be3c2..f120225cd 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -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" diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index d018a2c7f..d9af6235a 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -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" diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index 2e7f9a478..f10fdee64 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -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" diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index 51167db1c..e4b6fdb27 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -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" diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index faf52d762..265418024 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -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;