REGISTER_MUTATOR(nb, g_nexball)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
g_nexball_meter_period = autocvar_g_nexball_meter_period;
MUTATOR_ONROLLBACK_OR_REMOVE
{
WEP_NEXBALL.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
- // we actually cannot roll back nb_delayedinit 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;
}
REGISTER_MUTATOR(ons, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
ons_Initialize();
GameRules_teams(true);
GameRules_limit_score(autocvar_g_onslaught_point_limit);
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back ons_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 false;
}
#define MUTATOR_ONADD if (mode == MUTATOR_ADDING)
#define MUTATOR_ONREMOVE if (mode == MUTATOR_REMOVING)
#define MUTATOR_ONROLLBACK_OR_REMOVE if (mode == MUTATOR_REMOVING || mode == MUTATOR_ROLLING_BACK)
+
+#define MUTATOR_STATIC() MACRO_BEGIN { \
+ MUTATOR_ONADD { \
+ /* game loads at time 1 */ \
+ if (time > 1) { \
+ error("This is a game type and it cannot be added at runtime."); \
+ } \
+ } \
+ MUTATOR_ONREMOVE { \
+ LOG_INFO("This is a game type and it cannot be removed at runtime."); \
+ return -1; \
+ } \
+} MACRO_END
+
#define MUTATOR_ADD(name) Mutator_Add(MUTATOR_##name)
#define MUTATOR_REMOVE(name) Mutator_Remove(MUTATOR_##name)
#define MUTATOR_RETURNVALUE CallbackChain_ReturnValue
REGISTER_MUTATOR(as, false)
{
- GameRules_teams(true);
-
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
+ GameRules_teams(true);
assault_ScoreRules();
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back assault_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;
}
REGISTER_MUTATOR(ca, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- // game loads at time 1
- if (time > 1) error("This is a game type and it cannot be added at runtime.");
-
allowed_to_spawn = true;
ca_teams = autocvar_g_ca_teams_override;
GameRules_spawning_teams(autocvar_g_ca_team_spawns);
}
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
return 0;
}
REGISTER_MUTATOR(ctf, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
ctf_Initialize();
GameRules_teams(true);
GameRules_limit_score(autocvar_capturelimit_override);
GameRules_limit_lead(autocvar_captureleadlimit_override);
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back ctf_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
REGISTER_MUTATOR(cts, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
-
g_race_qualifying = true;
independent_players = 1;
GameRules_limit_score(0);
cts_Initialize();
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back cts_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;
}
REGISTER_MUTATOR(dm, false)
{
- MUTATOR_ONADD
- {
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- }
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back dm_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- error("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
+ MUTATOR_STATIC();
return 0;
}
REGISTER_MUTATOR(dom, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
dom_Initialize();
int fraglimit_override = autocvar_g_domination_point_limit;
GameRules_limit_score(fraglimit_override);
GameRules_limit_lead(autocvar_g_domination_point_leadlimit);
}
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
return 0;
}
REGISTER_MUTATOR(ft, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
freezetag_Initialize();
GameRules_teams(true);
GameRules_spawning_teams(autocvar_g_freezetag_team_spawns);
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back freezetag_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;
}
REGISTER_MUTATOR(inv, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
g_invasion = true;
invasion_Initialize();
GameRules_spawning_teams(autocvar_g_invasion_team_spawns);
}
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back invasion_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;
}
REGISTER_MUTATOR(ka, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
ka_Initialize();
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back ka_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 false;
}
REGISTER_MUTATOR(kh, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
kh_Initialize();
GameRules_teams(true);
GameRules_limit_lead(autocvar_g_keyhunt_point_leadlimit);
GameRules_spawning_teams(autocvar_g_keyhunt_team_spawns);
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back kh_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;
}
REGISTER_MUTATOR(lms, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
lms_Initialize();
GameRules_limit_score(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override));
GameRules_limit_lead(0);
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back lms_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;
}
REGISTER_MUTATOR(rc, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
-
rc_SetLimits();
race_Initialize();
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back race_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;
}
REGISTER_MUTATOR(tdm, false)
{
+ MUTATOR_STATIC();
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);
GameRules_teams(true);
GameRules_limit_lead(autocvar_g_tdm_point_leadlimit);
GameRules_spawning_teams(autocvar_g_tdm_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;
}