Moved loading to the fadeout between overworld map and game run state. Added _DEBUG preprocessor checks to prevent debug code from appearing in optimized builds.

pull/29/head
sigonasr2 11 months ago
parent 3e1227a899
commit a2bcee0591
  1. 2
      Adventures in Lestoria/Adventures in Lestoria.tiled-project
  2. 124
      Adventures in Lestoria/AdventuresInLestoria.cpp
  3. 6
      Adventures in Lestoria/AdventuresInLestoria.h
  4. 16
      Adventures in Lestoria/Audio.cpp
  5. 7
      Adventures in Lestoria/Audio.h
  6. 6
      Adventures in Lestoria/State_GameRun.cpp
  7. 3
      Adventures in Lestoria/State_OverworldMap.cpp
  8. 29
      Adventures in Lestoria/TMXParser.h
  9. 20
      Adventures in Lestoria/TODO.txt
  10. 13
      Adventures in Lestoria/TSXParser.h
  11. 8
      Adventures in Lestoria/Toggleable.h
  12. 2
      Adventures in Lestoria/Version.h
  13. 2
      Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
  14. 3
      Adventures in Lestoria/assets/config/configuration.txt
  15. BIN
      x64/Release/Adventures in Lestoria.exe

@ -15,7 +15,7 @@
"type": "enum", "type": "enum",
"values": [ "values": [
"None", "None",
"foresty_1_1" "foresty1_1"
], ],
"valuesAsFlags": false "valuesAsFlags": false
}, },

@ -229,6 +229,8 @@ bool AiL::OnUserCreate(){
Inventory::AddItem("Shell Sword"); Inventory::AddItem("Shell Sword");
Inventory::AddItem("Ring of the Slime King",3); Inventory::AddItem("Ring of the Slime King",3);
Audio::Initialize();
LoadLevel(LEVEL_NAMES["starting_map"_S]); LoadLevel(LEVEL_NAMES["starting_map"_S]);
ChangePlayerClass(WARRIOR); ChangePlayerClass(WARRIOR);
@ -243,8 +245,6 @@ bool AiL::OnUserCreate(){
Stats::InitializeDamageReductionTable(); Stats::InitializeDamageReductionTable();
Audio::Initialize();
utils::datafile::INITIAL_SETUP_COMPLETE=true; utils::datafile::INITIAL_SETUP_COMPLETE=true;
ValidateGameStatus(); //Checks to make sure everything has been initialized properly. ValidateGameStatus(); //Checks to make sure everything has been initialized properly.
@ -851,13 +851,15 @@ void AiL::RenderWorld(float fElapsedTime){
if(!IsForegroundTile(tileSheet,tileSheetIndex)&&!IsUpperForegroundTile(tileSheetIndex)&&!IsReflectiveTile(tileSheet,tileSheetIndex)){ if(!IsForegroundTile(tileSheet,tileSheetIndex)&&!IsUpperForegroundTile(tileSheetIndex)&&!IsReflectiveTile(tileSheet,tileSheetIndex)){
if(layer.tag.data["class"]!="CollisionOnly"){visibleTiles.erase({x,y});} if(layer.tag.data["class"]!="CollisionOnly"){visibleTiles.erase({x,y});}
RenderTile({x,y},tileSheet,tileSheetIndex,{tileSheetX,tileSheetY}); RenderTile({x,y},tileSheet,tileSheetIndex,{tileSheetX,tileSheetY});
if("debug_collision_boxes"_I){ #ifdef _DEBUG
if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){ if("debug_collision_boxes"_I){
geom2d::rect<int>collision=tileSheet.tileset->collision[tileSheetIndex].collision; if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){
view.FillRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth+collision.pos,collision.size,{0,0,0,128}); geom2d::rect<int>collision=tileSheet.tileset->collision[tileSheetIndex].collision;
view.DrawRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth+collision.pos,collision.size,GREY); 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);
}
} }
} #endif
} }
} }
} }
@ -877,13 +879,15 @@ void AiL::RenderWorld(float fElapsedTime){
if(layer.tag.data["class"]!="CollisionOnly"){visibleTiles.erase({x,y});} if(layer.tag.data["class"]!="CollisionOnly"){visibleTiles.erase({x,y});}
RenderTile({x,y},tileSheet,tileSheetIndex,{tileSheetX,tileSheetY}); RenderTile({x,y},tileSheet,tileSheetIndex,{tileSheetX,tileSheetY});
} }
if("debug_collision_boxes"_I){ #ifdef _DEBUG
if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){ if("debug_collision_boxes"_I){
geom2d::rect<int>collision=tileSheet.tileset->collision[tileSheetIndex].collision; if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){
view.FillRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth+collision.pos,collision.size,{0,0,0,128}); geom2d::rect<int>collision=tileSheet.tileset->collision[tileSheetIndex].collision;
view.DrawRectDecal(vi2d{x,y}*GetCurrentMap().tilewidth+collision.pos,collision.size,GREY); 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);
}
} }
} #endif
} }
} }
}break; }break;
@ -1061,11 +1065,13 @@ void AiL::RenderWorld(float fElapsedTime){
int tileSheetX=tileSheetIndex%tileSheetWidth; int tileSheetX=tileSheetIndex%tileSheetWidth;
int tileSheetY=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->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)});
#ifdef DEBUG_COLLISIONS #ifdef _DEBUG
if(tileSheet.tileset.collision.find(tileSheetIndex)!=tileSheet.tileset.collision.end()){ if("debug_collision_boxes"_I){
geom2d::rect<int>collision=tileSheet.tileset.collision[tileSheetIndex].collision; if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){
view.FillRectDecal(vi2d{x,y}*game->GetCurrentMap().tilewidth+collision.pos,collision.size,{0,0,0,128}); geom2d::rect<int>collision=tileSheet.tileset->collision[tileSheetIndex].collision;
view.DrawRectDecal(vi2d{x,y}*game->GetCurrentMap().tilewidth+collision.pos,collision.size,GREY); 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);
}
} }
#endif #endif
} }
@ -1241,12 +1247,14 @@ void AiL::RenderWorld(float fElapsedTime){
} }
} }
if(DEBUG_PATHFINDING){ #ifdef _DEBUG
std::vector<vf2d>pathing=game->pathfinder.Solve_AStar(player.get()->GetPos(),GetWorldMousePos(),8,player.get()->OnUpperLevel()); if(DEBUG_PATHFINDING){
for(vf2d&square:pathing){ std::vector<vf2d>pathing=game->pathfinder.Solve_AStar(player.get()->GetPos(),GetWorldMousePos(),8,player.get()->OnUpperLevel());
view.FillRectDecal(square*float(game->GetCurrentMap().tilewidth),{float(game->GetCurrentMap().tilewidth),float(game->GetCurrentMap().tilewidth)},DARK_GREEN); for(vf2d&square:pathing){
view.FillRectDecal(square*float(game->GetCurrentMap().tilewidth),{float(game->GetCurrentMap().tilewidth),float(game->GetCurrentMap().tilewidth)},DARK_GREEN);
}
} }
} #endif
} }
Player*AiL::GetPlayer(){ Player*AiL::GetPlayer(){
@ -1293,17 +1301,20 @@ void AiL::RenderHud(){
DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/4)-24}-GetTextSizeProp(displayText)/2,displayText,BLUE,VERY_DARK_BLUE); DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/4)-24}-GetTextSizeProp(displayText)/2,displayText,BLUE,VERY_DARK_BLUE);
} }
DisplayBossEncounterInfo(); DisplayBossEncounterInfo();
if("debug_player_info"_I){ #ifdef _DEBUG
DrawShadowStringDecal({0,128},player->GetPos().str()); if("debug_player_info"_I){
DrawShadowStringDecal({0,136},"Spd: "+std::to_string(player->GetMoveSpdMult())); DrawShadowStringDecal({0,128},player->GetPos().str());
DrawShadowStringDecal({0,144},"HP Timer: "+std::to_string(player->hpRecoveryTimer)); DrawShadowStringDecal({0,136},"Spd: "+std::to_string(player->GetMoveSpdMult()));
DrawShadowStringDecal({0,152},"HP Recovery Amt: "+std::to_string(player->GetHPRecoveryPct()*player->GetMaxHealth())); DrawShadowStringDecal({0,144},"HP Timer: "+std::to_string(player->hpRecoveryTimer));
if(!ISBLANK(GetLoadoutItem(0))){ DrawShadowStringDecal({0,152},"HP Recovery Amt: "+std::to_string(player->GetHPRecoveryPct()*player->GetMaxHealth()));
DrawShadowStringDecal({0,92},"Loadout Slot 1 Qty: "+std::to_string(GetLoadoutItem(0).lock()->Amt())); if(!ISBLANK(GetLoadoutItem(0))){
} DrawShadowStringDecal({0,92},"Loadout Slot 1 Qty: "+std::to_string(GetLoadoutItem(0).lock()->Amt()));
DrawShadowStringDecal({0,1},"Selection: "+Menu::menus[INVENTORY_CONSUMABLES]->selection.str()); }
DrawShadowStringDecal({0,12},"Button Hold Time: "+std::to_string(Menu::menus[INVENTORY_CONSUMABLES]->buttonHoldTime)); DrawShadowStringDecal({0,1},"Selection: "+Menu::menus[INVENTORY_CONSUMABLES]->selection.str());
}} DrawShadowStringDecal({0,12},"Button Hold Time: "+std::to_string(Menu::menus[INVENTORY_CONSUMABLES]->buttonHoldTime));
}
#endif
}
void AiL::RenderCooldowns(){ void AiL::RenderCooldowns(){
std::vector<Ability>cooldowns{ std::vector<Ability>cooldowns{
@ -1784,6 +1795,12 @@ void AiL::LoadLevel(MapName map){
camera.MoveCamera(cameraStartPos); camera.MoveCamera(cameraStartPos);
pathfinder.Initialize(); pathfinder.Initialize();
Audio::SetAudioEvent("Default Volume");
game->audioEngine.fullyLoaded=true; //We assume there's no audio to load, so we just set the audio as fully loaded by default.
if(MAP_DATA[map].bgmSongName.length()>0){
Audio::PlayBGM(MAP_DATA[map].bgmSongName);
DisableFadeIn(true);
}
} }
bool AiL::IsUpperForegroundTile(int tileID){ bool AiL::IsUpperForegroundTile(int tileID){
@ -2075,12 +2092,14 @@ datafile operator ""_A(const char*key,std::size_t len){
} }
void AiL::OutputDebugInfo(const char*key,std::size_t len){ void AiL::OutputDebugInfo(const char*key,std::size_t len){
if(utils::datafile::DEBUG_ACCESS_OPTIONS){ #ifdef _DEBUG
std::string k=std::string(key); if(utils::datafile::DEBUG_ACCESS_OPTIONS){
if(!k.starts_with("debug_")){ std::string k=std::string(key);
std::cout<<"Reading "<<k<<std::endl; if(!k.starts_with("debug_")){
std::cout<<"Reading "<<k<<std::endl;
}
} }
} #endif
} }
bool AiL::IsReflectiveTile(TilesheetData tileSheet,int tileID){ bool AiL::IsReflectiveTile(TilesheetData tileSheet,int tileID){
@ -2473,6 +2492,9 @@ void AiL::ClearLoadoutItem(int slot){
} }
void AiL::RenderFadeout(){ void AiL::RenderFadeout(){
if(Audio::BGMFullyLoaded()){
game->DisableFadeIn(false);
}
uint8_t alpha=0; uint8_t alpha=0;
if(fadeOutDuration>0){ if(fadeOutDuration>0){
fadeOutDuration=std::max(0.f,fadeOutDuration-GetElapsedTime()); fadeOutDuration=std::max(0.f,fadeOutDuration-GetElapsedTime());
@ -2482,14 +2504,26 @@ void AiL::RenderFadeout(){
alpha=uint8_t(util::lerp(0,255,1-(fadeOutDuration/fadeOutTotalTime))); alpha=uint8_t(util::lerp(0,255,1-(fadeOutDuration/fadeOutTotalTime)));
}else }else
if(fadeInDuration>0){ if(fadeInDuration>0){
fadeInDuration=std::max(0.f,fadeInDuration-GetElapsedTime()); if(!disableFadeIn){
alpha=uint8_t(util::lerp(255,0,1-(fadeInDuration/fadeOutTotalTime))); fadeInDuration=std::max(0.f,fadeInDuration-GetElapsedTime());
alpha=uint8_t(util::lerp(255,0,1-(fadeInDuration/fadeOutTotalTime)));
}else{
alpha=255;
}
} }
FillRectDecal({0,0},GetScreenSize(),{0,0,0,alpha}); FillRectDecal({0,0},GetScreenSize(),{0,0,0,alpha});
#ifdef _DEBUG
if("debug_transition_info"_I){
DrawShadowStringDecal({2,2},"Alpha: "+std::to_string(alpha));
DrawShadowStringDecal({2,14},"Disable Fade In: "+std::to_string(disableFadeIn));
DrawShadowStringDecal({2,26},"Fully Loaded: "+std::to_string(audioEngine.fullyLoaded));
}
#endif
} }
bool AiL::GamePaused(){ bool AiL::GamePaused(){
return fadeOutDuration>0; return fadeOutDuration>0||disableFadeIn;
} }
void AiL::EndGame(){ void AiL::EndGame(){
@ -2585,4 +2619,8 @@ void AiL::OnRequestCompleted(const std::string_view receivedData)const{
std::string operator ""_FS(const char*key,std::size_t len){ std::string operator ""_FS(const char*key,std::size_t len){
AiL::OutputDebugInfo(key,len); AiL::OutputDebugInfo(key,len);
return DATA.GetProperty(std::string(key,len)).GetFullString(); return DATA.GetProperty(std::string(key,len)).GetFullString();
}
void AiL::DisableFadeIn(const bool disable){
disableFadeIn=disable;
} }

@ -111,13 +111,14 @@ private:
int chapter=1; //We start at chapter 1. int chapter=1; //We start at chapter 1.
std::array<std::shared_ptr<Item>,3>loadout; std::array<std::shared_ptr<Item>,3>loadout;
float fadeOutDuration=0; float fadeOutDuration=0;
float fadeOutTotalTime=0;
float fadeInDuration=0;
States::State transitionState=States::State::GAME_RUN; States::State transitionState=States::State::GAME_RUN;
bool gameEnd=false; bool gameEnd=false;
std::vector<Monster>monstersToBeSpawned; std::vector<Monster>monstersToBeSpawned;
time_t gameStarted; time_t gameStarted;
std::function<void(std::string_view)>responseCallback; std::function<void(std::string_view)>responseCallback;
float fadeInDuration=0;
float fadeOutTotalTime=0;
bool disableFadeIn=false;
void ValidateGameStatus(); void ValidateGameStatus();
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
@ -213,6 +214,7 @@ public:
void InitializePlayerLevelCap(); void InitializePlayerLevelCap();
void ResetGame(); void ResetGame();
void OnRequestCompleted(const std::string_view receivedData)const override; void OnRequestCompleted(const std::string_view receivedData)const override;
void DisableFadeIn(const bool disable);
struct TileGroupData{ struct TileGroupData{
vi2d tilePos; vi2d tilePos;

@ -98,6 +98,8 @@ void Audio::Initialize(){
defaultFadeTime=data.GetReal(); defaultFadeTime=data.GetReal();
} }
} }
Self().bgm.SetInitialized();
} }
MiniAudio&Audio::Engine(){ MiniAudio&Audio::Engine(){
@ -108,6 +110,7 @@ void Audio::Play(const std::string_view sound){
}; };
void Audio::PlayBGM(const std::string_view sound,const bool loop){ void Audio::PlayBGM(const std::string_view sound,const bool loop){
BGM&track=Self().bgm[std::string(sound)]; BGM&track=Self().bgm[std::string(sound)];
Self().fullyLoaded=false;
StopBGM(); //Stop any currently playing track. StopBGM(); //Stop any currently playing track.
Self().playParams={std::string(sound),loop}; Self().playParams={std::string(sound),loop};
Self().playBGMWaitTime=0.7f; Self().playBGMWaitTime=0.7f;
@ -131,13 +134,15 @@ const Volume&Audio::BGM::GetVolume(const Event&eventName,const ChannelID&id)cons
} }
void Audio::BGM::Load(){ void Audio::BGM::Load(){
BGM&bgm=Self().bgm[Self().currentBGM];
if(Self().BGMIsPlaying()){ if(Self().BGMIsPlaying()){
bgm.Unload(); BGM&bgm=Self().bgm[Self().currentBGM];
if(Self().BGMIsPlaying()){
bgm.Unload();
}
} }
Self().currentBGM=songFileName; Self().currentBGM=songFileName;
BGM&newBgm=Self().bgm[songFileName]; BGM&newBgm=Self().bgm[songFileName];
if(newBgm.channels.size()>0)ERR(std::format("WARNING! The size of the channels list is greater than zero! Size: {}",bgm.channels.size())); if(newBgm.channels.size()>0)ERR(std::format("WARNING! The size of the channels list is greater than zero! Size: {}",newBgm.channels.size()));
for(const ChannelName&channel:newBgm.GetChannels()){ for(const ChannelName&channel:newBgm.GetChannels()){
ChannelID soundID=Engine().LoadSound("bgm_directory"_S+channel); ChannelID soundID=Engine().LoadSound("bgm_directory"_S+channel);
newBgm.channels.push_back(soundID); newBgm.channels.push_back(soundID);
@ -242,6 +247,11 @@ void Audio::Update(){
Engine().Play(trackID,Self().playParams.loop); Engine().Play(trackID,Self().playParams.loop);
channelListIndex++; channelListIndex++;
} }
Self().fullyLoaded=true;
} }
} }
}
const bool Audio::BGMFullyLoaded(){
return Self().fullyLoaded;
} }

@ -39,6 +39,7 @@ All rights reserved.
#include "olcPGEX_MiniAudio.h" #include "olcPGEX_MiniAudio.h"
#include "config.h" #include "config.h"
#include <set> #include <set>
#include "safemap.h"
using SongName=std::string; using SongName=std::string;
using Event=std::string; using Event=std::string;
@ -49,6 +50,7 @@ using Volume=float;
using VolumeList=std::vector<Volume>; using VolumeList=std::vector<Volume>;
class Audio{ class Audio{
friend class AiL;
public: public:
static Audio&Self(); static Audio&Self();
static MiniAudio&Engine(); static MiniAudio&Engine();
@ -62,6 +64,7 @@ public:
static const SongName&GetTrackName(); static const SongName&GetTrackName();
static void SetAudioEvent(const Event&eventName); static void SetAudioEvent(const Event&eventName);
static const bool BGMIsPlaying(); static const bool BGMIsPlaying();
static const bool BGMFullyLoaded(); //Fully loaded means when the audio buffer has finished filling up, which means sound is now playing.
private: private:
struct BGMPlayParams{ struct BGMPlayParams{
std::string sound; std::string sound;
@ -100,11 +103,11 @@ private:
private: private:
MiniAudio audioEngine; MiniAudio audioEngine;
SongName currentBGM=""; SongName currentBGM="";
std::map<SongName,BGM>bgm; safemap<SongName,BGM>bgm;
std::set<Event>events; std::set<Event>events;
static float defaultFadeTime; static float defaultFadeTime;
Event currentAudioEvent="Default Volume"; Event currentAudioEvent="Default Volume";
bool fullyLoaded=true;
float playBGMWaitTime=0.0f; float playBGMWaitTime=0.0f;
BGMPlayParams playParams; BGMPlayParams playParams;
}; };

@ -41,9 +41,11 @@ All rights reserved.
#include "Menu.h" #include "Menu.h"
#include "ItemDrop.h" #include "ItemDrop.h"
#include "VisualNovel.h" #include "VisualNovel.h"
#include "State_OverworldMap.h"
INCLUDE_MONSTER_LIST INCLUDE_MONSTER_LIST
INCLUDE_game INCLUDE_game
INCLUDE_LEVEL_NAMES
void State_GameRun::OnStateChange(GameState*prevState){ void State_GameRun::OnStateChange(GameState*prevState){
if(Menu::IsMenuOpen()){ if(Menu::IsMenuOpen()){
@ -52,6 +54,7 @@ void State_GameRun::OnStateChange(GameState*prevState){
game->GetPlayer()->SetState(State::NORMAL); game->GetPlayer()->SetState(State::NORMAL);
port=ViewPort::rectViewPort({0,0},{240,240},{24,24}); port=ViewPort::rectViewPort({0,0},{240,240},{24,24});
#pragma region Test Text Decal Creation
if(r.Decal()==nullptr){ if(r.Decal()==nullptr){
r.Create(240,240); r.Create(240,240);
game->SetDrawTarget(r.Sprite()); game->SetDrawTarget(r.Sprite());
@ -66,6 +69,9 @@ void State_GameRun::OnStateChange(GameState*prevState){
game->SetDrawTarget(nullptr); game->SetDrawTarget(nullptr);
r.Decal()->Update(); r.Decal()->Update();
} }
#pragma endregion
game->LoadLevel(LEVEL_NAMES.at(State_OverworldMap::GetCurrentConnectionPoint().map));
} }
void State_GameRun::OnUserUpdate(AiL*game){ void State_GameRun::OnUserUpdate(AiL*game){
game->bossDisplayTimer=std::max(0.f,game->bossDisplayTimer-game->GetElapsedTime()); game->bossDisplayTimer=std::max(0.f,game->bossDisplayTimer-game->GetElapsedTime());

@ -215,8 +215,7 @@ void State_OverworldMap::StartLevel(){
if(State_OverworldMap::GetCurrentConnectionPoint().map.starts_with("STORY")){ if(State_OverworldMap::GetCurrentConnectionPoint().map.starts_with("STORY")){
VisualNovel::LoadVisualNovel(State_OverworldMap::GetCurrentConnectionPoint().map); VisualNovel::LoadVisualNovel(State_OverworldMap::GetCurrentConnectionPoint().map);
}else{ }else{
game->LoadLevel(LEVEL_NAMES.at(State_OverworldMap::GetCurrentConnectionPoint().map)); GameState::ChangeState(States::GAME_RUN,0.3f);
GameState::ChangeState(States::GAME_RUN);
} }
} }

@ -95,6 +95,7 @@ struct Map{
std::vector<XMLTag> TilesetData; std::vector<XMLTag> TilesetData;
std::vector<LayerTag> LayerData; std::vector<LayerTag> LayerData;
std::string mapType=""; std::string mapType="";
std::string bgmSongName="";
std::set<std::string>spawns; std::set<std::string>spawns;
std::map<int,SpawnerTag> SpawnerData; //Spawn groups have IDs, mobs associate which spawner they are tied to via this ID. std::map<int,SpawnerTag> SpawnerData; //Spawn groups have IDs, mobs associate which spawner they are tied to via this ID.
std::map<std::string,std::vector<::ZoneData>> ZoneData; std::map<std::string,std::vector<::ZoneData>> ZoneData;
@ -144,6 +145,7 @@ class TMXParser{
#ifdef TMX_PARSER_SETUP #ifdef TMX_PARSER_SETUP
#undef TMX_PARSER_SETUP #undef TMX_PARSER_SETUP
#include "State_OverworldMap.h" #include "State_OverworldMap.h"
extern bool _MAP_LOAD_INFO;
extern bool _DEBUG_MAP_LOAD_INFO; extern bool _DEBUG_MAP_LOAD_INFO;
const std::string XMLTag::FormatTagData(std::map<std::string,std::string>tiles){ const std::string XMLTag::FormatTagData(std::map<std::string,std::string>tiles){
std::string displayStr=""; std::string displayStr="";
@ -285,7 +287,9 @@ class TMXParser{
if(valid&&data.length()>0){ if(valid&&data.length()>0){
if (newTag.tag.length()==0) { //Tag's empty, so first line is the tag. if (newTag.tag.length()==0) { //Tag's empty, so first line is the tag.
newTag.tag=data; newTag.tag=data;
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Tag: "<<newTag.tag<<"\n"; #if _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Tag: "<<newTag.tag<<"\n";
#endif
} else { } else {
std::string key = data.substr(0,data.find("=")); std::string key = data.substr(0,data.find("="));
std::string value = data.substr(data.find("=")+1,std::string::npos); std::string value = data.substr(data.find("=")+1,std::string::npos);
@ -295,7 +299,9 @@ class TMXParser{
value = value.substr(0,value.length()-1); value = value.substr(0,value.length()-1);
newTag.data[key]=value; newTag.data[key]=value;
if(_DEBUG_MAP_LOAD_INFO)std::cout<<" "<<key<<":"<<newTag.data[key]<<"\n"; #if _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<" "<<key<<":"<<newTag.data[key]<<"\n";
#endif
} }
} }
} }
@ -340,6 +346,9 @@ class TMXParser{
if (newTag.tag=="property"&&newTag.data["name"]=="Level Type") { if (newTag.tag=="property"&&newTag.data["name"]=="Level Type") {
parsedMapInfo.mapType=newTag.data["value"]; parsedMapInfo.mapType=newTag.data["value"];
} else } else
if (newTag.tag=="property"&&newTag.data["name"]=="Background Music") {
parsedMapInfo.bgmSongName=newTag.data["value"];
} else
if (newTag.tag=="object"&&newTag.data["type"]=="PlayerSpawnLocation") { 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}; parsedMapInfo.MapData.playerSpawnLocation={newTag.GetInteger("x")-newTag.GetInteger("width")/2,newTag.GetInteger("y")-newTag.GetInteger("height")/2};
} else } else
@ -379,9 +388,13 @@ class TMXParser{
prevZoneData=&zones.back(); prevZoneData=&zones.back();
} }
}else{ }else{
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Unsupported tag format! Ignoring."<<"\n"; #if _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Unsupported tag format! Ignoring."<<"\n";
#endif
} }
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"\n"<<"=============\n"; #if _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"\n"<<"=============\n";
#endif
} }
TMXParser::TMXParser(std::string file){ TMXParser::TMXParser(std::string file){
std::ifstream f(file,std::ios::in); std::ifstream f(file,std::ios::in);
@ -426,7 +439,9 @@ class TMXParser{
} }
if(infiniteMap){ if(infiniteMap){
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Infinite map detected. Parsing stopped early."<<std::endl; #if _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Infinite map detected. Parsing stopped early."<<std::endl;
#endif
} }
for(XMLTag&monster:accumulatedMonsterTags){ for(XMLTag&monster:accumulatedMonsterTags){
@ -490,6 +505,8 @@ class TMXParser{
counter++; counter++;
} }
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Parsed Map Data:\n"<<parsedMapInfo<<"\n"; #ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Parsed Map Data:\n"<<parsedMapInfo<<"\n";
#endif
} }
#endif #endif

@ -1,11 +1,6 @@
January 1st January 1st
=========== ===========
The Hub / NPC Interactions The Hub / NPC Interactions
Save/Load Game
EMSCRIPTEN Version: ???
NEW GAME -> Ask for a User ID -> Ask for a Save File Name -> Saves the Game -> Starts the Game
LOAD GAME -> Ask for a User ID -> Shows Available Files -> Click to Load -> Start Game
Audio Engine Audio Engine
- Audio Ambience Zones - Audio Ambience Zones
- Menu Sound Effects - Menu Sound Effects
@ -21,7 +16,13 @@ Settings Menu
-We have to save keybinds to the save file. -We have to save keybinds to the save file.
-Smooth Movement -Smooth Movement
-Click on title screen should not process as input immediately. -Click on title screen should not process as input immediately.
-Investigate why frame rate matters for intro screen. -Investigate why frame rate matters for intro screen.
-Warrior slash should occur even with no target
-Add in other story plates
-Faster main menu screen transition
-Simplify map collision tiles by removing the requirement for hidden boundaries.
-Loading should happen on fadeout.
January 31st January 31st
============ ============
@ -46,4 +47,11 @@ Story proofreading/correcting/storyboarding
- Export/Import Save Files Online/Offline - Export/Import Save Files Online/Offline
- Consider controls for fine-tuning music and how they sound during events. - Consider controls for fine-tuning music and how they sound during events.
- Lock up unimplemented classes.
- Emscripten _DEBUG flag add as an option when building

@ -178,11 +178,15 @@ class TSXParser{
TileCollisionData data; TileCollisionData data;
data.collision=geom2d::rect<int>{{newTag.GetInteger("x"),newTag.GetInteger("y")},{newTag.GetInteger("width"),newTag.GetInteger("height")}}; data.collision=geom2d::rect<int>{{newTag.GetInteger("x"),newTag.GetInteger("y")},{newTag.GetInteger("width"),newTag.GetInteger("height")}};
if(parsedTilesetInfo.CollisionData.count(previousTagID)){ if(parsedTilesetInfo.CollisionData.count(previousTagID)){
if(_DEBUG_MAP_LOAD_INFO)ERR("WARNING! There was already collision data defined for tile "<<previousTagID<<"!") #ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)ERR("WARNING! There was already collision data defined for tile "<<previousTagID<<"!");
#endif
} }
parsedTilesetInfo.CollisionData[previousTagID]=data; parsedTilesetInfo.CollisionData[previousTagID]=data;
} }
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"\n"<<"=============\n"; #ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"\n"<<"=============\n";
#endif
} }
TSXParser::TSXParser(std::string file) TSXParser::TSXParser(std::string file)
:previousTagID(-1){ :previousTagID(-1){
@ -214,7 +218,8 @@ class TSXParser{
} }
} }
} }
#ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Parsed Tileset Data:\n"<<parsedTilesetInfo<<"\n"; if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Parsed Tileset Data:\n"<<parsedTilesetInfo<<"\n";
#endif
} }
#endif #endif

@ -65,9 +65,11 @@ public:
} }
inline IToggleable(){ inline IToggleable(){
uninitializedToggleGroupItems.push_back(this); uninitializedToggleGroupItems.push_back(this);
if("debug_toggleable_items"_I){ #ifdef _DEBUG
std::cout<<"\tInitialized Toggle Item Ptr: 0x"<<std::hex<<this<<std::endl; if("debug_toggleable_items"_I){
} std::cout<<"\tInitialized Toggle Item Ptr: 0x"<<std::hex<<this<<std::endl;
}
#endif
} }
protected: protected:
std::vector<IToggleable*>toggleGroup; std::vector<IToggleable*>toggleGroup;

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 5395 #define VERSION_BUILD 5414
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="205" height="205" tilewidth="24" tileheight="24" infinite="0" backgroundcolor="#475500" nextlayerid="9" nextobjectid="164"> <map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="205" height="205" tilewidth="24" tileheight="24" infinite="0" backgroundcolor="#475500" nextlayerid="9" nextobjectid="164">
<properties> <properties>
<property name="Background Music" propertytype="BGM" value="foresty_1_1"/> <property name="Background Music" propertytype="BGM" value="foresty1_1"/>
<property name="Level Type" propertytype="LevelType" value="Dungeon"/> <property name="Level Type" propertytype="LevelType" value="Dungeon"/>
</properties> </properties>
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/> <tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>

@ -107,6 +107,9 @@ debug_access_options = 0
# Shows map loading output # Shows map loading output
debug_map_load_info = 0 debug_map_load_info = 0
# Shows state transition information
debug_transition_info = 0
# Shows extra info about the player on the HUD # Shows extra info about the player on the HUD
debug_player_info = 0 debug_player_info = 0

Loading…
Cancel
Save