From c572828132eb9c5dfbb4b596a663e95f25357ee0 Mon Sep 17 00:00:00 2001 From: Thanasis Antoniou Date: Wed, 1 May 2019 12:03:00 +0300 Subject: BLADERUNNER: Debugger command show maze score --- engines/bladerunner/debugger.cpp | 54 ++++++++++++++++++++++++++++++ engines/bladerunner/debugger.h | 4 +++ engines/bladerunner/script/police_maze.cpp | 10 +++--- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp index acafd68a59..4421a572f2 100644 --- a/engines/bladerunner/debugger.cpp +++ b/engines/bladerunner/debugger.cpp @@ -85,6 +85,7 @@ Debugger::Debugger(BladeRunnerEngine *vm) : GUI::Debugger() { _viewWalkboxes = false; _viewZBuffer = false; _playFullVk = false; + _showMazeScore = false; registerCmd("anim", WRAP_METHOD(Debugger, cmdAnimation)); registerCmd("draw", WRAP_METHOD(Debugger, cmdDraw)); @@ -104,6 +105,9 @@ Debugger::Debugger(BladeRunnerEngine *vm) : GUI::Debugger() { registerCmd("overlay", WRAP_METHOD(Debugger, cmdOverlay)); registerCmd("subtitle", WRAP_METHOD(Debugger, cmdSubtitle)); registerCmd("vk", WRAP_METHOD(Debugger, cmdVk)); + registerCmd("mazescore", WRAP_METHOD(Debugger, cmdMazeScore)); + registerCmd("boundbox", WRAP_METHOD(Debugger, cmdBoundBox)); + registerCmd("obstacle", WRAP_METHOD(Debugger, cmdObstacle)); } Debugger::~Debugger() { @@ -1075,6 +1079,56 @@ bool Debugger::cmdSubtitle(int argc, const char **argv) { } +/** +* Toggle showing Maze score on the fly as subtitle during the Police Maze Course +*/ +bool Debugger::cmdMazeScore(int argc, const char **argv) { +bool invalidSyntax = false; + + if (argc != 2) { + invalidSyntax = true; + } else { + if (_vm->_scene->getSetId() != kSetPS10_PS11_PS12_PS13) { + debugPrintf("Error:Command %s is only valid during the Police Maze course\n", argv[0]); + return true; + } + // + // set a debug variable to enable showing the maze score + // + Common::String argName = argv[1]; + argName.toLowercase(); + if (argc == 2 && argName == "toggle") { + _showMazeScore = !_showMazeScore; + debugPrintf("Showing maze score = %s\n", _showMazeScore ? "True":"False"); + } else { + invalidSyntax = true; + } + } + + if (invalidSyntax) { + debugPrintf("Toggle showing the Maze Score as a subtitle during the Shooting Grounds Course\n"); + debugPrintf("Usage: %s toggle", argv[0]); + } + return true; +} + +/** +* Change Bound box for objects to debug click box optimization +*/ +bool Debugger::cmdBoundBox(int argc, const char **argv) { + // TODO + return true; +} + +/** +* Add or remove obstacle to debug some issues whereby existing obstacle layout does not prevent +* characters from walking where they shouldn't +*/ +bool Debugger::cmdObstacle(int argc, const char **argv) { + // TODO + return true; +} + /** * Toggle playing a full VK session (full) * Only available in VK mode diff --git a/engines/bladerunner/debugger.h b/engines/bladerunner/debugger.h index 17255a7f30..2beee69c4b 100644 --- a/engines/bladerunner/debugger.h +++ b/engines/bladerunner/debugger.h @@ -54,6 +54,7 @@ public: bool _viewWalkboxes; bool _viewZBuffer; bool _playFullVk; + bool _showMazeScore; Debugger(BladeRunnerEngine *vm); ~Debugger(); @@ -75,6 +76,9 @@ public: bool cmdSave(int argc, const char **argv); bool cmdOverlay(int argc, const char **argv); bool cmdSubtitle(int argc, const char **argv); + bool cmdMazeScore(int argc, const char **argv); + bool cmdBoundBox(int argc, const char **argv); + bool cmdObstacle(int argc, const char **argv); bool cmdList(int argc, const char **argv); bool cmdVk(int argc, const char **argv); diff --git a/engines/bladerunner/script/police_maze.cpp b/engines/bladerunner/script/police_maze.cpp index 99a5384e94..f5b9a1daa2 100644 --- a/engines/bladerunner/script/police_maze.cpp +++ b/engines/bladerunner/script/police_maze.cpp @@ -30,8 +30,8 @@ #include "bladerunner/script/police_maze.h" #include "bladerunner/script/scene_script.h" #include "bladerunner/time.h" -//#include "bladerunner/subtitles.h" // Display score and debug info on-screen - +#include "bladerunner/subtitles.h" +#include "bladerunner/debugger.h" // ---------------------- // Maze point system info // ---------------------- @@ -152,8 +152,10 @@ void PoliceMaze::tick() { } } -// _vm->_subtitles->setGameSubsText(Common::String::format("Score: %02d", Global_Variable_Query(kVariablePoliceMazeScore)), true); // for debug purposes, show maze score -// _vm->_subtitles->show(); // for debug purposes, show maze score + if (_vm->_debugger->_showMazeScore && _isActive && !_isEnding) { + _vm->_subtitles->setGameSubsText(Common::String::format("Score: %02d", Global_Variable_Query(kVariablePoliceMazeScore)), true); + _vm->_subtitles->show(); + } if (notFound && _isActive && !_isEnding) { _isActive = false; -- cgit v1.2.3