From e15dd070f8bf38c9a2d209f3f554d4db689b9f91 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 20 Apr 2009 05:19:42 +0000 Subject: Fix sound effects regression in Waxworks. svn-id: r40023 --- engines/agos/event.cpp | 1 + engines/agos/res_snd.cpp | 15 ++++++++------- engines/agos/vga_e2.cpp | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'engines/agos') diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index bc07320563..4836ac8035 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -285,6 +285,7 @@ void AGOSEngine::animateEvent(const byte *codePtr, uint16 curZoneNum, uint16 cur _curVgaFile1 = vpe->vgaFile1; _curVgaFile2 = vpe->vgaFile2; _curSfxFile = vpe->sfxFile; + _curSfxFileSize = vpe->sfxFileEnd - vpe->sfxFile; _vcPtr = codePtr; diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index 891e183d4f..27c669b1e2 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -533,35 +533,36 @@ void AGOSEngine::loadSound(uint16 sound, uint16 freq, uint16 flags) { dst = _curSfxFile; if (getGameType() == GType_WW) { - uint tmp = sound; + uint16 tmp = sound; + while (tmp--) { - dst += READ_LE_UINT16(dst) + 4; size += READ_LE_UINT16(dst) + 4; + dst += READ_LE_UINT16(dst) + 4; if (size > _curSfxFileSize) - error("loadSound: Reading beyond EOF"); + error("loadSound: Reading beyond EOF (%d, %d)", size, _curSfxFileSize); } size = READ_LE_UINT16(dst); offs = 4; } else if (getGameType() == GType_ELVIRA2) { while (READ_BE_UINT32(dst + 4) != sound) { - dst += 12; size += 12; + dst += 12; if (size > _curSfxFileSize) - error("loadSound: Reading beyond EOF"); + error("loadSound: Reading beyond EOF (%d, %d)", size, _curSfxFileSize); } size = READ_BE_UINT32(dst); offs = READ_BE_UINT32(dst + 8); } else { while (READ_BE_UINT16(dst + 6) != sound) { - dst += 12; size += 12; + dst += 12; if (size > _curSfxFileSize) - error("loadSound: Reading beyond EOF"); + error("loadSound: Reading beyond EOF (%d, %d)", size, _curSfxFileSize); } diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp index 50f9ad7dee..58d3329296 100644 --- a/engines/agos/vga_e2.cpp +++ b/engines/agos/vga_e2.cpp @@ -195,6 +195,8 @@ void AGOSEngine::vc52_playSound() { _sound->playEffects(sound); } else if (getGameId() == GID_SIMON1DOS) { playSting(sound); + } else if (getGameType() == GType_WW) { + // TODO: Sound effects in PC version only } else { loadSound(sound, 0, 0); } -- cgit v1.2.3