diff options
-rw-r--r-- | engines/mohawk/riven.cpp | 31 | ||||
-rw-r--r-- | engines/mohawk/riven.h | 3 | ||||
-rw-r--r-- | engines/mohawk/riven_stack.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/riven_stack.h | 4 | ||||
-rw-r--r-- | engines/mohawk/riven_stacks/jspit.cpp | 36 | ||||
-rw-r--r-- | engines/mohawk/riven_stacks/jspit.h | 3 |
6 files changed, 44 insertions, 37 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 1c40acd135..197065b7e6 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -216,9 +216,6 @@ void MohawkEngine_Riven::doFrame() { needsUpdate = true; break; case Common::EVENT_LBUTTONDOWN: - if (_card->getCurHotspot()) { - checkSunnerAlertClick(); - } _stack->onMouseDown(_eventMan->getMousePos()); break; case Common::EVENT_LBUTTONUP: @@ -507,34 +504,6 @@ void MohawkEngine_Riven::doVideoTimer(VideoHandle handle, bool force) { _scriptMan->runStoredMovieOpcode(); } -void MohawkEngine_Riven::checkSunnerAlertClick() { - // We need to do a manual hardcoded check for the sunners' - // alert movies. - - uint32 &sunners = _vars["jsunners"]; - - // If the sunners are gone, there's nothing for us to do - if (sunners != 0) - return; - - uint32 rmapCode = _stack->getCurrentCardGlobalId(); - - // This is only for the mid/lower staircase sections - if (rmapCode != 0x79bd && rmapCode != 0x7beb) - return; - - // Only set the sunners variable on the forward hotspot - if (_card->getCurHotspot()->getBlstId() != 3) - return; - - // If the alert video is no longer playing, we have nothing left to do - VideoEntryPtr video = _video->findVideoRiven(1); - if (!video || video->endOfVideo()) - return; - - sunners = 1; -} - void MohawkEngine_Riven::addZipVisitedCard(uint16 cardId, uint16 cardNameId) { Common::String cardName = getStack()->getName(kCardNames, cardNameId); if (cardName.empty()) diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index 0dfba152bc..a4c4db4188 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -133,9 +133,6 @@ private: Common::SharedPtr<TimerProc> _timerProc; uint32 _timerTime; - // Miscellaneous - void checkSunnerAlertClick(); - public: // Stack/card/script funtions void changeToCard(uint16 dest); diff --git a/engines/mohawk/riven_stack.cpp b/engines/mohawk/riven_stack.cpp index d842bca415..f8dd6a30f1 100644 --- a/engines/mohawk/riven_stack.cpp +++ b/engines/mohawk/riven_stack.cpp @@ -268,6 +268,10 @@ bool RivenStack::mouseIsDown() const { return _mouseIsDown; } +void RivenStack::mouseForceUp() { + _mouseIsDown = false; +} + RivenNameList::RivenNameList() { } diff --git a/engines/mohawk/riven_stack.h b/engines/mohawk/riven_stack.h index d30702eb73..2365859dad 100644 --- a/engines/mohawk/riven_stack.h +++ b/engines/mohawk/riven_stack.h @@ -120,8 +120,12 @@ public: /** Handle a mouse move event */ void onMouseMove(const Common::Point &mouse); + /** Is the left mouse button currently pressed? */ bool mouseIsDown() const; + /** Force the left mouse button to be considered unpressed until the next mouse click */ + void mouseForceUp(); + // Common external commands void xflies(uint16 argc, uint16 *argv); // Start the "flies" effect diff --git a/engines/mohawk/riven_stacks/jspit.cpp b/engines/mohawk/riven_stacks/jspit.cpp index 7dc5210e46..f4b0c0fc62 100644 --- a/engines/mohawk/riven_stacks/jspit.cpp +++ b/engines/mohawk/riven_stacks/jspit.cpp @@ -413,9 +413,17 @@ void JSpit::xjplaybeetle_1450(uint16 argc, uint16 *argv) { void JSpit::xjlagoon700_alert(uint16 argc, uint16 *argv) { // Handle sunner reactions (mid-staircase) + uint32 sunners = _vm->_vars["jsunners"]; - if (_vm->_vars["jsunners"] == 0) - _vm->_video->playMovieRiven(1); + // If the sunners are gone, there's nothing for us to do + if (sunners != 0) { + return; + } + + VideoEntryPtr sunnerAlertVideo = _vm->_video->playMovieRiven(1); + + // Wait for a click while the alert video is playing + sunnersPlayVideo(sunnerAlertVideo, 0x7BEB); } void JSpit::xjlagoon800_alert(uint16 argc, uint16 *argv) { @@ -425,7 +433,10 @@ void JSpit::xjlagoon800_alert(uint16 argc, uint16 *argv) { if (sunners == 0) { // Show the sunners alert video - _vm->_video->playMovieRiven(1); + VideoEntryPtr sunnerAlertVideo = _vm->_video->playMovieRiven(1); + + // Wait for a click while the alert video is playing + sunnersPlayVideo(sunnerAlertVideo, 0xB6CA); } else if (sunners == 1) { // Show the sunners leaving if you moved forward in their "alert" status _vm->_video->playMovieBlockingRiven(2); @@ -451,6 +462,25 @@ void JSpit::xjlagoon1500_alert(uint16 argc, uint16 *argv) { } } +void JSpit::sunnersPlayVideo(VideoEntryPtr &video, uint32 destCardGlobalId) { + uint32 &sunners = _vm->_vars["jsunners"]; + + mouseForceUp(); + while (!video->endOfVideo() && !_vm->shouldQuit()) { + _vm->doFrame(); + + if (mouseIsDown()) { + video->stop(); + sunners = 1; + + uint16 destCardId = getCardStackId(destCardGlobalId); + RivenScriptPtr clickScript = _vm->_scriptMan->createScriptFromData(1, 2, 1, destCardId); + _vm->_scriptMan->runScript(clickScript, false); + break; + } + } +} + void JSpit::sunnersTopStairsTimer() { // If the sunners are gone, we have no video to play if (_vm->_vars["jsunners"] != 0) { diff --git a/engines/mohawk/riven_stacks/jspit.h b/engines/mohawk/riven_stacks/jspit.h index bf9158875c..9ce32bc4fe 100644 --- a/engines/mohawk/riven_stacks/jspit.h +++ b/engines/mohawk/riven_stacks/jspit.h @@ -24,6 +24,7 @@ #define RIVEN_STACKS_JSPIT_H #include "mohawk/riven_stacks/domespit.h" +#include "mohawk/video.h" namespace Mohawk { namespace RivenStacks { @@ -92,6 +93,8 @@ public: private: int jspitElevatorLoop(); void redrawWharkNumberPuzzle(uint16 overlay, uint16 number); + + void sunnersPlayVideo(VideoEntryPtr &video, uint32 destCardGlobalId); }; } // End of namespace RivenStacks |