summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-19 15:21:11 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-19 15:21:11 +0300
commitad3ee95f90bfd368a511407c13718b900e44be0f (patch)
treef3f41b9802d684d784b7cef05e0d6ae2383b5e5b /src/being
parentfba4289e53447a09dcf82211e2dab3563e2581f1 (diff)
downloadplus-ad3ee95f90bfd368a511407c13718b900e44be0f.tar.gz
plus-ad3ee95f90bfd368a511407c13718b900e44be0f.tar.bz2
plus-ad3ee95f90bfd368a511407c13718b900e44be0f.tar.xz
plus-ad3ee95f90bfd368a511407c13718b900e44be0f.zip
Move spritedirection into separate file.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp32
-rw-r--r--src/being/being.h4
-rw-r--r--src/being/compoundsprite.cpp2
-rw-r--r--src/being/compoundsprite.h2
4 files changed, 20 insertions, 20 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 513fe9322..5eb26d1a3 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -154,7 +154,7 @@ Being::Being(const int id,
mSubType(0xFFFF),
mDirection(BeingDirection::DOWN),
mDirectionDelayed(0),
- mSpriteDirection(DIRECTION_DOWN),
+ mSpriteDirection(SpriteDirection::DOWN),
mShowName(false),
mIsGM(false),
mType(type),
@@ -1177,17 +1177,17 @@ void Being::setAction(const BeingAction::Action &action, const int attackId)
int rotation;
switch (mSpriteDirection)
{
- case DIRECTION_DOWN:
+ case SpriteDirection::DOWN:
default:
rotation = 0;
break;
- case DIRECTION_LEFT:
+ case SpriteDirection::LEFT:
rotation = 90;
break;
- case DIRECTION_UP:
+ case SpriteDirection::UP:
rotation = 180;
break;
- case DIRECTION_RIGHT:
+ case SpriteDirection::RIGHT:
rotation = 270;
break;
}
@@ -1262,32 +1262,32 @@ void Being::setDirection(const uint8_t direction)
if (!mFaceDirection)
mFaceDirection = direction;
- SpriteDirection dir;
+ SpriteDirection::Type dir;
if (mFaceDirection & BeingDirection::UP)
{
if (mFaceDirection & BeingDirection::LEFT)
- dir = DIRECTION_UPLEFT;
+ dir = SpriteDirection::UPLEFT;
else if (mFaceDirection & BeingDirection::RIGHT)
- dir = DIRECTION_UPRIGHT;
+ dir = SpriteDirection::UPRIGHT;
else
- dir = DIRECTION_UP;
+ dir = SpriteDirection::UP;
}
else if (mFaceDirection & BeingDirection::DOWN)
{
if (mFaceDirection & BeingDirection::LEFT)
- dir = DIRECTION_DOWNLEFT;
+ dir = SpriteDirection::DOWNLEFT;
else if (mFaceDirection & BeingDirection::RIGHT)
- dir = DIRECTION_DOWNRIGHT;
+ dir = SpriteDirection::DOWNRIGHT;
else
- dir = DIRECTION_DOWN;
+ dir = SpriteDirection::DOWN;
}
else if (mFaceDirection & BeingDirection::RIGHT)
{
- dir = DIRECTION_RIGHT;
+ dir = SpriteDirection::RIGHT;
}
else
{
- dir = DIRECTION_LEFT;
+ dir = SpriteDirection::LEFT;
}
mSpriteDirection = static_cast<uint8_t>(dir);
@@ -2992,8 +2992,8 @@ void Being::setEmote(const uint8_t emotion, const int emote_time)
if (mEmotionSprite)
{
mEmotionSprite->play(mSpriteAction);
- mEmotionSprite->setSpriteDirection(static_cast<SpriteDirection>(
- mSpriteDirection));
+ mEmotionSprite->setSpriteDirection(
+ static_cast<SpriteDirection::Type>(mSpriteDirection));
}
else
{
diff --git a/src/being/being.h b/src/being/being.h
index 020c97e45..9ae57d545 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -492,8 +492,8 @@ class Being : public ActorSprite, public ConfigListener
/**
* Returns the direction the being is facing.
*/
- SpriteDirection getSpriteDirection() const A_WARN_UNUSED
- { return static_cast<SpriteDirection>(mSpriteDirection); }
+ SpriteDirection::Type getSpriteDirection() const A_WARN_UNUSED
+ { return static_cast<SpriteDirection::Type>(mSpriteDirection); }
void setPosition(const Vector &pos) override;
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index d355deafc..35599978b 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -196,7 +196,7 @@ const Image *CompoundSprite::getImage() const
return mImage;
}
-bool CompoundSprite::setSpriteDirection(const SpriteDirection direction)
+bool CompoundSprite::setSpriteDirection(const SpriteDirection::Type direction)
{
bool ret = false;
FOR_EACH (SpriteIterator, it, mSprites)
diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h
index b36da2d1f..05559045e 100644
--- a/src/being/compoundsprite.h
+++ b/src/being/compoundsprite.h
@@ -65,7 +65,7 @@ public:
virtual const Image *getImage() const override final A_WARN_UNUSED;
- virtual bool setSpriteDirection(const SpriteDirection direction)
+ virtual bool setSpriteDirection(const SpriteDirection::Type direction)
override final;
int getNumberOfLayers() const A_WARN_UNUSED;