aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kasak2009-07-14 18:11:33 +0000
committerDenis Kasak2009-07-14 18:11:33 +0000
commit6d51a3ead4eae4a2c8fbb8cce20b4c1e4bbd4c64 (patch)
treeaad68fa374766918508227a8b0caa2fc4b62a379
parentd5e16118461290b13af19bd37b8b30bea6c15528 (diff)
downloadscummvm-rg350-6d51a3ead4eae4a2c8fbb8cce20b4c1e4bbd4c64.tar.gz
scummvm-rg350-6d51a3ead4eae4a2c8fbb8cce20b4c1e4bbd4c64.tar.bz2
scummvm-rg350-6d51a3ead4eae4a2c8fbb8cce20b4c1e4bbd4c64.zip
* 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
-rw-r--r--engines/draci/animation.cpp20
1 files 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<Animation *>::iterator it;
for (it = _animations.begin(); it != _animations.end(); ++it) {