From ee7ba1bbaf4a17104f8a61be0218f9793b0b9cf6 Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Fri, 19 Dec 2014 17:14:13 +0600 Subject: ZVISION: Fix zork raw soundParams handling --- engines/zvision/sound/zork_raw.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/zvision/sound/zork_raw.cpp b/engines/zvision/sound/zork_raw.cpp index 393f2eb6a9..8688039325 100644 --- a/engines/zvision/sound/zork_raw.cpp +++ b/engines/zvision/sound/zork_raw.cpp @@ -264,30 +264,33 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, fileName.toLowercase(); - SoundParams soundParams = {}; + const SoundParams *soundParams = NULL; if (engine->getGameId() == GID_NEMESIS) { for (int i = 0; i < 32; ++i) { if (RawZorkStream::_zNemSoundParamLookupTable[i].identifier == (fileName[6])) - soundParams = RawZorkStream::_zNemSoundParamLookupTable[i]; + soundParams = &RawZorkStream::_zNemSoundParamLookupTable[i]; } } else if (engine->getGameId() == GID_GRANDINQUISITOR) { for (int i = 0; i < 24; ++i) { if (RawZorkStream::_zgiSoundParamLookupTable[i].identifier == (fileName[7])) - soundParams = RawZorkStream::_zgiSoundParamLookupTable[i]; + soundParams = &RawZorkStream::_zgiSoundParamLookupTable[i]; } } - if (soundParams.packed) { - return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, DisposeAfterUse::YES); + if (soundParams == NULL) + return NULL; + + if (soundParams->packed) { + return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams->rate, soundParams->stereo, DisposeAfterUse::YES); } else { byte flags = 0; - if (soundParams.bits16) + if (soundParams->bits16) flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN; - if (soundParams.stereo) + if (soundParams->stereo) flags |= Audio::FLAG_STEREO; - return Audio::makeRawStream(file, soundParams.rate, flags, DisposeAfterUse::YES); + return Audio::makeRawStream(file, soundParams->rate, flags, DisposeAfterUse::YES); } } -- cgit v1.2.3