]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix scoreboard UI input handling, implement team selection in the scoreboard (keyboar...
authorterencehill <piuntn@gmail.com>
Fri, 20 May 2022 23:17:21 +0000 (01:17 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 20 May 2022 23:17:21 +0000 (01:17 +0200)
binds-xonotic.cfg
commands.cfg
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/scoreboard.qh
qcsrc/client/main.qc
qcsrc/client/view.qc
qcsrc/menu/xonotic/keybinder.qc
qcsrc/server/command/cmd.qc

index 390354b54ee51295be2f3d8cfbbbcf45f63c531b..8796d8cddc12de8d3f68aac1759bce70855ca81c 100644 (file)
@@ -57,7 +57,7 @@ bind F1 vyes
 bind F2 vno
 bind F3 spec
 bind F4 ready
-bind F5 menu_showteamselect
+bind F5 scoreboard_team_selection
 bind F6 team_auto
 bind F7 menu_showsandboxtools
 bind F8 "quickmenu"
@@ -75,7 +75,7 @@ bind JOY5 "+fire2"
 bind JOY6 "+fire"
 bind JOY7 "+zoom"
 bind JOY8 "dropweapon"
-bind JOY9 "menu_showteamselect"
+bind JOY9 "scoreboard_team_selection"
 bind JOY10 "+show_info"
 bind JOY11 "+showscores"
 bind JOY12 "+con_chat_maximize"
index 1e26673d42055b639a03f40bbc12d9358e842c07..51ba1845e35083d417e506a2a97c95e01f315e4f 100644 (file)
@@ -149,6 +149,7 @@ alias hud_save "qc_cmd_cl hud save ${* ?}"
 alias radar "qc_cmd_cl hud radar ${* ?}"
 alias scoreboard_columns_help "qc_cmd_cl hud scoreboard_columns_help"
 alias scoreboard_columns_set "qc_cmd_cl hud scoreboard_columns_set ${* ?}"
+alias scoreboard_team_selection "_scoreboard_team_selection 1"
 
 
 // ========================================================
index 5169ea5f384d34ae16ea80f3b46da767fae0ed5d..554a05a475259ec38ef52300bcf81649e4f77af2 100644 (file)
@@ -194,7 +194,7 @@ void HUD_InfoMessages()
                                        s = strcat(blinkcolor, _("Teamnumbers are unbalanced!"));
                                        tm = GetTeam(myteam, false);
                                        if (tm && tm.team != NUM_SPECTATOR && tm.team_size == ts_max)
-                                               s = strcat(s, sprintf(_(" Press ^3%s%s to adjust"), getcommandkey(_("team menu"), "menu_showteamselect"), blinkcolor));
+                                               s = strcat(s, sprintf(_(" Press ^3%s%s to adjust"), getcommandkey(_("team selection"), "scoreboard_team_selection"), blinkcolor));
                                        InfoMessage(s);
                                }
                        }
index 50555381edfd86832bddb90b8d0a2ff286fdb6e6..f1a943c04781fafbd2edb7a0c5d7073f408708c6 100644 (file)
@@ -165,6 +165,47 @@ string Label_getInfo(string label, int mode)
        }
        return label;
 }
+
+void HUD_Scoreboard_UI_Disable()
+{
+       scoreboard_showscores = false;
+       scoreboard_ui_enabled = 0;
+       scoreboard_selected_panel = 0;
+       scoreboard_selected_player = NULL;
+       scoreboard_selected_team = NULL;
+       scoreboard_ui_disabled_time = time;
+}
+
+// mode: 0 normal, 1 team selection
+void Scoreboard_UI_Enable(int mode)
+{
+       if (mode == 1)
+       {
+               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;
+               scoreboard_ui_enabled = 2;
+               scoreboard_selected_panel = SB_PANEL_SCOREBOARD;
+       }
+       else
+       {
+               if (scoreboard_ui_enabled == 1)
+                       return;
+               scoreboard_ui_enabled = 1;
+               scoreboard_selected_panel = SB_PANEL_FIRST;
+       }
+       scoreboard_selected_player = NULL;
+       scoreboard_selected_team = NULL;
+       scoreboard_selected_panel_time = time;
+}
+
 int rankings_start_column;
 int rankings_rows = 0;
 int rankings_columns = 0;
@@ -173,6 +214,9 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
 {
        string s;
 
+       if(!scoreboard_ui_enabled)
+               return false;
+
        if(bInputType == 3)
        {
                mousepos.x = nPrimary;
@@ -186,32 +230,13 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
        // at this point bInputType can only be 0 or 1 (key pressed or released)
        bool key_pressed = (bInputType == 0);
 
-       if(scoreboard_ui_enabled)
+       // ESC to exit (TAB-ESC works too)
+       if(nPrimary == K_ESCAPE)
        {
-               // ESC to exit (TAB-ESC works too)
-               if(nPrimary == K_ESCAPE)
-               {
-                       if (!key_pressed)
-                               return true;
-                       scoreboard_showscores = false;
-                       scoreboard_ui_enabled = false;
-                       scoreboard_selected_panel = 0;
-                       scoreboard_selected_player = NULL;
+               if (!key_pressed)
                        return true;
-               }
-       }
-       else //if(!scoreboard_ui_enabled)
-       {
-               // TAB-ESC to enter
-               if(nPrimary == K_ESCAPE && (hudShiftState & S_TAB))
-               {
-                       if (!key_pressed)
-                               return true;
-
-                       scoreboard_ui_enabled = true;
-                       scoreboard_selected_panel = SB_PANEL_SCOREBOARD;
-                       scoreboard_selected_panel_time = time;
-               }
+               HUD_Scoreboard_UI_Disable();
+               return true;
        }
 
        // block any input while a menu dialog is fading
@@ -246,13 +271,13 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
                if(nPrimary == K_TAB) hudShiftState -= (hudShiftState & S_TAB);
        }
 
-       if(!scoreboard_ui_enabled)
-               return false;
-
        if(nPrimary == K_TAB)
        {
                if (!key_pressed)
                        return true;
+               if (scoreboard_ui_enabled == 2)
+                       goto downarrow_action;
+
                ++scoreboard_selected_panel;
                if (scoreboard_selected_panel == SB_PANEL_RANKINGS && !rankings_cnt)
                        ++scoreboard_selected_panel;
@@ -265,56 +290,99 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
        {
                if (!key_pressed)
                        return true;
+               LABEL(downarrow_action);
                if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
                {
-                       entity pl, tm;
-                       entity curr_pl = NULL;
-                       bool scoreboard_selected_player_found = false;
-                       if (!scoreboard_selected_player)
-                               scoreboard_selected_player_found = true;
-
-                       for(tm = teams.sort_next; tm; tm = tm.sort_next)
+                       if (scoreboard_ui_enabled == 2)
                        {
-                               if(tm.team != NUM_SPECTATOR)
-                               for(pl = players.sort_next; pl; pl = pl.sort_next)
+                               entity curr_team = NULL;
+                               bool scoreboard_selected_team_found = false;
+                               if (!scoreboard_selected_team)
+                                       scoreboard_selected_team_found = true;
+
+                               for(entity tm = teams.sort_next; tm; tm = tm.sort_next)
                                {
-                                       if(pl.team != tm.team)
+                                       if(tm.team == NUM_SPECTATOR)
                                                continue;
-                                       curr_pl = pl;
-                                       if (scoreboard_selected_player_found)
-                                               goto ok_done;
-                                       if (scoreboard_selected_player == pl)
-                                               scoreboard_selected_player_found = true;
+                                       curr_team = tm;
+                                       if (scoreboard_selected_team_found)
+                                               goto ok_team;
+                                       if (scoreboard_selected_team == tm)
+                                               scoreboard_selected_team_found = true;
                                }
+                               LABEL(ok_team);
+                               if (curr_team == scoreboard_selected_team) // loop reached the last team
+                                       curr_team = NULL;
+                               scoreboard_selected_team = curr_team;
+                       }
+                       else
+                       {
+                               entity pl, tm;
+                               entity curr_pl = NULL;
+                               bool scoreboard_selected_player_found = false;
+                               if (!scoreboard_selected_player)
+                                       scoreboard_selected_player_found = true;
+
+                               for(tm = teams.sort_next; tm; tm = tm.sort_next)
+                               {
+                                       if(tm.team != NUM_SPECTATOR)
+                                       for(pl = players.sort_next; pl; pl = pl.sort_next)
+                                       {
+                                               if(pl.team != tm.team)
+                                                       continue;
+                                               curr_pl = pl;
+                                               if (scoreboard_selected_player_found)
+                                                       goto ok_done;
+                                               if (scoreboard_selected_player == pl)
+                                                       scoreboard_selected_player_found = true;
+                                       }
+                               }
+                               LABEL(ok_done);
+                               if (curr_pl == scoreboard_selected_player) // loop reached the last player
+                                       curr_pl = NULL;
+                               scoreboard_selected_player = curr_pl;
                        }
-                       LABEL(ok_done);
-                       if (curr_pl == scoreboard_selected_player) // loop reached the last player
-                               curr_pl = NULL;
-                       scoreboard_selected_player = curr_pl;
                }
        }
        else if(nPrimary == K_UPARROW)
        {
                if (!key_pressed)
                        return true;
-               entity prev_pl = NULL;
                if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
                {
-                       entity pl, tm;
-                       for(tm = teams.sort_next; tm; tm = tm.sort_next)
+                       if (scoreboard_ui_enabled == 2)
                        {
-                               if(tm.team != NUM_SPECTATOR)
-                               for(pl = players.sort_next; pl; pl = pl.sort_next)
+                               entity prev_team = NULL;
+                               for(entity tm = teams.sort_next; tm; tm = tm.sort_next)
                                {
-                                       if(pl.team != tm.team)
+                                       if(tm.team == NUM_SPECTATOR)
                                                continue;
-                                       if (pl == scoreboard_selected_player)
-                                               goto ok_done2;
-                                       prev_pl = pl;
+                                       if (tm == scoreboard_selected_team)
+                                               goto ok_team2;
+                                       prev_team = tm;
+                               }
+                               LABEL(ok_team2);
+                               scoreboard_selected_team = prev_team;
+                       }
+                       else
+                       {
+                               entity prev_pl = NULL;
+                               entity pl, tm;
+                               for(tm = teams.sort_next; tm; tm = tm.sort_next)
+                               {
+                                       if(tm.team != NUM_SPECTATOR)
+                                       for(pl = players.sort_next; pl; pl = pl.sort_next)
+                                       {
+                                               if(pl.team != tm.team)
+                                                       continue;
+                                               if (pl == scoreboard_selected_player)
+                                                       goto ok_done2;
+                                               prev_pl = pl;
+                                       }
                                }
+                               LABEL(ok_done2);
+                               scoreboard_selected_player = prev_pl;
                        }
-                       LABEL(ok_done2);
-                       scoreboard_selected_player = prev_pl;
                }
        }
        else if(nPrimary == K_RIGHTARROW)
@@ -337,13 +405,20 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
                        return true;
                if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
                {
-                       if (!scoreboard_selected_player || (hudShiftState & S_SHIFT))
+                       if (scoreboard_ui_enabled == 2)
+                       {
+                               string team_name;
+                               if (!scoreboard_selected_team || (hudShiftState & S_SHIFT))
+                                       team_name = "auto";
+                               else
+                                       team_name = Static_Team_ColorName(scoreboard_selected_team.team);
+                               localcmd(sprintf("cmd selectteam %s; cmd join", team_name));
+                               HUD_Scoreboard_UI_Disable();
+                       }
+                       else if (!scoreboard_selected_player || (hudShiftState & S_SHIFT))
                        {
                                localcmd("join\n");
-                               scoreboard_ui_enabled = false;
-                               scoreboard_showscores = false;
-                               scoreboard_selected_panel = 0;
-                               scoreboard_selected_player = NULL;
+                               HUD_Scoreboard_UI_Disable();
                        }
                        else
                                localcmd(sprintf("spectate %d", scoreboard_selected_player.sv_entnum + 1));
@@ -358,10 +433,7 @@ float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSeconda
                        if (scoreboard_selected_player)
                        {
                                localcmd(sprintf("commandmode tell \"%s^7\"", entcs_GetName(scoreboard_selected_player.sv_entnum)));
-                               scoreboard_ui_enabled = false;
-                               scoreboard_showscores = false;
-                               scoreboard_selected_panel = 0;
-                               scoreboard_selected_player = NULL;
+                               HUD_Scoreboard_UI_Disable();
                        }
                }
        }
@@ -1118,10 +1190,10 @@ void Scoreboard_DrawItem(vector item_pos, vector rgb, entity pl, bool is_self, i
        vector h_pos = item_pos;
        vector h_size = vec2(panel_size.x, hud_fontsize.y * 1.25);
        // alternated rows highlighting
-       if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
+       if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD && scoreboard_ui_enabled == 1)
        {
                if (pl == scoreboard_selected_player)
-                       drawfill(h_pos, h_size, rgb, 0.44, DRAWFLAG_NORMAL);
+                       drawfill(h_pos, h_size, rgb, 0.44 * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
        else if(is_self)
                drawfill(h_pos, h_size, rgb, sbt_highlight_alpha_self, DRAWFLAG_NORMAL);
@@ -1292,13 +1364,13 @@ vector Scoreboard_DrawOthers(vector item_pos, vector rgb, int this_team, entity
                        }
                }
 
-               if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
+               if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD && scoreboard_ui_enabled == 1)
                {
                        if (pl == scoreboard_selected_player)
                        {
                                h_size.x = column_width + hud_fontsize.x * 0.25;
                                h_size.y = hud_fontsize.y;
-                               drawfill(pos - hud_fontsize.x * 0.25 * eX, h_size, rgb, 0.44, DRAWFLAG_NORMAL);
+                               drawfill(pos - hud_fontsize.x * 0.25 * eX, h_size, rgb, 0.44 * panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
                }
 
@@ -1425,8 +1497,13 @@ vector Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size)
 
        if (scoreboard_selected_panel == SB_PANEL_SCOREBOARD)
        {
-               float fade = max(0, (1 - (time - scoreboard_selected_panel_time) * 2));
-               drawfill(scoreboard_selected_hl_pos, scoreboard_selected_hl_size, '1 1 1', fade * 0.3, DRAWFLAG_NORMAL);
+               if (scoreboard_ui_enabled == 1 || (tm && scoreboard_selected_team == tm))
+               {
+                       float _alpha = (scoreboard_ui_enabled == 2) ? 0.2 : 0.3 * max(0, (1 - (time - scoreboard_selected_panel_time) * 2));
+                       _alpha *= panel_fg_alpha;
+                       if (_alpha)
+                               drawfill(scoreboard_selected_hl_pos, scoreboard_selected_hl_size, '1 1 1', _alpha, DRAWFLAG_NORMAL);
+               }
        }
 
        panel_size.x += panel_bg_padding * 2; // restore initial width
@@ -2118,72 +2195,86 @@ void Scoreboard_Draw()
 
        // Game Info: Game Type
        str = MapInfo_Type_ToText(gametype);
+       if (scoreboard_ui_enabled == 2)
+       {
+               if (scoreboard_selected_team)
+                       str = sprintf(_("^7Press ^3%s ^7to join the selected team"), getcommandkey(_("jump"), "+jump"));
+               else
+                       str = sprintf(_("^7Press ^3%s ^7to join 'best' team (auto-select)"), getcommandkey(_("jump"), "+jump"));
+       }
        draw_beginBoldFont();
        drawcolorcodedstring(pos + '0.5 0 0' * (panel_size.x - stringwidth(str, true, sb_gameinfo_type_fontsize)), str, sb_gameinfo_type_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
        draw_endBoldFont();
 
+       pos.y += sb_gameinfo_type_fontsize.y;
        // Game Info: Game Detail
-       float tl = STAT(TIMELIMIT);
-       float fl = STAT(FRAGLIMIT);
-       float ll = STAT(LEADLIMIT);
-       float ll_and_fl = STAT(LEADLIMIT_AND_FRAGLIMIT);
-       str = "";
-       if(tl > 0)
-               str = strcat(str, sprintf(_("^3%1.0f minutes"), tl));
-       if(!gametype.m_hidelimits)
-       {
-               if(fl > 0)
-               {
-                       if(tl > 0)
-                               str = strcat(str, "^7 / "); // delimiter
-                       if(teamplay)
-                       {
-                               str = strcat(str, sprintf(_("^5%s %s"), ScoreString(teamscores_flags(ts_primary), fl),
-                                       (teamscores_label(ts_primary) == "score")   ? CTX(_("SCO^points")) :
-                                       (teamscores_label(ts_primary) == "fastest") ? "" :
-                                       TranslateScoresLabel(teamscores_label(ts_primary))));
-                       }
-                       else
-                       {
-                               str = strcat(str, sprintf(_("^5%s %s"), ScoreString(scores_flags(ps_primary), fl),
-                                       (scores_label(ps_primary) == "score")   ? CTX(_("SCO^points")) :
-                                       (scores_label(ps_primary) == "fastest") ? "" :
-                                       TranslateScoresLabel(scores_label(ps_primary))));
-                       }
-               }
-               if(ll > 0)
+       if (scoreboard_ui_enabled == 2)
+       {
+               str = sprintf(_("^7Press ^3%s ^7to select a specific team"), translate_key("TAB"));
+               drawcolorcodedstring(pos + '0.5 0 0' * (panel_size.x - stringwidth(str, true, sb_gameinfo_detail_fontsize)), str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+       }
+       else
+       {
+               float tl = STAT(TIMELIMIT);
+               float fl = STAT(FRAGLIMIT);
+               float ll = STAT(LEADLIMIT);
+               float ll_and_fl = STAT(LEADLIMIT_AND_FRAGLIMIT);
+               str = "";
+               if(tl > 0)
+                       str = strcat(str, sprintf(_("^3%1.0f minutes"), tl));
+               if(!gametype.m_hidelimits)
                {
-                       if(tl > 0 || fl > 0)
+                       if(fl > 0)
                        {
-                               // delimiter
-                               if (ll_and_fl && fl > 0)
-                                       str = strcat(str, "^7 & ");
+                               if(tl > 0)
+                                       str = strcat(str, "^7 / "); // delimiter
+                               if(teamplay)
+                               {
+                                       str = strcat(str, sprintf(_("^5%s %s"), ScoreString(teamscores_flags(ts_primary), fl),
+                                               (teamscores_label(ts_primary) == "score")   ? CTX(_("SCO^points")) :
+                                               (teamscores_label(ts_primary) == "fastest") ? "" :
+                                               TranslateScoresLabel(teamscores_label(ts_primary))));
+                               }
                                else
-                                       str = strcat(str, "^7 / ");
+                               {
+                                       str = strcat(str, sprintf(_("^5%s %s"), ScoreString(scores_flags(ps_primary), fl),
+                                               (scores_label(ps_primary) == "score")   ? CTX(_("SCO^points")) :
+                                               (scores_label(ps_primary) == "fastest") ? "" :
+                                               TranslateScoresLabel(scores_label(ps_primary))));
+                               }
                        }
-
-                       if(teamplay)
+                       if(ll > 0)
                        {
-                               str = strcat(str, sprintf(_("^2+%s %s"), ScoreString(teamscores_flags(ts_primary), ll),
-                                       (teamscores_label(ts_primary) == "score")   ? CTX(_("SCO^points")) :
-                                       (teamscores_label(ts_primary) == "fastest") ? "" :
-                                       TranslateScoresLabel(teamscores_label(ts_primary))));
-                       }
-                       else
-                       {
-                               str = strcat(str, sprintf(_("^2+%s %s"), ScoreString(scores_flags(ps_primary), ll),
-                                       (scores_label(ps_primary) == "score")   ? CTX(_("SCO^points")) :
-                                       (scores_label(ps_primary) == "fastest") ? "" :
-                                       TranslateScoresLabel(scores_label(ps_primary))));
+                               if(tl > 0 || fl > 0)
+                               {
+                                       // delimiter
+                                       if (ll_and_fl && fl > 0)
+                                               str = strcat(str, "^7 & ");
+                                       else
+                                               str = strcat(str, "^7 / ");
+                               }
+
+                               if(teamplay)
+                               {
+                                       str = strcat(str, sprintf(_("^2+%s %s"), ScoreString(teamscores_flags(ts_primary), ll),
+                                               (teamscores_label(ts_primary) == "score")   ? CTX(_("SCO^points")) :
+                                               (teamscores_label(ts_primary) == "fastest") ? "" :
+                                               TranslateScoresLabel(teamscores_label(ts_primary))));
+                               }
+                               else
+                               {
+                                       str = strcat(str, sprintf(_("^2+%s %s"), ScoreString(scores_flags(ps_primary), ll),
+                                               (scores_label(ps_primary) == "score")   ? CTX(_("SCO^points")) :
+                                               (scores_label(ps_primary) == "fastest") ? "" :
+                                               TranslateScoresLabel(scores_label(ps_primary))));
+                               }
                        }
                }
+               drawcolorcodedstring(pos + '1 0 0' * (panel_size.x - stringwidth(str, true, sb_gameinfo_detail_fontsize)), str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); // align right
+               // map name
+               str = sprintf(_("^7Map: ^2%s"), shortmapname);
+               drawcolorcodedstring(pos, str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); // align left
        }
-
-       pos.y += sb_gameinfo_type_fontsize.y;
-       drawcolorcodedstring(pos + '1 0 0' * (panel_size.x - stringwidth(str, true, sb_gameinfo_detail_fontsize)), str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); // align right
-       // map name
-       str = sprintf(_("^7Map: ^2%s"), shortmapname);
-       drawcolorcodedstring(pos, str, sb_gameinfo_detail_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); // align left
        // End of Game Info Section
 
        pos.y += sb_gameinfo_detail_fontsize.y + hud_fontsize.y * 0.3; // space between Game Info Section and score table
index 2b43dcfa3a2162ec78a3aa5fb511a72378c9476e..8e01c6a66998a91c38ff193b9c3462a56e20147c 100644 (file)
@@ -23,15 +23,20 @@ void Scoreboard_UpdatePlayerTeams();
 void Scoreboard_UpdatePlayerPos(entity pl);
 void Scoreboard_UpdateTeamPos(entity Team);
 bool Scoreboard_WouldDraw();
+void Scoreboard_UI_Enable(int mode);
 
-bool scoreboard_ui_enabled;
+int scoreboard_ui_enabled;
+float scoreboard_ui_disabled_time;
+bool autocvar__scoreboard_team_selection;
 float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSecondary);
 
 int scoreboard_selected_panel;
 float scoreboard_selected_panel_time;
 entity scoreboard_selected_player;
+entity scoreboard_selected_team;
 
 // start from 1
+int SB_PANEL_FIRST = 1;
 int SB_PANEL_SCOREBOARD = 1;
 int SB_PANEL_RANKINGS = 2;
 int SB_PANEL_MAX = 2;
index bf34cce82f644cb251b2db76cb7350af88a016d7..0e5b4b5e10c95484450aff83d56ccdf9976452dd 100644 (file)
@@ -486,15 +486,23 @@ float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary)
                if(nPrimary == K_ALT) hudShiftState |= S_ALT;
                if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
                if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
+               if(nPrimary == K_TAB) hudShiftState |= S_TAB;
        }
        else {
                if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
                if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
                if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
+               if(nPrimary == K_TAB) hudShiftState -= (hudShiftState & S_TAB);
        }
 
+       // NOTE: Shift-Escape must be filtered out because it's the hardcoded console shortcut
        if (nPrimary == K_ESCAPE && !(hudShiftState & S_SHIFT) && key_pressed)
        {
+               if (hudShiftState & S_TAB)
+               {
+                       Scoreboard_UI_Enable(0);
+                       return true;
+               }
                if (!isdemo() && cvar("_menu_gamemenu_dialog_available"))
                {
                        localcmd("\nmenu_showgamemenudialog\n");
index 855d20f818fbf7d04028cd255ec5067f42ab25f8..cd36c1000ecd1fb46d00a1856120384778da70c9 100644 (file)
@@ -1705,6 +1705,11 @@ void CSQC_UpdateView(entity this, float w, float h)
        Debug_Draw();
 #endif
 
+       if (autocvar__scoreboard_team_selection)
+       {
+               Scoreboard_UI_Enable(1);
+               cvar_set("_scoreboard_team_selection", "0");
+       }
        scoreboard_active = Scoreboard_WouldDraw();
 
        HUD_Draw(this); // this parameter for deep vehicle function
index c76af8ceed148338342b68afcef70798071d3768..abaac730949ea2238a4ddbcfb55e2b2910017edb 100644 (file)
@@ -111,7 +111,7 @@ void KeyBinds_BuildList()
 
        KEYBIND_HEADER(_("Teamplay"));
        KEYBIND_DEF("team_auto"                             , _("auto-join team"));
-       KEYBIND_DEF("menu_showteamselect"                   , _("team menu"));
+       KEYBIND_DEF("scoreboard_team_selection"             , _("team selection"));
        KEYBIND_DEF("spec"                                  , _("spectate"));
        KEYBIND_EMPTY_LINE();
 
index 9feb068a812bdd377f7bf9a6822cdf0217a52104..0ffd87e866480ecfc097f5fb1c272eb1dba3ba8a 100644 (file)
@@ -114,7 +114,7 @@ void ClientCommand_clientversion(entity caller, int request, int argc)  // inter
                                        else if (teamplay && !autocvar_sv_spectate && !(Player_GetForcedTeamIndex(caller) > 0))
                                        {
                                                TRANSMUTE(Observer, caller);  // really?
-                                               stuffcmd(caller, "menu_showteamselect\n");
+                                               stuffcmd(caller, "scoreboard_team_selection\n");
                                        }
                                }