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

antoniou79 antoniou at cti.gr
Thu Feb 28 01:04:42 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:
1c75912ecf BLADERUNNER: Debugger command overlay


Commit: 1c75912ecf262dea13a845250eaf2bbad3276c4b
    https://github.com/scummvm/scummvm/commit/1c75912ecf262dea13a845250eaf2bbad3276c4b
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-02-28T02:04:19+02:00

Commit Message:
BLADERUNNER: Debugger command overlay

List and or play overlay loops that have been loaded for the scene

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


diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index fae61d0..48087ac 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -49,6 +49,8 @@
 #include "bladerunner/vqa_player.h"
 #include "bladerunner/waypoints.h"
 #include "bladerunner/zbuffer.h"
+#include "bladerunner/overlays.h"
+
 
 #include "common/debug.h"
 #include "common/str.h"
@@ -88,6 +90,7 @@ Debugger::Debugger(BladeRunnerEngine *vm) : GUI::Debugger() {
 	registerCmd("friend", WRAP_METHOD(Debugger, cmdFriend));
 	registerCmd("load", WRAP_METHOD(Debugger, cmdLoad));
 	registerCmd("save", WRAP_METHOD(Debugger, cmdSave));
+	registerCmd("overlay", WRAP_METHOD(Debugger, cmdOverlay));
 }
 
 Debugger::~Debugger() {
@@ -720,6 +723,83 @@ bool Debugger::cmdSave(int argc, const char **argv) {
 	return false;
 }
 
+/**
+* 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.
+*/
+bool Debugger::cmdOverlay(int argc, const char **argv) {
+	bool invalidSyntax = false;
+
+	if (argc != 1 && argc != 2 && argc != 3 && argc != 5) {
+		invalidSyntax = true;
+	}
+
+	if (argc == 1) {
+		debugPrintf("name animationId startFrame endFrame\n");
+		for (int i = 0; i < _vm->_overlays->kOverlayVideos; ++i) {
+			if (_vm->_overlays->_videos[i].loaded) {
+				VQADecoder::LoopInfo &loopInfo =_vm->_overlays->_videos[i].vqaPlayer->_decoder._loopInfo;
+				for (int j = 0; j < loopInfo.loopCount; ++j) {
+					debugPrintf("%s %2d %4d %4d\n", _vm->_overlays->_videos[i].name.c_str(), j, loopInfo.loops[j].begin, loopInfo.loops[j].end);
+				}
+			}
+		}
+		return true;
+	}
+
+	if (argc == 2) {
+		Common::String argName = argv[1];
+		if (argName == "reset") {
+			_vm->_overlays->removeAll();
+		} else {
+			debugPrintf("Invalid command usage\n");
+			invalidSyntax = true;
+		}
+	}
+
+	if (argc == 3 || argc == 5) {
+		Common::String overlayName = argv[1];
+		int overlayAnimationId = atoi(argv[2]);
+		bool loopForever = false;
+		bool startNowDontEnqueue = false;
+
+		if (argc == 5 && atoi(argv[3]) != 0) {
+			loopForever = true;
+		}
+		if (argc == 5 && atoi(argv[4]) != 0) {
+			startNowDontEnqueue = true;
+		}
+
+		if (overlayAnimationId < 0 || overlayAnimationId >  _vm->_overlays->kOverlayVideos) {
+			debugPrintf("Animation id value must be [0..%d]\n",  (_vm->_overlays->kOverlayVideos - 1) );
+			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());
+				}
+				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("Usage: %s [[<name> <animationId> [<loopForever> <startNow>]] | reset ]\n", argv[0]);
+	}
+	return true;
+}
+
 void Debugger::drawDebuggerOverlay() {
 	if (_viewSceneObjects) drawSceneObjects();
 	if (_viewScreenEffects) drawScreenEffects();
diff --git a/engines/bladerunner/debugger.h b/engines/bladerunner/debugger.h
index 6fe535a..f425543 100644
--- a/engines/bladerunner/debugger.h
+++ b/engines/bladerunner/debugger.h
@@ -73,6 +73,7 @@ public:
 	bool cmdFriend(int argc, const char **argv);
 	bool cmdLoad(int argc, const char **argv);
 	bool cmdSave(int argc, const char **argv);
+	bool cmdOverlay(int argc, const char **argv);
 
 	void drawDebuggerOverlay();
 
diff --git a/engines/bladerunner/overlays.h b/engines/bladerunner/overlays.h
index e250db9..cbb01fa 100644
--- a/engines/bladerunner/overlays.h
+++ b/engines/bladerunner/overlays.h
@@ -38,6 +38,8 @@ class SaveFileWriteStream;
 class VQAPlayer;
 
 class Overlays {
+	friend class Debugger;
+
 	static const int kOverlayVideos = 5;
 
 	struct Video {





More information about the Scummvm-git-logs mailing list