summaryrefslogtreecommitdiff
path: root/src/particle/particleengine.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-16 19:13:22 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-16 19:36:44 +0300
commitea31dc2bd04362265449afa9e54398f4cf628e74 (patch)
tree7ae86f9638dbd2658048537e7a4ced52d5c5c21f /src/particle/particleengine.h
parentac65e2c9b72e35a9e5a1a84da57ecdbd41e5923e (diff)
downloadplus-ea31dc2bd04362265449afa9e54398f4cf628e74.tar.gz
plus-ea31dc2bd04362265449afa9e54398f4cf628e74.tar.bz2
plus-ea31dc2bd04362265449afa9e54398f4cf628e74.tar.xz
plus-ea31dc2bd04362265449afa9e54398f4cf628e74.zip
Remove unused functions from ParticleEngine.
Diffstat (limited to 'src/particle/particleengine.h')
-rw-r--r--src/particle/particleengine.h236
1 files changed, 5 insertions, 231 deletions
diff --git a/src/particle/particleengine.h b/src/particle/particleengine.h
index 8916c0ac1..93688f777 100644
--- a/src/particle/particleengine.h
+++ b/src/particle/particleengine.h
@@ -23,14 +23,13 @@
#ifndef PARTICLE_PARTICLEENGINE_H
#define PARTICLE_PARTICLEENGINE_H
-#include "being/actor.h"
-
#include "enums/particle/alivestatus.h"
#include "localconsts.h"
class Color;
class Font;
+class Map;
class Particle;
class ParticleEmitter;
@@ -41,7 +40,7 @@ typedef std::list<ParticleEmitter *> Emitters;
typedef Emitters::iterator EmitterIterator;
typedef Emitters::const_iterator EmitterConstIterator;
-class ParticleEngine final : public Actor
+class ParticleEngine final
{
public:
static const float PARTICLE_SKY; // Maximum Z position of particles
@@ -80,26 +79,6 @@ class ParticleEngine final : public Actor
bool update() restrict2;
/**
- * Draws the particle image.
- */
- void draw(Graphics *restrict const graphics,
- const int offsetX,
- const int offsetY) const restrict2 override
- A_CONST A_NONNULL(2);
-
- /**
- * Necessary for sorting with the other sprites.
- */
- int getPixelY() const restrict2 override A_WARN_UNUSED
- { return CAST_S32(mPos.y) - 16; }
-
- /**
- * Necessary for sorting with the other sprites for sorting only.
- */
- int getSortPixelY() const restrict2 override A_WARN_UNUSED
- { return CAST_S32(mPos.y) - 16; }
-
- /**
* Creates a blank particle as a child of the current particle
* Useful for creating target particles
*/
@@ -133,219 +112,14 @@ class ParticleEngine final : public Actor
const bool outline = false)
restrict2 A_NONNULL(5, 6);
- /**
- * Adds an emitter to the particle.
- */
- void addEmitter(ParticleEmitter *const emitter) restrict2 A_NONNULL(2)
- { mChildEmitters.push_back(emitter); }
-
- /**
- * Sets the position in 3 dimensional space in pixels relative to map.
- */
- void moveTo(const Vector &restrict pos) restrict2
- { moveBy(pos - mPos); }
-
- /**
- * Sets the position in 2 dimensional space in pixels relative to map.
- */
- void moveTo(const float x, const float y) restrict2;
-
- /**
- * Changes the particle position relative
- */
- void moveBy(const Vector &restrict change) restrict2;
-
- /**
- * Sets the time in game ticks until the particle is destroyed.
- */
- void setLifetime(const int lifetime) restrict2 noexcept
- { mLifetimeLeft = lifetime; mLifetimePast = 0; }
-
- /**
- * Sets the age of the pixel in game ticks where the particle has
- * faded in completely.
- */
- void setFadeOut(const int fadeOut) restrict2 noexcept
- { mFadeOut = fadeOut; }
-
- /**
- * Sets the remaining particle lifetime where the particle starts to
- * fade out.
- */
- void setFadeIn(const int fadeIn) restrict2 noexcept
- { mFadeIn = fadeIn; }
-
- /**
- * Sets the current velocity in 3 dimensional space.
- */
- void setVelocity(const float x,
- const float y,
- const float z) restrict2 noexcept
- { mVelocity.x = x; mVelocity.y = y; mVelocity.z = z; }
-
- /**
- * Sets the downward acceleration.
- */
- void setGravity(const float gravity) restrict2 noexcept
- { mGravity = gravity; }
-
- /**
- * Sets the ammount of random vector changes
- */
- void setRandomness(const int r) restrict2 noexcept
- { mRandomness = r; }
-
- /**
- * Sets the ammount of velocity particles retain after
- * hitting the ground.
- */
- void setBounce(const float bouncieness) restrict2 noexcept
- { mBounce = bouncieness; }
-
- /**
- * Sets the flag if the particle is supposed to be moved by its parent
- */
- void setFollow(const bool follow) restrict2 noexcept
- { mFollow = follow; }
-
- /**
- * Gets the flag if the particle is supposed to be moved by its parent
- */
- bool doesFollow() const restrict2 noexcept A_WARN_UNUSED
- { return mFollow; }
-
- /**
- * Makes the particle move toward another particle with a
- * given acceleration and momentum
- */
- void setDestination(Particle *restrict const target,
- const float accel,
- const float moment) restrict2 noexcept A_NONNULL(2)
- { mTarget = target; mAcceleration = accel; mMomentum = moment; }
-
- /**
- * Sets the distance in pixel the particle can come near the target
- * particle before it is destroyed. Does only make sense after a target
- * particle has been set using setDestination.
- */
- void setDieDistance(const float dist) restrict2
- { mInvDieDistance = 1.0F / dist; }
-
- /**
- * Changes the size of the emitters so that the effect fills a
- * rectangle of this size
- */
- void adjustEmitterSize(const int w, const int h) restrict2;
-
- void setAllowSizeAdjust(const bool adjust) restrict2 noexcept
- { mAllowSizeAdjust = adjust; }
-
- bool isAlive() const restrict2 noexcept A_WARN_UNUSED
- { return mAlive == AliveStatus::ALIVE; }
-
- void prepareToDie() restrict2;
-
- /**
- * Determines whether the particle and its children are all dead
- */
- bool isExtinct() const restrict2 noexcept A_WARN_UNUSED
- { return !isAlive() && mChildParticles.empty(); }
-
- /**
- * Manually marks the particle for deletion.
- */
- void kill() restrict2 noexcept
- { mAlive = AliveStatus::DEAD_OTHER; mAutoDelete = true; }
-
- /**
- * After calling this function the particle will only request
- * deletion when kill() is called
- */
- void disableAutoDelete() restrict2 noexcept
- { mAutoDelete = false; }
+ void setMap(Map *const map)
+ { mMap = map; }
- /** We consider particles (at least for now) to be one layer-sprites */
- int getNumberOfLayers() const restrict2 override final
- { return 1; }
-
- float getAlpha() const restrict2 override final
- { return 1.0F; }
-
- void setAlpha(const float alpha A_UNUSED) restrict2 override
- { }
-
- void setDeathEffect(const std::string &restrict effectFile,
- const signed char conditions) restrict2
- { mDeathEffect = effectFile; mDeathEffectConditions = conditions; }
-
- protected:
- void updateSelf() restrict2;
-
- // Opacity of the graphical representation of the particle
- float mAlpha;
-
- // Lifetime left in game ticks
- int mLifetimeLeft;
-
- // Age of the particle in game ticks
- int mLifetimePast;
-
- // Lifetime in game ticks left where fading out begins
- int mFadeOut;
-
- // Age in game ticks where fading in is finished
- int mFadeIn;
-
- // Speed in pixels per game-tick.
- Vector mVelocity;
-
- // Is the particle supposed to be drawn and updated?
- AliveStatusT mAlive;
private:
- // List of child emitters.
- Emitters mChildEmitters;
-
// List of particles controlled by this particle
Particles mChildParticles;
- // Particle effect file to be spawned when the particle dies
- std::string mDeathEffect;
-
- // dynamic particle
- // Downward acceleration in pixels per game-tick.
- float mGravity;
-
- // How much the particle bounces off when hitting the ground
- float mBounce;
-
- // Acceleration towards the target particle in pixels per game-tick
- float mAcceleration;
-
- // Distance in pixels from the target particle that causes
- // the destruction of the particle
- float mInvDieDistance;
-
- // How much speed the particle retains after each game tick
- float mMomentum;
-
- // The particle that attracts this particle
- Particle *restrict mTarget;
-
- // Ammount of random vector change
- int mRandomness;
-
- // Bitfield of death conditions which trigger spawning
- // of the death particle
- signed char mDeathEffectConditions;
-
- // May the particle request its deletion by the parent particle?
- bool mAutoDelete;
-
- // Can the effect size be adjusted by the object props in the map file?
- bool mAllowSizeAdjust;
-
- // is this particle moved when its parent particle moves?
- bool mFollow;
+ Map *mMap;
};
extern ParticleEngine *particleEngine;