diff options
author | Jamieson Christian | 2003-09-30 17:53:42 +0000 |
---|---|---|
committer | Jamieson Christian | 2003-09-30 17:53:42 +0000 |
commit | 9d93e97ed4066729622e4d3d8c5c2302faf289c3 (patch) | |
tree | c062de4793543126bdd9729c6595b16cb2458601 /scumm | |
parent | 748523dbe22033e65eeef6c974dfba57379ea49e (diff) | |
download | scummvm-rg350-9d93e97ed4066729622e4d3d8c5c2302faf289c3.tar.gz scummvm-rg350-9d93e97ed4066729622e4d3d8c5c2302faf289c3.tar.bz2 scummvm-rg350-9d93e97ed4066729622e4d3d8c5c2302faf289c3.zip |
Support for FMTowns versions of MI1/2,
submitted by Hibernatus.
svn-id: r10511
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/resource.cpp | 22 | ||||
-rw-r--r-- | scumm/sound.cpp | 33 |
2 files changed, 30 insertions, 25 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp index b9c1d209c6..b25ecbf541 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -666,8 +666,6 @@ int Scumm::loadResource(int type, int idx) { } } else { if (type == rtSound) { - _fileHandle.readUint32LE(); - _fileHandle.readUint32LE(); return readSoundResource(type, idx); } @@ -699,7 +697,7 @@ int Scumm::loadResource(int type, int idx) { } int Scumm::readSoundResource(int type, int idx) { - uint32 pos, total_size, size, tag, basetag; + uint32 pos, total_size, size, tag, basetag, max_total_size; int pri, best_pri; uint32 best_size = 0, best_offs = 0; @@ -707,6 +705,8 @@ int Scumm::readSoundResource(int type, int idx) { pos = 0; + _fileHandle.readUint32LE(); + max_total_size = _fileHandle.readUint32BE() - 8; basetag = fileReadDword(); total_size = _fileHandle.readUint32BE(); @@ -731,6 +731,9 @@ int Scumm::readSoundResource(int type, int idx) { pri = -1; switch (tag) { + case MKID('TOWS'): + pri = 16; + break; case MKID('SBL '): pri = 15; break; @@ -780,12 +783,6 @@ int Scumm::readSoundResource(int type, int idx) { _fileHandle.read(createResource(type, idx, best_size), best_size); return 1; } - } else if (FROM_LE_32(basetag) == 24) { - _fileHandle.seek(-12, SEEK_CUR); - total_size = _fileHandle.readUint32BE(); - _fileHandle.seek(-8, SEEK_CUR); - _fileHandle.read(createResource(type, idx, total_size), total_size); - return 1; } else if (basetag == MKID('Mac0')) { _fileHandle.seek(-12, SEEK_CUR); total_size = _fileHandle.readUint32BE() - 8; @@ -850,7 +847,12 @@ int Scumm::readSoundResource(int type, int idx) { total_size = _fileHandle.readUint32BE(); _fileHandle.read(createResource(type, idx, total_size), total_size - 8); return 1; - + } else if (FROM_LE_32(basetag) == max_total_size) { + _fileHandle.seek(-12, SEEK_CUR); + total_size = _fileHandle.readUint32BE(); + _fileHandle.seek(-8, SEEK_CUR); + _fileHandle.read(createResource(type, idx, total_size), total_size); + return 1; } else { warning("Unrecognized base tag 0x%08x in sound %d", basetag, idx); } diff --git a/scumm/sound.cpp b/scumm/sound.cpp index a311dd261a..646be954fc 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -195,15 +195,6 @@ void Sound::playSound(int soundID) { assert(_scumm->_musicEngine); _scumm->_musicEngine->startSound(soundID); } - else if (READ_UINT32(ptr) == MKID('SOUN')) { - ptr += 24; - int track = ptr[0]; - int loops = ptr[1]; - int start = (ptr[2] * 60 + ptr[3]) * 75 + ptr[4]; - playCDTrack(track, loops == 0xff ? -1 : loops, start, 0); - - _currentCDSound = soundID; - } // Support for SFX in Monkey Island 1, Mac version // This is rather hackish right now, but works OK. SFX are not sounding // 100% correct, though, not sure right now what is causing this. @@ -328,16 +319,28 @@ void Sound::playSound(int soundID) { memcpy(sound, ptr + 33, size); _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); } - else if (_scumm->_features & GF_FMTOWNS) { - size = READ_LE_UINT32(ptr); + else if ((_scumm->_features & GF_FMTOWNS) || READ_UINT32(ptr) == MKID('SOUN') || READ_UINT32(ptr) == MKID('TOWS')) { + bool tows = READ_UINT32(ptr) == MKID('TOWS'); + if (_scumm->_features & GF_FMTOWNS) + size = READ_LE_UINT32(ptr); + else + { + size = READ_BE_UINT32(ptr + 4) - 2; + if (tows) + size += 8; + ptr += 2; + } rate = 11025; int type = *(ptr + 0x0D); - int numInstruments; - switch(type) { + if (tows) + type = 0; + switch (type) { case 0: // Sound effect numInstruments = *(ptr + 0x14); + if (tows) + numInstruments = 1; ptr += 0x16; size -= 0x16; while (numInstruments--) { @@ -372,7 +375,7 @@ void Sound::playSound(int soundID) { case 1: // Music (Euphony format) if (_scumm->_musicEngine) - _scumm->_musicEngine->startSound (soundID); + _scumm->_musicEngine->startSound(soundID); break; case 2: // CD track resource ptr += 0x16; @@ -387,7 +390,7 @@ void Sound::playSound(int soundID) { int start = (ptr[2] * 60 + ptr[3]) * 75 + ptr[4]; int end = (ptr[5] * 60 + ptr[6]) * 75 + ptr[7]; - playCDTrack(track, loops == 0xff ? -1 : loops, start, end - start); + playCDTrack(track, loops == 0xff ? -1 : loops, start, end <= start ? 0 : end - start); } _currentCDSound = soundID; |