aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/script.cpp
diff options
context:
space:
mode:
authorDenis Kasak2009-08-06 07:40:14 +0000
committerDenis Kasak2009-08-06 07:40:14 +0000
commit907a35c9297044b87f4e0c5c586873f669cee7da (patch)
treeab2046da0ebe9d4d934b13e23189facaee2c5228 /engines/draci/script.cpp
parent3ce16763c7d0f5ef22385dc482cc2c2e184b8f7c (diff)
downloadscummvm-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.cpp10
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> &params) {
_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;