From 6d51a3ead4eae4a2c8fbb8cce20b4c1e4bbd4c64 Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Tue, 14 Jul 2009 18:11:33 +0000 Subject: * Fixed bug in Animation which made the first frame of an animation being drawn after it's stopped * Fixed debugging info when starting and stopping animations svn-id: r42485 --- engines/draci/animation.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp index c6528fae46..2a333445ec 100644 --- a/engines/draci/animation.cpp +++ b/engines/draci/animation.cpp @@ -53,8 +53,8 @@ void Animation::setLooping(bool looping) { void Animation::nextFrame(bool force) { - // If there's only one or no frames, return - if (getFramesNum() < 2) + // If there's only one or no frames, or if the animation is not playing, return + if (getFramesNum() < 2 || !_playing) return; Common::Rect frameRect = _frames[_currentFrame]->getRect(); @@ -89,7 +89,8 @@ uint Animation::nextFrameNum() { void Animation::drawFrame(Surface *surface) { - if (_frames.size() == 0) + // If there are no frames or the animation is not playing, return + if (_frames.size() == 0 || !_playing) return; if (_id == kOverlayImage) { @@ -157,19 +158,21 @@ Animation *AnimationManager::addAnimation(int id, uint z, bool playing) { void AnimationManager::play(int id) { Animation *anim = getAnimation(id); - if (anim) + if (anim) { anim->setPlaying(true); - debugC(5, kDraciAnimationDebugLevel, "Playing animation %d...", id); + debugC(5, kDraciAnimationDebugLevel, "Playing animation %d...", id); + } } void AnimationManager::stop(int id) { Animation *anim = getAnimation(id); - if (anim) + if (anim) { anim->setPlaying(false); - - debugC(5, kDraciAnimationDebugLevel, "Stopping animation %d...", id); + + debugC(5, kDraciAnimationDebugLevel, "Stopping animation %d...", id); + } } Animation *AnimationManager::getAnimation(int id) { @@ -212,7 +215,6 @@ void AnimationManager::drawScene(Surface *surf) { // Fill the screen with colour zero since some rooms may rely on the screen being black _vm->_screen->getSurface()->fill(0); - Common::List::iterator it; for (it = _animations.begin(); it != _animations.end(); ++it) { -- cgit v1.2.3