[Scummvm-cvs-logs] SF.net SVN: scummvm: [20794] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Feb 20 08:36:01 CET 2006


Revision: 20794
Author:   fingolfin
Date:     2006-02-20 08:35:37 -0800 (Mon, 20 Feb 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=20794&view=rev

Log Message:
-----------
Added / corrected some comments, and moved ScummGameSettings to scumm.h

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-02-20 16:03:48 UTC (rev 20793)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-02-20 16:35:37 UTC (rev 20794)
@@ -181,21 +181,11 @@
 	error("Unknown gameid encountered in findDescriptionFromGameID");
 }
 
-struct ScummGameSettings {
-	const char *gameid;
-	const char *extra;
-	byte id, version, heversion;
-	int midi; // MidiDriverFlags values
-	uint32 features;
-	Common::Platform platform;
+GameSettings toGameSettings(const ScummGameSettings &g) {
+	GameSettings dummy = { g.gameid, findDescriptionFromGameID(g.gameid) };
+	return dummy;
+}
 
-	GameSettings toGameSettings() const {
-		GameSettings dummy = { gameid, findDescriptionFromGameID(gameid) };
-		return dummy;
-	}
-};
-
-
 enum {
 	// We only compute the MD5 of the first megabyte of our data files.
 	kMD5FileSizeLimit = 1024 * 1024
@@ -3351,23 +3341,23 @@
 							if (substLastIndex > 0 && // HE Mac versions.
 								(substResFileNameTable[substLastIndex].genMethod == kGenMac ||
 								 substResFileNameTable[substLastIndex].genMethod == kGenMacNoParens)) {
-								detectedGames.push_back(DetectedGame(g->toGameSettings(),
+								detectedGames.push_back(DetectedGame(toGameSettings(*g),
 																	 Common::UNK_LANG,
 																	 Common::kPlatformMacintosh));
 								fileSet[file->path()] = true;
 							} else if (substLastIndex == 0 && g->id == GID_MANIAC &&
 									   (buf[0] == 0xbc || buf[0] == 0xa0)) {
-								detectedGames.push_back(DetectedGame(g->toGameSettings(),
+								detectedGames.push_back(DetectedGame(toGameSettings(*g),
 																	 Common::UNK_LANG,
 																	 Common::kPlatformNES));
 							} else if ((g->id == GID_MANIAC || g->id == GID_ZAK) &&
 									   ((buf[0] == 0x31 && buf[1] == 0x0a) ||
 										(buf[0] == 0xcd && buf[1] == 0xfe))) {
-								detectedGames.push_back(DetectedGame(g->toGameSettings(),
+								detectedGames.push_back(DetectedGame(toGameSettings(*g),
 																	 Common::UNK_LANG,
 																	 Common::kPlatformC64));
 							} else {
-								detectedGames.push_back(g->toGameSettings());
+								detectedGames.push_back(toGameSettings(*g));
 								fileSet[file->path()] = false;
 							}
 							break;
@@ -3409,9 +3399,9 @@
 				assert(g->gameid);
 				// Insert the 'enhanced' game data into the candidate list
 				if (iter->_value == true) // This was HE Mac game
-					detectedGames.push_back(DetectedGame(g->toGameSettings(), elem->language, Common::kPlatformMacintosh));
+					detectedGames.push_back(DetectedGame(toGameSettings(*g), elem->language, Common::kPlatformMacintosh));
 				else
-					detectedGames.push_back(DetectedGame(g->toGameSettings(), elem->language, elem->platform));
+					detectedGames.push_back(DetectedGame(toGameSettings(*g), elem->language, elem->platform));
 				exactMatch = true;
 			}
 		}
@@ -3587,9 +3577,10 @@
 	g = multiple_versions_md5_settings;
 	while (g->gameid) {
 		if (!scumm_stricmp(md5, g->gameid)) {
-			// Match found
+			// Match found. Copy the data and ensure that we use the correct
+			// gameid (since we abused that field to store the MD5).
 			game = *g;
-			game.gameid = gameid;	// FIXME: Fingolfin wonders what this line is good for?
+			game.gameid = gameid;
 			if (game.extra) {
 				Common::String desc(findDescriptionFromGameID(gameid));
 				desc += " (";

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2006-02-20 16:03:48 UTC (rev 20793)
+++ scummvm/trunk/engines/scumm/scumm.h	2006-02-20 16:35:37 UTC (rev 20794)
@@ -320,6 +320,24 @@
 	rtNumTypes = 22
 };
 
+/**
+ * Descriptor of a specific SCUMM game. Used internally to store
+ * information about the tons of game variants that exist.
+ */
+struct ScummGameSettings {
+	const char *gameid;
+	const char *extra;
+	byte id, version, heversion;
+	int midi; // MidiDriverFlags values
+	uint32 features;
+	Common::Platform platform;
+
+};
+
+/**
+ * The 'resource manager' class. Currently doesn't really deserve to be called
+ * a 'class', at least until somebody gets around to OOfying this more.
+ */
 class ResourceManager {
 	friend class ScummDebugger;
 	friend class ScummEngine;
@@ -371,6 +389,9 @@
 	bool validateResource(const char *str, int type, int index) const;
 };
 
+/**
+ * Base class for all SCUMM engines.
+ */
 class ScummEngine : public Engine {
 	friend class ScummDebugger;
 	friend class SmushPlayer;







More information about the Scummvm-git-logs mailing list