diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-23 21:49:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-23 21:49:15 +0300 |
commit | 06711faa8e02ca2e65e9e1cf2d38c359728f6ccf (patch) | |
tree | 4794940562e6b9e0d9a4bc0ac9c9e11816dbb725 /src/being | |
parent | 34bd6e0b8e0fb74cc416550a52e6406c47fefea6 (diff) | |
download | mv-06711faa8e02ca2e65e9e1cf2d38c359728f6ccf.tar.gz mv-06711faa8e02ca2e65e9e1cf2d38c359728f6ccf.tar.bz2 mv-06711faa8e02ca2e65e9e1cf2d38c359728f6ccf.tar.xz mv-06711faa8e02ca2e65e9e1cf2d38c359728f6ccf.zip |
Add support for equipment particles effects from dyes.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/being.cpp | 68 | ||||
-rw-r--r-- | src/being/being.h | 4 |
2 files changed, 71 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 3f58bbde6..93222c846 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2949,7 +2949,9 @@ void Being::setSpriteCards(const unsigned int slot, CompoundSprite::setSprite(slot, equipmentSprite); mSpriteDraw[slot] = id; - addItemParticles(id, info.getDisplay()); + addItemParticlesCards(id, + info.getDisplay(), + cards); setAction(mAction, 0); if (equipmentSprite) @@ -3039,6 +3041,7 @@ void Being::setTempSprite(const unsigned int slot, CompoundSprite::setSprite(slot, equipmentSprite); mSpriteDraw[slot] = id; + // +++ here probably need use existing cards addItemParticles(id, info.getDisplay()); setAction(mAction, 0); @@ -5065,6 +5068,69 @@ void Being::addItemParticles(const int id, } } +void Being::addItemParticlesCards(const int id, + const SpriteDisplay &restrict display, + CardsList cards) restrict2 +{ + const SpriteParticleInfoIter it = mSpriteParticles.find(id); + ParticleInfo *restrict pi = nullptr; + if (it == mSpriteParticles.end()) + { + pi = new ParticleInfo(); + mSpriteParticles[id] = pi; + } + else + { + pi = (*it).second; + } + + if (!pi || !pi->particles.empty()) + return; + + // setup particle effects + if (ParticleEngine::enabled && + particleEngine) + { + FOR_EACH (StringVectCIter, itr, display.particles) + { + Particle *const p = particleEngine->addEffect(*itr, 0, 0); + controlCustomParticle(p); + pi->files.push_back(*itr); + pi->particles.push_back(p); + } + for (int f = 0; f < maxCards; f ++) + { + const int cardId = cards.cards[f]; + const ItemInfo &info = ItemDB::get(cardId); + const SpriteDisplay &restrict display2 = info.getDisplay(); + FOR_EACH (StringVectCIter, itr, display2.particles) + { + Particle *const p = particleEngine->addEffect(*itr, 0, 0); + controlCustomParticle(p); + pi->files.push_back(*itr); + pi->particles.push_back(p); + } + } + } + else + { + FOR_EACH (StringVectCIter, itr, display.particles) + { + pi->files.push_back(*itr); + } + for (int f = 0; f < maxCards; f ++) + { + const int cardId = cards.cards[f]; + const ItemInfo &info = ItemDB::get(cardId); + const SpriteDisplay &restrict display2 = info.getDisplay(); + FOR_EACH (StringVectCIter, itr, display2.particles) + { + pi->files.push_back(*itr); + } + } + } +} + void Being::removeItemParticles(const int id) restrict2 { const SpriteParticleInfoIter it = mSpriteParticles.find(id); diff --git a/src/being/being.h b/src/being/being.h index 40658fa68..49242a8c4 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1114,6 +1114,10 @@ class Being notfinal : public ActorSprite, void addItemParticles(const int id, const SpriteDisplay &restrict display) restrict2; + void addItemParticlesCards(const int id, + const SpriteDisplay &restrict display, + CardsList cards) restrict2; + void removeAllItemsParticles() restrict2; void removeItemParticles(const int id) restrict2; |