diff options
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/console.cpp | 39 | ||||
-rw-r--r-- | engines/mohawk/console.h | 1 | ||||
-rw-r--r-- | engines/mohawk/myst.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/myst.h | 1 |
4 files changed, 45 insertions, 0 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index 629cfdf306..93fa05fdbe 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -63,6 +63,7 @@ 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); } @@ -330,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 diff --git a/engines/mohawk/console.h b/engines/mohawk/console.h index af01c0d1e0..dc40049a89 100644 --- a/engines/mohawk/console.h +++ b/engines/mohawk/console.h @@ -55,6 +55,7 @@ private: bool Cmd_DisableInitOpcodes(int argc, const char **argv); bool Cmd_Cache(int argc, const char **argv); bool Cmd_Resources(int argc, const char **argv); + bool Cmd_QuickTest(int argc, const char **argv); }; #endif diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index dc6fe9a1eb..852196e6ac 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -121,6 +121,10 @@ Common::SeekableReadStream *MohawkEngine_Myst::getResource(uint32 tag, uint16 id return nullptr; } +Common::Array<uint16> MohawkEngine_Myst::getResourceIDList(uint32 type) const { + return _mhk[0]->getResourceIDList(type); +} + void MohawkEngine_Myst::cachePreload(uint32 tag, uint16 id) { if (!_cache.enabled) return; diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index 6e661b6580..4b4ceb4a5b 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -174,6 +174,7 @@ public: virtual ~MohawkEngine_Myst(); Common::SeekableReadStream *getResource(uint32 tag, uint16 id) override; + Common::Array<uint16> getResourceIDList(uint32 type) const; Common::String wrapMovieFilename(const Common::String &movieName, uint16 stack); |