[Scummvm-cvs-logs] SF.net SVN: scummvm:[42901] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Wed Jul 29 21:39:11 CEST 2009
Revision: 42901
http://scummvm.svn.sourceforge.net/scummvm/?rev=42901&view=rev
Author: dkasak13
Date: 2009-07-29 19:39:10 +0000 (Wed, 29 Jul 2009)
Log Message:
-----------
Added support for animation callbacks and implemented a few callbacks (doNothing, exitGameLoop, stopAnimation).
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/animation.cpp
scummvm/branches/gsoc2009-draci/engines/draci/animation.h
Modified: scummvm/branches/gsoc2009-draci/engines/draci/animation.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/animation.cpp 2009-07-29 19:39:03 UTC (rev 42900)
+++ scummvm/branches/gsoc2009-draci/engines/draci/animation.cpp 2009-07-29 19:39:10 UTC (rev 42901)
@@ -40,6 +40,7 @@
_looping = false;
_tick = _vm->_system->getMillis();
_currentFrame = 0;
+ _callback = &Animation::doNothing;
}
Animation::~Animation() {
@@ -95,8 +96,8 @@
// 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::stopAnimation() {
+ _vm->_anims->stop(_id);
+}
+
+void Animation::exitGameLoop() {
+ _vm->_game->setExitLoop(true);
+}
+
Animation *AnimationManager::addAnimation(int id, uint z, bool playing) {
// Increment animation index
Modified: scummvm/branches/gsoc2009-draci/engines/draci/animation.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/animation.h 2009-07-29 19:39:03 UTC (rev 42900)
+++ scummvm/branches/gsoc2009-draci/engines/draci/animation.h 2009-07-29 19:39:10 UTC (rev 42901)
@@ -51,7 +51,9 @@
class DraciEngine;
class Animation {
-
+
+typedef void (Animation::* AnimationCallback)();
+
public:
Animation(DraciEngine *v, int index);
~Animation();
@@ -90,6 +92,14 @@
void markDirtyRect(Surface *surface);
+ // Animation callbacks
+
+ void registerCallback(AnimationCallback callback) { _callback = callback; }
+
+ void doNothing() {}
+ void stopAnimation();
+ void exitGameLoop();
+
private:
uint nextFrameNum();
@@ -118,6 +128,8 @@
bool _looping;
Common::Array<Drawable*> _frames;
+ AnimationCallback _callback;
+
DraciEngine *_vm;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list