aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-12-24 23:53:16 +0000
committerMartin Kiewitz2009-12-24 23:53:16 +0000
commit4e45107be1b34e7edfba0869f889a4208d9eb705 (patch)
tree4064c110e41ed0f27a3ffca3ba3fcf2c4caa5418
parent16166de90c2268351e44bb5f88edb3a78ad0e88e (diff)
downloadscummvm-rg350-4e45107be1b34e7edfba0869f889a4208d9eb705.tar.gz
scummvm-rg350-4e45107be1b34e7edfba0869f889a4208d9eb705.tar.bz2
scummvm-rg350-4e45107be1b34e7edfba0869f889a4208d9eb705.zip
SCI/newmusic: Set signal after waiting for delta and not immediately (fixes iceman intro)
svn-id: r46539
-rw-r--r--engines/sci/sfx/music.cpp19
-rw-r--r--engines/sci/sfx/music.h3
2 files changed, 17 insertions, 5 deletions
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp
index fdc77f8c74..db49cf11dd 100644
--- a/engines/sci/sfx/music.cpp
+++ b/engines/sci/sfx/music.cpp
@@ -529,6 +529,14 @@ void MidiParser_SCI::unloadMusic() {
}
void MidiParser_SCI::parseNextEvent(EventInfo &info) {
+ SegManager *segMan = ((SciEngine *)g_engine)->getEngineState()->_segMan; // HACK
+
+ // Set signal AFTER waiting for delta, otherwise we would set signal too soon resulting in all sorts of bugs
+ if (_signalSet) {
+ _signalSet = false;
+ PUT_SEL32V(segMan, _pSnd->soundObj, signal, _signalToSet);
+ }
+
info.start = _position._play_pos;
info.delta = 0;
while (*_position._play_pos == 0xF8) {
@@ -545,8 +553,6 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
if (info.event < 0x80)
return;
- SegManager *segMan = ((SciEngine *)g_engine)->getEngineState()->_segMan; // HACK
-
_position._running_status = info.event;
switch (info.command()) {
case 0xC:
@@ -554,7 +560,8 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
info.basic.param2 = 0;
if (info.channel() == 0xF) {// SCI special case
if (info.basic.param1 != 0x7F) {
- PUT_SEL32V(segMan, _pSnd->soundObj, signal, info.basic.param1);
+ _signalSet = true;
+ _signalToSet = info.basic.param1;
} else {
_loopTick = _position._play_tick;
}
@@ -573,8 +580,8 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
switch (_soundVersion) {
case SCI_VERSION_0_EARLY:
_pSnd->dataInc += info.basic.param2;
- PUT_SEL32V(segMan, _pSnd->soundObj, signal, 0x7f + _pSnd->dataInc);
- warning("dataInc");
+ _signalSet = true;
+ _signalToSet = 0x7f + _pSnd->dataInc;
break;
case SCI_VERSION_1_EARLY:
case SCI_VERSION_1_LATE:
@@ -766,6 +773,8 @@ byte *MidiParser_SCI::midiFilterChannels(int channelMask) {
int midiParamCount;
_mixedData = filterData;
+ command = 0;
+ midiParamCount = 0;
lastCommand = 0;
curChannel = 15;
diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h
index 4050f008bc..57edba8b36 100644
--- a/engines/sci/sfx/music.h
+++ b/engines/sci/sfx/music.h
@@ -190,6 +190,9 @@ protected:
MusicEntry *_pSnd;
uint32 _loopTick;
byte _volume;
+
+ bool _signalSet;
+ int16 _signalToSet;
};
} // end of namespace