From: terencehill Date: Sat, 20 Aug 2011 16:08:09 +0000 (+0200) Subject: Merge branch 'master' into terencehill/arena_stuff X-Git-Tag: xonotic-v0.6.0~40^2~141^2~1^2 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=9c40c25078426ed90e985c402c648fea3e3a8832 Merge branch 'master' into terencehill/arena_stuff Conflicts: qcsrc/server/arena.qc --- 9c40c25078426ed90e985c402c648fea3e3a8832 diff --cc qcsrc/server/arena.qc index 09db36618a,587b1ec54c..c89c2b2efa --- a/qcsrc/server/arena.qc +++ b/qcsrc/server/arena.qc @@@ -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) @@@ -260,30 -255,34 +254,36 @@@ { 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(); @@@ -383,24 -383,26 +384,24 @@@ 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; }