summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-06 23:48:15 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-06 23:50:38 +0100
commit8f1048c7b30631a1e3caca6aca7dcb63220b6fb7 (patch)
treeb7eb2a678efe3a57f8fd4b94dc4817e4bc213c4a /src
parent98c58bb9d3d39e4edbff05387b905a6c0fffa85d (diff)
downloadmana-8f1048c7b30631a1e3caca6aca7dcb63220b6fb7.tar.gz
mana-8f1048c7b30631a1e3caca6aca7dcb63220b6fb7.tar.bz2
mana-8f1048c7b30631a1e3caca6aca7dcb63220b6fb7.tar.xz
mana-8f1048c7b30631a1e3caca6aca7dcb63220b6fb7.zip
Some code formatting
Diffstat (limited to 'src')
-rw-r--r--src/animatedsprite.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index b2bb1f28..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,8 +141,7 @@ 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;
@@ -165,8 +151,7 @@ AnimatedSprite::draw(Graphics* graphics, int posX, int posY) const
posY + mFrame->offsetY);
}
-void
-AnimatedSprite::setDirection(SpriteDirection direction)
+void AnimatedSprite::setDirection(SpriteDirection direction)
{
if (mDirection != direction)
{