summaryrefslogtreecommitdiff
path: root/src/particleemitter.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-06-22 21:47:53 +0200
committerAndrei Karas <akaras@inbox.ru>2011-06-23 12:46:37 +0300
commit99cb204d29a63bf5f4edb40b25f4fc1a6605fbd1 (patch)
treee6dc5588927460dbda4dccb002fb1e9c48823088 /src/particleemitter.cpp
parent493cc14facb80c6c86c57ef379131e56a0161215 (diff)
downloadmv-99cb204d29a63bf5f4edb40b25f4fc1a6605fbd1.tar.gz
mv-99cb204d29a63bf5f4edb40b25f4fc1a6605fbd1.tar.bz2
mv-99cb204d29a63bf5f4edb40b25f4fc1a6605fbd1.tar.xz
mv-99cb204d29a63bf5f4edb40b25f4fc1a6605fbd1.zip
Made possible to separate the dye colors and channels
for particle effects. It is now possible to write, for instance: <particlefx>my-particle-file.xml|#cbcb78,345678</particlefx> and in my-particle-file.xml: ... <property image="my-image.png|W" /> ... This will permit the use (and reuse) of generic particle files. Conflicts: src/particle.cpp src/particleemitter.cpp src/particleemitter.h src/simpleanimation.cpp
Diffstat (limited to 'src/particleemitter.cpp')
-rw-r--r--src/particleemitter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 844da5dad..6b6cca44b 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -27,6 +27,7 @@
#include "particleemitter.h"
#include "rotationalparticle.h"
+#include "resources/dye.h"
#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
@@ -39,7 +40,8 @@
#define DEG_RAD_FACTOR 0.017453293f
ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
- Map *map, int rotation):
+ Map *map, int rotation,
+ const std::string& dyePalettes):
mOutputPauseLeft(0),
mParticleImage(0)
{
@@ -99,6 +101,9 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
// Don't leak when multiple images are defined
if (!image.empty() && !mParticleImage)
{
+ if (!dyePalettes.empty())
+ Dye::instantiate(image, dyePalettes);
+
ResourceManager *resman = ResourceManager::getInstance();
mParticleImage = resman->getImage(image);
}
@@ -194,7 +199,8 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
}
else if (xmlStrEqual(propertyNode->name, BAD_CAST "emitter"))
{
- ParticleEmitter newEmitter(propertyNode, mParticleTarget, map);
+ ParticleEmitter newEmitter(propertyNode, mParticleTarget, map,
+ rotation, dyePalettes);
mParticleChildEmitters.push_back(newEmitter);
}
else if (xmlStrEqual(propertyNode->name, BAD_CAST "rotation"))