From 398c08c48160ee843dc959b84d6443c8f368f1be Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 14 Aug 2016 18:23:52 +1000 Subject: [PATCH] Add a method to the asymmetrical madness --- qcsrc/common/mapinfo.qc | 17 +++-------------- qcsrc/common/mapinfo.qh | 42 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 19313e6b6..4b5b92143 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -383,25 +383,14 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp diameter = vlen(mapMaxs - mapMins); int twoBaseModes = 0; - FOREACH(Gametypes, it.m_isTwoBaseMode(), twoBaseModes |= it.m_flags); + 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. + // we have a symmetrical map, don't add the modes without bases } else { - MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_DEATHMATCH.m_flags; // DM always works - MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_LMS.m_flags; // LMS always works - MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_KEEPAWAY.m_flags; // Keepaway always works - - if(spawnpoints >= 8 && diameter > 4096) { - MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_TEAM_DEATHMATCH.m_flags; - MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_FREEZETAG.m_flags; - MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CA.m_flags; - } - if(spawnpoints >= 12 && diameter > 5120) - MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_KEYHUNT.m_flags; + FOREACH(Gametypes, it.m_isAlwaysSupported(it, spawnpoints, diameter), MapInfo_Map_supportedGametypes |= it.m_flags); } if(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE.m_flags) diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 03909cf46..28e0cfe23 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -57,6 +57,10 @@ CLASS(Gametype, Object) { return false; } + METHOD(Gametype, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return false; + } METHOD(Gametype, describe, string(Gametype this)) { @@ -98,6 +102,10 @@ CLASS(Deathmatch, Gametype) { this.gametype_init(this, _("Deathmatch"),"dm","g_dm",false,"","timelimit=20 pointlimit=30 leadlimit=0",_("Score as many frags as you can")); } + METHOD(Deathmatch, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return true; + } ENDCLASS(Deathmatch) REGISTER_GAMETYPE(DEATHMATCH, NEW(Deathmatch)); @@ -106,6 +114,10 @@ CLASS(LastManStanding, Gametype) { this.gametype_init(this, _("Last Man Standing"),"lms","g_lms",false,"","timelimit=20 lives=9 leadlimit=0",_("Survive and kill until the enemies have no lives left")); } + METHOD(LastManStanding, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return true; + } ENDCLASS(LastManStanding) REGISTER_GAMETYPE(LMS, NEW(LastManStanding)); @@ -181,6 +193,12 @@ CLASS(TeamDeathmatch, Gametype) } return false; } + METHOD(TeamDeathmatch, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + if(spawnpoints >= 8 && diameter > 4096) + return true; + return false; + } ENDCLASS(TeamDeathmatch) REGISTER_GAMETYPE(TEAM_DEATHMATCH, NEW(TeamDeathmatch)); #define g_tdm IS_GAMETYPE(TEAM_DEATHMATCH) @@ -230,6 +248,12 @@ CLASS(ClanArena, Gametype) } return false; } + METHOD(ClanArena, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + if(spawnpoints >= 8 && diameter > 4096) + return true; + return false; + } #ifdef CSQC ATTRIB(ClanArena, m_modicons, void(vector pos, vector mySize), HUD_Mod_CA); #endif @@ -290,11 +314,11 @@ CLASS(KeyHunt, Gametype) } return false; } - METHOD(KeyHunt, m_modicons, void(vector pos, vector mySize)) + METHOD(KeyHunt, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) { - #ifdef CSQC - HUD_Mod_KH(pos, mySize); - #endif + if(spawnpoints >= 12 && diameter > 5120) + return true; + return false; } #ifdef CSQC ATTRIB(KeyHunt, m_modicons, void(vector pos, vector mySize), HUD_Mod_KH); @@ -375,6 +399,12 @@ CLASS(FreezeTag, Gametype) } return false; } + METHOD(FreezeTag, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + if(spawnpoints >= 8 && diameter > 4096) + return true; + return false; + } #ifdef CSQC ATTRIB(FreezeTag, m_modicons, void(vector pos, vector mySize), HUD_Mod_CA); #endif @@ -390,6 +420,10 @@ CLASS(Keepaway, Gametype) { this.gametype_init(this, _("Keepaway"),"ka","g_keepaway",true,"","timelimit=20 pointlimit=30",_("Hold the ball to get points for kills")); } + METHOD(Keepaway, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return true; + } #ifdef CSQC ATTRIB(Keepaway, m_modicons, void(vector pos, vector mySize), HUD_Mod_Keepaway); #endif -- 2.39.2