[Scummvm-cvs-logs] SF.net SVN: scummvm: [22078] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Fri Apr 21 19:15:08 CEST 2006


Revision: 22078
Author:   kirben
Date:     2006-04-21 19:14:42 -0700 (Fri, 21 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22078&view=rev

Log Message:
-----------
Cleanup use of different filenames in different versions

Modified Paths:
--------------
    scummvm/trunk/engines/simon/icons.cpp
    scummvm/trunk/engines/simon/intern.h
    scummvm/trunk/engines/simon/res.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
Modified: scummvm/trunk/engines/simon/icons.cpp
===================================================================
--- scummvm/trunk/engines/simon/icons.cpp	2006-04-21 22:10:50 UTC (rev 22077)
+++ scummvm/trunk/engines/simon/icons.cpp	2006-04-22 02:14:42 UTC (rev 22078)
@@ -31,16 +31,11 @@
 
 void SimonEngine::loadIconFile() {
 	Common::File in;
-	if (getPlatform() == Common::kPlatformAcorn)
-		in.open("ICONDATA");
-	else if (getPlatform() == Common::kPlatformAmiga)
-		in.open("icon.pkd");
-	else
-		in.open("ICON.DAT");
 	uint size;
 
+	in.open(getFileName(GAME_ICONFILE));
 	if (in.isOpen() == false)
-		error("Can't open icons file 'ICON.DAT'");
+		error("Can't open icons file '%s'", getFileName(GAME_ICONFILE));
 
 	size = in.size();
 

Modified: scummvm/trunk/engines/simon/intern.h
===================================================================
--- scummvm/trunk/engines/simon/intern.h	2006-04-21 22:10:50 UTC (rev 22077)
+++ scummvm/trunk/engines/simon/intern.h	2006-04-22 02:14:42 UTC (rev 22078)
@@ -145,15 +145,11 @@
 
 struct GameSpecificSettings {
 #ifndef PALMOS_68K
-	const char *gme_filename;
 	const char *effects_filename;
 	const char *speech_filename;
- 	const char *gamepc_filename;
  #else
-	const char gme_filename[12];
 	const char effects_filename[12];
 	const char speech_filename[12];
-  	const char gamepc_filename[12];
  #endif
 };
 

Modified: scummvm/trunk/engines/simon/res.cpp
===================================================================
--- scummvm/trunk/engines/simon/res.cpp	2006-04-21 22:10:50 UTC (rev 22077)
+++ scummvm/trunk/engines/simon/res.cpp	2006-04-22 02:14:42 UTC (rev 22078)
@@ -193,15 +193,15 @@
 	in.close();
 }
 
-void SimonEngine::loadGamePcFile(const char *filename) {
+void SimonEngine::loadGamePcFile() {
 	Common::File in;
 	int num_inited_objects;
 	int i, file_size;
 
 	/* read main gamepc file */
-	in.open(filename);
+	in.open(getFileName(GAME_BASEFILE));
 	if (in.isOpen() == false) {
-		error("Can't open gamepc file '%s'", gss->gamepc_filename);
+		error("Can't open gamepc file '%s'", getFileName(GAME_BASEFILE));
 	}
 
 	num_inited_objects = allocGamePcVars(&in);
@@ -218,9 +218,9 @@
 	in.close();
 
 	/* Read list of TABLE resources */
-	in.open("TBLLIST");
+	in.open(getFileName(GAME_TBLFILE));
 	if (in.isOpen() == false) {
-		error("Can't open table resources file 'TBLLIST'");
+		error("Can't open table resources file '%s'", getFileName(GAME_TBLFILE));
 	}
 
 	file_size = in.size();
@@ -240,12 +240,9 @@
 		return;
 
 	/* Read list of TEXT resources */
-	if (getPlatform() == Common::kPlatformAcorn)
-		in.open("STRIPPED");
-	else
-		in.open("STRIPPED.TXT");
+	in.open(getFileName(GAME_STRFILE));
 	if (in.isOpen() == false)
-		error("Can't open text resources file 'STRIPPED.TXT'");
+		error("Can't open text resources file '%s'", getFileName(GAME_STRFILE));
 
 	file_size = in.size();
 	_strippedTxtMem = (byte *)malloc(file_size);
@@ -442,10 +439,10 @@
 void SimonEngine::openGameFile() {
 	if (!(getFeatures() & GF_OLD_BUNDLE)) {
 		_gameFile = new File();
-		_gameFile->open(gss->gme_filename);
+		_gameFile->open(getFileName(GAME_GMEFILE));
 
 		if (_gameFile->isOpen() == false)
-			error("Can't open game file '%s'", gss->gme_filename);
+			error("Can't open game file '%s'", getFileName(GAME_GMEFILE));
 
 		uint32 size = _gameFile->readUint32LE();
 

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-21 22:10:50 UTC (rev 22077)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-22 02:14:42 UTC (rev 22078)
@@ -54,61 +54,23 @@
 #ifdef PALMOS_68K
 #define PTR(a) a
 static const GameSpecificSettings *simon1_settings;
-static const GameSpecificSettings *simon1acorn_settings;
-static const GameSpecificSettings *simon1amiga_settings;
-static const GameSpecificSettings *simon1demo_settings;
-static const GameSpecificSettings *simon2win_settings;
-static const GameSpecificSettings *simon2dos_settings;
+static const GameSpecificSettings *simon2_settings;
 static const GameSpecificSettings *feeblefiles_settings;
 #else
 #define PTR(a) &a
 static const GameSpecificSettings simon1_settings = {
-	"SIMON.GME",                            // gme_filename
 	"EFFECTS",                              // effects_filename
 	"SIMON",                                // speech_filename
-	"GAMEPC",                               // gamepc_filename
 };
 
-static const GameSpecificSettings simon1acorn_settings = {
-	"DATA",                                 // gme_filename
-	"EFFECTS",                              // effects_filename
-	"SIMON",                                // speech_filename
-	"GAMEBASE",                             // gamepc_filename
-};
-
-static const GameSpecificSettings simon1amiga_settings = {
-	"",                                     // gme_filename
+static const GameSpecificSettings simon2_settings = {
 	"",                                     // effects_filename
-	"",                                     // speech_filename
-	"gameamiga",                            // gamepc_filename
-};
-
-static const GameSpecificSettings simon1demo_settings = {
-	"",                                     // gme_filename
-	"",                                     // effects_filename
-	"",                                     // speech_filename
-	"GDEMO",                                // gamepc_filename
-};
-
-static const GameSpecificSettings simon2win_settings = {
-	"SIMON2.GME",                           // gme_filename
-	"",                                     // effects_filename
 	"SIMON2",                               // speech_filename
-	"GSPTR30",                              // gamepc_filename
 };
 
-static const GameSpecificSettings simon2dos_settings = {
-	"SIMON2.GME",                           // gme_filename
-	"",                                     // effects_filename
-	"",                                     // speech_filename
-	"GAME32",                               // gamepc_filename
-};
-
 static const GameSpecificSettings feeblefiles_settings = {
-	"",		                        // gme_filename
 	"",                                     // effects_filename
 	"VOICES",                               // speech_filename
-	"GAME22",                               // gamepc_filename
 };
 #endif
 
@@ -570,24 +532,13 @@
 		gss = PTR(feeblefiles_settings);
 	} else if (getGameType() == GType_SIMON2) {
 		if (getFeatures() & GF_TALKIE) {
-			gss = PTR(simon2win_settings);
-
 			// Add default file directories
 			File::addDefaultDirectory(_gameDataPath + "voices/");
 			File::addDefaultDirectory(_gameDataPath + "VOICES/");
-		} else {
-			gss = PTR(simon2dos_settings);
 		}
+		gss = PTR(simon2_settings);
 	} else if (getGameType() == GType_SIMON1) {
-		if (getPlatform() == Common::kPlatformAcorn) {
-			gss = PTR(simon1acorn_settings);
-		} else if (getPlatform() == Common::kPlatformAmiga) {
-			gss = PTR(simon1amiga_settings);
-		} else if (getGameId() == GID_SIMON1DEMO) {
-			gss = PTR(simon1demo_settings);
-		} else {
-			gss = PTR(simon1_settings);
-		}
+		gss = PTR(simon1_settings);
 	}
 
 	if ((getGameType() == GType_SIMON1) && (getFeatures() & GF_TALKIE)) {
@@ -3568,7 +3519,7 @@
 			_sound->effectsPause(_effectsPaused ^= 1);
 	}
 
-	loadGamePcFile(gss->gamepc_filename);
+	loadGamePcFile();
 
 	addTimeEvent(0, 1);
 	openGameFile();

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-21 22:10:50 UTC (rev 22077)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-22 02:14:42 UTC (rev 22078)
@@ -164,6 +164,12 @@
 	uint32 getFeatures() const { return _gameDescription->features; }
 	Common::Language getLanguage() const { return _gameDescription->language; }
 	Common::Platform getPlatform() const { return _gameDescription->platform; }
+	const char *getFileName(int type) const { 
+		for (int i = 0; i < _gameDescription->filesCount; i++) {
+			if (_gameDescription->filesDescriptions[i].fileType == type)
+				return _gameDescription->filesDescriptions[i].fileName; 
+		}
+	}
 
 protected:
 	void playSting(uint a);
@@ -486,7 +492,7 @@
 	void readGamePcText(Common::File *in);
 	void readItemChildren(Common::File *in, Item *item, uint tmp);
 	void readItemFromGamePc(Common::File *in, Item *item);
-	void loadGamePcFile(const char *filename);
+	void loadGamePcFile();
 	void decompressData(const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize);
 	void loadOffsets(const char *filename, int number, uint32 &file, uint32 &offset, uint32 &compressedSize, uint32 &size);
 	void loadSound(uint sound, uint pan, uint vol, uint type);


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