Renamed SubstResFileNames::winName and macName to almostGameID / expandedName (the old names were misleading; the new ones aren't great either :)
svn-id: r21062
This commit is contained in:
parent
bea9b5e7d0
commit
bb38ea2c17
7 changed files with 35 additions and 35 deletions
|
@ -162,7 +162,7 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
|
|||
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 MacResExtractor::extractResource(int id, byte **buf) {
|
|||
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());
|
||||
|
|
|
@ -161,7 +161,7 @@ void Sound::setupHEMusicFile() {
|
|||
|
||||
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 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -1168,7 +1168,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
|
|||
|
||||
substLastIndex = findSubstResFileName(subst, tempName, substLastIndex);
|
||||
applySubstResFileName(subst, tempName, detectName, sizeof(detectName));
|
||||
} while (subst.winName != 0);
|
||||
} while (subst.almostGameID != 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1284,10 +1284,10 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
|
|||
|
||||
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 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
|
|||
}
|
||||
|
||||
// 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;
|
||||
|
|
|
@ -152,7 +152,7 @@ void ScummEngine::openRoom(const int room) {
|
|||
}
|
||||
|
||||
// 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 @@ bool ScummEngine::openFile(BaseScummFile &file, const char *filename, bool resou
|
|||
// 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 @@ bool ScummEngine::openFile(BaseScummFile &file, const char *filename, bool resou
|
|||
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -292,30 +292,30 @@ static SubstResFileNames substResFileNameTable[] = {
|
|||
{ 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 @@ static void applySubstResFileName(const SubstResFileNames &subst, char *buf, int
|
|||
}
|
||||
|
||||
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 @@ bool applySubstResFileName(const SubstResFileNames &subst, const char *filename,
|
|||
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 @@ int findSubstResFileName(SubstResFileNames &subst, const char *filename, int ind
|
|||
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 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
|
|||
|
||||
// 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 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
|
|||
// (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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -343,8 +343,8 @@ enum GenMethods {
|
|||
};
|
||||
|
||||
struct SubstResFileNames {
|
||||
const char *winName;
|
||||
const char *macName;
|
||||
const char *almostGameID;
|
||||
const char *expandedName;
|
||||
GenMethods genMethod;
|
||||
};
|
||||
|
||||
|
|
|
@ -1008,7 +1008,7 @@ ScummFile *Sound::openSfxFile() {
|
|||
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 @@ ScummFile *Sound::openSfxFile() {
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue