aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2016-11-05 08:36:03 +0100
committerEugene Sandulenko2017-07-03 08:50:10 +0200
commitc04edb8f54f6e44079b389263428719c0b3c562c (patch)
tree78ff6665418427df127726448ef5f5fc2b5c8fdb
parente7146c9bf7d5bdc62b977dca47c445e7f828392e (diff)
downloadscummvm-rg350-c04edb8f54f6e44079b389263428719c0b3c562c.tar.gz
scummvm-rg350-c04edb8f54f6e44079b389263428719c0b3c562c.tar.bz2
scummvm-rg350-c04edb8f54f6e44079b389263428719c0b3c562c.zip
MOHAWK: Change the back from book commands to use scripts
-rw-r--r--engines/mohawk/riven.cpp2
-rw-r--r--engines/mohawk/riven_stacks/aspit.cpp22
-rw-r--r--engines/mohawk/riven_stacks/aspit.h2
3 files changed, 18 insertions, 8 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 03af71452d..7739dd5951 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -473,7 +473,7 @@ void MohawkEngine_Riven::checkInventoryClick() {
// Set the return stack/card id's.
_vars["returnstackid"] = _stack->getId();
- _vars["returncardid"] = _card->getId();
+ _vars["returncardid"] = _stack->getCardGlobalId(_card->getId());
// See RivenGraphics::showInventory() for an explanation
// of the variables' meanings.
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index f4ab7d1340..4c88b19676 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -95,9 +95,20 @@ void ASpit::xaatrusopenbook(uint16 argc, uint16 *argv) {
}
void ASpit::xaatrusbookback(uint16 argc, uint16 *argv) {
+ inventoryBackFromItemScript();
+}
+
+void ASpit::inventoryBackFromItemScript() const {
+ RivenScriptPtr stopSoundScript = _vm->_scriptMan->createScriptFromData(1, 12, 1, 1);
+ _vm->_scriptMan->runScript(stopSoundScript, false);
+
+ uint16 backStackId = _vm->_vars["returnstackid"];
+ uint32 backCardId = _vm->_vars["returncardid"];
+
// Return to where we were before entering the book
- _vm->changeToStack(_vm->_vars["returnstackid"]);
- _vm->changeToCard(_vm->_vars["returncardid"]);
+ RivenCommand *back = new RivenStackChangeCommand(_vm, backStackId, backCardId, true);
+ RivenScriptPtr backScript = _vm->_scriptMan->createScriptWithCommand(back);
+ _vm->_scriptMan->runScript(backScript, false);
}
void ASpit::xaatrusbookprevpage(uint16 argc, uint16 *argv) {
@@ -187,9 +198,7 @@ void ASpit::xacathopenbook(uint16 argc, uint16 *argv) {
}
void ASpit::xacathbookback(uint16 argc, uint16 *argv) {
- // Return to where we were before entering the book
- _vm->changeToStack(_vm->_vars["returnstackid"]);
- _vm->changeToCard(_vm->_vars["returncardid"]);
+ inventoryBackFromItemScript();
}
void ASpit::xacathbookprevpage(uint16 argc, uint16 *argv) {
@@ -229,8 +238,7 @@ void ASpit::xacathbooknextpage(uint16 argc, uint16 *argv) {
void ASpit::xtrapbookback(uint16 argc, uint16 *argv) {
// Return to where we were before entering the book
_vm->_vars["atrap"] = 0;
- _vm->changeToStack(_vm->_vars["returnstackid"]);
- _vm->changeToCard(_vm->_vars["returncardid"]);
+ inventoryBackFromItemScript();
}
void ASpit::xatrapbookclose(uint16 argc, uint16 *argv) {
diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h
index 60400dd5f6..3aa400263d 100644
--- a/engines/mohawk/riven_stacks/aspit.h
+++ b/engines/mohawk/riven_stacks/aspit.h
@@ -67,6 +67,8 @@ public:
void xaenablemenuintro(uint16 argc, uint16 *argv);
void xademoquit(uint16 argc, uint16 *argv);
void xaexittomain(uint16 argc, uint16 *argv);
+
+ void inventoryBackFromItemScript() const;
};
} // End of namespace RivenStacks