[Scummvm-cvs-logs] SF.net SVN: scummvm: [32203] scummvm/branches/gsoc2008-rtl/engines/agos

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Tue May 20 23:40:54 CEST 2008


Revision: 32203
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32203&view=rev
Author:   cpage88
Date:     2008-05-20 14:40:53 -0700 (Tue, 20 May 2008)

Log Message:
-----------
AGOS Engine: Began implementation for a new quit event which will cleanly return to the launcher.  This replaces the old shutdown() method within delay()

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/engines/agos/agos.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/agos.h
    scummvm/branches/gsoc2008-rtl/engines/agos/event.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/gfx.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/input.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/script.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/script_e1.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/script_s1.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/subroutine.cpp

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/agos.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/agos.cpp	2008-05-20 20:00:10 UTC (rev 32202)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/agos.cpp	2008-05-20 21:40:53 UTC (rev 32203)
@@ -98,6 +98,8 @@
 	_vc_get_out_of_code = 0;
 	_gameOffsetsPtr = 0;
 
+	_quit = false;
+
 	_debugger = 0;
 
 	_gameFile = 0;
@@ -933,7 +935,7 @@
 	_mixer->pauseAll(true);
 	_sound->ambientPause(true);
 
-	while (_pause) {
+	while (_pause && !_quit) {
 		delay(1);
 		if (_keyPressed.keycode == Common::KEYCODE_p)
 			_pause = false;
@@ -974,7 +976,7 @@
 		(getFeatures() & GF_DEMO)) {
 		int i;
 
-		while (1) {
+		while (!_quit) {
 			for (i = 0; i < 4; i++) {
 				setWindowImage(3, 9902 + i);
 				debug(0, "Displaying image %d", 9902 + i);
@@ -1003,7 +1005,7 @@
 	runSubroutine101();
 	permitInput();
 
-	while (1) {
+	while (!_quit) {
 		waitForInput();
 		handleVerbClicked(_verbHitArea);
 		delay(100);
@@ -1012,6 +1014,9 @@
 	return 0;
 }
 
+
+/*  I do not think that this will be used
+ *  
 void AGOSEngine::shutdown() {
 	// Sync with AGOSEngine::~AGOSEngine()
 	// In Simon 2, this gets deleted along with _sound further down
@@ -1059,6 +1064,7 @@
 
 	_system->quit();
 }
+*/
 
 uint32 AGOSEngine::getTime() const {
 	// FIXME: calling time() is not portable, use OSystem::getMillis instead

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/agos.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/agos.h	2008-05-20 20:00:10 UTC (rev 32202)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/agos.h	2008-05-20 21:40:53 UTC (rev 32203)
@@ -269,6 +269,7 @@
 
 	uint16 _marks;
 
+	bool _quit;
 	bool _scriptVar2;
 	bool _runScriptReturn1;
 	bool _runScriptCondition[40];

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/event.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/event.cpp	2008-05-20 20:00:10 UTC (rev 32202)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/event.cpp	2008-05-20 21:40:53 UTC (rev 32203)
@@ -142,7 +142,7 @@
 
 	cur_time = getTime() - _gameStoppedClock;
 
-	while ((te = _firstTimeStruct) != NULL && te->time <= cur_time) {
+	while ((te = _firstTimeStruct) != NULL && te->time <= cur_time && !_quit) {
 		result = true;
 		_pendingDeleteTimeEvent = te;
 		invokeTimeEvent(te);
@@ -521,7 +521,7 @@
 				_rightButtonDown++;
 				break;
 			case Common::EVENT_QUIT:
-				shutdown();
+				_quit = true;
 				return;
 			default:
 				break;
@@ -544,7 +544,7 @@
 		_system->delayMillis(this_delay);
 
 		cur = _system->getMillis();
-	} while (cur < start + amount);
+	} while (cur < start + amount && !_quit);
 }
 
 void AGOSEngine::timer_callback() {

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/gfx.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/gfx.cpp	2008-05-20 20:00:10 UTC (rev 32202)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/gfx.cpp	2008-05-20 21:40:53 UTC (rev 32203)
@@ -1263,7 +1263,7 @@
 		if (getGameType() == GType_WW && (mode == 6 || mode == 8 || mode == 9)) {
 			setWindowImage(mode, vga_res);
 		} else {
-			while (_copyScnFlag)
+			while (_copyScnFlag && !_quit)
 				delay(1);
 
 			setWindowImage(mode, vga_res);

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/input.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/input.cpp	2008-05-20 20:00:10 UTC (rev 32202)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/input.cpp	2008-05-20 21:40:53 UTC (rev 32203)
@@ -189,12 +189,12 @@
 		resetVerbs();
 	}
 
-	for (;;) {
+	while (!_quit) {
 		_lastHitArea = NULL;
 		_lastHitArea3 = NULL;
 		_dragAccept = 1;
 
-		for (;;) {
+		while (!_quit) {
 			if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
 					_keyPressed.keycode == Common::KEYCODE_F10)
 				displayBoxStars();

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/script.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/script.cpp	2008-05-20 20:00:10 UTC (rev 32202)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/script.cpp	2008-05-20 21:40:53 UTC (rev 32203)
@@ -410,7 +410,7 @@
 
 void AGOSEngine::o_end() {
 	// 68: exit interpreter
-	shutdown();
+	_quit = true;
 }
 
 void AGOSEngine::o_done() {
@@ -965,6 +965,9 @@
 int AGOSEngine::runScript() {
 	bool flag;
 
+	if (_quit)
+		return 1;
+
 	do {
 		if (_continousMainScript)
 			dumpOpcode(_codePtr);
@@ -1007,7 +1010,7 @@
 			error("Invalid opcode '%d' encountered", _opcode);
 
 		executeOpcode(_opcode);
-	} while (getScriptCondition() != flag && !getScriptReturn());
+	} while  (getScriptCondition() != flag && !getScriptReturn() && !_quit);
 
 	return getScriptReturn();
 }
@@ -1063,7 +1066,7 @@
 	_exitCutscene = false;
 	_rightButtonDown = false;
 
-	while (_vgaWaitFor != 0) {
+	while (_vgaWaitFor != 0 && !_quit) {
 		if (_rightButtonDown) {
 			if (_vgaWaitFor == 200 && (getGameType() == GType_FF || !getBitFlag(14))) {
 				skipSpeech();

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/script_e1.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/script_e1.cpp	2008-05-20 20:00:10 UTC (rev 32202)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/script_e1.cpp	2008-05-20 21:40:53 UTC (rev 32203)
@@ -565,7 +565,7 @@
 		lobjFunc(l, "You can see ");	/* Show objects */
 	}
 	if (r && (r->flags & 4) && levelOf(i) < 10000) {
-		shutdown();
+		_quit = true;
 	}
 }
 
@@ -944,7 +944,7 @@
 			windowPutChar(window, *message2);
 
 		if (confirmYesOrNo(120, 62) == 0x7FFF) {
-			shutdown();
+			_quit = true;
 		} else {
 			goto restart;
 		}

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/script_s1.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/script_s1.cpp	2008-05-20 20:00:10 UTC (rev 32202)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/script_s1.cpp	2008-05-20 21:40:53 UTC (rev 32203)
@@ -345,14 +345,14 @@
 		if (isSmartphone()) {
 			if (_keyPressed.keycode) {
 				if (_keyPressed.keycode == Common::KEYCODE_RETURN)
-					shutdown();
+					_quit = true;
 				else
 					break;
 			}
 		}
 #endif
 		if (_keyPressed.keycode == keyYes)
-			shutdown();
+			_quit = true;
 		else if (_keyPressed.keycode == keyNo)
 			break;
 	}

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/subroutine.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/subroutine.cpp	2008-05-20 20:00:10 UTC (rev 32202)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/subroutine.cpp	2008-05-20 21:40:53 UTC (rev 32203)
@@ -554,6 +554,10 @@
 
 	_currentTable = sub;
 restart:
+
+	if (_quit)
+		return result;
+
 	while ((byte *)sl != (byte *)sub) {
 		_currentLine = sl;
 		if (checkIfToRunSubroutineLine(sl, sub)) {


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