]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/arena_stuff
authorterencehill <piuntn@gmail.com>
Sat, 20 Aug 2011 16:08:09 +0000 (18:08 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 20 Aug 2011 16:08:09 +0000 (18:08 +0200)
Conflicts:
qcsrc/server/arena.qc

1  2 
qcsrc/server/arena.qc
qcsrc/server/cl_player.qc
qcsrc/server/mutators/gamemode_freezetag.qc

index 09db36618aeae5934dffe40dcf4eb29263632b2e,587b1ec54cef0cac9c4be7447d1961d89c67a974..c89c2b2efada451a84b1990255d437641088195b
@@@ -8,9 -8,9 +8,8 @@@ float arena_roundbased
  entity spawnqueue_first;
  entity spawnqueue_last;
  entity champion;
- string champion_name;
  float warmup;
 -float ca_players;
 -float required_ca_players;
 +float ca_teams_ok;
  .float caplayer;
  
  void PutObserverInServer();
@@@ -217,10 -214,9 +213,9 @@@ void Arena_Warmup(
  
        if(inWarmupStage)
                allowed_to_spawn = 1;
 -      if(ca_players < required_ca_players)
 +      if(g_ca && !ca_teams_ok)
                allowed_to_spawn = 1;
  
-       msg = NEWLINES;
        if(time < warmup && !inWarmupStage)
        {
                if (g_ca)
        {
                roundStartTime_prev = f;
                Announce("begin");
-               centerprint(self, "^1Begin!\n");
+               FOR_EACH_PLAYER(e)
+                       Send_CSQC_Centerprint_Generic(e, CPID_ROUND_STARTING, "^1Begin!", 1, 0);
  
                if(g_ca) {
 -                      ca_players = 0;
 +                      float start_red_ca_players, start_blue_ca_players;
  
 -            FOR_EACH_PLAYER(e)
 -                              ca_players += 1;
 +                      FOR_EACH_PLAYER(e) {
 +                              if (e.team == COLOR_TEAM1)
 +                                      start_red_ca_players += 1;
 +                              else if (e.team == COLOR_TEAM2)
 +                                      start_blue_ca_players += 1;
 +                      }
 +                      // teams are ok if there's at least 1 player in each team
 +                      ca_teams_ok = (start_red_ca_players && start_blue_ca_players);
                }
  
          if(self.classname == "player" && self.health > 0 && self.movetype == MOVETYPE_NONE)
              self.movetype = MOVETYPE_WALK;
        }
+       // clear champion to avoid centerprinting again the champion msg
+       if (champion)
+               champion = world;
  }
  
 -void count_spawned_players()
 +void count_players()
  {
 -      // TODO fix "*spawned" name, it should rather be "*players" or so
 -      // not doing this now to prevent merge hell with Tag
 -      // fix after merging with Tag
 -
        // count amount of players in each team
 -      totalspawned = redspawned = bluespawned = yellowspawned = pinkspawned = 0;
 +      total_players = red_players = blue_players = yellow_players = pink_players = 0;
        FOR_EACH_PLAYER(self) {
                if (self.team == COLOR_TEAM1)
                {
@@@ -372,9 -371,10 +372,10 @@@ void count_alive_players(
   *
   * Gets called in StartFrame()
   */
+ float warntime;
  void Spawnqueue_Check()
  {
 -      count_spawned_players();
 +      count_players();
        if(g_ca || g_freezetag) // we want to perform this before the return block below (CA)...
        {
                count_alive_players();
                return;
  
        if(g_ca) {
 -              required_ca_players = max(2, fabs(autocvar_bot_vs_human + 1));
 -
 -              if(ca_players < required_ca_players && (redspawned && bluespawned)) {
 +              if(!ca_teams_ok && (red_players && blue_players)) {
                        reset_map(TRUE);
                }
 -              else if(ca_players < required_ca_players) {
 +              else if(!ca_teams_ok) {
-                       FOR_EACH_PLAYER(self)
-                               centerprint(self, strcat("^1Need at least 1 player in each team to play CA", "^7\n"));
+                       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;
+                       }
                        return;
                }
                else if(!next_round) {
 -                      if((redspawned && !bluespawned) || (bluespawned && !redspawned)) {
 +                      if((red_players && !blue_players) || (blue_players && !red_players)) {
                                next_round = time + 5;
-                               champion = find(world, classname, "player");
-                               if(champion_name)
-                                       strunzone(champion_name);
-                               champion_name = strzone(champion.netname);
                        }
 -                      else if((!redspawned && !bluespawned) || time - warmup > autocvar_g_ca_round_timelimit) {
 +                      else if((!red_players && !blue_players) || time - warmup > autocvar_g_ca_round_timelimit) {
-                               FOR_EACH_CLIENT(self) centerprint(self, strcat("^7Round tied.", "^7\n"));
+                               FOR_EACH_CLIENT(self) centerprint(self, "^7Round tied");
                                next_round = time + 5;
                        }
  
Simple merge