summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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.
*/