]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a method to the asymmetrical madness
authorMario <mario@smbclan.net>
Sun, 14 Aug 2016 08:23:52 +0000 (18:23 +1000)
committerMario <mario@smbclan.net>
Sun, 14 Aug 2016 08:23:52 +0000 (18:23 +1000)
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh

index 19313e6b6a8262a5351e64443ce238a18596527d..4b5b9214300913de3d4c1daed3010a27319514d0 100644 (file)
@@ -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)
index 03909cf46c1c1b2008197c5bda83a5dc91951ba7..28e0cfe237800b209fca58b63ef268b4bad076ef 100644 (file)
@@ -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