diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-13 19:51:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-13 19:53:11 +0300 |
commit | 9cff7e13f21edf3c794085bd9d0fbbdb22ff6896 (patch) | |
tree | 81eae3e138e8e41a1f29eb9162f55f70b9b1d522 /src/being/being.cpp | |
parent | 1c59d2d1999a6dfe3fcc31518c76d27d34fd9b30 (diff) | |
download | mv-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/being.cpp')
-rw-r--r-- | src/being/being.cpp | 76 |
1 files changed, 49 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, |