aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2017-07-01 22:41:04 +0200
committerEugene Sandulenko2017-07-03 08:50:10 +0200
commitee70244fbfb981fc16c77b10bab6546cf5e5cb0d (patch)
treec8c735c87f5c6168c95e24de3e266d20b166c04e /engines/mohawk
parent2a444d35e8e31d670e18ce8e9186f7370db1e5e9 (diff)
downloadscummvm-rg350-ee70244fbfb981fc16c77b10bab6546cf5e5cb0d.tar.gz
scummvm-rg350-ee70244fbfb981fc16c77b10bab6546cf5e5cb0d.tar.bz2
scummvm-rg350-ee70244fbfb981fc16c77b10bab6546cf5e5cb0d.zip
MOHAWK: Check the Garden island external commands against the original
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/riven_graphics.h2
-rw-r--r--engines/mohawk/riven_stacks/bspit.cpp2
-rw-r--r--engines/mohawk/riven_stacks/domespit.cpp4
-rw-r--r--engines/mohawk/riven_stacks/gspit.cpp124
-rw-r--r--engines/mohawk/riven_video.cpp6
-rw-r--r--engines/mohawk/riven_video.h7
6 files changed, 76 insertions, 69 deletions
diff --git a/engines/mohawk/riven_graphics.h b/engines/mohawk/riven_graphics.h
index 6b63a869ba..12dcfba826 100644
--- a/engines/mohawk/riven_graphics.h
+++ b/engines/mohawk/riven_graphics.h
@@ -62,7 +62,6 @@ public:
void enableCardUpdateScript(bool enable);
void copyImageToScreen(uint16 image, uint32 left, uint32 top, uint32 right, uint32 bottom);
- void updateScreen(const Common::Rect &updateRect = Common::Rect(0, 0, 608, 392));
void drawRect(const Common::Rect &rect, bool active);
void drawImageRect(uint16 id, const Common::Rect &srcRect, const Common::Rect &dstRect);
void drawExtrasImage(uint16 id, const Common::Rect &dstRect);
@@ -139,6 +138,7 @@ private:
bool _dirtyScreen;
Graphics::PixelFormat _pixelFormat;
+ void updateScreen(const Common::Rect &updateRect = Common::Rect(0, 0, 608, 392));
void clearMainScreen();
// Credits
diff --git a/engines/mohawk/riven_stacks/bspit.cpp b/engines/mohawk/riven_stacks/bspit.cpp
index eb249af21b..1676eb0147 100644
--- a/engines/mohawk/riven_stacks/bspit.cpp
+++ b/engines/mohawk/riven_stacks/bspit.cpp
@@ -28,8 +28,6 @@
#include "mohawk/riven_graphics.h"
#include "mohawk/riven_video.h"
-#include "common/events.h"
-
namespace Mohawk {
namespace RivenStacks {
diff --git a/engines/mohawk/riven_stacks/domespit.cpp b/engines/mohawk/riven_stacks/domespit.cpp
index 6312538059..dfbb0b40c5 100644
--- a/engines/mohawk/riven_stacks/domespit.cpp
+++ b/engines/mohawk/riven_stacks/domespit.cpp
@@ -194,6 +194,8 @@ void DomeSpit::drawDomeSliders(uint16 startHotspot) {
uint16 bitmapId = _vm->findResourceID(ID_TBMP, buildCardResourceName(_sliderBmpName));
uint16 bgBitmapId = _vm->findResourceID(ID_TBMP, buildCardResourceName(_sliderBgBmpName));
+ _vm->_gfx->beginScreenUpdate();
+
for (uint16 i = 0; i < kDomeSliderSlotCount; i++) {
RivenHotspot *hotspot = _vm->getCard()->getHotspotByBlstId(startHotspot + i);
@@ -208,7 +210,7 @@ void DomeSpit::drawDomeSliders(uint16 startHotspot) {
_vm->_gfx->drawImageRect(bgBitmapId, srcRect, dstRect);
}
- _vm->_gfx->updateScreen();
+ _vm->_gfx->applyScreenUpdate();
}
Common::String DomeSpit::buildCardResourceName(const Common::String &name) const {
diff --git a/engines/mohawk/riven_stacks/gspit.cpp b/engines/mohawk/riven_stacks/gspit.cpp
index 35d514ab08..50d3aa34a4 100644
--- a/engines/mohawk/riven_stacks/gspit.cpp
+++ b/engines/mohawk/riven_stacks/gspit.cpp
@@ -28,34 +28,32 @@
#include "mohawk/riven_sound.h"
#include "mohawk/riven_video.h"
-#include "common/events.h"
-
namespace Mohawk {
namespace RivenStacks {
GSpit::GSpit(MohawkEngine_Riven *vm) :
DomeSpit(vm, kStackGspit, "gsliders.190", "gsliderbg.190") {
-// REGISTER_COMMAND(GSpit, xgresetpins);
-// REGISTER_COMMAND(GSpit, xgrotatepins);
-// REGISTER_COMMAND(GSpit, xgpincontrols);
-// REGISTER_COMMAND(GSpit, xgisland25_opencard);
-// REGISTER_COMMAND(GSpit, xgisland25_resetsliders);
-// REGISTER_COMMAND(GSpit, xgisland25_slidermd);
-// REGISTER_COMMAND(GSpit, xgisland25_slidermw);
-// REGISTER_COMMAND(GSpit, xgscpbtn);
-// REGISTER_COMMAND(GSpit, xgisland1490_domecheck);
-// REGISTER_COMMAND(GSpit, xgplateau3160_dopools);
-// REGISTER_COMMAND(GSpit, xgwt200_scribetime);
-// REGISTER_COMMAND(GSpit, xgwt900_scribe);
-// REGISTER_COMMAND(GSpit, xgplaywhark);
-// REGISTER_COMMAND(GSpit, xgrviewer);
-// REGISTER_COMMAND(GSpit, xgwharksnd);
-// REGISTER_COMMAND(GSpit, xglview_prisonoff);
-// REGISTER_COMMAND(GSpit, xglview_villageoff);
-// REGISTER_COMMAND(GSpit, xglviewer);
-// REGISTER_COMMAND(GSpit, xglview_prisonon);
-// REGISTER_COMMAND(GSpit, xglview_villageon);
+ REGISTER_COMMAND(GSpit, xgresetpins);
+ REGISTER_COMMAND(GSpit, xgrotatepins);
+ REGISTER_COMMAND(GSpit, xgpincontrols);
+ REGISTER_COMMAND(GSpit, xgisland25_opencard);
+ REGISTER_COMMAND(GSpit, xgisland25_resetsliders);
+ REGISTER_COMMAND(GSpit, xgisland25_slidermd);
+ REGISTER_COMMAND(GSpit, xgisland25_slidermw);
+ REGISTER_COMMAND(GSpit, xgscpbtn);
+ REGISTER_COMMAND(GSpit, xgisland1490_domecheck);
+ REGISTER_COMMAND(GSpit, xgplateau3160_dopools);
+ REGISTER_COMMAND(GSpit, xgwt200_scribetime);
+ REGISTER_COMMAND(GSpit, xgwt900_scribe);
+ REGISTER_COMMAND(GSpit, xgplaywhark);
+ REGISTER_COMMAND(GSpit, xgrviewer);
+ REGISTER_COMMAND(GSpit, xgwharksnd);
+ REGISTER_COMMAND(GSpit, xglview_prisonoff);
+ REGISTER_COMMAND(GSpit, xglview_villageoff);
+ REGISTER_COMMAND(GSpit, xglviewer);
+ REGISTER_COMMAND(GSpit, xglview_prisonon);
+ REGISTER_COMMAND(GSpit, xglview_villageon);
}
void GSpit::lowerPins() {
@@ -77,9 +75,10 @@ void GSpit::lowerPins() {
// Play the video of the pins going down
RivenVideo *video = _vm->_video->openSlot(upMovie);
- assert(video);
- video->setBounds(startTime, startTime + 550);
- video->playBlocking();
+ video->enable();
+ video->seek(startTime);
+ video->playBlocking(startTime + 550);
+ video->disable();
upMovie = 0;
}
@@ -87,7 +86,6 @@ void GSpit::lowerPins() {
void GSpit::xgresetpins(uint16 argc, uint16 *argv) {
// As the function name suggests, this resets the pins
lowerPins();
- _vm->_vars["gupmoov"] = 0;
}
void GSpit::xgrotatepins(uint16 argc, uint16 *argv) {
@@ -109,9 +107,10 @@ void GSpit::xgrotatepins(uint16 argc, uint16 *argv) {
// Play the video of the pins rotating
RivenVideo *video = _vm->_video->openSlot(_vm->_vars["gupmoov"]);
- assert(video);
- video->setBounds(startTime, startTime + 1215);
- video->playBlocking();
+ video->enable();
+ video->seek(startTime);
+ video->playBlocking(startTime + 1215);
+ video->disable();
}
void GSpit::xgpincontrols(uint16 argc, uint16 *argv) {
@@ -120,7 +119,7 @@ void GSpit::xgpincontrols(uint16 argc, uint16 *argv) {
RivenHotspot *panel = _vm->getCard()->getHotspotByBlstId(13);
// Get our mouse position and adjust it to the beginning of the hotspot
- Common::Point mousePos = _vm->_system->getEventManager()->getMousePos();
+ Common::Point mousePos = getMousePosition();
mousePos.x -= panel->getRect().left;
mousePos.y -= panel->getRect().top;
@@ -197,8 +196,10 @@ void GSpit::xgpincontrols(uint16 argc, uint16 *argv) {
RivenVideo *handle = _vm->_video->openSlot(pinMovieCodes[imagePos - 1]);
assert(handle);
uint32 startTime = 9630 - pinPos * 600;
- handle->setBounds(startTime, startTime + 550);
- handle->playBlocking();
+ handle->enable();
+ handle->seek(startTime);
+ handle->playBlocking(startTime + 550);
+ handle->disable();
// Update the relevant variables
_vm->_vars["gupmoov"] = pinMovieCodes[imagePos - 1];
@@ -232,10 +233,10 @@ void GSpit::xgisland1490_domecheck(uint16 argc, uint16 *argv) {
void GSpit::xgplateau3160_dopools(uint16 argc, uint16 *argv) {
// Play the deactivation of a pool if one is active and a different one is activated
- _vm->_cursor->setCursor(kRivenHideCursor);
- _vm->_system->updateScreen();
- RivenVideo *video = _vm->_video->openSlot(_vm->_vars["glkbtns"] * 2);
- video->playBlocking();
+ if (_vm->_vars["glkbtns"] != 0) {
+ RivenVideo *video = _vm->_video->openSlot(_vm->_vars["glkbtns"] * 2);
+ video->playBlocking();
+ }
}
void GSpit::xgwt200_scribetime(uint16 argc, uint16 *argv) {
@@ -260,11 +261,13 @@ void GSpit::xgrviewer(uint16 argc, uint16 *argv) {
uint32 &viewerLight = _vm->_vars["grview"];
if (viewerLight == 1) {
viewerLight = 0;
- _vm->_sound->playSound(27);
- _vm->refreshCard();
+ _vm->_sound->playCardSound("gScpBtnUp", 255, true);
+ _vm->getCard()->enter(false);
// Delay a bit before turning
- _vm->_system->delayMillis(200);
+ while (_vm->_sound->isEffectPlaying()) {
+ _vm->doFrame();
+ }
}
// Calculate how much we're moving
@@ -276,13 +279,15 @@ void GSpit::xgrviewer(uint16 argc, uint16 *argv) {
// Now play the movie
RivenVideo *video = _vm->_video->openSlot(1);
- assert(video);
- video->setBounds(s_viewerTimeIntervals[curPos], s_viewerTimeIntervals[newPos]);
- video->playBlocking();
+ video->enable();
+ video->seek(s_viewerTimeIntervals[curPos]);
+ video->playBlocking(s_viewerTimeIntervals[newPos]);
+ video->disable();
+ video->stop();
// Set the new position and let the card's scripts take over again
curPos = newPos % 6; // Clip it to 0-5
- _vm->refreshCard();
+ _vm->getCard()->enter(false);
}
void GSpit::xgplaywhark(uint16 argc, uint16 *argv) {
@@ -328,11 +333,28 @@ void GSpit::xgplaywhark(uint16 argc, uint16 *argv) {
// For whatever reason the devs felt fit, code 31 is used for all of the videos
RivenVideo *video = _vm->_video->openSlot(31);
video->playBlocking();
- _vm->refreshCard();
}
void GSpit::xgwharksnd(uint16 argc, uint16 *argv) {
- // TODO: Random background whark videos
+ uint32 wharkVisits = _vm->_vars["gwhark"];
+
+ // If we're at 5 or more, the whark will no longer visit us :(
+ if (wharkVisits >= 5) {
+ return;
+ }
+
+ uint soundId = _vm->_rnd->getRandomNumberRng(1, 36);
+ if (soundId >= 10) {
+ // No whark this time
+ return;
+ }
+
+ // Wait for the whark to come
+ uint delay = _vm->_rnd->getRandomNumberRng(1, 30) + 120;
+ _vm->delay(delay);
+
+ // Play a random whark sound
+ _vm->_sound->playCardSound(Common::String::format("gWharkSolo%d", soundId));
}
void GSpit::xglviewer(uint16 argc, uint16 *argv) {
@@ -348,9 +370,11 @@ void GSpit::xglviewer(uint16 argc, uint16 *argv) {
// Now play the movie
RivenVideo *video = _vm->_video->openSlot(1);
- assert(video);
- video->setBounds(s_viewerTimeIntervals[curPos], s_viewerTimeIntervals[newPos]);
- video->playBlocking();
+ video->enable();
+ video->seek(s_viewerTimeIntervals[curPos]);
+ video->playBlocking(s_viewerTimeIntervals[newPos]);
+ video->disable();
+ video->stop();
// Set the new position to the variable
curPos = newPos % 6; // Clip it to 0-5
@@ -430,10 +454,8 @@ void GSpit::xglview_prisonon(uint16 argc, uint16 *argv) {
cathState = 1;
// Turn on the viewer
- _vm->_cursor->hideCursor();
RivenVideo *turnOn = _vm->_video->openSlot(turnOnMovie);
turnOn->playBlocking();
- _vm->_cursor->showCursor();
uint32 timeUntilNextMovie;
@@ -465,10 +487,8 @@ void GSpit::xglview_prisonoff(uint16 argc, uint16 *argv) {
// Play the 'turn off' movie after stopping any videos still playing
_vm->_video->closeVideos();
- _vm->_cursor->hideCursor();
RivenVideo *video = _vm->_video->openSlot(5);
video->playBlocking();
- _vm->_cursor->showCursor();
// Redraw the viewer
_vm->getCard()->drawPicture(1);
diff --git a/engines/mohawk/riven_video.cpp b/engines/mohawk/riven_video.cpp
index 375af47ffe..33245ef3c1 100644
--- a/engines/mohawk/riven_video.cpp
+++ b/engines/mohawk/riven_video.cpp
@@ -97,12 +97,6 @@ uint32 RivenVideo::getDuration() const {
return _video->getDuration().msecs();
}
-void RivenVideo::setBounds(uint32 startTime, uint32 endTime) {
- assert(_video);
- _video->setEndTime(Audio::Timestamp(0, endTime, 600));
- _video->seek(Audio::Timestamp(0, startTime, 600));
-}
-
void RivenVideo::seek(uint32 time) {
assert(_video);
diff --git a/engines/mohawk/riven_video.h b/engines/mohawk/riven_video.h
index d5025a28e2..914225b8de 100644
--- a/engines/mohawk/riven_video.h
+++ b/engines/mohawk/riven_video.h
@@ -93,13 +93,6 @@ public:
/** Disable the video */
void disable();
- /**
- * Set the bounds of the video
- *
- * This automatically seeks to the start time
- */
- void setBounds(uint32 startTime, uint32 endTime);
-
/** Seek to the given time */
void seek(uint32 time);