ManaPlus
particleemitter.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2006-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef PARTICLE_PARTICLEEMITTER_H
25 #define PARTICLE_PARTICLEEMITTER_H
26 
28 
30 
31 #include "utils/xml.h"
32 
33 #include <list>
34 
35 class Image;
36 class ImageSet;
37 class Map;
38 class Particle;
39 
45 {
46  public:
47  ParticleEmitter(XmlNodeConstPtrConst emitterNode,
48  Particle *const target,
49  Map *const map,
50  const int rotation,
51  const std::string& dyePalettes) A_NONNULL(3);
52 
57 
59 
60 
64 
69 
73  void createParticles(const int tick,
74  STD_VECTOR<Particle*> &newParticles);
75 
79  void setTarget(Particle *const target)
80  { mParticleTarget = target; }
81 
86  void adjustSize(const int w, const int h);
87 
88  private:
89  template <typename T> static ParticleEmitterProp<T>
90  readParticleEmitterProp(XmlNodePtrConst propertyNode, T def);
91 
92  static ImageSet *getImageSet(XmlNodePtrConst node);
93 
98 
104 
109 
110  /*
111  * Vector changing of particles:
112  */
116 
117  /*
118  * Properties of targeting particles:
119  */
124 
125  /*
126  * Behavior over time of the particles:
127  */
131 
132  // Map the particles are spawned on
134 
135  // Number of particles spawned per update
137 
138  // Pause in frames between two spawns
140 
141  /*
142  * Graphical representation of the particles
143  */
144  // Particle image, if used
146 
147  // Filename of particle animation file
149 
150  // Filename of particle rotation file
152 
153  // Opacity of the graphical representation of the particles
155 
156  /*
157  * Death effect of the particles
158  */
159  std::string mDeathEffect;
160 
161  // List of emitters the spawned particles are equipped with
162  std::list<ParticleEmitter> mParticleChildEmitters;
163 
164  STD_VECTOR<ImageSet*> mTempSets;
165 
167 
169 
171 };
172 #endif // PARTICLE_PARTICLEEMITTER_H
Definition: map.h:75
ParticleEmitter(const xmlNode *const emitterNode, Particle *const target, Map *const map, const int rotation, const std::string &dyePalettes)
std::string mDeathEffect
Particle * mParticleTarget
ParticleEmitterProp< float > mParticlePosZ
ParticleEmitterProp< int > mOutput
static ImageSet * getImageSet(xmlNode *const node)
ParticleEmitterProp< float > mParticleAngleHorizontal
ParticleEmitterProp< float > mParticleDieDistance
ParticleEmitterProp< int > mParticleFadeIn
std::list< ParticleEmitter > mParticleChildEmitters
static ParticleEmitterProp< T > readParticleEmitterProp(xmlNode *const propertyNode, T def)
signed char mDeathEffectConditions
ParticleEmitterProp< int > mParticleRandomness
ParticleEmitterProp< float > mParticlePower
void setTarget(Particle *const target)
ParticleEmitterProp< int > mParticleLifetime
void adjustSize(const int w, const int h)
ParticleEmitterProp< float > mParticleAngleVertical
ParticleEmitterProp< float > mParticleAcceleration
ParticleEmitterProp< float > mParticleGravity
void createParticles(const int tick, std::vector< Particle * > &newParticles)
ParticleEmitter & operator=(const ParticleEmitter &o)
ParticleEmitterProp< int > mParticleFadeOut
ParticleEmitterProp< float > mParticleAlpha
Animation mParticleAnimation
ParticleEmitterProp< float > mParticlePosX
ParticleEmitterProp< float > mParticleBounce
Animation mParticleRotation
std::vector< ImageSet * > mTempSets
ParticleEmitterProp< float > mParticleMomentum
ParticleEmitterProp< float > mParticlePosY
ParticleEmitterProp< int > mOutputPause
#define A_NONNULL(...)
Definition: localconsts.h:168
#define final
Definition: localconsts.h:46
#define A_DEFAULT_COPY(func)
Definition: localconsts.h:41