aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mohawk/riven.cpp11
-rw-r--r--engines/mohawk/riven.h1
-rw-r--r--engines/mohawk/riven_card.cpp58
-rw-r--r--engines/mohawk/riven_card.h37
-rw-r--r--engines/mohawk/riven_external.cpp96
-rw-r--r--engines/mohawk/riven_graphics.cpp30
-rw-r--r--engines/mohawk/riven_graphics.h4
-rw-r--r--engines/mohawk/riven_scripts.cpp38
-rw-r--r--engines/mohawk/riven_scripts.h8
9 files changed, 188 insertions, 95 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index cf194a538d..3ea5d16795 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -53,6 +53,7 @@ Common::Rect *g_demoExitRect;
MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescription *gamedesc) : MohawkEngine(syst, gamedesc) {
_showHotspots = false;
_gameOver = false;
+ _activatedPLST = false;
_activatedSLST = false;
_ignoreNextMouseUp = false;
_extrasFile = nullptr;
@@ -409,20 +410,10 @@ void MohawkEngine_Riven::refreshCard() {
_gfx->_updatesEnabled = true;
_gfx->clearWaterEffects();
- _gfx->_activatedPLSTs.clear();
_video->stopVideos();
- _gfx->drawPLST(1);
- _activatedSLST = false;
- _card->runScript(kCardLoadScript);
- _gfx->updateScreen();
- _card->runScript(kCardOpenScript);
_card->open();
- // Activate the first sound list if none have been activated
- if (!_activatedSLST)
- _sound->playSLST(1, _card->getId());
-
if (_showHotspots)
for (uint16 i = 0; i < _hotspotCount; i++)
_gfx->drawRect(_hotspots[i].rect, _hotspots[i].enabled);
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 300078667d..a61c4b0a54 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -199,6 +199,7 @@ public:
void setGameOver() { _gameOver = true; }
void ignoreNextMouseUp() { _ignoreNextMouseUp = true; }
Common::SeekableReadStream *getExtrasResource(uint32 tag, uint16 id);
+ bool _activatedPLST;
bool _activatedSLST;
void runLoadDialog();
void delayAndUpdate(uint32 ms);
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index 90a6888f22..54b588c2a0 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -22,6 +22,9 @@
#include "mohawk/riven_card.h"
+#include "mohawk/riven_graphics.h"
+#include "mohawk/sound.h"
+
#include "mohawk/resource.h"
#include "mohawk/riven.h"
@@ -31,6 +34,7 @@ RivenCard::RivenCard(MohawkEngine_Riven *vm, uint16 id) :
_vm(vm),
_id(id) {
loadCardResource(id);
+ loadCardPictureList(id);
}
RivenCard::~RivenCard() {
@@ -48,7 +52,16 @@ void RivenCard::loadCardResource(uint16 id) {
}
void RivenCard::open() {
+ _vm->_activatedPLST = false;
+ _vm->_activatedSLST = false;
+
+ runScript(kCardLoadScript);
+ defaultLoadScript();
+
initializeZipMode();
+ _vm->_gfx->updateScreen();
+
+ runScript(kCardOpenScript);
}
void RivenCard::initializeZipMode() {
@@ -70,4 +83,49 @@ uint16 RivenCard::getId() const {
return _id;
}
+void RivenCard::defaultLoadScript() {
+ // Activate the first picture list if none have been activated
+ if (!_vm->_activatedPLST)
+ drawPicture(1);
+
+ // Activate the first sound list if none have been activated
+ if (!_vm->_activatedSLST)
+ _vm->_sound->playSLST(1, _id);
+}
+
+void RivenCard::loadCardPictureList(uint16 id) {
+ Common::SeekableReadStream* plst = _vm->getResource(ID_PLST, id);
+ uint16 recordCount = plst->readUint16BE();
+ _pictureList.resize(recordCount);
+
+ for (uint16 i = 0; i < recordCount; i++) {
+ Picture &picture = _pictureList[i];
+ picture.index = plst->readUint16BE();
+ picture.id = plst->readUint16BE();
+ picture.rect.left = plst->readUint16BE();
+ picture.rect.top = plst->readUint16BE();
+ picture.rect.right = plst->readUint16BE();
+ picture.rect.bottom = plst->readUint16BE();
+ }
+
+ delete plst;
+}
+
+void RivenCard::drawPicture(uint16 index, bool queue) {
+ if (index > 0 && index <= _pictureList.size()) {
+ RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(1, 39, 1, index);
+ _vm->_scriptMan->runScript(script, queue);
+ }
+}
+
+RivenCard::Picture RivenCard::getPicture(uint16 index) const {
+ for (uint16 i = 0; i < _pictureList.size(); i++) {
+ if (_pictureList[i].index == index) {
+ return _pictureList[i];
+ }
+ }
+
+ error("Could not find picture %d in card %d", index, _id);
+}
+
} // End of namespace Mohawk
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index a615e70466..86e872497f 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -25,30 +25,65 @@
#include "mohawk/riven_scripts.h"
+#include "common/rect.h"
#include "common/system.h"
namespace Mohawk {
+/**
+ * A game view
+ *
+ * The names Card and Stack are legacy from the HyperCard engine used in
+ * the original mac version of Myst.
+ *
+ * Cards contain hotspots, scripts, and resource lists.
+ */
class RivenCard {
public:
RivenCard(MohawkEngine_Riven *vm, uint16 id);
~RivenCard();
+ /**
+ * An image that can be drawn in this card
+ */
+ struct Picture {
+ uint16 index;
+ uint16 id;
+ Common::Rect rect;
+ };
+
+ /** Initialization routine used to draw a card for the first time or to refresh it */
void open();
- void initializeZipMode();
+
+ /** Run one of the card's scripts */
void runScript(uint16 scriptType);
+ /** Get the id of the card in the stack */
uint16 getId() const;
+ /** Get the card's picture with the specified index */
+ Picture getPicture(uint16 index) const;
+
+ /** Draw one of the card's pictures synchronously or asynchronously */
+ void drawPicture(uint16 index, bool queue = false);
+
private:
void loadCardResource(uint16 id);
+ void loadCardPictureList(uint16 id);
+
+ void initializeZipMode();
+ void defaultLoadScript();
MohawkEngine_Riven *_vm;
+ // General card data
uint16 _id;
int16 _name;
uint16 _zipModePlace;
RivenScriptList _scripts;
+
+ // Resource lists
+ Common::Array<Picture> _pictureList;
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index 38fe8b2166..1027052461 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -460,7 +460,7 @@ void RivenExternal::xaatrusopenbook(uint16 argc, uint16 *argv) {
}
// Draw the image of the page
- _vm->_gfx->drawPLST(page);
+ _vm->getCurCard()->drawPicture(page);
}
void RivenExternal::xaatrusbookback(uint16 argc, uint16 *argv) {
@@ -525,13 +525,13 @@ void RivenExternal::xacathopenbook(uint16 argc, uint16 *argv) {
}
// Draw the image of the page
- _vm->_gfx->drawPLST(page);
+ _vm->getCurCard()->drawPicture(page);
// Draw the white page edges
if (page > 1 && page < 5)
- _vm->_gfx->drawPLST(50);
+ _vm->getCurCard()->drawPicture(50);
else if (page > 5)
- _vm->_gfx->drawPLST(51);
+ _vm->getCurCard()->drawPicture(51);
if (page == 28) {
// Draw the telescope combination
@@ -708,7 +708,7 @@ void RivenExternal::xblabopenbook(uint16 argc, uint16 *argv) {
uint32 page = _vm->_vars["blabpage"];
// Draw the image of the page based on the blabbook variable
- _vm->_gfx->drawPLST(page);
+ _vm->getCurCard()->drawPicture(page);
if (page == 14) {
// Draw the dome combination
@@ -949,7 +949,7 @@ void RivenExternal::xbait(uint16 argc, uint16 *argv) {
// Set the bait if we put it on the plate
if (_vm->_hotspots[9].rect.contains(_vm->_system->getEventManager()->getMousePos())) {
_vm->_vars["bbait"] = 1;
- _vm->_gfx->drawPLST(4);
+ _vm->getCurCard()->drawPicture(4);
_vm->_gfx->updateScreen();
_vm->_hotspots[3].enabled = false; // Disable bait hotspot
_vm->_hotspots[9].enabled = true; // Enable baitplate hotspot
@@ -983,7 +983,7 @@ void RivenExternal::xbfreeytram(uint16 argc, uint16 *argv) {
void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) {
// Remove the pellet from the plate and put it in your hand
- _vm->_gfx->drawPLST(3);
+ _vm->getCurCard()->drawPicture(3);
_vm->_cursor->setCursor(kRivenPelletCursor);
_vm->_gfx->updateScreen();
@@ -1010,7 +1010,7 @@ void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) {
// Set the bait if we put it on the plate, remove otherwise
if (_vm->_hotspots[9].rect.contains(_vm->_system->getEventManager()->getMousePos())) {
_vm->_vars["bbait"] = 1;
- _vm->_gfx->drawPLST(4);
+ _vm->getCurCard()->drawPicture(4);
_vm->_gfx->updateScreen();
_vm->_hotspots[3].enabled = false; // Disable bait hotspot
_vm->_hotspots[9].enabled = true; // Enable baitplate hotspot
@@ -1426,21 +1426,21 @@ void RivenExternal::xglviewer(uint16 argc, uint16 *argv) {
curPos = newPos % 6; // Clip it to 0-5
// And update the screen with the new image
- _vm->_gfx->drawPLST(curPos + 2);
+ _vm->getCurCard()->drawPicture(curPos + 2);
_vm->_gfx->updateScreen();
}
void RivenExternal::xglview_villageon(uint16 argc, uint16 *argv) {
// Turn on the left viewer to 'village mode'
_vm->_vars["glview"] = 2;
- _vm->_gfx->drawPLST(_vm->_vars["glviewpos"] + 2);
+ _vm->getCurCard()->drawPicture(_vm->_vars["glviewpos"] + 2);
_vm->_gfx->updateScreen();
}
void RivenExternal::xglview_villageoff(uint16 argc, uint16 *argv) {
// Turn off the left viewer when in 'village mode' (why is this external?)
_vm->_vars["glview"] = 0;
- _vm->_gfx->drawPLST(1);
+ _vm->getCurCard()->drawPicture(1);
_vm->_gfx->updateScreen();
}
@@ -1517,7 +1517,7 @@ void RivenExternal::xglview_prisonon(uint16 argc, uint16 *argv) {
} else {
// Otherwise, just redraw the imager
timeUntilNextMovie = _vm->_rnd->getRandomNumberRng(10, 20) * 1000;
- _vm->_gfx->drawPLST(8);
+ _vm->getCurCard()->drawPicture(8);
_vm->_gfx->updateScreen();
}
@@ -1541,7 +1541,7 @@ void RivenExternal::xglview_prisonoff(uint16 argc, uint16 *argv) {
_vm->_cursor->showCursor();
// Redraw the viewer
- _vm->_gfx->drawPLST(1);
+ _vm->getCurCard()->drawPicture(1);
_vm->_gfx->updateScreen();
}
@@ -1620,19 +1620,19 @@ void RivenExternal::xjtunnel103_pictfix(uint16 argc, uint16 *argv) {
// Now, draw which icons are depressed based on the bits of the variable
if (iconsDepressed & (1 << 0))
- _vm->_gfx->drawPLST(2);
+ _vm->getCurCard()->drawPicture(2);
if (iconsDepressed & (1 << 1))
- _vm->_gfx->drawPLST(3);
+ _vm->getCurCard()->drawPicture(3);
if (iconsDepressed & (1 << 2))
- _vm->_gfx->drawPLST(4);
+ _vm->getCurCard()->drawPicture(4);
if (iconsDepressed & (1 << 3))
- _vm->_gfx->drawPLST(5);
+ _vm->getCurCard()->drawPicture(5);
if (iconsDepressed & (1 << 22))
- _vm->_gfx->drawPLST(6);
+ _vm->getCurCard()->drawPicture(6);
if (iconsDepressed & (1 << 23))
- _vm->_gfx->drawPLST(7);
+ _vm->getCurCard()->drawPicture(7);
if (iconsDepressed & (1 << 24))
- _vm->_gfx->drawPLST(8);
+ _vm->getCurCard()->drawPicture(8);
}
void RivenExternal::xjtunnel104_pictfix(uint16 argc, uint16 *argv) {
@@ -1641,21 +1641,21 @@ void RivenExternal::xjtunnel104_pictfix(uint16 argc, uint16 *argv) {
// Now, draw which icons are depressed based on the bits of the variable
if (iconsDepressed & (1 << 9))
- _vm->_gfx->drawPLST(2);
+ _vm->getCurCard()->drawPicture(2);
if (iconsDepressed & (1 << 10))
- _vm->_gfx->drawPLST(3);
+ _vm->getCurCard()->drawPicture(3);
if (iconsDepressed & (1 << 11))
- _vm->_gfx->drawPLST(4);
+ _vm->getCurCard()->drawPicture(4);
if (iconsDepressed & (1 << 12))
- _vm->_gfx->drawPLST(5);
+ _vm->getCurCard()->drawPicture(5);
if (iconsDepressed & (1 << 13))
- _vm->_gfx->drawPLST(6);
+ _vm->getCurCard()->drawPicture(6);
if (iconsDepressed & (1 << 14))
- _vm->_gfx->drawPLST(7);
+ _vm->getCurCard()->drawPicture(7);
if (iconsDepressed & (1 << 15))
- _vm->_gfx->drawPLST(8);
+ _vm->getCurCard()->drawPicture(8);
if (iconsDepressed & (1 << 16))
- _vm->_gfx->drawPLST(9);
+ _vm->getCurCard()->drawPicture(9);
}
void RivenExternal::xjtunnel105_pictfix(uint16 argc, uint16 *argv) {
@@ -1664,19 +1664,19 @@ void RivenExternal::xjtunnel105_pictfix(uint16 argc, uint16 *argv) {
// Now, draw which icons are depressed based on the bits of the variable
if (iconsDepressed & (1 << 3))
- _vm->_gfx->drawPLST(2);
+ _vm->getCurCard()->drawPicture(2);
if (iconsDepressed & (1 << 4))
- _vm->_gfx->drawPLST(3);
+ _vm->getCurCard()->drawPicture(3);
if (iconsDepressed & (1 << 5))
- _vm->_gfx->drawPLST(4);
+ _vm->getCurCard()->drawPicture(4);
if (iconsDepressed & (1 << 6))
- _vm->_gfx->drawPLST(5);
+ _vm->getCurCard()->drawPicture(5);
if (iconsDepressed & (1 << 7))
- _vm->_gfx->drawPLST(6);
+ _vm->getCurCard()->drawPicture(6);
if (iconsDepressed & (1 << 8))
- _vm->_gfx->drawPLST(7);
+ _vm->getCurCard()->drawPicture(7);
if (iconsDepressed & (1 << 9))
- _vm->_gfx->drawPLST(8);
+ _vm->getCurCard()->drawPicture(8);
}
void RivenExternal::xjtunnel106_pictfix(uint16 argc, uint16 *argv) {
@@ -1685,21 +1685,21 @@ void RivenExternal::xjtunnel106_pictfix(uint16 argc, uint16 *argv) {
// Now, draw which icons are depressed based on the bits of the variable
if (iconsDepressed & (1 << 16))
- _vm->_gfx->drawPLST(2);
+ _vm->getCurCard()->drawPicture(2);
if (iconsDepressed & (1 << 17))
- _vm->_gfx->drawPLST(3);
+ _vm->getCurCard()->drawPicture(3);
if (iconsDepressed & (1 << 18))
- _vm->_gfx->drawPLST(4);
+ _vm->getCurCard()->drawPicture(4);
if (iconsDepressed & (1 << 19))
- _vm->_gfx->drawPLST(5);
+ _vm->getCurCard()->drawPicture(5);
if (iconsDepressed & (1 << 20))
- _vm->_gfx->drawPLST(6);
+ _vm->getCurCard()->drawPicture(6);
if (iconsDepressed & (1 << 21))
- _vm->_gfx->drawPLST(7);
+ _vm->getCurCard()->drawPicture(7);
if (iconsDepressed & (1 << 22))
- _vm->_gfx->drawPLST(8);
+ _vm->getCurCard()->drawPicture(8);
if (iconsDepressed & (1 << 23))
- _vm->_gfx->drawPLST(9);
+ _vm->getCurCard()->drawPicture(9);
}
void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) {
@@ -1947,8 +1947,8 @@ void RivenExternal::xjschool280_resetright(uint16 argc, uint16 *argv) {
void RivenExternal::redrawWharkNumberPuzzle(uint16 overlay, uint16 number) {
// Update the screen for the whark number puzzle
// We don't update the whole screen here because we don't want to overwrite the video data
- _vm->_gfx->drawPLST(overlay);
- _vm->_gfx->drawPLST(number + 1);
+ _vm->getCurCard()->drawPicture(overlay);
+ _vm->getCurCard()->drawPicture(number + 1);
_vm->_gfx->updateScreen(Common::Rect(80, 212, 477, 392));
_vm->_system->updateScreen();
}
@@ -2109,7 +2109,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) {
_vm->_scriptMan->stopAllScripts(); // Stop all running scripts (so we don't remain in the cage)
_vm->_video->stopVideos(); // Stop all videos
_vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor
- _vm->_gfx->drawPLST(3); // Black out the screen
+ _vm->getCurCard()->drawPicture(3); // Black out the screen
_vm->_gfx->updateScreen(); // Update the screen
_vm->_sound->playSound(0); // Play the link sound
_vm->_video->activateMLST(7, _vm->getCurCard()->getId()); // Activate Gehn Link Video
@@ -2182,7 +2182,7 @@ void RivenExternal::xobedroom5_closedrawer(uint16 argc, uint16 *argv) {
}
void RivenExternal::xogehnopenbook(uint16 argc, uint16 *argv) {
- _vm->_gfx->drawPLST(_vm->_vars["ogehnpage"]);
+ _vm->getCurCard()->drawPicture(_vm->_vars["ogehnpage"]);
}
void RivenExternal::xogehnbookprevpage(uint16 argc, uint16 *argv) {
@@ -2685,7 +2685,7 @@ void RivenExternal::xtakeit(uint16 argc, uint16 *argv) {
assert(marble != 0);
// Redraw the background
- _vm->_gfx->drawPLST(1);
+ _vm->getCurCard()->drawPicture(1);
_vm->_gfx->updateScreen();
// Loop until the player lets go (or quits)
diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index 983c31efa3..34da11f6b7 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -82,42 +82,12 @@ void RivenGraphics::copyImageToScreen(uint16 image, uint32 left, uint32 top, uin
_dirtyScreen = true;
}
-void RivenGraphics::drawPLST(uint16 x) {
- Common::SeekableReadStream* plst = _vm->getResource(ID_PLST, _vm->getCurCard()->getId());
- uint16 recordCount = plst->readUint16BE();
-
- for (uint16 i = 0; i < recordCount; i++) {
- uint16 index = plst->readUint16BE();
- uint16 id = plst->readUint16BE();
- uint16 left = plst->readUint16BE();
- uint16 top = plst->readUint16BE();
- uint16 right = plst->readUint16BE();
- uint16 bottom = plst->readUint16BE();
-
- // We are also checking here to make sure we haven't drawn the image yet on screen.
- // This fixes problems with drawing PLST 1 twice and some other images twice. PLST
- // 1 is sometimes not called by the scripts, so some cards don't appear if we don't
- // draw PLST 1 each time. This "hack" is here to catch any PLST attempting to draw
- // twice. There should never be a problem with doing it this way.
- if (index == x && !(Common::find(_activatedPLSTs.begin(), _activatedPLSTs.end(), x) != _activatedPLSTs.end())) {
- debug(0, "Drawing image %d", id);
- copyImageToScreen(id, left, top, right, bottom);
- _activatedPLSTs.push_back(x);
- break;
- }
- }
-
- delete plst;
-}
-
void RivenGraphics::updateScreen(Common::Rect updateRect) {
if (_updatesEnabled) {
_vm->runUpdateScreenScript();
_vm->_sound->triggerDrawSound();
if (_dirtyScreen) {
- _activatedPLSTs.clear();
-
// Copy to screen if there's no transition. Otherwise transition. ;)
if (_scheduledTransition < 0)
_vm->_system->copyRectToScreen(_mainScreen->getBasePtr(updateRect.left, updateRect.top), _mainScreen->pitch, updateRect.left, updateRect.top, updateRect.width(), updateRect.height());
diff --git a/engines/mohawk/riven_graphics.h b/engines/mohawk/riven_graphics.h
index 577e5e6911..a90c288d60 100644
--- a/engines/mohawk/riven_graphics.h
+++ b/engines/mohawk/riven_graphics.h
@@ -34,11 +34,9 @@ public:
RivenGraphics(MohawkEngine_Riven *vm);
~RivenGraphics();
- void copyImageToScreen(uint16, uint32, uint32, uint32, uint32);
+ void copyImageToScreen(uint16 image, uint32 left, uint32 top, uint32 right, uint32 bottom);
void updateScreen(Common::Rect updateRect = Common::Rect(0, 0, 608, 392));
bool _updatesEnabled;
- Common::Array<uint16> _activatedPLSTs;
- void drawPLST(uint16 x);
void drawRect(Common::Rect rect, bool active);
void drawImageRect(uint16 id, Common::Rect srcRect, Common::Rect dstRect);
void drawExtrasImage(uint16 id, Common::Rect dstRect);
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index 2f26081ca1..68a2152d01 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -121,6 +121,38 @@ void RivenScriptManager::runScript(const RivenScriptPtr &script, bool queue) {
}
}
+RivenScriptPtr RivenScriptManager::createScriptFromData(uint16 commandCount, ...) {
+ va_list args;
+ va_start(args, commandCount);
+
+ // Build a script from the variadic arguments
+ Common::MemoryWriteStreamDynamic writeStream = Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
+ writeStream.writeUint16BE(commandCount);
+
+ for (uint i = 0; i < commandCount; i++) {
+ uint16 command = va_arg(args, int);
+ writeStream.writeUint16BE(command);
+
+ if (command == 8) {
+ // The switch command has a different format that is not implemented
+ error("Cannot create a Switch command from data");
+ }
+
+ uint16 argumentCount = va_arg(args, int);
+ writeStream.writeUint16BE(argumentCount);
+
+ for (uint j = 0; j < commandCount; j++) {
+ uint16 argument = va_arg(args, int);
+ writeStream.writeUint16BE(argument);
+ }
+ }
+
+ va_end(args);
+
+ Common::MemoryReadStream readStream = Common::MemoryReadStream(writeStream.getData(), writeStream.size());
+ return readScript(&readStream);
+}
+
RivenScript::RivenScript() {
_continueRunning = true;
}
@@ -538,7 +570,11 @@ void RivenSimpleCommand::storeMovieOpcode(uint16 op, uint16 argc, uint16 *argv)
// Command 39: activate PLST record (card picture lists)
void RivenSimpleCommand::activatePLST(uint16 op, uint16 argc, uint16 *argv) {
- _vm->_gfx->drawPLST(argv[0]);
+ _vm->_activatedPLST = true;
+
+ RivenCard::Picture picture = _vm->getCurCard()->getPicture(argv[0]);
+
+ _vm->_gfx->copyImageToScreen(picture.id, picture.rect.left, picture.rect.top, picture.rect.right, picture.rect.bottom);
// An update is automatically sent here as long as it's not a load or update script and updates are enabled.
// TODO: Fix the graphics manager
diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h
index f562619dbf..fd47a108be 100644
--- a/engines/mohawk/riven_scripts.h
+++ b/engines/mohawk/riven_scripts.h
@@ -52,6 +52,9 @@ enum {
class MohawkEngine_Riven;
class RivenCommand;
+class RivenScript;
+
+typedef Common::SharedPtr<RivenScript> RivenScriptPtr;
/**
* Scripts in Riven are a list of Commands
@@ -86,8 +89,6 @@ private:
bool _continueRunning;
};
-typedef Common::SharedPtr<RivenScript> RivenScriptPtr;
-
/**
* A script and its type
*
@@ -114,6 +115,9 @@ public:
/** Read a single script from a stream */
RivenScriptPtr readScript(Common::ReadStream *stream);
+ /** Create a script from the caller provided arguments containing raw data */
+ RivenScriptPtr createScriptFromData(uint16 commandCount, ...);
+
/** Read a list of typed scripts from a stream */
RivenScriptList readScripts(Common::ReadStream *stream);