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

bgK bastien.bouclet at gmail.com
Sun Sep 9 16:14:13 CEST 2018


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

Summary:
d7b511b98b MOHAWK: RIVEN: Return to main menu after the credits
22ded2c406 MOHAWK: RIVEN: Don't allow opening the main menu from the config screens
e758ff8036 MOHAWK: RIVEN: Don't allow saving from the GMM if no game is started


Commit: d7b511b98ba160339b8d302d7b585fb09ba0517c
    https://github.com/scummvm/scummvm/commit/d7b511b98ba160339b8d302d7b585fb09ba0517c
Author: David Fioramonti (dafioram at gmail.com)
Date: 2018-09-09T16:11:12+02:00

Commit Message:
MOHAWK: RIVEN: Return to main menu after the credits

Like the original the game loop returns to the main menu
after the credits end.

The variable states are reset and the player can start
a new game or load an old one.

Changed paths:
    engines/mohawk/riven_graphics.cpp
    engines/mohawk/riven_stack.cpp
    engines/mohawk/riven_stacks/ospit.cpp


diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index 084019d..71339d6 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -656,6 +656,9 @@ void RivenGraphics::beginCredits() {
 	// Clear the old cache
 	clearCache();
 
+	_creditsImage = kRivenCreditsZeroImage;
+	_creditsPos = 0;
+
 	// Now cache all the credits images
 	for (uint16 i = kRivenCreditsZeroImage; i <= kRivenCreditsLastImage; i++) {
 		MohawkSurface *surface = _bitmapDecoder->decodeImage(_vm->getExtrasResource(ID_TBMP, i));
diff --git a/engines/mohawk/riven_stack.cpp b/engines/mohawk/riven_stack.cpp
index 17baf94..c0a7587 100644
--- a/engines/mohawk/riven_stack.cpp
+++ b/engines/mohawk/riven_stack.cpp
@@ -258,7 +258,16 @@ void RivenStack::runCredits(uint16 video, uint32 delay, uint32 videoFrameCountOv
 		_vm->doFrame();
 	}
 
-	_vm->setGameEnded();
+	videoPtr->stop();
+	_vm->_cursor->showCursor();
+
+	// Clear the game state
+	_vm->startNewGame();
+
+	// Go to the main menu
+	RivenScriptPtr goToMainMenu = _vm->_scriptMan->createScriptWithCommand(
+			new RivenStackChangeCommand(_vm, kStackAspit, 1, true, true));
+	_vm->_scriptMan->runScript(goToMainMenu, true);
 }
 
 void RivenStack::installCardTimer() {
diff --git a/engines/mohawk/riven_stacks/ospit.cpp b/engines/mohawk/riven_stacks/ospit.cpp
index d01a0c0..c0dc13d 100644
--- a/engines/mohawk/riven_stacks/ospit.cpp
+++ b/engines/mohawk/riven_stacks/ospit.cpp
@@ -142,7 +142,6 @@ void OSpit::xbookclick(const ArgumentArray &args) {
 	// use the trap book, he will shoot the player. Dead on arrival.
 	// Run the credits from here.
 	if (_vm->_vars["agehn"] == 3) {
-		_vm->_scriptMan->stopAllScripts();
 		runCredits(args[0], 5000, 995);
 		return;
 	}


Commit: 22ded2c406ea07fb14d1127bcbbc3043815dd2da
    https://github.com/scummvm/scummvm/commit/22ded2c406ea07fb14d1127bcbbc3043815dd2da
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-09-09T16:11:12+02:00

Commit Message:
MOHAWK: RIVEN: Don't allow opening the main menu from the config screens

Changed paths:
    engines/mohawk/riven.cpp
    engines/mohawk/riven.h


diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 0571022..a17d5f7 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -335,18 +335,15 @@ void MohawkEngine_Riven::processInput() {
 }
 
 void MohawkEngine_Riven::goToMainMenu() {
-	_menuSavedStack = _stack->getId();
-	_menuSavedCard = _card->getId();
-
-	// If we are already in menu, do not call again
-	if (_menuSavedStack == kStackAspit && _menuSavedCard == 1) {
-		_menuSavedStack = -1;
-		_menuSavedCard = -1;
+	if (isInMainMenu()) {
 		return;
 	}
 
-	_menuTumbnail.reset(new Graphics::Surface());
-	createThumbnailFromScreen(_menuTumbnail.get());
+	_menuSavedStack = _stack->getId();
+	_menuSavedCard = _card->getId();
+
+	_menuThumbnail.reset(new Graphics::Surface());
+	createThumbnailFromScreen(_menuThumbnail.get());
 
 	RivenCommand *go = new RivenStackChangeCommand(this, kStackAspit, 1, true, true);
 	RivenScriptPtr goScript = _scriptMan->createScriptWithCommand(go);
@@ -362,11 +359,16 @@ void MohawkEngine_Riven::resumeFromMainMenu() {
 
 	_menuSavedStack = -1;
 	_menuSavedCard = -1;
-	_menuTumbnail.reset();
+	_menuThumbnail.reset();
+}
+
+bool MohawkEngine_Riven::isInMainMenu() const {
+	static const uint16 kCardIdAspitAtrusJournal = 5;
+	return _stack->getId() == kStackAspit && _card->getId() < kCardIdAspitAtrusJournal;
 }
 
 bool MohawkEngine_Riven::isGameStarted() const {
-	return _stack->getId() != kStackAspit || _menuSavedStack != -1;
+	return !isInMainMenu() || _menuSavedStack != -1;
 }
 
 void MohawkEngine_Riven::pauseEngineIntern(bool pause) {
@@ -646,7 +648,7 @@ void MohawkEngine_Riven::startNewGame() {
 	// Clear all the state data
 	_menuSavedStack = -1;
 	_menuSavedCard = -1;
-	_menuTumbnail.reset();
+	_menuThumbnail.reset();
 
 	_vars.clear();
 	initVars();
@@ -692,7 +694,7 @@ Common::Error MohawkEngine_Riven::loadGameState(int slot) {
 	if (loadError.getCode() == Common::kNoError) {
 		_menuSavedStack = -1;
 		_menuSavedCard = -1;
-		_menuTumbnail.reset();
+		_menuThumbnail.reset();
 	}
 
 	return loadError;
@@ -719,7 +721,7 @@ Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &
 		_vars["CurrentCardID"] = _menuSavedCard;
 	}
 
-	const Graphics::Surface *thumbnail = _menuSavedStack != -1 ? _menuTumbnail.get() : nullptr;
+	const Graphics::Surface *thumbnail = _menuSavedStack != -1 ? _menuThumbnail.get() : nullptr;
 	Common::Error error = _saveLoad->saveGame(slot, desc, thumbnail, autosave);
 
 	if (_menuSavedStack != -1) {
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index e938d27..b4084ca 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -126,7 +126,7 @@ private:
 
 	int _menuSavedCard;
 	int _menuSavedStack;
-	Common::ScopedPtr<Graphics::Surface, Graphics::SurfaceDeleter> _menuTumbnail;
+	Common::ScopedPtr<Graphics::Surface, Graphics::SurfaceDeleter> _menuThumbnail;
 
 	bool _gameEnded;
 	uint32 _lastSaveTime;
@@ -180,6 +180,7 @@ public:
 	// Main menu handling
 	void goToMainMenu();
 	void resumeFromMainMenu();
+	bool isInMainMenu() const;
 	bool isGameStarted() const;
 	void startNewGame();
 };


Commit: e758ff8036c871ad634a8fb9ba97e03663c4a920
    https://github.com/scummvm/scummvm/commit/e758ff8036c871ad634a8fb9ba97e03663c4a920
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-09-09T16:11:12+02:00

Commit Message:
MOHAWK: RIVEN: Don't allow saving from the GMM if no game is started

Changed paths:
    engines/mohawk/riven.cpp


diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index a17d5f7..b299769 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -744,7 +744,7 @@ void MohawkEngine_Riven::saveGameStateAndDisplayError(int slot, const Common::St
 }
 
 void MohawkEngine_Riven::tryAutoSaving() {
-	if (!canSaveGameStateCurrently() || !isGameStarted() || _gameEnded) {
+	if (!canSaveGameStateCurrently() || _gameEnded) {
 		return; // Can't save right now, try again on the next frame
 	}
 
@@ -797,7 +797,7 @@ bool MohawkEngine_Riven::canLoadGameStateCurrently() {
 }
 
 bool MohawkEngine_Riven::canSaveGameStateCurrently() {
-	return canLoadGameStateCurrently();
+	return canLoadGameStateCurrently() && isGameStarted();
 }
 
 bool MohawkEngine_Riven::hasGameEnded() const {





More information about the Scummvm-git-logs mailing list