summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertram <yohanndotferreiraatorange.fr>2010-03-08 10:59:06 +0100
committerBertram <yohanndotferreiraatorange.fr>2010-03-08 10:59:06 +0100
commit71cefdb345652342a3eaf84f197586809128e6ab (patch)
treeee005153907e75a9f03c2ece12683a5294ff5ecb
parentda77a5f25dbf9cdfbb33ddae1c01ed961f41374f (diff)
parent5ba23a83501dc267a0adbd17d0ae23def3acf089 (diff)
downloadmana-71cefdb345652342a3eaf84f197586809128e6ab.tar.gz
mana-71cefdb345652342a3eaf84f197586809128e6ab.tar.bz2
mana-71cefdb345652342a3eaf84f197586809128e6ab.tar.xz
mana-71cefdb345652342a3eaf84f197586809128e6ab.zip
Merge branch 'master' of gitorious.org:mana/mana
-rw-r--r--src/particle.cpp12
-rw-r--r--src/particle.h4
-rw-r--r--src/resources/mapreader.cpp9
3 files changed, 20 insertions, 5 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index d3dbfd64..84161c9f 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -64,6 +64,7 @@ Particle::Particle(Map *map):
mAlpha(1.0f),
mAutoDelete(true),
mMap(map),
+ mAllowSizeAdjust(false),
mGravity(0.0f),
mRandomness(0),
mBounce(0.0f),
@@ -322,6 +323,8 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
int lifetime = XML::getProperty(effectChildNode, "lifetime", -1);
newParticle->setLifetime(lifetime);
+ bool resizeable = "false" != XML::getProperty(effectChildNode, "size-adjustable", "false");
+ newParticle->setAllowSizeAdjust(resizeable);
// Look for additional emitters for this particle
for_each_xml_child_node(emitterNode, effectChildNode)
@@ -380,10 +383,13 @@ Particle *Particle::addTextRiseFadeOutEffect(const std::string &text,
void Particle::adjustEmitterSize(int w, int h)
{
- for (EmitterIterator e = mChildEmitters.begin();
- e != mChildEmitters.end(); e++)
+ if (mAllowSizeAdjust)
{
- (*e)->adjustSize(w, h);
+ for (EmitterIterator e = mChildEmitters.begin();
+ e != mChildEmitters.end(); e++)
+ {
+ (*e)->adjustSize(w, h);
+ }
}
}
diff --git a/src/particle.h b/src/particle.h
index 87360bec..0690e8c4 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -256,6 +256,9 @@ class Particle : public Sprite
*/
void adjustEmitterSize(int w, int h);
+ void setAllowSizeAdjust(bool adjust)
+ { mAllowSizeAdjust = adjust; }
+
bool isAlive()
{ return mAlive; }
@@ -297,6 +300,7 @@ class Particle : public Sprite
std::list<Sprite*>::iterator mSpriteIterator; /**< iterator of the particle on the current map */
Emitters mChildEmitters; /**< List of child emitters. */
Particles mChildParticles; /**< List of particles controlled by this particle */
+ bool mAllowSizeAdjust; /**< Can the effect size be adjusted by the object props in the map file? */
// dynamic particle
Vector mVelocity; /**< Speed in pixels per game-tick. */
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index d8678362..0f7ad749 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -21,6 +21,7 @@
#include "resources/mapreader.h"
+#include "configuration.h"
#include "log.h"
#include "map.h"
#include "tileset.h"
@@ -291,8 +292,12 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
}
else if (objType == "WARP")
{
- map->addParticleEffect("graphics/particles/warparea.particle.xml",
- objX, objY, objW, objH);
+ if (config.getValue("showWarps", 1))
+ {
+ map->addParticleEffect(
+ "graphics/particles/warparea.particle.xml",
+ objX, objY, objW, objH);
+ }
}
else
{