From f15771f79ba6ee193f7c8bd5ac873766c5510447 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 1 Jun 2023 13:03:52 +0200 Subject: [PATCH] skip an extra 1 second black-screen time on startup whenever possible The transition time is still there when entering the title from another game state where it makes sense; especially the intro. --- Aquaria/AnimationEditor.cpp | 2 +- Aquaria/BitBlotLogo.cpp | 2 +- Aquaria/DSQ.cpp | 16 ++++++---------- Aquaria/DSQ.h | 2 +- Aquaria/InGameMenu.cpp | 2 +- Aquaria/Intro.cpp | 2 +- Aquaria/Mod.cpp | 25 ++++++++++++++----------- Aquaria/Mod.h | 1 + Aquaria/ParticleEditor.cpp | 2 +- Aquaria/ScriptInterface.cpp | 2 +- Aquaria/States.cpp | 6 +++--- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Aquaria/AnimationEditor.cpp b/Aquaria/AnimationEditor.cpp index 1365537..9c3a80d 100644 --- a/Aquaria/AnimationEditor.cpp +++ b/Aquaria/AnimationEditor.cpp @@ -1363,7 +1363,7 @@ void AnimationEditor::goToTitle() if (!dsq->returnToScene.empty()) game->transitionToScene(dsq->returnToScene); else - dsq->title(); + dsq->title(false); } void AnimationEditor::quit() diff --git a/Aquaria/BitBlotLogo.cpp b/Aquaria/BitBlotLogo.cpp index f209832..c4f61c1 100644 --- a/Aquaria/BitBlotLogo.cpp +++ b/Aquaria/BitBlotLogo.cpp @@ -62,7 +62,7 @@ void BitBlotLogo::doShortBitBlot() void BitBlotLogo::getOut() { - dsq->title(); + dsq->title(false); } void BitBlotLogo::applyState() diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index ea09d97..bd9c8c9 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -1364,11 +1364,11 @@ void DSQ::init() // Go directly to the title in dev mode if(isDeveloperKeys()) - title(); + title(false); else if (dsq->user.demo.intro != 0) enqueueJumpState("Intro"); else if(dsq->user.demo.shortLogos) - title(); + title(false); else enqueueJumpState("BitBlotLogo"); } @@ -2664,16 +2664,12 @@ void DSQ::title(bool fade) if (fade) { sound->fadeMusic(SFT_OUT, 1); + run(1); + resetTimer(); + sound->stopMusic(); } - run(1); - - resetTimer(); - - if (fade) - sound->stopMusic(); - - user.save(); + //user.save(); if (mod.isActive()) { diff --git a/Aquaria/DSQ.h b/Aquaria/DSQ.h index 584ffb7..81600a6 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -167,7 +167,7 @@ public: void action(int id, int state, int source, InputDevice device); - void title(bool fadeMusic=true); + void title(bool fadeMusic); void cutsceneEffects(bool on); diff --git a/Aquaria/InGameMenu.cpp b/Aquaria/InGameMenu.cpp index dd38b99..5a9957b 100644 --- a/Aquaria/InGameMenu.cpp +++ b/Aquaria/InGameMenu.cpp @@ -3203,7 +3203,7 @@ void InGameMenu::onExitCheckYes() { dsq->sound->stopAllVoice(); dsq->toggleCursor(0, 0.25); - dsq->title(); + dsq->title(true); } void InGameMenu::onExitCheckNo() diff --git a/Aquaria/Intro.cpp b/Aquaria/Intro.cpp index 9be361b..c92b2ea 100644 --- a/Aquaria/Intro.cpp +++ b/Aquaria/Intro.cpp @@ -83,7 +83,7 @@ void Intro::endIntro() dsq->setCutscene(0); - dsq->title(); + dsq->title(true); } bool Intro::waitQuit(float t) diff --git a/Aquaria/Mod.cpp b/Aquaria/Mod.cpp index 5bcee5c..8035924 100644 --- a/Aquaria/Mod.cpp +++ b/Aquaria/Mod.cpp @@ -106,7 +106,7 @@ bool Mod::loadSavedGame(const std::string& path) debugLog("MOD: loadSavedGame/compatScript failed"); setActive(false); - dsq->title(); + dsq->title(false); return false; } @@ -226,13 +226,21 @@ void Mod::applyStart() dsq->continuity.reset(); dsq->scriptInterface.reset(); + if(!tryStart()) + { + setActive(false); + dsq->title(false); + } +} + +bool Mod::tryStart() +{ + // Before loading init.lua, load a compatibility layer, if necessary if(!loadCompatScript()) { debugLog("MOD: compatScript failed"); - setActive(false); - dsq->title(); - return; + return false; } // load the mod-init.lua file @@ -243,17 +251,12 @@ void Mod::applyStart() if (!dsq->runScript(scriptPath, "init")) { debugLog("MOD: runscript failed"); - setActive(false); - dsq->title(); + return false; } if (isActive() && game->sceneToLoad.empty()) { debugLog("MOD: no scene loaded in mod-init"); - setActive(false); - dsq->title(); - } - else if (isActive()) - { + return false; } } diff --git a/Aquaria/Mod.h b/Aquaria/Mod.h index 1e1245c..5065163 100644 --- a/Aquaria/Mod.h +++ b/Aquaria/Mod.h @@ -70,6 +70,7 @@ protected: int debugMenu; int enqueueModStart; void applyStart(); + bool tryStart(); std::string name; std::string path; diff --git a/Aquaria/ParticleEditor.cpp b/Aquaria/ParticleEditor.cpp index 0db9cdb..3e6415c 100644 --- a/Aquaria/ParticleEditor.cpp +++ b/Aquaria/ParticleEditor.cpp @@ -122,7 +122,7 @@ void ParticleEditor::goToTitle() if (!dsq->returnToScene.empty()) game->transitionToScene(dsq->returnToScene); else - dsq->title(); + dsq->title(false); } void ParticleEditor::load() diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index 1db3aea..ed1c7a3 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -3877,7 +3877,7 @@ luaFunc(jumpState) luaFunc(goToTitle) { - dsq->title(); + dsq->title(true); luaReturnNil(); } diff --git a/Aquaria/States.cpp b/Aquaria/States.cpp index 1bda990..7bcc69c 100644 --- a/Aquaria/States.cpp +++ b/Aquaria/States.cpp @@ -239,7 +239,7 @@ void GameOver::applyState() game->transitionToScene(game->sceneToLoad); } else - dsq->title(); + dsq->title(false); } void GameOver::removeState() @@ -252,7 +252,7 @@ void GameOver::removeState() void GameOver::onClick() { if (timer == 0) - dsq->title(); + dsq->title(true); } void GameOver::update(float dt) @@ -426,7 +426,7 @@ void Nag::onExit() switch (dsq->nagType) { case NAG_TOTITLE: - dsq->title(); + dsq->title(true); break; default: case NAG_QUIT: