aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mohawk/riven.cpp11
-rw-r--r--engines/mohawk/riven_inventory.cpp2
-rw-r--r--engines/mohawk/riven_scripts.cpp17
-rw-r--r--engines/mohawk/riven_scripts.h4
-rw-r--r--engines/mohawk/riven_stacks/aspit.cpp2
-rw-r--r--engines/mohawk/riven_stacks/ospit.cpp2
6 files changed, 26 insertions, 12 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 5d02317ec0..77d52f9aa5 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -341,15 +341,18 @@ void MohawkEngine_Riven::goToMainMenu() {
_menuTumbnail.reset(new Graphics::Surface());
createThumbnailFromScreen(_menuTumbnail.get());
- changeToStack(kStackAspit);
- changeToCard(1);
+ RivenCommand *go = new RivenStackChangeCommand(this, kStackAspit, 1, true, true);
+ RivenScriptPtr goScript = _scriptMan->createScriptWithCommand(go);
+ _scriptMan->runScript(goScript, true);
}
void MohawkEngine_Riven::resumeFromMainMenu() {
assert(_menuSavedStack != -1);
- changeToStack(_menuSavedStack);
- changeToCard(_menuSavedCard);
+ RivenCommand *resume = new RivenStackChangeCommand(this, _menuSavedStack, _menuSavedCard, true, true);
+ RivenScriptPtr resumeScript = _scriptMan->createScriptWithCommand(resume);
+ _scriptMan->runScript(resumeScript, true);
+
_menuSavedStack = -1;
_menuSavedCard = -1;
_menuTumbnail.reset();
diff --git a/engines/mohawk/riven_inventory.cpp b/engines/mohawk/riven_inventory.cpp
index b4304eceec..7479080685 100644
--- a/engines/mohawk/riven_inventory.cpp
+++ b/engines/mohawk/riven_inventory.cpp
@@ -167,7 +167,7 @@ void RivenInventory::backFromItemScript() const {
uint32 backCardId = _vm->_vars["returncardid"];
// Return to where we were before entering the book
- RivenCommand *back = new RivenStackChangeCommand(_vm, backStackId, backCardId, true);
+ RivenCommand *back = new RivenStackChangeCommand(_vm, backStackId, backCardId, true, false);
RivenScriptPtr backScript = _vm->_scriptMan->createScriptWithCommand(back);
_vm->_scriptMan->runScript(backScript, true);
}
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index 3547302c88..a59850f1ee 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -918,11 +918,13 @@ void RivenSwitchCommand::applyCardPatches(uint32 globalId, int scriptType, uint1
}
}
-RivenStackChangeCommand::RivenStackChangeCommand(MohawkEngine_Riven *vm, uint16 stackId, uint32 globalCardId, bool byStackId) :
+RivenStackChangeCommand::RivenStackChangeCommand(MohawkEngine_Riven *vm, uint16 stackId, uint32 globalCardId,
+ bool byStackId, bool byStackCardId) :
RivenCommand(vm),
_stackId(stackId),
_cardId(globalCardId),
- _byStackId(byStackId) {
+ _byStackId(byStackId),
+ _byStackCardId(byStackCardId) {
}
@@ -935,7 +937,7 @@ RivenStackChangeCommand *RivenStackChangeCommand::createFromStream(MohawkEngine_
uint16 stackId = stream->readUint16BE();
uint32 globalCardId = stream->readUint32BE();
- return new RivenStackChangeCommand(vm, stackId, globalCardId, false);
+ return new RivenStackChangeCommand(vm, stackId, globalCardId, false, false);
}
void RivenStackChangeCommand::execute() {
@@ -954,7 +956,14 @@ void RivenStackChangeCommand::execute() {
}
_vm->changeToStack(stackID);
- uint16 cardID = _vm->getStack()->getCardStackId(_cardId);
+
+ uint16 cardID;
+ if (_byStackCardId) {
+ cardID = _cardId;
+ } else {
+ cardID = _vm->getStack()->getCardStackId(_cardId);
+ }
+
_vm->changeToCard(cardID);
}
diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h
index 423434fe59..c7c49805b1 100644
--- a/engines/mohawk/riven_scripts.h
+++ b/engines/mohawk/riven_scripts.h
@@ -387,7 +387,8 @@ private:
*/
class RivenStackChangeCommand : public RivenCommand {
public:
- RivenStackChangeCommand(MohawkEngine_Riven *vm, uint16 stackId, uint32 globalCardId, bool byStackId);
+ RivenStackChangeCommand(MohawkEngine_Riven *vm, uint16 stackId, uint32 globalCardId,
+ bool byStackId, bool byStackCardId);
static RivenStackChangeCommand *createFromStream(MohawkEngine_Riven *vm, Common::ReadStream *stream);
virtual ~RivenStackChangeCommand();
@@ -401,6 +402,7 @@ private:
uint16 _stackId;
uint32 _cardId;
bool _byStackId; // Otherwise by stack name id
+ bool _byStackCardId; // Otherwise by global card id
};
/**
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index a94b454257..59cc3b9912 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -424,7 +424,7 @@ void ASpit::xaNewGame(const ArgumentArray &args) {
kRivenCommandTransition, 1, kRivenTransitionBlend,
kRivenCommandChangeCard, 1, 2);
- script->addCommand(RivenCommandPtr(new RivenStackChangeCommand(_vm, 0, 0x6E9A, false)));
+ script->addCommand(RivenCommandPtr(new RivenStackChangeCommand(_vm, 0, 0x6E9A, false, false)));
script += _vm->_scriptMan->createScriptFromData(1,
kRivenCommandStopSound, 1, 2);
diff --git a/engines/mohawk/riven_stacks/ospit.cpp b/engines/mohawk/riven_stacks/ospit.cpp
index d939beacba..f44bc0d8ac 100644
--- a/engines/mohawk/riven_stacks/ospit.cpp
+++ b/engines/mohawk/riven_stacks/ospit.cpp
@@ -51,7 +51,7 @@ void OSpit::xorollcredittime(const ArgumentArray &args) {
// we should be using the Tay end game sequences.
if (_vm->_vars["returnstackid"] == kStackRspit) {
RivenScriptPtr script = _vm->_scriptMan->createScriptWithCommand(
- new RivenStackChangeCommand(_vm, kStackRspit, 0x3338, true));
+ new RivenStackChangeCommand(_vm, kStackRspit, 0x3338, true, false));
_vm->_scriptMan->runScript(script, false);
return;
}