TDM: g_tdm_team_spawns
authordiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Fri, 30 Oct 2009 19:24:12 +0000 (19:24 +0000)
committerdiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Fri, 30 Oct 2009 19:24:12 +0000 (19:24 +0000)
git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8193 f962a42d-fe04-0410-a3ab-8c8b0445ebaa

data/defaultNexuiz.cfg
data/qcsrc/server/cl_client.qc
data/qcsrc/server/defs.qh
data/qcsrc/server/g_world.qc
data/qcsrc/server/miscfunctions.qc
data/qcsrc/server/teamplay.qc

index 96355f7..ba89e9c 100644 (file)
@@ -555,6 +555,7 @@ seta g_balance_teams_force 0        "automatically balance out teams when players move
 seta g_balance_teams_prevent_imbalance 0       "prevent players from changing to larger teams"
 set g_tdm_teams 2 "how many teams are in team deathmatch (set by mapinfo)"
 seta g_tdm_teams_override 0    "how many teams are in team deathmatch"
+set g_tdm_team_spawns 0 "when 1, a map can define team spawnpoints for TDM"
 set g_changeteam_banned 0      "not allowed to change team"
 set g_changeteam_fragtransfer 0        "% of frags you get to keep when you change teams (rounded down)"
 
index 0e26be8..f7c4273 100644 (file)
@@ -92,7 +92,7 @@ void spawnfunc_info_player_deathmatch (void)
 void spawnpoint_use()
 {
        if(teams_matter)
-       if(have_team_spawns)
+       if(have_team_spawns > 0)
        {
                self.team = activator.team;
                some_spawn_has_been_used = 1;
@@ -293,7 +293,7 @@ entity SelectSpawnPoint (float anypoint)
 
        teamcheck = 0;
 
-       if(!anypoint && have_team_spawns)
+       if(!anypoint && have_team_spawns > 0)
                teamcheck = self.team;
 
        // get the list of players
index 59b60a6..4a937a9 100644 (file)
@@ -418,7 +418,7 @@ float TemporaryDB;
 .float team_saved;
 
 float some_spawn_has_been_used;
-float have_team_spawns;
+float have_team_spawns; // 0 = no team spawns requested, -1 = team spawns requested but none found, 1 = team spawns requested and found
 
 // set when showing a kill countdown
 .entity killindicator;
index b46a082..7c4bc39 100644 (file)
@@ -1776,7 +1776,7 @@ float WinningCondition_RanOutOfSpawns()
 {
        entity head;
 
-       if(!have_team_spawns)
+       if(have_team_spawns <= 0)
                return WINNING_NO;
 
        if(!some_spawn_has_been_used)
index a89c158..18b25e6 100644 (file)
@@ -263,7 +263,7 @@ void relocate_spawnpoint()
     if (!self.cnt)
         self.cnt = 1;
 
-    if (g_ctf || g_assault || g_onslaught || g_domination || g_nexball)
+    if (have_team_spawns != 0)
         if (self.team)
             have_team_spawns = 1;
 
index 85efb48..387a6b2 100644 (file)
@@ -219,6 +219,8 @@ void InitGameplayMode()
                gamemode_name = "Team Deathmatch";
                ActivateTeamplay();
                tdm_init();
+               if(cvar("g_tdm_team_spawns"))
+                       have_team_spawns = -1; // request team spawns
        }
 
        if(g_domination)
@@ -229,6 +231,7 @@ void InitGameplayMode()
                fraglimit_override = cvar("g_domination_point_limit");
                leadlimit_override = cvar("g_domination_point_leadlimit");
                dom_init();
+               have_team_spawns = -1; // request team spawns
        }
 
        if(g_ctf)
@@ -252,6 +255,7 @@ void InitGameplayMode()
                        leadlimit_override = cvar("captureleadlimit_override");
                }
                ctf_init();
+               have_team_spawns = -1; // request team spawns
        }
 
        if(g_runematch)
@@ -306,6 +310,7 @@ void InitGameplayMode()
                gamemode_name = "Assault";
                ActivateTeamplay();
                ScoreRules_assault();
+               have_team_spawns = -1; // request team spawns
        }
 
        if(g_onslaught)
@@ -313,6 +318,7 @@ void InitGameplayMode()
                game = GAME_ONSLAUGHT;
                gamemode_name = "Onslaught";
                ActivateTeamplay();
+               have_team_spawns = -1; // request team spawns
        }
 
        if(g_race)
@@ -324,6 +330,7 @@ void InitGameplayMode()
                {
                        ActivateTeamplay();
                        race_teams = bound(2, cvar("g_race_teams"), 4);
+                       have_team_spawns = -1; // request team spawns
                }
                else
                        race_teams = 0;
@@ -350,6 +357,7 @@ void InitGameplayMode()
                leadlimit_override = cvar("g_nexball_goalleadlimit");
                ActivateTeamplay();
                nb_init();
+               have_team_spawns = -1; // request team spawns
        }
 
        if(teams_matter)