From 3dd5378899a9bf12b3c17ff39d9390155a5a49d2 Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Sat, 16 Sep 2006 13:50:27 +0000 Subject: Fixed line-endings and set missing properties. --- src/animatedsprite.cpp | 58 +++++++++++++++++++++++++------------------------- src/animatedsprite.h | 4 ++-- 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src') 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; diff --git a/src/animatedsprite.h b/src/animatedsprite.h index c860b46d..7ca87237 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -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.h 2430 2006-07-24 00:13:24Z b_lindeijer $ + * $Id$ */ #ifndef _TMW_ANIMATEDSPRITE_H @@ -50,7 +50,7 @@ enum SpriteAction ACTION_SIT, ACTION_SLEEP, ACTION_HURT, - ACTION_DEAD, + ACTION_DEAD, ACTION_INVALID }; -- cgit v1.2.3-70-g09d2