[Scummvm-cvs-logs] SF.net SVN: scummvm:[35409] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Wed Dec 17 14:07:56 CET 2008


Revision: 35409
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35409&view=rev
Author:   drmccoy
Date:     2008-12-17 13:07:56 +0000 (Wed, 17 Dec 2008)

Log Message:
-----------
Only do the no-cd-workaround if all resource files can be found

Modified Paths:
--------------
    scummvm/trunk/engines/gob/game.cpp
    scummvm/trunk/engines/gob/game.h
    scummvm/trunk/engines/gob/game_v6.cpp
    scummvm/trunk/engines/gob/inter_v6.cpp
    scummvm/trunk/engines/gob/saveload.h
    scummvm/trunk/engines/gob/saveload_v6.cpp

Modified: scummvm/trunk/engines/gob/game.cpp
===================================================================
--- scummvm/trunk/engines/gob/game.cpp	2008-12-17 11:15:47 UTC (rev 35408)
+++ scummvm/trunk/engines/gob/game.cpp	2008-12-17 13:07:56 UTC (rev 35409)
@@ -81,6 +81,8 @@
 	_preventScroll = false;
 	_scrollHandleMouse = false;
 
+	_noCd = false;
+
 	_tempStr[0] = 0;
 	_curImaFile[0] = 0;
 	_collStr[0] = 0;

Modified: scummvm/trunk/engines/gob/game.h
===================================================================
--- scummvm/trunk/engines/gob/game.h	2008-12-17 11:15:47 UTC (rev 35408)
+++ scummvm/trunk/engines/gob/game.h	2008-12-17 13:07:56 UTC (rev 35409)
@@ -95,6 +95,8 @@
 	bool _preventScroll;
 	bool _scrollHandleMouse;
 
+	bool _noCd;
+
 	Game(GobEngine *vm);
 	virtual ~Game();
 
@@ -307,6 +309,8 @@
 			uint16 right, uint16 bottom, int16 flags, int16 key,
 			uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0);
 
+	virtual void prepareStart(void);
+
 	virtual void pushCollisions(char all);
 
 	virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,

Modified: scummvm/trunk/engines/gob/game_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v6.cpp	2008-12-17 11:15:47 UTC (rev 35408)
+++ scummvm/trunk/engines/gob/game_v6.cpp	2008-12-17 13:07:56 UTC (rev 35409)
@@ -25,6 +25,7 @@
 
 #include "common/endian.h"
 #include "common/stream.h"
+#include "common/file.h"
 
 #include "gob/gob.h"
 #include "gob/game.h"
@@ -154,6 +155,17 @@
 	return 0;
 }
 
+void Game_v6::prepareStart(void) {
+	_noCd = false;
+
+	if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") &&
+	    Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) {
+		_noCd = true;
+	}	
+
+	Game_v2::prepareStart();
+}
+
 void Game_v6::pushCollisions(char all) {
 	Collision *srcPtr;
 	Collision *destPtr;

Modified: scummvm/trunk/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v6.cpp	2008-12-17 11:15:47 UTC (rev 35408)
+++ scummvm/trunk/engines/gob/inter_v6.cpp	2008-12-17 13:07:56 UTC (rev 35409)
@@ -769,7 +769,7 @@
 	// (it checks CD1.ITK - CD4.ITK and the first that's found determines
 	// the CD number), while its NO_CD modus wants everything in CD1.ITK.
 	// So we just open the other ITKs, too.
-	if (!scumm_stricmp(fileName, "cd1.itk")) {
+	if (_vm->_game->_noCd && !scumm_stricmp(fileName, "CD1.ITK")) {
 		_vm->_dataIO->openDataFile("CD2.ITK", true);
 		_vm->_dataIO->openDataFile("CD3.ITK", true);
 		_vm->_dataIO->openDataFile("CD4.ITK", true);

Modified: scummvm/trunk/engines/gob/saveload.h
===================================================================
--- scummvm/trunk/engines/gob/saveload.h	2008-12-17 11:15:47 UTC (rev 35408)
+++ scummvm/trunk/engines/gob/saveload.h	2008-12-17 13:07:56 UTC (rev 35409)
@@ -413,7 +413,8 @@
 class SaveLoad_v6 : public SaveLoad {
 public:
 	enum SaveType {
-		kSaveNone
+		kSaveNone,
+		kSaveNoCD
 	};
 
 	SaveLoad_v6(GobEngine *vm, const char *targetName);

Modified: scummvm/trunk/engines/gob/saveload_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/saveload_v6.cpp	2008-12-17 11:15:47 UTC (rev 35408)
+++ scummvm/trunk/engines/gob/saveload_v6.cpp	2008-12-17 13:07:56 UTC (rev 35409)
@@ -27,12 +27,13 @@
 
 #include "gob/gob.h"
 #include "gob/saveload.h"
+#include "gob/game.h"
 
 namespace Gob {
 
 SaveLoad_v6::SaveFile SaveLoad_v6::_saveFiles[] = {
 	{"mdo.def", 0, kSaveModeExists, kSaveNone},
-	{"NO_CD.TXT", 0, kSaveModeExists, kSaveNone}
+	{"NO_CD.TXT", 0, kSaveModeExists, kSaveNoCD}
 };
 
 SaveLoad_v6::SaveLoad_v6(GobEngine *vm, const char *targetName) :
@@ -45,11 +46,21 @@
 SaveLoad::SaveMode SaveLoad_v6::getSaveMode(const char *fileName) {
 	fileName = stripPath(fileName);
 
-	for (int i = 0; i < ARRAYSIZE(_saveFiles); i++)
+	int i;
+	for (i = 0; i < ARRAYSIZE(_saveFiles); i++)
 		if (!scumm_stricmp(fileName, _saveFiles[i].sourceName))
-			return _saveFiles[i].mode;
+			break;
 
-	return kSaveModeNone;
+	if (i >= ARRAYSIZE(_saveFiles))
+		return kSaveModeNone;
+
+	if (_saveFiles[i].type != kSaveNoCD)
+		return _saveFiles[i].mode;
+
+	if (_vm->_game->_noCd)
+		return kSaveModeExists;
+	else
+		return kSaveModeNone;
 }
 
 } // End of namespace Gob


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