summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-03 17:47:17 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-03 17:47:17 +0300
commitad43e58d901bcc89632c80bdcf498acf2f1717c2 (patch)
treea386e723b0e5d090279704bb28b06334e117588d /src
parent421c0d17d65ee740c992c96b04a00b846b50a2e5 (diff)
downloadplus-ad43e58d901bcc89632c80bdcf498acf2f1717c2.tar.gz
plus-ad43e58d901bcc89632c80bdcf498acf2f1717c2.tar.bz2
plus-ad43e58d901bcc89632c80bdcf498acf2f1717c2.tar.xz
plus-ad43e58d901bcc89632c80bdcf498acf2f1717c2.zip
Add support for riding flag in actorsprite and statuseffect.
Diffstat (limited to 'src')
-rw-r--r--src/being/actorsprite.cpp7
-rw-r--r--src/being/actorsprite.h4
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/statuseffect.cpp5
-rw-r--r--src/statuseffect.h4
5 files changed, 18 insertions, 3 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 343018204..9f21d4996 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -73,7 +73,8 @@ ActorSprite::ActorSprite(const int id) :
mCursorPaddingY(0),
mMustResetParticles(false),
mPoison(false),
- mHaveCart(false)
+ mHaveCart(false),
+ mRiding(false)
{
}
@@ -220,8 +221,10 @@ void ActorSprite::updateStatusEffect(const int index, const bool newStatus)
return;
if (effect->isPoison() && getType() == ActorType::Player)
setPoison(newStatus);
- if (effect->isCart() && localPlayer == this)
+ else if (effect->isCart() && localPlayer == this)
setHaveCart(newStatus);
+ else if (effect->isRiding())
+ setRiding(newStatus);
handleStatusEffect(effect, index);
}
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index 02a17ea07..12624aa30 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -177,6 +177,9 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
bool getHaveCart() const A_WARN_UNUSED
{ return mHaveCart; }
+ virtual void setRiding(const bool b)
+ { mRiding = b; }
+
protected:
/**
* Notify self that the stun mode has been updated. Invoked by
@@ -239,6 +242,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
bool mMustResetParticles;
bool mPoison;
bool mHaveCart;
+ bool mRiding;
};
#endif // BEING_ACTORSPRITE_H
diff --git a/src/defaults.cpp b/src/defaults.cpp
index eb33c4245..f1abdfb60 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -580,6 +580,7 @@ DefaultsData* getPathsDefaults()
AddDEF("defaultcommandsPatchDir", "defaultcommands.d");
AddDEF("poisonEffectName", "poison");
AddDEF("cartEffectName", "cart");
+ AddDEF("ridingEffectName", "riding");
return configData;
}
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 41697b852..c5e660abd 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -50,7 +50,8 @@ StatusEffect::StatusEffect() :
mAction(),
mPersistentParticleEffect(false),
mIsPoison(false),
- mIsCart(false)
+ mIsCart(false),
+ mIsRiding(false)
{
}
@@ -201,6 +202,8 @@ void StatusEffect::loadXmlFile(const std::string &fileName)
(name == paths.getStringValue("poisonEffectName"));
startEffect->mIsCart =
(name == paths.getStringValue("cartEffectName"));
+ startEffect->mIsRiding =
+ (name == paths.getStringValue("ridingEffectName"));
startEffect->mMessage = XML::getProperty(
node, "start-message", "");
startEffect->mSFXEffect = XML::getProperty(
diff --git a/src/statuseffect.h b/src/statuseffect.h
index 4cba35432..ce99fa5d8 100644
--- a/src/statuseffect.h
+++ b/src/statuseffect.h
@@ -80,6 +80,9 @@ class StatusEffect final
bool isCart() const A_WARN_UNUSED
{ return mIsCart; }
+ bool isRiding() const A_WARN_UNUSED
+ { return mIsRiding; }
+
/**
* Retrieves a status effect.
*
@@ -128,6 +131,7 @@ class StatusEffect final
bool mPersistentParticleEffect;
bool mIsPoison;
bool mIsCart;
+ bool mIsRiding;
};
#endif // STATUSEFFECT_H