ManaPlus
Public Member Functions | Static Private Member Functions | Private Attributes
ParticleEmitter Class Reference

#include <particleemitter.h>

Public Member Functions

 ParticleEmitter (const xmlNode *const emitterNode, Particle *const target, Map *const map, const int rotation, const std::string &dyePalettes)
 
 ParticleEmitter (const ParticleEmitter &o)
 
ParticleEmitteroperator= (const ParticleEmitter &o)
 
 ~ParticleEmitter ()
 
void createParticles (const int tick, std::vector< Particle * > &newParticles)
 
void setTarget (Particle *const target)
 
void adjustSize (const int w, const int h)
 

Static Private Member Functions

template<typename T >
static ParticleEmitterProp< T > readParticleEmitterProp (xmlNode *const propertyNode, T def)
 
static ImageSetgetImageSet (xmlNode *const node)
 

Private Attributes

ParticleEmitterProp< float > mParticlePosX
 
ParticleEmitterProp< float > mParticlePosY
 
ParticleEmitterProp< float > mParticlePosZ
 
ParticleEmitterProp< float > mParticleAngleHorizontal
 
ParticleEmitterProp< float > mParticleAngleVertical
 
ParticleEmitterProp< float > mParticlePower
 
ParticleEmitterProp< float > mParticleGravity
 
ParticleEmitterProp< int > mParticleRandomness
 
ParticleEmitterProp< float > mParticleBounce
 
ParticlemParticleTarget
 
ParticleEmitterProp< float > mParticleAcceleration
 
ParticleEmitterProp< float > mParticleDieDistance
 
ParticleEmitterProp< float > mParticleMomentum
 
ParticleEmitterProp< int > mParticleLifetime
 
ParticleEmitterProp< int > mParticleFadeOut
 
ParticleEmitterProp< int > mParticleFadeIn
 
MapmMap
 
ParticleEmitterProp< int > mOutput
 
ParticleEmitterProp< int > mOutputPause
 
ImagemParticleImage
 
Animation mParticleAnimation
 
Animation mParticleRotation
 
ParticleEmitterProp< float > mParticleAlpha
 
std::string mDeathEffect
 
std::list< ParticleEmittermParticleChildEmitters
 
std::vector< ImageSet * > mTempSets
 
int mOutputPauseLeft
 
signed char mDeathEffectConditions
 
bool mParticleFollow
 

Detailed Description

Every Particle can have one or more particle emitters that create new particles when they are updated

Definition at line 43 of file particleemitter.h.

Constructor & Destructor Documentation

◆ ParticleEmitter() [1/2]

ParticleEmitter::ParticleEmitter ( const xmlNode *const  emitterNode,
Particle *const  target,
Map *const  map,
const int  rotation,
const std::string &  dyePalettes 
)

Definition at line 53 of file particleemitter.cpp.

56  :
57  mParticleTarget(target),
58  mMap(map),
59  mOutput(),
60  mOutputPause(),
61  mParticleImage(nullptr),
62  mParticleAnimation("particle animation"),
63  mParticleRotation("particle rotation"),
65  mDeathEffect(),
67  mTempSets(),
70  mParticleFollow(false)
71 {
72  // Initializing default values
73  mParticlePosX.set(0.0F);
74  mParticlePosY.set(0.0F);
75  mParticlePosZ.set(0.0F);
78  mParticlePower.set(0.0F);
79  mParticleGravity.set(0.0F);
81  mParticleBounce.set(0.0F);
84  mParticleMomentum.set(1.0F);
88  mOutput.set(1);
89  mOutputPause.set(0);
90  mParticleAlpha.set(1.0F);
91 
92  if (emitterNode == nullptr)
93  return;
94  for_each_xml_child_node(propertyNode, emitterNode)
95  {
96  if (xmlNameEqual(propertyNode, "property"))
97  {
98  const std::string name = XML::getProperty(
99  propertyNode, "name", "");
100 
101  if (name == "position-x")
102  {
103  mParticlePosX = readParticleEmitterProp(propertyNode, 0.0F);
104  }
105  else if (name == "position-y")
106  {
107  mParticlePosY = readParticleEmitterProp(propertyNode, 0.0F);
111  }
112  else if (name == "position-z")
113  {
114  mParticlePosZ = readParticleEmitterProp(propertyNode, 0.0F);
118  }
119  else if (name == "image")
120  {
121  std::string image = XML::getProperty(
122  propertyNode, "value", "");
123  // Don't leak when multiple images are defined
124  if (!image.empty() && (mParticleImage == nullptr))
125  {
126  if (!dyePalettes.empty())
127  Dye::instantiate(image, dyePalettes);
129  }
130  }
131  else if (name == "subimage")
132  {
133  std::string image = XML::getProperty(
134  propertyNode, "value", "");
135  // Don't leak when multiple images are defined
136  if (!image.empty() && (mParticleImage == nullptr))
137  {
138  if (!dyePalettes.empty())
139  Dye::instantiate(image, dyePalettes);
140  Image *img = Loader::getImage(image);
141  if (img != nullptr)
142  {
144  XML::getProperty(propertyNode, "x", 0),
145  XML::getProperty(propertyNode, "y", 0),
146  XML::getProperty(propertyNode, "width", 0),
147  XML::getProperty(propertyNode, "height", 0));
148  img->decRef();
149  }
150  else
151  {
152  mParticleImage = nullptr;
153  }
154  }
155  }
156  else if (name == "horizontal-angle")
157  {
159  readParticleEmitterProp(propertyNode, 0.0F);
161  += static_cast<float>(rotation);
164  += static_cast<float>(rotation);
167  }
168  else if (name == "vertical-angle")
169  {
171  readParticleEmitterProp(propertyNode, 0.0F);
175  }
176  else if (name == "power")
177  {
178  mParticlePower = readParticleEmitterProp(propertyNode, 0.0F);
179  }
180  else if (name == "gravity")
181  {
182  mParticleGravity = readParticleEmitterProp(propertyNode, 0.0F);
183  }
184  else if (name == "randomnes"
185  || name == "randomness") // legacy bug
186  {
187  mParticleRandomness = readParticleEmitterProp(propertyNode, 0);
188  }
189  else if (name == "bounce")
190  {
191  mParticleBounce = readParticleEmitterProp(propertyNode, 0.0F);
192  }
193  else if (name == "lifetime")
194  {
195  mParticleLifetime = readParticleEmitterProp(propertyNode, 0);
197  }
198  else if (name == "output")
199  {
200  mOutput = readParticleEmitterProp(propertyNode, 0);
201  mOutput.maxVal += 1;
202  }
203  else if (name == "output-pause")
204  {
205  mOutputPause = readParticleEmitterProp(propertyNode, 0);
207  }
208  else if (name == "acceleration")
209  {
211  propertyNode, 0.0F);
212  }
213  else if (name == "die-distance")
214  {
216  propertyNode, 0.0F);
217  }
218  else if (name == "momentum")
219  {
221  propertyNode, 1.0F);
222  }
223  else if (name == "fade-out")
224  {
225  mParticleFadeOut = readParticleEmitterProp(propertyNode, 0);
226  }
227  else if (name == "fade-in")
228  {
229  mParticleFadeIn = readParticleEmitterProp(propertyNode, 0);
230  }
231  else if (name == "alpha")
232  {
233  mParticleAlpha = readParticleEmitterProp(propertyNode, 1.0F);
234  }
235  else if (name == "follow-parent")
236  {
237  const std::string value = XML::getProperty(propertyNode,
238  "value", "0");
239  if (value == "1" || value == "true")
240  mParticleFollow = true;
241  }
242  else
243  {
244  logger->log("Particle Engine: Warning, "
245  "unknown emitter property \"%s\"",
246  name.c_str());
247  }
248  }
249  else if (xmlNameEqual(propertyNode, "emitter"))
250  {
251  ParticleEmitter newEmitter(propertyNode, mParticleTarget, map,
252  rotation, dyePalettes);
253  mParticleChildEmitters.push_back(newEmitter);
254  }
255  else if (xmlNameEqual(propertyNode, "rotation")
256  || xmlNameEqual(propertyNode, "animation"))
257  {
258  ImageSet *const imageset = getImageSet(propertyNode);
259  if (imageset == nullptr)
260  {
261  logger->log1("Error: no valid imageset");
262  continue;
263  }
264  mTempSets.push_back(imageset);
265 
266  Animation &animation = (xmlNameEqual(propertyNode, "rotation")) !=
268 
269  // Get animation frames
270  for_each_xml_child_node(frameNode, propertyNode)
271  {
272  const int delay = XML::getIntProperty(
273  frameNode, "delay", 0, 0, 100000);
274  const int offsetX = XML::getProperty(frameNode, "offsetX", 0)
275  - imageset->getWidth() / 2 + mapTileSize / 2;
276  const int offsetY = XML::getProperty(frameNode, "offsetY", 0)
277  - imageset->getHeight() + mapTileSize;
278  const int rand = XML::getIntProperty(
279  frameNode, "rand", 100, 0, 100);
280 
281  if (xmlNameEqual(frameNode, "frame"))
282  {
283  const int index = XML::getProperty(frameNode, "index", -1);
284 
285  if (index < 0)
286  {
287  logger->log1("No valid value for 'index'");
288  continue;
289  }
290 
291  Image *const img = imageset->get(index);
292 
293  if (img == nullptr)
294  {
295  logger->log("No image at index %d", index);
296  continue;
297  }
298 
299  animation.addFrame(img, delay,
300  offsetX, offsetY, rand);
301  }
302  else if (xmlNameEqual(frameNode, "sequence"))
303  {
304  int start = XML::getProperty(frameNode, "start", -1);
305  const int end = XML::getProperty(frameNode, "end", -1);
306 
307  if (start < 0 || end < 0)
308  {
309  logger->log1("No valid value for 'start' or 'end'");
310  continue;
311  }
312 
313  while (end >= start)
314  {
315  Image *const img = imageset->get(start);
316  if (img == nullptr)
317  {
318  logger->log("No image at index %d", start);
319  continue;
320  }
321 
322  animation.addFrame(img, delay,
323  offsetX, offsetY, rand);
324  start ++;
325  }
326  }
327  else if (xmlNameEqual(frameNode, "end"))
328  {
329  animation.addTerminator(rand);
330  }
331  } // for frameNode
332  }
333  else if (xmlNameEqual(propertyNode, "deatheffect"))
334  {
335  if (!XmlHaveChildContent(propertyNode))
336  continue;
337  mDeathEffect = XmlChildContent(propertyNode);
338  mDeathEffectConditions = 0x00;
339  if (XML::getBoolProperty(propertyNode, "on-floor", true))
340  {
343  }
344  if (XML::getBoolProperty(propertyNode, "on-sky", true))
345  {
348  }
349  if (XML::getBoolProperty(propertyNode, "on-other", false))
350  {
353  }
354  if (XML::getBoolProperty(propertyNode, "on-impact", true))
355  {
358  }
359  if (XML::getBoolProperty(propertyNode, "on-timeout", true))
360  {
363  }
364  }
365  }
366 }

References Animation::addFrame(), Animation::addTerminator(), CAST_S8, ParticleEmitterProp< T >::changeAmplitude, AliveStatus::DEAD_FLOOR, AliveStatus::DEAD_IMPACT, AliveStatus::DEAD_OTHER, AliveStatus::DEAD_SKY, AliveStatus::DEAD_TIMEOUT, Image::decRef(), DEG_RAD_FACTOR, for_each_xml_child_node, ImageSet::get(), XML::getBoolProperty(), ImageSet::getHeight(), Loader::getImage(), getImageSet(), XML::getIntProperty(), XML::getProperty(), Loader::getSubImage(), ImageSet::getWidth(), Dye::instantiate(), Logger::log(), Logger::log1(), logger, mapTileSize, ParticleEmitterProp< T >::maxVal, mDeathEffect, mDeathEffectConditions, ParticleEmitterProp< T >::minVal, mOutput, mOutputPause, mOutputPauseLeft, mParticleAcceleration, mParticleAlpha, mParticleAngleHorizontal, mParticleAngleVertical, mParticleAnimation, mParticleBounce, mParticleChildEmitters, mParticleDieDistance, mParticleFadeIn, mParticleFadeOut, mParticleFollow, mParticleGravity, mParticleImage, mParticleLifetime, mParticleMomentum, mParticlePosX, mParticlePosY, mParticlePosZ, mParticlePower, mParticleRandomness, mParticleRotation, mParticleTarget, mTempSets, readParticleEmitterProp(), ParticleEmitterProp< T >::set(), SIN45, anonymous_namespace{stringutils.cpp}::start, and ParticleEmitterProp< T >::value().

Referenced by createParticles().

◆ ParticleEmitter() [2/2]

ParticleEmitter::ParticleEmitter ( const ParticleEmitter o)

Copy Constructor (necessary for reference counting of particle images)

Definition at line 368 of file particleemitter.cpp.

369 {
370  *this = o;
371 }

◆ ~ParticleEmitter()

ParticleEmitter::~ParticleEmitter ( )

Destructor.

Definition at line 455 of file particleemitter.cpp.

456 {
458  {
459  if (*i != nullptr)
460  (*i)->decRef();
461  }
462  mTempSets.clear();
463 
464  if (mParticleImage != nullptr)
465  {
467  mParticleImage = nullptr;
468  }
469 }

References Image::decRef(), FOR_EACH, mParticleImage, and mTempSets.

Member Function Documentation

◆ adjustSize()

void ParticleEmitter::adjustSize ( const int  w,
const int  h 
)

Changes the size of the emitter so that the effect fills a rectangle of this size

Definition at line 605 of file particleemitter.cpp.

606 {
607  if (w == 0 || h == 0)
608  return; // new dimensions are illegal
609 
610  // calculate the old rectangle
611  const int oldArea = CAST_S32(
614  if (oldArea == 0)
615  {
616  // when the effect has no dimension it is
617  // not designed to be resizeable
618  return;
619  }
620 
621  // set the new dimensions
622  mParticlePosX.set(0, static_cast<float>(w));
623  mParticlePosY.set(0, static_cast<float>(h));
624  const int newArea = w * h;
625  // adjust the output so that the particle density stays the same
626  const float outputFactor = static_cast<float>(newArea)
627  / static_cast<float>(oldArea);
628  mOutput.minVal = CAST_S32(static_cast<float>(
629  mOutput.minVal) * outputFactor);
630  mOutput.maxVal = CAST_S32(static_cast<float>(
631  mOutput.maxVal) * outputFactor);
632 }

References CAST_S32, ParticleEmitterProp< T >::maxVal, ParticleEmitterProp< T >::minVal, mOutput, mParticlePosX, mParticlePosY, and ParticleEmitterProp< T >::set().

◆ createParticles()

void ParticleEmitter::createParticles ( const int  tick,
std::vector< Particle * > &  newParticles 
)

Spawns new particles

Definition at line 513 of file particleemitter.cpp.

515 {
516  if (mOutputPauseLeft > 0)
517  {
518  mOutputPauseLeft --;
519  return;
520  }
522 
523  for (int i = mOutput.value(tick); i > 0; i--)
524  {
525  // Limit maximum particles
527  break;
528 
529  Particle *newParticle = nullptr;
530  if (mParticleImage != nullptr)
531  {
532  const std::string &name = mParticleImage->mIdPath;
535  {
537  }
538 
540  break;
541 
542  newParticle = new ImageParticle(mParticleImage);
543  newParticle->setMap(mMap);
544  }
545  else if (!mParticleRotation.mFrames.empty())
546  {
547  Animation *const newAnimation = new Animation(mParticleRotation);
548  newParticle = new RotationalParticle(newAnimation);
549  newParticle->setMap(mMap);
550  }
551  else if (!mParticleAnimation.mFrames.empty())
552  {
553  Animation *const newAnimation = new Animation(mParticleAnimation);
554  newParticle = new AnimationParticle(newAnimation);
555  newParticle->setMap(mMap);
556  }
557  else
558  {
559  newParticle = new Particle;
560  newParticle->setMap(mMap);
561  }
562 
563  const Vector position(mParticlePosX.value(tick),
564  mParticlePosY.value(tick),
565  mParticlePosZ.value(tick));
566  newParticle->moveTo(position);
567 
568  const float angleH = mParticleAngleHorizontal.value(tick);
569  const float cosAngleH = static_cast<float>(cos(angleH));
570  const float sinAngleH = static_cast<float>(sin(angleH));
571  const float angleV = mParticleAngleVertical.value(tick);
572  const float cosAngleV = static_cast<float>(cos(angleV));
573  const float sinAngleV = static_cast<float>(sin(angleV));
574  const float power = mParticlePower.value(tick);
575  newParticle->setVelocity(cosAngleH * cosAngleV * power,
576  sinAngleH * cosAngleV * power,
577  sinAngleV * power);
578 
579  newParticle->setRandomness(mParticleRandomness.value(tick));
580  newParticle->setGravity(mParticleGravity.value(tick));
581  newParticle->setBounce(mParticleBounce.value(tick));
582  newParticle->setFollow(mParticleFollow);
583 
584  newParticle->setDestination(mParticleTarget,
586  mParticleMomentum.value(tick));
587 
588  newParticle->setDieDistance(mParticleDieDistance.value(tick));
589 
590  newParticle->setLifetime(mParticleLifetime.value(tick));
591  newParticle->setFadeOut(mParticleFadeOut.value(tick));
592  newParticle->setFadeIn(mParticleFadeIn.value(tick));
593  newParticle->setAlpha(mParticleAlpha.value(tick));
594 
596  newParticle->addEmitter(new ParticleEmitter(*it));
597 
598  if (!mDeathEffect.empty())
600 
601  newParticles.push_back(newParticle);
602  }
603 }

References Particle::addEmitter(), ParticleType::Animation, AttributesEnum::find(), FOR_EACH, ImageParticle::imageParticleCountByName, ParticleEngine::maxCount, mDeathEffect, mDeathEffectConditions, Animation::mFrames, Resource::mIdPath, mMap, mOutput, mOutputPause, mOutputPauseLeft, Particle::moveTo(), mParticleAcceleration, mParticleAlpha, mParticleAngleHorizontal, mParticleAngleVertical, mParticleAnimation, mParticleBounce, mParticleChildEmitters, mParticleDieDistance, mParticleFadeIn, mParticleFadeOut, mParticleFollow, mParticleGravity, mParticleImage, mParticleLifetime, mParticleMomentum, mParticlePosX, mParticlePosY, mParticlePosZ, mParticlePower, mParticleRandomness, mParticleRotation, mParticleTarget, ParticleEngine::particleCount, ParticleEmitter(), Particle::setAlpha(), Particle::setBounce(), Particle::setDeathEffect(), Particle::setDestination(), Particle::setDieDistance(), Particle::setFadeIn(), Particle::setFadeOut(), Particle::setFollow(), Particle::setGravity(), Particle::setLifetime(), Actor::setMap(), Particle::setRandomness(), Particle::setVelocity(), and ParticleEmitterProp< T >::value().

◆ getImageSet()

ImageSet * ParticleEmitter::getImageSet ( xmlNode *const  node)
staticprivate

Definition at line 373 of file particleemitter.cpp.

374 {
375  ImageSet *imageset = nullptr;
376  const int subX = XML::getProperty(node, "subX", -1);
377  if (subX != -1)
378  {
380  node, "imageset", ""));
381  if (img == nullptr)
382  return nullptr;
383 
384  Image *const img2 = Loader::getSubImage(img, subX,
385  XML::getProperty(node, "subY", 0),
386  XML::getProperty(node, "subWidth", 0),
387  XML::getProperty(node, "subHeight", 0));
388  if (img2 == nullptr)
389  {
390  img->decRef();
391  return nullptr;
392  }
393 
394  imageset = Loader::getSubImageSet(img2,
395  XML::getProperty(node, "width", 0),
396  XML::getProperty(node, "height", 0));
397  img2->decRef();
398  img->decRef();
399  }
400  else
401  {
402  imageset = Loader::getImageSet(
403  XML::getProperty(node, "imageset", ""),
404  XML::getProperty(node, "width", 0),
405  XML::getProperty(node, "height", 0));
406  }
407  return imageset;
408 }

References Image::decRef(), Loader::getImage(), Loader::getImageSet(), XML::getProperty(), Loader::getSubImage(), and Loader::getSubImageSet().

Referenced by ParticleEmitter().

◆ operator=()

ParticleEmitter & ParticleEmitter::operator= ( const ParticleEmitter o)

Assignment operator that calls the copy constructor

Definition at line 410 of file particleemitter.cpp.

411 {
430  mMap = o.mMap;
431  mOutput = o.mOutput;
439  mTempSets = o.mTempSets;
440 
442  {
443  if (*i != nullptr)
444  (*i)->incRef();
445  }
446 
447  mOutputPauseLeft = 0;
448 
449  if (mParticleImage != nullptr)
451 
452  return *this;
453 }

References FOR_EACH, Resource::incRef(), mDeathEffect, mDeathEffectConditions, mMap, mOutput, mOutputPause, mOutputPauseLeft, mParticleAcceleration, mParticleAlpha, mParticleAngleHorizontal, mParticleAngleVertical, mParticleAnimation, mParticleBounce, mParticleChildEmitters, mParticleDieDistance, mParticleFadeIn, mParticleFadeOut, mParticleFollow, mParticleGravity, mParticleImage, mParticleLifetime, mParticleMomentum, mParticlePosX, mParticlePosY, mParticlePosZ, mParticlePower, mParticleRandomness, mParticleRotation, mParticleTarget, and mTempSets.

◆ readParticleEmitterProp()

template<typename T >
ParticleEmitterProp< T > ParticleEmitter::readParticleEmitterProp ( xmlNode *const  propertyNode,
def 
)
staticprivate

Definition at line 472 of file particleemitter.cpp.

473 {
474  ParticleEmitterProp<T> retval;
475 
476  def = static_cast<T>(XML::getDoubleProperty(propertyNode, "value",
477  static_cast<double>(def)));
478  retval.set(static_cast<T>(XML::getDoubleProperty(propertyNode, "min",
479  static_cast<double>(def))), static_cast<T>(XML::getDoubleProperty(
480  propertyNode, "max", static_cast<double>(def))));
481 
482  const std::string change = XML::getProperty(
483  propertyNode, "change-func", "none");
484  T amplitude = static_cast<T>(XML::getDoubleProperty(propertyNode,
485  "change-amplitude", 0.0));
486 
487  const int period = XML::getProperty(propertyNode, "change-period", 0);
488  const int phase = XML::getProperty(propertyNode, "change-phase", 0);
489  if (change == "saw" || change == "sawtooth")
490  {
492  amplitude, period, phase);
493  }
494  else if (change == "sine" || change == "sinewave")
495  {
497  amplitude, period, phase);
498  }
499  else if (change == "triangle")
500  {
502  amplitude, period, phase);
503  }
504  else if (change == "square")
505  {
507  amplitude, period, phase);
508  }
509 
510  return retval;
511 }

References ParticleChangeFunc::FUNC_SAW, ParticleChangeFunc::FUNC_SINE, ParticleChangeFunc::FUNC_SQUARE, ParticleChangeFunc::FUNC_TRIANGLE, XML::getDoubleProperty(), XML::getProperty(), ParticleEmitterProp< T >::set(), and ParticleEmitterProp< T >::setFunction().

Referenced by ParticleEmitter().

◆ setTarget()

void ParticleEmitter::setTarget ( Particle *const  target)
inline

Sets the target of the particles that are created

Definition at line 78 of file particleemitter.h.

79  { mParticleTarget = target; }

References mParticleTarget.

Field Documentation

◆ mDeathEffect

std::string ParticleEmitter::mDeathEffect
private

Definition at line 158 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mDeathEffectConditions

signed char ParticleEmitter::mDeathEffectConditions
private

Definition at line 167 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mMap

Map* ParticleEmitter::mMap
private

Definition at line 132 of file particleemitter.h.

Referenced by createParticles(), and operator=().

◆ mOutput

ParticleEmitterProp<int> ParticleEmitter::mOutput
private

Definition at line 135 of file particleemitter.h.

Referenced by adjustSize(), createParticles(), operator=(), and ParticleEmitter().

◆ mOutputPause

ParticleEmitterProp<int> ParticleEmitter::mOutputPause
private

Definition at line 138 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mOutputPauseLeft

int ParticleEmitter::mOutputPauseLeft
private

Definition at line 165 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleAcceleration

ParticleEmitterProp<float> ParticleEmitter::mParticleAcceleration
private

Definition at line 120 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleAlpha

ParticleEmitterProp<float> ParticleEmitter::mParticleAlpha
private

Definition at line 153 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleAngleHorizontal

ParticleEmitterProp<float> ParticleEmitter::mParticleAngleHorizontal
private

initial vector of particles:

Definition at line 101 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleAngleVertical

ParticleEmitterProp<float> ParticleEmitter::mParticleAngleVertical
private

Definition at line 102 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleAnimation

Animation ParticleEmitter::mParticleAnimation
private

Definition at line 147 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleBounce

ParticleEmitterProp<float> ParticleEmitter::mParticleBounce
private

Definition at line 114 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleChildEmitters

std::list<ParticleEmitter> ParticleEmitter::mParticleChildEmitters
private

Definition at line 161 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleDieDistance

ParticleEmitterProp<float> ParticleEmitter::mParticleDieDistance
private

Definition at line 121 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleFadeIn

ParticleEmitterProp<int> ParticleEmitter::mParticleFadeIn
private

Definition at line 129 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleFadeOut

ParticleEmitterProp<int> ParticleEmitter::mParticleFadeOut
private

Definition at line 128 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleFollow

bool ParticleEmitter::mParticleFollow
private

Definition at line 169 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleGravity

ParticleEmitterProp<float> ParticleEmitter::mParticleGravity
private

Definition at line 112 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleImage

Image* ParticleEmitter::mParticleImage
private

Definition at line 144 of file particleemitter.h.

Referenced by createParticles(), operator=(), ParticleEmitter(), and ~ParticleEmitter().

◆ mParticleLifetime

ParticleEmitterProp<int> ParticleEmitter::mParticleLifetime
private

Definition at line 127 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleMomentum

ParticleEmitterProp<float> ParticleEmitter::mParticleMomentum
private

Definition at line 122 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticlePosX

ParticleEmitterProp<float> ParticleEmitter::mParticlePosX
private

initial position of particles:

Definition at line 96 of file particleemitter.h.

Referenced by adjustSize(), createParticles(), operator=(), and ParticleEmitter().

◆ mParticlePosY

ParticleEmitterProp<float> ParticleEmitter::mParticlePosY
private

Definition at line 96 of file particleemitter.h.

Referenced by adjustSize(), createParticles(), operator=(), and ParticleEmitter().

◆ mParticlePosZ

ParticleEmitterProp<float> ParticleEmitter::mParticlePosZ
private

Definition at line 96 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticlePower

ParticleEmitterProp<float> ParticleEmitter::mParticlePower
private

Initial velocity of particles

Definition at line 107 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleRandomness

ParticleEmitterProp<int> ParticleEmitter::mParticleRandomness
private

Definition at line 113 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleRotation

Animation ParticleEmitter::mParticleRotation
private

Definition at line 150 of file particleemitter.h.

Referenced by createParticles(), operator=(), and ParticleEmitter().

◆ mParticleTarget

Particle* ParticleEmitter::mParticleTarget
private

Definition at line 119 of file particleemitter.h.

Referenced by createParticles(), operator=(), ParticleEmitter(), and setTarget().

◆ mTempSets

std::vector<ImageSet*> ParticleEmitter::mTempSets
private

Definition at line 163 of file particleemitter.h.

Referenced by operator=(), ParticleEmitter(), and ~ParticleEmitter().


The documentation for this class was generated from the following files:
ParticleEmitterProp::maxVal
T maxVal
Definition: particleemitterprop.h:119
ParticleEmitter::mParticleDieDistance
ParticleEmitterProp< float > mParticleDieDistance
Definition: particleemitter.h:121
ParticleEmitter::mParticlePosY
ParticleEmitterProp< float > mParticlePosY
Definition: particleemitter.h:96
ParticleEngine::maxCount
static int maxCount
Definition: particleengine.h:52
AliveStatus::DEAD_SKY
@ DEAD_SKY
Definition: alivestatus.h:33
ParticleEmitter::mParticlePosX
ParticleEmitterProp< float > mParticlePosX
Definition: particleemitter.h:96
ParticleEmitterListCIter
std::list< ParticleEmitter >::const_iterator ParticleEmitterListCIter
Definition: particleemitter.cpp:51
anonymous_namespace{stringutils.cpp}::start
unsigned int start
Definition: stringutils.cpp:227
ParticleChangeFunc::FUNC_SQUARE
@ FUNC_SQUARE
Definition: particlechangefunc.h:34
SIN45
static const float SIN45
Definition: particleemitter.cpp:47
Particle::setLifetime
void setLifetime(const int lifetime)
Definition: particle.h:122
ParticleEmitter::mMap
Map * mMap
Definition: particleemitter.h:132
ParticleEmitter::mTempSets
std::vector< ImageSet * > mTempSets
Definition: particleemitter.h:163
Particle
Definition: particle.h:44
Particle::setAlpha
void setAlpha(const float alpha)
Definition: particle.h:236
ParticleType::Animation
@ Animation
Definition: particletype.h:29
ParticleEmitter::ParticleEmitter
ParticleEmitter(const xmlNode *const emitterNode, Particle *const target, Map *const map, const int rotation, const std::string &dyePalettes)
Definition: particleemitter.cpp:53
ParticleChangeFunc::FUNC_TRIANGLE
@ FUNC_TRIANGLE
Definition: particlechangefunc.h:33
Particle::setDieDistance
void setDieDistance(const float dist)
Definition: particle.h:193
ParticleEmitter::mParticleRandomness
ParticleEmitterProp< int > mParticleRandomness
Definition: particleemitter.h:113
AnimationParticle
Definition: animationparticle.h:32
Particle::setFollow
void setFollow(const bool follow)
Definition: particle.h:169
ParticleEmitter::readParticleEmitterProp
static ParticleEmitterProp< T > readParticleEmitterProp(xmlNode *const propertyNode, T def)
Definition: particleemitter.cpp:472
ParticleEmitter::mOutputPauseLeft
int mOutputPauseLeft
Definition: particleemitter.h:165
Particle::addEmitter
void addEmitter(ParticleEmitter *const emitter)
Definition: particle.h:100
ParticleEmitter::mParticleRotation
Animation mParticleRotation
Definition: particleemitter.h:150
ParticleEmitter::mParticleTarget
Particle * mParticleTarget
Definition: particleemitter.h:119
ParticleEmitter::mParticleFollow
bool mParticleFollow
Definition: particleemitter.h:169
Particle::setDeathEffect
virtual void setDeathEffect(const std::string &effectFile, const signed char conditions)
Definition: particle.h:239
ParticleEmitter::mOutputPause
ParticleEmitterProp< int > mOutputPause
Definition: particleemitter.h:138
Loader::getImageSet
ImageSet * getImageSet(const std::string &imagePath, const int w, const int h)
Definition: imagesetloader.cpp:65
Image
Definition: image.h:67
Particle::setDestination
void setDestination(Particle *const target, const float accel, const float moment)
Definition: particle.h:182
ParticleEmitter::getImageSet
static ImageSet * getImageSet(xmlNode *const node)
Definition: particleemitter.cpp:373
ParticleEngine::particleCount
static int particleCount
Definition: particleengine.h:51
AliveStatus::DEAD_IMPACT
@ DEAD_IMPACT
Definition: alivestatus.h:34
ParticleEmitter::mParticleBounce
ParticleEmitterProp< float > mParticleBounce
Definition: particleemitter.h:114
XML::getIntProperty
int getIntProperty(const xmlNodePtr node, const char *const name, int def, const int min, const int max)
Definition: libxml.cpp:189
XML::getProperty
int getProperty(const xmlNodePtr node, const char *const name, int def)
Definition: libxml.cpp:173
ImageSet::getWidth
int getWidth() const
Definition: imageset.h:59
AliveStatus::DEAD_OTHER
@ DEAD_OTHER
Definition: alivestatus.h:35
ParticleEmitterProp::minVal
T minVal
Definition: particleemitterprop.h:118
logger
Logger * logger
Definition: logger.cpp:88
AttributesEnum::find
bool find(const std::string &key)
Definition: attributesstrings.cpp:32
Resource::incRef
virtual void incRef()
Definition: resource.cpp:37
ParticleEmitter::mDeathEffectConditions
signed char mDeathEffectConditions
Definition: particleemitter.h:167
ParticleEmitter::mOutput
ParticleEmitterProp< int > mOutput
Definition: particleemitter.h:135
XML::getBoolProperty
bool getBoolProperty(const xmlNodePtr node, const char *const name, const bool def)
Definition: libxml.cpp:268
ParticleEmitterProp
Definition: particleemitterprop.h:32
Particle::setVelocity
void setVelocity(const float x, const float y, const float z)
Definition: particle.h:142
ParticleEmitter::mParticleFadeOut
ParticleEmitterProp< int > mParticleFadeOut
Definition: particleemitter.h:128
ImageSet::get
Image * get(const size_type i) const
Definition: imageset.cpp:66
ParticleEmitter::mParticleAnimation
Animation mParticleAnimation
Definition: particleemitter.h:147
CAST_S8
#define CAST_S8
Definition: cast.h:25
ImageParticle::imageParticleCountByName
static StringIntMap imageParticleCountByName
Definition: imageparticle.h:58
ParticleEmitterProp::setFunction
void setFunction(ParticleChangeFuncT func, T amplitude, const int period, const int phase)
Definition: particleemitterprop.h:57
Animation::addTerminator
void addTerminator(const int rand)
Definition: animation.cpp:55
ParticleEmitter::mParticleChildEmitters
std::list< ParticleEmitter > mParticleChildEmitters
Definition: particleemitter.h:161
Loader::getImage
Image * getImage(const std::string &idPath)
Definition: imageloader.cpp:85
ParticleEmitter
Definition: particleemitter.h:43
ParticleEmitter::mParticleAlpha
ParticleEmitterProp< float > mParticleAlpha
Definition: particleemitter.h:153
ParticleEmitter::mParticleFadeIn
ParticleEmitterProp< int > mParticleFadeIn
Definition: particleemitter.h:129
Particle::setGravity
void setGravity(const float gravity)
Definition: particle.h:150
Loader::getSubImageSet
ImageSet * getSubImageSet(Image *const parent, const int width, const int height)
Definition: subimagesetloader.cpp:64
ParticleChangeFunc::FUNC_SAW
@ FUNC_SAW
Definition: particlechangefunc.h:32
ParticleEmitter::mParticleAngleHorizontal
ParticleEmitterProp< float > mParticleAngleHorizontal
Definition: particleemitter.h:101
Particle::setBounce
void setBounce(const float bouncieness)
Definition: particle.h:163
DEG_RAD_FACTOR
static const float DEG_RAD_FACTOR
Definition: particleemitter.cpp:48
ParticleEmitter::mParticleLifetime
ParticleEmitterProp< int > mParticleLifetime
Definition: particleemitter.h:127
Animation
Definition: animation.h:40
XML::getDoubleProperty
double getDoubleProperty(const xmlNodePtr node, const char *const name, double def)
Definition: libxml.cpp:226
Logger::log1
void log1(const char *const log_text)
Definition: logger.cpp:237
Particle::setFadeOut
void setFadeOut(const int fadeOut)
Definition: particle.h:129
ImageSet::getHeight
int getHeight() const
Definition: imageset.h:65
ParticleEmitter::mParticleAngleVertical
ParticleEmitterProp< float > mParticleAngleVertical
Definition: particleemitter.h:102
ParticleEmitter::mParticleImage
Image * mParticleImage
Definition: particleemitter.h:144
Actor::setMap
virtual void setMap(Map *const map)
Definition: actor.cpp:47
ParticleEmitterProp::value
T value(int tick) const
Definition: particleemitterprop.h:70
Loader::getSubImage
Image * getSubImage(Image *const parent, const int x, const int y, const int width, const int height)
Definition: subimageloader.cpp:67
ParticleEmitter::mParticleMomentum
ParticleEmitterProp< float > mParticleMomentum
Definition: particleemitter.h:122
ParticleEmitter::mDeathEffect
std::string mDeathEffect
Definition: particleemitter.h:158
ActorType::T
T
Definition: actortype.h:27
Dye::instantiate
static void instantiate(std::string &target, const std::string &palettes)
Definition: dye.cpp:96
CAST_S32
#define CAST_S32
Definition: cast.h:29
ParticleEmitterProp::set
void set(const T min, const T max)
Definition: particleemitterprop.h:46
Particle::setRandomness
void setRandomness(const int r)
Definition: particle.h:156
Animation::addFrame
void addFrame(Image *const image, const int delay, const int offsetX, const int offsetY, const int rand)
Definition: animation.cpp:45
ParticleEmitter::mParticlePosZ
ParticleEmitterProp< float > mParticlePosZ
Definition: particleemitter.h:96
for_each_xml_child_node
#define for_each_xml_child_node(var, parent)
Definition: libxml.h:160
Particle::setFadeIn
void setFadeIn(const int fadeIn)
Definition: particle.h:136
RotationalParticle
Definition: rotationalparticle.h:32
Vector
Definition: vector.h:38
ImageSet
Definition: imageset.h:37
ParticleEmitter::mParticleGravity
ParticleEmitterProp< float > mParticleGravity
Definition: particleemitter.h:112
AliveStatus::DEAD_TIMEOUT
@ DEAD_TIMEOUT
Definition: alivestatus.h:31
ParticleChangeFunc::FUNC_SINE
@ FUNC_SINE
Definition: particlechangefunc.h:31
ImageParticle
Definition: imageparticle.h:35
Particle::moveTo
void moveTo(const Vector &pos)
Definition: particle.h:106
ParticleEmitter::mParticleAcceleration
ParticleEmitterProp< float > mParticleAcceleration
Definition: particleemitter.h:120
Logger::log
void log(const char *const log_text,...)
Definition: logger.cpp:268
FOR_EACH
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
Resource::mIdPath
std::string mIdPath
Definition: resource.h:83
ParticleEmitter::mParticlePower
ParticleEmitterProp< float > mParticlePower
Definition: particleemitter.h:107
Image::decRef
void decRef()
Definition: image.cpp:522
ParticleEmitterProp::changeAmplitude
T changeAmplitude
Definition: particleemitterprop.h:122
AliveStatus::DEAD_FLOOR
@ DEAD_FLOOR
Definition: alivestatus.h:32
mapTileSize
static const int mapTileSize
Definition: map.h:26
ImageSetVectorCIter
std::vector< ImageSet * >::const_iterator ImageSetVectorCIter
Definition: particleemitter.cpp:50
Animation::mFrames
Frames mFrames
Definition: animation.h:98