diff --git a/Adventures in Lestoria/Adventures in Lestoria.tiled-project b/Adventures in Lestoria/Adventures in Lestoria.tiled-project
index 5b9d61a9..3d23d5d6 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.tiled-project
+++ b/Adventures in Lestoria/Adventures in Lestoria.tiled-project
@@ -40,7 +40,9 @@
"type": "enum",
"values": [
"None",
- "foresty1_1"
+ "foresty1_1",
+ "overworld",
+ "foresty_boss"
],
"valuesAsFlags": false
},
@@ -273,7 +275,9 @@
"Yellow Slime",
"Flower Turret",
"Slime King",
- "Wolf"
+ "Wolf",
+ "Bear",
+ "Frog"
],
"valuesAsFlags": false
},
diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
index 5183118a..29f9bfcd 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
@@ -383,10 +383,6 @@
-
-
-
-
diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
index e6106801..4aaa89a8 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
@@ -417,9 +417,6 @@
Header Files
-
- Header Files
-
Header Files
diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp
index b71e571a..5a5973e0 100644
--- a/Adventures in Lestoria/AdventuresInLestoria.cpp
+++ b/Adventures in Lestoria/AdventuresInLestoria.cpp
@@ -86,7 +86,6 @@ std::vectorSPAWNER_LIST;
std::vector>DAMAGENUMBER_LIST;
std::vector>BULLET_LIST;
safemapGFX;
-safemapLEVEL_NAMES;
utils::datafile DATA;
AiL*game;
InputGroup AiL::KEY_LEFT;
@@ -240,7 +239,7 @@ bool AiL::OnUserCreate(){
EnvironmentalAudio::Initialize();
SoundEffect::Initialize();
- LoadLevel(LEVEL_NAMES["starting_map"_S]);
+ LoadLevel("starting_map"_S);
ChangePlayerClass(WARRIOR);
GameState::Initialize();
@@ -1587,7 +1586,7 @@ void AiL::InitializeLevel(std::string mapFile,MapName map){
if(VisualNovel::storyLevelData.count(cp.map)){ //Visual novel story data for story levels.
cp.levelDataExists=true;
}
- if(LEVEL_NAMES.count(cp.map)&&&MapHelper::MapFromString(cp.map)==&MAP_DATA[map]){
+ if(MAP_DATA.find(cp.map)!=MAP_DATA.end()){
MAP_DATA[map].name=cp.name;
for(std::string spawn:MAP_DATA[map].spawns){
cp.spawns.push_back(spawn);
@@ -2176,21 +2175,11 @@ bool AiL::OnUserDestroy(){
}
void AiL::InitializeLevels(){
- #define INITLEVEL(map) \
- LEVEL_NAMES[#map]=map; \
- InitializeLevel("map_path"_S + "Levels."#map ## _S,map);
-
- INITLEVEL(WORLD_MAP);
- INITLEVEL(CAMPAIGN_1_1);
- INITLEVEL(BOSS_1);
- INITLEVEL(CAMPAIGN_1_2);
- INITLEVEL(CAMPAIGN_1_3);
- INITLEVEL(CAMPAIGN_1_4);
- INITLEVEL(CAMPAIGN_1_5);
+ for(auto&[key,size]:DATA["Levels"]){
+ InitializeLevel("map_path"_S+operator""_S(("Levels."+key).c_str(),("Levels."+key).size()),key);
+ }
Test::RunMapTests();
-
- LEVEL_NAMES.SetInitialized();
}
void AiL::SpawnMonster(vf2d pos,MonsterData&data,bool upperLevel,bool isBossSpawn){
diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h
index 8553b201..8386f969 100644
--- a/Adventures in Lestoria/AdventuresInLestoria.h
+++ b/Adventures in Lestoria/AdventuresInLestoria.h
@@ -89,7 +89,7 @@ private:
float lastWorldShakeAdjust=0;
vf2d worldShakeVel={};
const float WORLD_SHAKE_ADJUST_MAX_TIME=0.4f;
- MapName currentLevel=MapName::CAMPAIGN_1_1;
+ MapName currentLevel="CAMPAIGN_1_1";
std::vectorforegroundTileGroups;
std::vectorupperForegroundTileGroups;
int bridgeLayerIndex=-1;
diff --git a/Adventures in Lestoria/Audio.cpp b/Adventures in Lestoria/Audio.cpp
index f106057c..ab7a2cb4 100644
--- a/Adventures in Lestoria/Audio.cpp
+++ b/Adventures in Lestoria/Audio.cpp
@@ -81,12 +81,21 @@ void Audio::Initialize(){
if(data.HasProperty("Events")){
for(auto&eventName:Self().events){
auto&eventData=data["Events"][eventName];
- if(eventData.GetValueCount()!=bgm.GetChannelCount())ERR(std::format("WARNING! {} parameters do not match channel count. {} != {}",eventName,eventData.GetValueCount(),bgm.GetChannelCount()));
- VolumeList volumes;
- for(int i=0;iITEM_DATA;
#define INCLUDE_ITEM_CATEGORIES extern safemap>ITEM_CATEGORIES;
#define DO_NOTHING [](MenuFuncData data){return true;}
-#define INCLUDE_LEVEL_NAMES extern safemapLEVEL_NAMES;
#define INCLUDE_WINDOW_SIZE extern vi2d WINDOW_SIZE;
#define INCLUDE_CENTERED extern const vf2d Menu::CENTERED;
diff --git a/Adventures in Lestoria/EncountersSpawnListScrollableWindowComponent.h b/Adventures in Lestoria/EncountersSpawnListScrollableWindowComponent.h
index face93f4..23fde223 100644
--- a/Adventures in Lestoria/EncountersSpawnListScrollableWindowComponent.h
+++ b/Adventures in Lestoria/EncountersSpawnListScrollableWindowComponent.h
@@ -45,7 +45,6 @@ All rights reserved.
#include "Error.h"
INCLUDE_MONSTER_DATA
-INCLUDE_LEVEL_NAMES
class EncountersSpawnListScrollableWindowComponent:public ScrollableWindowComponent{
protected:
diff --git a/Adventures in Lestoria/Map.cpp b/Adventures in Lestoria/Map.cpp
index f8657e6b..98dc9902 100644
--- a/Adventures in Lestoria/Map.cpp
+++ b/Adventures in Lestoria/Map.cpp
@@ -40,13 +40,12 @@ All rights reserved.
#include "safemap.h"
INCLUDE_game
-INCLUDE_LEVEL_NAMES
float TileGroup::FADE_TIME=0.3f;
uint8_t TileGroup::FADE_AMT=160;
Map&MapHelper::MapFromString(std::string mapName){
- return game->MAP_DATA.at(LEVEL_NAMES.at(mapName));
+ return game->MAP_DATA.at(mapName);
}
void TileGroup::InsertTile(TileRenderData tile){
diff --git a/Adventures in Lestoria/Map.h b/Adventures in Lestoria/Map.h
index f82c67a5..72138267 100644
--- a/Adventures in Lestoria/Map.h
+++ b/Adventures in Lestoria/Map.h
@@ -39,10 +39,11 @@ All rights reserved.
#include "olcUTIL_Geometry2D.h"
#include
#include "TMXParser.h"
-#include "MapName.h"
struct XMLTag;
+using MapName=std::string;
+
class MapHelper{
public:
static Map&MapFromString(std::string mapName);
diff --git a/Adventures in Lestoria/MapName.h b/Adventures in Lestoria/MapName.h
deleted file mode 100644
index 82bf6af7..00000000
--- a/Adventures in Lestoria/MapName.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#pragma region License
-/*
-License (OLC-3)
-~~~~~~~~~~~~~~~
-
-Copyright 2024 Joshua Sigona
-
-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.
-
-Portions of this software are copyright © 2023 The FreeType
-Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
-All rights reserved.
-*/
-#pragma endregion
-#pragma once
-
-enum MapName{
- CAMPAIGN_1_1,
- CAMPAIGN_1_2,
- CAMPAIGN_1_3,
- CAMPAIGN_1_4,
- CAMPAIGN_1_5,
- BOSS_1,
- WORLD_MAP
-};
\ No newline at end of file
diff --git a/Adventures in Lestoria/MonsterData.cpp b/Adventures in Lestoria/MonsterData.cpp
index feeeab68..bb501b43 100644
--- a/Adventures in Lestoria/MonsterData.cpp
+++ b/Adventures in Lestoria/MonsterData.cpp
@@ -69,7 +69,9 @@ void MonsterData::InitializeMonsterData(){
};
MonsterData::imgs[MonsterName]=NEW Renderable();
- MonsterData::imgs[MonsterName]->Load("assets/monsters/"+MonsterName+".png");
+ const rcode imgLoadResult=MonsterData::imgs[MonsterName]->Load("assets/monsters/"+MonsterName+".png");
+ if(imgLoadResult!=OK)ERR(std::format("WARNING! Image loading for Monster {} failed with result {}",MonsterName,int(imgLoadResult)));
+
EventName hurtSound="";
EventName deathSound="";
diff --git a/Adventures in Lestoria/OverworldMapLevelWindow.cpp b/Adventures in Lestoria/OverworldMapLevelWindow.cpp
index b3020961..dfac481a 100644
--- a/Adventures in Lestoria/OverworldMapLevelWindow.cpp
+++ b/Adventures in Lestoria/OverworldMapLevelWindow.cpp
@@ -45,7 +45,6 @@ All rights reserved.
#include "Map.h"
INCLUDE_game
-INCLUDE_LEVEL_NAMES
INCLUDE_MONSTER_DATA
using A=Attribute;
diff --git a/Adventures in Lestoria/State_GameRun.cpp b/Adventures in Lestoria/State_GameRun.cpp
index 9948feba..859d87fa 100644
--- a/Adventures in Lestoria/State_GameRun.cpp
+++ b/Adventures in Lestoria/State_GameRun.cpp
@@ -45,7 +45,6 @@ All rights reserved.
INCLUDE_MONSTER_LIST
INCLUDE_game
-INCLUDE_LEVEL_NAMES
void State_GameRun::OnStateChange(GameState*prevState){
if(Menu::IsMenuOpen()){
@@ -71,7 +70,7 @@ void State_GameRun::OnStateChange(GameState*prevState){
}
#pragma endregion
- game->LoadLevel(LEVEL_NAMES.at(State_OverworldMap::GetCurrentConnectionPoint().map));
+ game->LoadLevel(State_OverworldMap::GetCurrentConnectionPoint().map);
}
void State_GameRun::OnUserUpdate(AiL*game){
game->bossDisplayTimer=std::max(0.f,game->bossDisplayTimer-game->GetElapsedTime());
diff --git a/Adventures in Lestoria/State_MainMenu.cpp b/Adventures in Lestoria/State_MainMenu.cpp
index 69c492c3..123bae95 100644
--- a/Adventures in Lestoria/State_MainMenu.cpp
+++ b/Adventures in Lestoria/State_MainMenu.cpp
@@ -44,6 +44,7 @@ All rights reserved.
INCLUDE_game
void State_MainMenu::OnStateChange(GameState*prevState){
+ Audio::PlayBGM("title_screen");
TitleScreen::Reset();
game->UpdateDiscordStatus("Main Menu","");
};
diff --git a/Adventures in Lestoria/State_OverworldMap.cpp b/Adventures in Lestoria/State_OverworldMap.cpp
index d1201c10..df9aebaf 100644
--- a/Adventures in Lestoria/State_OverworldMap.cpp
+++ b/Adventures in Lestoria/State_OverworldMap.cpp
@@ -59,7 +59,7 @@ State_OverworldMap::State_OverworldMap(){
SetStageMarker("Stage I-I"); //Eventually we will load the game from a file and this will not be necessary. We just set it to this for now.
}
void State_OverworldMap::OnStateChange(GameState*prevState){
- game->LoadLevel(WORLD_MAP);
+ game->LoadLevel("WORLD_MAP");
if(Menu::IsMenuOpen()){
Menu::CloseAllMenus();
}
diff --git a/Adventures in Lestoria/TMXParser.h b/Adventures in Lestoria/TMXParser.h
index 65a17161..ad63793f 100644
--- a/Adventures in Lestoria/TMXParser.h
+++ b/Adventures in Lestoria/TMXParser.h
@@ -42,11 +42,9 @@ All rights reserved.
#include
#include "EnvironmentalAudio.h"
#include "DEFINES.h"
-#include "MapName.h"
#include "safemap.h"
-INCLUDE_LEVEL_NAMES
-
+using MapName=std::string;
using namespace olc;
struct XMLTag{
@@ -132,6 +130,7 @@ class TMXParser{
Map GetData();
private:
Map parsedMapInfo;
+ std::string fileName;
bool buildingSpawner=false;
SpawnerTag obj;
int prevSpawner;
@@ -246,7 +245,7 @@ class TMXParser{
return displayStr;
}
const MapName&Map::GetMapName()const{
- return LEVEL_NAMES[name];
+ return name;
}
std::ostream& operator <<(std::ostream& os, std::vector& rhs) {
for(XMLTag&tag:rhs){
@@ -329,8 +328,11 @@ class TMXParser{
if (newTag.tag=="map"){
if(stoi(newTag.data["infinite"])==1){
infiniteMap=true;
+ ERR(std::format("WARNING! Infinite maps are not supported! Invalid map: {}",fileName));
return;
}
+ if(newTag.data.find("class")==newTag.data.end())ERR(std::format("WARNING! Map {} does not have a class set!",fileName));
+ if(newTag.data["class"]!="Map")ERR(std::format("WARNING! Map {} is not set to the map class! Class is set to {} instead.",fileName,newTag.data["class"]));
parsedMapInfo.MapData={stoi(newTag.data["width"]),stoi(newTag.data["height"]),stoi(newTag.data["tilewidth"]),stoi(newTag.data["tileheight"])};
} else
if (newTag.tag=="tileset"){
@@ -381,6 +383,7 @@ class TMXParser{
monsterPropertyTagCount=0;
} else
if (newTag.tag=="property"&&monsterPropertyTagCount==0) {
+ if(newTag.data["value"]=="None")ERR(std::format("WARNING! Invalid monster type provided: {} in map {}",newTag.data["value"],fileName));
monsterTag.data["value"]=newTag.data["value"];
parsedMapInfo.spawns.insert(newTag.GetString("value"));
monsterPropertyTagCount++;
@@ -407,9 +410,11 @@ class TMXParser{
zones.emplace_back(geom2d::rect{{newTag.GetInteger("x"),newTag.GetInteger("y")},{newTag.GetInteger("width"),newTag.GetInteger("height")}});
prevZoneData=&zones.back();
} else {
- std::vector&zones=parsedMapInfo.ZoneData[newTag.data["type"]];
- zones.emplace_back(geom2d::rect{{newTag.GetInteger("x"),newTag.GetInteger("y")},{newTag.GetInteger("width"),newTag.GetInteger("height")}});
- prevZoneData=&zones.back();
+ if(newTag.data["width"].length()>0&&newTag.data["height"].length()>0){ //This ensures the zone is valid to begin with.
+ std::vector&zones=parsedMapInfo.ZoneData[newTag.data["type"]];
+ zones.emplace_back(geom2d::rect{{newTag.GetInteger("x"),newTag.GetInteger("y")},{newTag.GetInteger("width"),newTag.GetInteger("height")}});
+ prevZoneData=&zones.back();
+ }
}
}else{
#if _DEBUG
@@ -421,6 +426,7 @@ class TMXParser{
#endif
}
TMXParser::TMXParser(std::string file){
+ fileName=file;
std::ifstream f(file,std::ios::in);
std::string accumulator="";
diff --git a/Adventures in Lestoria/TSXParser.h b/Adventures in Lestoria/TSXParser.h
index bc2eab24..28dd388b 100644
--- a/Adventures in Lestoria/TSXParser.h
+++ b/Adventures in Lestoria/TSXParser.h
@@ -130,7 +130,7 @@ class TSXParser{
}
}
}
-
+
if (newTag.tag=="tileset") {
parsedTilesetInfo.tilewidth=stoi(newTag.data["tilewidth"]);
parsedTilesetInfo.tileheight=stoi(newTag.data["tileheight"]);
diff --git a/Adventures in Lestoria/Test.cpp b/Adventures in Lestoria/Test.cpp
index 54aaaa34..26f85727 100644
--- a/Adventures in Lestoria/Test.cpp
+++ b/Adventures in Lestoria/Test.cpp
@@ -54,13 +54,13 @@ void Test::is(std::string conditionStr,bool testResult){
void Test::RunMapTests(){
is("There are two LowerBridgeCollision zones in Campaign I-I",
- game->MAP_DATA.at(CAMPAIGN_1_1).ZoneData.count("LowerBridgeCollision")
- &&game->MAP_DATA.at(CAMPAIGN_1_1).ZoneData.at("LowerBridgeCollision").size()>=2);
+ game->MAP_DATA.at("CAMPAIGN_1_1").ZoneData.count("LowerBridgeCollision")
+ &&game->MAP_DATA.at("CAMPAIGN_1_1").ZoneData.at("LowerBridgeCollision").size()>=2);
for(auto&[key,value]:game->MAP_DATA){
- is("A Map type has been selected for map "+std::to_string(key),
+ is("A Map type has been selected for map "+key,
value.mapType!=""&&value.mapType!="Unspecified");
if(value.mapType=="Dungeon"){
- is("There is an EndZone in Dungeon "+std::to_string(key),
+ is("There is an EndZone in Dungeon "+key,
value.ZoneData.count("EndZone"));
}
}
diff --git a/Adventures in Lestoria/TitleScreen.cpp b/Adventures in Lestoria/TitleScreen.cpp
index 790d6b6f..89914785 100644
--- a/Adventures in Lestoria/TitleScreen.cpp
+++ b/Adventures in Lestoria/TitleScreen.cpp
@@ -111,6 +111,7 @@ void TitleScreen::Update(){
state=FINAL;
currentAnimationTime=0.f;
Menu::OpenMenu(MAIN_MENU,false);
+ Audio::SetAudioEvent("TitleScreenLoaded");
}
}break;
}
diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h
index 146b384e..2427549f 100644
--- a/Adventures in Lestoria/Version.h
+++ b/Adventures in Lestoria/Version.h
@@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
-#define VERSION_BUILD 5499
+#define VERSION_BUILD 5517
#define stringify(a) stringify_(a)
#define stringify_(a) #a
diff --git a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
index c8f9f6f0..7487bfc5 100644
--- a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
+++ b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
@@ -1951,13 +1951,6 @@
-