MOHAWK: Move Riven's sunner alert handling to the jungle stack

This commit is contained in:
Bastien Bouclet 2017-02-11 08:00:07 +01:00 committed by Eugene Sandulenko
parent f0267d542f
commit ae6f248616
6 changed files with 44 additions and 37 deletions

View File

@ -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())

View File

@ -133,9 +133,6 @@ private:
Common::SharedPtr<TimerProc> _timerProc;
uint32 _timerTime;
// Miscellaneous
void checkSunnerAlertClick();
public:
// Stack/card/script funtions
void changeToCard(uint16 dest);

View File

@ -268,6 +268,10 @@ bool RivenStack::mouseIsDown() const {
return _mouseIsDown;
}
void RivenStack::mouseForceUp() {
_mouseIsDown = false;
}
RivenNameList::RivenNameList() {
}

View File

@ -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

View File

@ -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) {

View File

@ -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