diff options
author | Benjamin Haisch | 2008-05-07 17:28:38 +0000 |
---|---|---|
committer | Benjamin Haisch | 2008-05-07 17:28:38 +0000 |
commit | a7f5150228c405b2083cf9fd5da5d0890610f113 (patch) | |
tree | 648b5cb27c48ce36866c10b963133834181e33eb /engines/made/script.cpp | |
parent | 311e9165ed3b9442049e9e5e6b25c31d024f04ac (diff) | |
download | scummvm-rg350-a7f5150228c405b2083cf9fd5da5d0890610f113.tar.gz scummvm-rg350-a7f5150228c405b2083cf9fd5da5d0890610f113.tar.bz2 scummvm-rg350-a7f5150228c405b2083cf9fd5da5d0890610f113.zip |
- cmd_return now exits the game if it returns from the main function
- Implemented cmd_exit
- PmvPlayer now exits "more gracefully" when the application is closed while playing
svn-id: r31930
Diffstat (limited to 'engines/made/script.cpp')
-rw-r--r-- | engines/made/script.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/engines/made/script.cpp b/engines/made/script.cpp index ba0b61d29b..6e896d94be 100644 --- a/engines/made/script.cpp +++ b/engines/made/script.cpp @@ -192,7 +192,7 @@ ScriptInterpreter::~ScriptInterpreter() { void ScriptInterpreter::runScript(int16 scriptObjectIndex) { - _terminated = false; + _vm->_quit = false; _runningScriptObjectIndex = scriptObjectIndex; _localStackPos = _stack.getStackPos(); @@ -200,7 +200,7 @@ void ScriptInterpreter::runScript(int16 scriptObjectIndex) { _codeBase = _vm->_dat->getObject(_runningScriptObjectIndex)->getData(); _codeIp = _codeBase; - while (!_terminated) { + while (!_vm->_quit) { byte opcode = readByte(); if (opcode >= 1 && opcode <= _commandsMax) { debug(4, "[%04X:%04X] opcode = %s", _runningScriptObjectIndex, (uint) (_codeIp - _codeBase), _commands[opcode - 1].desc); @@ -418,11 +418,17 @@ void ScriptInterpreter::cmd_vsize() { } void ScriptInterpreter::cmd_exit() { - warning("Unimplemented command: cmd_exit"); + _vm->_quit = true; } void ScriptInterpreter::cmd_return() { - // TODO: Check if returning from main function + + // Check if returning from main function + if (_localStackPos == kScriptStackSize) { + _vm->_quit = true; + return; + } + int16 funcResult = _stack.top(); _stack.setStackPos(_localStackPos); _localStackPos = kScriptStackLimit - _stack.pop(); |