aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/animation.cpp
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/animation.cpp
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/animation.cpp')
-rw-r--r--engines/draci/animation.cpp17
1 files changed, 14 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);
}