aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorJohannes Schickel2011-07-14 00:48:30 +0200
committerJohannes Schickel2011-07-14 00:49:32 +0200
commitf814dc971ca9f6526b4f6049642b79d6371dcfb8 (patch)
tree254ec12a9dd2e914d4daed1daebbc60c594f01da /engines/scumm
parent9565af1ae42674b67fd1ed744ae4855991ba8473 (diff)
downloadscummvm-rg350-f814dc971ca9f6526b4f6049642b79d6371dcfb8.tar.gz
scummvm-rg350-f814dc971ca9f6526b4f6049642b79d6371dcfb8.tar.bz2
scummvm-rg350-f814dc971ca9f6526b4f6049642b79d6371dcfb8.zip
SCUMM: Handle default instrument set up in iMuse like the original.
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/imuse/imuse.cpp16
-rw-r--r--engines/scumm/imuse/sysex_scumm.cpp23
2 files changed, 26 insertions, 13 deletions
diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index 451721cf70..5ad4798578 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -1682,7 +1682,21 @@ void IMuseInternal::setGlobalInstrument(byte slot, byte *data) {
void IMuseInternal::copyGlobalInstrument(byte slot, Instrument *dest) {
if (slot >= 32)
return;
- _global_instruments[slot].copy_to(dest);
+
+ // Both the AdLib code and the PC Speaker code use an all zero instrument
+ // as default in the original, thus we do the same.
+ // PC Speaker instrument size is 23, while AdLib instrument size is 30.
+ // Thus we just use a 30 byte instrument data array as default.
+ const byte defaultInstr[30] = { 0 };
+
+ if (_global_instruments[slot].isValid()) {
+ // In case we have an valid instrument set up, copy it to the part.
+ _global_instruments[slot].copy_to(dest);
+ } else if (_pcSpeaker) {
+ dest->pcspk(defaultInstr);
+ } else {
+ dest->adlib(defaultInstr);
+ }
}
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index 9f795133be..85ffc86f47 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -81,20 +81,19 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
se->reallocateMidiChannels(player->_midi);
}
} else {
- // Even in cases where a program does not seem to be specified,
- // i.e. bytes 15 and 16 are 0, we send a program change because
- // 0 is a valid program number. MI2 tests show that in such
- // cases, a regular program change message always seems to follow
- // anyway.
if (player->_isMIDI) {
+ // Even in cases where a program does not seem to be specified,
+ // i.e. bytes 15 and 16 are 0, we send a program change because
+ // 0 is a valid program number. MI2 tests show that in such
+ // cases, a regular program change message always seems to follow
+ // anyway.
part->_instrument.program(buf[8], player->_isMT32);
- } else if (se->_pcSpeaker) {
- // FIXME/HACK: This is only needed here, since when we use the following line:
- // se->copyGlobalInstrument(buf[8], &part->_instrument);
- // We would not get any instrument for PC Speaker. Because we don't default to an
- // "empty" instrument in case the global instrument specified is not set up.
- byte empty[23] = {0};
- part->_instrument.pcspk(empty);
+ } else {
+ // Like the original we set up the instrument data of the
+ // specified program here too. In case the global
+ // instrument data is not loaded already, this will take
+ // care of setting a default instrument too.
+ se->copyGlobalInstrument(buf[8], &part->_instrument);
}
part->sendAll();
}