From 2da922081cc1feab68217941946340ca892be074 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 5 Apr 2008 13:19:12 +0000 Subject: Speech is now played correctly in the Macintosh version of IHNM svn-id: r31405 --- engines/saga/rscfile.cpp | 14 ++++++++++---- engines/saga/sndres.cpp | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/saga/rscfile.cpp b/engines/saga/rscfile.cpp index 7914b3ed3b..bd5bfdfa1d 100644 --- a/engines/saga/rscfile.cpp +++ b/engines/saga/rscfile.cpp @@ -505,10 +505,16 @@ bool Resource::createContexts() { } else { // No voice file found, don't add any file to the array voicesFileInArray = true; - warning("No voice file found, voices will be disabled"); - _vm->_voicesEnabled = false; - _vm->_subtitlesEnabled = true; - _vm->_voiceFilesExist = false; + + if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) { + // The Macintosh version of IHNM has no voices.res, and it has all + // its voice files in subdirectories, so don't do anything here + } else { + warning("No voice file found, voices will be disabled"); + _vm->_voicesEnabled = false; + _vm->_subtitlesEnabled = true; + _vm->_voiceFilesExist = false; + } } } } diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 83e13d94aa..7b96308a41 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -105,6 +105,18 @@ void SndRes::setVoiceBank(int serial) { if (_voiceSerial == serial) return; + // If we got the Macintosh version of IHNM, just set the voice bank + // so that we know which voices* subfolder to look for later + if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) { + _voiceSerial = serial; + // Set a dummy voice context + _voiceContext = new ResourceContext(); + _voiceContext->fileType = GAME_VOICEFILE; + _voiceContext->count = 0; + _voiceContext->serial = 0; + return; + } + // If there are no voice files present, don't set the voice bank if (!_vm->_voiceFilesExist) return; @@ -177,10 +189,25 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff int dirIndex = 0; if ((context->fileType & GAME_VOICEFILE) != 0) { - // TODO - return false; + dirIndex = floor((float)(resourceId / 64)); + + if (_voiceSerial == 0) { + if (resourceId <= 16) // F in hex (1 char in hex) + sprintf(soundFileName, "Voices/VoicesS/Voices%d/VoicesS00%x", dirIndex, resourceId); + else if (resourceId <= 255) // FF in hex (2 chars in hex) + sprintf(soundFileName, "Voices/VoicesS/Voices%d/VoicesS0%x", dirIndex, resourceId); + else + sprintf(soundFileName, "Voices/VoicesS/Voices%d/VoicesS%x", dirIndex, resourceId); + } else { + if (resourceId <= 16) // F in hex (1 char in hex) + sprintf(soundFileName, "Voices/Voices%d/Voices%d/Voices%d00%x", _voiceSerial, dirIndex, _voiceSerial, resourceId); + else if (resourceId <= 255) // FF in hex (2 chars in hex) + sprintf(soundFileName, "Voices/Voices%d/Voices%d/Voices%d0%x", _voiceSerial, dirIndex, _voiceSerial, resourceId); + else + sprintf(soundFileName, "Voices/Voices%d/Voices%d/Voices%d%x", _voiceSerial, dirIndex, _voiceSerial, resourceId); + } } else { - dirIndex = floor((float)(resourceId / 63)); + dirIndex = floor((float)(resourceId / 64)); if (resourceId <= 16) // F in hex (1 char in hex) sprintf(soundFileName, "SFX/SFX%d/SFX00%x", dirIndex, resourceId); @@ -204,7 +231,11 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff soundInfo = _vm->getSfxInfo(); } - context->table[resourceId].fillSoundPatch(soundInfo); + if (_vm->getGameType() == GType_IHNM && _vm->isMacResources() && (context->fileType & GAME_VOICEFILE) != 0) { + // No sound patch data for the voice files in the Mac version of IHNM + } else { + context->table[resourceId].fillSoundPatch(soundInfo); + } MemoryReadStream readS(soundResource, soundResourceLength); -- cgit v1.2.3