From: Rudolf Polzer Date: Sun, 6 Nov 2011 20:14:27 +0000 (+0100) Subject: detect whether map has vehicles/turrets in mapinfo (flag is unused yet) X-Git-Tag: xonotic-v0.6.0~35^2~66^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e754c70f7e95175595013bdaa09fcc456bf9f634;p=xonotic%2Fxonotic-data.pk3dir.git detect whether map has vehicles/turrets in mapinfo (flag is unused yet) --- diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 469c86a2b..4ec54b0f0 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -326,6 +326,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 } @@ -896,6 +900,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"); @@ -954,6 +966,8 @@ float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametype { 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"); diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 3eb16d854..ebfc0e443 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -17,6 +17,8 @@ float MAPINFO_TYPE_KEEPAWAY = 32768; float MAPINFO_TYPE_ALL = 65535; // this has to include all above bits float MAPINFO_FEATURE_WEAPONS = 1; // not defined for minstagib-only maps +float MAPINFO_FEATURE_VEHICLES = 2; +float MAPINFO_FEATURE_TURRETS = 4; float MAPINFO_FLAG_HIDDEN = 1; // not in lsmaps/menu/vcall/etc., can just be changed to manually float MAPINFO_FLAG_FORBIDDEN = 2; // don't even allow the map by a cvar setting that allows hidden maps