aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2009-12-22 00:12:59 +0000
committerFilippos Karapetis2009-12-22 00:12:59 +0000
commitbe67479aef238d8558438ccc31da69dde67ea807 (patch)
treee8ee07cb598ac448e55c8e55a6d7433968ba25f8 /engines
parentf6880b98217783f9bc76959cf951e803c89092f0 (diff)
downloadscummvm-rg350-be67479aef238d8558438ccc31da69dde67ea807.tar.gz
scummvm-rg350-be67479aef238d8558438ccc31da69dde67ea807.tar.bz2
scummvm-rg350-be67479aef238d8558438ccc31da69dde67ea807.zip
Some bugfixes to the new music code
svn-id: r46473
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/sfx/music.cpp1
-rw-r--r--engines/sci/sfx/soundcmd.cpp10
2 files changed, 6 insertions, 5 deletions
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp
index 3956b0faeb..5fdf45db69 100644
--- a/engines/sci/sfx/music.cpp
+++ b/engines/sci/sfx/music.cpp
@@ -446,6 +446,7 @@ void SciMusic::soundKill(MusicEntry *pSnd) {
// Remove sound from playlist
for (i = 0; i < sz; i++) {
if (_playList[i] == pSnd) {
+ delete _playList[i]->soundRes;
_playList.remove_at(i);
break;
}
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index ecade498c3..297e926f7e 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -276,6 +276,11 @@ void SoundCommandParser::cmdInitHandle(reg_t obj, int16 value) {
PUT_SEL32(_segMan, obj, handle, obj);
#ifndef USE_OLD_MUSIC_FUNCTIONS
+ // Check if a track with the same sound object is already playing
+ int prevTrack = _music->findListSlot(obj);
+ if (prevTrack > -1)
+ _music->soundKill(_music->_playList[prevTrack]);
+
MusicEntry *newSound = new MusicEntry();
newSound->soundRes = 0;
if (_resMan->testResource(ResourceId(kResourceTypeSound, number)))
@@ -284,9 +289,6 @@ void SoundCommandParser::cmdInitHandle(reg_t obj, int16 value) {
newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF;
newSound->pStreamAud = 0;
newSound->pMidiParser = 0;
-
- // TODO
- //_music->soundKill(newSound);
_music->_playList.push_back(newSound);
if (newSound->soundRes)
@@ -424,8 +426,6 @@ void SoundCommandParser::cmdDisposeHandle(reg_t obj, int16 value) {
if (!GET_SEL32(_segMan, obj, nodePtr).isNull()) {
_music->soundKill(_music->_playList[slot]);
- delete _music->_playList[slot]->soundRes;
- _music->_playList.remove_at(slot);
PUT_SEL32(_segMan, obj, nodePtr, NULL_REG);
}