From d2c64cb6995486136be2cd511ff7ad835d57c319 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 13 Mar 2016 20:03:22 +0300 Subject: Add separate functions for draw monsters. --- src/being/being.cpp | 28 ++++++++++++++++++++++++++-- src/being/being.h | 9 +++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index bbd7f63b2..c3e63d41c 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2915,6 +2915,18 @@ void Being::drawOther(Graphics *restrict const graphics, drawOtherSpriteAt(graphics, px, py); } +void Being::drawMonster(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; + drawBeingCursor(graphics, px, py); + drawMonsterSpriteAt(graphics, px, py); +} + void Being::drawPortal(Graphics *restrict const graphics, const int offsetX, const int offsetY) const restrict2 @@ -2942,8 +2954,12 @@ void Being::draw(Graphics *restrict const graphics, offsetX, offsetY); break; - case ActorType::Npc: case ActorType::Monster: + drawMonster(graphics, + offsetX, + offsetY); + break; + case ActorType::Npc: case ActorType::FloorItem: case ActorType::LocalPet: case ActorType::Avatar: @@ -3033,10 +3049,17 @@ void Being::drawPlayerSpriteAt(Graphics *restrict const graphics, void Being::drawOtherSpriteAt(Graphics *restrict const graphics, const int x, const int y) const restrict2 +{ + CompoundSprite::draw(graphics, x, y); +} + +void Being::drawMonsterSpriteAt(Graphics *restrict const graphics, + const int x, + const int y) const restrict2 { if (mHighlightMonsterAttackRange && mType == ActorType::Monster && - isAlive()) + mAction != BeingAction::DEAD) { if (!userPalette) { @@ -3082,6 +3105,7 @@ void Being::drawOtherSpriteAt(Graphics *restrict const graphics, 2 * 50, 4); } + } void Being::drawPortalSpriteAt(Graphics *restrict const graphics, diff --git a/src/being/being.h b/src/being/being.h index 0c61733cf..ba392d385 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -641,6 +641,11 @@ class Being notfinal : public ActorSprite, const int offsetY) const restrict2 A_NONNULL(2); + void drawMonster(Graphics *restrict const graphics, + const int offsetX, + const int offsetY) const + restrict2 A_NONNULL(2); + void drawPortal(Graphics *restrict const graphics, const int offsetX, const int offsetY) const @@ -1010,6 +1015,10 @@ class Being notfinal : public ActorSprite, const int x, const int y) const restrict2 A_NONNULL(2); + void drawMonsterSpriteAt(Graphics *restrict const graphics, + const int x, + const int y) const restrict2 A_NONNULL(2); + /** * Updates name's location. */ -- cgit v1.2.3-60-g2f50