// scoreboard setup
void assault_ScoreRules()
{
- int teams = 0;
- teams |= BIT(0);
- teams |= BIT(1); // always red vs blue
-
+ int teams = BITS(2); // always red vs blue
GameRules_scoring(teams, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, {
field_team(ST_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY);
field(SP_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY);
ca_teams = autocvar_g_ca_teams_override;
if (ca_teams < 2)
ca_teams = cvar("g_ca_teams"); // read the cvar directly as it gets written earlier in the same frame
- ca_teams = bound(2, ca_teams, 4);
- int teams = 0;
- if(ca_teams >= 1) teams |= BIT(0);
- if(ca_teams >= 2) teams |= BIT(1);
- if(ca_teams >= 3) teams |= BIT(2);
- if(ca_teams >= 4) teams |= BIT(3);
-
- ca_teams = teams; // now set it?
-
- GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
+ ca_teams = BITS(bound(2, ca_teams, 4));
+ GameRules_scoring(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, {
field_team(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
});
int autocvar_g_freezetag_teams_override;
float autocvar_g_freezetag_warmup;
-void freezetag_ScoreRules(int teams)
-{
- GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {
- field(SP_FREEZETAG_REVIVALS, "revivals", 0);
- });
-}
-
void freezetag_count_alive_players()
{
total_players = redalive = bluealive = yellowalive = pinkalive = 0;
freezetag_teams = autocvar_g_freezetag_teams_override;
if(freezetag_teams < 2)
freezetag_teams = cvar("g_freezetag_teams"); // read the cvar directly as it gets written earlier in the same frame
- freezetag_teams = bound(2, freezetag_teams, 4);
-
- int teams = 0;
- if(freezetag_teams >= 1) teams |= BIT(0);
- if(freezetag_teams >= 2) teams |= BIT(1);
- if(freezetag_teams >= 3) teams |= BIT(2);
- if(freezetag_teams >= 4) teams |= BIT(3);
- freezetag_teams = teams; // now set it?
- freezetag_ScoreRules(freezetag_teams);
+ freezetag_teams = BITS(bound(2, freezetag_teams, 4));
+ GameRules_scoring(freezetag_teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {
+ field(SP_FREEZETAG_REVIVALS, "revivals", 0);
+ });
round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, func_null);
round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
if(autocvar_g_invasion_teams)
{
- invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
- int teams = 0;
- if(invasion_teams >= 1) teams |= BIT(0);
- if(invasion_teams >= 2) teams |= BIT(1);
- if(invasion_teams >= 3) teams |= BIT(2);
- if(invasion_teams >= 4) teams |= BIT(3);
-
- invasion_teams = teams; // now set it?
+ invasion_teams = BITS(bound(2, autocvar_g_invasion_teams, 4));
}
else
invasion_teams = 0;
kh_teams = autocvar_g_keyhunt_teams_override;
if(kh_teams < 2)
kh_teams = cvar("g_keyhunt_teams"); // read the cvar directly as it gets written earlier in the same frame
- kh_teams = bound(2, kh_teams, 4);
-
- int teams = 0;
- if(kh_teams >= 1) teams |= BIT(0);
- if(kh_teams >= 2) teams |= BIT(1);
- if(kh_teams >= 3) teams |= BIT(2);
- if(kh_teams >= 4) teams |= BIT(3);
-
- kh_teams = teams; // now set it?
+ kh_teams = BITS(bound(2, kh_teams, 4));
// make a KH entity for controlling the game
kh_controller = spawn();
if(autocvar_g_race_teams)
{
GameRules_teams(true);
- race_teams = bound(2, autocvar_g_race_teams, 4);
- int teams = 0;
- if(race_teams >= 1) teams |= BIT(0);
- if(race_teams >= 2) teams |= BIT(1);
- if(race_teams >= 3) teams |= BIT(2);
- if(race_teams >= 4) teams |= BIT(3);
-
- race_teams = teams; // now set it?
+ race_teams = BITS(bound(2, autocvar_g_race_teams, 4));
}
else
race_teams = 0;
LOG_TRACE("No \"tdm_team\" entities found on this map, creating them anyway.");
int numteams = autocvar_g_tdm_teams_override;
-
if(numteams < 2) { numteams = autocvar_g_tdm_teams; }
- numteams = bound(2, numteams, 4);
-
- int teams = 0;
- if(numteams >= 1) teams |= BIT(0);
- if(numteams >= 2) teams |= BIT(1);
- if(numteams >= 3) teams |= BIT(2);
- if(numteams >= 4) teams |= BIT(3);
+ int teams = BITS(bound(2, numteams, 4));
if(teams & BIT(0))
tdm_SpawnTeam("Red", NUM_TEAM_1);
if(teams & BIT(1))