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

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Mon Aug 11 00:53:44 CEST 2008


Revision: 33772
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33772&view=rev
Author:   cpage88
Date:     2008-08-10 22:53:43 +0000 (Sun, 10 Aug 2008)

Log Message:
-----------
Added Autosave support for AGI

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/engines/agi/agi.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/agi.h
    scummvm/branches/gsoc2008-rtl/engines/agi/cycle.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/saveload.cpp

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/agi.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/agi.cpp	2008-08-10 22:03:00 UTC (rev 33771)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/agi.cpp	2008-08-10 22:53:43 UTC (rev 33772)
@@ -734,6 +734,8 @@
 	_gfx->initVideo();
 	_sound->initSound();
 
+	_lastSaveTime = 0;
+
 	_timer->installTimerProc(agiTimerFunctionLow, 10 * 1000, NULL);
 
 	_game.ver = -1;		/* Don't display the conf file warning */

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/agi.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/agi.h	2008-08-10 22:03:00 UTC (rev 33771)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/agi.h	2008-08-10 22:53:43 UTC (rev 33772)
@@ -746,6 +746,8 @@
 	int go();
 	void initialize();
 
+	uint32 _lastSaveTime;
+
 public:
 	AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc);
 	virtual ~AgiEngine();

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/cycle.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/cycle.cpp	2008-08-10 22:03:00 UTC (rev 33771)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/cycle.cpp	2008-08-10 22:53:43 UTC (rev 33772)
@@ -355,6 +355,10 @@
 		if (quit() == 0xff)
 			ec = errRestartGame;
 
+		if (shouldPerformAutoSave(_lastSaveTime)) {
+			saveGame(getSavegameFilename(0), "Autosave");
+		}
+
 	} while (quit() == 0);
 
 	_sound->stopSound();

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/saveload.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/saveload.cpp	2008-08-10 22:03:00 UTC (rev 33771)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/saveload.cpp	2008-08-10 22:53:43 UTC (rev 33772)
@@ -214,6 +214,9 @@
 
 	delete out;
 	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName);
+
+	_lastSaveTime = _system->getMillis();
+
 	return result;
 }
 
@@ -699,13 +702,18 @@
 
 	sprintf(fileName, "%s", getSavegameFilename(slot));
 
-	drawWindow(hp, vp, GFX_WIDTH - hp, GFX_HEIGHT - vp);
-	printText("Select a slot in which you wish to\nsave the game:",
-			0, hm + 1, vm + 1, w, MSG_BOX_TEXT, MSG_BOX_COLOUR);
 
-	slot = selectSlot();
-	if (slot < 0)
-		return errOK;
+	do {
+		drawWindow(hp, vp, GFX_WIDTH - hp, GFX_HEIGHT - vp);
+		printText("Select a slot in which you wish to\nsave the game:",
+				0, hm + 1, vm + 1, w, MSG_BOX_TEXT, MSG_BOX_COLOUR);
+		slot = selectSlot();
+		if (slot == 0)
+			messageBox("That slot is for Autosave only.");
+		else if (slot < 0)
+			return errOK;
+	}
+	while (slot == 0);
 
 	drawWindow(hp, vp + 5 * CHAR_LINES, GFX_WIDTH - hp,
 			GFX_HEIGHT - vp - 9 * CHAR_LINES);


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