diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-10 22:03:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-07-10 22:03:10 +0300 |
commit | f9a7f96525c7485de4cf27f973f0b52f5d74f048 (patch) | |
tree | be1ed401dffb832f9d923760ac89ad415cfc4d7f /src/being | |
parent | 314147c53d571345436d2def199213fa71f22c9d (diff) | |
download | ManaVerse-f9a7f96525c7485de4cf27f973f0b52f5d74f048.tar.gz ManaVerse-f9a7f96525c7485de4cf27f973f0b52f5d74f048.tar.bz2 ManaVerse-f9a7f96525c7485de4cf27f973f0b52f5d74f048.tar.xz ManaVerse-f9a7f96525c7485de4cf27f973f0b52f5d74f048.zip |
Add support for initial particle effect for effect from status-effects.xml
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/actorsprite.cpp | 47 | ||||
-rw-r--r-- | src/being/actorsprite.h | 10 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 7 | ||||
-rw-r--r-- | src/being/localplayer.h | 3 |
4 files changed, 48 insertions, 19 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 6d072adc7..7007d52aa 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -119,7 +119,11 @@ void ActorSprite::logic() const StatusEffect *const effect = StatusEffectDB::getStatusEffect(*it, Enable_true); if (effect && effect->mIsPersistent) - updateStatusEffect(*it, Enable_true); + { + updateStatusEffect(*it, + Enable_true, + IsStart_false); + } } } @@ -174,14 +178,15 @@ struct EffectDescription final }; void ActorSprite::setStatusEffect(const int32_t index, - const Enable active) + const Enable active, + const IsStart start) { const Enable wasActive = fromBool( mStatusEffects.find(index) != mStatusEffects.end(), Enable); if (active != wasActive) { - updateStatusEffect(index, active); + updateStatusEffect(index, active, start); if (active == Enable_true) mStatusEffects.insert(index); else @@ -200,7 +205,9 @@ void ActorSprite::setStatusEffectBlock(const int offset, if (index != -1) { - setStatusEffect(index, fromBool(val, Enable)); + setStatusEffect(index, + fromBool(val, Enable), + IsStart_false); } else if (val && config.getBoolValue("unimplimentedLog")) { @@ -226,7 +233,9 @@ static void applyEffectByOption(ActorSprite *const actor, const Enable enable = (opt & option) != 0 ? Enable_true : Enable_false; option |= opt; option ^= opt; - actor->setStatusEffect(id, enable); + actor->setStatusEffect(id, + enable, + IsStart_false); } if (option && config.getBoolValue("unimplimentedLog")) { @@ -251,12 +260,16 @@ static void applyEffectByOption1(ActorSprite *const actor, const int32_t id = (*it).second; if (opt == option) { - actor->setStatusEffect(id, Enable_true); + actor->setStatusEffect(id, + Enable_true, + IsStart_false); option = 0U; } else { - actor->setStatusEffect(id, Enable_false); + actor->setStatusEffect(id, + Enable_false, + IsStart_false); } } if (option && config.getBoolValue("unimplimentedLog")) @@ -340,7 +353,8 @@ void ActorSprite::setStatusEffectOpiton0(const uint32_t option) } void ActorSprite::updateStatusEffect(const int32_t index, - const Enable newStatus) + const Enable newStatus, + const IsStart start) { StatusEffect *const effect = StatusEffectDB::getStatusEffect( index, newStatus); @@ -358,19 +372,26 @@ void ActorSprite::updateStatusEffect(const int32_t index, else if (effect->mIsPostDelay) stopCast(newStatus == Enable_true); #endif - handleStatusEffect(effect, index); + handleStatusEffect(effect, index, start); } void ActorSprite::handleStatusEffect(const StatusEffect *const effect, - const int32_t effectId) + const int32_t effectId, + const IsStart start) { if (!effect) return; - Particle *const particle = effect->getParticle(); - if (effectId >= 0) - mStatusParticleEffects.setLocally(effectId, particle); + { + if (start == IsStart_true) + { + Particle *const particle = effect->getParticle(); + mStatusParticleEffects.setLocally(effectId, particle); + } + // +++ here also need enable permanent status effects, + // need new field in StatusEffect + } } void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index 2ee96f73c..1a32ceaf9 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -34,6 +34,7 @@ #include "enums/simpletypes/beingid.h" #include "enums/simpletypes/enable.h" #include "enums/simpletypes/forcedisplay.h" +#include "enums/simpletypes/isstart.h" #include "enums/resources/map/blocktype.h" @@ -108,7 +109,8 @@ class ActorSprite notfinal : public CompoundSprite, public Actor { mUsedTargetCursor = nullptr; } void setStatusEffect(const int32_t index, - const Enable active); + const Enable active, + const IsStart start); void setStatusEffectOpitons(const uint32_t option, const uint32_t opt1, @@ -197,7 +199,8 @@ class ActorSprite notfinal : public CompoundSprite, public Actor * The new flag is passed. */ virtual void updateStatusEffect(const int32_t index, - const Enable newStatus); + const Enable newStatus, + const IsStart start); /** * Handle an update to a status or stun effect @@ -206,7 +209,8 @@ class ActorSprite notfinal : public CompoundSprite, public Actor * \param effectId -1 for stun, otherwise the effect index */ virtual void handleStatusEffect(const StatusEffect *const effect, - const int32_t effectId); + const int32_t effectId, + const IsStart start); void setupSpriteDisplay(const SpriteDisplay &display, const ForceDisplay forceDisplay diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index dd2b52838..97845ae31 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -998,9 +998,12 @@ void LocalPlayer::setGotoTarget(Being *const target) } void LocalPlayer::handleStatusEffect(const StatusEffect *const effect, - const int32_t effectId) + const int32_t effectId, + const IsStart start) { - Being::handleStatusEffect(effect, effectId); + Being::handleStatusEffect(effect, + effectId, + start); if (effect) { diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 14d731b74..08974a621 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -427,7 +427,8 @@ class LocalPlayer final : public Being, void updateCoords() override final; void handleStatusEffect(const StatusEffect *const effect, - const int32_t effectId) override final; + const int32_t effectId, + const IsStart start) override final; void startWalking(const unsigned char dir); |