]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/scoreboard.qc
Scoreboard UI and team selection: add SHIFT+TAB shortcuts to reverse cycling
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / scoreboard.qc
index a2921ac9809b8e1134332d08c419da27c8d1ef44..1d9268a03734508c71ec718fb57f63fb5cbb2a28 100644 (file)
@@ -173,7 +173,6 @@ void HUD_Scoreboard_UI_Disable()
        scoreboard_selected_panel = 0;
        scoreboard_selected_player = NULL;
        scoreboard_selected_team = NULL;
-       scoreboard_ui_disabled_time = time;
 }
 
 // mode: 0 normal, 1 team selection
@@ -183,14 +182,11 @@ void Scoreboard_UI_Enable(int mode)
        {
                if (scoreboard_ui_enabled == 2 || !teamplay)
                        return;
-               // Do not allow reopening the team selection for some time after it has been closed.
-               // It works around a bug caused by the server sending scoreboard_team_selection every frame
-               // until client selects a team and joins: scoreboard_team_selection gets executed even
-               // after client already joined
-               // For the record, with the menu dialog this workaround is not needed because it takes
-               // some time to fade away
-               if (time < scoreboard_ui_disabled_time + 0.5)
-                       return;
+
+               // release player's pressed keys as they aren't released elsewhere
+               // in particular jump needs to be released as it may open the team selection
+               // (when server detects jump has been pressed it sends the command to open the team selection)
+               Release_Common_Keys();
                scoreboard_ui_enabled = 2;
                scoreboard_selected_panel = SB_PANEL_SCOREBOARD;
        }
@@ -276,13 +272,29 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
                if (!key_pressed)
                        return true;
                if (scoreboard_ui_enabled == 2)
-                       goto downarrow_action;
+               {
+                       if (hudShiftState & S_SHIFT)
+                               goto uparrow_action;
+                       else
+                               goto downarrow_action;
+               }
 
-               ++scoreboard_selected_panel;
-               if (scoreboard_selected_panel == SB_PANEL_RANKINGS && !rankings_cnt)
+               if (hudShiftState & S_SHIFT)
+               {
+                       --scoreboard_selected_panel;
+                       if (scoreboard_selected_panel == SB_PANEL_RANKINGS && !rankings_cnt)
+                               --scoreboard_selected_panel;
+                       if (scoreboard_selected_panel < SB_PANEL_FIRST)
+                               scoreboard_selected_panel = SB_PANEL_MAX;
+               }
+               else
+               {
                        ++scoreboard_selected_panel;
-               if (scoreboard_selected_panel >= SB_PANEL_MAX)
-                       scoreboard_selected_panel = 1;
+                       if (scoreboard_selected_panel == SB_PANEL_RANKINGS && !rankings_cnt)
+                               ++scoreboard_selected_panel;
+                       if (scoreboard_selected_panel > SB_PANEL_MAX)
+                               scoreboard_selected_panel = SB_PANEL_FIRST;
+               }
 
                scoreboard_selected_panel_time = time;
        }
@@ -348,6 +360,7 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
        {
                if (!key_pressed)
                        return true;
+               LABEL(uparrow_action);
                if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
                {
                        if (scoreboard_ui_enabled == 2)