diff options
author | Bastien Bouclet | 2016-11-05 14:47:02 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-03 08:50:10 +0200 |
commit | 22926a1835079f31fa778f2f2eb4e645c451457a (patch) | |
tree | 5c622ae7a0ef933ccfe0abe18aec7f7d3b42542d /engines/mohawk/riven_stacks/pspit.cpp | |
parent | efcf38f95f14272efd8ace91747a45bd53c74b57 (diff) | |
download | scummvm-rg350-22926a1835079f31fa778f2f2eb4e645c451457a.tar.gz scummvm-rg350-22926a1835079f31fa778f2f2eb4e645c451457a.tar.bz2 scummvm-rg350-22926a1835079f31fa778f2f2eb4e645c451457a.zip |
MOHAWK: Move the timer callbacks to the stacks
Diffstat (limited to 'engines/mohawk/riven_stacks/pspit.cpp')
-rw-r--r-- | engines/mohawk/riven_stacks/pspit.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/engines/mohawk/riven_stacks/pspit.cpp b/engines/mohawk/riven_stacks/pspit.cpp index ae10bd0211..4c80849d86 100644 --- a/engines/mohawk/riven_stacks/pspit.cpp +++ b/engines/mohawk/riven_stacks/pspit.cpp @@ -22,7 +22,9 @@ #include "mohawk/riven_stacks/pspit.h" +#include "mohawk/cursors.h" #include "mohawk/riven.h" +#include "mohawk/riven_card.h" #include "mohawk/riven_sound.h" namespace Mohawk { @@ -40,6 +42,45 @@ PSpit::PSpit(MohawkEngine_Riven *vm) : REGISTER_COMMAND(PSpit, xpisland25_slidermw); } +void PSpit::catherineIdleTimer() { + uint32 &cathCheck = _vm->_vars["pcathcheck"]; + uint32 &cathState = _vm->_vars["acathstate"]; + uint16 movie; + + // Choose a random movie based on where Catherine is + if (cathCheck == 0) { + static const int movieList[] = { 5, 6, 7, 8 }; + cathCheck = 1; + movie = movieList[_vm->_rnd->getRandomNumber(3)]; + } else if (cathState == 1) { + static const int movieList[] = { 11, 14 }; + movie = movieList[_vm->_rnd->getRandomBit()]; + } else { + static const int movieList[] = { 9, 10, 12, 13 }; + movie = movieList[_vm->_rnd->getRandomNumber(3)]; + } + + // Update her state if she moves from left/right or right/left, resp. + if (movie == 5 || movie == 7 || movie == 11 || movie == 14) + cathState = 2; + else + cathState = 1; + + // Play the movie, blocking + _vm->_video->activateMLST(_vm->getCard()->getMovie(movie)); + _vm->_cursor->hideCursor(); + _vm->_video->playMovieBlockingRiven(movie); + _vm->_cursor->showCursor(); + _vm->_system->updateScreen(); + + // Install the next timer for the next video + uint32 timeUntilNextMovie = _vm->_rnd->getRandomNumber(120) * 1000; + + _vm->_vars["pcathtime"] = timeUntilNextMovie + _vm->getTotalPlayTime(); + + _vm->installTimer(TIMER(PSpit, catherineIdleTimer), timeUntilNextMovie); +} + void PSpit::xpisland990_elevcombo(uint16 argc, uint16 *argv) { // Play button sound based on argv[0] _vm->_sound->playSound(argv[0] + 5); @@ -84,5 +125,15 @@ void PSpit::xpisland25_slidermw(uint16 argc, uint16 *argv) { checkSliderCursorChange(14); } +void PSpit::installCardTimer() { + if (getCurrentCardGlobalId() == 0x3a85) { + // Top of elevator on prison island + // Handle Catherine hardcoded videos + _vm->installTimer(TIMER(PSpit, catherineIdleTimer), _vm->_rnd->getRandomNumberRng(1, 33) * 1000); + } else { + RivenStack::installCardTimer(); + } +} + } // End of namespace RivenStacks } // End of namespace Mohawk |