diff --git a/Adventures in Lestoria/Ability.h b/Adventures in Lestoria/Ability.h
index f2aab0d3..aba06e65 100644
--- a/Adventures in Lestoria/Ability.h
+++ b/Adventures in Lestoria/Ability.h
@@ -39,7 +39,7 @@ All rights reserved.
#include "olcPixelGameEngine.h"
#include "Key.h"
-struct Player;
+class Player;
struct PrecastData{
float castTime;
diff --git a/Adventures in Lestoria/Adventures in Lestoria.tiled-project b/Adventures in Lestoria/Adventures in Lestoria.tiled-project
index 830b418d..67b7b979 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.tiled-project
+++ b/Adventures in Lestoria/Adventures in Lestoria.tiled-project
@@ -8,6 +8,31 @@
"."
],
"propertyTypes": [
+ {
+ "color": "#ff3af8eb",
+ "drawFill": true,
+ "id": 28,
+ "members": [
+ {
+ "name": "Sound Name",
+ "propertyType": "EnvironmentalSounds",
+ "type": "string",
+ "value": "None"
+ }
+ ],
+ "name": "AudioEnvironmentalSound",
+ "type": "class",
+ "useAs": [
+ "property",
+ "map",
+ "layer",
+ "object",
+ "tile",
+ "tileset",
+ "wangcolor",
+ "wangset"
+ ]
+ },
{
"id": 27,
"name": "BGM",
@@ -89,6 +114,17 @@
"object"
]
},
+ {
+ "id": 29,
+ "name": "EnvironmentalSounds",
+ "storageType": "string",
+ "type": "enum",
+ "values": [
+ "None",
+ "Waterfall"
+ ],
+ "valuesAsFlags": false
+ },
{
"color": "#ffd9d929",
"drawFill": true,
diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
index 9cd72d90..99641940 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
@@ -134,6 +134,7 @@
stdcpp20
C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\Documents\include;%(AdditionalIncludeDirectories)
/MP8 %(AdditionalOptions)
+ 4099;5030;4715;4172;4834
Console
@@ -200,6 +201,7 @@
stdcpp20
C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\Documents\include;%(AdditionalIncludeDirectories)
/MP8 %(AdditionalOptions)
+ 4099;5030;4715;4172;4834
Console
@@ -355,6 +357,10 @@
+
+
+
+
@@ -377,6 +383,10 @@
+
+
+
+
@@ -467,6 +477,10 @@
+
+
+
+
@@ -547,6 +561,10 @@
+
+
+
+
@@ -621,6 +639,10 @@
+
+
+
+
@@ -640,8 +662,13 @@
+
+
+
+
+
diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
index 3c2db80b..f3726ac5 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
@@ -85,6 +85,9 @@
{a54ab812-9474-465f-9f0d-4dceecb9e963}
+
+ {c28287fa-b401-4715-b2f2-8ac1021d5ec9}
+
@@ -411,6 +414,15 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
@@ -692,10 +704,19 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
+
+ Documentation
+
@@ -807,6 +828,18 @@
+
+ Configurations\Audio
+
+
+ Configurations\Audio
+
+
+ Configurations\Audio
+
+
+ Configurations\Audio
+
diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp
index 94680b59..ea2b6071 100644
--- a/Adventures in Lestoria/AdventuresInLestoria.cpp
+++ b/Adventures in Lestoria/AdventuresInLestoria.cpp
@@ -157,6 +157,12 @@ AiL::AiL()
std::string BGM_EVENTS_CONFIG = CONFIG_PATH + "event_config"_S;
utils::datafile::Read(DATA,BGM_EVENTS_CONFIG);
+ std::string AUDIO_CONFIG = CONFIG_PATH + "audio_config"_S;
+ utils::datafile::Read(DATA,AUDIO_CONFIG);
+
+ std::string ENVIRONMENTAL_AUDIO_CONFIG = CONFIG_PATH + "environmental_audio_config"_S;
+ utils::datafile::Read(DATA,ENVIRONMENTAL_AUDIO_CONFIG);
+
utils::datafile::DEBUG_ACCESS_OPTIONS="debug_access_options"_I;
sAppName = "GAME_NAME"_S;
@@ -177,7 +183,7 @@ bool AiL::OnUserCreate(){
camera=Camera2D{WINDOW_SIZE};
camera.SetMode(olc::utils::Camera2D::Mode::LazyFollow);
camera.SetTarget(player->GetPos());
- camera.SetWorldBoundary({0,0},GetCurrentMap().MapSize*GetCurrentMap().TileSize);
+ camera.SetWorldBoundary({0,0},GetCurrentMap().MapData.MapSize*GetCurrentMap().MapData.TileSize);
camera.EnableWorldBoundary(false);
ItemAttribute::Initialize();
@@ -230,6 +236,7 @@ bool AiL::OnUserCreate(){
Inventory::AddItem("Ring of the Slime King",3);
Audio::Initialize();
+ EnvironmentalAudio::Initialize();
LoadLevel(LEVEL_NAMES["starting_map"_S]);
ChangePlayerClass(WARRIOR);
@@ -340,8 +347,8 @@ void AiL::HandleUserInput(float fElapsedTime){
if(player->GetVelocity()==vf2d{0,0}&&player->CanMove()){
auto GetPlayerStaircaseDirection=[&](){
for(LayerTag&layer:MAP_DATA[GetCurrentLevel()].LayerData){
- int truncatedPlayerX=int(player->GetX())/game->GetCurrentMap().tilewidth;
- int truncatedPlayerY=int(player->GetY())/game->GetCurrentMap().tilewidth;
+ int truncatedPlayerX=int(player->GetX())/game->GetCurrentMapData().tilewidth;
+ int truncatedPlayerY=int(player->GetY())/game->GetCurrentMapData().tilewidth;
int tileID=layer.tiles[truncatedPlayerY][truncatedPlayerX];
TilesheetData dat=GetTileSheet(GetCurrentLevel(),tileID);
if (dat.tileset->staircaseTiles.find(tileID)!=dat.tileset->staircaseTiles.end()){
@@ -727,9 +734,9 @@ void AiL::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2d ti
int tileSheetWidth=tileSheet.tileset->tileset->Sprite()->width/tileSheet.tileset->tilewidth;
int tileSheetX=animatedIndex%tileSheetWidth;
int tileSheetY=animatedIndex/tileSheetWidth;
- view.DrawPartialDecal(pos*game->GetCurrentMap().tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)},tileSheet.tileset->tileset->Decal(),vi2d{tileSheetX,tileSheetY}*tileSheet.tileset->tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)});
+ view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)},tileSheet.tileset->tileset->Decal(),vi2d{tileSheetX,tileSheetY}*tileSheet.tileset->tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)});
}else{
- view.DrawPartialDecal(pos*game->GetCurrentMap().tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)},tileSheet.tileset->tileset->Decal(),tileSheetPos*tileSheet.tileset->tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)});
+ view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)},tileSheet.tileset->tileset->Decal(),tileSheetPos*tileSheet.tileset->tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)});
}
}
@@ -805,7 +812,7 @@ void AiL::RenderWorld(float fElapsedTime){
SetDecalMode(DecalMode::ADDITIVE);
float reflectionHeight=(float(player->GetFrame().GetSourceRect().size.y)-8)*player->GetSizeMult();
float reflectionBottom=player->GetPos().y+reflectionHeight;
- float cutOff=reflectionBottom-GetCurrentMap().height*GetCurrentMap().tileheight;
+ float cutOff=reflectionBottom-GetCurrentMapData().height*GetCurrentMapData().tileheight;
float multiplierX=0.9f;
multiplierX*=(1-abs(sin(reflectionStepTime))*"water_reflection_scale_factor"_F);
multiplierX*=(1-abs(cos(1.5f*reflectionStepTime))*"water_reflection_scale_factor"_F);
@@ -816,13 +823,13 @@ void AiL::RenderWorld(float fElapsedTime){
}
SetDecalMode(DecalMode::NORMAL);
}
- if(GetCurrentMap().optimized){
- view.FillRectDecal(-WINDOW_SIZE,vf2d{float(GetCurrentMap().width),float(GetCurrentMap().height)}*float(GetCurrentMap().tilewidth)+vf2d{WINDOW_SIZE}*2,{100,180,100});
+ if(GetCurrentMapData().optimized){
+ view.FillRectDecal(-WINDOW_SIZE,vf2d{float(GetCurrentMapData().width),float(GetCurrentMapData().height)}*float(GetCurrentMapData().tilewidth)+vf2d{WINDOW_SIZE}*2,{100,180,100});
view.DrawDecal({0,0},MAP_DATA[GetCurrentLevel()].optimizedTile->Decal());
}else{
- for (int x = view.GetTopLeftTile().x/GetCurrentMap().tilewidth-1; x <= view.GetBottomRightTile().x/GetCurrentMap().tilewidth; x++){
- for (int y = view.GetTopLeftTile().y/GetCurrentMap().tilewidth-1; y <= view.GetBottomRightTile().y/GetCurrentMap().tilewidth; y++){
- if(x>=0&&x=0&&y=0&&x=0&&yupperLevel){
int tileID=layer.tiles[y][x]-1;
if(tileID!=-1){
- int playerXTruncated=int(player->GetPos().x)/GetCurrentMap().tilewidth;
- int playerYTruncated=int(player->GetPos().y)/GetCurrentMap().tilewidth;
+ int playerXTruncated=int(player->GetPos().x)/GetCurrentMapData().tilewidth;
+ int playerYTruncated=int(player->GetPos().y)/GetCurrentMapData().tilewidth;
if(playerXTruncated==x&&playerYTruncated==y){
bridgeLayerFade=true;
}
@@ -855,8 +862,8 @@ void AiL::RenderWorld(float fElapsedTime){
if("debug_collision_boxes"_I){
if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){
geom2d::rectcollision=tileSheet.tileset->collision[tileSheetIndex].collision;
- view.FillRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth+collision.pos,collision.size,{0,0,0,128});
- view.DrawRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth+collision.pos,collision.size,GREY);
+ view.FillRectDecal(vi2d{x,y}*GetCurrentMapData().tilewidth+collision.pos,collision.size,{0,0,0,128});
+ view.DrawRectDecal(vi2d{x,y}*GetCurrentMapData().tilewidth+collision.pos,collision.size,GREY);
}
}
#endif
@@ -883,8 +890,8 @@ void AiL::RenderWorld(float fElapsedTime){
if("debug_collision_boxes"_I){
if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){
geom2d::rectcollision=tileSheet.tileset->collision[tileSheetIndex].collision;
- view.FillRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth+collision.pos,collision.size,{0,0,0,128});
- view.DrawRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth+collision.pos,collision.size,GREY);
+ view.FillRectDecal(vi2d{x,y}*GetCurrentMapData().tilewidth+collision.pos,collision.size,{0,0,0,128});
+ view.DrawRectDecal(vi2d{x,y}*GetCurrentMapData().tilewidth+collision.pos,collision.size,GREY);
}
}
#endif
@@ -893,12 +900,12 @@ void AiL::RenderWorld(float fElapsedTime){
}break;
case RenderMode::EMPTY_TILES:{
if(visibleTiles.count({x,y})){
- view.FillRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth,{float(GetCurrentMap().tilewidth),float(GetCurrentMap().tilewidth)},{100,180,100});
+ view.FillRectDecal(vi2d{x,y}*GetCurrentMapData().tilewidth,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},{100,180,100});
}
}break;
}
}else{
- view.FillRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth,{float(GetCurrentMap().tilewidth),float(GetCurrentMap().tilewidth)},{100,180,100});
+ view.FillRectDecal(vi2d{x,y}*GetCurrentMapData().tilewidth,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},{100,180,100});
}
}
}
@@ -1053,9 +1060,9 @@ void AiL::RenderWorld(float fElapsedTime){
#pragma region Bridge Layer Rendering
if(bridgeLayer!=nullptr){
- for (int x = view.GetTopLeftTile().x/game->GetCurrentMap().tilewidth-1; x <= view.GetBottomRightTile().x/game->GetCurrentMap().tilewidth; x++){
- for (int y = view.GetTopLeftTile().y/game->GetCurrentMap().tilewidth-1; y <= view.GetBottomRightTile().y/game->GetCurrentMap().tilewidth; y++){
- if(x>=0&&x=0&&yGetCurrentMapData().tilewidth-1; x <= view.GetBottomRightTile().x/game->GetCurrentMapData().tilewidth; x++){
+ for (int y = view.GetTopLeftTile().y/game->GetCurrentMapData().tilewidth-1; y <= view.GetBottomRightTile().y/game->GetCurrentMapData().tilewidth; y++){
+ if(x>=0&&x=0&&ytiles[y][x]-1;
if(tileID!=-1){
TilesheetData tileSheet=GetTileSheet(currentLevel,tileID);
@@ -1064,13 +1071,13 @@ void AiL::RenderWorld(float fElapsedTime){
int tileSheetIndex=tileID-(tileSheet.firstgid-1);
int tileSheetX=tileSheetIndex%tileSheetWidth;
int tileSheetY=tileSheetIndex/tileSheetWidth;
- view.DrawPartialDecal(vi2d{x,y}*game->GetCurrentMap().tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)},tileSheet.tileset->tileset->Decal(),vi2d{tileSheetX,tileSheetY}*game->GetCurrentMap().tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)},{255,255,255,uint8_t(255-bridgeFadeFactor/TileGroup::FADE_TIME*TileGroup::FADE_AMT)});
+ view.DrawPartialDecal(vi2d{x,y}*game->GetCurrentMapData().tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)},tileSheet.tileset->tileset->Decal(),vi2d{tileSheetX,tileSheetY}*game->GetCurrentMapData().tilewidth,{float(tileSheet.tileset->tilewidth),float(tileSheet.tileset->tileheight)},{255,255,255,uint8_t(255-bridgeFadeFactor/TileGroup::FADE_TIME*TileGroup::FADE_AMT)});
#ifdef _DEBUG
if("debug_collision_boxes"_I){
if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){
geom2d::rectcollision=tileSheet.tileset->collision[tileSheetIndex].collision;
- view.FillRectDecal(vi2d{x,y}*game->GetCurrentMap().tilewidth+collision.pos,collision.size,{0,0,0,128});
- view.DrawRectDecal(vi2d{x,y}*game->GetCurrentMap().tilewidth+collision.pos,collision.size,GREY);
+ view.FillRectDecal(vi2d{x,y}*game->GetCurrentMapData().tilewidth+collision.pos,collision.size,{0,0,0,128});
+ view.DrawRectDecal(vi2d{x,y}*game->GetCurrentMapData().tilewidth+collision.pos,collision.size,GREY);
}
}
#endif
@@ -1251,7 +1258,7 @@ void AiL::RenderWorld(float fElapsedTime){
if(DEBUG_PATHFINDING){
std::vectorpathing=game->pathfinder.Solve_AStar(player.get()->GetPos(),GetWorldMousePos(),8,player.get()->OnUpperLevel());
for(vf2d&square:pathing){
- view.FillRectDecal(square*float(game->GetCurrentMap().tilewidth),{float(game->GetCurrentMap().tilewidth),float(game->GetCurrentMap().tilewidth)},DARK_GREEN);
+ view.FillRectDecal(square*float(game->GetCurrentMapData().tilewidth),{float(game->GetCurrentMapData().tilewidth),float(game->GetCurrentMapData().tilewidth)},DARK_GREEN);
}
}
#endif
@@ -1579,6 +1586,12 @@ void AiL::LoadLevel(MapName map){
GetPlayer()->SetState(State::NORMAL);
GetPlayer()->GetCastInfo()={};
GetPlayer()->ResetAccumulatedXP();
+
+ #pragma region Reset Environmental Audio
+ for(EnvironmentalAudio&audio:MAP_DATA[map].environmentalAudioData){
+ audio.Deactivate();
+ }
+ #pragma endregion
#pragma region Monster Spawn Data Setup
for(auto&[key,value]:MAP_DATA[map].SpawnerData){
@@ -1604,10 +1617,10 @@ void AiL::LoadLevel(MapName map){
return std::vector{};
};
for(ZoneData&zone:GetUpperZones()){
- int zoneX=zone.zone.pos.x/game->GetCurrentMap().tilewidth; //snap to grid
- int zoneY=zone.zone.pos.y/game->GetCurrentMap().tilewidth;
- int zoneW=zone.zone.right().start.x/game->GetCurrentMap().tilewidth-zoneX;
- int zoneH=zone.zone.bottom().start.y/game->GetCurrentMap().tilewidth-zoneY;
+ int zoneX=zone.zone.pos.x/game->GetCurrentMapData().tilewidth; //snap to grid
+ int zoneY=zone.zone.pos.y/game->GetCurrentMapData().tilewidth;
+ int zoneW=zone.zone.right().start.x/game->GetCurrentMapData().tilewidth-zoneX;
+ int zoneH=zone.zone.bottom().start.y/game->GetCurrentMapData().tilewidth-zoneY;
for(int x=zoneX;xforegroundTilesAdded,upperForegroundTilesAdded;
- for(int x=0;x0&&foregroundTilesIncluded.find(vi2d{x,y}+vi2d{-1,0})==foregroundTilesIncluded.end())tileGroupChecks.push({x-1,y});
- if(x0&&foregroundTilesIncluded.find(vi2d{x,y}+vi2d{0,-1})==foregroundTilesIncluded.end())tileGroupChecks.push({x,y-1});
- if(yGetCurrentMap().tilewidth,vi2d{tileSheetX,tileSheetY}*game->GetCurrentMap().tilewidth,realTileSheetIndex,layer2ID};
+ TileRenderData tile={tileSheet,vi2d{pos.x,pos.y}*game->GetCurrentMapData().tilewidth,vi2d{tileSheetX,tileSheetY}*game->GetCurrentMapData().tilewidth,realTileSheetIndex,layer2ID};
if(IsForeground(tileSheet,tileSheetIndex)){
foregroundTilesIncluded.insert({pos.x,pos.y});
group.InsertTile(tile);
@@ -1682,18 +1695,18 @@ void AiL::LoadLevel(MapName map){
vi2d targetPos=pos+vi2d{-1,0};
if(pos.x>0&&foregroundTilesIncluded.find(targetPos)==foregroundTilesIncluded.end()){tileGroupChecks.push(targetPos);foregroundTilesIncluded.insert(targetPos);}
targetPos=pos+vi2d{1,0};
- if(pos.x0&&foregroundTilesIncluded.find(targetPos)==foregroundTilesIncluded.end()){tileGroupChecks.push(targetPos);foregroundTilesIncluded.insert(targetPos);}
targetPos=pos+vi2d{0,1};
- if(pos.yGetCurrentMap().tilewidth,vi2d{tileSheetX,tileSheetY}*game->GetCurrentMap().tilewidth,realTileSheetIndex,layerID};
+ TileRenderData tile={tileSheet,vi2d{x,y}*game->GetCurrentMapData().tilewidth,vi2d{tileSheetX,tileSheetY}*game->GetCurrentMapData().tilewidth,realTileSheetIndex,layerID};
SetupTileGroups([&](TilesheetData sheet,int tileID){return IsForegroundTile(sheet,tileID);},tile,foregroundTilesAdded,foregroundTileGroups);
SetupTileGroups([&](TilesheetData sheet,int tileID){return IsUpperForegroundTile(tileID);},tile,upperForegroundTilesAdded,upperForegroundTileGroups);
#pragma endregion
@@ -1833,7 +1846,7 @@ TilesheetData AiL::GetTileSheet(MapName map,int tileID){
bool AiL::HasTileCollision(MapName map,vf2d pos,bool upperLevel){
geom2d::rectcollisionRect=GetTileCollision(map,pos,upperLevel);
- vi2d collisionRectSnapPos=vi2d{pos/float(game->GetCurrentMap().tilewidth)}*game->GetCurrentMap().tilewidth;
+ vi2d collisionRectSnapPos=vi2d{pos/float(game->GetCurrentMapData().tilewidth)}*game->GetCurrentMapData().tilewidth;
collisionRect.pos+=collisionRectSnapPos;
return geom2d::overlaps(collisionRect,pos);
}
@@ -1843,19 +1856,19 @@ bool AiL::IsBridgeLayer(LayerTag&layer){
}
geom2d::rectAiL::GetTileCollision(MapName map,vf2d pos,bool upperLevel){
- if(pos.x<0||pos.y<0||pos.x>=GetCurrentMap().width*game->GetCurrentMap().tilewidth||pos.y>=GetCurrentMap().height*game->GetCurrentMap().tilewidth)return NO_COLLISION;
+ if(pos.x<0||pos.y<0||pos.x>=GetCurrentMapData().width*game->GetCurrentMapData().tilewidth||pos.y>=GetCurrentMapData().height*game->GetCurrentMapData().tilewidth)return NO_COLLISION;
#pragma region Lower Bridge Collision Check
if(!upperLevel){ //We are looking for lower bridge collisions.
for(ZoneData&zone:MAP_DATA[map].ZoneData["LowerBridgeCollision"]){
if(geom2d::contains(zone.zone,pos)){
- return {{0,0},{game->GetCurrentMap().tilewidth,game->GetCurrentMap().tilewidth}};
+ return {{0,0},{game->GetCurrentMapData().tilewidth,game->GetCurrentMapData().tilewidth}};
}
}
}
#pragma endregion
//The logic here is, if there's a tile on the bridge, we respect that tile instead if we're on the upper level. So we don't check other layers when we are on the upper level and there is a tile below us.
if(upperLevel&&bridgeLayerIndex!=-1){
- int tileID=MAP_DATA[map].LayerData[bridgeLayerIndex].tiles[int(pos.y)/game->GetCurrentMap().tilewidth][int(pos.x)/game->GetCurrentMap().tilewidth]-1;
+ int tileID=MAP_DATA[map].LayerData[bridgeLayerIndex].tiles[int(pos.y)/game->GetCurrentMapData().tilewidth][int(pos.x)/game->GetCurrentMapData().tilewidth]-1;
if(tileID!=-1){
if (GetTileSheet(map,tileID%1000000).tileset->collision.find(tileID%1000000-GetTileSheet(map,tileID%1000000).firstgid+1)!=GetTileSheet(map,tileID%1000000).tileset->collision.end()){
return GetTileSheet(map,tileID%1000000).tileset->collision[tileID%1000000-GetTileSheet(map,tileID%1000000).firstgid+1].collision;
@@ -1867,7 +1880,7 @@ geom2d::rectAiL::GetTileCollision(MapName map,vf2d pos,bool upperLevel){
for(int counter=0;LayerTag&layer:MAP_DATA[map].LayerData){
//auto HasNoClass=[&](){return layer.tag.data.find("class")==layer.tag.data.end();};
if(counter!=bridgeLayerIndex){
- int tileID=layer.tiles[int(pos.y)/game->GetCurrentMap().tilewidth][int(pos.x)/game->GetCurrentMap().tilewidth]-1;
+ int tileID=layer.tiles[int(pos.y)/game->GetCurrentMapData().tilewidth][int(pos.x)/game->GetCurrentMapData().tilewidth]-1;
if(tileID!=-1&&GetTileSheet(map,tileID%1000000).tileset->collision.find(tileID%1000000-GetTileSheet(map,tileID%1000000).firstgid+1)!=GetTileSheet(map,tileID%1000000).tileset->collision.end()){
geom2d::rectcollisionRect=GetTileSheet(map,tileID%1000000).tileset->collision[tileID%1000000-GetTileSheet(map,tileID%1000000).firstgid+1].collision;
if(foundRect.pos==NO_COLLISION.pos&&foundRect.size==NO_COLLISION.size){
@@ -1886,7 +1899,7 @@ geom2d::rectAiL::GetTileCollision(MapName map,vf2d pos,bool upperLevel){
return foundRect;
}
-MapName AiL::GetCurrentLevel(){
+const MapName&AiL::GetCurrentLevel()const{
return currentLevel;
}
@@ -2346,8 +2359,14 @@ void AiL::InitializeGraphics(){
std::cout<GetTileCollision(MapName map,vf2d pos,bool upperLevel=false);
//Checks if the point resides inside of a collision tile.
bool HasTileCollision(MapName map,vf2d pos,bool upperLevel=false);
- MapName GetCurrentLevel();
+ const MapName&GetCurrentLevel()const;
bool IsBridgeLayer(LayerTag&layer);
std::map>&GetZoneData(MapName map);
void PopulateRenderLists();
@@ -198,7 +198,9 @@ public:
void ReduceBossEncounterMobCount();
void InitializeGraphics();
void RenderVersionInfo();
- MapTag GetCurrentMap();
+ const Map&GetCurrentMap()const;
+ const MapTag&GetCurrentMapData()const;
+ const MapName&GetCurrentMapName()const;
int GetCurrentChapter();
void SetChapter(int chapter);
const std::weak_ptr- GetLoadoutItem(int slot);
diff --git a/Adventures in Lestoria/Audio.cpp b/Adventures in Lestoria/Audio.cpp
index 072209e9..6544c1eb 100644
--- a/Adventures in Lestoria/Audio.cpp
+++ b/Adventures in Lestoria/Audio.cpp
@@ -108,6 +108,11 @@ MiniAudio&Audio::Engine(){
void Audio::Play(const std::string_view sound){
Engine().Play(std::string(sound));
};
+const size_t Audio::LoadAndPlay(const std::string_view sound,const bool loop){
+ size_t soundID=Engine().LoadSound(std::string(sound));
+ Engine().Play(soundID,loop);
+ return soundID;
+};
void Audio::PlayBGM(const std::string_view sound,const bool loop){
BGM&track=Self().bgm[std::string(sound)];
Self().fullyLoaded=false;
diff --git a/Adventures in Lestoria/Audio.h b/Adventures in Lestoria/Audio.h
index 0a86b90f..b2438abc 100644
--- a/Adventures in Lestoria/Audio.h
+++ b/Adventures in Lestoria/Audio.h
@@ -57,6 +57,8 @@ public:
static void Initialize();
static void Update();
static void Play(const std::string_view sound);
+ [[nodiscard]]
+ static const size_t LoadAndPlay(const std::string_view sound,const bool loop=true);
//Play a BGM given a name found in bgm.txt configuration file.
static void PlayBGM(const std::string_view sound,const bool loop=true);
static void StopBGM();
diff --git a/Adventures in Lestoria/CREDITS b/Adventures in Lestoria/CREDITS
index f783f3a6..efbdcbbf 100644
--- a/Adventures in Lestoria/CREDITS
+++ b/Adventures in Lestoria/CREDITS
@@ -26,5 +26,6 @@ Fonts obtained from:
Nb Pixel Font Bundle: https://nimblebeastscollective.itch.io/nb-pixel-font-bundle
Nb Pixel Font Bundle 2: https://nimblebeastscollective.itch.io/nb-pixel-font-bundle-2
+Ogg Vorbis audio decoder - v1.22 - public domain http://nothings.org/stb_vorbis/
miniaudio library Copyright 2023 by David Reid under the MIT No Attribution License
olcPGEX_MiniAudio Copyright 2023 by Moros Smith under the OLC-3 License
\ No newline at end of file
diff --git a/Adventures in Lestoria/EnvironmentalAudio.cpp b/Adventures in Lestoria/EnvironmentalAudio.cpp
new file mode 100644
index 00000000..128f1622
--- /dev/null
+++ b/Adventures in Lestoria/EnvironmentalAudio.cpp
@@ -0,0 +1,99 @@
+#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
+
+#include "EnvironmentalAudio.h"
+#include "Audio.h"
+#include "AdventuresInLestoria.h"
+
+INCLUDE_game
+INCLUDE_DATA
+
+float EnvironmentalAudio::ACTIVATION_RANGE;
+std::mapEnvironmentalAudio::SOUND_DATA;
+
+void EnvironmentalAudio::Initialize(){
+ ACTIVATION_RANGE="Audio.Environmental Audio Activation Range"_F;
+ for(auto&[key,size]:DATA["Environmental Audio"]){
+ SOUND_DATA[key].file=DATA["Environmental Audio"][key]["File"].GetString();
+ if(!std::filesystem::exists(operator""_SFX(SOUND_DATA[key].file.c_str(),SOUND_DATA[key].file.length())))ERR(std::format("WARNING! Could not load Environmental Audio {} due to missing file {} in {}",key,SOUND_DATA[key].file,"sfx_directory"_S));
+ SOUND_DATA[key].volume=DATA["Environmental Audio"][key]["Volume"].GetReal()/100.f;
+ }
+}
+
+EnvironmentalAudio::EnvironmentalAudio()
+ :audioName(""),pos({}){}
+EnvironmentalAudio::EnvironmentalAudio(const std::string_view audioName,const vf2d pos)
+ :audioName(audioName),pos(pos){}
+void EnvironmentalAudio::SetPos(const vf2d&pos){
+ this->pos=pos;
+}
+void EnvironmentalAudio::SetAudioName(const std::string_view audioName){
+ this->audioName=audioName;
+}
+void EnvironmentalAudio::Activate(){
+ if(activated)return;
+ soundInstance=Audio::LoadAndPlay(operator""_SFX(SOUND_DATA[audioName].file.c_str(),SOUND_DATA[audioName].file.length()),true);
+ activated=true;
+}
+void EnvironmentalAudio::Deactivate(){
+ if(!activated)return;
+ if(soundInstance!=std::numeric_limits::max()){
+ Audio::Engine().UnloadSound(soundInstance);
+ }
+ soundInstance=std::numeric_limits::max();
+ activated=false;
+}
+void EnvironmentalAudio::UpdateEnvironmentalAudio(){
+ for(const EnvironmentalAudio&aud:game->GetCurrentMap().environmentalAudioData){
+ EnvironmentalAudio&audio=const_cast(aud);
+ audio.Update();
+ }
+}
+void EnvironmentalAudio::Update(){
+ float distanceFromPlayer=geom2d::line(game->GetPlayer()->GetPos(),pos).length();
+ if(distanceFromPlayerACTIVATION_RANGE){
+ Deactivate();
+ return; //Do not need to continue processing if the sound is not even going to be heard.
+ }
+ float distRatio=1-distanceFromPlayer/ACTIVATION_RANGE; //0-1 where 1 is full volume.
+ float xDistRatio=(pos.x-game->GetPlayer()->GetX())/ACTIVATION_RANGE; //0-1 where 1 is full volume.
+
+ Audio::Engine().SetVolume(soundInstance,distRatio);
+ Audio::Engine().SetPan(soundInstance,xDistRatio);
+}
\ No newline at end of file
diff --git a/Adventures in Lestoria/EnvironmentalAudio.h b/Adventures in Lestoria/EnvironmentalAudio.h
new file mode 100644
index 00000000..f98d0e65
--- /dev/null
+++ b/Adventures in Lestoria/EnvironmentalAudio.h
@@ -0,0 +1,67 @@
+#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
+#include "olcPixelGameEngine.h"
+
+using EnvironmentalAudioSoundName=std::string;
+using FileName=std::string;
+
+struct EnvironmentalAudioData{
+ FileName file;
+ float volume; //0.0f-1.0f
+};
+
+class EnvironmentalAudio{
+ friend class AiL;
+ vf2d pos;
+ std::string audioName;
+ static float ACTIVATION_RANGE;
+ bool activated=false;
+ size_t soundInstance=std::numeric_limits::max();
+ static std::mapSOUND_DATA;
+public:
+ static void Initialize();
+ EnvironmentalAudio();
+ EnvironmentalAudio(const std::string_view audioName,const vf2d pos);
+ void SetPos(const vf2d&pos);
+ void SetAudioName(const std::string_view audioName);
+ void Activate();
+ void Deactivate();
+ static void UpdateEnvironmentalAudio();
+ void Update();
+};
\ No newline at end of file
diff --git a/Adventures in Lestoria/Item.cpp b/Adventures in Lestoria/Item.cpp
index 21b197c0..bdd541be 100644
--- a/Adventures in Lestoria/Item.cpp
+++ b/Adventures in Lestoria/Item.cpp
@@ -49,6 +49,7 @@ INCLUDE_game
INCLUDE_DATA
INCLUDE_GFX
+const std::string Item::BLANK_ITEM_NAME="";
safemapITEM_DATA;
safemapITEM_SCRIPTS;
safemap>ITEM_CATEGORIES;
@@ -563,11 +564,11 @@ uint32_t Item::Amt()const{
return amt;
};
const std::string&Item::ActualName()const{
- if(_IsBlank())return "";
+ if(_IsBlank())return BLANK_ITEM_NAME;
return it->Name();
};
const std::string Item::DisplayName()const{
- if(_IsBlank())return "";
+ if(_IsBlank())return BLANK_ITEM_NAME;
std::string name=ActualName();
if(IsEquippable()&&EnhancementLevel()>0){
name+=" [+"+std::to_string(EnhancementLevel())+"]";
diff --git a/Adventures in Lestoria/Item.h b/Adventures in Lestoria/Item.h
index d776b649..ae9eb521 100644
--- a/Adventures in Lestoria/Item.h
+++ b/Adventures in Lestoria/Item.h
@@ -109,7 +109,7 @@ public:
friend const bool operator==(const Stats&lhs,const Stats&rhs){return lhs.attributes==rhs.attributes;}
};
-class Stats;
+struct Stats;
class CraftingRequirement;
struct EnhancementLevelInfo{
@@ -171,6 +171,7 @@ private:
static int IsBlankStaticCallCounter;
const bool _IsBlank()const;
public:
+ static const std::string BLANK_ITEM_NAME;
Item();
Item(uint32_t amt,IT item,uint8_t enhancementLevel=0);
uint32_t Amt()const;
diff --git a/Adventures in Lestoria/Map.cpp b/Adventures in Lestoria/Map.cpp
index 8cc43ac0..f8657e6b 100644
--- a/Adventures in Lestoria/Map.cpp
+++ b/Adventures in Lestoria/Map.cpp
@@ -51,23 +51,23 @@ Map&MapHelper::MapFromString(std::string mapName){
void TileGroup::InsertTile(TileRenderData tile){
if(tiles.size()==0){
- range={tile.pos,{game->GetCurrentMap().tilewidth,game->GetCurrentMap().tilewidth}};
+ range={tile.pos,{game->GetCurrentMapData().tilewidth,game->GetCurrentMapData().tilewidth}};
minX=tile.pos.x;
- maxX=minX+game->GetCurrentMap().tilewidth;
+ maxX=minX+game->GetCurrentMapData().tilewidth;
minY=tile.pos.y;
- maxY=minY+game->GetCurrentMap().tilewidth;
+ maxY=minY+game->GetCurrentMapData().tilewidth;
} else {
if(tile.pos.xGetCurrentMap().tilewidth>maxX){
- maxX=tile.pos.x+game->GetCurrentMap().tilewidth;
+ if(tile.pos.x+game->GetCurrentMapData().tilewidth>maxX){
+ maxX=tile.pos.x+game->GetCurrentMapData().tilewidth;
}
if(tile.pos.yGetCurrentMap().tilewidth>maxY){
- maxY=tile.pos.y+game->GetCurrentMap().tilewidth;
+ if(tile.pos.y+game->GetCurrentMapData().tilewidth>maxY){
+ maxY=tile.pos.y+game->GetCurrentMapData().tilewidth;
}
range={{minX,minY},{maxX-minX,maxY-minY}};
}
diff --git a/Adventures in Lestoria/Map.h b/Adventures in Lestoria/Map.h
index 75daf8e5..f82c67a5 100644
--- a/Adventures in Lestoria/Map.h
+++ b/Adventures in Lestoria/Map.h
@@ -39,19 +39,10 @@ All rights reserved.
#include "olcUTIL_Geometry2D.h"
#include
#include "TMXParser.h"
+#include "MapName.h"
struct XMLTag;
-enum MapName{
- CAMPAIGN_1_1,
- CAMPAIGN_1_2,
- CAMPAIGN_1_3,
- CAMPAIGN_1_4,
- CAMPAIGN_1_5,
- BOSS_1,
- WORLD_MAP
-};
-
class MapHelper{
public:
static Map&MapFromString(std::string mapName);
diff --git a/Adventures in Lestoria/MapName.h b/Adventures in Lestoria/MapName.h
new file mode 100644
index 00000000..82bf6af7
--- /dev/null
+++ b/Adventures in Lestoria/MapName.h
@@ -0,0 +1,48 @@
+#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/Menu.h b/Adventures in Lestoria/Menu.h
index 4f535bf0..2fc80d45 100644
--- a/Adventures in Lestoria/Menu.h
+++ b/Adventures in Lestoria/Menu.h
@@ -108,7 +108,6 @@ class Menu:public IAttributable{
static void InitializeUserIDWindow();
friend class AiL;
- friend struct Player;
friend class ItemInfo;
friend class EntityStats;
diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp
index 9d35045f..91503343 100644
--- a/Adventures in Lestoria/Monster.cpp
+++ b/Adventures in Lestoria/Monster.cpp
@@ -113,17 +113,17 @@ void Monster::PerformIdleAnimation(){
}
bool Monster::SetX(float x){
vf2d newPos={x,pos.y};
- vi2d tilePos=vi2d(newPos/float(game->GetCurrentMap().tilewidth))*game->GetCurrentMap().tilewidth;
+ vi2d tilePos=vi2d(newPos/float(game->GetCurrentMapData().tilewidth))*game->GetCurrentMapData().tilewidth;
geom2d::rectcollisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel);
if(collisionRect.pos==vi2d{0,0}&&collisionRect.size==vi2d{1,1}){
- pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult()));
+ pos.x=std::clamp(x,game->GetCurrentMapData().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMapData().width*game->GetCurrentMapData().tilewidth-game->GetCurrentMapData().tilewidth/2.f*GetSizeMult()));
Moved();
return true;
} else {
geom2d::rectcollision={collisionRect.pos,collisionRect.size};
collision.pos+=tilePos;
if(!geom2d::overlaps(geom2d::circle(newPos,12*GetSizeMult()),collision)){
- pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult()));
+ pos.x=std::clamp(x,game->GetCurrentMapData().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMapData().width*game->GetCurrentMapData().tilewidth-game->GetCurrentMapData().tilewidth/2.f*GetSizeMult()));
Moved();
return true;
}
@@ -132,17 +132,17 @@ bool Monster::SetX(float x){
}
bool Monster::SetY(float y){
vf2d newPos={pos.x,y};
- vi2d tilePos=vi2d(newPos/float(game->GetCurrentMap().tilewidth))*game->GetCurrentMap().tilewidth;
+ vi2d tilePos=vi2d(newPos/float(game->GetCurrentMapData().tilewidth))*game->GetCurrentMapData().tilewidth;
geom2d::rectcollisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel);
if(collisionRect.pos==vi2d{0,0}&&collisionRect.size==vi2d{1,1}){
- pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult()));
+ pos.y=std::clamp(y,game->GetCurrentMapData().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMapData().height*game->GetCurrentMapData().tilewidth-game->GetCurrentMapData().tilewidth/2.f*GetSizeMult()));
Moved();
return true;
} else {
geom2d::rectcollision={collisionRect.pos,collisionRect.size};
collision.pos+=tilePos;
- if(!geom2d::overlaps(geom2d::circle(newPos,game->GetCurrentMap().tilewidth/2*GetSizeMult()),collision)){
- pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult()));
+ if(!geom2d::overlaps(geom2d::circle(newPos,game->GetCurrentMapData().tilewidth/2*GetSizeMult()),collision)){
+ pos.y=std::clamp(y,game->GetCurrentMapData().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMapData().height*game->GetCurrentMapData().tilewidth-game->GetCurrentMapData().tilewidth/2.f*GetSizeMult()));
Moved();
return true;
}
@@ -385,7 +385,7 @@ void Monster::StartPathfinding(float pathingTime){
void Monster::PathAroundBehavior(float fElapsedTime){
if(path.size()>0){
//Move towards the new path.
- geom2d::line moveTowardsLine=geom2d::line(pos,path[pathIndex]*float(game->GetCurrentMap().tilewidth));
+ geom2d::line moveTowardsLine=geom2d::line(pos,path[pathIndex]*float(game->GetCurrentMapData().tilewidth));
if(moveTowardsLine.length()>2){
SetPos(pos+moveTowardsLine.vector().norm()*100*fElapsedTime*GetMoveSpdMult());
if(moveTowardsLine.vector().x>0){
diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h
index f8cfb684..be34e971 100644
--- a/Adventures in Lestoria/Monster.h
+++ b/Adventures in Lestoria/Monster.h
@@ -49,7 +49,6 @@ All rights reserved.
INCLUDE_ITEM_DATA
struct DamageNumber;
-struct Player;
class AiL;
enum class Attribute;
@@ -109,7 +108,7 @@ struct MonsterData{
};
-struct Monster:IAttributable{
+class Monster:IAttributable{
friend struct STRATEGY;
public:
Monster()=delete;
diff --git a/Adventures in Lestoria/Pathfinding.cpp b/Adventures in Lestoria/Pathfinding.cpp
index a550d4cb..c50adce5 100644
--- a/Adventures in Lestoria/Pathfinding.cpp
+++ b/Adventures in Lestoria/Pathfinding.cpp
@@ -45,68 +45,68 @@ void Pathfinding::Initialize(){
if(nodes!=nullptr){
delete[] nodes;
}
- nodes = NEW sNode[game->GetCurrentMap().width * game->GetCurrentMap().height];
- for (int x = 0; x < game->GetCurrentMap().width; x++)
- for (int y = 0; y < game->GetCurrentMap().height; y++)
+ nodes = NEW sNode[game->GetCurrentMapData().width * game->GetCurrentMapData().height];
+ for (int x = 0; x < game->GetCurrentMapData().width; x++)
+ for (int y = 0; y < game->GetCurrentMapData().height; y++)
{
- nodes[y * game->GetCurrentMap().width + x].x = x; // ...because we give each node its own coordinates
- nodes[y * game->GetCurrentMap().width + x].y = y;
- geom2d::recttile=game->GetTileCollision(game->GetCurrentLevel(),{float(x*game->GetCurrentMap().tilewidth),float(y*game->GetCurrentMap().tilewidth)});
- nodes[y * game->GetCurrentMap().width + x].bObstacle = tile.pos!=game->NO_COLLISION.pos||tile.size!=game->NO_COLLISION.size;
- tile=game->GetTileCollision(game->GetCurrentLevel(),{float(x*game->GetCurrentMap().tilewidth),float(y*game->GetCurrentMap().tilewidth)},true);
- nodes[y * game->GetCurrentMap().width + x].bObstacleUpper = tile.pos!=game->NO_COLLISION.pos||tile.size!=game->NO_COLLISION.size;
- nodes[y * game->GetCurrentMap().width + x].parent = nullptr;
- nodes[y * game->GetCurrentMap().width + x].bVisited = false;
+ nodes[y * game->GetCurrentMapData().width + x].x = x; // ...because we give each node its own coordinates
+ nodes[y * game->GetCurrentMapData().width + x].y = y;
+ geom2d::recttile=game->GetTileCollision(game->GetCurrentLevel(),{float(x*game->GetCurrentMapData().tilewidth),float(y*game->GetCurrentMapData().tilewidth)});
+ nodes[y * game->GetCurrentMapData().width + x].bObstacle = tile.pos!=game->NO_COLLISION.pos||tile.size!=game->NO_COLLISION.size;
+ tile=game->GetTileCollision(game->GetCurrentLevel(),{float(x*game->GetCurrentMapData().tilewidth),float(y*game->GetCurrentMapData().tilewidth)},true);
+ nodes[y * game->GetCurrentMapData().width + x].bObstacleUpper = tile.pos!=game->NO_COLLISION.pos||tile.size!=game->NO_COLLISION.size;
+ nodes[y * game->GetCurrentMapData().width + x].parent = nullptr;
+ nodes[y * game->GetCurrentMapData().width + x].bVisited = false;
}
- for (int x = 0; x < game->GetCurrentMap().width; x++)
- for (int y = 0; y < game->GetCurrentMap().height; y++)
+ for (int x = 0; x < game->GetCurrentMapData().width; x++)
+ for (int y = 0; y < game->GetCurrentMapData().height; y++)
{
if(y>0)
- nodes[y*game->GetCurrentMap().width + x].vecNeighbours.push_back(&nodes[(y - 1) * game->GetCurrentMap().width + (x + 0)]);
- if(yGetCurrentMap().height-1)
- nodes[y*game->GetCurrentMap().width + x].vecNeighbours.push_back(&nodes[(y + 1) * game->GetCurrentMap().width + (x + 0)]);
+ nodes[y*game->GetCurrentMapData().width + x].vecNeighbours.push_back(&nodes[(y - 1) * game->GetCurrentMapData().width + (x + 0)]);
+ if(yGetCurrentMapData().height-1)
+ nodes[y*game->GetCurrentMapData().width + x].vecNeighbours.push_back(&nodes[(y + 1) * game->GetCurrentMapData().width + (x + 0)]);
if (x>0)
- nodes[y*game->GetCurrentMap().width + x].vecNeighbours.push_back(&nodes[(y + 0) * game->GetCurrentMap().width + (x - 1)]);
- if(xGetCurrentMap().width-1)
- nodes[y*game->GetCurrentMap().width + x].vecNeighbours.push_back(&nodes[(y + 0) * game->GetCurrentMap().width + (x + 1)]);
+ nodes[y*game->GetCurrentMapData().width + x].vecNeighbours.push_back(&nodes[(y + 0) * game->GetCurrentMapData().width + (x - 1)]);
+ if(xGetCurrentMapData().width-1)
+ nodes[y*game->GetCurrentMapData().width + x].vecNeighbours.push_back(&nodes[(y + 0) * game->GetCurrentMapData().width + (x + 1)]);
if (y>0 && x>0)
- nodes[y*game->GetCurrentMap().width + x].vecNeighbours.push_back(&nodes[(y - 1) * game->GetCurrentMap().width + (x - 1)]);
- if (yGetCurrentMap().height-1 && x>0)
- nodes[y*game->GetCurrentMap().width + x].vecNeighbours.push_back(&nodes[(y + 1) * game->GetCurrentMap().width + (x - 1)]);
- if (y>0 && xGetCurrentMap().width-1)
- nodes[y*game->GetCurrentMap().width + x].vecNeighbours.push_back(&nodes[(y - 1) * game->GetCurrentMap().width + (x + 1)]);
- if (yGetCurrentMap().height - 1 && xGetCurrentMap().width-1)
- nodes[y*game->GetCurrentMap().width + x].vecNeighbours.push_back(&nodes[(y + 1) * game->GetCurrentMap().width + (x + 1)]);
+ nodes[y*game->GetCurrentMapData().width + x].vecNeighbours.push_back(&nodes[(y - 1) * game->GetCurrentMapData().width + (x - 1)]);
+ if (yGetCurrentMapData().height-1 && x>0)
+ nodes[y*game->GetCurrentMapData().width + x].vecNeighbours.push_back(&nodes[(y + 1) * game->GetCurrentMapData().width + (x - 1)]);
+ if (y>0 && xGetCurrentMapData().width-1)
+ nodes[y*game->GetCurrentMapData().width + x].vecNeighbours.push_back(&nodes[(y - 1) * game->GetCurrentMapData().width + (x + 1)]);
+ if (yGetCurrentMapData().height - 1 && xGetCurrentMapData().width-1)
+ nodes[y*game->GetCurrentMapData().width + x].vecNeighbours.push_back(&nodes[(y + 1) * game->GetCurrentMapData().width + (x + 1)]);
}
// Manually position the start and end markers so they are not nullptr
- nodeStart = &nodes[(game->GetCurrentMap().height / 2) * game->GetCurrentMap().width + 1];
- nodeEnd = &nodes[(game->GetCurrentMap().height / 2) * game->GetCurrentMap().width + game->GetCurrentMap().width-2];
+ nodeStart = &nodes[(game->GetCurrentMapData().height / 2) * game->GetCurrentMapData().width + 1];
+ nodeEnd = &nodes[(game->GetCurrentMapData().height / 2) * game->GetCurrentMapData().width + game->GetCurrentMapData().width-2];
}
std::vector Pathfinding::Solve_AStar(vf2d startPos,vf2d endPos,float maxRange,bool upperLevel){
float dist=float(sqrt(pow(endPos.x-startPos.x,2)+pow(endPos.y-startPos.y,2)));
- if(dist>maxRange*game->GetCurrentMap().tilewidth)return {};
+ if(dist>maxRange*game->GetCurrentMapData().tilewidth)return {};
- nodeStart=&nodes[int(startPos.y/game->GetCurrentMap().tilewidth)*game->GetCurrentMap().width+int(startPos.x/game->GetCurrentMap().tilewidth)];
- nodeEnd=&nodes[int(endPos.y/game->GetCurrentMap().tilewidth)*game->GetCurrentMap().width+int(endPos.x/game->GetCurrentMap().tilewidth)];
+ nodeStart=&nodes[int(startPos.y/game->GetCurrentMapData().tilewidth)*game->GetCurrentMapData().width+int(startPos.x/game->GetCurrentMapData().tilewidth)];
+ nodeEnd=&nodes[int(endPos.y/game->GetCurrentMapData().tilewidth)*game->GetCurrentMapData().width+int(endPos.x/game->GetCurrentMapData().tilewidth)];
geom2d::rectposPerimeter{{int(std::min(startPos.x,endPos.x)),int(std::min(startPos.y,endPos.y))},{int(abs(endPos.x-startPos.x)),int(abs(endPos.y-startPos.y))}};
- posPerimeter.pos={int(std::clamp(posPerimeter.pos.x-maxRange*game->GetCurrentMap().tilewidth,0.f,game->GetCurrentMap().width*float(game->GetCurrentMap().tilewidth))),int(std::clamp(posPerimeter.pos.y-maxRange*game->GetCurrentMap().tilewidth,0.f,game->GetCurrentMap().height*float(game->GetCurrentMap().tilewidth)))};
- posPerimeter.size={int(std::clamp(posPerimeter.size.x+maxRange*game->GetCurrentMap().tilewidth*2,0.f,game->GetCurrentMap().width*float(game->GetCurrentMap().tilewidth)-posPerimeter.pos.x)),int(std::clamp(posPerimeter.size.y+maxRange*game->GetCurrentMap().tilewidth*2,0.f,game->GetCurrentMap().height*float(game->GetCurrentMap().tilewidth)-posPerimeter.pos.y))};
+ posPerimeter.pos={int(std::clamp(posPerimeter.pos.x-maxRange*game->GetCurrentMapData().tilewidth,0.f,game->GetCurrentMapData().width*float(game->GetCurrentMapData().tilewidth))),int(std::clamp(posPerimeter.pos.y-maxRange*game->GetCurrentMapData().tilewidth,0.f,game->GetCurrentMapData().height*float(game->GetCurrentMapData().tilewidth)))};
+ posPerimeter.size={int(std::clamp(posPerimeter.size.x+maxRange*game->GetCurrentMapData().tilewidth*2,0.f,game->GetCurrentMapData().width*float(game->GetCurrentMapData().tilewidth)-posPerimeter.pos.x)),int(std::clamp(posPerimeter.size.y+maxRange*game->GetCurrentMapData().tilewidth*2,0.f,game->GetCurrentMapData().height*float(game->GetCurrentMapData().tilewidth)-posPerimeter.pos.y))};
- for (int x = 0; x < game->GetCurrentMap().width; x++){
- for (int y = 0; y < game->GetCurrentMap().height; y++){
- if(geom2d::overlaps(posPerimeter,vi2d{x*game->GetCurrentMap().tilewidth,y*game->GetCurrentMap().tilewidth})){
- nodes[y*game->GetCurrentMap().width + x].bVisited = false;
+ for (int x = 0; x < game->GetCurrentMapData().width; x++){
+ for (int y = 0; y < game->GetCurrentMapData().height; y++){
+ if(geom2d::overlaps(posPerimeter,vi2d{x*game->GetCurrentMapData().tilewidth,y*game->GetCurrentMapData().tilewidth})){
+ nodes[y*game->GetCurrentMapData().width + x].bVisited = false;
} else {
- nodes[y*game->GetCurrentMap().width + x].bVisited = true;
+ nodes[y*game->GetCurrentMapData().width + x].bVisited = true;
}
- nodes[y*game->GetCurrentMap().width + x].fGlobalGoal = INFINITY;
- nodes[y*game->GetCurrentMap().width + x].fLocalGoal = INFINITY;
- nodes[y*game->GetCurrentMap().width + x].parent = nullptr; // No parents
+ nodes[y*game->GetCurrentMapData().width + x].fGlobalGoal = INFINITY;
+ nodes[y*game->GetCurrentMapData().width + x].fLocalGoal = INFINITY;
+ nodes[y*game->GetCurrentMapData().width + x].parent = nullptr; // No parents
}
}
diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp
index 417e554f..5c938499 100644
--- a/Adventures in Lestoria/Player.cpp
+++ b/Adventures in Lestoria/Player.cpp
@@ -100,13 +100,13 @@ void Player::Initialize(){
bool Player::SetX(float x){
vf2d newPos={x,pos.y};
- vi2d tilePos=vi2d(newPos/float(game->GetCurrentMap().tilewidth))*game->GetCurrentMap().tilewidth;
+ vi2d tilePos=vi2d(newPos/float(game->GetCurrentMapData().tilewidth))*game->GetCurrentMapData().tilewidth;
geom2d::rectcollisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel);
#pragma region lambdas
auto NoTileCollisionExistsHere=[&](){return collisionRect.pos==game->NO_COLLISION.pos&&collisionRect.size==game->NO_COLLISION.size;};
#pragma endregion
if(NoTileCollisionExistsHere()){
- pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult()));
+ pos.x=std::clamp(x,game->GetCurrentMapData().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMapData().width*game->GetCurrentMapData().tilewidth-game->GetCurrentMapData().tilewidth/2.f*GetSizeMult()));
Moved();
return true;
} else {
@@ -116,7 +116,7 @@ bool Player::SetX(float x){
#pragma endregion
collision.pos+=tilePos;
if(NoPlayerCollisionWithTile()){
- pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult()));
+ pos.x=std::clamp(x,game->GetCurrentMapData().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMapData().width*game->GetCurrentMapData().tilewidth-game->GetCurrentMapData().tilewidth/2.f*GetSizeMult()));
Moved();
return true;
}
@@ -126,13 +126,13 @@ bool Player::SetX(float x){
bool Player::SetY(float y){
vf2d newPos={pos.x,y};
- vi2d tilePos=vi2d(newPos/float(game->GetCurrentMap().tilewidth))*game->GetCurrentMap().tilewidth;
+ vi2d tilePos=vi2d(newPos/float(game->GetCurrentMapData().tilewidth))*game->GetCurrentMapData().tilewidth;
geom2d::rectcollisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel);
#pragma region lambdas
auto NoTileCollisionExistsHere=[&](){return collisionRect.pos==game->NO_COLLISION.pos&&collisionRect.size==game->NO_COLLISION.size;};
#pragma endregion
if(NoTileCollisionExistsHere()){
- pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult()));
+ pos.y=std::clamp(y,game->GetCurrentMapData().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMapData().height*game->GetCurrentMapData().tilewidth-game->GetCurrentMapData().tilewidth/2.f*GetSizeMult()));
Moved();
return true;
} else {
@@ -142,7 +142,7 @@ bool Player::SetY(float y){
#pragma endregion
collision.pos+=tilePos;
if(NoPlayerCollisionWithTile()){
- pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult()));
+ pos.y=std::clamp(y,game->GetCurrentMapData().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMapData().height*game->GetCurrentMapData().tilewidth-game->GetCurrentMapData().tilewidth/2.f*GetSizeMult()));
Moved();
return true;
}
@@ -713,6 +713,7 @@ void Player::Moved(){
upperLevel=false;
}
}
+ EnvironmentalAudio::UpdateEnvironmentalAudio();
}
void Player::Spin(float duration,float spinSpd){
@@ -803,7 +804,7 @@ CastInfo&Player::GetCastInfo(){
}
bool Player::CanPathfindTo(vf2d pos,vf2d targetPos,float range){
- if(targetPos.x<0||targetPos.y<0||targetPos.x>game->GetCurrentMap().width*game->GetCurrentMap().tilewidth||targetPos.y>game->GetCurrentMap().height*game->GetCurrentMap().tileheight)return false;
+ if(targetPos.x<0||targetPos.y<0||targetPos.x>game->GetCurrentMapData().width*game->GetCurrentMapData().tilewidth||targetPos.y>game->GetCurrentMapData().height*game->GetCurrentMapData().tileheight)return false;
std::vectorpathing=game->pathfinder.Solve_AStar(pos,targetPos,range,upperLevel);
return pathing.size()>0&&pathing.size()=5){
m.I(A::PHASE_REPEAT_COUNT)=0;
- float jumpAngle=util::angleTo(m.GetPos(),game->GetCurrentMap().MapSize*game->GetCurrentMap().tilewidth/2); //We jump towards the center to keep the player from constantly dealing with a stuck boss.
- float jumpDistance=ConfigFloat("Phase4.JumpDistance")/100*game->GetCurrentMap().tilewidth;
+ float jumpAngle=util::angleTo(m.GetPos(),game->GetCurrentMapData().MapSize*game->GetCurrentMapData().tilewidth/2); //We jump towards the center to keep the player from constantly dealing with a stuck boss.
+ float jumpDistance=ConfigFloat("Phase4.JumpDistance")/100*game->GetCurrentMapData().tilewidth;
float jumpSpd=jumpDistance/ConfigFloat("Phase4.JumpDuration");
StartJump(ConfigFloat("Phase4.JumpDuration"),m.GetPos()+vf2d{cos(jumpAngle)*jumpDistance,sin(jumpAngle)*jumpDistance},0,jumpSpd);
}else
diff --git a/Adventures in Lestoria/State_MainMenu.cpp b/Adventures in Lestoria/State_MainMenu.cpp
index c320de26..69c492c3 100644
--- a/Adventures in Lestoria/State_MainMenu.cpp
+++ b/Adventures in Lestoria/State_MainMenu.cpp
@@ -49,7 +49,7 @@ void State_MainMenu::OnStateChange(GameState*prevState){
};
void State_MainMenu::OnUserUpdate(AiL*game){
TitleScreen::Update();
- if(AiL::KEY_CONFIRM.Pressed()){
+ if(AiL::KEY_CONFIRM.Released()){
TitleScreen::Skip();
}
};
diff --git a/Adventures in Lestoria/TMXParser.h b/Adventures in Lestoria/TMXParser.h
index 87bfb572..65a17161 100644
--- a/Adventures in Lestoria/TMXParser.h
+++ b/Adventures in Lestoria/TMXParser.h
@@ -40,6 +40,12 @@ All rights reserved.
#include "olcUTIL_Geometry2D.h"
#include
#include
+#include "EnvironmentalAudio.h"
+#include "DEFINES.h"
+#include "MapName.h"
+#include "safemap.h"
+
+INCLUDE_LEVEL_NAMES
using namespace olc;
@@ -94,11 +100,13 @@ struct Map{
Renderable*optimizedTile=nullptr;
std::vector TilesetData;
std::vector LayerData;
+ std::vectorenvironmentalAudioData;
std::string mapType="";
std::string bgmSongName="";
std::setspawns;
std::map SpawnerData; //Spawn groups have IDs, mobs associate which spawner they are tied to via this ID.
std::map> ZoneData;
+ const MapName&GetMapName()const;
std::string FormatLayerData(std::ostream& os, std::vectortiles);
std::string FormatSpawnerData(std::ostream& os, std::maptiles);
friend std::ostream& operator << (std::ostream& os, Map& rhs);
@@ -128,6 +136,7 @@ class TMXParser{
SpawnerTag obj;
int prevSpawner;
ZoneData*prevZoneData=nullptr;
+ EnvironmentalAudio*prevAudioData=nullptr;
void ParseTag(std::string tag);
int monsterPropertyTagCount=-1;
XMLTag monsterTag;
@@ -236,6 +245,9 @@ class TMXParser{
}
return displayStr;
}
+ const MapName&Map::GetMapName()const{
+ return LEVEL_NAMES[name];
+ }
std::ostream& operator <<(std::ostream& os, std::vector& rhs) {
for(XMLTag&tag:rhs){
os <<
@@ -347,7 +359,19 @@ class TMXParser{
parsedMapInfo.mapType=newTag.data["value"];
} else
if (newTag.tag=="property"&&newTag.data["name"]=="Background Music") {
- parsedMapInfo.bgmSongName=newTag.data["value"];
+ if(newTag.data["value"]!="None"){ //None is a default value that we ignore.
+ parsedMapInfo.bgmSongName=newTag.data["value"];
+ }
+ } else
+ if (newTag.tag=="object"&&newTag.data["type"]=="AudioEnvironmentalSound") {
+ parsedMapInfo.environmentalAudioData.emplace_back();
+ prevAudioData=&parsedMapInfo.environmentalAudioData.back();
+ prevAudioData->SetPos({newTag.GetFloat("x"),newTag.GetFloat("y")});
+ } else
+ if (newTag.tag=="property"&&newTag.data["propertytype"]=="EnvironmentalSounds") {
+ if(newTag.data["value"]!="None"){ //None is a default value that we ignore.
+ prevAudioData->SetAudioName(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};
diff --git a/Adventures in Lestoria/TextEntryLabel.h b/Adventures in Lestoria/TextEntryLabel.h
index e193c71c..90668215 100644
--- a/Adventures in Lestoria/TextEntryLabel.h
+++ b/Adventures in Lestoria/TextEntryLabel.h
@@ -81,7 +81,7 @@ public:
if(censored){
return game->TextEntryGetString();
}else{
- MenuLabel::GetLabel();
+ return MenuLabel::GetLabel();
}
}
};
\ No newline at end of file
diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h
index f692c8fa..8851bd00 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 5414
+#define VERSION_BUILD 5466
#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 c5af4223..fb978da7 100644
--- a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
+++ b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
@@ -1,5 +1,5 @@
-