diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-09-16 13:50:27 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-09-16 13:50:27 +0000 |
commit | 3dd5378899a9bf12b3c17ff39d9390155a5a49d2 (patch) | |
tree | 86aa88bb4f5a3f9fef17d57289486191a8fb5db0 /src/animatedsprite.cpp | |
parent | b9b94c857cbf2dbf6036b86e7d59be649c018eac (diff) | |
download | mana-3dd5378899a9bf12b3c17ff39d9390155a5a49d2.tar.gz mana-3dd5378899a9bf12b3c17ff39d9390155a5a49d2.tar.bz2 mana-3dd5378899a9bf12b3c17ff39d9390155a5a49d2.tar.xz mana-3dd5378899a9bf12b3c17ff39d9390155a5a49d2.zip |
Fixed line-endings and set missing properties.
Diffstat (limited to 'src/animatedsprite.cpp')
-rw-r--r-- | src/animatedsprite.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index a6d8eaf7..269e1fe6 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -18,7 +18,7 @@ * along with The Mana World; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: animation.cpp 2430 2006-07-24 00:13:24Z b_lindeijer $ + * $Id$ */ #include "animatedsprite.h" @@ -103,26 +103,26 @@ AnimatedSprite::AnimatedSprite(const std::string& animationFile, int variant): Action *action = new Action(); - action->setSpriteset(mSpritesets[imageset]);
-
- SpriteAction actionname = makeSpriteAction(name);
- if (actionname == ACTION_INVALID)
- {
-
- logger->log("Warning: Unknown action \"%s\" defined in %s",
- name.c_str(),
- animationFile.c_str());
- continue;
- }
- else {
- mActions[makeSpriteAction(name)] = action;
-
- // When first action set it as default direction
- if (mActions.empty())
- {
- mActions[ACTION_DEFAULT] = action;
- }
- };
+ action->setSpriteset(mSpritesets[imageset]); + + SpriteAction actionname = makeSpriteAction(name); + if (actionname == ACTION_INVALID) + { + + logger->log("Warning: Unknown action \"%s\" defined in %s", + name.c_str(), + animationFile.c_str()); + continue; + } + else { + mActions[makeSpriteAction(name)] = action; + + // When first action set it as default direction + if (mActions.empty()) + { + mActions[ACTION_DEFAULT] = action; + } + }; // get animations @@ -175,7 +175,7 @@ AnimatedSprite::AnimatedSprite(const std::string& animationFile, int variant): } // for node // Complete missing actions - substituteAction(ACTION_STAND, ACTION_DEFAULT);
+ substituteAction(ACTION_STAND, ACTION_DEFAULT); substituteAction(ACTION_WALK, ACTION_STAND); substituteAction(ACTION_WALK, ACTION_RUN); substituteAction(ACTION_ATTACK, ACTION_STAND); @@ -296,7 +296,7 @@ AnimatedSprite::update(int time) // If not enough time has passed yet, do nothing if (time > mLastTime && mAction) { - Animation *animation = mAction->getAnimation(mDirection);
+ Animation *animation = mAction->getAnimation(mDirection); if (animation != NULL) { animation->update((unsigned int)((time - mLastTime) * mSpeed));} mLastTime = time; @@ -309,9 +309,9 @@ AnimatedSprite::draw(Graphics* graphics, Sint32 posX, Sint32 posY) const if (!mAction) return false; - Animation *animation = mAction->getAnimation(mDirection);
- if (animation == NULL) return false;
-
+ Animation *animation = mAction->getAnimation(mDirection); + if (animation == NULL) return false; + int phase = animation->getCurrentPhase(); if (phase < 0) return false; @@ -337,9 +337,9 @@ AnimatedSprite::getHeight() const SpriteAction AnimatedSprite::makeSpriteAction(const std::string& action) -{
- if (action == "" || action == "default") {
- return ACTION_DEFAULT;
+{ + if (action == "" || action == "default") { + return ACTION_DEFAULT; } if (action == "stand") { return ACTION_STAND; |