aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanasis Antoniou2019-02-28 02:02:25 +0200
committerThanasis Antoniou2019-02-28 02:04:19 +0200
commit1c75912ecf262dea13a845250eaf2bbad3276c4b (patch)
tree98d682901944f14ef5fd008540141cc6a8ea047b
parentb924da753a4569cf5b309d0f17b2afd6cb24e287 (diff)
downloadscummvm-rg350-1c75912ecf262dea13a845250eaf2bbad3276c4b.tar.gz
scummvm-rg350-1c75912ecf262dea13a845250eaf2bbad3276c4b.tar.bz2
scummvm-rg350-1c75912ecf262dea13a845250eaf2bbad3276c4b.zip
BLADERUNNER: Debugger command overlay
List and or play overlay loops that have been loaded for the scene
-rw-r--r--engines/bladerunner/debugger.cpp80
-rw-r--r--engines/bladerunner/debugger.h1
-rw-r--r--engines/bladerunner/overlays.h2
3 files changed, 83 insertions, 0 deletions
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index fae61d0e37..48087ac831 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 6fe535a870..f425543bad 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 e250db9810..cbb01fa04b 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 {