aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/animation.cpp
diff options
context:
space:
mode:
authorDenis Kasak2009-07-29 19:39:10 +0000
committerDenis Kasak2009-07-29 19:39:10 +0000
commitf42894c33cb744759a9cfd64fcc24599a8451572 (patch)
tree1c5a3c3fb4c41c274a69aa4be80e1aa00fc5d225 /engines/draci/animation.cpp
parent07042e31bcabd4c33f38a7c3a41ca6c603525011 (diff)
downloadscummvm-rg350-f42894c33cb744759a9cfd64fcc24599a8451572.tar.gz
scummvm-rg350-f42894c33cb744759a9cfd64fcc24599a8451572.tar.bz2
scummvm-rg350-f42894c33cb744759a9cfd64fcc24599a8451572.zip
Added support for animation callbacks and implemented a few callbacks (doNothing, exitGameLoop, stopAnimation).
svn-id: r42901
Diffstat (limited to 'engines/draci/animation.cpp')
-rw-r--r--engines/draci/animation.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp
index 6cde72a9d2..5ba12fb529 100644
--- a/engines/draci/animation.cpp
+++ b/engines/draci/animation.cpp
@@ -40,6 +40,7 @@ Animation::Animation(DraciEngine *vm, int index) : _vm(vm) {
_looping = false;
_tick = _vm->_system->getMillis();
_currentFrame = 0;
+ _callback = &Animation::doNothing;
}
Animation::~Animation() {
@@ -95,8 +96,8 @@ void Animation::nextFrame(bool force) {
// If we are at the last frame and not looping, stop the animation
// The animation is also restarted to frame zero
if ((_currentFrame == getFrameCount() - 1) && !_looping) {
- // When the animation reaches its end, stop it
- _vm->_anims->stop(_id);
+ // When the animation reaches its end, call the preset callback
+ (this->*_callback)();
// Reset the frame to 0
_currentFrame = 0;
@@ -272,6 +273,14 @@ void Animation::deleteFrames() {
}
}
+void Animation::stopAnimation() {
+ _vm->_anims->stop(_id);
+}
+
+void Animation::exitGameLoop() {
+ _vm->_game->setExitLoop(true);
+}
+
Animation *AnimationManager::addAnimation(int id, uint z, bool playing) {
// Increment animation index