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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Mar 4 02:39:01 CET 2006


Revision: 21062
Author:   fingolfin
Date:     2006-03-04 02:38:05 -0800 (Sat, 04 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=21062&view=rev

Log Message:
-----------
Renamed SubstResFileNames::winName and macName to almostGameID / expandedName (the old names were misleading; the new ones aren't great either :)

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/he/resource_he.cpp
    scummvm/trunk/engines/scumm/he/sound_he.cpp
    scummvm/trunk/engines/scumm/plugin.cpp
    scummvm/trunk/engines/scumm/resource.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h
    scummvm/trunk/engines/scumm/sound.cpp
Modified: scummvm/trunk/engines/scumm/he/resource_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.cpp	2006-03-04 09:40:45 UTC (rev 21061)
+++ scummvm/trunk/engines/scumm/he/resource_he.cpp	2006-03-04 10:38:05 UTC (rev 21062)
@@ -162,7 +162,7 @@
 	if (!_fileName[0]) { // We are running for the first time
 		snprintf(_fileName, 256, "%s.he3", _vm->getBaseName());
 
-		if (_vm->_substResFileName.winName != 0) {
+		if (_vm->_substResFileName.almostGameID != 0) {
 			char buf1[128];
 
 			_vm->generateSubstResFileName(_fileName, buf1, sizeof(buf1));
@@ -1291,7 +1291,7 @@
 	int size;
 
 	if (!_fileName[0]) // We are running for the first time
-		if (_vm->_substResFileName.winName != 0) {
+		if (_vm->_substResFileName.almostGameID != 0) {
 			char buf1[128];
 
 			snprintf(buf1, 128, "%s.he3", _vm->getBaseName());

Modified: scummvm/trunk/engines/scumm/he/sound_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/sound_he.cpp	2006-03-04 09:40:45 UTC (rev 21061)
+++ scummvm/trunk/engines/scumm/he/sound_he.cpp	2006-03-04 10:38:05 UTC (rev 21062)
@@ -161,7 +161,7 @@
 
 	sprintf(buf, "%s.he4", _vm->getBaseName());
 
-	if (_vm->_substResFileName.winName != 0) {
+	if (_vm->_substResFileName.almostGameID != 0) {
 		_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
 		strcpy(buf, buf1);
 	}
@@ -360,7 +360,7 @@
 
 		sprintf(buf, "%s.he4", _vm->getBaseName());
 
-		if (_vm->_substResFileName.winName != 0) {
+		if (_vm->_substResFileName.almostGameID != 0) {
 			_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
 			strcpy(buf, buf1);
 		}

Modified: scummvm/trunk/engines/scumm/plugin.cpp
===================================================================
--- scummvm/trunk/engines/scumm/plugin.cpp	2006-03-04 09:40:45 UTC (rev 21061)
+++ scummvm/trunk/engines/scumm/plugin.cpp	2006-03-04 10:38:05 UTC (rev 21062)
@@ -1168,7 +1168,7 @@
 
 				substLastIndex = findSubstResFileName(subst, tempName, substLastIndex);
 				applySubstResFileName(subst, tempName, detectName, sizeof(detectName));
-			} while (subst.winName != 0);
+			} while (subst.almostGameID != 0);
 		}
 	}
 
@@ -1284,10 +1284,10 @@
 
 			substLastIndex = findSubstResFileName(subst, tempName, substLastIndex);
 			applySubstResFileName(subst, tempName, detectName, sizeof(detectName));
-		} while (subst.winName != 0);
+		} while (subst.almostGameID != 0);
 
 		if (found) {
-			if (subst.winName != 0)
+			if (subst.almostGameID != 0)
 				debug(5, "Generated filename substitute: %s -> %s", tempName, detectName);
 			break;
 		}
@@ -1299,7 +1299,7 @@
 	}
 
 	// Force game to have Mac platform if needed
-	if (subst.winName) {
+	if (subst.almostGameID) {
 		if (subst.genMethod == kGenMac ||
 			subst.genMethod == kGenMacNoParens)
 			game.platform = Common::kPlatformMacintosh;

Modified: scummvm/trunk/engines/scumm/resource.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource.cpp	2006-03-04 09:40:45 UTC (rev 21061)
+++ scummvm/trunk/engines/scumm/resource.cpp	2006-03-04 10:38:05 UTC (rev 21062)
@@ -152,7 +152,7 @@
 		}
 
 		// If we have substitute
-		if (_substResFileName.winName != 0 && !(_game.platform == Common::kPlatformNES || _game.platform == Common::kPlatformC64)) {
+		if (_substResFileName.almostGameID != 0 && !(_game.platform == Common::kPlatformNES || _game.platform == Common::kPlatformC64)) {
 			char tmpBuf[128];
 			generateSubstResFileName(buf, tmpBuf, sizeof(tmpBuf));
 			strcpy(buf, tmpBuf);
@@ -255,7 +255,7 @@
 		// from target name. dottdemo.000 vs tentacle.000. So we should
 		// substitute those names too
 		if (resourceFile == true) {
-			if (_substResFileNameBundle.winName == 0) {
+			if (_substResFileNameBundle.almostGameID == 0) {
 				int substLastIndex = 0;
 
 				do {
@@ -264,14 +264,14 @@
 
 					substLastIndex = findSubstResFileName(_substResFileNameBundle, filename, substLastIndex);
 					applySubstResFileName(_substResFileNameBundle, filename, name, sizeof(name));
-				} while (_substResFileNameBundle.winName != 0);
+				} while (_substResFileNameBundle.almostGameID != 0);
 
-				if (_substResFileNameBundle.winName != 0) {
-					debug(5, "Generated substitute in Mac bundle: [%s -> %s]", filename, _substResFileNameBundle.winName);
+				if (_substResFileNameBundle.almostGameID != 0) {
+					debug(5, "Generated substitute in Mac bundle: [%s -> %s]", filename, _substResFileNameBundle.almostGameID);
 				}
 			}
 
-			if (_substResFileNameBundle.winName != 0)
+			if (_substResFileNameBundle.almostGameID != 0)
 				applySubstResFileName(_substResFileNameBundle, filename, name, sizeof(name));
 		}
 

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-03-04 09:40:45 UTC (rev 21061)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-03-04 10:38:05 UTC (rev 21062)
@@ -292,30 +292,30 @@
 	{ NULL, NULL, kGenAsIs }
 };
 
-static void applySubstResFileName(const SubstResFileNames &subst, char *buf, int bufsize, const char *ext, int num) {
+static void applySubstResFileName(const SubstResFileNames &subst, char *buf, int bufsize, const char *ext, char num) {
 	switch (subst.genMethod) {
 	case kGenMac:
 	case kGenMacNoParens:
 		if (num == '3') { // special case for cursors
 			// For mac they're stored in game binary
-			strncpy(buf, subst.macName, bufsize);
+			strncpy(buf, subst.expandedName, bufsize);
 		} else {
 			if (subst.genMethod == kGenMac)
-				snprintf(buf, bufsize, "%s (%c)", subst.macName, num);
+				snprintf(buf, bufsize, "%s (%c)", subst.expandedName, num);
 			else
-				snprintf(buf, bufsize, "%s %c", subst.macName, num);
+				snprintf(buf, bufsize, "%s %c", subst.expandedName, num);
 		}
 		break;
 
 	case kGenPC:
 		if (ext)
-			snprintf(buf, bufsize, "%s%s", subst.macName, ext);
+			snprintf(buf, bufsize, "%s%s", subst.expandedName, ext);
 		else
-			strncpy(buf, subst.macName, bufsize);
+			strncpy(buf, subst.expandedName, bufsize);
 		break;
 
 	case kGenAsIs:
-		strncpy(buf, subst.macName, bufsize);
+		strncpy(buf, subst.expandedName, bufsize);
 		break;
 
 	default:
@@ -325,7 +325,7 @@
 }
 
 bool applySubstResFileName(const SubstResFileNames &subst, const char *filename, char *buf, int bufsize) {
-	if (subst.winName == 0)
+	if (subst.almostGameID == 0)
 		return false;
 
 	size_t len = strlen(filename);
@@ -341,7 +341,7 @@
 	if (ext)
 		len = ext - filename;
 
-	if (!scumm_strnicmp(filename, subst.winName, len)) {
+	if (!scumm_strnicmp(filename, subst.almostGameID, len)) {
 		applySubstResFileName(subst, buf, bufsize, ext, num);
 		return true;
 	}
@@ -367,8 +367,8 @@
 		len = ext - filename;
 
 	int i;
-	for (i = index; substResFileNameTable[i].winName; i++) {
-		if (!scumm_strnicmp(filename, substResFileNameTable[i].winName, len)) {
+	for (i = index; substResFileNameTable[i].almostGameID; i++) {
+		if (!scumm_strnicmp(filename, substResFileNameTable[i].almostGameID, len)) {
 			subst = substResFileNameTable[i];
 			return i+1;
 		}
@@ -442,12 +442,12 @@
 
 	// We read data directly from NES ROM instead of extracting it with
 	// external tool
-	if ((_game.platform == Common::kPlatformNES) && _substResFileName.winName) {
+	if ((_game.platform == Common::kPlatformNES) && _substResFileName.almostGameID) {
 		char tmpBuf[128];
 		generateSubstResFileName("00.LFL", tmpBuf, sizeof(tmpBuf));
 		_fileHandle = new ScummNESFile();
 		_containerFile = tmpBuf;
-	} else if ((_game.platform == Common::kPlatformC64) && _substResFileName.winName) {
+	} else if ((_game.platform == Common::kPlatformC64) && _substResFileName.almostGameID) {
 		const char *tmpBuf1, *tmpBuf2;
 		if (_game.id == GID_MANIAC) {
 			tmpBuf1 = "maniac1.d64";
@@ -471,12 +471,12 @@
 	// (we do that here); the rest is handled by the  ScummFile class and 
 	// code in openResourceFile() (and in the Sound class, for MONSTER.SOU
 	// handling).
-	if (_game.version >= 5 && _game.heversion == 0 && _substResFileName.winName &&
+	if (_game.version >= 5 && _game.heversion == 0 && _substResFileName.almostGameID &&
 		_game.platform == Common::kPlatformMacintosh && 
 		_substResFileName.genMethod == kGenAsIs) {
-		if (_fileHandle->open(_substResFileName.macName)) {
-			_containerFile = _substResFileName.macName;
-			_substResFileName.winName = 0;
+		if (_fileHandle->open(_substResFileName.expandedName)) {
+			_containerFile = _substResFileName.expandedName;
+			_substResFileName.almostGameID = 0;
 		}
 	}
 

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2006-03-04 09:40:45 UTC (rev 21061)
+++ scummvm/trunk/engines/scumm/scumm.h	2006-03-04 10:38:05 UTC (rev 21062)
@@ -343,8 +343,8 @@
 };
 
 struct SubstResFileNames {
-	const char *winName;
-	const char *macName;
+	const char *almostGameID;
+	const char *expandedName;
 	GenMethods genMethod;
 };
 

Modified: scummvm/trunk/engines/scumm/sound.cpp
===================================================================
--- scummvm/trunk/engines/scumm/sound.cpp	2006-03-04 09:40:45 UTC (rev 21061)
+++ scummvm/trunk/engines/scumm/sound.cpp	2006-03-04 10:38:05 UTC (rev 21062)
@@ -1008,7 +1008,7 @@
 	basename[0] = _vm->getBaseName();
 	basename[1] = "monster";
 	
-	if (_vm->_substResFileName.winName != 0) {
+	if (_vm->_substResFileName.almostGameID != 0) {
 
 		strcpy(buf, basename[0]);
 		_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
@@ -1033,7 +1033,7 @@
 			sprintf(buf, "%s.tlk", _vm->getBaseName());
 		}
 
-		if (_vm->_substResFileName.winName != 0) {
+		if (_vm->_substResFileName.almostGameID != 0) {
 			_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
 			strcpy(buf, buf1);
 		}







More information about the Scummvm-git-logs mailing list