float i;
float inWorldspawn;
float r;
- float twoBaseModes;
float diameter, spawnpoints;
float spawnplaces;
}
else if(k == "classname")
{
- if(v == "dom_controlpoint")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_DOMINATION.m_flags;
- else if(v == "item_flag_team2")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTF.m_flags;
- else if(v == "team_CTF_blueflag")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTF.m_flags;
- else if(v == "invasion_spawnpoint")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_INVASION.m_flags;
- else if(v == "target_assault_roundend")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_ASSAULT.m_flags;
- else if(v == "onslaught_generator")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_ONSLAUGHT.m_flags;
- else if(substring(v, 0, 8) == "nexball_" || substring(v, 0, 4) == "ball")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_NEXBALL.m_flags;
- else if(v == "info_player_team1")
+ if(v == "info_player_team1")
++spawnpoints;
else if(v == "info_player_team2")
++spawnpoints;
++spawnpoints;
else if(v == "info_player_deathmatch")
++spawnpoints;
- else if(v == "trigger_race_checkpoint")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_RACE.m_flags;
- else if(v == "target_startTimer")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTS.m_flags;
else if(v == "weapon_nex")
{ }
else if(v == "weapon_railgun")
MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_MONSTERS;
else if(v == "target_music" || v == "trigger_music")
_MapInfo_Map_worldspawn_music = string_null; // don't use regular BGM
+ else
+ FOREACH(Gametypes, true, it.m_generate_mapinfo(it, v));
}
}
}
}
diameter = vlen(mapMaxs - mapMins);
- twoBaseModes = MapInfo_Map_supportedGametypes & (MAPINFO_TYPE_CTF.m_flags | MAPINFO_TYPE_ASSAULT.m_flags | MAPINFO_TYPE_RACE.m_flags | MAPINFO_TYPE_NEXBALL.m_flags);
- if(twoBaseModes && (MapInfo_Map_supportedGametypes == twoBaseModes))
+ int twoBaseModes = 0;
+ FOREACH(Gametypes, it.m_isTwoBaseMode(), twoBaseModes |= it.m_flags);
+ if(twoBaseModes && (twoBaseModes &= MapInfo_Map_supportedGametypes))
{
// we have a CTF-only or Assault-only map. Don't add other modes then,
// as the map is too symmetric for them.
#include "util.qh"
+// info about a map that MapInfo loads
+string MapInfo_Map_bspname;
+string MapInfo_Map_title;
+string MapInfo_Map_titlestring; // either bspname: title or just title, depending on whether bspname is redundant
+string MapInfo_Map_description;
+string MapInfo_Map_author;
+string MapInfo_Map_clientstuff; // not in cache, only for map load
+string MapInfo_Map_fog; // not in cache, only for map load
+int MapInfo_Map_supportedGametypes;
+int MapInfo_Map_supportedFeatures;
+int MapInfo_Map_flags;
+vector MapInfo_Map_mins; // these are '0 0 0' if not supported!
+vector MapInfo_Map_maxs; // these are '0 0 0' if not specified!
+
int MAPINFO_TYPE_ALL;
.int m_flags;
{
return false;
}
+ METHOD(Gametype, m_generate_mapinfo, void(Gametype this, string v))
+ {
+ TC(Gametype, this);
+ }
+ METHOD(Gametype, m_isTwoBaseMode, bool())
+ {
+ return false;
+ }
METHOD(Gametype, describe, string(Gametype this))
{
}
return false;
}
+ METHOD(Race, m_generate_mapinfo, void(Gametype this, string v))
+ {
+ if(v == "trigger_race_checkpoint")
+ MapInfo_Map_supportedGametypes |= this.m_flags;
+ }
+ METHOD(Race, m_isTwoBaseMode, bool())
+ {
+ return true;
+ }
ENDCLASS(Race)
REGISTER_GAMETYPE(RACE, NEW(Race));
#define g_race IS_GAMETYPE(RACE)
{
this.gametype_init(this, _("Race CTS"),"cts","g_cts",false,"cloaked","timelimit=20",_("Race for fastest time."));
}
+ METHOD(RaceCTS, m_generate_mapinfo, void(Gametype this, string v))
+ {
+ if(v == "target_startTimer")
+ MapInfo_Map_supportedGametypes |= this.m_flags;
+ }
ENDCLASS(RaceCTS)
REGISTER_GAMETYPE(CTS, NEW(RaceCTS));
#define g_cts IS_GAMETYPE(CTS)
{
this.gametype_init(this, _("Capture the Flag"),"ctf","g_ctf",true,"","timelimit=20 caplimit=10 leadlimit=6",_("Find and bring the enemy flag to your base to capture it, defend your base from the other team"));
}
+ METHOD(CaptureTheFlag, m_generate_mapinfo, void(Gametype this, string v))
+ {
+ if(v == "item_flag_team2" || v == "team_CTF_blueflag")
+ MapInfo_Map_supportedGametypes |= this.m_flags;
+ }
+ METHOD(CaptureTheFlag, m_isTwoBaseMode, bool())
+ {
+ return true;
+ }
ENDCLASS(CaptureTheFlag)
REGISTER_GAMETYPE(CTF, NEW(CaptureTheFlag));
#define g_ctf IS_GAMETYPE(CTF)
}
return false;
}
+ METHOD(Domination, m_generate_mapinfo, void(Gametype this, string v))
+ {
+ if(v == "dom_controlpoint")
+ MapInfo_Map_supportedGametypes |= this.m_flags;
+ }
ENDCLASS(Domination)
REGISTER_GAMETYPE(DOMINATION, NEW(Domination));
{
this.gametype_init(this, _("Assault"),"as","g_assault",true,"","timelimit=20",_("Destroy obstacles to find and destroy the enemy power core before time runs out"));
}
+ METHOD(Assault, m_generate_mapinfo, void(Gametype this, string v))
+ {
+ if(v == "target_assault_roundend")
+ MapInfo_Map_supportedGametypes |= this.m_flags;
+ }
+ METHOD(Assault, m_isTwoBaseMode, bool())
+ {
+ return true;
+ }
ENDCLASS(Assault)
REGISTER_GAMETYPE(ASSAULT, NEW(Assault));
#define g_assault IS_GAMETYPE(ASSAULT)
{
this.gametype_init(this, _("Onslaught"),"ons","g_onslaught",true,"","pointlimit=1 timelimit=20",_("Capture control points to reach and destroy the enemy generator"));
}
+ METHOD(Onslaught, m_generate_mapinfo, void(Gametype this, string v))
+ {
+ if(v == "onslaught_generator")
+ MapInfo_Map_supportedGametypes |= this.m_flags;
+ }
ENDCLASS(Onslaught)
REGISTER_GAMETYPE(ONSLAUGHT, NEW(Onslaught));
{
this.gametype_init(this, _("Nexball"),"nb","g_nexball",true,"","timelimit=20 pointlimit=5 leadlimit=0",_("Shoot and kick the ball into the enemies goal, keep your goal clean"));
}
+ METHOD(NexBall, m_generate_mapinfo, void(Gametype this, string v))
+ {
+ if(substring(v, 0, 8) == "nexball_" || substring(v, 0, 4) == "ball")
+ MapInfo_Map_supportedGametypes |= this.m_flags;
+ }
+ METHOD(NexBall, m_isTwoBaseMode, bool())
+ {
+ return true;
+ }
ENDCLASS(NexBall)
REGISTER_GAMETYPE(NEXBALL, NEW(NexBall));
#define g_nexball IS_GAMETYPE(NEXBALL)
}
return false;
}
+ METHOD(Invasion, m_generate_mapinfo, void(Gametype this, string v))
+ {
+ if(v == "invasion_spawnpoint")
+ MapInfo_Map_supportedGametypes |= this.m_flags;
+ }
ENDCLASS(Invasion)
REGISTER_GAMETYPE(INVASION, NEW(Invasion));
float MapInfo_count;
-// info about a map that MapInfo loads
-string MapInfo_Map_bspname;
-string MapInfo_Map_title;
-string MapInfo_Map_titlestring; // either bspname: title or just title, depending on whether bspname is redundant
-string MapInfo_Map_description;
-string MapInfo_Map_author;
-string MapInfo_Map_clientstuff; // not in cache, only for map load
-string MapInfo_Map_fog; // not in cache, only for map load
-int MapInfo_Map_supportedGametypes;
-int MapInfo_Map_supportedFeatures;
-int MapInfo_Map_flags;
-vector MapInfo_Map_mins; // these are '0 0 0' if not supported!
-vector MapInfo_Map_maxs; // these are '0 0 0' if not specified!
-
// load MapInfo_count; generate mapinfo for maps that miss them, and clear the
// cache; you need to call MapInfo_FilterGametype afterwards!
void MapInfo_Enumerate();