diff options
author | Robert Špalek | 2009-10-12 22:27:23 +0000 |
---|---|---|
committer | Robert Špalek | 2009-10-12 22:27:23 +0000 |
commit | e77928440307f0d8a765e32100e031989ad25ff5 (patch) | |
tree | 970e4c758de39c9c5f97bc6557428a0363a07101 /engines/draci/animation.cpp | |
parent | d306e1219e606f5af6b3dd37556f1ba1ecb5ed51 (diff) | |
download | scummvm-rg350-e77928440307f0d8a765e32100e031989ad25ff5.tar.gz scummvm-rg350-e77928440307f0d8a765e32100e031989ad25ff5.tar.bz2 scummvm-rg350-e77928440307f0d8a765e32100e031989ad25ff5.zip |
Sound effects are now correctly played.
Dubbing is not yet played.
svn-id: r45000
Diffstat (limited to 'engines/draci/animation.cpp')
-rw-r--r-- | engines/draci/animation.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp index c3ae4a8f12..37ef609ea4 100644 --- a/engines/draci/animation.cpp +++ b/engines/draci/animation.cpp @@ -39,6 +39,7 @@ Animation::Animation(DraciEngine *vm, int index) : _vm(vm) { _paused = false; _tick = _vm->_system->getMillis(); _currentFrame = 0; + _hasChangedFrame = true; _callback = &Animation::doNothing; } @@ -97,6 +98,8 @@ void Animation::nextFrame(bool force) { // Fetch new frame and mark it dirty markDirtyRect(surface); + + _hasChangedFrame = true; } } @@ -129,6 +132,15 @@ void Animation::drawFrame(Surface *surface) { // Draw frame frame->drawReScaled(surface, false, _displacement); } + + const SoundSample *sample = _samples[_currentFrame]; + if (_hasChangedFrame && sample) { + debugC(3, kDraciSoundDebugLevel, + "Playing sample on animation %d, frame %d: %d+%d at %dHz", + _id, _currentFrame, sample->_offset, sample->_length, sample->_frequency); + _vm->_sound->playSound(sample, Audio::Mixer::kMaxChannelVolume, false); + } + _hasChangedFrame = false; } void Animation::setID(int id) { @@ -162,6 +174,9 @@ bool Animation::isPlaying() const { void Animation::setPlaying(bool playing) { _tick = _vm->_system->getMillis(); _playing = playing; + + // When restarting an animation, allow playing sounds. + _hasChangedFrame |= playing; } bool Animation::isPaused() const { |