summaryrefslogtreecommitdiff
path: root/src/animation.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-26 18:50:34 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-26 18:50:34 +0000
commitef82a7df8aafb569f6db5e77ff2dd67fde860148 (patch)
tree202a461e6d9d426ef1d080ec554334a195fa709a /src/animation.cpp
parentc3a3b608b3f9a7b2edb3a7132af5dffde1a9e3c2 (diff)
downloadmana-ef82a7df8aafb569f6db5e77ff2dd67fde860148.tar.gz
mana-ef82a7df8aafb569f6db5e77ff2dd67fde860148.tar.bz2
mana-ef82a7df8aafb569f6db5e77ff2dd67fde860148.tar.xz
mana-ef82a7df8aafb569f6db5e77ff2dd67fde860148.zip
Applied patch by Bahamut81 which implements resetting of Animation, Action and
AnimatedSprite. This fixes the animation synchronization issues.
Diffstat (limited to 'src/animation.cpp')
-rw-r--r--src/animation.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/animation.cpp b/src/animation.cpp
index 1213d0d6..c1b27ebd 100644
--- a/src/animation.cpp
+++ b/src/animation.cpp
@@ -27,9 +27,15 @@
#include "utils/dtor.h"
-Animation::Animation():
- mTime(0)
+Animation::Animation()
{
+ reset();
+}
+
+void
+Animation::reset()
+{
+ mTime = 0;
iCurrentPhase = mAnimationPhases.begin();
}
@@ -123,3 +129,13 @@ Action::setAnimation(int direction, Animation *animation)
mAnimations[direction] = animation;
}
+
+void
+Action::reset()
+{
+ for (AnimationIterator i = mAnimations.begin();
+ i != mAnimations.end(); ++i)
+ {
+ i->second->reset();
+ }
+}