X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmapinfo.qc;h=3d06854578acbda85607a119a59bea958e9c4d4d;hp=21263719b32d035697b8d12cb13fe4926cde81c0;hb=d6fa4cbca32e3eb9a1c21a27e97b0c6cbc970fd5;hpb=04ab0ff7c3c5fcfe9780eadccfd5abd03d25b181 diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 21263719b..3d0685457 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -313,6 +313,8 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTF; else if(v == "team_CTF_blueflag") MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTF; + else if(v == "invasion_spawnpoint") + MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_INVASION; else if(v == "target_assault_roundend") MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_ASSAULT; else if(v == "onslaught_generator") @@ -341,6 +343,8 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_TURRETS; else if(startsWith(v, "vehicle_")) MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_VEHICLES; + else if(startsWith(v, "monster_")) + MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_MONSTERS; else if(v == "target_music" || v == "trigger_music") _MapInfo_Map_worldspawn_music = string_null; // don't use regular BGM } @@ -600,14 +604,11 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType) p = strstrofs(sa, "=", 0); if(p < 0) { - k = "timelimit"; - v = s; - } - else - { - k = substring(sa, 0, p); - v = substring(sa, p+1, -1); + print("Invalid gametype setting in mapinfo for gametype ", MapInfo_Type_ToString(pWantedType), ": ", sa, "\n"); + continue; } + k = substring(sa, 0, p); + v = substring(sa, p+1, -1); if(k == "timelimit") { @@ -632,6 +633,7 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType) cvar_set("g_freezetag_teams", v); cvar_set("g_keyhunt_teams", v); cvar_set("g_domination_default_teams", v); + cvar_set("g_invasion_teams", v); } else if(k == "qualifying_timelimit") { @@ -643,7 +645,7 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType) } else { - print("Invalid gametype key in mapinfo: ", k, "\n"); + print("Invalid gametype setting in mapinfo for gametype ", MapInfo_Type_ToString(pWantedType), ": ", sa, "\n"); } } @@ -680,6 +682,12 @@ float MapInfo_Type_FromString(string t) t = "ka"; print("'. Should use '", t, "'.\n"); } + if(t == "invasion") + { + print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t); + t = "inv"; + print("'. Should use '", t, "'.\n"); + } if(t == "all") return MAPINFO_TYPE_ALL; for(e = MapInfo_Type_first; e; e = e.enemy) @@ -688,6 +696,15 @@ float MapInfo_Type_FromString(string t) return 0; } +string MapInfo_Type_Description(float t) +{ + entity e; + for(e = MapInfo_Type_first; e; e = e.enemy) + if(t == e.items) + return e.gametype_description; + return ""; +} + string MapInfo_Type_ToString(float t) { entity e; @@ -973,6 +990,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo 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; + else if(t == "monsters") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_MONSTERS; else if(t == "new_toys") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS; else dprint("Map ", pFilename, " supports unknown feature ", t, ", ignored\n"); @@ -1127,7 +1145,8 @@ float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametype { if(!(MapInfo_Map_supportedGametypes & pGametypeToSet)) { - error("Can't select the requested game type. This should never happen as the caller should prevent it!\n"); + //error("Can't select the requested game type. This should never happen as the caller should prevent it!\n"); + return 0; //_MapInfo_Map_ApplyGametypeEx("", pGametypeToSet, MAPINFO_TYPE_DEATHMATCH); //return; } @@ -1256,14 +1275,14 @@ void MapInfo_LoadMap(string s, float reinit) localcmd(strcat("\nchangelevel ", s, "\n")); } -string MapInfo_ListAllowedMaps(float pRequiredFlags, float pForbiddenFlags) +string MapInfo_ListAllowedMaps(float type, float pRequiredFlags, float pForbiddenFlags) { string out; float i; // to make absolutely sure: MapInfo_Enumerate(); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), pRequiredFlags, pForbiddenFlags, 0); + MapInfo_FilterGametype(type, MapInfo_CurrentFeatures(), pRequiredFlags, pForbiddenFlags, 0); out = ""; for(i = 0; i < MapInfo_count; ++i)