[Scummvm-git-logs] scummvm master -> 8e35f77e2ddec913e35134be12ef23c6d696c3db

dreammaster dreammaster at scummvm.org
Sat Aug 19 03:54:01 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:
8e35f77e2d TITANIC: Implement F5 & F7 Saving and Loading


Commit: 8e35f77e2ddec913e35134be12ef23c6d696c3db
    https://github.com/scummvm/scummvm/commit/8e35f77e2ddec913e35134be12ef23c6d696c3db
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-08-18T21:53:57-04:00

Commit Message:
TITANIC: Implement F5 & F7 Saving and Loading

Changed paths:
    engines/titanic/main_game_window.cpp
    engines/titanic/titanic.cpp
    engines/titanic/titanic.h


diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index 053712d..cfea98c 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -341,6 +341,12 @@ void CMainGameWindow::keyDown(Common::KeyState keyState) {
 			_gameManager->_gameState.changeView(newView, nullptr);
 		}
 
+	} else if (keyState.keycode == Common::KEYCODE_F5) {
+		// Show the GMM save dialog
+		g_vm->showScummVMSaveDialog();
+	} else if (keyState.keycode == Common::KEYCODE_F7) {
+		// Show the GMM load dialog
+		g_vm->showScummVMRestoreDialog();
 	} else if (_inputAllowed) {
 		_gameManager->_inputTranslator.keyDown(keyState);
 	}
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 8a1b00c..5fd7237 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -25,9 +25,11 @@
 #include "common/config-manager.h"
 #include "common/debug-channels.h"
 #include "common/events.h"
+#include "common/translation.h"
 #include "engines/util.h"
 #include "graphics/scaler.h"
 #include "graphics/thumbnail.h"
+#include "gui/saveload.h"
 #include "titanic/titanic.h"
 #include "titanic/debugger.h"
 #include "titanic/carry/hose.h"
@@ -251,4 +253,41 @@ void TitanicEngine::GUIError(const char *msg, ...) {
 	GUIErrorMessage(buffer);
 }
 
+
+void TitanicEngine::showScummVMSaveDialog() {
+	if (!canSaveGameStateCurrently())
+		return;
+
+	GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
+
+	int slot = dialog->runModalWithCurrentTarget();
+	if (slot >= 0) {
+		Common::String desc = dialog->getResultString();
+
+		if (desc.empty()) {
+			// create our own description for the saved game, the user didn't enter it
+			desc = dialog->createDefaultSaveDescription(slot);
+		}
+
+		// Save the game
+		saveGameState(slot, desc);
+	}
+
+	delete dialog;
+}
+
+void TitanicEngine::showScummVMRestoreDialog() {
+	if (!canLoadGameStateCurrently())
+		return;
+
+	GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
+
+	int slot = dialog->runModalWithCurrentTarget();
+	if (slot >= 0) {
+		loadGameState(slot);
+	}
+
+	delete dialog;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index dc7fd15..0c15cf3 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -191,6 +191,16 @@ public:
 	 * Displays an error message in a GUI dialog
 	 */
 	void GUIError(const char *msg, ...) GCC_PRINTF(2, 3);
+
+	/**
+	 * Shows the ScummVM GMM save dialog
+	 */
+	void showScummVMSaveDialog();
+
+	/**
+	 * Shows the ScummVM GMM load dialog
+	 */
+	void showScummVMRestoreDialog();
 };
 
 extern TitanicEngine *g_vm;





More information about the Scummvm-git-logs mailing list