]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapinfo.qc
Merge remote-tracking branch 'origin/terencehill/mutators_dialog_cleanup'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapinfo.qc
index 3a72f7387687ae9d942cd2b17f203d91091bbafb..05c93865dbcceed7c2606d9cb567b727e3fe8ad7 100644 (file)
@@ -242,6 +242,8 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp
        spawnpoints = 0;
        spawnplaces = 0;
        _MapInfo_Map_worldspawn_music = "";
+       mapMins = '0 0 0';
+       mapMaxs = '0 0 0';
 
        for(;;)
        {
@@ -472,8 +474,7 @@ void _MapInfo_Map_ApplyGametype(string s, float pWantedType, float pThisType, fl
        {
                sa = car(s);
                if(sa != "")
-                       if(cvar("g_ctf_win_mode") < 2)
-                               cvar_set("fraglimit", sa);
+                       cvar_set("fraglimit", sa);
                s = cdr(s);
        }
 
@@ -537,8 +538,8 @@ string _MapInfo_GetDefaultEx(float t)
 {
        entity e;
        for(e = MapInfo_Type_first; e; e = e.enemy)
-               if(t == e.weapons)
-                       return e.message;
+               if(t == e.items)
+                       return e.model2;
        return "";
 }
 
@@ -547,7 +548,6 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType)
        string sa, k, v;
        float p;
        string fraglimit_normal;
-       string fraglimit_caps;
        string fraglimit_teams;
 
        MapInfo_Map_supportedGametypes |= pThisType;
@@ -565,7 +565,6 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType)
        cvar_set("g_race_qualifying_timelimit", cvar_defstring("g_race_qualifying_timelimit"));
 
        fraglimit_normal = string_null;
-       fraglimit_caps = string_null;
        fraglimit_teams = string_null;
 
        s = strcat(_MapInfo_GetDefaultEx(pWantedType), " ", s);
@@ -597,14 +596,10 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType)
                {
                        cvar_set("leadlimit", v);
                }
-               else if(k == "pointlimit" || k == "fraglimit" || k == "lives" || k == "laplimit")
+               else if(k == "pointlimit" || k == "fraglimit" || k == "lives" || k == "laplimit" || k == "caplimit")
                {
                        fraglimit_normal = v;
                }
-               else if(k == "caplimit")
-               {
-                       fraglimit_caps = v;
-               }
                else if(k == "teampointlimit" || k == "teamlaplimit")
                {
                        fraglimit_teams = v;
@@ -629,12 +624,7 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType)
                }
        }
 
-       if(pWantedType == MAPINFO_TYPE_CTF && cvar("g_ctf_win_mode") < 2)
-       {
-               if(fraglimit_caps)
-                       cvar_set("fraglimit", fraglimit_caps);
-       }
-       else if(pWantedType == MAPINFO_TYPE_RACE && cvar("g_race_teams") >= 2)
+       if(pWantedType == MAPINFO_TYPE_RACE && cvar("g_race_teams") >= 2)
        {
                if(fraglimit_teams)
                        cvar_set("fraglimit", fraglimit_teams);
@@ -649,11 +639,29 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType)
 float MapInfo_Type_FromString(string t)
 {
        entity e;
+       if(t == "nexball")
+       {
+               print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t);
+               t = "nb";
+               print("'. Should use '", t, "'.\n");
+       }
+       if(t == "freezetag")
+       {
+               print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t);
+               t = "ft";
+               print("'. Should use '", t, "'.\n");
+       }
+       if(t == "keepaway")
+       {
+               print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t);
+               t = "ka";
+               print("'. Should use '", t, "'.\n");
+       }
        if(t == "all")
                return MAPINFO_TYPE_ALL;
        for(e = MapInfo_Type_first; e; e = e.enemy)
                if(t == e.mdl)
-                       return e.weapons;
+                       return e.items;
        return 0;
 }
 
@@ -663,11 +671,20 @@ string MapInfo_Type_ToString(float t)
        if(t == MAPINFO_TYPE_ALL)     
                return "all";
        for(e = MapInfo_Type_first; e; e = e.enemy)
-               if(t == e.weapons)
+               if(t == e.items)
                        return e.mdl;
        return "";
 }
 
+string MapInfo_Type_ToText(float t)
+{
+       entity e;
+       for(e = MapInfo_Type_first; e; e = e.enemy)
+               if(t == e.items)
+                       return e.message;
+       return _("@!#%'n Tuba Throwing");
+}
+
 void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s, float recurse)
 {
        string t;
@@ -928,7 +945,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo
                        MapInfo_Map_author = s;
                else if(t == "has")
                {
-                       t = car(s); s = cdr(s);
+                       t = car(s); // s = cdr(s);
                        if     (t == "weapons") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS;
                        else if(t == "turrets") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_TURRETS;
                        else if(t == "vehicles") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_VEHICLES;
@@ -1160,8 +1177,8 @@ float MapInfo_CurrentGametype()
        prev = cvar("gamecfg");
        for(e = MapInfo_Type_first; e; e = e.enemy)
                if(cvar(e.netname))
-                       if(prev != e.weapons)
-                               return e.weapons;
+                       if(prev != e.items)
+                               return e.items;
        if(prev)
                return prev;
        return MAPINFO_TYPE_DEATHMATCH;
@@ -1190,7 +1207,7 @@ void MapInfo_SwitchGameType(float t)
 {
        entity e;
        for(e = MapInfo_Type_first; e; e = e.enemy)
-               cvar_set(e.netname, (t == e.weapons) ? "1" : "0");
+               cvar_set(e.netname, (t == e.items) ? "1" : "0");
 }
 
 void MapInfo_LoadMap(string s, float reinit)