summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-08-05 02:20:34 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-08-05 02:20:34 +0000
commitd25e1c9b0dac7fcfe803083af1189489d5a9ad88 (patch)
tree330e30558d62c4de99976305390a976fd5f8d958 /src/being.cpp
parent97f1e5345cc8a88fed9c65035f2b01fc2eaf9cbd (diff)
downloadmana-d25e1c9b0dac7fcfe803083af1189489d5a9ad88.tar.gz
mana-d25e1c9b0dac7fcfe803083af1189489d5a9ad88.tar.bz2
mana-d25e1c9b0dac7fcfe803083af1189489d5a9ad88.tar.xz
mana-d25e1c9b0dac7fcfe803083af1189489d5a9ad88.zip
Some cleanups, mostly lowering indentation levels.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/being.cpp b/src/being.cpp
index a688aec5..1ca8929a 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -205,18 +205,18 @@ Being::setAction(Uint8 action)
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
- if (mSprites[i] != NULL)
- {
- if (currentAction == ACTION_ATTACK ||
+ if (!mSprites[i])
+ continue;
+
+ if (currentAction == ACTION_ATTACK ||
currentAction == ACTION_ATTACK_STAB ||
currentAction == ACTION_ATTACK_BOW)
- {
- mSprites[i]->play(currentAction, mAttackSpeed);
- }
- else
- {
- mSprites[i]->play(currentAction);
- }
+ {
+ mSprites[i]->play(currentAction, mAttackSpeed);
+ }
+ else
+ {
+ mSprites[i]->play(currentAction);
}
}
@@ -231,7 +231,8 @@ Being::setDirection(Uint8 direction)
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
- if (mSprites[i] != NULL) mSprites[i]->setDirection(dir);
+ if (mSprites[i] != NULL)
+ mSprites[i]->setDirection(dir);
}
}
@@ -332,10 +333,6 @@ Being::draw(Graphics *graphics, int offsetX, int offsetY)
int px = mPx + offsetX;
int py = mPy + offsetY;
- //what are these two lines good for? please add a comment.
- unsigned char dir = 0;
- while (!(mDirection & (1 << dir))) dir++;
-
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
if (mSprites[i] != NULL)
@@ -348,14 +345,13 @@ Being::draw(Graphics *graphics, int offsetX, int offsetY)
void
Being::drawEmotion(Graphics *graphics, Sint32 offsetX, Sint32 offsetY)
{
- int px = mPx + offsetX;
- int py = mPy + offsetY;
+ if (!mEmotion)
+ return;
- if (mEmotion)
- {
- graphics->drawImage(emotionset->get(mEmotion - 1),
- px + 3, py - 60);
- }
+ int px = mPx + offsetX + 3;
+ int py = mPy + offsetY - 60;
+
+ graphics->drawImage(emotionset->get(mEmotion - 1), px, py);
}
void