summaryrefslogtreecommitdiff
path: root/src/rotationalparticle.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-24 00:11:07 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-24 00:11:07 +0300
commit2aa5e6701cc6bcc18b1f797dba25e4023f604845 (patch)
treee08789a11163a3768407bf1fb3f82e2e52a31db5 /src/rotationalparticle.cpp
parent944aaba6adf16becb8c82efd35df25f8c90e25b5 (diff)
downloadplus-2aa5e6701cc6bcc18b1f797dba25e4023f604845.tar.gz
plus-2aa5e6701cc6bcc18b1f797dba25e4023f604845.tar.bz2
plus-2aa5e6701cc6bcc18b1f797dba25e4023f604845.tar.xz
plus-2aa5e6701cc6bcc18b1f797dba25e4023f604845.zip
improve rotationalparticle class.
Diffstat (limited to 'src/rotationalparticle.cpp')
-rw-r--r--src/rotationalparticle.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rotationalparticle.cpp b/src/rotationalparticle.cpp
index 407bcaa56..d3b296587 100644
--- a/src/rotationalparticle.cpp
+++ b/src/rotationalparticle.cpp
@@ -28,6 +28,7 @@
#include "debug.h"
static const double PI = 3.14159265;
+static const float PI2 = 2 * 3.14159265;
RotationalParticle::RotationalParticle(Map *const map,
Animation *const animation) :
@@ -64,12 +65,12 @@ bool RotationalParticle::update()
float rad = static_cast<float>(atan2(mVelocity.x, mVelocity.y));
if (rad < 0)
- rad = static_cast<float>(PI) + static_cast<float>(PI) + rad;
+ rad = PI2 + rad;
const float range = static_cast<const float>(PI / size);
// Determines which frame the particle should play
- if (rad < range || rad > ((static_cast<float>(PI)*2) - range))
+ if (rad < range || rad > PI2 - range)
{
mAnimation->setFrame(0);
}