diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-22 21:47:53 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-22 21:47:53 +0200 |
commit | ba5b70974c5dfa0be3105e72a0a012455b28e7a9 (patch) | |
tree | b79f9f46cc30eb2a1196b79392831af144fabc22 /src/particleemitter.cpp | |
parent | 852ff45c35c422b5264487669934b392a8657465 (diff) | |
download | mana-ba5b70974c5dfa0be3105e72a0a012455b28e7a9.tar.gz mana-ba5b70974c5dfa0be3105e72a0a012455b28e7a9.tar.bz2 mana-ba5b70974c5dfa0be3105e72a0a012455b28e7a9.tar.xz mana-ba5b70974c5dfa0be3105e72a0a012455b28e7a9.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.
Diffstat (limited to 'src/particleemitter.cpp')
-rw-r--r-- | src/particleemitter.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index 32b63c9e..bfeaa139 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -26,6 +26,7 @@ #include "particleemitter.h" #include "rotationalparticle.h" +#include "resources/dye.h" #include "resources/image.h" #include "resources/imageset.h" #include "resources/resourcemanager.h" @@ -36,7 +37,9 @@ #define SIN45 0.707106781f #define DEG_RAD_FACTOR 0.017453293f -ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map, int rotation): +ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, + Map *map, int rotation, + const std::string& dyePalettes): mOutputPauseLeft(0), mParticleImage(0) { @@ -95,6 +98,9 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map * // 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); } @@ -183,7 +189,8 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map * } 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")) |