From e754c70f7e95175595013bdaa09fcc456bf9f634 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 6 Nov 2011 21:14:27 +0100 Subject: [PATCH] detect whether map has vehicles/turrets in mapinfo (flag is unused yet) --- qcsrc/common/mapinfo.qc | 14 ++++++++++++++ qcsrc/common/mapinfo.qh | 2 ++ 2 files changed, 16 insertions(+) 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 -- 2.39.2