diff options
author | Denis Kasak | 2009-08-06 07:40:14 +0000 |
---|---|---|
committer | Denis Kasak | 2009-08-06 07:40:14 +0000 |
commit | 907a35c9297044b87f4e0c5c586873f669cee7da (patch) | |
tree | ab2046da0ebe9d4d934b13e23189facaee2c5228 | |
parent | 3ce16763c7d0f5ef22385dc482cc2c2e184b8f7c (diff) | |
download | scummvm-rg350-907a35c9297044b87f4e0c5c586873f669cee7da.tar.gz scummvm-rg350-907a35c9297044b87f4e0c5c586873f669cee7da.tar.bz2 scummvm-rg350-907a35c9297044b87f4e0c5c586873f669cee7da.zip |
Added ability to end the currently executing GPL program before it finishes via Script::endCurrentProgram().
svn-id: r43086
-rw-r--r-- | engines/draci/script.cpp | 10 | ||||
-rw-r--r-- | engines/draci/script.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 17cdefe009..9d72c4ab34 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -583,6 +583,9 @@ void Script::talk(Common::Queue<int> ¶ms) { _vm->_game->setExitLoop(false); } +void Script::endCurrentProgram() { + _endProgram = true; +} /** * @brief Evaluates mathematical expressions @@ -797,6 +800,10 @@ int Script::run(GPL2Program program, uint16 offset) { // extract low byte, i.e. the command subnumber byte subnum = cmdpair & 0xFF; + // This might get set by some GPL commands via Script::endCurrentProgram() + // if they need a program to stop midway + _endProgram = false; + if ((cmd = findCommand(num, subnum))) { int tmp; @@ -828,8 +835,9 @@ int Script::run(GPL2Program program, uint16 offset) { (this->*(cmd->_handler))(params); } - } while (cmd->_name != "gplend" && cmd->_name != "exit"); + } while (cmd->_name != "gplend" && cmd->_name != "exit" && !_endProgram); + _endProgram = false; _jump = oldJump; return 0; diff --git a/engines/draci/script.h b/engines/draci/script.h index 9e3345cd0b..78e813da40 100644 --- a/engines/draci/script.h +++ b/engines/draci/script.h @@ -89,10 +89,12 @@ public: Script(DraciEngine *vm) : _vm(vm), _jump(0) { setupCommandList(); }; int run(GPL2Program program, uint16 offset); + void endCurrentProgram(); private: int _jump; + bool _endProgram; /** List of all GPL commands. Initialised in the constructor. */ const GPL2Command *_commandList; |