summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-11-08 23:10:21 +0300
committerAndrei Karas <akaras@inbox.ru>2017-11-08 23:10:21 +0300
commit7ca06be4b1a8dab21d21ddbab078ef7fed8cd1f8 (patch)
treefd036a61e12f36c16fded19d1e32dd82ba1560ae /src/being
parent284b8a1f756101bf69efbc064b1e247119eea621 (diff)
downloadplus-7ca06be4b1a8dab21d21ddbab078ef7fed8cd1f8.tar.gz
plus-7ca06be4b1a8dab21d21ddbab078ef7fed8cd1f8.tar.bz2
plus-7ca06be4b1a8dab21d21ddbab078ef7fed8cd1f8.tar.xz
plus-7ca06be4b1a8dab21d21ddbab078ef7fed8cd1f8.zip
Allow draw npc equipment sprites (only basic slots).
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp35
-rw-r--r--src/being/being.h9
2 files changed, 42 insertions, 2 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 6bbf50a48..4f115a6d3 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2875,7 +2875,6 @@ void Being::setSpriteColor(const unsigned int slot,
CompoundSprite::setSprite(slot, equipmentSprite);
mSpriteDraw[slot] = id;
-
addItemParticles(id, info.getDisplay());
setAction(mAction, 0);
@@ -3224,6 +3223,15 @@ void Being::setHairTempSprite(const unsigned int slot,
void Being::setHairColorSpriteID(const unsigned int slot,
const int id) restrict2
{
+ if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
+ return;
+
+ if (slot >= CAST_U32(mSprites.size()))
+ ensureSize(slot + 1);
+
+ if (slot >= CAST_U32(mSlots.size()))
+ mSlots.resize(slot + 1, BeingSlot());
+
BeingSlot &beingSlot = mSlots[slot];
setSpriteColor(slot,
id,
@@ -3688,6 +3696,18 @@ void Being::drawOther(Graphics *restrict const graphics,
drawOtherSpriteAt(graphics, px, py);
}
+void Being::drawNpc(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);
+ drawNpcSpriteAt(graphics, px, py);
+}
+
void Being::drawMonster(Graphics *restrict const graphics,
const int offsetX,
const int offsetY) const restrict2
@@ -3783,10 +3803,14 @@ void Being::draw(Graphics *restrict const graphics,
offsetX,
offsetY);
break;
+ case ActorType::Npc:
+ drawNpc(graphics,
+ offsetX,
+ offsetY);
+ break;
case ActorType::Pet:
case ActorType::SkillUnit:
case ActorType::Unknown:
- case ActorType::Npc:
case ActorType::FloorItem:
case ActorType::Avatar:
default:
@@ -3902,6 +3926,13 @@ void Being::drawOtherSpriteAt(Graphics *restrict const graphics,
CompoundSprite::drawSimple(graphics, x, y);
}
+void Being::drawNpcSpriteAt(Graphics *restrict const graphics,
+ const int x,
+ const int y) const restrict2
+{
+ drawCompound(graphics, x, y);
+}
+
void Being::drawMonsterSpriteAt(Graphics *restrict const graphics,
const int x,
const int y) const restrict2
diff --git a/src/being/being.h b/src/being/being.h
index 0ca1ce780..775c875f9 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -679,6 +679,11 @@ class Being notfinal : public ActorSprite,
const int offsetY) const
restrict2 A_NONNULL(2);
+ void drawNpc(Graphics *restrict const graphics,
+ const int offsetX,
+ const int offsetY) const
+ restrict2 A_NONNULL(2);
+
void drawMonster(Graphics *restrict const graphics,
const int offsetX,
const int offsetY) const
@@ -1106,6 +1111,10 @@ class Being notfinal : public ActorSprite,
const int x,
const int y) const restrict2 A_NONNULL(2);
+ void drawNpcSpriteAt(Graphics *restrict const graphics,
+ 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);