diff --git a/.vscode/settings.json b/.vscode/settings.json index e867125e..36a8d2be 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -79,6 +79,7 @@ "ios": "cpp", "locale": "cpp", "queue": "cpp", - "stack": "cpp" + "stack": "cpp", + "span": "cpp" } } \ No newline at end of file diff --git a/Crawler/Crawler b/Crawler/Crawler new file mode 100755 index 00000000..dcc8bd1d Binary files /dev/null and b/Crawler/Crawler differ diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 67c6e863..eddf7bbf 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -1003,6 +1003,7 @@ MapName Crawler::GetCurrentLevel(){ int main() { + std::cout< using namespace olc; @@ -40,6 +41,7 @@ struct Map{ std::vector TilesetData; std::vector LayerData; std::vector SpawnerData; + std::map>> ZoneData; std::string FormatLayerData(std::ostream& os, std::vectortiles); std::string FormatSpawnerData(std::ostream& os, std::vectortiles); friend std::ostream& operator << (std::ostream& os, Map& rhs); @@ -57,7 +59,6 @@ class TMXParser{ public: TMXParser(std::string file); }; - #ifdef TMX_PARSER_SETUP #undef TMX_PARSER_SETUP const std::string XMLTag::FormatTagData(std::maptiles){ @@ -201,7 +202,7 @@ class TMXParser{ if (newTag.tag=="layer") { LayerTag l = {newTag}; parsedMapInfo.LayerData.push_back(l); - } else + }else if (newTag.tag=="object"&&newTag.data["type"]=="SpawnGroup") { if(buildingSpawner){ parsedMapInfo.SpawnerData.push_back(obj); @@ -213,6 +214,17 @@ class TMXParser{ if (newTag.tag=="object"&&newTag.data["type"]=="PlayerSpawnLocation") { parsedMapInfo.MapData.playerSpawnLocation={newTag.GetInteger("x")-newTag.GetInteger("width")/2,newTag.GetInteger("y")-newTag.GetInteger("height")/2}; } else + if (newTag.tag=="object"&&newTag.data.find("type")!=newTag.data.end()){ + //This is an object with a type that doesn't fit into other categories, we can add it to ZoneData. + if(parsedMapInfo.ZoneData.find(newTag.data["type"])!=parsedMapInfo.ZoneData.end()){ + std::vector>&zones=parsedMapInfo.ZoneData[newTag.data["type"]]; + zones.push_back({{newTag.GetInteger("x"),newTag.GetInteger("y")},{newTag.GetInteger("width"),newTag.GetInteger("height")}}); + } else { + std::vector>zones; + zones.push_back({{newTag.GetInteger("x"),newTag.GetInteger("y")},{newTag.GetInteger("width"),newTag.GetInteger("height")}}); + parsedMapInfo.ZoneData[newTag.data["type"]]=zones; + } + } if (newTag.tag=="property"&&buildingSpawner) { if(newTag.data["propertytype"]=="MonsterName"){ obj.properties.push_back(newTag); diff --git a/Crawler/pixelGameEngine.o b/Crawler/pixelGameEngine.o new file mode 100644 index 00000000..d273f0ca Binary files /dev/null and b/Crawler/pixelGameEngine.o differ