From 4bbb951c8e9f22a33575ea2e169343dabdd8e55d Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 9 Apr 2007 20:17:10 +0000 Subject: Fixed the wrong sound issue (laughing instead of a "whooosh" sound) in Gob3's second screen svn-id: r26445 --- engines/gob/inter_v2.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'engines/gob') diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 222ce8ee2b..3f76be5498 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -2016,11 +2016,14 @@ int16 Inter_v2::loadSound(int16 search) { byte *dataPtr; int16 id; int16 slot; + uint16 slotIdMask; uint32 dataSize; SoundType type; SoundSource source; type = SOUND_SND; + slotIdMask = 0; + if (!search) { slot = _vm->_parse->parseValExpr(); if (slot < 0) { @@ -2031,19 +2034,23 @@ int16 Inter_v2::loadSound(int16 search) { } else { id = load16(); - for (slot = 0; slot < 60; slot++) { - if (_vm->_game->_soundSamples[slot].isId(id)) - return slot | 0x8000; - } - - for (slot = 59; slot >= 0; slot--) { - if (_vm->_game->_soundSamples[slot].empty()) + for (slot = 0; slot < 60; slot++) + if (_vm->_game->_soundSamples[slot].isId(id)) { + slotIdMask = 0x8000; break; - } + } + + if (slot == 60) { + for (slot = 59; slot >= 0; slot--) { + if (_vm->_game->_soundSamples[slot].empty()) + break; + } - if (slot == -1) { - warning("Inter_v2::loadSound(): No free slot to load sound (id = %d)", id); - return 0; + if (slot == -1) { + warning("Inter_v2::loadSound(): No free slot to load sound " + "(id = %d)", id); + return 0; + } } } @@ -2083,7 +2090,7 @@ int16 Inter_v2::loadSound(int16 search) { _vm->_game->_soundSamples[slot]._id = id; } - return slot; + return slot | slotIdMask; } void Inter_v2::animPalette() { -- cgit v1.2.3