]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add support for up to 72 gametypes
authorDr. Jaska <drjaska83@gmail.com>
Wed, 10 Jul 2024 18:27:36 +0000 (18:27 +0000)
committerDr. Jaska <drjaska83@gmail.com>
Wed, 10 Jul 2024 18:27:36 +0000 (18:27 +0000)
18 files changed:
qcsrc/common/gamemodes/gamemode/assault/assault.qh
qcsrc/common/gamemodes/gamemode/ctf/ctf.qh
qcsrc/common/gamemodes/gamemode/cts/cts.qh
qcsrc/common/gamemodes/gamemode/domination/domination.qh
qcsrc/common/gamemodes/gamemode/duel/duel.qh
qcsrc/common/gamemodes/gamemode/invasion/invasion.qh
qcsrc/common/gamemodes/gamemode/mayhem/mayhem.qh
qcsrc/common/gamemodes/gamemode/nexball/nexball.qh
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qh
qcsrc/common/gamemodes/gamemode/race/race.qh
qcsrc/common/gamemodes/gamemode/survival/survival.qh
qcsrc/common/gamemodes/gamemode/tdm/tdm.qh
qcsrc/common/gamemodes/gamemode/tka/tka.qh
qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qc
qcsrc/server/mapvoting.qc

index f4f4b3f92fdff0f6d826038a6737a4b7307813a6..c07002d8f3594585b17a4301cddb3da5934970de 100644 (file)
@@ -10,7 +10,7 @@ CLASS(Assault, Gametype)
     METHOD(Assault, m_generate_mapinfo, void(Gametype this, string v))
     {
         if(v == "target_assault_roundend")
-            MapInfo_Map_supportedGametypes |= this.m_flags;
+            MapInfo_Map_supportedGametypes |= this.gametype_flags;
     }
     METHOD(Assault, m_isTwoBaseMode, bool())
     {
index 5d74f31cce3fb7d625ff3c2a4e19778502269fc2..c5d15fec947da960da4feca23bd1cb04d5009062 100644 (file)
@@ -14,7 +14,7 @@ CLASS(CaptureTheFlag, Gametype)
     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;
+            MapInfo_Map_supportedGametypes |= this.gametype_flags;
     }
     METHOD(CaptureTheFlag, m_isTwoBaseMode, bool())
     {
index c59b73c36399b460f8f282864efa92d50886b06c..c677ff6021b5369d09754acff3aec25e2912b485 100644 (file)
@@ -13,7 +13,7 @@ CLASS(RaceCTS, Gametype)
     METHOD(RaceCTS, m_generate_mapinfo, void(Gametype this, string v))
     {
         if(v == "target_startTimer")
-            MapInfo_Map_supportedGametypes |= this.m_flags;
+            MapInfo_Map_supportedGametypes |= this.gametype_flags;
     }
     METHOD(RaceCTS, m_setTeams, void(string sa))
     {
index 494737c3636879a31ad684602acf6cefbd94b6b0..3117c2980e43c172da10d9de8d02fb15007183f5 100644 (file)
@@ -27,7 +27,7 @@ CLASS(Domination, Gametype)
     METHOD(Domination, m_generate_mapinfo, void(Gametype this, string v))
     {
         if(v == "dom_controlpoint" || v == "team_dom_point")
-            MapInfo_Map_supportedGametypes |= this.m_flags;
+            MapInfo_Map_supportedGametypes |= this.gametype_flags;
     }
     METHOD(Domination, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns))
     {
index ede5f9b42d05cb9424646fbb82cd04a9e65570d1..316b6c341ec1584466495724d2569c8fd39b0871 100644 (file)
@@ -18,7 +18,7 @@ CLASS(Duel, Gametype)
         {
             // if this is set, all DM maps support duel too
             // TODO: we should really check the size of maps, some DM maps do not work for duel!
-            if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags))
+            if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.gametype_flags))
                 return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported)
         }
         return false;
index 7ac091d5cd31cb3858d4ac6e267978a7b4c66c8f..71f6b7d143486643813969527f5c231359c971a8 100644 (file)
@@ -19,7 +19,7 @@ CLASS(Invasion, Gametype)
     METHOD(Invasion, m_generate_mapinfo, void(Gametype this, string v))
     {
         if(v == "invasion_spawnpoint")
-            MapInfo_Map_supportedGametypes |= this.m_flags;
+            MapInfo_Map_supportedGametypes |= this.gametype_flags;
     }
     METHOD(Invasion, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns))
     {
index 930e3067b10e9ee72e52e4b45dcfd539a259a4e7..68237e4658d71cf03445ed93a9f1204138347211 100644 (file)
@@ -15,11 +15,11 @@ CLASS(mayhem, Gametype)
        }
        METHOD(mayhem, m_isForcedSupported, bool(Gametype this))
        {
-               if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags))
+               if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.gametype_flags))
                {
                        return true;
                }
-               if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.m_flags))
+               if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.gametype_flags))
                {
                        return true;
                }
index be11699dd27b2a1e4773db045b9342fe0b964b2d..845fb2ec11161888a04e7d13d63a5ec44dbae3c0 100644 (file)
@@ -13,7 +13,7 @@ CLASS(NexBall, Gametype)
     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;
+            MapInfo_Map_supportedGametypes |= this.gametype_flags;
     }
     METHOD(NexBall, m_isTwoBaseMode, bool())
     {
index 3e7dece709b3b2e35bb665c34360bfa3bc0327a0..fc3938b9240521c192c94c9ac90a9756e9d56705 100644 (file)
@@ -10,7 +10,7 @@ CLASS(Onslaught, Gametype)
     METHOD(Onslaught, m_generate_mapinfo, void(Gametype this, string v))
     {
         if(v == "onslaught_generator")
-            MapInfo_Map_supportedGametypes |= this.m_flags;
+            MapInfo_Map_supportedGametypes |= this.gametype_flags;
     }
     METHOD(Onslaught, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns))
     {
index 2eed3433f452813ebafa2a2ea7d12412f1044730..ddc11089c12116cfc1d142affbdd964aedc49fd3 100644 (file)
@@ -26,7 +26,7 @@ CLASS(Race, Gametype)
     METHOD(Race, m_generate_mapinfo, void(Gametype this, string v))
     {
         if(v == "trigger_race_checkpoint")
-            MapInfo_Map_supportedGametypes |= this.m_flags;
+            MapInfo_Map_supportedGametypes |= this.gametype_flags;
     }
     METHOD(Race, m_isTwoBaseMode, bool())
     {
index baddfb5c26ec7cacddc4e1748f9bd57ecfebf783..7c5d8c7c40263af6403529534e9b396768b196f1 100644 (file)
@@ -20,7 +20,7 @@ CLASS(Survival, Gametype)
         if(!cvar("g_survival_not_lms_maps"))
         {
             // if this is unset, all LMS maps support Survival too
-            if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS.m_flags))
+            if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_LMS.gametype_flags))
                 return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported)
         }
         return false;
index eeee581f42166f22a118be82f15673a537f4f35b..ab7a16427c5a954d9b76dd0a9b5f3e0107da213f 100644 (file)
@@ -32,7 +32,7 @@ CLASS(TeamDeathmatch, Gametype)
         if(cvar("g_tdm_on_dm_maps"))
         {
             // if this is set, all DM maps support TDM too
-            if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags))
+            if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.gametype_flags))
                 return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported)
         }
         return false;
index c6de0eefd23e9dcb03bfcf630493f4e8c0488d90..af9d60db3af7dc3aa908b97d715a4dcb161a2d09 100644 (file)
@@ -36,13 +36,13 @@ CLASS(TeamKeepaway, Gametype)
         if(cvar("g_tka_on_ka_maps"))
         {
             // if this is set, all KA maps support TKA too
-            if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEEPAWAY.m_flags))
+            if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEEPAWAY.gametype_flags))
                 return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported)
         }
         if(cvar("g_tka_on_tdm_maps"))
         {
             // if this is set, all TDM maps support TKA too
-            if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.m_flags))
+            if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.gametype_flags))
                 return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported)
         }
         return false;
index 6e37f666fc2dac667f06ccaf60729c63d02211bd..5280e79fc8a8c69b26597eecb91a9d98fcc15089 100644 (file)
@@ -28,10 +28,10 @@ CLASS(tmayhem, Gametype)
        }
        METHOD(tmayhem, m_isForcedSupported, bool(Gametype this))
        {
-               if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags)){
+               if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.gametype_flags)){
                        return true;
                }
-               if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.m_flags)){
+               if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.gametype_flags)){
                        return true;
                }
                return false;
index 707c6826ceb555270e865a99fcdd1f24171cc388..677a5f8f7af52f03daa6db8b4cf667144094483e 100644 (file)
@@ -17,6 +17,23 @@ int autocvar_g_mapinfo_q3compat = 1;
        #define WARN_COND false
 #endif
 
+vector _GametypeFlags_FromGametype(int a)
+{
+       if (REGISTRY_MAX(Gametypes) > 24)
+               if (a >= 24)
+               {
+                       a -= 24;
+                       if (REGISTRY_MAX(Gametypes) > 48)
+                               if (a >= 24)
+                               {
+                                       a -= 24;
+                                       return '0 0 1' * BIT(a);
+                               }
+                       return '0 1 0' * BIT(a);
+               }
+       return '1 0 0' * BIT(a);
+}
+
 // generic string stuff
 
 int _MapInfo_Cache_Active;
@@ -71,7 +88,7 @@ void MapInfo_Cache_Store()
        bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, MapInfo_Map_titlestring);
        bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, MapInfo_Map_description);
        bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, MapInfo_Map_author);
-       bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, ftos(MapInfo_Map_supportedGametypes));
+       bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, vtos(MapInfo_Map_supportedGametypes));
        bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, ftos(MapInfo_Map_supportedFeatures));
        bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, ftos(MapInfo_Map_flags));
 }
@@ -94,7 +111,7 @@ float MapInfo_Cache_Retrieve(string map)
        MapInfo_Map_titlestring = bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i);
        MapInfo_Map_description = bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i);
        MapInfo_Map_author = bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i);
-       MapInfo_Map_supportedGametypes = stof(bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i));
+       MapInfo_Map_supportedGametypes = stov(bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i));
        MapInfo_Map_supportedFeatures = stof(bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i));
        MapInfo_Map_flags = stof(bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i));
 
@@ -159,9 +176,9 @@ float _MapInfo_FilterList_cmp(float i, float j, entity pass)
 
 float MapInfo_FilterGametype(Gametype pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
 {
-       return _MapInfo_FilterGametype(pGametype.m_flags, pFeatures, pFlagsRequired, pFlagsForbidden, pAbortOnGenerate);
+       return _MapInfo_FilterGametype(pGametype.gametype_flags, pFeatures, pFlagsRequired, pFlagsForbidden, pAbortOnGenerate);
 }
-float _MapInfo_FilterGametype(int pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
+float _MapInfo_FilterGametype(vector pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
 {
        float i, j;
        if (!_MapInfo_filtered_allocated)
@@ -179,7 +196,7 @@ float _MapInfo_FilterGametype(int pGametype, int pFeatures, int pFlagsRequired,
                                MapInfo_progress = i / _MapInfo_globcount;
                                return 0;
                        }
-               if((MapInfo_Map_supportedGametypes & pGametype) != 0)
+               if(MapInfo_Map_supportedGametypes & pGametype)
                if((MapInfo_Map_supportedFeatures & pFeatures) == pFeatures)
                if((MapInfo_Map_flags & pFlagsForbidden) == 0)
                if((MapInfo_Map_flags & pFlagsRequired) == pFlagsRequired)
@@ -397,27 +414,27 @@ 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);
+       vector twoBaseModes = '0 0 0';
+       FOREACH(Gametypes, it.m_isTwoBaseMode(), twoBaseModes |= it.gametype_flags);
        if(twoBaseModes && (twoBaseModes &= MapInfo_Map_supportedGametypes))
        {
                // we have a symmetrical map, don't add the modes without bases
        }
        else if(!is_q3df_map)
        {
-               FOREACH(Gametypes, it.m_isAlwaysSupported(it, spawnpoints, diameter), MapInfo_Map_supportedGametypes |= it.m_flags);
+               FOREACH(Gametypes, it.m_isAlwaysSupported(it, spawnpoints, diameter), MapInfo_Map_supportedGametypes |= it.gametype_flags);
        }
 
-       if(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE.m_flags)
+       if(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE.gametype_flags)
        if(!spawnplaces)
        {
-               MapInfo_Map_supportedGametypes &= ~MAPINFO_TYPE_RACE.m_flags;
-               MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTS.m_flags;
+               MapInfo_Map_supportedGametypes &= ~MAPINFO_TYPE_RACE.gametype_flags;
+               MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTS.gametype_flags;
        }
 
        LOG_TRACE("-> diameter ",    ftos(diameter));
        LOG_TRACE(";  spawnpoints ", ftos(spawnpoints));
-       LOG_TRACE(";  modes ",       ftos(MapInfo_Map_supportedGametypes));
+       LOG_TRACE(";  modes ",       vtos(MapInfo_Map_supportedGametypes));
 
        fclose(fh);
 
@@ -430,7 +447,7 @@ void _MapInfo_Map_Reset()
        MapInfo_Map_titlestring = "<TITLE>";
        MapInfo_Map_description = "<DESCRIPTION>";
        MapInfo_Map_author = "<AUTHOR>";
-       MapInfo_Map_supportedGametypes = 0;
+       MapInfo_Map_supportedGametypes = '0 0 0';
        MapInfo_Map_supportedFeatures = 0;
        MapInfo_Map_flags = 0;
        MapInfo_Map_clientstuff = "";
@@ -447,8 +464,8 @@ string _MapInfo_GetDefault(Gametype t)
 void _MapInfo_Map_ApplyGametype(string s, Gametype pWantedType, Gametype pThisType, int load_default)
 {
        string sa;
-       MapInfo_Map_supportedGametypes |= pThisType.m_flags;
-       if(!(pThisType.m_flags & pWantedType.m_flags))
+       MapInfo_Map_supportedGametypes |= pThisType.gametype_flags;
+       if(!(pThisType.gametype_flags & pWantedType.gametype_flags))
                return;
 
        if(load_default)
@@ -526,8 +543,8 @@ float _MapInfo_GetTeamPlayBool(Gametype t)
 
 void _MapInfo_Map_ApplyGametypeEx(string s, Gametype pWantedType, Gametype pThisType)
 {
-       MapInfo_Map_supportedGametypes |= pThisType.m_flags;
-       if (!(pThisType.m_flags & pWantedType.m_flags))
+       MapInfo_Map_supportedGametypes |= pThisType.gametype_flags;
+       if (!(pThisType.gametype_flags & pWantedType.gametype_flags))
                return;
 
        // reset all the cvars to their defaults
@@ -815,7 +832,7 @@ bool _MapInfo_ParseArena(string arena_filename, int fh, string pFilename, Gamety
        string stored_Map_description = "";
        string stored_Map_title = "";
        string stored_Map_author = "";
-       int stored_supportedGametypes = 0;
+       vector stored_supportedGametypes = '0 0 0';
        int stored_supportedFeatures = 0;
        int stored_flags = 0;
        string t, s;
@@ -862,7 +879,7 @@ bool _MapInfo_ParseArena(string arena_filename, int fh, string pFilename, Gamety
                                        MapInfo_Map_supportedGametypes |= stored_supportedGametypes;
                                else
                                {
-                                       FOREACH(Gametypes, it.m_flags & stored_supportedGametypes,
+                                       FOREACH(Gametypes, it.gametype_flags & stored_supportedGametypes,
                                        {
                                                _MapInfo_Map_ApplyGametype ("", pGametypeToSet, it, true);
                                        });
@@ -877,7 +894,7 @@ bool _MapInfo_ParseArena(string arena_filename, int fh, string pFilename, Gamety
                                stored_Map_description = "";
                                stored_Map_title = "";
                                stored_Map_author = "";
-                               stored_supportedGametypes = 0;
+                               stored_supportedGametypes = '0 0 0';
                                stored_supportedFeatures = 0;
                                stored_flags = 0;
                                continue;
@@ -935,14 +952,14 @@ bool _MapInfo_ParseArena(string arena_filename, int fh, string pFilename, Gamety
                        {
                                Gametype f = MapInfo_Type_FromString(it, false, true);
                                if(f)
-                                       stored_supportedGametypes |= f.m_flags;
+                                       stored_supportedGametypes |= f.gametype_flags;
                        });
                }
                else if(t == "style" && isdefi)
                {
                        // we have a defrag map on our hands, add CTS!
                        // TODO: styles
-                       stored_supportedGametypes |= MAPINFO_TYPE_CTS.m_flags;
+                       stored_supportedGametypes |= MAPINFO_TYPE_CTS.gametype_flags;
                }
                else if(t == "map")
                {
@@ -1118,7 +1135,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, Gamet
                        if(MapInfo_Map_flags & MAPINFO_FLAG_FRUSTRATING)
                                fputs(fh, "frustrating\n");
 
-                       FOREACH(Gametypes, MapInfo_Map_supportedGametypes & it.m_flags, {
+                       FOREACH(Gametypes, MapInfo_Map_supportedGametypes & it.gametype_flags, {
                                fputs(fh, sprintf("gametype %s // defaults: %s\n", MapInfo_Type_ToString(it), _MapInfo_GetDefaultEx(it)));
                        });
 
@@ -1266,7 +1283,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, Gamet
                        Gametype f = NULL;
                        if(all || (f = MapInfo_Type_FromString(t, true, false)))
                        {
-                               if((all ? MAPINFO_TYPE_ALL : f.m_flags) & pGametypeToSet.m_flags)
+                               if((all ? MAPINFO_TYPE_ALL : f.gametype_flags) & pGametypeToSet.gametype_flags)
                                {
                                        _MapInfo_Parse_Settemp(pFilename, acl, 0, s, 1);
                                }
@@ -1283,7 +1300,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, Gamet
                        Gametype f = NULL;
                        if(all || (f = MapInfo_Type_FromString(t, true, false)))
                        {
-                               if((all ? MAPINFO_TYPE_ALL : f.m_flags) & pGametypeToSet.m_flags)
+                               if((all ? MAPINFO_TYPE_ALL : f.gametype_flags) & pGametypeToSet.gametype_flags)
                                {
                                        _MapInfo_Parse_Settemp(pFilename, acl, 1, s, 1);
                                }
@@ -1359,7 +1376,7 @@ LABEL(mapinfo_handled)
                MapInfo_Map_author = ""; // don't display "<AUTHOR>" in the UI (we do write it to .mapinfo files)
 
        MapInfo_Cache_Store();
-       if(MapInfo_Map_supportedGametypes != 0)
+       if(MapInfo_Map_supportedGametypes != '0 0 0')
                return r;
        if (WARN_COND)
                LOG_WARN("Map ", pFilename, " supports no game types, ignored");
@@ -1373,7 +1390,7 @@ int MapInfo_Get_ByName(string pFilename, float pAllowGenerate, Gametype pGametyp
 
        if(pGametypeToSet)
        {
-               if(!(MapInfo_Map_supportedGametypes & pGametypeToSet.m_flags))
+               if(!(MapInfo_Map_supportedGametypes & pGametypeToSet.gametype_flags))
                {
                        error("Can't select the requested game type. This should never happen as the caller should prevent it!\n");
                        //_MapInfo_Map_ApplyGametypeEx("", pGametypeToSet, MAPINFO_TYPE_DEATHMATCH);
@@ -1476,7 +1493,7 @@ float _MapInfo_CheckMap(string s, bool gametype_only) // returns 0 if the map ca
 {
        if(!MapInfo_Get_ByName(s, 1, NULL))
                return 0;
-       if((MapInfo_Map_supportedGametypes & MapInfo_CurrentGametype().m_flags) == 0)
+       if(!(MapInfo_Map_supportedGametypes & MapInfo_CurrentGametype().gametype_flags))
                return 0;
        if (gametype_only)
                return 1;
@@ -1500,12 +1517,12 @@ void MapInfo_SwitchGameType(Gametype t)
 
 void MapInfo_LoadMap(string s, float reinit)
 {
-       MapInfo_Map_supportedGametypes = 0;
+       MapInfo_Map_supportedGametypes = '0 0 0';
        // we shouldn't need this, as LoadMapSettings already fixes the gametype
        //if(!MapInfo_CheckMap(s))
        //{
        //      print("EMERGENCY: can't play the selected map in the given game mode. Falling back to DM.\n");
-       //      MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH.m_flags);
+       //      MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH.gametype_flags);
        //}
 
        LOG_INFO("Switching to map ", s);
@@ -1569,12 +1586,12 @@ void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
                        return; // do not call Get_ByName!
                }
 
-               if(MapInfo_Map_supportedGametypes == 0)
+               if(MapInfo_Map_supportedGametypes == '0 0 0')
                {
                        RandomSelection_Init();
                        FOREACH(Gametypes, it.m_priority == 2, 
                        {
-                               MapInfo_Map_supportedGametypes |= it.m_flags;
+                               MapInfo_Map_supportedGametypes |= it.gametype_flags;
                                RandomSelection_AddEnt(it, 1, 1);
                        });
                        if(RandomSelection_chosen_ent)
@@ -1597,7 +1614,7 @@ void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
 #endif
                RandomSelection_Init();
                Gametype t_prev = t;
-               FOREACH(Gametypes, MapInfo_Map_supportedGametypes & it.m_flags,
+               FOREACH(Gametypes, MapInfo_Map_supportedGametypes & it.gametype_flags,
                {
                        RandomSelection_AddEnt(it, 1, it.m_priority);
                });
@@ -1622,7 +1639,7 @@ void MapInfo_ClearTemps()
        MapInfo_Map_description = string_null;
        MapInfo_Map_author = string_null;
        MapInfo_Map_clientstuff = string_null;
-       MapInfo_Map_supportedGametypes = 0;
+       MapInfo_Map_supportedGametypes = '0 0 0';
        MapInfo_Map_supportedFeatures = 0;
 }
 
index 4d65695ae41a9391d19b1f145440c1942bfc5e70..e1368871ec070e556a1c606c9ca55235a5c6c869 100644 (file)
@@ -10,7 +10,7 @@ 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;
+vector MapInfo_Map_supportedGametypes;
 int MapInfo_Map_supportedFeatures;
 int MapInfo_Map_flags;
 vector MapInfo_Map_mins; // these are '0 0 0' if not supported!
@@ -24,8 +24,11 @@ const int GAMETYPE_FLAG_HIDELIMITS      = BIT(4); // don't display a score limit
 const int GAMETYPE_FLAG_WEAPONARENA     = BIT(5); // gametype has a forced weapon arena, weapon arena mutators should disable themselves when this is set
 const int GAMETYPE_FLAG_1V1             = BIT(6); // 1v1 gameplay
 
-int MAPINFO_TYPE_ALL;
-.int m_flags;
+vector MAPINFO_TYPE_ALL;
+.vector gametype_flags;
+
+// must be defined before the registry
+vector _GametypeFlags_FromGametype(int a);
 
 CLASS(Gametype, Object)
     ATTRIB(Gametype, m_id, int, 0);
@@ -115,9 +118,6 @@ CLASS(Gametype, Object)
         this.m_hidelimits = (gflags & GAMETYPE_FLAG_HIDELIMITS);
         this.m_weaponarena = (gflags & GAMETYPE_FLAG_WEAPONARENA);
         this.m_1v1 = (gflags & GAMETYPE_FLAG_1V1);
-
-        // same as `1 << m_id`
-        MAPINFO_TYPE_ALL |= this.items = this.m_flags = (MAPINFO_TYPE_ALL + 1);
     }
 ENDCLASS(Gametype)
 
@@ -127,7 +127,15 @@ REGISTRY_SORT(Gametypes)
 REGISTRY_CHECK(Gametypes)
 
 REGISTRY_DEFINE_GET(Gametypes, NULL)
-STATIC_INIT(Gametypes_renumber) { FOREACH(Gametypes, true, it.m_id = i); }
+STATIC_INIT(Gametypes_renumber)
+{
+    FOREACH(Gametypes, true,
+    {
+        it.m_id = i;
+        vector set = it.gametype_flags = _GametypeFlags_FromGametype(it.m_id);
+        MAPINFO_TYPE_ALL |= set;
+    });
+}
 #define REGISTER_GAMETYPE(NAME, inst) REGISTER(Gametypes, MAPINFO_TYPE, NAME, m_id, inst)
 
 #ifndef CSQC
@@ -154,7 +162,7 @@ void MapInfo_Enumerate();
 // filter the info by game type mask (updates MapInfo_count)
 float MapInfo_progress;
 float MapInfo_FilterGametype(Gametype gametypeFlags, float features, float pFlagsRequired, float pFlagsForbidden, float pAbortOnGenerate); // 1 on success, 0 on temporary failure (call it again next frame then; use MapInfo_progress as progress indicator)
-float _MapInfo_FilterGametype(int gametypeFlags, float features, float pFlagsRequired, float pFlagsForbidden, float pAbortOnGenerate); // 1 on success, 0 on temporary failure (call it again next frame then; use MapInfo_progress as progress indicator)
+float _MapInfo_FilterGametype(vector gametypeFlags, float features, float pFlagsRequired, float pFlagsForbidden, float pAbortOnGenerate); // 1 on success, 0 on temporary failure (call it again next frame then; use MapInfo_progress as progress indicator)
 void MapInfo_FilterString(string sf); // filter _MapInfo_filtered (created by MapInfo_FilterGametype) with keyword
 int MapInfo_CurrentFeatures(); // retrieves currently required features from cvars
 Gametype MapInfo_CurrentGametype(); // retrieves current gametype from cvars
index d32bd0f8401eee0314deff72edef2468ae4e3f27..80de0be2730d5573587eccb87063139aa43d4f4b 100644 (file)
@@ -33,7 +33,7 @@ void XonoticMapInfoDialog_loadMapInfo(entity me, int i, entity mlb)
        {
                entity e;
                e = me.(typeLabels[i]);
-               e.disabled = !(MapInfo_Map_supportedGametypes & GameType_GetID(i).m_flags);
+               e.disabled = !(MapInfo_Map_supportedGametypes & GameType_GetID(i).gametype_flags);
        }
 
        MapInfo_ClearTemps();
index b9d19f611dfdd61f6beae00b05181161cd7872d6..72969a0ab8d4169e3c81dab4ea0863c8ceaf7738 100644 (file)
@@ -73,24 +73,25 @@ int GameTypeVote_AvailabilityStatus(string type_name)
        {
                if ( !MapInfo_Get_ByName(autocvar_nextmap, false, NULL) )
                        return flag;
-               if (!(MapInfo_Map_supportedGametypes & type.m_flags))
+               if (!(MapInfo_Map_supportedGametypes & type.gametype_flags))
                        return flag;
        }
 
        return flag | GTV_AVAILABLE;
 }
 
-int GameTypeVote_GetMask()
+vector GameTypeVote_GetMask()
 {
-       int n, j, gametype_mask;
+       int n, j;
+       vector gametype_mask;
        n = tokenizebyseparator(autocvar_sv_vote_gametype_options, " ");
        n = min(MAPVOTE_COUNT, n);
-       gametype_mask = 0;
+       gametype_mask = '0 0 0';
        for(j = 0; j < n; ++j)
-               gametype_mask |= GameTypeVote_Type_FromString(argv(j)).m_flags;
+               gametype_mask |= GameTypeVote_Type_FromString(argv(j)).gametype_flags;
 
-       if (gametype_mask == 0)
-               gametype_mask |= MapInfo_CurrentGametype().m_flags;
+       if (gametype_mask == '0 0 0')
+               gametype_mask |= MapInfo_CurrentGametype().gametype_flags;
 
        return gametype_mask;
 }