summaryrefslogtreecommitdiff
path: root/src/particle.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-12 13:24:16 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-12 21:23:10 +0100
commit306ad2effe4d0897453e61ad787e01dc47c33076 (patch)
tree75b8b291af55e80d01d9eb85afd7d465233a1a57 /src/particle.h
parent66599a9896e0cf69b58c0a73152aba4750d87af2 (diff)
downloadmana-306ad2effe4d0897453e61ad787e01dc47c33076.tar.gz
mana-306ad2effe4d0897453e61ad787e01dc47c33076.tar.bz2
mana-306ad2effe4d0897453e61ad787e01dc47c33076.tar.xz
mana-306ad2effe4d0897453e61ad787e01dc47c33076.zip
General code cleanups
* Use default member initializers * Use range-based for loops * Avoid needless pointer references for ShopItem::mDuplicates * Removed type aliases that are only used once or twice * Removed more unused includes * Removed some unused functions * Removed superfluous .c_str() * Rely on default copy and assignment operators for Vector class * Use std::unique_ptr in some places * Removed duplicated mPlayerMoney updating in SellDialog * Removed duplicated Game::handleInput call * Removed unused SDLInput::mMouseInWindow * Removed remnant of manual widget positioning in HelpWindow * Removed superfluous initialization of static pointers
Diffstat (limited to 'src/particle.h')
-rw-r--r--src/particle.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/particle.h b/src/particle.h
index 68b1efd9..eece1f85 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -262,38 +262,38 @@ class Particle : public Actor
protected:
/** Opacity of the graphical representation of the particle */
- float mAlpha;
+ float mAlpha = 1.0f;
/** Calculates the current alpha transparency taking current fade status into account*/
float getCurrentAlpha() const;
- int mLifetimeLeft; /**< Lifetime left in game ticks*/
- int mLifetimePast; /**< Age of the particle in game ticks*/
- int mFadeOut; /**< Lifetime in game ticks left where fading out begins*/
- int mFadeIn; /**< Age in game ticks where fading in is finished*/
- Vector mVelocity; /**< Speed in pixels per game-tick. */
+ int mLifetimeLeft = -1; /**< Lifetime left in game ticks*/
+ int mLifetimePast = 0; /**< Age of the particle in game ticks*/
+ int mFadeOut = 0; /**< Lifetime in game ticks left where fading out begins*/
+ int mFadeIn = 0; /**< Age in game ticks where fading in is finished*/
+ Vector mVelocity; /**< Speed in pixels per game-tick. */
private:
- AliveStatus mAlive; /**< Is the particle supposed to be drawn and updated?*/
+ AliveStatus mAlive = ALIVE; /**< Is the particle supposed to be drawn and updated?*/
// generic properties
- bool mAutoDelete; /**< May the particle request its deletion by the parent particle? */
- 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? */
- std::string mDeathEffect; /**< Particle effect file to be spawned when the particle dies */
- char mDeathEffectConditions;/**< Bitfield of death conditions which trigger spawning of the death particle */
+ bool mAutoDelete = true; /**< May the particle request its deletion by the parent particle? */
+ Emitters mChildEmitters; /**< List of child emitters. */
+ Particles mChildParticles; /**< List of particles controlled by this particle */
+ bool mAllowSizeAdjust = false; /**< Can the effect size be adjusted by the object props in the map file? */
+ std::string mDeathEffect; /**< Particle effect file to be spawned when the particle dies */
+ char mDeathEffectConditions = 0;/**< Bitfield of death conditions which trigger spawning of the death particle */
// dynamic particle
- float mGravity; /**< Downward acceleration in pixels per game-tick. */
- int mRandomness; /**< Ammount of random vector change */
- float mBounce; /**< How much the particle bounces off when hitting the ground */
- bool mFollow; /**< is this particle moved when its parent particle moves? */
+ float mGravity = 0.0f; /**< Downward acceleration in pixels per game-tick. */
+ int mRandomness = 0; /**< Ammount of random vector change */
+ float mBounce = 0.0f; /**< How much the particle bounces off when hitting the ground */
+ bool mFollow = false; /**< is this particle moved when its parent particle moves? */
// follow-point particles
- Particle *mTarget; /**< The particle that attracts this particle*/
- float mAcceleration; /**< Acceleration towards the target particle in pixels per game-tick*/
- float mInvDieDistance; /**< Distance in pixels from the target particle that causes the destruction of the particle*/
- float mMomentum; /**< How much speed the particle retains after each game tick*/
+ Particle *mTarget = nullptr; /**< The particle that attracts this particle*/
+ float mAcceleration = 0.0f; /**< Acceleration towards the target particle in pixels per game-tick*/
+ float mInvDieDistance = -1.0f; /**< Distance in pixels from the target particle that causes the destruction of the particle*/
+ float mMomentum = 1.0f; /**< How much speed the particle retains after each game tick*/
};
extern Particle *particleEngine;