diff options
author | Bastien Bouclet | 2017-02-11 12:31:13 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-03 08:50:10 +0200 |
commit | 3f58a795e724cde51966cb7e8b6fd8550d576b16 (patch) | |
tree | afb1a6f71ee61be8ff3a37bf6394a73095d52261 | |
parent | 1286e7fcf0d46dd2887fa466df74f3652f7af1df (diff) | |
download | scummvm-rg350-3f58a795e724cde51966cb7e8b6fd8550d576b16.tar.gz scummvm-rg350-3f58a795e724cde51966cb7e8b6fd8550d576b16.tar.bz2 scummvm-rg350-3f58a795e724cde51966cb7e8b6fd8550d576b16.zip |
MOHAWK: Add an enum for Riven's command types
-rw-r--r-- | engines/mohawk/riven_card.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/riven_inventory.cpp | 2 | ||||
-rw-r--r-- | engines/mohawk/riven_scripts.cpp | 26 | ||||
-rw-r--r-- | engines/mohawk/riven_scripts.h | 65 | ||||
-rw-r--r-- | engines/mohawk/riven_stacks/jspit.cpp | 2 |
5 files changed, 68 insertions, 31 deletions
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp index 09c72d5258..cc816a81c9 100644 --- a/engines/mohawk/riven_card.cpp +++ b/engines/mohawk/riven_card.cpp @@ -149,7 +149,7 @@ void RivenCard::loadCardPictureList(uint16 id) { void RivenCard::drawPicture(uint16 index, bool queue) { if (index > 0 && index <= _pictureList.size()) { - RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(1, 39, 1, index); + RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(1, kRivenCommandActivatePLST, 1, index); _vm->_scriptMan->runScript(script, queue); } } @@ -216,7 +216,7 @@ void RivenCard::loadCardSoundList(uint16 id) { void RivenCard::playSound(uint16 index, bool queue) { if (index > 0 && index <= _soundList.size()) { - RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(1, 40, 1, index); + RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(1, kRivenCommandActivateSLST, 1, index); _vm->_scriptMan->runScript(script, queue); } } diff --git a/engines/mohawk/riven_inventory.cpp b/engines/mohawk/riven_inventory.cpp index f4f3df0721..3dcc5908b0 100644 --- a/engines/mohawk/riven_inventory.cpp +++ b/engines/mohawk/riven_inventory.cpp @@ -187,7 +187,7 @@ void RivenInventory::checkClick(const Common::Point &mousePos) { } void RivenInventory::backFromItemScript() const { - RivenScriptPtr stopSoundScript = _vm->_scriptMan->createScriptFromData(1, 12, 1, 1); + RivenScriptPtr stopSoundScript = _vm->_scriptMan->createScriptFromData(1, kRivenCommandStopSound, 1, 1); _vm->_scriptMan->runScript(stopSoundScript, false); uint16 backStackId = _vm->_vars["returnstackid"]; diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index ad7196dd26..99f1eecf6e 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -67,13 +67,13 @@ RivenScriptPtr RivenScriptManager::readScript(Common::ReadStream *stream) { } RivenCommandPtr RivenScriptManager::readCommand(Common::ReadStream *stream) { - uint16 type = stream->readUint16BE(); + RivenCommandType type = (RivenCommandType) stream->readUint16BE(); switch (type) { - case 8: - return RivenCommandPtr(RivenSwitchCommand::createFromStream(_vm, type, stream)); - case 27: - return RivenCommandPtr(RivenStackChangeCommand::createFromStream(_vm, type, stream)); + case kRivenCommandSwitch: + return RivenCommandPtr(RivenSwitchCommand::createFromStream(_vm, stream)); + case kRivenCommandChangeStack: + return RivenCommandPtr(RivenStackChangeCommand::createFromStream(_vm, stream)); default: return RivenCommandPtr(RivenSimpleCommand::createFromStream(_vm, type, stream)); } @@ -155,7 +155,7 @@ RivenScriptPtr RivenScriptManager::createScriptFromData(uint16 commandCount, ... uint16 command = va_arg(args, int); writeStream.writeUint16BE(command); - if (command == 8) { + if (command == kRivenCommandSwitch) { // The switch command has a different format that is not implemented error("Cannot create a Switch command from data"); } @@ -252,7 +252,7 @@ RivenCommand::~RivenCommand() { } -RivenSimpleCommand::RivenSimpleCommand(MohawkEngine_Riven *vm, int type, const ArgumentArray &arguments) : +RivenSimpleCommand::RivenSimpleCommand(MohawkEngine_Riven *vm, RivenCommandType type, const ArgumentArray &arguments) : RivenCommand(vm), _type(type), _arguments(arguments) { @@ -262,7 +262,7 @@ RivenSimpleCommand::RivenSimpleCommand(MohawkEngine_Riven *vm, int type, const A RivenSimpleCommand::~RivenSimpleCommand() { } -RivenSimpleCommand *RivenSimpleCommand::createFromStream(MohawkEngine_Riven *vm, int type, Common::ReadStream *stream) { +RivenSimpleCommand *RivenSimpleCommand::createFromStream(MohawkEngine_Riven *vm, RivenCommandType type, Common::ReadStream *stream) { uint16 argCount = stream->readUint16BE(); Common::Array<uint16> arguments; @@ -644,10 +644,10 @@ void RivenSimpleCommand::activateMLST(uint16 op, uint16 argc, uint16 *argv) { Common::String RivenSimpleCommand::describe() const { Common::String desc; - if (_type == 7) { // Use the variable name + if (_type == kRivenCommandSwitch) { // Use the variable name Common::String varName = _vm->getStack()->getName(kVariableNames, _arguments[0]); desc = Common::String::format("%s = %d", varName.c_str(), _arguments[1]); - } else if (_type == 17) { // Use the external command name + } else if (_type == kRivenCommandRunExternal) { // Use the external command name Common::String externalCommandName = _vm->getStack()->getName(kExternalCommandNames, _arguments[0]); desc = Common::String::format("%s(", externalCommandName.c_str()); uint16 varCount = _arguments[1]; @@ -657,7 +657,7 @@ Common::String RivenSimpleCommand::describe() const { desc += ", "; } desc += ")"; - } else if (_type == 24) { // Use the variable name + } else if (_type == kRivenCommandIncrementVariable) { // Use the variable name Common::String varName = _vm->getStack()->getName(kVariableNames, _arguments[0]); desc = Common::String::format("%s += %d", varName.c_str(), _arguments[1]); } else { @@ -703,7 +703,7 @@ RivenSwitchCommand::~RivenSwitchCommand() { } -RivenSwitchCommand *RivenSwitchCommand::createFromStream(MohawkEngine_Riven *vm, int type, Common::ReadStream *stream) { +RivenSwitchCommand *RivenSwitchCommand::createFromStream(MohawkEngine_Riven *vm, Common::ReadStream *stream) { RivenSwitchCommand *command = new RivenSwitchCommand(vm); if (stream->readUint16BE() != 2) { @@ -782,7 +782,7 @@ RivenStackChangeCommand::~RivenStackChangeCommand() { } -RivenStackChangeCommand *RivenStackChangeCommand::createFromStream(MohawkEngine_Riven *vm, int type, Common::ReadStream *stream) { +RivenStackChangeCommand *RivenStackChangeCommand::createFromStream(MohawkEngine_Riven *vm, Common::ReadStream *stream) { /* argumentsSize = */ stream->readUint16BE(); uint16 stackId = stream->readUint16BE(); uint32 globalCardId = stream->readUint32BE(); diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h index 1a990c451b..b47724d544 100644 --- a/engines/mohawk/riven_scripts.h +++ b/engines/mohawk/riven_scripts.h @@ -37,17 +37,54 @@ namespace Mohawk { // Script Types enum { - kMouseDownScript = 0, - kMouseDragScript = 1, - kMouseUpScript = 2, - kMouseEnterScript = 3, + kMouseDownScript = 0, + kMouseDragScript = 1, + kMouseUpScript = 2, + kMouseEnterScript = 3, kMouseInsideScript = 4, - kMouseLeaveScript = 5, + kMouseLeaveScript = 5, - kCardLoadScript = 6, - kCardLeaveScript = 7, - kCardEnterScript = 9, - kCardUpdateScript = 10 + kCardLoadScript = 6, + kCardLeaveScript = 7, + kCardEnterScript = 9, + kCardUpdateScript = 10 +}; + +enum RivenCommandType { + kRivenCommandDrawBitmap = 1, + kRivenCommandChangeCard = 2, + kRivenCommandPlayScriptSLST = 3, + kRivenCommandPlaySound = 4, + kRivenCommandSetVariable = 7, + kRivenCommandSwitch = 8, + kRivenCommandEnableHotspot = 9, + kRivenCommandDisableHotspot = 10, + kRivenCommandStopSound = 12, + kRivenCommandChangeCursor = 13, + kRivenCommandDelay = 14, + kRivenCommandRunExternal = 17, + kRivenCommandTransition = 18, + kRivenCommandRefreshCard = 19, + kRivenCommandBeginScreenUpdate = 20, + kRivenCommandApplyScreenUpdate = 21, + kRivenCommandIncrementVariable = 24, + kRivenCommandChangeStack = 27, + kRivenCommandDisableMovie = 28, + kRivenCommandDisableAllMovies = 29, + kRivenCommandEnableMovie = 31, + kRivenCommandlayMovieBlocking = 32, + kRivenCommandPlayMovie = 33, + kRivenCommandStopMovie = 34, + kRivenCommandUnk36 = 36, + kRivenCommandFadeAmbientSounds = 37, + kRivenCommandStoreMovieOpcode = 38, + kRivenCommandActivatePLST = 39, + kRivenCommandActivateSLST = 40, + kRivenCommandActivateMLSTAndPlay = 41, + kRivenCommandActivateBLST = 43, + kRivenCommandActivateFLST = 44, + kRivenCommandZipMode = 45, + kRivenCommandActivateMLST = 46 }; class MohawkEngine_Riven; @@ -206,7 +243,7 @@ protected: */ class RivenSimpleCommand : public RivenCommand { public: - static RivenSimpleCommand *createFromStream(MohawkEngine_Riven *vm, int type, Common::ReadStream *stream); + static RivenSimpleCommand *createFromStream(MohawkEngine_Riven *vm, RivenCommandType type, Common::ReadStream *stream); virtual ~RivenSimpleCommand(); // RivenCommand API @@ -221,7 +258,7 @@ private: const char *desc; }; - RivenSimpleCommand(MohawkEngine_Riven *vm, int type, const ArgumentArray &arguments); + RivenSimpleCommand(MohawkEngine_Riven *vm, RivenCommandType type, const ArgumentArray &arguments); void setupOpcodes(); Common::String describe() const; @@ -264,7 +301,7 @@ private: const RivenOpcode *_opcodes; - int _type; + RivenCommandType _type; ArgumentArray _arguments; }; @@ -278,7 +315,7 @@ private: */ class RivenSwitchCommand : public RivenCommand { public: - static RivenSwitchCommand *createFromStream(MohawkEngine_Riven *vm, int type, Common::ReadStream *stream); + static RivenSwitchCommand *createFromStream(MohawkEngine_Riven *vm, Common::ReadStream *stream); virtual ~RivenSwitchCommand(); // RivenCommand API @@ -308,7 +345,7 @@ class RivenStackChangeCommand : public RivenCommand { public: RivenStackChangeCommand(MohawkEngine_Riven *vm, uint16 stackId, uint32 globalCardId, bool byStackId); - static RivenStackChangeCommand *createFromStream(MohawkEngine_Riven *vm, int type, Common::ReadStream *stream); + static RivenStackChangeCommand *createFromStream(MohawkEngine_Riven *vm, Common::ReadStream *stream); virtual ~RivenStackChangeCommand(); // RivenCommand API diff --git a/engines/mohawk/riven_stacks/jspit.cpp b/engines/mohawk/riven_stacks/jspit.cpp index db2acfb28b..1df55017a9 100644 --- a/engines/mohawk/riven_stacks/jspit.cpp +++ b/engines/mohawk/riven_stacks/jspit.cpp @@ -474,7 +474,7 @@ void JSpit::sunnersPlayVideo(VideoEntryPtr &video, uint32 destCardGlobalId) { sunners = 1; uint16 destCardId = getCardStackId(destCardGlobalId); - RivenScriptPtr clickScript = _vm->_scriptMan->createScriptFromData(1, 2, 1, destCardId); + RivenScriptPtr clickScript = _vm->_scriptMan->createScriptFromData(1, kRivenCommandChangeCard, 1, destCardId); _vm->_scriptMan->runScript(clickScript, false); break; } |