summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-18 15:27:19 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-18 15:27:19 +0300
commit5ec1b3eaa504bc8f9443a340e579e000d4516651 (patch)
tree1273ad4e33941142a23e1b5586a45636e0d06045 /src/being
parent1ce5e20594dbf44d6311d217cdba3b217491fc0b (diff)
downloadmv-5ec1b3eaa504bc8f9443a340e579e000d4516651.tar.gz
mv-5ec1b3eaa504bc8f9443a340e579e000d4516651.tar.bz2
mv-5ec1b3eaa504bc8f9443a340e579e000d4516651.tar.xz
mv-5ec1b3eaa504bc8f9443a340e579e000d4516651.zip
Highlight skill attack range with border, while casting skill.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp48
-rw-r--r--src/being/being.h16
2 files changed, 63 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 95142fecc..0b52592d4 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -242,6 +242,10 @@ Being::Being(const BeingId id,
mKarma(0),
mManner(0),
mAreaSize(11),
+ mCastEndTime(0),
+ mCastX1(0),
+ mCastSize(0),
+ mCastY1(0),
#ifdef EATHENA_SUPPORT
mCreatorId(BeingId_zero),
#endif
@@ -257,7 +261,8 @@ Being::Being(const BeingId id,
mAway(false),
mInactive(false),
mNeedPosUpdate(true),
- mPetAi(true)
+ mPetAi(true),
+ mDrawCast(false)
{
for (int f = 0; f < 20; f ++)
{
@@ -1783,6 +1788,12 @@ void Being::logic() restrict2
(*it)->update(time);
#endif
+ if (mCastEndTime != 0 && mCastEndTime < tick_time)
+ {
+ mCastEndTime = 0;
+ mDrawCast = false;
+ }
+
if (mAnimationEffect)
{
mAnimationEffect->update(time);
@@ -3486,9 +3497,25 @@ void Being::drawPlayer(Graphics *restrict const graphics,
drawBeingCursor(graphics, px, py);
drawPlayerSpriteAt(graphics, px, py);
#endif
+ if (mDrawCast)
+ drawCasting(graphics, offsetX, offsetY);
}
}
+void Being::drawCasting(Graphics *const graphics,
+ const int offsetX,
+ const int offsetY) const
+{
+ graphics->setColor(userPalette->getColorWithAlpha(
+ UserColorId::ATTACK_RANGE_BORDER));
+
+ graphics->drawRectangle(Rect(
+ mCastX1 + offsetX,
+ mCastY1 + offsetY,
+ mCastSize,
+ mCastSize));
+}
+
void Being::drawBeingCursor(Graphics *const graphics,
const int offsetX,
const int offsetY) const
@@ -5002,6 +5029,25 @@ void Being::serverRemove() restrict2 noexcept2
mTrickDead = false;
}
+void Being::addCast(const int dstX,
+ const int dstY,
+ const int skillId A_UNUSED,
+ const int range A_UNUSED,
+ const int waitTimeTicks)
+{
+ if (waitTimeTicks <= 0)
+ {
+ mCastEndTime = 0;
+ mDrawCast = false;
+ return;
+ }
+ mCastEndTime = tick_time + waitTimeTicks;
+ mDrawCast = true;
+ mCastX1 = (dstX - range) * mapTileSize;
+ mCastY1 = (dstY - range) * mapTileSize;
+ mCastSize = range * mapTileSize * 2 + mapTileSize;
+}
+
#ifdef EATHENA_SUPPORT
void Being::removeHorse() restrict2
{
diff --git a/src/being/being.h b/src/being/being.h
index bf05d091b..810044956 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -1038,6 +1038,12 @@ class Being notfinal : public ActorSprite,
void serverRemove() restrict2 noexcept2;
+ void addCast(const int dstX,
+ const int dstY,
+ const int skillId,
+ const int range,
+ const int waitTimeTicks);
+
protected:
void drawPlayerSpriteAt(Graphics *restrict const graphics,
const int x,
@@ -1170,6 +1176,10 @@ class Being notfinal : public ActorSprite,
const int offsetX,
const int offsetY) const A_NONNULL(2);
+ void drawCasting(Graphics *const graphics,
+ const int offsetX,
+ const int offsetY) const A_NONNULL(2);
+
const ActorTypeT mType;
/** Speech Bubble components */
@@ -1255,6 +1265,11 @@ class Being notfinal : public ActorSprite,
int mKarma;
int mManner;
int mAreaSize;
+ int mCastEndTime;
+ int mCastX1;
+ int mCastSize;
+ int mCastY1;
+ int mCastHeight;
#ifdef EATHENA_SUPPORT
BeingId mCreatorId;
#endif
@@ -1271,6 +1286,7 @@ class Being notfinal : public ActorSprite,
bool mInactive;
bool mNeedPosUpdate;
bool mPetAi;
+ bool mDrawCast;
};
extern std::list<BeingCacheEntry*> beingInfoCache;