diff options
-rw-r--r-- | scumm/actor.cpp | 1 | ||||
-rw-r--r-- | scumm/actor.h | 1 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 15 | ||||
-rw-r--r-- | scumm/sound.cpp | 10 |
4 files changed, 21 insertions, 6 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 18214afdf8..a8da519408 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -101,6 +101,7 @@ void Actor::initActor(int mode) { ignoreTurns = false; talkFrequency = 256; + talkPan = 64; if (_vm->_version <= 2) { initFrame = 2; diff --git a/scumm/actor.h b/scumm/actor.h index a4d8f0466a..47a3f54666 100644 --- a/scumm/actor.h +++ b/scumm/actor.h @@ -90,6 +90,7 @@ public: byte room; byte talkColor; int talkFrequency; + byte talkPan; byte scalex, scaley; byte charset; byte moving; diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index f019e9e343..2819d862b6 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1070,9 +1070,18 @@ void Scumm_v8::o8_actorOps() { a->talkFrequency = pop(); break; case 0x89: // SO_ACTOR_PAN - // TODO - implement this! - i = pop(); - warning("o8_actorOps: setActorPan(%d) not implemented", i); + // FIXME: This should be stored in savegames. + // 0 = left, 64 = middle, 127 = right. + a->talkPan = pop(); + + // If the actor is talking at the moment, adjust the panning + // on the current talk channel handle. (If the handle is 0, + // setChannelPan() won't do anything.) + + if (_actorToPrintStrFor == a->number) + _mixer->setChannelPan(_sound->_talkChannelHandle, + (a->talkPan != 64) ? 2 * a->talkPan - 127 : 0); + break; default: error("o8_actorOps: default case 0x%x", subOp); diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 29191fb82b..f603e9706f 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1290,7 +1290,7 @@ void Sound::playBundleSound(char *sound, PlayingSoundHandle *handle) { if (!result) return; - int32 rate = 22050, channels, output_size = 0; + int32 rate = 22050, pan = 0, channels, output_size = 0; int32 tag, size = -1, bits = 0; if (_scumm->_gameId == GID_CMI) { @@ -1356,6 +1356,10 @@ void Sound::playBundleSound(char *sound, PlayingSoundHandle *handle) { if (_scumm->_actorToPrintStrFor != 0xFF && _scumm->_actorToPrintStrFor != 0) { Actor *a = _scumm->derefActor(_scumm->_actorToPrintStrFor, "playBundleSound"); rate = (rate * a->talkFrequency) / 256; + + // Adjust to fit the mixer's notion of panning. + if (pan != 64) + pan = 2 * a->talkPan - 127; } // Stop any sound currently playing on the given handle @@ -1363,12 +1367,12 @@ void Sound::playBundleSound(char *sound, PlayingSoundHandle *handle) { _scumm->_mixer->stopHandle(*handle); if (bits == 8) { - _scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, 127, 0); + _scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, 127, pan); } else if (bits == 16) { // FIXME: For some weird reasons, sometimes we get an odd size, even though // the data is supposed to be in 16 bit format... that makes no sense... size &= ~1; - _scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, 127, 0); + _scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, 127, pan); } else { warning("Sound::playBundleSound() to do more options to playRaw..."); } |