summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-18 15:37:01 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-18 15:37:01 +0300
commitae7d05fce2107e762e84a287f33f2dbad60abd7d (patch)
treea9d8ce99e98eda697c2b4e8e19d8473b8fedc14a /src/being
parent3e1eec6460461242ff6548f8c542e0c020d18c4a (diff)
downloadmv-ae7d05fce2107e762e84a287f33f2dbad60abd7d.tar.gz
mv-ae7d05fce2107e762e84a287f33f2dbad60abd7d.tar.bz2
mv-ae7d05fce2107e762e84a287f33f2dbad60abd7d.tar.xz
mv-ae7d05fce2107e762e84a287f33f2dbad60abd7d.zip
Split horse into two sprites before player and after player.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp54
-rw-r--r--src/being/being.h3
2 files changed, 38 insertions, 19 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index b8f4ce414..711fcf233 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -194,7 +194,8 @@ Being::Being(const BeingId id,
#ifdef EATHENA_SUPPORT
mChat(nullptr),
mHorseInfo(nullptr),
- mHorseSprite(nullptr),
+ mDownHorseSprite(nullptr),
+ mUpHorseSprite(nullptr),
#endif
mX(0),
mY(0),
@@ -1439,8 +1440,10 @@ void Being::setAction(const BeingActionT &action, const int attackId)
sprite->play(currentAction);
}
#ifdef EATHENA_SUPPORT
- if (mHorseSprite)
- mHorseSprite->play(currentAction);
+ if (mDownHorseSprite)
+ mDownHorseSprite->play(currentAction);
+ if (mUpHorseSprite)
+ mUpHorseSprite->play(currentAction);
#endif
mAction = action;
}
@@ -1510,8 +1513,10 @@ void Being::setDirection(const uint8_t direction)
}
#ifdef EATHENA_SUPPORT
- if (mHorseSprite)
- mHorseSprite->setSpriteDirection(dir);
+ if (mDownHorseSprite)
+ mDownHorseSprite->setSpriteDirection(dir);
+ if (mUpHorseSprite)
+ mUpHorseSprite->setSpriteDirection(dir);
#endif
recalcSpritesOrder();
}
@@ -1603,8 +1608,10 @@ void Being::logic()
if (mEmotionSprite)
mEmotionSprite->update(time);
#ifdef EATHENA_SUPPORT
- if (mHorseSprite)
- mHorseSprite->update(time);
+ if (mDownHorseSprite)
+ mDownHorseSprite->update(time);
+ if (mUpHorseSprite)
+ mUpHorseSprite->update(time);
#endif
if (mAnimationEffect)
@@ -2669,19 +2676,23 @@ void Being::draw(Graphics *const graphics,
const int px = getActorX() + offsetX;
const int py = getActorY() + offsetY;
#ifdef EATHENA_SUPPORT
- if (mHorseInfo)
+ if (mDownHorseSprite)
{
- AnimatedSprite *const sprite = mHorseInfo->sprite;
- if (sprite)
- {
- sprite->draw(graphics,
- px + mHorseInfo->offsetX,
- py + mHorseInfo->offsetY);
- }
+ mDownHorseSprite->draw(graphics,
+ px + mHorseInfo->downOffsetX,
+ py + mHorseInfo->downOffsetY);
}
#endif
ActorSprite::draw1(graphics, px, py);
drawSpriteAt(graphics, px, py);
+#ifdef EATHENA_SUPPORT
+ if (mUpHorseSprite)
+ {
+ mUpHorseSprite->draw(graphics,
+ px + mHorseInfo->upOffsetX,
+ py + mHorseInfo->upOffsetY);
+ }
+#endif
}
}
@@ -4031,14 +4042,21 @@ void Being::setRiding(const bool b)
{
mHorseInfo = HorseDB::get(1);
if (mHorseInfo)
- mHorseSprite = mHorseInfo->sprite;
+ {
+ mDownHorseSprite = mHorseInfo->downSprite;
+ mUpHorseSprite = mHorseInfo->upSprite;
+ }
else
- mHorseSprite = nullptr;
+ {
+ mDownHorseSprite = nullptr;
+ mUpHorseSprite = nullptr;
+ }
}
else
{
mHorseInfo = nullptr;
- mHorseSprite = nullptr;
+ mDownHorseSprite = nullptr;
+ mUpHorseSprite = nullptr;
}
}
#endif
diff --git a/src/being/being.h b/src/being/being.h
index 8253cca55..09da505c5 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -1087,7 +1087,8 @@ class Being notfinal : public ActorSprite,
ChatObject *mChat;
HorseInfo *mHorseInfo;
#endif
- AnimatedSprite *mHorseSprite;
+ AnimatedSprite *mDownHorseSprite;
+ AnimatedSprite *mUpHorseSprite;
int mX; // position in tiles
int mY; // position in tiles