[Scummvm-git-logs] scummvm master -> 1b50b3af31ca138dab31be0485c7fa318775f2a0

dreammaster dreammaster at scummvm.org
Sun Jan 14 23:59:51 CET 2018


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:
1b50b3af31 XEEN: Enable loading savegames from the launcher


Commit: 1b50b3af31ca138dab31be0485c7fa318775f2a0
    https://github.com/scummvm/scummvm/commit/1b50b3af31ca138dab31be0485c7fa318775f2a0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-01-14T17:59:43-05:00

Commit Message:
XEEN: Enable loading savegames from the launcher

Changed paths:
    engines/xeen/worldofxeen/worldofxeen.cpp
    engines/xeen/xeen.cpp
    engines/xeen/xeen.h


diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp
index c5f5657..a15bc40 100644
--- a/engines/xeen/worldofxeen/worldofxeen.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen.cpp
@@ -39,8 +39,9 @@ WorldOfXeenEngine::WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *g
 void WorldOfXeenEngine::outerGameLoop() {
 	//_pendingAction = getGameID() == GType_DarkSide ? WOX_DARKSIDE_INTRO : WOX_CLOUDS_INTRO;
 	_pendingAction = WOX_MENU;
-	if (gDebugLevel >= 1)
-		// Skip main menu when starting in debug mode
+
+	if (_loadSaveSlot != -1 || gDebugLevel >= 1)
+		// Skip main menu and go straight to the game
 		_pendingAction = WOX_PLAY_GAME;
 
 	while (!shouldQuit() && _pendingAction != WOX_QUIT) {
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index 9a0e42e..81f629e 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -139,7 +139,8 @@ Common::Error XeenEngine::saveGameState(int slot, const Common::String &desc) {
 }
 
 Common::Error XeenEngine::loadGameState(int slot) {
-	return _saves->loadGameState(slot);
+	_loadSaveSlot = slot;
+	return Common::kNoError;
 }
 
 bool XeenEngine::canLoadGameStateCurrently() {
@@ -173,7 +174,12 @@ void XeenEngine::play() {
 		_party->_mazePosition.y = 21;
 	}
 
-	_map->load(_party->_mazeId);
+	if (_loadSaveSlot >= 0) {
+		_saves->loadGameState(_loadSaveSlot);
+		_loadSaveSlot = -1;
+	} else {
+		_map->load(_party->_mazeId);
+	}
 
 	_interface->startup();
 	if (_mode == MODE_0) {
@@ -199,6 +205,13 @@ void XeenEngine::play() {
 void XeenEngine::gameLoop() {
 	// Main game loop
 	while (!shouldQuit()) {
+		if (_loadSaveSlot >= 0) {
+			// Load any pending savegame
+			int saveSlot = _loadSaveSlot;
+			_loadSaveSlot = -1;
+			_saves->loadGameState(saveSlot);
+		}
+
 		_map->cellFlagLookup(_party->_mazePosition);
 		if (_map->_currentIsEvent) {
 			_quitMode = _scripts->checkEvents();
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index afbec4a..c0ff071 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -102,7 +102,12 @@ class XeenEngine : public Engine {
 private:
 	const XeenGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;
-	int _loadSaveSlot;
+private:
+	void initialize();
+
+	// Engine APIs
+	virtual Common::Error run();
+	virtual bool hasFeature(EngineFeature f) const;
 
 	void play();
 
@@ -110,6 +115,8 @@ private:
 
 	void gameLoop();
 protected:
+	int _loadSaveSlot;
+protected:
 	/**
 	 * Outer gameplay loop responsible for dispatching control to game-specific
 	 * intros, main menus, or to play the actual game
@@ -120,12 +127,6 @@ protected:
 	 * Play the game
 	 */
 	virtual void playGame();
-private:
-	void initialize();
-
-	// Engine APIs
-	virtual Common::Error run();
-	virtual bool hasFeature(EngineFeature f) const;
 public:
 	Combat *_combat;
 	Debugger *_debugger;





More information about the Scummvm-git-logs mailing list