diff options
author | Johannes Schickel | 2011-08-05 22:46:26 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-08-05 22:58:50 +0200 |
commit | b86de198a01d840d71706bca7facb4f1ce8cb997 (patch) | |
tree | 173d723fe56a29f00d02fbf92421af7a7a0294ee /engines/scumm/sound.cpp | |
parent | 75ca55eaec14cc47a55c091a0d059166682ee6e1 (diff) | |
download | scummvm-rg350-b86de198a01d840d71706bca7facb4f1ce8cb997.tar.gz scummvm-rg350-b86de198a01d840d71706bca7facb4f1ce8cb997.tar.bz2 scummvm-rg350-b86de198a01d840d71706bca7facb4f1ce8cb997.zip |
SCUMM: Fix up CMS player implementation.
It's much better now and hopefully quite close to the original when it comes
to the music part. The intro music of Loom and Monkey Island 1 EGA sounds fine
to me now at least.
Diffstat (limited to 'engines/scumm/sound.cpp')
-rw-r--r-- | engines/scumm/sound.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index a74fa365a2..b4836d0c31 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -2104,18 +2104,37 @@ int ScummEngine::readSoundResourceSmallHeader(ResId idx) { _fileHandle->read(_res->createResource(rtSound, idx, wa_size + 6), wa_size + 6); } return 1; - } else if (_musicType == MDT_CMS && ad_offs != 0) { + } else if (_musicType == MDT_CMS) { if (_game.features & GF_OLD_BUNDLE) { - _fileHandle->seek(wa_offs + wa_size + 6, SEEK_SET); - byte musType = _fileHandle->readByte(); + bool hasAdLibMusicTrack = false; - if (musType == 0x80) { + if (ad_offs) { + _fileHandle->seek(ad_offs + 4 + 2, SEEK_SET); + hasAdLibMusicTrack = (_fileHandle->readByte() == 0x80); + } + + if (hasAdLibMusicTrack) { _fileHandle->seek(ad_offs, SEEK_SET); _fileHandle->read(_res->createResource(rtSound, idx, ad_size), ad_size); } else { _fileHandle->seek(wa_offs, SEEK_SET); _fileHandle->read(_res->createResource(rtSound, idx, wa_size), wa_size); } + } else { + bool hasAdLibMusicTrack = false; + + if (ad_offs) { + _fileHandle->seek(ad_offs + 2, SEEK_SET); + hasAdLibMusicTrack = (_fileHandle->readByte() == 0x80); + } + + if (hasAdLibMusicTrack) { + _fileHandle->seek(ad_offs - 4, SEEK_SET); + _fileHandle->read(_res->createResource(rtSound, idx, ad_size + 4), ad_size + 4); + } else { + _fileHandle->seek(wa_offs - 6, SEEK_SET); + _fileHandle->read(_res->createResource(rtSound, idx, wa_size + 6), wa_size + 6); + } } } else if (ad_offs != 0) { // AD resources have a header, instrument definitions and one MIDI track. |