[Scummvm-cvs-logs] SF.net SVN: scummvm:[36279] scummvm/trunk/engines/agi

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Feb 12 16:13:52 CET 2009


Revision: 36279
          http://scummvm.svn.sourceforge.net/scummvm/?rev=36279&view=rev
Author:   thebluegr
Date:     2009-02-12 15:13:52 +0000 (Thu, 12 Feb 2009)

Log Message:
-----------
Fix for bug #2541237 - "AGI: Restart quits ScummVM"

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.cpp
    scummvm/trunk/engines/agi/agi.h
    scummvm/trunk/engines/agi/cycle.cpp
    scummvm/trunk/engines/agi/keyboard.cpp
    scummvm/trunk/engines/agi/op_cmd.cpp
    scummvm/trunk/engines/agi/op_test.cpp
    scummvm/trunk/engines/agi/saveload.cpp
    scummvm/trunk/engines/agi/text.cpp

Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2009-02-12 09:52:31 UTC (rev 36278)
+++ scummvm/trunk/engines/agi/agi.cpp	2009-02-12 15:13:52 UTC (rev 36279)
@@ -382,6 +382,8 @@
 
 	initWords();
 
+	restartGame = false;
+
 	if (!_menu)
 		_menu = new Menu(this, _gfx, _picture);
 

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2009-02-12 09:52:31 UTC (rev 36278)
+++ scummvm/trunk/engines/agi/agi.h	2009-02-12 15:13:52 UTC (rev 36279)
@@ -165,7 +165,6 @@
 	errNotEnoughMemory,
 	errBadResource,
 	errUnknownAGIVersion,
-	errRestartGame,
 	errNoLoopsInView,
 	errViewDataError,
 	errNoGameList,
@@ -799,6 +798,7 @@
 
 	uint8 *_intobj;
 	int _oldMode;
+	bool restartGame;
 
 	Menu* _menu;
 

Modified: scummvm/trunk/engines/agi/cycle.cpp
===================================================================
--- scummvm/trunk/engines/agi/cycle.cpp	2009-02-12 09:52:31 UTC (rev 36278)
+++ scummvm/trunk/engines/agi/cycle.cpp	2009-02-12 15:13:52 UTC (rev 36279)
@@ -115,7 +115,7 @@
 	oldSound = getflag(fSoundOn);
 
 	_game.exitAllLogics = false;
-	while (runLogic(0) == 0 && !shouldQuit()) {
+	while (runLogic(0) == 0 && !(shouldQuit() || restartGame)) {
 		_game.vars[vWordNotFound] = 0;
 		_game.vars[vBorderTouchObj] = 0;
 		_game.vars[vBorderCode] = 0;
@@ -361,16 +361,11 @@
 			_game.vars[vKey] = 0;
 		}
 
-		// FIXME: This has been broken with the merge of the RTL GSoC project. shouldQuit() returns a boolean, and we're trying to
-		// check it against 0xff, which is never going to be true
-		//if (shouldQuit() == 0xff)
-		//	ec = errRestartGame;
-
 		if (shouldPerformAutoSave(_lastSaveTime)) {
 			saveGame(getSavegameFilename(0), "Autosave");
 		}
 
-	} while (shouldQuit() == 0);
+	} while (!(shouldQuit() || restartGame));
 
 	_sound->stopSound();
 
@@ -390,8 +385,11 @@
 
 		if (agiInit() != errOK)
 			break;
-		if (ec == errRestartGame)
+
+		if (restartGame) {
 			setflag(fRestartGame, true);
+			restartGame = false;
+		}
 
 		// Set computer type (v20 i.e. vComputer)
 		switch (getPlatform()) {
@@ -444,7 +442,7 @@
 		ec = playGame();
 		_game.state = STATE_LOADED;
 		agiDeinit();
-	} while (ec == errRestartGame);
+	} while (restartGame);
 
 	delete _menu;
 	_menu = NULL;

Modified: scummvm/trunk/engines/agi/keyboard.cpp
===================================================================
--- scummvm/trunk/engines/agi/keyboard.cpp	2009-02-12 09:52:31 UTC (rev 36278)
+++ scummvm/trunk/engines/agi/keyboard.cpp	2009-02-12 15:13:52 UTC (rev 36279)
@@ -374,7 +374,7 @@
 	}
 
 	debugC(3, kDebugLevelInput, "waiting...");
-	while (!shouldQuit()) {
+	while (!(shouldQuit() || restartGame)) {
 		_gfx->pollTimer();	/* msdos driver -> does nothing */
 		key = doPollKeyboard();
 		if (key == KEY_ENTER || key == KEY_ESCAPE || key == BUTTON_LEFT)
@@ -397,7 +397,7 @@
 	}
 
 	debugC(3, kDebugLevelInput, "waiting...");
-	while (!shouldQuit()) {
+	while (!(shouldQuit() || restartGame)) {
 		_gfx->pollTimer();	/* msdos driver -> does nothing */
 		key = doPollKeyboard();
 		if (key)

Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp	2009-02-12 09:52:31 UTC (rev 36278)
+++ scummvm/trunk/engines/agi/op_cmd.cpp	2009-02-12 15:13:52 UTC (rev 36279)
@@ -1231,7 +1231,7 @@
 		g_agi->selectionBox(" Restart game, or continue? \n\n\n", buttons);
 
 	if (sel == 0) {
-		g_agi->quitGame();
+		g_agi->restartGame = true;
 		g_agi->setflag(fRestartGame, true);
 		g_agi->_menu->enableAll();
 	}
@@ -1331,7 +1331,7 @@
 
 	do {
 		g_agi->mainCycle();
-	} while (game.inputMode == INPUT_GETSTRING && !g_agi->shouldQuit());
+	} while (game.inputMode == INPUT_GETSTRING && !(g_agi->shouldQuit() || g_agi->restartGame));
 }
 
 cmd(get_num) {
@@ -1349,7 +1349,7 @@
 
 	do {
 		g_agi->mainCycle();
-	} while (game.inputMode == INPUT_GETSTRING && !g_agi->shouldQuit());
+	} while (game.inputMode == INPUT_GETSTRING && !(g_agi->shouldQuit() || g_agi->restartGame));
 
 	_v[p1] = atoi(game.strings[MAX_STRINGS]);
 	debugC(4, kDebugLevelScripts, "[%s] -> %d", game.strings[MAX_STRINGS], _v[p1]);
@@ -1745,7 +1745,7 @@
 	curLogic->cIP = curLogic->sIP;
 
 	timerHack = 0;
-	while (ip < _game.logics[n].size && !shouldQuit()) {
+	while (ip < _game.logics[n].size && !(shouldQuit() || restartGame)) {
 		if (_debug.enabled) {
 			if (_debug.steps > 0) {
 				if (_debug.logic0 || n) {

Modified: scummvm/trunk/engines/agi/op_test.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_test.cpp	2009-02-12 09:52:31 UTC (rev 36278)
+++ scummvm/trunk/engines/agi/op_test.cpp	2009-02-12 15:13:52 UTC (rev 36279)
@@ -231,7 +231,7 @@
 	uint8 p[16] = { 0 };
 	bool end_test = false;
 
-	while (retval && !shouldQuit() && !end_test) {
+	while (retval && !(shouldQuit() || restartGame) && !end_test) {
 		if (_debug.enabled && (_debug.logic0 || lognum))
 			debugConsole(lognum, lTEST_MODE, NULL);
 

Modified: scummvm/trunk/engines/agi/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agi/saveload.cpp	2009-02-12 09:52:31 UTC (rev 36278)
+++ scummvm/trunk/engines/agi/saveload.cpp	2009-02-12 15:13:52 UTC (rev 36279)
@@ -566,7 +566,7 @@
 	int oldFirstSlot = _firstSlot + 1;
 	int oldActive = active + 1;
 
-	while (!shouldQuit()) {
+	while (!(shouldQuit() || restartGame)) {
 		int sbPos = 0;
 
 		// Use the extreme scrollbar positions only if the extreme

Modified: scummvm/trunk/engines/agi/text.cpp
===================================================================
--- scummvm/trunk/engines/agi/text.cpp	2009-02-12 09:52:31 UTC (rev 36278)
+++ scummvm/trunk/engines/agi/text.cpp	2009-02-12 15:13:52 UTC (rev 36279)
@@ -376,7 +376,7 @@
 	AllowSyntheticEvents on(this);
 
 	debugC(4, kDebugLevelText, "selectionBox(): waiting...");
-	while (!shouldQuit()) {
+	while (!(shouldQuit() || restartGame)) {
 		for (i = 0; b[i]; i++)
 			_gfx->drawCurrentStyleButton(bx[i], by[i], b[i], i == active, false, i == 0);
 


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