diff options
author | Bastien Bouclet | 2016-11-01 19:19:26 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-03 08:50:10 +0200 |
commit | 14bbf8aab4ed187ec1e6da9e61a1acf6601d0332 (patch) | |
tree | 05d0ca49831dc96351a95da6347559e5f5909bac /engines/mohawk/riven_stack.h | |
parent | e2c5609e81d3a54e0d3c63427288f3c261b86ade (diff) | |
download | scummvm-rg350-14bbf8aab4ed187ec1e6da9e61a1acf6601d0332.tar.gz scummvm-rg350-14bbf8aab4ed187ec1e6da9e61a1acf6601d0332.tar.bz2 scummvm-rg350-14bbf8aab4ed187ec1e6da9e61a1acf6601d0332.zip |
MOHAWK: Move the external commands to their respective stacks
Diffstat (limited to 'engines/mohawk/riven_stack.h')
-rw-r--r-- | engines/mohawk/riven_stack.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/engines/mohawk/riven_stack.h b/engines/mohawk/riven_stack.h index 33c6f48034..0911fbbd86 100644 --- a/engines/mohawk/riven_stack.h +++ b/engines/mohawk/riven_stack.h @@ -23,6 +23,8 @@ #ifndef RIVEN_STACK_H #define RIVEN_STACK_H +#include "common/hash-str.h" +#include "common/ptr.h" #include "common/str-array.h" namespace Mohawk { @@ -99,14 +101,41 @@ public: /** Get the global id of a card in the stack */ uint32 getCardGlobalId(uint16 cardId) const; + /** Run an external command with the specified parameters */ + void runCommand(uint16 argc, uint16 *argv); + /** Write all of the stack's data including its cards to standard output */ void dump() const; + + // Common external commands + void xflies(uint16 argc, uint16 *argv); // Start the "flies" effect + + // TODO: Misc stuff move elsewhere + uint16 getComboDigit(uint32 correctCombo, uint32 digit); + void runDemoBoundaryDialog(); + void runEndGame(uint16 video, uint32 delay); + void runCredits(uint16 video, uint32 delay); + +protected: + typedef Common::Functor2<uint16, uint16 *, void> ExternalCommand; + + MohawkEngine_Riven *_vm; + + /** Register an external command for use by the scripts */ + void registerCommand(const Common::String &name, ExternalCommand *command); + private: + typedef Common::HashMap<Common::String, Common::SharedPtr<ExternalCommand>, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> CommandsMap; + +#define REGISTER_COMMAND(cls, method) \ + registerCommand( \ + #method, new Common::Functor2Mem<uint16, uint16 *, void, cls>(this, &cls::method) \ + ) + void loadResourceNames(); void loadCardIdMap(); void setCurrentStackVariable(); - MohawkEngine_Riven *_vm; uint16 _id; @@ -118,6 +147,8 @@ private: RivenNameList _stackNames; Common::Array<uint32> _cardIdMap; + + CommandsMap _commands; }; } // End of namespace Mohawk |