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

sev at users.sourceforge.net sev at users.sourceforge.net
Tue May 19 23:09:44 CEST 2009


Revision: 40733
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40733&view=rev
Author:   sev
Date:     2009-05-19 21:09:43 +0000 (Tue, 19 May 2009)

Log Message:
-----------
Start of fixing bug #2537054: "AGI: Using GMM to load causes graphics glitches"
The engine still crashes when load from GMM occured with a text box on screen.

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

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2009-05-19 20:40:21 UTC (rev 40732)
+++ scummvm/trunk/engines/agi/agi.h	2009-05-19 21:09:43 UTC (rev 40733)
@@ -968,6 +968,7 @@
 	int messageBox(const char *);
 	int selectionBox(const char *, const char **);
 	void closeWindow(void);
+	void forgetWindow(void);
 	void drawWindow(int, int, int, int);
 	void printText(const char *, int, int, int, int, int, int, bool checkerboard = false);
 	void printTextConsole(const char *, int, int, int, int, int);

Modified: scummvm/trunk/engines/agi/keyboard.cpp
===================================================================
--- scummvm/trunk/engines/agi/keyboard.cpp	2009-05-19 20:40:21 UTC (rev 40732)
+++ scummvm/trunk/engines/agi/keyboard.cpp	2009-05-19 21:09:43 UTC (rev 40733)
@@ -379,7 +379,7 @@
 	}
 
 	debugC(3, kDebugLevelInput, "waiting...");
-	while (!(shouldQuit() || restartGame)) {
+	while (!(shouldQuit() || restartGame || getflag(fRestoreJustRan))) {
 		_gfx->pollTimer();	/* msdos driver -> does nothing */
 		key = doPollKeyboard();
 		if (key == KEY_ENTER || key == KEY_ESCAPE || key == BUTTON_LEFT)

Modified: scummvm/trunk/engines/agi/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agi/saveload.cpp	2009-05-19 20:40:21 UTC (rev 40732)
+++ scummvm/trunk/engines/agi/saveload.cpp	2009-05-19 21:09:43 UTC (rev 40733)
@@ -613,6 +613,16 @@
 
 		_gfx->pollTimer();	/* msdos driver -> does nothing */
 		key = doPollKeyboard();
+
+		// It may happen that somebody will open GMM while
+		// this dialog is open, and load a game
+		// We are processing it here, effectively jumping
+		// out of the dead loop
+		if (getflag(fRestoreJustRan)) {
+			rc = -2;
+			goto getout;
+		}
+
 		switch (key) {
 		case KEY_ENTER:
 			rc = active;
@@ -724,6 +734,7 @@
 
 getout:
 	closeWindow();
+
 	return rc;
 }
 
@@ -844,7 +855,9 @@
 	slot = selectSlot();
 
 	if (slot < 0) {
-		messageBox("Game NOT restored.");
+		if (slot == -1) // slot = -2 when GMM was launched
+			messageBox("Game NOT restored.");
+
 		return errOK;
 	}
 

Modified: scummvm/trunk/engines/agi/text.cpp
===================================================================
--- scummvm/trunk/engines/agi/text.cpp	2009-05-19 20:40:21 UTC (rev 40732)
+++ scummvm/trunk/engines/agi/text.cpp	2009-05-19 21:09:43 UTC (rev 40733)
@@ -299,6 +299,11 @@
  */
 void AgiEngine::closeWindow() {
 	debugC(4, kDebugLevelText, "closeWindow()");
+
+	if (getflag(fRestoreJustRan)) {
+		forgetWindow();
+	}
+
 	_sprites->eraseBoth();
 	eraseTextbox();	/* remove window, if any */
 	_sprites->blitBoth();
@@ -307,6 +312,18 @@
 }
 
 /**
+ * Remove existing window without restoring anything
+ */
+void AgiEngine::forgetWindow() {
+	debugC(4, kDebugLevelText, "forgetWindow()");
+
+	free(_game.window.buffer);
+	_game.window.buffer = 0;
+	_game.window.active = false;
+	_game.hasWindow = false;
+}
+
+/**
  * Display a message box.
  * This function displays the specified message in a text box
  * centered in the screen and waits until a key is pressed.
@@ -466,6 +483,9 @@
 	setvar(vKey, 0);
 
 	do {
+		if (getflag(fRestoreJustRan))
+			break;
+
 		mainCycle();
 		if (_game.keypress == KEY_ENTER) {
 			debugC(4, kDebugLevelText, "KEY_ENTER");


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