Speech is now played correctly in the Macintosh version of IHNM

svn-id: r31405
This commit is contained in:
Filippos Karapetis 2008-04-05 13:19:12 +00:00
parent 99283e9e54
commit 2da922081c
2 changed files with 45 additions and 8 deletions

View File

@ -505,10 +505,16 @@ bool Resource::createContexts() {
} else { } else {
// No voice file found, don't add any file to the array // No voice file found, don't add any file to the array
voicesFileInArray = true; voicesFileInArray = true;
warning("No voice file found, voices will be disabled");
_vm->_voicesEnabled = false; if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) {
_vm->_subtitlesEnabled = true; // The Macintosh version of IHNM has no voices.res, and it has all
_vm->_voiceFilesExist = false; // 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;
}
} }
} }
} }

View File

@ -105,6 +105,18 @@ void SndRes::setVoiceBank(int serial) {
if (_voiceSerial == serial) if (_voiceSerial == serial)
return; 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 there are no voice files present, don't set the voice bank
if (!_vm->_voiceFilesExist) if (!_vm->_voiceFilesExist)
return; return;
@ -177,10 +189,25 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
int dirIndex = 0; int dirIndex = 0;
if ((context->fileType & GAME_VOICEFILE) != 0) { if ((context->fileType & GAME_VOICEFILE) != 0) {
// TODO dirIndex = floor((float)(resourceId / 64));
return false;
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 { } else {
dirIndex = floor((float)(resourceId / 63)); dirIndex = floor((float)(resourceId / 64));
if (resourceId <= 16) // F in hex (1 char in hex) if (resourceId <= 16) // F in hex (1 char in hex)
sprintf(soundFileName, "SFX/SFX%d/SFX00%x", dirIndex, resourceId); 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(); 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); MemoryReadStream readS(soundResource, soundResourceLength);