#include "gamemode_tdm.qh"
-#ifndef GAMEMODE_TDM_H
-#define GAMEMODE_TDM_H
-int autocvar_g_tdm_point_limit;
-int autocvar_g_tdm_point_leadlimit;
-bool autocvar_g_tdm_team_spawns;
-void tdm_DelayedInit(entity this);
-
-REGISTER_MUTATOR(tdm, false)
-{
- MUTATOR_ONADD
- {
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
-
- ActivateTeamplay();
- SetLimits(autocvar_g_tdm_point_limit, autocvar_g_tdm_point_leadlimit, autocvar_timelimit_override, -1);
- if (autocvar_g_tdm_team_spawns)
- have_team_spawns = -1; // request team spawns
- }
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back tdm_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
- return 0;
-}
-
-#endif
-
-#ifdef IMPLEMENTATION
int autocvar_g_tdm_teams;
int autocvar_g_tdm_teams_override;
{
if(!g_tdm || !this.cnt) { delete(this); return; }
- this.classname = "tdm_team";
this.team = this.cnt + 1;
}
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))
}
}
-MUTATOR_HOOKFUNCTION(tdm, GetTeamCount, CBC_ORDER_EXCLUSIVE)
+MUTATOR_HOOKFUNCTION(tdm, CheckAllowedTeams, CBC_ORDER_EXCLUSIVE)
{
M_ARGV(1, string) = "tdm_team";
return true;
// announce remaining frags
return true;
}
-
-#endif