diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 55932daf..db2d2b7d 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -3728,12 +3728,6 @@ void AiL::InitializeGraphics(){ ItemAttribute::Initialize(); ItemInfo::InitializeItems(); - for(std::string img:VisualNovel::graphicsToLoad){ - Renderable&image=GFX[img]; - LoadResource(image,"GFX_Prefix"_S+img); - } - LOG(VisualNovel::graphicsToLoad.size()<<" images for visual novel engine have been loaded."); - SetFontSprite("GFX_Prefix"_S+"font.png","GFX_Prefix"_S+"font_shadow.png",&gamepack,"GENERATE_GAMEPACK"_B); LOG("Custom font loaded."); diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 7aaf5b22..0c90fb9d 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -103,6 +103,7 @@ class AiL : public olc::PixelGameEngine { friend class GameState; friend class State_GameRun; + friend class VisualNovel; friend class SaveFile; friend class sig::Animation; friend class Audio; diff --git a/Adventures in Lestoria/State_Story.cpp b/Adventures in Lestoria/State_Story.cpp index f8f08451..21fa5900 100644 --- a/Adventures in Lestoria/State_Story.cpp +++ b/Adventures in Lestoria/State_Story.cpp @@ -40,6 +40,8 @@ All rights reserved. #include "Menu.h" #include "AdventuresInLestoria.h" +INCLUDE_GFX + void State_Story::OnStateChange(GameState*prevState){} void State_Story::OnLevelLoad(){} void State_Story::OnUserUpdate(AiL*game){ diff --git a/Adventures in Lestoria/State_Story.h b/Adventures in Lestoria/State_Story.h index fab02062..1da6f76b 100644 --- a/Adventures in Lestoria/State_Story.h +++ b/Adventures in Lestoria/State_Story.h @@ -39,6 +39,7 @@ All rights reserved. #include "GameState.h" class State_Story:public GameState{ +private: virtual void OnStateChange(GameState*prevState)override final; virtual void OnUserUpdate(AiL*game)override final; virtual void Draw(AiL*game)override final; diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 8eb65ce7..a25964e6 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -61,6 +61,8 @@ No damage / No loadout items used / Defeat All TODO Add constructor for safemaps. +IEffect + DEMO ==== diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 79039d56..235c0442 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 13664 +#define VERSION_BUILD 13670 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/VisualNovel.cpp b/Adventures in Lestoria/VisualNovel.cpp index faeb3f7e..5e7dc74a 100644 --- a/Adventures in Lestoria/VisualNovel.cpp +++ b/Adventures in Lestoria/VisualNovel.cpp @@ -205,7 +205,15 @@ void VisualNovel::Reset(){ commands.clear(); commandIndex=0; } +#undef LoadResource //Stupid Windows!!!! void VisualNovel::LoadDialog(std::string dialogName,std::functiondialogFinishedCallbackFunc){ + for(std::string img:VisualNovel::graphicsToLoad){ + GFX.Unlock(); + Renderable&image=GFX[img]; + game->LoadResource(image,"GFX_Prefix"_S+img); + } + GFX.SetInitialized(); + LOG(VisualNovel::graphicsToLoad.size()<<" images for visual novel engine have been loaded."); novel.previousState=GameState::GetCurrentState(); novel.dialogFinishedCallbackFunc=dialogFinishedCallbackFunc; novel.storyLevel=dialogName; @@ -219,6 +227,14 @@ void VisualNovel::LoadDialog(std::string dialogName,std::functiondialogF Menu::themeSelection="Purple"; } void VisualNovel::LoadVisualNovel(std::string storyLevelName){ + for(std::string img:VisualNovel::graphicsToLoad){ + GFX.Unlock(); + Renderable&image=GFX[img]; + game->LoadResource(image,"GFX_Prefix"_S+img); + } + GFX.SetInitialized(); + LOG(VisualNovel::graphicsToLoad.size()<<" images for visual novel engine have been loaded."); + novel.storyLevel=storyLevelName; novel.Reset(); for(std::unique_ptr&command:storyLevelData.at(storyLevelName)){ @@ -266,6 +282,11 @@ void VisualNovel::ExecuteNextCommand(){ } } void VisualNovel::Draw(const uint8_t backgroundAlpha){ + if(game->fadeOutDuration>0&&game->fadeOutDuration-game->GetElapsedTime()<=0.f){ + for(std::string img:graphicsToLoad)GFX.erase(GFX.find(img)); + LOG(graphicsToLoad.size()<<" images for visual novel engine have been unloaded."); + return; + } if(backgroundFilename!=""){ float alpha=backgroundAlpha/255.f; if(transitionTime>0){ diff --git a/Adventures in Lestoria/safemap.h b/Adventures in Lestoria/safemap.h index 63e6cfb3..58eb76e0 100644 --- a/Adventures in Lestoria/safemap.h +++ b/Adventures in Lestoria/safemap.h @@ -94,6 +94,9 @@ public: auto find(const T&key)const{ return map.find(key); } + auto find(T&key){ + return map.find(key); + } auto begin()const{ return map.begin(); } diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index a1a0c45d..dcf1bfb4 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ