summaryrefslogtreecommitdiff
path: root/src/simpleanimation.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/simpleanimation.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/simpleanimation.cpp')
-rw-r--r--src/simpleanimation.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index a952d792b..e3591f30c 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -28,6 +28,7 @@
#include "utils/stringutils.h"
#include "resources/animation.h"
+#include "resources/dye.h"
#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
@@ -43,13 +44,14 @@ SimpleAnimation::SimpleAnimation(Animation *animation):
{
}
-SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode):
+SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode,
+ const std::string& dyePalettes):
mAnimation(new Animation),
mAnimationTime(0),
mAnimationPhase(0),
mInitialized(false)
{
- initializeAnimation(animationNode);
+ initializeAnimation(animationNode, dyePalettes);
if (mAnimation)
mCurrentFrame = mAnimation->getFrame(0);
else
@@ -134,13 +136,21 @@ Image *SimpleAnimation::getCurrentImage() const
return NULL;
}
-void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode)
+void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode,
+ const std::string& dyePalettes)
{
mInitialized = false;
if (!animationNode)
return;
+ std::string imagePath = XML::getProperty(animationNode,
+ "imageset", "");
+
+ // Instanciate the dye coloration.
+ if (!imagePath.empty() && !dyePalettes.empty())
+ Dye::instantiate(imagePath, dyePalettes);
+
ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
XML::getProperty(animationNode, "imageset", ""),
XML::getProperty(animationNode, "width", 0),