summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-01 10:49:36 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-01 10:49:36 +0000
commit73911893133028a855931b037ed4e90217d5503a (patch)
tree24eaed10128754db9436ea9bd333d169f041cc0c /src/being.cpp
parent768cf33e1b66994379ac757aae0589bee83a2e7f (diff)
downloadmana-73911893133028a855931b037ed4e90217d5503a.tar.gz
mana-73911893133028a855931b037ed4e90217d5503a.tar.bz2
mana-73911893133028a855931b037ed4e90217d5503a.tar.xz
mana-73911893133028a855931b037ed4e90217d5503a.zip
Third time is the charm; changed sprite direction code again.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 1018b8e1..68c670fd 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -60,7 +60,7 @@ Being::Being(Uint16 id, Uint16 job, Map *map):
mWeapon(0),
mWalkSpeed(150),
mSpeedModifier(1024),
- mFaceDirection(DOWN), mDirection(DOWN),
+ mSpriteDirection(DIRECTION_DOWN), mDirection(DOWN),
mMap(NULL),
mHairStyle(0), mHairColor(0),
mSpeechTime(0),
@@ -372,24 +372,12 @@ Being::setDirection(Uint8 direction)
return;
// if the direction does not change much, keep the common component
- mFaceDirection = mDirection & direction;
+ int mFaceDirection = mDirection & direction;
if (!mFaceDirection)
mFaceDirection = direction;
mDirection = direction;
- SpriteDirection dir = getSpriteDirection();
- for (int i = 0; i < VECTOREND_SPRITE; i++)
- {
- if (mSprites[i] != NULL)
- mSprites[i]->setDirection(dir);
- }
-}
-
-SpriteDirection
-Being::getSpriteDirection() const
-{
SpriteDirection dir;
-
if (mFaceDirection & UP)
{
dir = DIRECTION_UP;
@@ -406,8 +394,13 @@ Being::getSpriteDirection() const
{
dir = DIRECTION_LEFT;
}
+ mSpriteDirection = dir;
- return dir;
+ for (int i = 0; i < VECTOREND_SPRITE; i++)
+ {
+ if (mSprites[i] != NULL)
+ mSprites[i]->setDirection(dir);
+ }
}
void