From 8a8ef403f70b43458f90b6192ce8cedcf2c9a209 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 13 Mar 2016 18:50:18 +0300 Subject: Separate Being::draw function into drawPlayer and drawOther. --- src/being/being.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- src/being/being.h | 10 ++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) (limited to 'src/being') 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 diff --git a/src/being/being.h b/src/being/being.h index 8d95205fd..7c3860220 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -631,6 +631,16 @@ class Being notfinal : public ActorSprite, const int offsetY) const restrict2 override final A_NONNULL(2); + void drawPlayer(Graphics *restrict const graphics, + const int offsetX, + const int offsetY) const + restrict2 A_NONNULL(2); + + void drawOther(Graphics *restrict const graphics, + const int offsetX, + const int offsetY) const + restrict2 A_NONNULL(2); + void drawBasic(Graphics *restrict const graphics, const int x, const int y) const restrict2 A_NONNULL(2); -- cgit v1.2.3-60-g2f50