]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
CA: stop the countdown immediately if one team is empty, old behaviour wasn't good...
authorterencehill <piuntn@gmail.com>
Thu, 5 Jan 2012 22:41:58 +0000 (23:41 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 5 Jan 2012 22:41:58 +0000 (23:41 +0100)
qcsrc/server/arena.qc
qcsrc/server/cl_player.qc

index 4f3150258e3c8e0c711b887c7166d0f2bad32760..f66ddb2cef7f4a791a646d8fd489224f1d5cde57 100644 (file)
@@ -9,7 +9,6 @@ entity spawnqueue_first;
 entity spawnqueue_last;
 entity champion;
 float warmup;
-float ca_teams_ok;
 .float caplayer;
 
 void PutObserverInServer();
@@ -215,8 +214,6 @@ void Arena_Warmup()
 
        if(inWarmupStage)
                allowed_to_spawn = 1;
-       if(g_ca && !ca_teams_ok)
-               allowed_to_spawn = 1;
 
        if(time < warmup && !inWarmupStage)
        {
@@ -230,17 +227,23 @@ void Arena_Warmup()
 
                if(f != roundStartTime_prev) {
                        roundStartTime_prev = f;
-                       if(f == 5)
-                               Announce("prepareforbattle");
-                       else if(f == 3)
-                               Announce("3");
-                       else if(f == 2)
-                               Announce("2");
-                       else if(f == 1)
-                               Announce("1");
-
-                       FOR_EACH_PLAYER(e)
-                               Send_CSQC_Centerprint_Generic(e, CPID_ROUND_STARTING, "Round will start in %d", 1, f);
+                       if(g_ca && !(red_players && blue_players)) {
+                               FOR_EACH_PLAYER(self)
+                                       Send_CSQC_Centerprint_Generic(self, CPID_ROUND_STARTING, "^1Need at least 1 player in each team to play CA", 2, 0);
+                               warmup = time + autocvar_g_ca_warmup;
+                       } else {
+                               if(f == 5)
+                                       Announce("prepareforbattle");
+                               else if(f == 3)
+                                       Announce("3");
+                               else if(f == 2)
+                                       Announce("2");
+                               else if(f == 1)
+                                       Announce("1");
+
+                               FOR_EACH_PLAYER(e)
+                                       Send_CSQC_Centerprint_Generic(e, CPID_ROUND_STARTING, "Round will start in %d", 1, f);
+                       }
                }
 
                if (g_arena) {
@@ -257,12 +260,16 @@ void Arena_Warmup()
        else if(f > -1 && f != roundStartTime_prev)
        {
                roundStartTime_prev = f;
-               Announce("begin");
-               FOR_EACH_PLAYER(e)
-                       Send_CSQC_Centerprint_Generic(e, CPID_ROUND_STARTING, "^1Begin!", 1, 0);
-
-               if(g_ca)
-                       ca_teams_ok = (red_players && blue_players); // teams are ok if there's at least 1 player in each team
+               if(g_ca) {
+                       if(red_players && blue_players)
+                               allowed_to_spawn = 0;
+                       else
+                               reset_map(TRUE);
+               } else {
+                       Announce("begin");
+                       FOR_EACH_PLAYER(e)
+                               Send_CSQC_Centerprint_Generic(e, CPID_ROUND_STARTING, "^1Begin!", 1, 0);
+               }
 
                if(g_arena) {
                        FOR_EACH_PLAYER(e)
@@ -370,26 +377,15 @@ void count_alive_players()
  *
  * Gets called in StartFrame()
  */
-float warntime;
 void Spawnqueue_Check()
 {
        if(time < warmup + 1 || inWarmupStage || intermission_running)
                return;
 
        if(g_ca) {
-               if(!ca_teams_ok && (red_players && blue_players)) {
-                       reset_map(TRUE);
-               }
-               else if(!ca_teams_ok) {
-                       if (time > warntime)
-                       {
-                               FOR_EACH_PLAYER(self)
-                                       Send_CSQC_Centerprint_Generic(self, CPID_ROUND_STARTING, "^1Need at least 1 player in each team to play CA", 2, 0);
-                               warntime = time + 1;
-                       }
+               if(allowed_to_spawn) // round is not started yet
                        return;
-               }
-               else if(!next_round) {
+               if(!next_round) {
                        if(!(redalive && bluealive)) {
                                // every player of (at least) one team is dead, round ends here
                                if(redalive) {
index 04ad12c6ef66b0a8685b8e55ef277b0fe19e9c6a..1387f02dcd64b89dbd73fbb1ab56f4512d74e1dc 100644 (file)
@@ -432,7 +432,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        float valid_damage_for_weaponstats;
        float excess;
 
-       if((g_arena && numspawned < 2) || (g_ca && !ca_teams_ok) && !inWarmupStage)
+       if((g_arena && numspawned < 2) || (g_ca && allowed_to_spawn) && !inWarmupStage)
                return;
 
        dh = max(self.health, 0);