From 20095d8e93085419385efbe82d6607201d1d38c6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 12 Mar 2006 17:58:04 +0000 Subject: - Changes usage of regBx to regAx in primaryEffect2 (seems to be a bug introduced when renaming). - Changes unk41 and unk32 to signed. - Fixes wrong sound when dropping items (that was also a little bug in primaryEffect2) svn-id: r21240 --- engines/kyra/sound_adlib.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'engines') diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index fdefaabede..971df24484 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -152,8 +152,8 @@ private: uint8 unk34; uint8 unk35; uint8 unk36; - uint8 unk32; - uint8 unk41; + int8 unk32; + int8 unk41; uint8 unk38; uint8 opExtraLevel1; uint8 unk7; @@ -1094,23 +1094,23 @@ void AdlibDriver::primaryEffect2(OutputState &state) { } state.unk41 += state.unk32; - if ((int8)state.unk41 < 0) { - uint16 temp2 = state.unk37; + if (state.unk41 < 0) { + uint16 unk1 = state.unk37; if (!(--state.unk34)) { - temp2 ^= 0xFFFF; - ++temp2; - state.unk37 = temp2; + unk1 ^= 0xFFFF; + ++unk1; + state.unk37 = unk1; state.unk34 = state.unk35; } - uint16 temp3 = state.regAx | (state.regBx << 8); - temp2 += temp3 & 0x3FF; - state.regAx = temp2 & 0xFF; - - state.regBx = (state.regBx & 0xFC) | (temp3 >> 8); + uint16 unk2 = (state.regAx | (state.regBx << 8)) & 0x3FF; + unk2 += unk1; + + state.regAx = unk2 & 0xFF; + state.regBx = (state.regBx & 0xFC) | (unk2 >> 8); // Octave / F-Number / Key-On - writeOPL(0xA0 + _curTable, state.regBx); + writeOPL(0xA0 + _curTable, state.regAx); writeOPL(0xB0 + _curTable, state.regBx); } } @@ -1352,7 +1352,7 @@ int AdlibDriver::update_setBaseFreq(uint8 *&dataptr, OutputState &state, uint8 v } int AdlibDriver::update_setupPrimaryEffect2(uint8 *&dataptr, OutputState &state, uint8 value) { - state.unk32 = value; + state.unk32 = (int8)value; state.unk33 = *dataptr++; uint8 temp = *dataptr++; state.unk34 = temp + 1; -- cgit v1.2.3