aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx
diff options
context:
space:
mode:
authorFilippos Karapetis2009-12-31 08:30:30 +0000
committerFilippos Karapetis2009-12-31 08:30:30 +0000
commit54245f712d18860c1454d4d1b3878bad77d43728 (patch)
tree0062c85f0304761e3a2feefa2dc59858ab92883e /engines/sci/sfx
parent762bdc7caded769c6440bae0e17fca8c37f5d317 (diff)
downloadscummvm-rg350-54245f712d18860c1454d4d1b3878bad77d43728.tar.gz
scummvm-rg350-54245f712d18860c1454d4d1b3878bad77d43728.tar.bz2
scummvm-rg350-54245f712d18860c1454d4d1b3878bad77d43728.zip
SCI/new music code: The loop selector for each music score is no longer cached, but read directly from the sound object
svn-id: r46792
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r--engines/sci/sfx/midiparser.cpp9
-rw-r--r--engines/sci/sfx/music.cpp1
-rw-r--r--engines/sci/sfx/music.h1
-rw-r--r--engines/sci/sfx/soundcmd.cpp8
4 files changed, 7 insertions, 12 deletions
diff --git a/engines/sci/sfx/midiparser.cpp b/engines/sci/sfx/midiparser.cpp
index 8d44cf0a5a..59d762bda8 100644
--- a/engines/sci/sfx/midiparser.cpp
+++ b/engines/sci/sfx/midiparser.cpp
@@ -200,10 +200,11 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
info.ext.data = _position._play_pos;
_position._play_pos += info.length;
if (info.ext.type == 0x2F) {// end of track reached
- if (_pSnd->loop)
- _pSnd->loop--;
- PUT_SEL32V(segMan, _pSnd->soundObj, loop, _pSnd->loop);
- if (_pSnd->loop) {
+ int16 loop = GET_SEL32V(segMan, _pSnd->soundObj, loop);
+ if (loop)
+ loop--;
+ PUT_SEL32V(segMan, _pSnd->soundObj, loop, loop);
+ if (loop) {
// We need to play it again...
jumpToTick(_loopTick);
} else {
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp
index a2f84f6ec6..5223b87a9f 100644
--- a/engines/sci/sfx/music.cpp
+++ b/engines/sci/sfx/music.cpp
@@ -557,7 +557,6 @@ MusicEntry::MusicEntry() {
dataInc = 0;
ticker = 0;
prio = 0;
- loop = 0;
volume = 0;
pauseCounter = 0;
diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h
index 8145de8fb8..eab1c7aff9 100644
--- a/engines/sci/sfx/music.h
+++ b/engines/sci/sfx/music.h
@@ -73,7 +73,6 @@ public:
uint16 dataInc;
uint16 ticker;
byte prio;
- uint16 loop;
int16 volume;
int16 pauseCounter;
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index 97408e7f96..15067e7270 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -288,7 +288,6 @@ void SoundCommandParser::cmdInitHandle(reg_t obj, int16 value) {
if (number && _resMan->testResource(ResourceId(kResourceTypeSound, number)))
newSound->soundRes = new SoundResource(number, _resMan, _soundVersion);
newSound->soundObj = obj;
- newSound->loop = GET_SEL32V(_segMan, obj, loop);
newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF;
newSound->volume = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, Audio::Mixer::kMaxChannelVolume);
@@ -421,7 +420,6 @@ void SoundCommandParser::cmdPlayHandle(reg_t obj, int16 value) {
PUT_SEL32V(_segMan, obj, state, kSoundPlaying);
}
- musicSlot->loop = GET_SEL32V(_segMan, obj, loop);
musicSlot->prio = GET_SEL32V(_segMan, obj, priority);
// vol selector doesnt get used before sci1late
if (_soundVersion < SCI_VERSION_1_LATE)
@@ -677,7 +675,6 @@ void SoundCommandParser::cmdUpdateHandle(reg_t obj, int16 value) {
return;
}
- musicSlot->loop = GET_SEL32V(_segMan, obj, loop);
int16 objVol = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, 255);
if (objVol != musicSlot->volume)
_music->soundSetVolume(musicSlot, objVol);
@@ -895,11 +892,10 @@ void SoundCommandParser::cmdSetHandleLoop(reg_t obj, int16 value) {
return;
}
if (value == -1) {
- musicSlot->loop = 0xFFFF;
+ PUT_SEL32V(_segMan, obj, loop, 0xFFFF);
} else {
- musicSlot->loop = 1; // actually plays the music once
+ PUT_SEL32V(_segMan, obj, loop, 1); // actually plays the music once
}
- PUT_SEL32V(_segMan, obj, loop, musicSlot->loop);
#endif
}