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

antoniou79 antoniou at cti.gr
Mon Mar 18 18:14:13 CET 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:
a4f92ce346 BLADERUNER: Enhanced overlay debugger command


Commit: a4f92ce3460a47bd5c80ff444f3485e2c064ed61
    https://github.com/scummvm/scummvm/commit/a4f92ce3460a47bd5c80ff444f3485e2c064ed61
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-03-18T19:12:09+02:00

Commit Message:
BLADERUNER: Enhanced overlay debugger command

It will now load any specified overlay in the scene as long as it is valid

Changed paths:
    engines/bladerunner/bladerunner.h
    engines/bladerunner/debugger.cpp


diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index 3154ff8..1df3c35 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -109,14 +109,13 @@ class ZBuffer;
 
 class BladeRunnerEngine : public Engine {
 public:
-	static const int kArchiveCount = 11; // +1 to original value (10) to accommodate for SUBTITLES.MIX resource
+	static const int kArchiveCount = 12; // +2 to original value (10) to accommodate for SUBTITLES.MIX and one extra resource file, to allow for capability of loading all VQAx.MIX and the MODE.MIX file (debug purposes)
 	static const int kActorCount = 100;
 	static const int kActorVoiceOver = kActorCount - 1;
 
 	bool           _gameIsRunning;
 	bool           _windowIsActive;
 	int            _playerLosesControlCounter;
-
 	Common::String   _languageCode;
 	Common::Language _language;
 
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index d0cfca8..4186841 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -726,9 +726,9 @@ bool Debugger::cmdSave(int argc, const char **argv) {
 }
 
 /**
-* This will currently only work with any of the
-* overlay videos that the game has loaded for the scene
-* at the time of running the command.
+* Will use overlay videos that the game has loaded for the scene
+* at the time of running the command
+* or otherwise will attempt to load the specified overlay to the scene.
 */
 bool Debugger::cmdOverlay(int argc, const char **argv) {
 	bool invalidSyntax = false;
@@ -737,7 +737,22 @@ bool Debugger::cmdOverlay(int argc, const char **argv) {
 		invalidSyntax = true;
 	}
 
+	// Make sure all MIX with VQAs are loaded (including MODE.MIX)
+	if (!_vm->openArchive("MODE.MIX")) {
+		debugPrintf("Error: Could not load resource MODE.MIX\n");
+	}
+	if (!_vm->openArchive("VQA1.MIX")) {
+		debugPrintf("Error: Could not load resource VQA1.MIX\n");
+	}
+	if (!_vm->openArchive("VQA2.MIX")) {
+		debugPrintf("Error: Could not load resource VQA2.MIX\n");
+	}
+	if (!_vm->openArchive("VQA3.MIX")) {
+		debugPrintf("Error: Could not load resource VQA3.MIX\n");
+	}
+
 	if (argc == 1) {
+		// print info for all overlays loaded for the scene
 		debugPrintf("name animationId startFrame endFrame\n");
 		for (int i = 0; i < _vm->_overlays->kOverlayVideos; ++i) {
 			if (_vm->_overlays->_videos[i].loaded) {
@@ -751,6 +766,7 @@ bool Debugger::cmdOverlay(int argc, const char **argv) {
 	}
 
 	if (argc == 2) {
+		// Check if we need to reset (remove) the overlays loaded for the scene
 		Common::String argName = argv[1];
 		if (argName == "reset") {
 			_vm->_overlays->removeAll();
@@ -764,39 +780,46 @@ bool Debugger::cmdOverlay(int argc, const char **argv) {
 		Common::String overlayName = argv[1];
 		int overlayAnimationId = atoi(argv[2]);
 		bool loopForever = false;
-		bool startNowDontEnqueue = false;
+		LoopSetModes startNowFlag = kLoopSetModeEnqueue;
 
 		if (argc == 5 && atoi(argv[3]) != 0) {
 			loopForever = true;
 		}
+
 		if (argc == 5 && atoi(argv[4]) != 0) {
-			startNowDontEnqueue = true;
+			startNowFlag = kLoopSetModeImmediate;
 		}
 
-		if (overlayAnimationId < 0 || overlayAnimationId >  _vm->_overlays->kOverlayVideos) {
-			debugPrintf("Animation id value must be [0..%d]\n",  (_vm->_overlays->kOverlayVideos - 1) );
+		if (overlayAnimationId < 0) {
+			debugPrintf("Animation id value must be >= 0!\n");
 			return true;
 		}
-
-		for (int i = 0; i < _vm->_overlays->kOverlayVideos; ++i) {
-			if (overlayName == _vm->_overlays->_videos[i].name) {
-				// check if already loaded
-				if (overlayAnimationId >= _vm->_overlays->_videos[i].vqaPlayer->_decoder._loopInfo.loopCount) {
-					debugPrintf("Invalid loop id: %d for overlay animation: %s\n",  overlayAnimationId, overlayName.c_str());
-				}
-				else if( _vm->_overlays->play(overlayName, overlayAnimationId, loopForever, startNowDontEnqueue, 0) == -1 ) {
-					debugPrintf("Could not play loop id: %d for overlay animation: %s\n", overlayAnimationId, overlayName.c_str());
+		//
+		// Attempt to load the overlay even if not already loaded for the scene (in _vm->_overlays->_videos)
+		int overlayVideoIdx = _vm->_overlays->play(overlayName, overlayAnimationId, loopForever, startNowFlag, 0);
+		if( overlayVideoIdx == -1 ) {
+			debugPrintf("Could not load the overlay animation: %s in this scene. Try reseting overlays first to free up slots!\n", overlayName.c_str());
+		} else {
+			debugPrintf("Loading overlay animation: %s...\n", overlayName.c_str());
+			VQADecoder::LoopInfo &loopInfo =_vm->_overlays->_videos[overlayVideoIdx].vqaPlayer->_decoder._loopInfo;
+			int overlayAnimationLoopCount = loopInfo.loopCount;
+			if (overlayAnimationLoopCount == 0) {
+				debugPrintf("Error: No valid loops were found for overlay animation named: %s!\n", overlayName.c_str());
+				_vm->_overlays->remove(overlayName.c_str());
+			} else if (overlayAnimationId >= overlayAnimationLoopCount) {
+				debugPrintf("Invalid loop id: %d for overlay animation: %s. Try from 0 to %d.\n",  overlayAnimationId, overlayName.c_str(), overlayAnimationLoopCount-1);
+			} else {
+				// print info about available loops too
+				debugPrintf("Animation: %s loaded. Running loop %d...\n", overlayName.c_str(), overlayAnimationId);
+				for (int j = 0; j < overlayAnimationLoopCount; ++j) {
+					debugPrintf("%s %2d %4d %4d\n", _vm->_overlays->_videos[overlayVideoIdx].name.c_str(), j, loopInfo.loops[j].begin, loopInfo.loops[j].end);
 				}
-				return true;
 			}
 		}
-		// given animation name is not loaded in scene (or does not exist)
-		debugPrintf("Overlay: %s is not loaded in the scene\n", overlayName.c_str());
-		invalidSyntax = true;
 	}
 
 	if (invalidSyntax) {
-		debugPrintf("List or play loaded overlay animations. Values for loopForever and startNow are boolean.\n");
+		debugPrintf("Load, list or play loaded overlay animations. Values for loopForever and startNow are boolean.\n");
 		debugPrintf("Usage: %s [[<name> <animationId> [<loopForever> <startNow>]] | reset ]\n", argv[0]);
 	}
 	return true;





More information about the Scummvm-git-logs mailing list