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 /engines/draci/script.cpp | |
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
Diffstat (limited to 'engines/draci/script.cpp')
-rw-r--r-- | engines/draci/script.cpp | 10 |
1 files changed, 9 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; |