[Scummvm-cvs-logs] SF.net SVN: scummvm:[43086] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Thu Aug 6 09:40:14 CEST 2009


Revision: 43086
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43086&view=rev
Author:   dkasak13
Date:     2009-08-06 07:40:14 +0000 (Thu, 06 Aug 2009)

Log Message:
-----------
Added ability to end the currently executing GPL program before it finishes via Script::endCurrentProgram().

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/script.h

Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp	2009-08-06 05:17:18 UTC (rev 43085)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp	2009-08-06 07:40:14 UTC (rev 43086)
@@ -583,6 +583,9 @@
 	_vm->_game->setExitLoop(false);
 }
 
+void Script::endCurrentProgram() {
+	_endProgram = true;
+}
 
 /**
  * @brief Evaluates mathematical expressions
@@ -797,6 +800,10 @@
 		// 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 @@
 			(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;

Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.h	2009-08-06 05:17:18 UTC (rev 43085)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.h	2009-08-06 07:40:14 UTC (rev 43086)
@@ -89,10 +89,12 @@
 	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;


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