From f814dc971ca9f6526b4f6049642b79d6371dcfb8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 14 Jul 2011 00:48:30 +0200 Subject: SCUMM: Handle default instrument set up in iMuse like the original. --- engines/scumm/imuse/imuse.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'engines/scumm/imuse/imuse.cpp') 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); + } } -- cgit v1.2.3