Merge branch 'bones_was_here/team_selection_compatibility' into 'master'
authorterencehill <piuntn@gmail.com>
Wed, 10 Aug 2022 12:58:00 +0000 (12:58 +0000)
committerterencehill <piuntn@gmail.com>
Wed, 10 Aug 2022 12:58:00 +0000 (12:58 +0000)
Fix team selection for 0.8.5 clients on current servers that use g_balance_teams 0

Closes #2729

See merge request xonotic/xonotic-data.pk3dir!1059

binds-xonotic.cfg
commands.cfg
qcsrc/client/main.qc
qcsrc/server/client.qc

index 8796d8cddc12de8d3f68aac1759bce70855ca81c..2a81e706971d048c3106af270fc5ddbf8ff1eec2 100644 (file)
@@ -57,7 +57,7 @@ bind F1 vyes
 bind F2 vno
 bind F3 spec
 bind F4 ready
-bind F5 scoreboard_team_selection
+bind F5 team_selection_show
 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 "scoreboard_team_selection"
+bind JOY9 team_selection_show
 bind JOY10 "+show_info"
 bind JOY11 "+showscores"
 bind JOY12 "+con_chat_maximize"
index 9dd270012708d06e0a54c45ce635121bbe3ce3f4..28c7e8063e9ca8a9ee8b16c2a8c173b631b2a77d 100644 (file)
@@ -151,9 +151,9 @@ alias scoreboard_columns_help "qc_cmd_cl hud scoreboard_columns_help"
 alias scoreboard_columns_set "qc_cmd_cl hud scoreboard_columns_set ${* ?}"
 
 set _scoreboard_team_selection_available 0 // set to 1 by CSQC
-alias _menu_showteamselect1 "_scoreboard_team_selection 1"
-alias _menu_showteamselect0 "menu_showteamselect"
-alias scoreboard_team_selection "_menu_showteamselect$_scoreboard_team_selection_available"
+alias _team_selection_show1 "_scoreboard_team_selection 1"
+alias _team_selection_show0 menu_showteamselect
+alias team_selection_show "_team_selection_show$_scoreboard_team_selection_available"
 
 // ========================================================
 //  cmd (client-to-server command) - server/command/cmd.qc
index b2825bc825c79cab7e0e9a6ef5fde80e59a78a2e..22f0438f411fd76aa4dda07953d3e09c3f1345ef 100644 (file)
@@ -44,9 +44,6 @@
 
 void CSQC_Init()
 {
-       cvar_set("_scoreboard_team_selection_available", "1");
-       cvar_set("_scoreboard_team_selection", "0"); // in case it has been left set to 1
-
        prvm_language = strzone(cvar_string("prvm_language"));
 
 #ifdef WATERMARK
@@ -103,6 +100,10 @@ void CSQC_Init()
        if(autocvar_cl_lockview)
                cvar_set("cl_lockview", "0");
 
+       if (cvar_type("_scoreboard_team_selection_available") & CVAR_TYPEFLAG_EXISTS)
+               cvar_settemp("_scoreboard_team_selection_available", "1");
+       cvar_set("_scoreboard_team_selection", "0"); // in case it has been left set to 1
+
        gametype = NULL;
 
        postinit = false;
@@ -152,7 +153,6 @@ void CSQC_Init()
 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
 void Shutdown()
 {
-       cvar_set("_scoreboard_team_selection_available", "0");
        WarpZone_Shutdown();
 
        delete(teams);
index cf93e4e7a3dd311875e4a32fe372fadd1aae65ad..e9955b407dfb6c4ef7a5af4452ddf51dbb967291 100644 (file)
@@ -1939,7 +1939,7 @@ bool ShowTeamSelection(entity this)
        if (!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || this.team_selected || (CS(this).wasplayer && autocvar_g_changeteam_banned) || Player_HasRealForcedTeam(this))
                return false;
        if (frametime) // once per frame is more than enough
-               stuffcmd(this, "scoreboard_team_selection\n");
+               stuffcmd(this, "_scoreboard_team_selection 1\n");
        return true;
 }
 void Join(entity this)