From 8a458bbf5bc6fcfa66d6e96e0dea1ec20b2fd0d9 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 16 Nov 2008 16:21:37 +0100 Subject: Got rid of CVS/Subversion $Id$ markers I don't know why we dealt with these things for so long. Did we ever get anything out of it? --- src/animatedsprite.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/animatedsprite.cpp') diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 466779fd..840fb1e8 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -17,8 +17,6 @@ * You should have received a copy of the GNU General Public License * 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$ */ #include "animatedsprite.h" -- cgit v1.2.3-60-g2f50 From 84cfc5ac9929d2190d9fb19fa411b72d90bb2185 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 6 Dec 2008 23:48:15 +0100 Subject: Some code formatting --- src/animatedsprite.cpp | 57 +++++++++++--------------------------------------- 1 file changed, 12 insertions(+), 45 deletions(-) (limited to 'src/animatedsprite.cpp') diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 840fb1e8..203a82af 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -56,7 +56,8 @@ AnimatedSprite *AnimatedSprite::load(const std::string& filename, int variant) { ResourceManager *resman = ResourceManager::getInstance(); SpriteDef *s = resman->getSprite(filename, variant); - if (!s) return NULL; + if (!s) + return NULL; AnimatedSprite *as = new AnimatedSprite(s); s->decRef(); return as; @@ -67,22 +68,18 @@ AnimatedSprite::~AnimatedSprite() mSprite->decRef(); } -void -AnimatedSprite::reset() +void AnimatedSprite::reset() { mFrameIndex = 0; mFrameTime = 0; mLastTime = 0; } -void -AnimatedSprite::play(SpriteAction spriteAction) +void AnimatedSprite::play(SpriteAction spriteAction) { Action *action = mSprite->getAction(spriteAction); if (!action) - { return; - } mAction = action; Animation *animation = mAction->getAnimation(mDirection); @@ -96,20 +93,15 @@ AnimatedSprite::play(SpriteAction spriteAction) } } -void -AnimatedSprite::update(int time) +void AnimatedSprite::update(int time) { // Avoid freaking out at first frame or when tick_time overflows if (time < mLastTime || mLastTime == 0) - { mLastTime = time; - } // If not enough time has passed yet, do nothing if (time <= mLastTime || !mAnimation) - { return; - } unsigned int dt = time - mLastTime; mLastTime = time; @@ -121,13 +113,10 @@ AnimatedSprite::update(int time) } } -bool -AnimatedSprite::updateCurrentAnimation(unsigned int time) +bool AnimatedSprite::updateCurrentAnimation(unsigned int time) { if (!mFrame || Animation::isTerminator(*mFrame)) - { return false; - } mFrameTime += time; @@ -137,9 +126,7 @@ AnimatedSprite::updateCurrentAnimation(unsigned int time) mFrameIndex++; if (mFrameIndex == mAnimation->getLength()) - { mFrameIndex = 0; - } mFrame = mAnimation->getFrame(mFrameIndex); @@ -154,30 +141,24 @@ AnimatedSprite::updateCurrentAnimation(unsigned int time) return true; } -bool -AnimatedSprite::draw(Graphics* graphics, int posX, int posY) const +bool AnimatedSprite::draw(Graphics* graphics, int posX, int posY) const { if (!mFrame || !mFrame->image) - { return false; - } return graphics->drawImage(mFrame->image, posX + mFrame->offsetX, posY + mFrame->offsetY); } -void -AnimatedSprite::setDirection(SpriteDirection direction) +void AnimatedSprite::setDirection(SpriteDirection direction) { if (mDirection != direction) { mDirection = direction; if (!mAction) - { return; - } Animation *animation = mAction->getAnimation(mDirection); @@ -190,26 +171,12 @@ AnimatedSprite::setDirection(SpriteDirection direction) } } -int -AnimatedSprite::getWidth() const +int AnimatedSprite::getWidth() const { - if (mFrame) - { - return mFrame->image->getWidth(); - } - else { - return 0; - } + return mFrame ? mFrame->image->getWidth() : 0; } -int -AnimatedSprite::getHeight() const +int AnimatedSprite::getHeight() const { - if (mFrame) - { - return mFrame->image->getHeight(); - } - else { - return 0; - } + return mFrame ? mFrame->image->getHeight() : 0; } -- cgit v1.2.3-60-g2f50