Merge branch 'samual/keepaway' into fruitiex/freezetag_vs_keepaway
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapinfo.qc
index 187bf63..35a827f 100644 (file)
@@ -351,6 +351,7 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp
 
                if(spawnpoints >= 8  && diameter > 4096) {
                        MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_TEAM_DEATHMATCH;
+                       MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_FREEZETAG;
                        MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CA;
                }
                if(                     diameter < 4096)
@@ -407,6 +408,7 @@ string _MapInfo_GetDefault(float t)
                case MAPINFO_TYPE_ONSLAUGHT:       return "20 0";
                case MAPINFO_TYPE_NEXBALL:         return "5 20 0";
                case MAPINFO_TYPE_CTS:             return "20 0 0";
+               case MAPINFO_TYPE_FREEZETAG:       return "10 20 0";
                case MAPINFO_TYPE_KEEPAWAY:        return "30 20 0";
                default:                           return "";
        }
@@ -536,6 +538,7 @@ string _MapInfo_GetDefaultEx(float t)
                case MAPINFO_TYPE_ONSLAUGHT:       return "timelimit=20";
                case MAPINFO_TYPE_NEXBALL:         return "timelimit=20 pointlimit=5 leadlimit=0";
                case MAPINFO_TYPE_CTS:             return "timelimit=20 skill=-1";
+               case MAPINFO_TYPE_FREEZETAG:       return "timelimit=20 pointlimit=10 teams=2 leadlimit=0";
                case MAPINFO_TYPE_KEEPAWAY:        return "timelimit=20 pointlimit=30";
                default:                           return "";
        }
@@ -661,6 +664,7 @@ float MapInfo_Type_FromString(string t)
        else if(t == "rc")      return MAPINFO_TYPE_RACE;
        else if(t == "nexball") return MAPINFO_TYPE_NEXBALL;
        else if(t == "cts")     return MAPINFO_TYPE_CTS;
+       else if(t == "freezetag")       return MAPINFO_TYPE_FREEZETAG;
        else if(t == "keepaway") return MAPINFO_TYPE_KEEPAWAY;
        else if(t == "all")     return MAPINFO_TYPE_ALL;
        else                    return 0;
@@ -682,6 +686,7 @@ string MapInfo_Type_ToString(float t)
        else if(t == MAPINFO_TYPE_RACE)            return "rc";
        else if(t == MAPINFO_TYPE_NEXBALL)         return "nexball";
        else if(t == MAPINFO_TYPE_CTS)             return "cts";
+       else if(t == MAPINFO_TYPE_FREEZETAG)       return "freezetag";
        else if(t == MAPINFO_TYPE_KEEPAWAY)        return "keepaway";
        else if(t == MAPINFO_TYPE_ALL)             return "all";
        else                                       return "";
@@ -1147,6 +1152,8 @@ float MapInfo_CurrentGametype()
                return MAPINFO_TYPE_NEXBALL;
        else if(cvar("g_cts"))
                return MAPINFO_TYPE_CTS;
+       else if(cvar("g_freezetag"))
+               return MAPINFO_TYPE_FREEZETAG;
        else if(cvar("g_keepaway"))
                return MAPINFO_TYPE_KEEPAWAY;
        else
@@ -1176,20 +1183,21 @@ string MapInfo_GetGameTypeCvar(float t)
 {
        switch(t)
        {
-               case MAPINFO_TYPE_DEATHMATCH:           return "g_dm";
-               case MAPINFO_TYPE_TEAM_DEATHMATCH:      return "g_tdm";
-               case MAPINFO_TYPE_DOMINATION:           return "g_domination";
-               case MAPINFO_TYPE_CTF:                  return "g_ctf";
-               case MAPINFO_TYPE_RUNEMATCH:            return "g_runematch";
-               case MAPINFO_TYPE_LMS:                  return "g_lms";
-               case MAPINFO_TYPE_ARENA:                        return "g_arena";
-               case MAPINFO_TYPE_CA:                   return "g_ca";
-               case MAPINFO_TYPE_KEYHUNT:              return "g_kh";
-               case MAPINFO_TYPE_ASSAULT:              return "g_assault";
-               case MAPINFO_TYPE_ONSLAUGHT:            return "g_onslaught";
-               case MAPINFO_TYPE_RACE:                         return "g_race";
-               case MAPINFO_TYPE_NEXBALL:              return "g_nexball";
-               case MAPINFO_TYPE_CTS:                  return "g_cts";
+               case MAPINFO_TYPE_DEATHMATCH: return "g_dm";
+               case MAPINFO_TYPE_TEAM_DEATHMATCH: return "g_tdm";
+               case MAPINFO_TYPE_DOMINATION: return "g_domination";
+               case MAPINFO_TYPE_CTF: return "g_ctf";
+               case MAPINFO_TYPE_RUNEMATCH: return "g_runematch";
+               case MAPINFO_TYPE_LMS: return "g_lms";
+               case MAPINFO_TYPE_ARENA: return "g_arena";
+               case MAPINFO_TYPE_CA: return "g_ca";
+               case MAPINFO_TYPE_KEYHUNT: return "g_kh";
+               case MAPINFO_TYPE_ASSAULT: return "g_assault";
+               case MAPINFO_TYPE_ONSLAUGHT: return "g_onslaught";
+               case MAPINFO_TYPE_RACE: return "g_race";
+               case MAPINFO_TYPE_NEXBALL: return "g_nexball";
+               case MAPINFO_TYPE_FREEZETAG: return "g_freezetag";
+               case MAPINFO_TYPE_CTS: return "g_cts";
                case MAPINFO_TYPE_KEEPAWAY:             return "g_keepaway";
                default: return "";
        }
@@ -1212,6 +1220,7 @@ void MapInfo_SwitchGameType(float t)
        cvar_set("g_race",       (t == MAPINFO_TYPE_RACE)            ? "1" : "0");
        cvar_set("g_nexball",    (t == MAPINFO_TYPE_NEXBALL)         ? "1" : "0");
        cvar_set("g_cts",        (t == MAPINFO_TYPE_CTS)             ? "1" : "0");
+       cvar_set("g_freezetag",  (t == MAPINFO_TYPE_FREEZETAG)       ? "1" : "0");
        cvar_set("g_keepaway",   (t == MAPINFO_TYPE_KEEPAWAY)        ? "1" : "0");
 }