26 #include "gui/viewport.h"
55 mChildMoveParticles(),
72 "particleFastPhysics"),
91 const float x1 =
static_cast<float>(cameraX - 3000);
92 const float y1 =
static_cast<float>(cameraY - 2000);
93 const float x2 =
static_cast<float>(cameraX + 3000);
94 const float y2 =
static_cast<float>(cameraY + 2000);
100 const float posX = particle->mPos.x;
101 const float posY = particle->mPos.y;
102 if (posX < x1 || posX > x2 || posY < y1 || posY > y2)
108 if (particle->update())
138 const size_t pos = particleEffectFile.find(
'|');
139 const std::string dyePalettes = (pos != std::string::npos)
140 ? particleEffectFile.substr(pos + 1) :
"";
142 particleEffectFile.substr(0, pos),
148 XmlNodeConstPtrConst rootNode = doc->
rootNode();
150 if ((rootNode ==
nullptr) || !xmlNameEqual(rootNode,
"effect"))
152 logger->
log(
"Error loading particle: %s", particleEffectFile.c_str());
161 if (!xmlNameEqual(effectChildNode,
"particle"))
176 effectChildNode,
"rotation")) !=
nullptr)
183 "image")) !=
nullptr)
185 std::string imageSrc;
186 if (XmlHaveChildContent(node))
187 imageSrc = XmlChildContent(node);
188 if (!imageSrc.empty() && !dyePalettes.empty())
204 effectChildNode,
"position-x", 0);
206 effectChildNode,
"position-y", 0);
208 effectChildNode,
"position-z", 0);
209 const Vector position(
static_cast<float>(pixelX) + offsetX,
210 static_cast<float>(pixelY) + offsetY,
212 newParticle->
moveTo(position);
217 "size-adjustable",
"false");
224 if (xmlNameEqual(emitterNode,
"emitter"))
235 else if (xmlNameEqual(emitterNode,
"deatheffect"))
237 std::string deathEffect;
238 if ((node !=
nullptr) && XmlHaveChildContent(node))
239 deathEffect = XmlChildContent(emitterNode);
241 char deathEffectConditions = 0x00;
244 deathEffectConditions +=
CAST_S8(
249 deathEffectConditions +=
CAST_S8(
254 deathEffectConditions +=
CAST_S8(
259 deathEffectConditions +=
CAST_S8(
264 deathEffectConditions +=
CAST_S8(
268 deathEffect, deathEffectConditions);
272 mChildParticles.push_back(newParticle);
293 newParticle->
moveTo(
static_cast<float>(
x),
294 static_cast<float>(
y));
296 static_cast<float>((rand() % 100) - 50) / 200.0F,
297 static_cast<float>((rand() % 100) - 50) / 200.0F,
298 (
static_cast<float>((rand() % 100)) / 200.0F) + 4.0F);
305 mChildParticles.push_back(newParticle);
326 newParticle->
moveTo(
static_cast<float>(
x),
327 static_cast<float>(
y));
334 mChildParticles.push_back(newParticle);
virtual void setMap(Map *const map)
bool getBoolValue(const std::string &key) const
int getIntValue(const std::string &key) const
static void instantiate(std::string &target, const std::string &palettes)
void log(const char *const log_text,...)
void log1(const char *const log_text)
static const float PARTICLE_SKY
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation)
Particle * addTextRiseFadeOutEffect(const std::string &text, const int x, const int y, const Color *const color, Font *const font, const bool outline)
static ParticlePhysicsT fastPhysics
Particles mChildMoveParticles
Particle * addTextSplashEffect(const std::string &text, const int x, const int y, const Color *const color, Font *const font, const bool outline)
static void setupEngine()
Particles mChildParticles
void setLifetime(const int lifetime)
void setGravity(const float gravity)
void setBounce(const float bouncieness)
void setAllowSizeAdjust(const bool adjust)
virtual void setDeathEffect(const std::string &effectFile, const signed char conditions)
void addEmitter(ParticleEmitter *const emitter)
void setFadeIn(const int fadeIn)
void setFadeOut(const int fadeOut)
void moveTo(const Vector &pos)
void setVelocity(const float x, const float y, const float z)
void delete_all(Container &c)
#define fromInt(val, name)
#define for_each_xml_child_node(var, parent)
XML::Document * getXml(const std::string &idPath, const UseVirtFs useResman, const SkipError skipError)
Image * getImage(const std::string &idPath)
float getFloatProperty(const xmlNodePtr node, const char *const name, float def)
bool getBoolProperty(const xmlNodePtr node, const char *const name, const bool def)
int getProperty(const xmlNodePtr node, const char *const name, int def)
xmlNodePtr findFirstChildByName(const xmlNode *const parent, const char *const name)
ParticleEngine * particleEngine
Particles::iterator ParticleIterator
ParticlePhysics ::T ParticlePhysicsT
const bool SkipError_false
const bool UseVirtFs_true