aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/continue_save_dialog.cpp3
-rw-r--r--engines/titanic/core/project_item.cpp1
-rw-r--r--engines/titanic/main_game_window.cpp13
-rw-r--r--engines/titanic/titanic.cpp13
-rw-r--r--engines/titanic/titanic.h2
5 files changed, 28 insertions, 4 deletions
diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp
index 3b447135bd..6de267e9fe 100644
--- a/engines/titanic/continue_save_dialog.cpp
+++ b/engines/titanic/continue_save_dialog.cpp
@@ -78,6 +78,9 @@ int CContinueSaveDialog::show() {
// Event loop waiting for selection
while (!g_vm->shouldQuit() && _selectedSlot == -999) {
g_vm->_events->pollEventsAndWait();
+
+ if (g_vm->_loadSaveSlot != -1)
+ _selectedSlot = g_vm->_loadSaveSlot;
}
if (g_vm->shouldQuit())
_selectedSlot = -2;
diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp
index 0fa5d44511..94689f1600 100644
--- a/engines/titanic/core/project_item.cpp
+++ b/engines/titanic/core/project_item.cpp
@@ -173,6 +173,7 @@ void CProjectItem::loadGame(int slotId) {
// Clear any existing project contents and call preload code
preLoad();
clear();
+ g_vm->_loadSaveSlot = -1;
// Open either an existing savegame slot or the new game template
if (slotId >= 0) {
diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index 2d98c813a6..d84ed8540d 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -65,7 +65,14 @@ void CMainGameWindow::applicationStarting() {
SCREEN_WIDTH / 2 - image.w / 2,
SCREEN_HEIGHT / 2 - image.h / 2
));
- _vm->_events->sleep(5000);
+
+ // Delay for 5 seconds
+ const int NUM_STEPS = 20;
+ for (int idx = 0; idx < NUM_STEPS; ++idx) {
+ _vm->_events->sleep(5000 / NUM_STEPS);
+ if (_vm->_loadSaveSlot >= 0)
+ break;
+ }
}
// Set up the game project, and get game slot
@@ -112,6 +119,10 @@ bool CMainGameWindow::isLoadingFromLauncher() const {
}
int CMainGameWindow::selectSavegame() {
+ // If a savegame was selected from GMM during the startup, return it
+ if (g_vm->_loadSaveSlot != -1)
+ return g_vm->_loadSaveSlot;
+
// If the user selected a savegame from the launcher, return it
if (ConfMan.hasKey("save_slot"))
return ConfMan.getInt("save_slot");
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 9c05a13d81..5af822a235 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -69,6 +69,7 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe
_scriptHandler = nullptr;
_script = nullptr;
CMusicRoom::_musicHandler = nullptr;
+ _loadSaveSlot = -1;
// Set up debug channels
DebugMan.addDebugChannel(kDebugCore, "core", "Core engine debug level");
@@ -188,12 +189,16 @@ void TitanicEngine::setRoomNames() {
bool TitanicEngine::canLoadGameStateCurrently() {
CGameManager *gameManager = _window->_gameManager;
CScreenManager *screenMan = CScreenManager::_screenManagerPtr;
+
+ if (!gameManager)
+ // Allow loading from copyright screen and continue dialogs
+ return true;
if (!_window->_inputAllowed)
return false;
if (screenMan && screenMan->_inputHandler->isLocked())
return false;
- if (!gameManager || !gameManager->isntTransitioning())
+ if (!gameManager->isntTransitioning())
return false;
CProjectItem *project = gameManager->_project;
@@ -220,7 +225,11 @@ bool TitanicEngine::canSaveGameStateCurrently() {
}
Common::Error TitanicEngine::loadGameState(int slot) {
- _window->_project->loadGame(slot);
+ CGameManager *gameManager = _window->_gameManager;
+ if (!gameManager)
+ _loadSaveSlot = slot;
+ else
+ _window->_project->loadGame(slot);
return Common::kNoError;
}
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index 0fea87988b..7fd8cf7297 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -105,7 +105,6 @@ private:
void setRoomNames();
protected:
const TitanicGameDescription *_gameDescription;
- int _loadSaveSlot;
// Engine APIs
virtual void initializePath(const Common::FSNode &gamePath);
@@ -130,6 +129,7 @@ public:
StringArray _roomNames;
Strings _strings;
CString _stateRoomExitView;
+ int _loadSaveSlot;
public:
TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc);
virtual ~TitanicEngine();