diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-05 00:21:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-05 01:04:15 +0300 |
commit | a498132aa32be5fdf8d4227a7332016fc90ed87d (patch) | |
tree | 2a25422158248717df594e7d5e6058303b06cbcb /src/effectmanager.cpp | |
parent | faeaa157b1abada82243b8dc508201aa17db1df2 (diff) | |
download | plus-a498132aa32be5fdf8d4227a7332016fc90ed87d.tar.gz plus-a498132aa32be5fdf8d4227a7332016fc90ed87d.tar.bz2 plus-a498132aa32be5fdf8d4227a7332016fc90ed87d.tar.xz plus-a498132aa32be5fdf8d4227a7332016fc90ed87d.zip |
add animation effect to being.
can be used for now from effects.xml with attribute "sprite".
Diffstat (limited to 'src/effectmanager.cpp')
-rw-r--r-- | src/effectmanager.cpp | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index f7e1ccbaa..ac4f80afc 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -70,17 +70,20 @@ bool EffectManager::trigger(const int id, Being *const being, bool rValue = false; FOR_EACH (std::vector<EffectDescription>::const_iterator, i, mEffects) { - if ((*i).id == id) + const EffectDescription &effect = *i; + if (effect.id == id) { rValue = true; - if (!(*i).gfx.empty()) + if (!effect.gfx.empty()) { Particle *const selfFX = particleEngine->addEffect( - (*i).gfx, 0, 0, rotation); + effect.gfx, 0, 0, rotation); being->controlParticle(selfFX); } - if (!(*i).sfx.empty()) - soundManager.playSfx((*i).sfx); + if (!effect.sfx.empty()) + soundManager.playSfx(effect.sfx); + if (!effect.sprite.empty()) + being->addEffect(effect.sprite); break; } } @@ -96,16 +99,19 @@ Particle *EffectManager::triggerReturn(const int id, Being *const being, Particle *rValue = nullptr; FOR_EACH (std::vector<EffectDescription>::const_iterator, i, mEffects) { - if ((*i).id == id) + const EffectDescription &effect = *i; + if (effect.id == id) { - if (!(*i).gfx.empty()) + if (!effect.gfx.empty()) { rValue = particleEngine->addEffect( - (*i).gfx, 0, 0, rotation); + effect.gfx, 0, 0, rotation); being->controlParticle(rValue); } - if (!(*i).sfx.empty()) - soundManager.playSfx((*i).sfx); + if (!effect.sfx.empty()) + soundManager.playSfx(effect.sfx); + if (!effect.sprite.empty()) + being->addEffect(effect.sprite); break; } } @@ -121,13 +127,15 @@ bool EffectManager::trigger(const int id, const int x, const int y, bool rValue = false; FOR_EACH (std::vector<EffectDescription>::const_iterator, i, mEffects) { - if ((*i).id == id) + const EffectDescription &effect = *i; + if (effect.id == id) { rValue = true; - if (!(*i).gfx.empty() && particleEngine) - particleEngine->addEffect((*i).gfx, x, y, rotation); - if (!(*i).sfx.empty()) - soundManager.playSfx((*i).sfx); + if (!effect.gfx.empty() && particleEngine) + particleEngine->addEffect(effect.gfx, x, y, rotation); + if (!effect.sfx.empty()) + soundManager.playSfx(effect.sfx); + // TODO add sprite effect to position break; } } |