[Scummvm-cvs-logs] SF.net SVN: scummvm: [24960] scummvm/trunk/engines/agos

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Jan 1 05:35:28 CET 2007


Revision: 24960
          http://scummvm.svn.sourceforge.net/scummvm/?rev=24960&view=rev
Author:   kirben
Date:     2006-12-31 20:35:27 -0800 (Sun, 31 Dec 2006)

Log Message:
-----------
Fix bug #1624767 - FF: save games will not load.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/agosgame.cpp
    scummvm/trunk/engines/agos/intern.h
    scummvm/trunk/engines/agos/saveload.cpp
    scummvm/trunk/engines/agos/script_e1.cpp
    scummvm/trunk/engines/agos/script_e2.cpp
    scummvm/trunk/engines/agos/script_ff.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-12-31 15:25:59 UTC (rev 24959)
+++ scummvm/trunk/engines/agos/agos.h	2007-01-01 04:35:27 UTC (rev 24960)
@@ -1392,10 +1392,10 @@
 
 	Item *getNextItemPtrStrange();
 
-	bool loadGame_e1(const char *filename);
+	bool loadGame_e1(const char *filename, bool restartMode = false);
 	bool saveGame_e1(const char *filename);
 
-	bool loadGame(const char *filename);
+	bool loadGame(const char *filename, bool restartMode = false);
 	bool saveGame(uint slot, const char *caption);
 
 	void openTextWindow();

Modified: scummvm/trunk/engines/agos/agosgame.cpp
===================================================================
--- scummvm/trunk/engines/agos/agosgame.cpp	2006-12-31 15:25:59 UTC (rev 24959)
+++ scummvm/trunk/engines/agos/agosgame.cpp	2007-01-01 04:35:27 UTC (rev 24960)
@@ -9,6 +9,7 @@
 			{
 	{ "gameamiga",		GAME_BASEFILE,	"7bdaff4a118d8035047cf9b1393b3fa0"},
 	{ "icon.dat",		GAME_ICONFILE,	"2db931e84f1ca01f0816dddfae3f49e1"},
+	{ "start",		GAME_RESTFILE,	"69fb4f12108b39ae659f108cad4d3efe"},
 	{ NULL, 0, NULL}
 			},
 			Common::EN_ANY,
@@ -50,6 +51,7 @@
 			{
 	{ "gamest",		GAME_BASEFILE,	"8942859018fcfb2dbed13e83d974d1ab"},
 	{ "icon.dat",		GAME_ICONFILE,	"2db931e84f1ca01f0816dddfae3f49e1"},
+	{ "start",		GAME_RESTFILE,	"69fb4f12108b39ae659f108cad4d3efe"},
 	{ "tbllist",		GAME_TBLFILE,	"5b6ff494bf7e24213758598ef4ac0a8b"},
 	{ NULL, 0, NULL}
 			},
@@ -71,6 +73,7 @@
 			{
 	{ "gamepc",		GAME_BASEFILE,	"a49e132a1f18306dd5d1ec2fe435e178"},
 	{ "icon.dat",		GAME_ICONFILE,	"fda48c9da7f3e72d0313e2f5f760fc45"},
+	{ "start",		GAME_RESTFILE,	"69fb4f12108b39ae659f108cad4d3efe"},
 	{ "tbllist",		GAME_TBLFILE,	"319f6b227c7822a551f57d24e70f8149"},
 	{ NULL, 0, NULL}
 			},
@@ -92,6 +95,7 @@
 			{
 	{ "gamepc",		GAME_BASEFILE,	"d0b593143e21fc150c044819df2c0b98"},
 	{ "icon.dat",		GAME_ICONFILE,	"fda48c9da7f3e72d0313e2f5f760fc45"},
+	{ "start",		GAME_RESTFILE,	"69fb4f12108b39ae659f108cad4d3efe"},
 	{ "tbllist",		GAME_TBLFILE,	"319f6b227c7822a551f57d24e70f8149"},
 	{ NULL, 0, NULL}
 			},
@@ -113,6 +117,7 @@
 			{
 	{ "gamepc",		GAME_BASEFILE,	"9076d507d60cc454df662316438ec843"},
 	{ "icon.dat",		GAME_ICONFILE,	"fda48c9da7f3e72d0313e2f5f760fc45"},
+	{ "start",		GAME_RESTFILE,	"69fb4f12108b39ae659f108cad4d3efe"},
 	{ "tbllist",		GAME_TBLFILE,	"319f6b227c7822a551f57d24e70f8149"},
 	{ NULL, 0, NULL}
 			},
@@ -135,6 +140,7 @@
 	{ "gameamiga",		GAME_BASEFILE,	"4aa163967f5d2bd319f8350d6af03186"},
 	{ "icon.dat",		GAME_ICONFILE,	"a88b1c02e13ab04dd790ec30502c323d"},
 	{ "menus.dat",		GAME_MENUFILE,	"a2fdc88a77c8bdffec6b36cbeda4d955"},
+	{ "start",		GAME_RESTFILE,	"4d380a35ba941d03ee5084c71d20055b"},
 	{ "stripped.txt",	GAME_STRFILE,	"41c975a9c1106cb5298a0bc3df0a266e"},
 	{ "tbllist",		GAME_TBLFILE,	"177f5f2640e80ef92d1421d32de06a5e"},
 	{ NULL, 0, NULL}
@@ -158,6 +164,7 @@
 	{ "gamest",		GAME_BASEFILE,	"1b1acd637d32bee79859b7cc9de070e7"},
 	{ "icon.dat",		GAME_ICONFILE,	"9a4eaf4df0cdf5cc85a5134150f96589"},
 	{ "menus.dat",		GAME_MENUFILE,	"a2fdc88a77c8bdffec6b36cbeda4d955"},
+	{ "start",		GAME_RESTFILE,	"4d380a35ba941d03ee5084c71d20055b"},
 	{ "stripped.txt",	GAME_STRFILE,	"41c975a9c1106cb5298a0bc3df0a266e"},
 	{ "tbllist",		GAME_TBLFILE,	"177f5f2640e80ef92d1421d32de06a5e"},
 	{ NULL, 0, NULL}
@@ -181,6 +188,7 @@
 	{ "gamepc",		GAME_BASEFILE,	"3313254722031b22d833a2cf45a91fd7"},
 	{ "icon.dat",		GAME_ICONFILE,	"83a7278bff55c82fbb3aef92981866c9"},
 	{ "menus.dat",		GAME_MENUFILE,	"a2fdc88a77c8bdffec6b36cbeda4d955"},
+	{ "start",		GAME_RESTFILE,	"4d380a35ba941d03ee5084c71d20055b"},
 	{ "stripped.txt",	GAME_STRFILE,	"c2533277b7ff11f5495967d55355ea17"},
 	{ "tbllist",		GAME_TBLFILE,	"8252660df0edbdbc3e6377e155bbd0c5"},
 	{ NULL, 0, NULL}
@@ -204,6 +212,7 @@
 	{ "gamepc",		GAME_BASEFILE,	"1282fd5c520861ae2b73bf653afef547"},
 	{ "icon.dat",		GAME_ICONFILE,	"83a7278bff55c82fbb3aef92981866c9"},
 	{ "menus.dat",		GAME_MENUFILE,	"a2fdc88a77c8bdffec6b36cbeda4d955"},
+	{ "start",		GAME_RESTFILE,	"4d380a35ba941d03ee5084c71d20055b"},
 	{ "stripped.txt",	GAME_STRFILE,	"c2533277b7ff11f5495967d55355ea17"},
 	{ "tbllist",		GAME_TBLFILE,	"8252660df0edbdbc3e6377e155bbd0c5"},
 	{ NULL, 0, NULL}
@@ -227,6 +236,7 @@
 	{ "gamepc",		GAME_BASEFILE,	"d1979d2fbc5fb5276563578ca55cbcec"},
 	{ "icon.dat",		GAME_ICONFILE,	"83a7278bff55c82fbb3aef92981866c9"},
 	{ "menus.dat",		GAME_MENUFILE,	"a2fdc88a77c8bdffec6b36cbeda4d955"},
+	{ "start",		GAME_RESTFILE,	"4d380a35ba941d03ee5084c71d20055b"},
 	{ "stripped.txt",	GAME_STRFILE,	"c3a8f644551a27c8a2fec0f8070b46b7"},
 	{ "tbllist",		GAME_TBLFILE,	"8252660df0edbdbc3e6377e155bbd0c5"},
 	{ NULL, 0, NULL}
@@ -250,6 +260,7 @@
 	{ "gamepc",		GAME_BASEFILE,	"4bf28ab00f5324fd938e632595742382"},
 	{ "icon.dat",		GAME_ICONFILE,	"83a7278bff55c82fbb3aef92981866c9"},
 	{ "menus.dat",		GAME_MENUFILE,	"a2fdc88a77c8bdffec6b36cbeda4d955"},
+	{ "start",		GAME_RESTFILE,	"4d380a35ba941d03ee5084c71d20055b"},
 	{ "stripped.txt",	GAME_STRFILE,	"c3a8f644551a27c8a2fec0f8070b46b7"},
 	{ "tbllist",		GAME_TBLFILE,	"8252660df0edbdbc3e6377e155bbd0c5"},
 	{ NULL, 0, NULL}
@@ -273,6 +284,7 @@
 	{ "gameamiga",		GAME_BASEFILE,	"eca24fe7c3e005caca47cecac56f7245"},
 	{ "icon.pkd",		GAME_ICONFILE,	"4822a91c18b1b2005ac17fc617f7dcbe"},
 	{ "menus.dat",		GAME_MENUFILE,	"3409eeb8ca8b46fc04da99de67573f5e"},
+	{ "start",		GAME_RESTFILE,	"036b647973d6884cdfc2042a3d12df83"},
 	{ "stripped.txt",	GAME_STRFILE,	"6faaebff2786216900061eeb978f10af"},
 	{ "tbllist",		GAME_TBLFILE,	"95c44bfc380770a6b6dd0dfcc69e80a0"},
 	{ "xtbllist",		GAME_XTBLFILE,	"6c7b3db345d46349a5226f695c03e20f"},
@@ -298,6 +310,7 @@
 	{ "icon.dat",		GAME_ICONFILE,	"ef1b8ad3494cf103dc10a99fe152ef9a"},
 	{ "menus.dat",		GAME_MENUFILE,	"3409eeb8ca8b46fc04da99de67573f5e"},
 	{ "roomslst",		GAME_RMSLFILE,	"e3758c46ab8f3c23a1ac012bd607108d"},
+	{ "start",		GAME_RESTFILE,	"036b647973d6884cdfc2042a3d12df83"},
 	{ "stripped.txt",	GAME_STRFILE,	"f259e3e07a1cde8d0404a767d815e12c"},
 	{ "tbllist",		GAME_TBLFILE,	"95c44bfc380770a6b6dd0dfcc69e80a0"},
 	{ "xtbllist",		GAME_XTBLFILE,	"6c7b3db345d46349a5226f695c03e20f"},
@@ -1457,6 +1470,7 @@
 			{
 	{ "game22",		GAME_BASEFILE,	"629762ea9ca9ee9ff85f4774d219f5c7"},
 	{ "gfxindex.dat",	GAME_GFXIDXFILE,"f550f7915c5ce3a68c9f870f507449c2"},
+	{ "setup",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1478,6 +1492,7 @@
 			{
 	{ "game22",		GAME_BASEFILE,	"bcd76ac080003eee3649df18db25b60e"},
 	{ "gfxindex.dat",	GAME_GFXIDXFILE,"f550f7915c5ce3a68c9f870f507449c2"},
+	{ "setup",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1499,6 +1514,7 @@
 			{
 	{ "game22",		GAME_BASEFILE,	"629762ea9ca9ee9ff85f4774d219f5c7"},
 	{ "graphics.vga",	GAME_GFXIDXFILE,"11a4853cb35956846976e9473ee0e41e"},
+	{ "setup",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1520,6 +1536,7 @@
 			{
 	{ "game22",		GAME_BASEFILE,	"ba90b40a47726039671d9e91630dd7ed"},
 	{ "graphics.vga",	GAME_GFXIDXFILE,"11a4853cb35956846976e9473ee0e41e"},
+	{ "setup",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1541,6 +1558,7 @@
 			{
 	{ "game22",		GAME_BASEFILE,	"bcd76ac080003eee3649df18db25b60e"},
 	{ "graphics.vga",	GAME_GFXIDXFILE,"11a4853cb35956846976e9473ee0e41e"},
+	{ "setup",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1562,6 +1580,7 @@
 			{
 	{ "game22",		GAME_BASEFILE,	"71d7d2d5e479b053c5a9757f1702c9c3"},
 	{ "graphics.vga",	GAME_GFXIDXFILE,"11a4853cb35956846976e9473ee0e41e"},
+	{ "setup",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1582,6 +1601,7 @@
 
 			{
 	{ "game22",		GAME_BASEFILE,	"629762ea9ca9ee9ff85f4774d219f5c7"},
+	{ "save.999",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1602,6 +1622,7 @@
 
 			{
 	{ "game22",		GAME_BASEFILE,	"a8746407a5b20a7da0da0a14c380af1c"},
+	{ "save.999",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1622,6 +1643,7 @@
 
 			{
 	{ "game22",		GAME_BASEFILE,	"ba90b40a47726039671d9e91630dd7ed"},
+	{ "save.999",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1642,6 +1664,7 @@
 
 			{
 	{ "game22",		GAME_BASEFILE,	"bcd76ac080003eee3649df18db25b60e"},
+	{ "save.999",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1662,6 +1685,7 @@
 
 			{
 	{ "game22",		GAME_BASEFILE,	"80576f2e1ed4c912b63921fe77af313e"},
+	{ "save.999",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},
@@ -1682,6 +1706,7 @@
 
 			{
 	{ "game22",		GAME_BASEFILE,	"71d7d2d5e479b053c5a9757f1702c9c3"},
+	{ "save.999",		GAME_RESTFILE,	"71512fc98501a8071a26b683a31dde78"},
 	{ "tbllist",		GAME_TBLFILE,	"0bbfee8e69739111eb36b0d138da8ddf"},
 	{ NULL, 0, NULL}
 			},

Modified: scummvm/trunk/engines/agos/intern.h
===================================================================
--- scummvm/trunk/engines/agos/intern.h	2006-12-31 15:25:59 UTC (rev 24959)
+++ scummvm/trunk/engines/agos/intern.h	2007-01-01 04:35:27 UTC (rev 24960)
@@ -222,8 +222,9 @@
 	GAME_RMSLFILE = 1 << 5,
 	GAME_TBLFILE  = 1 << 6,
 	GAME_XTBLFILE = 1 << 7,
+	GAME_RESTFILE = 1 << 8,
 
-	GAME_GFXIDXFILE = 1 << 8
+	GAME_GFXIDXFILE = 1 << 9
 };
 
 enum GameIds {

Modified: scummvm/trunk/engines/agos/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agos/saveload.cpp	2006-12-31 15:25:59 UTC (rev 24959)
+++ scummvm/trunk/engines/agos/saveload.cpp	2007-01-01 04:35:27 UTC (rev 24960)
@@ -115,15 +115,7 @@
 	} else if (getGameType() == GType_PP) {
 		sprintf(buf, "swampy.sav");
 	} else if (getGameType() == GType_FF) {
-		if (slot == 999) {
-			// Restart state
-			if (getPlatform() == Common::kPlatformWindows)
-				sprintf(buf, "save.%.3d", slot);
-			else
-				sprintf(buf, "setup");
-		} else {
-			sprintf(buf, "feeble.%.3d", slot);
-		}
+		sprintf(buf, "feeble.%.3d", slot);
 	} else if (getGameType() == GType_SIMON2) {
 		sprintf(buf, "simon2.%.3d", slot);
 	} else {
@@ -564,20 +556,19 @@
 		f->writeUint32BE(val - 1);
 }
 
-bool AGOSEngine::loadGame_e1(const char *filename) {
+bool AGOSEngine::loadGame_e1(const char *filename, bool restartMode) {
 	Common::SeekableReadStream *f = NULL;
 	uint num, item_index, i;
 
 	_lockWord |= 0x100;
 
-	// Load restart state
-	Common::File *file = new Common::File();
-	file->open(filename, Common::File::kFileReadMode);
-	if (!file->isOpen()) {
-		delete file;
-		f = _saveFileMan->openForLoading(filename);
-	} else {
+	if (restartMode) {
+		// Load restart state
+		Common::File *file = new Common::File();
+		file->open(filename, Common::File::kFileReadMode);
 		f = file;
+	} else {
+		f = _saveFileMan->openForLoading(filename);
 	}
 
 	if (f == NULL) {
@@ -735,21 +726,20 @@
 	return result;
 }
 
-bool AGOSEngine::loadGame(const char *filename) {
+bool AGOSEngine::loadGame(const char *filename, bool restartMode) {
 	char ident[100];
 	Common::SeekableReadStream *f = NULL;
 	uint num, item_index, i, j;
 
 	_lockWord |= 0x100;
 
-	// Load restart state
-	Common::File *file = new Common::File();
-	file->open(filename, Common::File::kFileReadMode);
-	if (!file->isOpen()) {
-		delete file;
-		f = _saveFileMan->openForLoading(filename);
-	} else {
+	if (restartMode) {
+		// Load restart state
+		Common::File *file = new Common::File();
+		file->open(filename, Common::File::kFileReadMode);
 		f = file;
+	} else {
+		f = _saveFileMan->openForLoading(filename);
 	}
 
 	if (f == NULL) {

Modified: scummvm/trunk/engines/agos/script_e1.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_e1.cpp	2006-12-31 15:25:59 UTC (rev 24959)
+++ scummvm/trunk/engines/agos/script_e1.cpp	2007-01-01 04:35:27 UTC (rev 24960)
@@ -477,9 +477,13 @@
 void AGOSEngine::oe1_loadGame() {
 	// 202: load game
 	uint16 stringId = getNextStringID();
+	debug(0, "oe1_loadGame: stub (%s)", (const char *)getStringPtrByID(stringId));
 
-	debug(0, "oe1_loadGame: stub (%s)", (const char *)getStringPtrByID(stringId));
-	loadGame_e1((const char *)getStringPtrByID(stringId));
+	if (!scumm_stricmp(getFileName(GAME_RESTFILE), (const char *)getStringPtrByID(stringId))) {
+		loadGame_e1(getFileName(GAME_RESTFILE), true);
+	} else {
+		loadGame_e1((const char *)getStringPtrByID(stringId));
+	}
 }
 
 void AGOSEngine::oe1_clearUserItem() {

Modified: scummvm/trunk/engines/agos/script_e2.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_e2.cpp	2006-12-31 15:25:59 UTC (rev 24959)
+++ scummvm/trunk/engines/agos/script_e2.cpp	2007-01-01 04:35:27 UTC (rev 24960)
@@ -131,9 +131,13 @@
 void AGOSEngine::oe2_loadGame() {
 	// 89: load game
 	uint16 stringId = getNextStringID();
+	debug(0, "oe1_loadGame: stub (%s)", (const char *)getStringPtrByID(stringId));
 
-	debug(0, "oe1_loadGame: stub (%s)", (const char *)getStringPtrByID(stringId));
-	loadGame((const char *)getStringPtrByID(stringId));
+	if (!scumm_stricmp(getFileName(GAME_RESTFILE), (const char *)getStringPtrByID(stringId))) {
+		loadGame(getFileName(GAME_RESTFILE), true);
+	} else {
+		loadGame((const char *)getStringPtrByID(stringId));
+	}
 }
 
 void AGOSEngine::oe2_drawItem() {

Modified: scummvm/trunk/engines/agos/script_ff.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_ff.cpp	2006-12-31 15:25:59 UTC (rev 24959)
+++ scummvm/trunk/engines/agos/script_ff.cpp	2007-01-01 04:35:27 UTC (rev 24960)
@@ -216,7 +216,11 @@
 
 void AGOSEngine::off_loadUserGame() {
 	// 133: load game
-	loadGame(genSaveName(readVariable(55)));
+	if (readVariable(55) == 999) {
+		loadGame(getFileName(GAME_RESTFILE), true);
+	} else {
+		loadGame(genSaveName(readVariable(55)));
+	}
 }
 
 void AGOSEngine::off_listSaveGames() {


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