[Scummvm-git-logs] scummvm master -> aa3adfb4b12bcfac20aa3caf2d424a3d9e3e24fc

dreammaster dreammaster at scummvm.org
Wed Sep 6 05:01:21 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
aa3adfb4b1 TITANIC: Allow GMM loading from the copyright and continue dialog


Commit: aa3adfb4b12bcfac20aa3caf2d424a3d9e3e24fc
    https://github.com/scummvm/scummvm/commit/aa3adfb4b12bcfac20aa3caf2d424a3d9e3e24fc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-09-05T23:01:12-04:00

Commit Message:
TITANIC: Allow GMM loading from the copyright and continue dialog

Changed paths:
    engines/titanic/continue_save_dialog.cpp
    engines/titanic/core/project_item.cpp
    engines/titanic/main_game_window.cpp
    engines/titanic/titanic.cpp
    engines/titanic/titanic.h


diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp
index 3b44713..6de267e 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 0fa5d44..94689f1 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 2d98c81..d84ed85 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 9c05a13..5af822a 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 0fea879..7fd8cf7 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();





More information about the Scummvm-git-logs mailing list