diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp
index 7fef12a2..eaed5401 100644
--- a/Crawler/Crawler.cpp
+++ b/Crawler/Crawler.cpp
@@ -54,6 +54,7 @@ SUCH DAMAGE.
#include "Toggleable.h"
#include "Unlock.h"
#include "State_OverworldMap.h"
+#include "Test.h"
INCLUDE_EMITTER_LIST
@@ -1722,6 +1723,8 @@ void Crawler::InitializeLevels(){
INITLEVEL(BOSS_1);
INITLEVEL(CAMPAIGN_1_2);
+ Test::RunMapTests();
+
LEVEL_NAMES.SetInitialized();
}
diff --git a/Crawler/Crawler.tiled-project b/Crawler/Crawler.tiled-project
index 8fe1e713..8660ba17 100644
--- a/Crawler/Crawler.tiled-project
+++ b/Crawler/Crawler.tiled-project
@@ -61,6 +61,18 @@
"object"
]
},
+ {
+ "color": "#ff00ff33",
+ "drawFill": true,
+ "id": 23,
+ "members": [
+ ],
+ "name": "EndZone",
+ "type": "class",
+ "useAs": [
+ "object"
+ ]
+ },
{
"color": "#ffd9d929",
"drawFill": true,
@@ -98,7 +110,22 @@
"valuesAsFlags": false
},
{
- "color": "#ffc3ae44",
+ "id": 25,
+ "name": "LevelType",
+ "storageType": "string",
+ "type": "enum",
+ "values": [
+ "Dungeon",
+ "Boss",
+ "Story",
+ "Blacksmith",
+ "Unspecified",
+ "World Map"
+ ],
+ "valuesAsFlags": false
+ },
+ {
+ "color": "#fffff700",
"drawFill": true,
"id": 9,
"members": [
@@ -128,6 +155,12 @@
"drawFill": true,
"id": 19,
"members": [
+ {
+ "name": "Level Type",
+ "propertyType": "LevelType",
+ "type": "string",
+ "value": "Unspecified"
+ },
{
"name": "Optimize",
"type": "bool",
diff --git a/Crawler/Crawler.vcxproj b/Crawler/Crawler.vcxproj
index 6d53fae2..04f1de43 100644
--- a/Crawler/Crawler.vcxproj
+++ b/Crawler/Crawler.vcxproj
@@ -311,6 +311,7 @@
+
@@ -365,6 +366,7 @@
+
diff --git a/Crawler/Crawler.vcxproj.filters b/Crawler/Crawler.vcxproj.filters
index 47cddebf..f426da3e 100644
--- a/Crawler/Crawler.vcxproj.filters
+++ b/Crawler/Crawler.vcxproj.filters
@@ -249,6 +249,9 @@
Header Files\Interface
+
+ Header Files
+
@@ -416,6 +419,9 @@
Source Files\Interface
+
+ Source Files
+
diff --git a/Crawler/Error.h b/Crawler/Error.h
index 13f62f2f..6a613d98 100644
--- a/Crawler/Error.h
+++ b/Crawler/Error.h
@@ -30,7 +30,8 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#pragma once
-#include
+#include
+#include
#ifndef __EMSCRIPTEN__
#include
#endif
@@ -46,6 +47,7 @@ SUCH DAMAGE.
#undef ERR //Stupid Windows
#ifndef __EMSCRIPTEN__
+ //WARNING! err accepts a stream of data using << operators. If you want to concatenate strings via the + operator, you must wrap the entire operation in ()
#define ERR(err) { \
std::stringstream errStream; \
errStream< TilesetData;
std::vector LayerData;
+ std::string mapType="";
std::setspawns;
std::map SpawnerData; //Spawn groups have IDs, mobs associate which spawner they are tied to via this ID.
std::map>> ZoneData;
@@ -319,21 +320,12 @@ typedef std::map>> ZoneData;
if (newTag.tag=="property"&&newTag.data["name"]=="Boss Title Display") {
parsedMapInfo.SpawnerData[prevSpawner].bossNameDisplay=newTag.data["value"];
} else
+ if (newTag.tag=="property"&&newTag.data["name"]=="Level Type") {
+ parsedMapInfo.mapType=newTag.data["value"];
+ } else
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()
- &&(newTag.data["type"]=="LowerZone"||newTag.data["type"]=="UpperZone")){
- //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;
- }
- }else
if (newTag.tag=="object"&&newTag.data["type"]=="Monster") {
//XMLTag monsterTag=ReadNextTag();
//XMLTag spawnerLinkTag=ReadNextTag();
@@ -360,6 +352,17 @@ typedef std::map>> ZoneData;
} else
if(newTag.tag=="property"&¤tStagePlate!=nullptr){
currentStagePlate->properties[newTag.data["name"]]={newTag.data["name"],newTag.data["value"]};
+ }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;
+ }
}else{
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Unsupported tag format! Ignoring."<<"\n";
}
diff --git a/Crawler/Test.cpp b/Crawler/Test.cpp
new file mode 100644
index 00000000..574f71c2
--- /dev/null
+++ b/Crawler/Test.cpp
@@ -0,0 +1,61 @@
+/*
+License (OLC-3)
+~~~~~~~~~~~~~~~
+
+Copyright 2018 - 2023 OneLoneCoder.com
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions or derivations of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions or derivative works in binary form must reproduce the above
+copyright notice. This list of conditions and the following disclaimer must be
+reproduced in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may
+be used to endorse or promote products derived from this software without specific
+prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+*/
+#include "Test.h"
+#include "Error.h"
+#include "Crawler.h"
+#include "DEFINES.h"
+
+INCLUDE_game
+
+int Test::totalTests=0;
+
+void Test::is(std::string conditionStr,bool testResult){
+ std::cout<<"Running test "<MAP_DATA.at(CAMPAIGN_1_1).ZoneData.count("LowerBridgeCollision")
+ &&game->MAP_DATA.at(CAMPAIGN_1_1).ZoneData.at("LowerBridgeCollision").size()>=2);
+ for(auto&key:game->MAP_DATA){
+ is("A Map type has been selected for map "+std::to_string(key.first),
+ key.second.mapType!=""&&key.second.mapType!="Unspecified");
+ if(key.second.mapType=="Dungeon"){
+ is("There is an EndZone in Dungeon "+std::to_string(key.first),
+ key.second.ZoneData.count("EndZone"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Crawler/Test.h b/Crawler/Test.h
new file mode 100644
index 00000000..37d233d1
--- /dev/null
+++ b/Crawler/Test.h
@@ -0,0 +1,39 @@
+/*
+License (OLC-3)
+~~~~~~~~~~~~~~~
+
+Copyright 2018 - 2023 OneLoneCoder.com
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions or derivations of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions or derivative works in binary form must reproduce the above
+copyright notice. This list of conditions and the following disclaimer must be
+reproduced in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may
+be used to endorse or promote products derived from this software without specific
+prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+*/
+#include
+
+class Test{
+ static int totalTests;
+ static void is(std::string conditionStr,bool testResult);
+public:
+ static void RunMapTests();
+};
\ No newline at end of file
diff --git a/Crawler/Version.h b/Crawler/Version.h
index 141cb04b..efa48b14 100644
--- a/Crawler/Version.h
+++ b/Crawler/Version.h
@@ -33,7 +33,7 @@ SUCH DAMAGE.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
-#define VERSION_BUILD 2860
+#define VERSION_BUILD 2876
#define stringify(a) stringify_(a)
#define stringify_(a) #a
diff --git a/Crawler/assets/Campaigns/1_1_v2.tmx b/Crawler/assets/Campaigns/1_1_v2.tmx
index 60bd3589..cf8a7bc0 100644
--- a/Crawler/assets/Campaigns/1_1_v2.tmx
+++ b/Crawler/assets/Campaigns/1_1_v2.tmx
@@ -1,5 +1,8 @@
-