summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-13 19:51:48 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-13 19:53:11 +0300
commit9cff7e13f21edf3c794085bd9d0fbbdb22ff6896 (patch)
tree81eae3e138e8e41a1f29eb9162f55f70b9b1d522 /src/being
parent1c59d2d1999a6dfe3fcc31518c76d27d34fd9b30 (diff)
downloadmv-9cff7e13f21edf3c794085bd9d0fbbdb22ff6896.tar.gz
mv-9cff7e13f21edf3c794085bd9d0fbbdb22ff6896.tar.bz2
mv-9cff7e13f21edf3c794085bd9d0fbbdb22ff6896.tar.xz
mv-9cff7e13f21edf3c794085bd9d0fbbdb22ff6896.zip
Add separate functions for draw portals.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp76
-rw-r--r--src/being/being.h9
2 files changed, 58 insertions, 27 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 45b971399..bbd7f63b2 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2915,6 +2915,17 @@ void Being::drawOther(Graphics *restrict const graphics,
drawOtherSpriteAt(graphics, px, py);
}
+void Being::drawPortal(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;
+ drawPortalSpriteAt(graphics, px, py);
+}
+
void Being::draw(Graphics *restrict const graphics,
const int offsetX,
const int offsetY) const restrict2
@@ -2926,10 +2937,14 @@ void Being::draw(Graphics *restrict const graphics,
offsetX,
offsetY);
break;
+ case ActorType::Portal:
+ drawPortal(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
@@ -3019,32 +3034,9 @@ void Being::drawOtherSpriteAt(Graphics *restrict const graphics,
const int x,
const int y) const restrict2
{
- if (mHighlightMapPortals &&
- mMap &&
- mSubType == fromInt(45, BeingTypeId) &&
- !mMap->getHasWarps())
- {
- if (!userPalette)
- {
- CompoundSprite::draw(graphics, x, y);
- return;
- }
-
- graphics->setColor(userPalette->
- getColorWithAlpha(UserColorId::PORTAL_HIGHLIGHT));
-
- graphics->fillRectangle(Rect(x, y,
- mapTileSize, mapTileSize));
-
- if (mDrawHotKeys && !mName.empty())
- {
- const Color &color = userPalette->getColor(UserColorId::BEING);
- gui->getFont()->drawString(graphics, color, color, mName, x, y);
- }
- }
- else if (mHighlightMonsterAttackRange &&
- mType == ActorType::Monster &&
- isAlive())
+ if (mHighlightMonsterAttackRange &&
+ mType == ActorType::Monster &&
+ isAlive())
{
if (!userPalette)
{
@@ -3092,6 +3084,36 @@ void Being::drawOtherSpriteAt(Graphics *restrict const graphics,
}
}
+void Being::drawPortalSpriteAt(Graphics *restrict const graphics,
+ const int x,
+ const int y) const restrict2
+{
+ if (mHighlightMapPortals &&
+ mMap &&
+ !mMap->getHasWarps())
+ {
+ if (!userPalette)
+ {
+ CompoundSprite::draw(graphics, x, y);
+ return;
+ }
+
+ graphics->setColor(userPalette->
+ getColorWithAlpha(UserColorId::PORTAL_HIGHLIGHT));
+
+ graphics->fillRectangle(Rect(x, y,
+ mapTileSize, mapTileSize));
+
+ if (mDrawHotKeys && !mName.empty())
+ {
+ const Color &color = userPalette->getColor(UserColorId::BEING);
+ gui->getFont()->drawString(graphics, color, color, mName, x, y);
+ }
+ }
+
+ CompoundSprite::draw(graphics, x, y);
+}
+
void Being::drawHpBar(Graphics *restrict const graphics,
const int maxHP,
const int hp,
diff --git a/src/being/being.h b/src/being/being.h
index dbdb58acb..0c61733cf 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 drawPortal(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);
@@ -1001,6 +1006,10 @@ class Being notfinal : public ActorSprite,
const int x,
const int y) const restrict2 A_NONNULL(2);
+ void drawPortalSpriteAt(Graphics *restrict const graphics,
+ const int x,
+ const int y) const restrict2 A_NONNULL(2);
+
/**
* Updates name's location.
*/