From: terencehill Date: Sat, 22 Dec 2012 08:51:02 +0000 (+0100) Subject: Full support for 3 and 4 teams in CA and Freezetag X-Git-Tag: xonotic-v0.7.0~61^2~77 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9bbaf653e6d235a7507c8ef15f644c081a0eb7e2;p=xonotic%2Fxonotic-data.pk3dir.git Full support for 3 and 4 teams in CA and Freezetag --- diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index cb95f9681..b2bfcf6a0 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -194,7 +194,9 @@ seta hud_panel_modicons_bg_color_team "" "override panel color with team color i seta hud_panel_modicons_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" seta hud_panel_modicons_bg_border "" "if set to something else than \"\" = override default size of border around the background" seta hud_panel_modicons_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" +seta hud_panel_modicons_ca_layout "" "2 possible layouts: 0) number of alive players; 1) icons and number of alive players" seta hud_panel_modicons_dom_layout "" "3 possible layouts: 0) only icons; 1) icons and percentage of average pps (points per second); 2) icons and average pps" +seta hud_panel_modicons_freezetag_layout "" "2 possible layouts: 0) number of alive players; 1) icons and number of alive players" seta hud_panel_pressedkeys "" "enable/disable this panel, 1 = show only when spectating other players, 2 = show always" seta hud_panel_pressedkeys_pos "" "position of this base of the panel" diff --git a/gamemodes.cfg b/gamemodes.cfg index 6cff7e5a4..515b8ce6c 100644 --- a/gamemodes.cfg +++ b/gamemodes.cfg @@ -168,6 +168,9 @@ set g_ca_spectate_enemies 0 "Allow spectating enemy player by dead player during set g_ca_warmup 10 "how long the players will have time to run around the map before the round starts" set g_ca_damage2score_multiplier 0.01 set g_ca_round_timelimit 180 +seta g_ca_teams_override 0 +set g_ca_teams 0 + // ================== @@ -283,6 +286,8 @@ seta g_freezetag_revive_speed 0.4 "Speed for reviving a frozen teammate" seta g_freezetag_revive_clearspeed 1.6 "Speed at which reviving progress gets lost when out of range" seta g_freezetag_revive_extra_size 100 "Distance in qu that you can stand from a frozen teammate to keep reviving him" seta g_freezetag_frozen_force 0.6 "How much to multiply the force on a frozen player with" +seta g_freezetag_teams_override 0 +set g_freezetag_teams 0 // ========== diff --git a/gfx/hud/default/player_pink.tga b/gfx/hud/default/player_pink.tga new file mode 100644 index 000000000..89a765921 Binary files /dev/null and b/gfx/hud/default/player_pink.tga differ diff --git a/gfx/hud/default/player_yellow.tga b/gfx/hud/default/player_yellow.tga new file mode 100644 index 000000000..8717d8f76 Binary files /dev/null and b/gfx/hud/default/player_yellow.tga differ diff --git a/hud_luminos.cfg b/hud_luminos.cfg index 6472a2579..c5be52095 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -192,7 +192,9 @@ seta hud_panel_modicons_bg_color_team "" seta hud_panel_modicons_bg_alpha "" seta hud_panel_modicons_bg_border "" seta hud_panel_modicons_bg_padding "0" +seta hud_panel_modicons_ca_layout "1" seta hud_panel_modicons_dom_layout "1" +seta hud_panel_modicons_freezetag_layout "1" seta hud_panel_pressedkeys 1 seta hud_panel_pressedkeys_pos "0.450000 0.720000" diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index bb7e0662e..843ff14a9 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -192,7 +192,9 @@ seta hud_panel_modicons_bg_color_team "" seta hud_panel_modicons_bg_alpha "" seta hud_panel_modicons_bg_border "" seta hud_panel_modicons_bg_padding "" +seta hud_panel_modicons_ca_layout "1" seta hud_panel_modicons_dom_layout "1" +seta hud_panel_modicons_freezetag_layout "1" seta hud_panel_pressedkeys 1 seta hud_panel_pressedkeys_pos "0.450000 0.650000" diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index e0921ad35..835c7d2c1 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -192,7 +192,9 @@ seta hud_panel_modicons_bg_color_team "" seta hud_panel_modicons_bg_alpha "" seta hud_panel_modicons_bg_border "" seta hud_panel_modicons_bg_padding "" +seta hud_panel_modicons_ca_layout "1" seta hud_panel_modicons_dom_layout "1" +seta hud_panel_modicons_freezetag_layout "1" seta hud_panel_pressedkeys 1 seta hud_panel_pressedkeys_pos "0.450000 0.690000" diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index 119f7b18f..20673e3f5 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -192,7 +192,9 @@ seta hud_panel_modicons_bg_color_team "" seta hud_panel_modicons_bg_alpha "" seta hud_panel_modicons_bg_border "" seta hud_panel_modicons_bg_padding "" +seta hud_panel_modicons_ca_layout "1" seta hud_panel_modicons_dom_layout "1" +seta hud_panel_modicons_freezetag_layout "1" seta hud_panel_pressedkeys 1 seta hud_panel_pressedkeys_pos "0.410000 0.710000" diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index 3cf0feb75..498079561 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -192,7 +192,9 @@ seta hud_panel_modicons_bg_color_team "" seta hud_panel_modicons_bg_alpha "" seta hud_panel_modicons_bg_border "" seta hud_panel_modicons_bg_padding "" +seta hud_panel_modicons_ca_layout "1" seta hud_panel_modicons_dom_layout "1" +seta hud_panel_modicons_freezetag_layout "1" seta hud_panel_pressedkeys 1 seta hud_panel_pressedkeys_pos "0.440000 0.760000" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index ed56f7183..d91288b6d 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -246,7 +246,9 @@ float autocvar_hud_panel_healtharmor_text; float autocvar_hud_panel_infomessages; float autocvar_hud_panel_infomessages_flip; float autocvar_hud_panel_modicons; +float autocvar_hud_panel_modicons_ca_layout; float autocvar_hud_panel_modicons_dom_layout; +float autocvar_hud_panel_modicons_freezetag_layout; float autocvar_hud_panel_notify; float autocvar_hud_panel_notify_fadetime; float autocvar_hud_panel_notify_flip; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 13f37b70e..f2b990145 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -3281,32 +3281,93 @@ void HUD_VoteWindow(void) float mod_active; // is there any active mod icon? -// Clan Arena HUD modicons -void HUD_Mod_CA(vector pos, vector mySize) +void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, float layout, float i) { - mod_active = 1; // CA should never hide the mod icons panel - float redalive, bluealive; - redalive = getstati(STAT_REDALIVE); - bluealive = getstati(STAT_BLUEALIVE); + float stat; + string pic; + vector color; + switch(i) + { + case 0: + stat = getstati(STAT_REDALIVE); + pic = "player_red.tga"; + color = '1 0 0'; + break; + case 1: + stat = getstati(STAT_BLUEALIVE); + pic = "player_blue.tga"; + color = '0 0 1'; + break; + case 2: + stat = getstati(STAT_YELLOWALIVE); + pic = "player_yellow.tga"; + color = '1 1 0'; + break; + case 3: + stat = getstati(STAT_PINKALIVE); + pic = "player_pink.tga"; + color = '1 0 1'; + } - vector redpos, bluepos; - if(mySize_x > mySize_y) + if(mySize_x/mySize_y > aspect_ratio) { - redpos = pos; - bluepos = pos + eY * 0.5 * mySize_y; - drawpic_aspect_skin(redpos, "player_red.tga", 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(redpos + eX * 0.5 * mySize_x, ftos(redalive), 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawpic_aspect_skin(bluepos, "player_blue.tga", 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(bluepos + eX * 0.5 * mySize_x, ftos(bluealive), 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + i = aspect_ratio * mySize_y; + myPos_x = myPos_x + (mySize_x - i) / 2; + mySize_x = i; } else { - redpos = pos; - bluepos = pos + eY * 0.5 * mySize_y; - drawpic_aspect_skin(redpos, "player_red.tga", eX * mySize_x + eY * 0.3 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(redpos + eY * 0.3 * mySize_y, ftos(redalive), eX * mySize_x + eY * 0.2 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawpic_aspect_skin(bluepos, "player_blue.tga", eX * mySize_x + eY * 0.3 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(bluepos + eY * 0.3 * mySize_y, ftos(bluealive), eX * mySize_x + eY * 0.2 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + i = 1/aspect_ratio * mySize_x; + myPos_y = myPos_y + (mySize_y - i) / 2; + mySize_y = i; + } + + if(layout) + { + drawpic_aspect_skin(myPos, pic, eX * 0.7 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(myPos + eX * 0.7 * mySize_x, ftos(stat), eX * 0.3 * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL); + } + else + drawstring_aspect(myPos, ftos(stat), mySize, color, panel_fg_alpha, DRAWFLAG_NORMAL); +} + +// Clan Arena and Freeze Tag HUD modicons +void HUD_Mod_CA(vector myPos, vector mySize) +{ + mod_active = 1; // required in each mod function that always shows something + entity tm; + float teams_count; + for(tm = teams.sort_next; tm; tm = tm.sort_next) + if(tm.team != COLOR_SPECTATOR) + ++teams_count; + + float layout; + if(gametype == MAPINFO_TYPE_CA) + layout = autocvar_hud_panel_modicons_ca_layout; + else //if(gametype == MAPINFO_TYPE_FREEZETAG) + layout = autocvar_hud_panel_modicons_freezetag_layout; + float rows, columns, aspect_ratio; + rows = mySize_y/mySize_x; + aspect_ratio = (layout) ? 2 : 1; + rows = bound(1, floor((sqrt((4 * aspect_ratio * teams_count + rows) * rows) + rows + 0.5) / 2), teams_count); + columns = ceil(teams_count/rows); + + int i; + float row, column; + for(i=0; i= rows) + { + row = 0; + ++column; + } } } diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index 75c1d2c0e..23e9f8e4b 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -135,7 +135,9 @@ void HUD_Panel_ExportCfg(string cfgname) HUD_Write_PanelCvar_q("_alreadyvoted_alpha"); break; case HUD_PANEL_MODICONS: + HUD_Write_PanelCvar_q("_ca_layout"); HUD_Write_PanelCvar_q("_dom_layout"); + HUD_Write_PanelCvar_q("_freezetag_layout"); break; case HUD_PANEL_PRESSEDKEYS: HUD_Write_PanelCvar_q("_attack"); diff --git a/qcsrc/server/arena.qc b/qcsrc/server/arena.qc index 14caab85b..4f986d138 100644 --- a/qcsrc/server/arena.qc +++ b/qcsrc/server/arena.qc @@ -19,6 +19,8 @@ float redalive, bluealive, yellowalive, pinkalive; .float redalive_stat, bluealive_stat, yellowalive_stat, pinkalive_stat; float red_players, blue_players, yellow_players, pink_players; float total_players; +#define CA_TEAMS() ((red_players > 0) + (blue_players > 0) + (yellow_players > 0) + (pink_players > 0)) +#define CA_TEAMS_OK() (CA_TEAMS() == ca_teams) /** * Resets the state of all clients, items, flags, runes, keys, weapons, waypoints, ... of the map. @@ -224,7 +226,7 @@ void Arena_Warmup() allowed_to_spawn = 1; else if (warmup == 0) //first warmup or warmup cleared { - if (red_players && blue_players) + if(CA_TEAMS_OK()) reset_map(TRUE); else if(f != roundStartTime_prev) { @@ -251,7 +253,7 @@ void Arena_Warmup() if(f != roundStartTime_prev) { roundStartTime_prev = f; - if(g_ca && !(red_players && blue_players)) { + if(g_ca && !CA_TEAMS_OK()) { warmup = 0; return; } @@ -281,7 +283,7 @@ void Arena_Warmup() { roundStartTime_prev = f; if(g_ca) { - if(red_players && blue_players) + if(CA_TEAMS_OK()) allowed_to_spawn = 0; else { @@ -343,13 +345,44 @@ void count_alive_players() redalive += 1; else if (self.team == COLOR_TEAM2 && self.health >= 1) bluealive += 1; + else if (self.team == COLOR_TEAM3 && self.health >= 1) + yellowalive += 1; + else if (self.team == COLOR_TEAM4 && self.health >= 1) + pinkalive += 1; } FOR_EACH_REALCLIENT(self) { self.redalive_stat = redalive; self.bluealive_stat = bluealive; + self.yellowalive_stat = yellowalive; + self.pinkalive_stat = pinkalive; } } +float CA_GetWinnerTeam() +{ + float winner_team; + if(redalive >= 1) + winner_team = COLOR_TEAM1; + if(bluealive >= 1) + { + if(winner_team) return 0; + winner_team = COLOR_TEAM2; + } + if(yellowalive >= 1) + { + if(winner_team) return 0; + winner_team = COLOR_TEAM3; + } + if(pinkalive >= 1) + { + if(winner_team) return 0; + winner_team = COLOR_TEAM4; + } + if(winner_team) + return winner_team; + return -1; // no player left +} + /** * This function finds out whether an arena round is over 1 player is left. * It determines the last player who's still alive and saves it's entity reference @@ -363,22 +396,18 @@ void Spawnqueue_Check() return; if(g_ca) { + float winner_team; if(allowed_to_spawn) // round is not started yet return; if(!next_round) { - if(!(redalive && bluealive)) { - // every player of (at least) one team is dead, round ends here - if(redalive) { - play2all("ctf/red_capture.wav"); - FOR_EACH_CLIENT(self) centerprint(self, "^1RED ^7team wins the round"); - TeamScore_AddToTeam(COLOR_TEAM1, ST_SCORE, +1); + winner_team = CA_GetWinnerTeam(); + if(winner_team) { + if(winner_team > 0) { + FOR_EACH_CLIENT(self) + centerprint(self, strcat(ColoredTeamName(winner_team), " wins the round")); + TeamScore_AddToTeam(winner_team, ST_SCORE, +1); } - else if(bluealive) { - play2all("ctf/blue_capture.wav"); - FOR_EACH_CLIENT(self) centerprint(self, "^4BLUE ^7team wins the round"); - TeamScore_AddToTeam(COLOR_TEAM2, ST_SCORE, +1); - } - else + else //if(winner_team == -1) // no player left FOR_EACH_CLIENT(self) centerprint(self, "^7Round tied"); next_round = -1; } @@ -389,7 +418,7 @@ void Spawnqueue_Check() } else if(next_round == -1) { // wait for killed players to be put as spectators - if(!(red_players && blue_players)) + if(!CA_TEAMS_OK()) next_round = time + 5; } else if((next_round > 0 && next_round < time)) diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index ae57831a6..bbae1e234 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -743,6 +743,8 @@ float autocvar_g_ca_point_leadlimit; float autocvar_g_ca_point_limit; float autocvar_g_ca_round_timelimit; float autocvar_g_ca_spectate_enemies; +float autocvar_g_ca_teams; +float autocvar_g_ca_teams_override; float autocvar_g_ca_warmup; float autocvar_g_campaign; #define autocvar_g_campaign_forceteam cvar("g_campaign_forceteam") @@ -854,6 +856,8 @@ float autocvar_g_freezetag_point_limit; float autocvar_g_freezetag_revive_extra_size; float autocvar_g_freezetag_revive_speed; float autocvar_g_freezetag_revive_clearspeed; +float autocvar_g_freezetag_teams; +float autocvar_g_freezetag_teams_override; float autocvar_g_freezetag_warmup; #define autocvar_g_friendlyfire cvar("g_friendlyfire") #define autocvar_g_friendlyfire_virtual cvar("g_friendlyfire_virtual") diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index c57efb54b..0b3d1e752 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -58,6 +58,8 @@ float team1_score, team2_score, team3_score, team4_score; float maxclients; +float ca_teams; + // Fields .void(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) event_damage; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 5ab72ce4e..eed0a7914 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -806,12 +806,6 @@ void spawnfunc_worldspawn (void) addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load); - if(g_ca) - { - addstat(STAT_REDALIVE, AS_INT, redalive_stat); - addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat); - } - // g_movementspeed hack addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw); addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed); diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index ca06458b0..4e7fbd1d7 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -1,3 +1,4 @@ +float freezetag_teams; float freezetag_CheckTeams(); float freezetag_CheckWinner(); void freezetag_Initialize() @@ -49,24 +50,14 @@ void freezetag_count_alive_players() e.pinkalive_stat = pinkalive; } } - -float freezetag_TeamsCanPlay() -{ - if((redalive >= 1 && bluealive >= 1) - || (redalive >= 1 && yellowalive >= 1) - || (redalive >= 1 && pinkalive >= 1) - || (bluealive >= 1 && yellowalive >= 1) - || (bluealive >= 1 && pinkalive >= 1) - || (yellowalive >= 1 && pinkalive >= 1)) - return 1; // we still have active players on two or more teams, nobody won yet - return 0; -} +#define FREEZETAG_ALIVE_TEAMS() ((redalive > 0) + (bluealive > 0) + (yellowalive > 0) + (pinkalive > 0)) +#define FREEZETAG_ALIVE_TEAMS_OK() (FREEZETAG_ALIVE_TEAMS() == freezetag_teams) float prev_total_players; float freezetag_CheckTeams() { entity e; - if(freezetag_TeamsCanPlay()) + if(FREEZETAG_ALIVE_TEAMS_OK()) { if(prev_total_players != -1) { @@ -81,6 +72,10 @@ float freezetag_CheckTeams() string teams_missing; if(!redalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM1), ", "); if(!bluealive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM2), ", "); + if(freezetag_teams >= 3) + if(!yellowalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM3), ", "); + if(freezetag_teams == 4) + if(!pinkalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM4), ", "); teams_missing = substring(teams_missing, 0, strlen(teams_missing)-2); FOR_EACH_REALCLIENT(e) @@ -89,31 +84,54 @@ float freezetag_CheckTeams() } return 0; } + +float freezetag_getWinnerTeam() +{ + float winner_team; + if(redalive >= 1) + winner_team = COLOR_TEAM1; + if(bluealive >= 1) + { + if(winner_team) return 0; + winner_team = COLOR_TEAM2; + } + if(yellowalive >= 1) + { + if(winner_team) return 0; + winner_team = COLOR_TEAM3; + } + if(pinkalive >= 1) + { + if(winner_team) return 0; + winner_team = COLOR_TEAM4; + } + if(winner_team) + return winner_team; + return -1; // no player left +} + float freezetag_CheckWinner() { - if(freezetag_TeamsCanPlay()) + if(FREEZETAG_ALIVE_TEAMS() > 1) return 0; - entity e, winner; + entity e; + float winner_team; string teamname; - winner = world; - - FOR_EACH_PLAYER(e) - { - if(e.freezetag_frozen == 0 && e.health >= 1) // here's one player from the winning team... good - { - winner = e; - break; // break, we found the winner - } - } - - if(winner != world) // just in case a winner wasn't found + winner_team = freezetag_getWinnerTeam(); + if(winner_team > 0) { - teamname = ColoredTeamName(winner.team); + teamname = ColoredTeamName(winner_team); FOR_EACH_REALCLIENT(e) centerprint(e, strcat(teamname, "^5 wins the round, all other teams were frozen.")); bprint(teamname, "^5 wins the round since all the other teams were frozen.\n"); - TeamScore_AddToTeam(winner.team, ST_SCORE, +1); + TeamScore_AddToTeam(winner_team, ST_SCORE, +1); + } + else if(winner_team == -1) + { + FOR_EACH_REALCLIENT(e) + centerprint(e, "^5Round tied! All teams were frozen."); + bprint("^5Round tied! All teams were frozen.\n"); } return 1; @@ -570,6 +588,16 @@ MUTATOR_HOOKFUNCTION(freezetag_SpectateCopy) return 0; } +MUTATOR_HOOKFUNCTION(freezetag_GetTeamCount) +{ + freezetag_teams = autocvar_g_freezetag_teams_override; + if(freezetag_teams < 2) + freezetag_teams = autocvar_g_freezetag_teams; + freezetag_teams = bound(2, freezetag_teams, 4); + ret_float = freezetag_teams; + return 0; +} + MUTATOR_DEFINITION(gamemode_freezetag) { MUTATOR_HOOK(MakePlayerObserver, freezetag_RemovePlayer, CBC_ORDER_ANY); @@ -584,6 +612,7 @@ MUTATOR_DEFINITION(gamemode_freezetag) MUTATOR_HOOK(ForbidThrowCurrentWeapon, freezetag_ForbidThrowCurrentWeapon, CBC_ORDER_ANY); MUTATOR_HOOK(HavocBot_ChooseRule, freezetag_BotRoles, CBC_ORDER_ANY); MUTATOR_HOOK(SpectateCopy, freezetag_SpectateCopy, CBC_ORDER_ANY); + MUTATOR_HOOK(GetTeamCount, freezetag_GetTeamCount, CBC_ORDER_EXCLUSIVE); MUTATOR_ONADD { diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 61b9f06fd..0314104b1 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -182,8 +182,14 @@ void InitGameplayMode() fraglimit_override = autocvar_g_ca_point_limit; leadlimit_override = autocvar_g_ca_point_leadlimit; allowed_to_spawn = TRUE; - precache_sound("ctf/red_capture.wav"); - precache_sound("ctf/blue_capture.wav"); + ca_teams = autocvar_g_ca_teams_override; + if(ca_teams < 2) + ca_teams = autocvar_g_ca_teams; + ca_teams = bound(2, ca_teams, 4); + addstat(STAT_REDALIVE, AS_INT, redalive_stat); + addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat); + addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat); + addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat); } if(g_keyhunt) { @@ -476,6 +482,8 @@ void CheckAllowedTeams (entity for_whom) // cover anything else by treating it like tdm with no teams spawned if(g_race) dm = race_teams; + else if(g_ca) + dm = ca_teams; else dm = 2;