[Scummvm-git-logs] scummvm master -> 7407cbc7880989f4444daeb53ac60b93be4ced8c

antoniou79 antoniou at cti.gr
Wed May 22 11:15:21 CEST 2019


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:
7407cbc788 BLADERUNNER: Don't exit to desktop after end credits


Commit: 7407cbc7880989f4444daeb53ac60b93be4ced8c
    https://github.com/scummvm/scummvm/commit/7407cbc7880989f4444daeb53ac60b93be4ced8c
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-05-22T12:13:43+03:00

Commit Message:
BLADERUNNER: Don't exit to desktop after end credits

Changed paths:
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/mouse.cpp
    engines/bladerunner/mouse.h
    engines/bladerunner/script/ai/steele.cpp


diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 06d6e1c..cd8cbbe 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -317,36 +317,50 @@ Common::Error BladeRunnerEngine::run() {
 	}
 
 	if (warnUserAboutUnsupportedGame()) {
-
-		if (ConfMan.hasKey("save_slot")) {
-			loadGameState(ConfMan.getInt("save_slot"));
-		} else if (hasSavegames) {
-			_kia->_forceOpen = true;
-			_kia->open(kKIASectionLoad);
-		}
-		// TODO: why is game starting new game here when everything is done in startup?
-		//  else {
-		// 	newGame(kGameDifficultyMedium);
-		// }
-
-		gameLoop();
-
-		_mouse->disable();
-
-		if (_gameOver) {
-			// In the original game this created a single "END_GAME_STATE.END"
-			// which had the a valid format of a save game but was never accessed
-			// from the loading screen. (Due to the .END extension)
-			// It was also a single file that was overwritten each time the player
-			// finished the game.
-			// Maybe its purpose was debugging (?) by renaming it to .SAV and also
-			// for the game to "know" if the player has already finished the game at least once (?)
-			// although that latter one seems not to be used for anything, or maybe it was planned
-			// to be used for a sequel (?). We will never know.
-			// Disabling as in current state it will only fill-up save slots
-			// autoSaveGame(4, true);
-			_endCredits->show();
-		}
+		// improvement: Use a do-while() loop to handle the normal end-game state
+		// so that the game won't exit abruptly after end credits
+		do {
+			// additional code for gracefully handling end-game after _endCredits->show()
+			_gameOver = false;
+			_gameIsRunning = true;
+			if (_mouse->isDisabled()) {
+				// force a mouse enable here since otherwise, after end-game,
+				// we need extra call(s) to mouse->enable to get the _disabledCounter to 0
+				_mouse->enable(true);
+			}
+			// end of additional code for gracefully handling end-game
+
+			if (ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") != -1) {
+				loadGameState(ConfMan.getInt("save_slot"));
+				ConfMan.set("save_slot", "-1");
+			} else if (hasSavegames) {
+				_kia->_forceOpen = true;
+				_kia->open(kKIASectionLoad);
+			}
+			// TODO: why is game starting new game here when everything is done in startup?
+			//  else {
+			// 	newGame(kGameDifficultyMedium);
+			// }
+
+			gameLoop();
+
+			_mouse->disable();
+
+			if (_gameOver) {
+				// In the original game this created a single "END_GAME_STATE.END"
+				// which had the a valid format of a save game but was never accessed
+				// from the loading screen. (Due to the .END extension)
+				// It was also a single file that was overwritten each time the player
+				// finished the game.
+				// Maybe its purpose was debugging (?) by renaming it to .SAV and also
+				// for the game to "know" if the player has already finished the game at least once (?)
+				// although that latter one seems not to be used for anything, or maybe it was planned
+				// to be used for a sequel (?). We will never know.
+				// Disabling as in current state it will only fill-up save slots
+				// autoSaveGame(4, true);
+				_endCredits->show();
+			}
+		} while (_gameOver); // if main game loop ended and _gameOver == false, then shutdown
 	}
 
 	shutdown();
diff --git a/engines/bladerunner/mouse.cpp b/engines/bladerunner/mouse.cpp
index 59dcb41..6a6f94f 100644
--- a/engines/bladerunner/mouse.cpp
+++ b/engines/bladerunner/mouse.cpp
@@ -218,8 +218,8 @@ void Mouse::disable() {
 	_randomCountdownY = 0;
 }
 
-void Mouse::enable() {
-	if (--_disabledCounter <= 0) {
+void Mouse::enable(bool force) {
+	if (force || --_disabledCounter <= 0) {
 		_disabledCounter = 0;
 	}
 }
diff --git a/engines/bladerunner/mouse.h b/engines/bladerunner/mouse.h
index 31ba17a..75be576 100644
--- a/engines/bladerunner/mouse.h
+++ b/engines/bladerunner/mouse.h
@@ -62,7 +62,7 @@ public:
 	void setMouseJitterDown();
 
 	void disable();
-	void enable();
+	void enable(bool force = false);
 	bool isDisabled() const;
 
 	void draw(Graphics::Surface &surface, int x, int y);
diff --git a/engines/bladerunner/script/ai/steele.cpp b/engines/bladerunner/script/ai/steele.cpp
index d6fdf22..b10ca1f 100644
--- a/engines/bladerunner/script/ai/steele.cpp
+++ b/engines/bladerunner/script/ai/steele.cpp
@@ -512,28 +512,42 @@ int AIScriptSteele::GetFriendlinessModifierIfGetsClue(int otherActorId, int clue
 
 	switch (clueId) {
 	case kClueMcCoyRecoveredHoldensBadge:
+		// fall through
 	case kClueMcCoyRetiredLucy:
+		// fall through
 	case kClueMcCoyRetiredDektora:
+		// fall through
 	case kClueMcCoyRetiredSadik:
+		// fall through
 	case kClueMcCoyShotZubenInTheBack:
+		// fall through
 	case kClueMcCoyRetiredLutherLance:
+		// fall through
 	case kClueClovisOrdersMcCoysDeath:
+		// fall through
 	case kClueMcCoyIsKind:
+		// fall through
 	case kClueMcCoyIsInsane:
 		return 5;
 
 	case kClueMcCoyKilledRunciter1:
+		// fall through
 	case kClueMcCoyShotGuzza:
+		// fall through
 	case kClueMcCoyKilledRunciter2:
-		return 0;
+		return 0; // TODO shouldn't this be a negative number?
 
 	case kClueMcCoyLetZubenEscape:
 		return -4;
 
 	case kClueMcCoyWarnedIzo:
+		// fall through
 	case kClueMcCoyHelpedIzoIzoIsAReplicant:
+		// fall through
 	case kClueMcCoyHelpedDektora:
+		// fall through
 	case kClueMcCoyHelpedLucy:
+		// fall through
 	case kClueMcCoyHelpedGordo:
 		return -5;
 





More information about the Scummvm-git-logs mailing list