diff options
-rw-r--r-- | engines/mohawk/console.cpp | 29 | ||||
-rw-r--r-- | engines/mohawk/console.h | 1 | ||||
-rw-r--r-- | engines/mohawk/riven_external.cpp | 2 | ||||
-rw-r--r-- | engines/mohawk/riven_external.h | 1 |
4 files changed, 32 insertions, 1 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index 149b6b6eba..abdcf42dc0 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -28,6 +28,7 @@ #include "mohawk/myst_scripts.h" #include "mohawk/graphics.h" #include "mohawk/riven.h" +#include "mohawk/riven_external.h" #include "mohawk/livingbooks.h" #include "mohawk/sound.h" #include "mohawk/video.h" @@ -307,6 +308,7 @@ RivenConsole::RivenConsole(MohawkEngine_Riven *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("dumpScript", WRAP_METHOD(RivenConsole, Cmd_DumpScript)); DCmd_Register("listZipCards", WRAP_METHOD(RivenConsole, Cmd_ListZipCards)); DCmd_Register("getRMAP", WRAP_METHOD(RivenConsole, Cmd_GetRMAP)); + DCmd_Register("combos", WRAP_METHOD(RivenConsole, Cmd_Combos)); } RivenConsole::~RivenConsole() { @@ -608,6 +610,33 @@ bool RivenConsole::Cmd_GetRMAP(int argc, const char **argv) { return true; } +bool RivenConsole::Cmd_Combos(int argc, const char **argv) { + // In the vain of SCUMM's 'drafts' command, this command will list + // out all combinations needed in Riven, decoded from the variables. + // You'll need to look up the Rebel Tunnel puzzle on your own; the + // solution is constant. + + uint32 teleCombo = *_vm->matchVarToString("tcorrectorder"); + uint32 prisonCombo = *_vm->matchVarToString("pcorrectorder"); + uint32 domeCombo = *_vm->matchVarToString("adomecombo"); + + DebugPrintf("Telescope Combo:\n "); + for (int i = 0; i < 5; i++) + DebugPrintf("%d ", _vm->_externalScriptHandler->getComboDigit(teleCombo, i)); + + DebugPrintf("\nPrison Combo:\n "); + for (int i = 0; i < 5; i++) + DebugPrintf("%d ", _vm->_externalScriptHandler->getComboDigit(prisonCombo, i)); + + DebugPrintf("\nDome Combo:\n "); + for (int i = 1; i <= 25; i++) + if (domeCombo & (1 << (25 - i))) + DebugPrintf("%d ", i); + + DebugPrintf("\n"); + return true; +} + LivingBooksConsole::LivingBooksConsole(MohawkEngine_LivingBooks *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("playSound", WRAP_METHOD(LivingBooksConsole, Cmd_PlaySound)); DCmd_Register("stopSound", WRAP_METHOD(LivingBooksConsole, Cmd_StopSound)); diff --git a/engines/mohawk/console.h b/engines/mohawk/console.h index 9a30d46225..1806c61027 100644 --- a/engines/mohawk/console.h +++ b/engines/mohawk/console.h @@ -88,6 +88,7 @@ private: bool Cmd_DumpScript(int argc, const char **argv); bool Cmd_ListZipCards(int argc, const char **argv); bool Cmd_GetRMAP(int argc, const char **argv); + bool Cmd_Combos(int argc, const char **argv); }; class LivingBooksConsole : public GUI::Debugger { diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index 24466305fe..67d621a54c 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -1325,7 +1325,7 @@ void RivenExternal::xogehnbooknextpage(uint16 argc, uint16 *argv) { _vm->_gfx->updateScreen(); } -static uint16 getComboDigit(uint32 correctCombo, uint32 digit) { +uint16 RivenExternal::getComboDigit(uint32 correctCombo, uint32 digit) { static const uint32 powers[] = { 100000, 10000, 1000, 100, 10, 1 }; return (correctCombo % powers[digit]) / powers[digit + 1]; } diff --git a/engines/mohawk/riven_external.h b/engines/mohawk/riven_external.h index 14bb51340c..bdf3fa01bc 100644 --- a/engines/mohawk/riven_external.h +++ b/engines/mohawk/riven_external.h @@ -38,6 +38,7 @@ public: ~RivenExternal(); void runCommand(uint16 argc, uint16 *argv); + uint16 getComboDigit(uint32 correctCombo, uint32 digit); private: MohawkEngine_Riven *_vm; |