From f42894c33cb744759a9cfd64fcc24599a8451572 Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Wed, 29 Jul 2009 19:39:10 +0000 Subject: Added support for animation callbacks and implemented a few callbacks (doNothing, exitGameLoop, stopAnimation). svn-id: r42901 --- engines/draci/animation.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'engines/draci/animation.cpp') 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 -- cgit v1.2.3