diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-02 23:05:46 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-02 23:05:46 +0000 |
commit | 8676da1517a86105e4cb4970fd3a7886f7d0c214 (patch) | |
tree | 5c4b3b7748c62d9375799f375e13c4b58a89498a /src/animatedsprite.cpp | |
parent | 8714de88fe9715b5a4014f16d15bc55f8860cdcf (diff) | |
download | mana-8676da1517a86105e4cb4970fd3a7886f7d0c214.tar.gz mana-8676da1517a86105e4cb4970fd3a7886f7d0c214.tar.bz2 mana-8676da1517a86105e4cb4970fd3a7886f7d0c214.tar.xz mana-8676da1517a86105e4cb4970fd3a7886f7d0c214.zip |
Some cleanups, fixes and a small start on a solution for the animated sprite
synchronization problem (resetting all animations).
Diffstat (limited to 'src/animatedsprite.cpp')
-rw-r--r-- | src/animatedsprite.cpp | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 0e93ad97..3ea400ac 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -228,6 +228,19 @@ AnimatedSprite::~AnimatedSprite() } void +AnimatedSprite::reset() +{ + // Reset all defined actions (because of aliases, some will be resetted + // multiple times) + for (ActionIterator i = mActions.begin(); i != mActions.end(); ++i) + { + //TODO: If resetting everything is really a nice way of fixing the + // synchronization issues, finish implementing this. + //i->second->reset(); + } +} + +void AnimatedSprite::play(SpriteAction action, int time) { ActionIterator i = mActions.find(action); @@ -306,66 +319,62 @@ AnimatedSprite::makeSpriteAction(const std::string& action) return ACTION_STAND; } else if (action == "walk") { - return ACTION_WALK; + return ACTION_WALK; } else if (action == "run") { - return ACTION_RUN; + return ACTION_RUN; } else if (action == "attack") { - return ACTION_ATTACK; + return ACTION_ATTACK; } else if (action == "attack_swing") { - return ACTION_ATTACK_SWING; + return ACTION_ATTACK_SWING; } else if (action == "attack_stab") { - return ACTION_ATTACK_STAB; + return ACTION_ATTACK_STAB; } else if (action == "attack_bow") { - return ACTION_ATTACK_BOW; + return ACTION_ATTACK_BOW; } else if (action == "attack_throw") { - return ACTION_ATTACK_THROW; + return ACTION_ATTACK_THROW; } else if (action == "cast_magic") { - return ACTION_CAST_MAGIC; + return ACTION_CAST_MAGIC; } else if (action == "use_item") { - return ACTION_USE_ITEM; + return ACTION_USE_ITEM; } else if (action == "sit") { - return ACTION_SIT; + return ACTION_SIT; } else if (action == "sleep") { - return ACTION_SLEEP; + return ACTION_SLEEP; } else if (action == "hurt") { - return ACTION_HURT; + return ACTION_HURT; } else if (action == "dead") { - return ACTION_DEAD; + return ACTION_DEAD; } - else - { + else { return ACTION_DEFAULT; } } - - SpriteDirection AnimatedSprite::makeSpriteDirection(const std::string& direction) { if (direction == "up") { - return DIRECTION_UP; + return DIRECTION_UP; } else if (direction == "left") { - return DIRECTION_LEFT; + return DIRECTION_LEFT; } else if (direction == "right") { - return DIRECTION_RIGHT; + return DIRECTION_RIGHT; } - else - { + else { return DIRECTION_DOWN; } } |