aboutsummaryrefslogtreecommitdiff
path: root/engines/draci
diff options
context:
space:
mode:
authorDenis Kasak2009-07-30 01:12:07 +0000
committerDenis Kasak2009-07-30 01:12:07 +0000
commitb124c8b1225627def357b284e43d9890e1fda79a (patch)
treefc23bcb19684165230506479a0908ec669653b2b /engines/draci
parent6ed99df75aadeb8c3844c7d4546735afbd1831de (diff)
downloadscummvm-rg350-b124c8b1225627def357b284e43d9890e1fda79a.tar.gz
scummvm-rg350-b124c8b1225627def357b284e43d9890e1fda79a.tar.bz2
scummvm-rg350-b124c8b1225627def357b284e43d9890e1fda79a.zip
* Added Animation::setCurrentFrame()
* Moved rewinding the animation to the beginning from Animation::nextFrame() to AnimationManager::stop() (fixes the owl animation) svn-id: r42913
Diffstat (limited to 'engines/draci')
-rw-r--r--engines/draci/animation.cpp17
-rw-r--r--engines/draci/animation.h1
2 files changed, 15 insertions, 3 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp
index 5ba12fb529..c5c33153ea 100644
--- a/engines/draci/animation.cpp
+++ b/engines/draci/animation.cpp
@@ -98,9 +98,6 @@ void Animation::nextFrame(bool force) {
if ((_currentFrame == getFrameCount() - 1) && !_looping) {
// When the animation reaches its end, call the preset callback
(this->*_callback)();
-
- // Reset the frame to 0
- _currentFrame = 0;
} else {
// Mark old frame dirty so it gets deleted
markDirtyRect(surface);
@@ -258,6 +255,16 @@ uint Animation::currentFrameNum() {
return _currentFrame;
}
+void Animation::setCurrentFrame(uint frame) {
+
+ // Check whether the value is sane
+ if (frame > _frames.size()) {
+ return;
+ }
+
+ _currentFrame = frame;
+}
+
void Animation::deleteFrames() {
// If there are no frames to delete, return
@@ -331,6 +338,10 @@ void AnimationManager::stop(int id) {
anim->markDirtyRect(_vm->_screen->getSurface());
anim->setPlaying(false);
+
+ // Reset the animation to the beginning
+ anim->setCurrentFrame(0);
+
debugC(3, kDraciAnimationDebugLevel, "Stopping animation %d...", id);
}
diff --git a/engines/draci/animation.h b/engines/draci/animation.h
index 3fd4b67114..a6ab07a9a4 100644
--- a/engines/draci/animation.h
+++ b/engines/draci/animation.h
@@ -69,6 +69,7 @@ public:
void addFrame(Drawable *frame);
Drawable *getFrame(int frameNum = kCurrentFrame);
+ void setCurrentFrame(uint frame);
uint currentFrameNum();
uint getFrameCount();
void deleteFrames();