[Scummvm-cvs-logs] SF.net SVN: scummvm: [31930] scummvm/trunk/engines/made

john_doe at users.sourceforge.net john_doe at users.sourceforge.net
Wed May 7 19:28:38 CEST 2008


Revision: 31930
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31930&view=rev
Author:   john_doe
Date:     2008-05-07 10:28:38 -0700 (Wed, 07 May 2008)

Log Message:
-----------
- 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

Modified Paths:
--------------
    scummvm/trunk/engines/made/pmvplayer.cpp
    scummvm/trunk/engines/made/script.cpp

Modified: scummvm/trunk/engines/made/pmvplayer.cpp
===================================================================
--- scummvm/trunk/engines/made/pmvplayer.cpp	2008-05-07 15:09:10 UTC (rev 31929)
+++ scummvm/trunk/engines/made/pmvplayer.cpp	2008-05-07 17:28:38 UTC (rev 31930)
@@ -188,8 +188,8 @@
 				_abort = true;
 			break;
 		case Common::EVENT_QUIT:
-			// TODO: Exit more gracefully
-			g_system->quit();
+			_vm->_quit = true;
+			_abort = true;
 			break;
 		default:
 			break;

Modified: scummvm/trunk/engines/made/script.cpp
===================================================================
--- scummvm/trunk/engines/made/script.cpp	2008-05-07 15:09:10 UTC (rev 31929)
+++ scummvm/trunk/engines/made/script.cpp	2008-05-07 17:28:38 UTC (rev 31930)
@@ -192,7 +192,7 @@
 
 void ScriptInterpreter::runScript(int16 scriptObjectIndex) {
 
-	_terminated = false;
+	_vm->_quit = false;
 	_runningScriptObjectIndex = scriptObjectIndex;
 
 	_localStackPos = _stack.getStackPos();
@@ -200,7 +200,7 @@
 	_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_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();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list