Dynamically load Visual Novel assets. Release Build 13670.
This commit is contained in:
parent
9d097e3cdd
commit
195924932b
@ -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.");
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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){
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -61,6 +61,8 @@ No damage / No loadout items used / Defeat All
|
||||
|
||||
TODO Add constructor for safemaps.
|
||||
|
||||
IEffect
|
||||
|
||||
DEMO
|
||||
====
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -205,7 +205,15 @@ void VisualNovel::Reset(){
|
||||
commands.clear();
|
||||
commandIndex=0;
|
||||
}
|
||||
#undef LoadResource //Stupid Windows!!!!
|
||||
void VisualNovel::LoadDialog(std::string dialogName,std::function<void()>dialogFinishedCallbackFunc){
|
||||
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::function<void()>dialogF
|
||||
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>&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){
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user