diff options
author | Bastien Bouclet | 2017-01-28 08:55:31 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-03 08:50:10 +0200 |
commit | 0ba035eea6e36c3d0bd9058d0b623eb7aad23f82 (patch) | |
tree | 06b8c09aa5c5d4700c9672cfc0296675660445df /engines/mohawk/riven_stacks | |
parent | 22926a1835079f31fa778f2f2eb4e645c451457a (diff) | |
download | scummvm-rg350-0ba035eea6e36c3d0bd9058d0b623eb7aad23f82.tar.gz scummvm-rg350-0ba035eea6e36c3d0bd9058d0b623eb7aad23f82.tar.bz2 scummvm-rg350-0ba035eea6e36c3d0bd9058d0b623eb7aad23f82.zip |
MOHAWK: Move Riven inventory code to a new class
Diffstat (limited to 'engines/mohawk/riven_stacks')
-rw-r--r-- | engines/mohawk/riven_stacks/aspit.cpp | 26 | ||||
-rw-r--r-- | engines/mohawk/riven_stacks/aspit.h | 2 | ||||
-rw-r--r-- | engines/mohawk/riven_stacks/rspit.cpp | 5 | ||||
-rw-r--r-- | engines/mohawk/riven_stacks/tspit.cpp | 3 |
4 files changed, 12 insertions, 24 deletions
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp index 4c88b19676..aabd7dba91 100644 --- a/engines/mohawk/riven_stacks/aspit.cpp +++ b/engines/mohawk/riven_stacks/aspit.cpp @@ -25,6 +25,7 @@ #include "mohawk/riven.h" #include "mohawk/riven_card.h" #include "mohawk/riven_graphics.h" +#include "mohawk/riven_inventory.h" #include "mohawk/riven_sound.h" #include "common/translation.h" @@ -95,20 +96,7 @@ 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 - RivenCommand *back = new RivenStackChangeCommand(_vm, backStackId, backCardId, true); - RivenScriptPtr backScript = _vm->_scriptMan->createScriptWithCommand(back); - _vm->_scriptMan->runScript(backScript, false); + _vm->_inventory->backFromItemScript(); } void ASpit::xaatrusbookprevpage(uint16 argc, uint16 *argv) { @@ -198,7 +186,7 @@ void ASpit::xacathopenbook(uint16 argc, uint16 *argv) { } void ASpit::xacathbookback(uint16 argc, uint16 *argv) { - inventoryBackFromItemScript(); + _vm->_inventory->backFromItemScript(); } void ASpit::xacathbookprevpage(uint16 argc, uint16 *argv) { @@ -238,7 +226,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; - inventoryBackFromItemScript(); + _vm->_inventory->backFromItemScript(); } void ASpit::xatrapbookclose(uint16 argc, uint16 *argv) { @@ -309,7 +297,7 @@ void ASpit::xadisablemenuintro(uint16 argc, uint16 *argv) { // The original also had this shortcut. // Hide the "exit" button here - _vm->_gfx->hideInventory(); + _vm->_inventory->hide(); } void ASpit::xaenablemenuintro(uint16 argc, uint16 *argv) { @@ -318,12 +306,12 @@ void ASpit::xaenablemenuintro(uint16 argc, uint16 *argv) { // The original also had this shortcut. // Show the "exit" button here - _vm->_gfx->showInventory(); + _vm->_inventory->show(); } void ASpit::xademoquit(uint16 argc, uint16 *argv) { // Exactly as it says on the tin. In the demo, this function quits. - _vm->setGameOver(); + _vm->quitGame(); } void ASpit::xaexittomain(uint16 argc, uint16 *argv) { diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h index 3aa400263d..60400dd5f6 100644 --- a/engines/mohawk/riven_stacks/aspit.h +++ b/engines/mohawk/riven_stacks/aspit.h @@ -67,8 +67,6 @@ 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 diff --git a/engines/mohawk/riven_stacks/rspit.cpp b/engines/mohawk/riven_stacks/rspit.cpp index a7431a6e7f..49fac73346 100644 --- a/engines/mohawk/riven_stacks/rspit.cpp +++ b/engines/mohawk/riven_stacks/rspit.cpp @@ -25,6 +25,7 @@ #include "mohawk/riven.h" #include "mohawk/riven_card.h" #include "mohawk/riven_graphics.h" +#include "mohawk/riven_inventory.h" namespace Mohawk { namespace RivenStacks { @@ -53,11 +54,11 @@ void RSpit::xrshowinventory(uint16 argc, uint16 *argv) { // Give the trap book and Catherine's journal to the player _vm->_vars["atrapbook"] = 1; _vm->_vars["acathbook"] = 1; - _vm->_gfx->showInventory(); + _vm->_inventory->show(); } void RSpit::xrhideinventory(uint16 argc, uint16 *argv) { - _vm->_gfx->hideInventory(); + _vm->_inventory->hide(); } void RSpit::rebelPrisonWindowTimer() { diff --git a/engines/mohawk/riven_stacks/tspit.cpp b/engines/mohawk/riven_stacks/tspit.cpp index 763f5351cd..e4d51791bb 100644 --- a/engines/mohawk/riven_stacks/tspit.cpp +++ b/engines/mohawk/riven_stacks/tspit.cpp @@ -26,6 +26,7 @@ #include "mohawk/riven.h" #include "mohawk/riven_card.h" #include "mohawk/riven_graphics.h" +#include "mohawk/riven_inventory.h" #include "common/events.h" @@ -181,7 +182,7 @@ void TSpit::xtchotakesbook(uint16 argc, uint16 *argv) { } void TSpit::xthideinventory(uint16 argc, uint16 *argv) { - _vm->_gfx->hideInventory(); + _vm->_inventory->hide(); } // Marble Puzzle related constants |