+
+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;
+}
+