diff options
author | Johannes Schickel | 2011-07-10 19:23:59 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-07-10 19:23:59 +0200 |
commit | 4ee228bb1692c4f77cea861cdea05282f4567591 (patch) | |
tree | 641d054b65f7420526db8997c58f100745e6ea4b /engines | |
parent | 5f5daadedbd3dafa80836d6c9a2c865ce0a22f8b (diff) | |
download | scummvm-rg350-4ee228bb1692c4f77cea861cdea05282f4567591.tar.gz scummvm-rg350-4ee228bb1692c4f77cea861cdea05282f4567591.tar.bz2 scummvm-rg350-4ee228bb1692c4f77cea861cdea05282f4567591.zip |
SCUMM: Fix some envelope bugs in PC Speaker output.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/imuse/pcspk.cpp | 10 | ||||
-rw-r--r-- | engines/scumm/imuse/pcspk.h | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/engines/scumm/imuse/pcspk.cpp b/engines/scumm/imuse/pcspk.cpp index 51f6950bf5..01e2ab3b7d 100644 --- a/engines/scumm/imuse/pcspk.cpp +++ b/engines/scumm/imuse/pcspk.cpp @@ -21,8 +21,6 @@ #include "scumm/imuse/pcspk.h" -#include "common/debug.h" -#include "common/textconsole.h" #include "common/util.h" namespace Scumm { @@ -107,7 +105,7 @@ void PcSpkDriver::onTimer() { if (out.unkB && out.unkC) { out.unkA += out.unkB; if (out.instrument) - out.unkE = (out.instrument[out.unkA] * out.unkC) >> 4; + out.unkE = ((int8)out.instrument[out.unkA] * out.unkC) >> 4; } ++_effectTimer; @@ -515,7 +513,7 @@ void PcSpkDriver::updateEffectGenerator(MidiChannel_PcSpk &chan, EffectEnvelope break; case 3: - chan._out.unkC = (def.phase & 0xFF) + chan._instrument[1]; + chan._out.unkC = (def.phase & 0xFF) + chan._instrument[2]; break; case 4: @@ -540,10 +538,10 @@ void PcSpkDriver::updateEffectGenerator(MidiChannel_PcSpk &chan, EffectEnvelope } uint8 PcSpkDriver::advanceEffectEnvelope(EffectEnvelope &env, EffectDefinition &def) { - if (env.duration > 0) { + if (env.duration != 0) { env.duration -= 17; if (env.duration <= 0) { - env.duration = 0; + env.state = 0; return 0; } } diff --git a/engines/scumm/imuse/pcspk.h b/engines/scumm/imuse/pcspk.h index 3f70160988..e77ac8c1bf 100644 --- a/engines/scumm/imuse/pcspk.h +++ b/engines/scumm/imuse/pcspk.h @@ -62,7 +62,7 @@ private: struct EffectEnvelope { uint8 state; int16 currentLevel; - uint16 duration; + int16 duration; int16 maxLevel; int16 startLevel; uint8 loop; @@ -80,7 +80,7 @@ private: }; struct EffectDefinition { - uint16 phase; + int16 phase; uint8 type; uint8 useModWheel; EffectEnvelope *envelope; @@ -95,12 +95,12 @@ private: uint8 unkA; uint8 unkB; uint8 unkC; - uint16 unkE; + int16 unkE; EffectEnvelope effectEnvelopeA; EffectDefinition effectDefA; EffectEnvelope effectEnvelopeB; EffectDefinition effectDefB; - uint16 unk60; + int16 unk60; }; struct MidiChannel_PcSpk : public MidiChannel { |