diff options
author | Paul Gilbert | 2014-08-17 22:44:31 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-17 22:44:31 -0400 |
commit | 9150e1816c57e3852fd86123ba8e0d1c9dee8ff4 (patch) | |
tree | 008dd047ce1910ee50929853afcf9eff1ea99681 /engines/access | |
parent | 7fef53b68ccddcb8ed93c567456c73fe503ee006 (diff) | |
download | scummvm-rg350-9150e1816c57e3852fd86123ba8e0d1c9dee8ff4.tar.gz scummvm-rg350-9150e1816c57e3852fd86123ba8e0d1c9dee8ff4.tar.bz2 scummvm-rg350-9150e1816c57e3852fd86123ba8e0d1c9dee8ff4.zip |
ACCESS: Shifted some Amazon specific opcodes to the AmazonScripts class
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/amazon/amazon_scripts.cpp | 57 | ||||
-rw-r--r-- | engines/access/amazon/amazon_scripts.h | 9 | ||||
-rw-r--r-- | engines/access/scripts.cpp | 41 | ||||
-rw-r--r-- | engines/access/scripts.h | 15 |
4 files changed, 73 insertions, 49 deletions
diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index 2fdbcc94a2..38cf9d6a84 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -71,6 +71,63 @@ void AmazonScripts::executeSpecial(int commandIndex, int param1, int param2) { } } +typedef void(AmazonScripts::*AmazonScriptMethodPtr)(); + +void AmazonScripts::executeCommand(int commandIndex) { + static const AmazonScriptMethodPtr COMMAND_LIST[] = { + &AmazonScripts::CMDHELP, &AmazonScripts::CMDCYCLEBACK, + &AmazonScripts::CMDCHAPTER, &AmazonScripts::cmdSetHelp, + &AmazonScripts::cmdCenterPanel, &AmazonScripts::cmdMainPanel, + &AmazonScripts::CMDRETFLASH + }; + + if (commandIndex >= 73) + (this->*COMMAND_LIST[commandIndex - 73])(); + else + Scripts::executeCommand(commandIndex); +} + +void AmazonScripts::CMDHELP() { + error("TODO CMDHELP"); +} + +void AmazonScripts::CMDCYCLEBACK() { + error("TODO CMDCYCLEBACK"); +} +void AmazonScripts::CMDCHAPTER() { + error("TODO CMDCHAPTER"); +} + +void AmazonScripts::cmdSetHelp() { + int arrayId = (_data->readUint16LE() && 0xFF) - 1; + int helpId = _data->readUint16LE() && 0xFF; + + byte *help = _vm->_helpTbl[arrayId]; + help[helpId] = 1; + + if (_vm->_useItem == 0) { + _sequence = 11000; + searchForSequence(); + } +} + +void AmazonScripts::cmdCenterPanel() { + if (_vm->_screen->_vesaMode) { + _vm->_screen->clearScreen(); + _vm->_screen->setPanel(3); + } +} + +void AmazonScripts::cmdMainPanel() { + if (_vm->_screen->_vesaMode) { + _vm->_room->init4Quads(); + _vm->_screen->setPanel(0); + } +} + +void AmazonScripts::CMDRETFLASH() { + error("TODO CMDRETFLASH"); +} } // End of namespace Amazon diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h index b8fdaaa7f3..c9a889e3ad 100644 --- a/engines/access/amazon/amazon_scripts.h +++ b/engines/access/amazon/amazon_scripts.h @@ -33,6 +33,15 @@ namespace Amazon { class AmazonScripts: public Scripts { protected: virtual void executeSpecial(int commandIndex, int param1, int param2); + virtual void executeCommand(int commandIndex); + + void CMDHELP(); + void CMDCYCLEBACK(); + void CMDCHAPTER(); + void cmdSetHelp(); + void cmdCenterPanel(); + void cmdMainPanel(); + void CMDRETFLASH(); public: AmazonScripts(AccessEngine *vm); }; diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index fba947a174..3c60065bfe 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -29,7 +29,7 @@ namespace Access { -Scripts::Scripts(AccessEngine *vm) : _vm(vm) { +Scripts::Scripts(AccessEngine *vm) : Manager(vm) { _rawData = nullptr; _data = nullptr; _sequence = 0; @@ -89,6 +89,8 @@ int Scripts::executeScript() { return _returnCode; } +typedef void(Scripts::*ScriptMethodPtr)(); + void Scripts::executeCommand(int commandIndex) { static const ScriptMethodPtr COMMAND_LIST[] = { &Scripts::CMDOBJECT, &Scripts::cmdEndObject, &Scripts::cmdJumpLook, @@ -115,9 +117,7 @@ void Scripts::executeCommand(int commandIndex) { &Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION, &Scripts::CMDPUSHLOCATION, &Scripts::cmdPlayerOff, &Scripts::cmdPlayerOn, &Scripts::CMDDEAD, &Scripts::cmdFadeOut, - &Scripts::CMDENDVID, &Scripts::CMDHELP, &Scripts::CMDCYCLEBACK, - &Scripts::CMDCHAPTER, &Scripts::cmdSetHelp, &Scripts::cmdCenterPanel, - &Scripts::cmdMainPanel, &Scripts::CMDRETFLASH + &Scripts::CMDENDVID }; (this->*COMMAND_LIST[commandIndex])(); @@ -503,38 +503,5 @@ void Scripts::cmdFadeOut() { } void Scripts::CMDENDVID() { error("TODO CMDENDVID"); } -void Scripts::CMDHELP() { error("TODO CMDHELP"); } -void Scripts::CMDCYCLEBACK() { error("TODO CMDCYCLEBACK"); } -void Scripts::CMDCHAPTER() { error("TODO CMDCHAPTER"); } - -void Scripts::cmdSetHelp() { - int arrayId = (_data->readUint16LE() && 0xFF) - 1; - int helpId = _data->readUint16LE() && 0xFF; - - byte *help = _vm->_helpTbl[arrayId]; - help[helpId] = 1; - - if (_vm->_useItem == 0) { - _sequence = 11000; - searchForSequence(); - } -} - -void Scripts::cmdCenterPanel() { - if (_vm->_screen->_vesaMode) { - _vm->_screen->clearScreen(); - _vm->_screen->setPanel(3); - } -} - -void Scripts::cmdMainPanel() { - if (_vm->_screen->_vesaMode) { - _vm->_room->init4Quads(); - _vm->_screen->setPanel(0); - } -} - -void Scripts::CMDRETFLASH() { error("TODO CMDRETFLASH"); } - } // End of namespace Access diff --git a/engines/access/scripts.h b/engines/access/scripts.h index ac2bae005c..1f0bf84443 100644 --- a/engines/access/scripts.h +++ b/engines/access/scripts.h @@ -25,23 +25,21 @@ #include "common/scummsys.h" #include "common/memstream.h" +#include "access/data.h" namespace Access { class AccessEngine; class Scripts; -typedef void(Scripts::*ScriptMethodPtr)(); - -class Scripts { +class Scripts: public Manager { private: const byte *_rawData; - Common::MemoryReadStream *_data; int _specialFunction; void printString(const Common::String &msg); protected: - AccessEngine *_vm; + Common::MemoryReadStream *_data; virtual void executeSpecial(int commandIndex, int param1, int param2) = 0; virtual void executeCommand(int commandIndex); @@ -112,13 +110,6 @@ protected: void CMDDEAD(); void cmdFadeOut(); void CMDENDVID(); - void CMDHELP(); - void CMDCYCLEBACK(); - void CMDCHAPTER(); - void cmdSetHelp(); - void cmdCenterPanel(); - void cmdMainPanel(); - void CMDRETFLASH(); public: int _sequence; bool _endFlag; |