aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/sound.cpp
diff options
context:
space:
mode:
authorMax Horn2006-04-23 17:33:16 +0000
committerMax Horn2006-04-23 17:33:16 +0000
commit0d67640a58b044ade0605319e091df9b2f666e4a (patch)
treefcec3906ad2abb5ea28072663193a7cce9282e83 /engines/scumm/sound.cpp
parentd11f5724f96107a07d462be2410d93f55bd1fba2 (diff)
downloadscummvm-rg350-0d67640a58b044ade0605319e091df9b2f666e4a.tar.gz
scummvm-rg350-0d67640a58b044ade0605319e091df9b2f666e4a.tar.bz2
scummvm-rg350-0d67640a58b044ade0605319e091df9b2f666e4a.zip
Behold, the new SCUMM detector finally has arrived. Unified detection & engine instantiation, reduced code duplication, more powerful detection in case MD5 is not known / can't be computed, and many other nifty improvements.
svn-id: r22110
Diffstat (limited to 'engines/scumm/sound.cpp')
-rw-r--r--engines/scumm/sound.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 2a94230ce6..9dfeecc80b 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -996,7 +996,6 @@ ScummFile *Sound::openSfxFile() {
};
char buf[256];
- char buf1[128];
ScummFile *file = new ScummFile();
_offsetTable = NULL;
@@ -1004,19 +1003,22 @@ ScummFile *Sound::openSfxFile() {
* That way, you can keep .sou files for multiple games in the
* same directory */
- const char *basename[4] = { 0, 0, 0, 0 };
- basename[0] = _vm->getBaseName();
- basename[1] = "monster";
+ Common::String basename[2];
- if (_vm->_substResFileName.almostGameID != 0) {
- _vm->generateSubstResFileName(basename[0], buf1, sizeof(buf1));
- basename[2] = buf1;
+ const char *ptr = strchr(_vm->_filenamePattern.pattern, '.');
+ if (ptr) {
+ basename[0] = Common::String(_vm->_filenamePattern.pattern, ptr - _vm->_filenamePattern.pattern + 1);
+ } else {
+ basename[0] = _vm->_filenamePattern.pattern;
+ basename[0] += '.';
}
+ basename[1] = "monster.";
- for (int j = 0; basename[j] && !file->isOpen(); ++j) {
+ for (uint j = 0; j < 2 && !file->isOpen(); ++j) {
for (int i = 0; extensions[i].ext; ++i) {
- sprintf(buf, "%s.%s", basename[j], extensions[i].ext);
- if (_vm->openFile(*file, buf)) {
+ Common::String tmp(basename[j]);
+ tmp += extensions[i].ext;
+ if (_vm->openFile(*file, tmp.c_str())) {
_soundMode = extensions[i].mode;
break;
}
@@ -1025,15 +1027,11 @@ ScummFile *Sound::openSfxFile() {
if (!file->isOpen()) {
if ((_vm->_game.heversion <= 61 && _vm->_game.platform == Common::kPlatformMacintosh) || (_vm->_game.heversion >= 70)) {
- sprintf(buf, "%s.he2", _vm->getBaseName());
+ strncpy(buf, _vm->generateFilename(2).c_str(), sizeof(buf));
} else {
- sprintf(buf, "%s.tlk", _vm->getBaseName());
+ sprintf(buf, "%s.tlk", _vm->_filenamePattern.pattern);
}
- if (_vm->_substResFileName.almostGameID != 0) {
- _vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
- strcpy(buf, buf1);
- }
if (file->open(buf) && _vm->_game.heversion <= 73)
file->setEnc(0x69);
_soundMode = kVOCMode;