From 95c17148aeef394d27d2055b4764f32ca1dcdade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ko=C5=82odziejski?= Date: Fri, 9 Apr 2004 21:44:29 +0000 Subject: [PATCH] fixed 'region' code svn-id: r13526 --- scumm/imuse_digi/dimuse.cpp | 4 +++- scumm/imuse_digi/dimuse_sndmgr.cpp | 5 +++-- scumm/imuse_digi/dimuse_sndmgr.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index 3c58872e332..19c5ce80b71 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -222,7 +222,9 @@ void IMuseDigital::switchToNextRegion(int track) { return; } - int jumpId = _sound->getJumpIdByRegion(_track[track].soundHandle, _track[track].curRegion); + int jumpId = _sound->getJumpIdByRegionAndHookId(_track[track].soundHandle, _track[track].curRegion, _track[track].curHookId); + if (jumpId == -1) + jumpId = _sound->getJumpIdByRegionAndHookId(_track[track].soundHandle, _track[track].curRegion, 0); if (jumpId != -1) { int region = _sound->getRegionIdByJumpId(_track[track].soundHandle, jumpId); assert(region != -1); diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp index 010283c916d..67a12475f43 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -404,12 +404,13 @@ int ImuseDigiSndMgr::getRegionOffset(soundStruct *soundHandle, int region) { return soundHandle->region[region].offset; } -int ImuseDigiSndMgr::getJumpIdByRegion(soundStruct *soundHandle, int region) { +int ImuseDigiSndMgr::getJumpIdByRegionAndHookId(soundStruct *soundHandle, int region, int hookId) { assert(soundHandle && checkForProperHandle(soundHandle)); assert(region >= 0 && region < soundHandle->numRegions); for (int l = 0; l < soundHandle->numJumps; l++) { if (soundHandle->jump[l].offset == soundHandle->region[region].offset) { - return l; + if (soundHandle->jump[l].hookId == hookId) + return l; } } diff --git a/scumm/imuse_digi/dimuse_sndmgr.h b/scumm/imuse_digi/dimuse_sndmgr.h index 063775fff97..c6055e5e0a4 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.h +++ b/scumm/imuse_digi/dimuse_sndmgr.h @@ -115,7 +115,7 @@ public: int getNumRegions(soundStruct *soundHandle); int getNumJumps(soundStruct *soundHandle); int getRegionOffset(soundStruct *soundHandle, int region); - int getJumpIdByRegion(soundStruct *soundHandle, int region); + int getJumpIdByRegionAndHookId(soundStruct *soundHandle, int region, int hookId); int getRegionIdByJumpId(soundStruct *soundHandle, int jumpId); int getJumpHookId(soundStruct *soundHandle, int number); int getJumpFade(soundStruct *soundHandle, int number);