diff options
Diffstat (limited to 'engines/mohawk/console.cpp')
-rw-r--r-- | engines/mohawk/console.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index 9b5bae78be..93fa05fdbe 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -63,6 +63,8 @@ MystConsole::MystConsole(MohawkEngine_Myst *vm) : GUI::Debugger(), _vm(vm) { registerCmd("disableInitOpcodes", WRAP_METHOD(MystConsole, Cmd_DisableInitOpcodes)); registerCmd("cache", WRAP_METHOD(MystConsole, Cmd_Cache)); registerCmd("resources", WRAP_METHOD(MystConsole, Cmd_Resources)); + registerCmd("quickTest", WRAP_METHOD(MystConsole, Cmd_QuickTest)); + registerVar("show_resource_rects", &_vm->_showResourceRects); } MystConsole::~MystConsole() { @@ -329,6 +331,44 @@ bool MystConsole::Cmd_Resources(int argc, const char **argv) { return true; } +bool MystConsole::Cmd_QuickTest(int argc, const char **argv) { + // Go through all the ages, all the views and click random stuff + for (uint i = 0; i < ARRAYSIZE(mystStackNames); i++) { + if (i == 2 || i == 5 || i == 9 || i == 10) continue; + debug("Loading stack %s", mystStackNames[i]); + _vm->changeToStack(i, default_start_card[i], 0, 0); + + Common::Array<uint16> ids = _vm->getResourceIDList(ID_VIEW); + for (uint j = 0; j < ids.size(); j++) { + if (ids[j] == 4632) continue; + + debug("Loading card %d", ids[j]); + _vm->changeToCard(ids[j], kTransitionCopy); + + _vm->_video->updateMovies(); + _vm->_scriptParser->runPersistentScripts(); + _vm->_system->updateScreen(); + + int16 resIndex = _vm->_rnd->getRandomNumber(_vm->_resources.size()) - 1; + if (resIndex >= 0 && _vm->_resources[resIndex]->isEnabled()) { + _vm->_resources[resIndex]->handleMouseDown(); + _vm->_resources[resIndex]->handleMouseUp(); + } + + _vm->_video->updateMovies(); + _vm->_scriptParser->runPersistentScripts(); + _vm->_system->updateScreen(); + + if (_vm->getCurStack() != i) { + // Clicking may have linked us to another age + _vm->changeToStack(i, default_start_card[i], 0, 0); + } + } + } + + return true; +} + #endif // ENABLE_MYST #ifdef ENABLE_RIVEN |