From 6dc9dc7e8f3e865e10207da30b69c33dd51be251 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Wed, 31 May 2023 01:10:39 +0200 Subject: [PATCH] now that textures are no longer the bottleneck, speed up editor map reload --- Aquaria/DSQ.cpp | 4 +--- Aquaria/DSQ.h | 2 -- Aquaria/Game.cpp | 22 ++++++++++++++-------- Aquaria/Game.h | 2 ++ Aquaria/SceneEditor.cpp | 4 ++++ 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 7acbc99..38d0297 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -165,8 +165,6 @@ DSQ::DSQ(const std::string& fileSystem, const std::string& extraDataDir) cutscene_text = 0; cutscene_text2 = 0; - doScreenTrans = false; - cutscenePaused = false; inCutscene = false; _canSkipCutscene = false; @@ -2227,7 +2225,7 @@ void DSQ::doLoadMenu() if (selectedSaveSlot != 0) { - dsq->doScreenTrans = true; + game->doScreenTrans = true; } else { diff --git a/Aquaria/DSQ.h b/Aquaria/DSQ.h index 9813f4f..668d0d1 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -327,8 +327,6 @@ public: static void loadModsCallback(const std::string &filename, void *param); static void loadModPackagesCallback(const std::string &filename, void *param); - bool doScreenTrans; - AquariaSaveSlot *selectedSaveSlot; void setStory(); diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 8c1c2a4..6254ab7 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -226,6 +226,8 @@ Game::Game() : StateObject() worldPaused = false; cookingScript = 0; + doScreenTrans = false; + noSceneTransitionFadeout = false; } Game::~Game() @@ -3223,7 +3225,7 @@ void Game::applyState() else dsq->runScript("scripts/maps/map_"+sceneName+".lua", "init", true); - if (!dsq->doScreenTrans && (dsq->overlay->alpha != 0 && !dsq->overlay->alpha.isInterpolating())) + if (!doScreenTrans && (dsq->overlay->alpha != 0 && !dsq->overlay->alpha.isInterpolating())) { if (verbose) debugLog("fading in"); debugLog("FADEIN"); @@ -3237,12 +3239,12 @@ void Game::applyState() core->resetTimer(); } - if (dsq->doScreenTrans) + if (doScreenTrans) { debugLog("SCREENTRANS!"); core->resetTimer(); dsq->toggleCursor(false, 0); - dsq->doScreenTrans = false; + doScreenTrans = false; dsq->transitionSaveSlots(); dsq->overlay->alpha = 0; @@ -3257,7 +3259,7 @@ void Game::applyState() applyingState = false; - if (!dsq->doScreenTrans) + if (!doScreenTrans) { dsq->toggleCursor(true, 0.5); } @@ -5041,10 +5043,14 @@ void Game::removeState() controlHint_ignoreClear = false; clearControlHint(); - dsq->overlay->color = 0; - - dsq->overlay->alpha.interpolateTo(1, fadeTime); - dsq->run(fadeTime); + if(noSceneTransitionFadeout) + noSceneTransitionFadeout = false; + else + { + dsq->overlay->color = 0; + dsq->overlay->alpha.interpolateTo(1, fadeTime); + dsq->run(fadeTime); + } dsq->rumble(0,0,0,-1, INPUT_JOYSTICK); diff --git a/Aquaria/Game.h b/Aquaria/Game.h index 600fe63..99d592e 100644 --- a/Aquaria/Game.h +++ b/Aquaria/Game.h @@ -349,6 +349,8 @@ public: int worldMapIndex; bool loadingScene; + bool doScreenTrans; + bool noSceneTransitionFadeout; WaterSurfaceRender *waterSurfaceRender; diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index 95a3912..35b9b40 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -1815,12 +1815,16 @@ void SceneEditor::loadSceneByName() { std::string s = dsq->getUserInputString("Enter Name of Map to Load"); if (!s.empty()) + { + dsq->game->noSceneTransitionFadeout = true; dsq->game->transitionToScene(s); + } } void SceneEditor::reloadScene() { debugLog("reloadScene"); + dsq->game->noSceneTransitionFadeout = true; dsq->game->positionToAvatar = dsq->game->avatar->position; dsq->game->transitionToScene(dsq->game->sceneName); }