summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-13 18:50:18 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-13 18:50:18 +0300
commit8a8ef403f70b43458f90b6192ce8cedcf2c9a209 (patch)
treee20104d00dd25ba04d37bb8e3aef36891cb925a1 /src/being/being.cpp
parentac56a47abb8b6a2dc184e1a39c3c7989fd135550 (diff)
downloadmanaplus-8a8ef403f70b43458f90b6192ce8cedcf2c9a209.tar.gz
manaplus-8a8ef403f70b43458f90b6192ce8cedcf2c9a209.tar.bz2
manaplus-8a8ef403f70b43458f90b6192ce8cedcf2c9a209.tar.xz
manaplus-8a8ef403f70b43458f90b6192ce8cedcf2c9a209.zip
Separate Being::draw function into drawPlayer and drawOther.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp50
1 files changed, 47 insertions, 3 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 7be22145b..b37db6c62 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2839,9 +2839,9 @@ void Being::talkTo() const restrict2
npcHandler->talk(mId);
}
-void Being::draw(Graphics *restrict const graphics,
- const int offsetX,
- const int offsetY) const restrict2
+void Being::drawPlayer(Graphics *restrict const graphics,
+ const int offsetX,
+ const int offsetY) const restrict2
{
if (!mErased)
{
@@ -2881,6 +2881,50 @@ void Being::draw(Graphics *restrict const graphics,
}
}
+void Being::drawOther(Graphics *restrict const graphics,
+ const int offsetX,
+ const int offsetY) const restrict2
+{
+ // getActorX() + offsetX;
+ const int px = mPixelX - mapTileSize / 2 + offsetX;
+ // getActorY() + offsetY;
+ const int py = mPixelY - mapTileSize + offsetY;
+ ActorSprite::draw1(graphics, px, py);
+ drawSpriteAt(graphics, px, py);
+}
+
+void Being::draw(Graphics *restrict const graphics,
+ const int offsetX,
+ const int offsetY) const restrict2
+{
+ switch (mType)
+ {
+ case ActorType::Player:
+ drawPlayer(graphics,
+ offsetX,
+ offsetY);
+ break;
+ case ActorType::Npc:
+ case ActorType::Monster:
+ case ActorType::FloorItem:
+ case ActorType::Portal:
+ case ActorType::LocalPet:
+ case ActorType::Avatar:
+#ifdef EATHENA_SUPPORT
+ case ActorType::Pet:
+ case ActorType::Mercenary:
+ case ActorType::Homunculus:
+ case ActorType::SkillUnit:
+ case ActorType::Unknown:
+#endif
+ default:
+ drawOther(graphics,
+ offsetX,
+ offsetY);
+ break;
+ }
+}
+
void Being::drawSprites(Graphics *restrict const graphics,
const int posX,
const int posY) const restrict2