diff options
-rw-r--r-- | engines/mohawk/graphics.h | 3 | ||||
-rw-r--r-- | engines/mohawk/riven_external.cpp | 43 |
2 files changed, 39 insertions, 7 deletions
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h index 831e768e41..ebc1e696f3 100644 --- a/engines/mohawk/graphics.h +++ b/engines/mohawk/graphics.h @@ -42,7 +42,8 @@ class MystBitmap; enum { kRivenMainCursor = 3000, - kRivenPelletCursor = 5000 + kRivenPelletCursor = 5000, + kRivenHideCursor = 9000 }; // 803-805 are animated, one large bmp which is in chunks diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index 964fda5ba3..ba9e802e49 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -1193,19 +1193,50 @@ void RivenExternal::xogehnbooknextpage(uint16 argc, uint16 *argv) { _vm->_gfx->updateScreen(); } +static uint16 getComboDigit(uint32 correctCombo, uint32 digit) { + static const uint32 powers[] = { 100000, 10000, 1000, 100, 10, 1 }; + return (correctCombo % powers[digit]) / powers[digit + 1]; +} + void RivenExternal::xgwatch(uint16 argc, uint16 *argv) { - // TODO: Plays the prison combo on the watch + // Hide the cursor + _vm->_gfx->changeCursor(kRivenHideCursor); + + uint32 *prisonCombo = _vm->matchVarToString("pcorrectorder"); + uint32 soundTime = _vm->_system->getMillis() - 500; // Start the first sound instantly + byte curSound = 0; + + while (!_vm->shouldQuit()) { + // Play the next sound every half second + if (_vm->_system->getMillis() - soundTime >= 500) { + if (curSound == 5) // Break out after the last sound is done + break; + + _vm->_sound->playSound(getComboDigit(*prisonCombo, curSound) + 13); + curSound++; + soundTime = _vm->_system->getMillis(); + } + + // Poll events just to check for quitting + Common::Event event; + while (_vm->_system->getEventManager()->pollEvent(event)) {} + + // Cut down on CPU usage + _vm->_system->delayMillis(10); + } + + // Now play the video for the watch + _vm->_video->activateMLST(1, _vm->getCurCard()); + _vm->_video->playMovieBlocking(1); + + // And, finally, refresh + _vm->changeToCard(); } // ------------------------------------------------------------------------------------ // pspit (Prison Island) external commands // ------------------------------------------------------------------------------------ -static uint16 getComboDigit(uint32 correctCombo, uint32 digitsCorrect) { - static const uint32 powers[] = { 100000, 10000, 1000, 100, 10, 1 }; - return (correctCombo % powers[digitsCorrect]) / powers[digitsCorrect + 1]; -} - void RivenExternal::xpisland990_elevcombo(uint16 argc, uint16 *argv) { // Play button sound based on argv[0] _vm->_sound->playSound(argv[0] + 5, false); |