X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmapinfo.qc;h=05c93865dbcceed7c2606d9cb567b727e3fe8ad7;hb=5424bd3ad212983e33860ec76d35dbcb7c5004b4;hp=469c86a2b68f18822121160a4cea454e0540099e;hpb=4337dab09bbbe024bcc77db446ed76962fb17f0d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 469c86a2b..05c93865d 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -78,6 +78,7 @@ float MapInfo_Cache_Retrieve(string map) MapInfo_Map_supportedGametypes = stof(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)); + return 1; } @@ -241,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(;;) { @@ -326,6 +329,10 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp { } else if(startsWith(v, "weapon_")) MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS; + else if(startsWith(v, "turret_")) + MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_TURRETS; + else if(startsWith(v, "vehicle_")) + MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_VEHICLES; else if(v == "target_music" || v == "trigger_music") _MapInfo_Map_worldspawn_music = string_null; // don't use regular BGM } @@ -467,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); } @@ -530,26 +536,11 @@ void _MapInfo_Map_ApplyGametype(string s, float pWantedType, float pThisType, fl string _MapInfo_GetDefaultEx(float t) { - switch(t) - { - case MAPINFO_TYPE_DEATHMATCH: return "timelimit=20 pointlimit=30 leadlimit=0"; - case MAPINFO_TYPE_TEAM_DEATHMATCH: return "timelimit=20 pointlimit=50 teams=2 leadlimit=0"; - case MAPINFO_TYPE_DOMINATION: return "timelimit=20 pointlimit=200 teams=2 leadlimit=0"; - case MAPINFO_TYPE_CTF: return "timelimit=20 pointlimit=300 caplimit=10 leadlimit=0"; - case MAPINFO_TYPE_RUNEMATCH: return "timelimit=20 pointlimit=200 leadlimit=0"; - case MAPINFO_TYPE_LMS: return "timelimit=20 lives=9 leadlimit=0"; - case MAPINFO_TYPE_ARENA: return "timelimit=20 pointlimit=10 leadlimit=0"; - case MAPINFO_TYPE_CA: return "timelimit=20 pointlimit=10 leadlimit=0"; - case MAPINFO_TYPE_KEYHUNT: return "timelimit=20 pointlimit=1000 teams=3 leadlimit=0"; - case MAPINFO_TYPE_ASSAULT: return "timelimit=20"; - case MAPINFO_TYPE_RACE: return "timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0"; - 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 ""; - } + entity e; + for(e = MapInfo_Type_first; e; e = e.enemy) + if(t == e.items) + return e.model2; + return ""; } void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType) @@ -557,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; @@ -575,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); @@ -607,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; @@ -639,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); @@ -658,46 +638,51 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType) float MapInfo_Type_FromString(string t) { - if (t == "dm") return MAPINFO_TYPE_DEATHMATCH; - else if(t == "tdm") return MAPINFO_TYPE_TEAM_DEATHMATCH; - else if(t == "dom") return MAPINFO_TYPE_DOMINATION; - else if(t == "ctf") return MAPINFO_TYPE_CTF; - else if(t == "rune") return MAPINFO_TYPE_RUNEMATCH; - else if(t == "lms") return MAPINFO_TYPE_LMS; - else if(t == "arena") return MAPINFO_TYPE_ARENA; - else if(t == "ca") return MAPINFO_TYPE_CA; - else if(t == "kh") return MAPINFO_TYPE_KEYHUNT; - else if(t == "as") return MAPINFO_TYPE_ASSAULT; - else if(t == "ons") return MAPINFO_TYPE_ONSLAUGHT; - 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; + 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.items; + return 0; } string MapInfo_Type_ToString(float t) { - if (t == MAPINFO_TYPE_DEATHMATCH) return "dm"; - else if(t == MAPINFO_TYPE_TEAM_DEATHMATCH) return "tdm"; - else if(t == MAPINFO_TYPE_DOMINATION) return "dom"; - else if(t == MAPINFO_TYPE_CTF) return "ctf"; - else if(t == MAPINFO_TYPE_RUNEMATCH) return "rune"; - else if(t == MAPINFO_TYPE_LMS) return "lms"; - else if(t == MAPINFO_TYPE_ARENA) return "arena"; - else if(t == MAPINFO_TYPE_CA) return "ca"; - else if(t == MAPINFO_TYPE_KEYHUNT) return "kh"; - else if(t == MAPINFO_TYPE_ASSAULT) return "as"; - else if(t == MAPINFO_TYPE_ONSLAUGHT) return "ons"; - 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 ""; + entity e; + if(t == MAPINFO_TYPE_ALL) + return "all"; + for(e = MapInfo_Type_first; e; e = e.enemy) + 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) @@ -826,7 +811,7 @@ float MapInfo_isRedundant(string fn, string t) } // load info about a map by name into the MapInfo_Map_* globals -float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametypeToSet) +float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, float pGametypeToSet) { string fn; string s, t; @@ -896,6 +881,14 @@ float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametype fputs(fh, "has weapons\n"); else fputs(fh, "// uncomment this if you added weapon pickups: has weapons\n"); + if(MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_TURRETS) + fputs(fh, "has turrets\n"); + else + fputs(fh, "// uncomment this if you added turrets: has turrets\n"); + if(MapInfo_Map_supportedFeatures & MAPINFO_FEATURE_VEHICLES) + fputs(fh, "has weapons\n"); + else + fputs(fh, "// uncomment this if you added vehicles: has vehicles\n"); if(MapInfo_Map_flags & MAPINFO_FLAG_FRUSTRATING) fputs(fh, "frustrating\n"); @@ -952,8 +945,10 @@ float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametype 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; else if(t == "new_toys") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS; else dprint("Map ", pFilename, " supports unknown feature ", t, ", ignored\n"); @@ -1074,16 +1069,6 @@ float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametype } fclose(fh); - if(pGametypeToSet) - { - if(!(MapInfo_Map_supportedGametypes & pGametypeToSet)) - { - 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); - //return; - } - } - if(MapInfo_Map_title == "