summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-18 22:13:37 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-18 22:13:37 +0200
commitf4792bc06f21335fc2d1171d937ea7645ca0c253 (patch)
treec7b11cf81f254f5b9ed2f5dbfe127649abc7545a /src/particle.cpp
parentf98d003e354a1792117b7cbc771d1dd91475a156 (diff)
downloadmanaverse-f4792bc06f21335fc2d1171d937ea7645ca0c253.tar.gz
manaverse-f4792bc06f21335fc2d1171d937ea7645ca0c253.tar.bz2
manaverse-f4792bc06f21335fc2d1171d937ea7645ca0c253.tar.xz
manaverse-f4792bc06f21335fc2d1171d937ea7645ca0c253.zip
Fix most conversions except manaserv net code and some other code.
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp51
1 files changed, 29 insertions, 22 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index 9ecd8e65d..807bca084 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -140,8 +140,8 @@ bool Particle::update()
+ static_cast<float>(fabs(dist.z));
break;
default:
- invHypotenuse = 1.0f / sqrt(
- dist.x * dist.x + dist.y * dist.y + dist.z * dist.z);
+ invHypotenuse = 1.0f / static_cast<float>(sqrt(
+ dist.x * dist.x + dist.y * dist.y + dist.z * dist.z));
break;
}
@@ -156,12 +156,12 @@ bool Particle::update()
if (mRandomness > 0)
{
- mVelocity.x += (rand() % mRandomness - rand()
- % mRandomness) / 1000.0f;
- mVelocity.y += (rand() % mRandomness - rand()
- % mRandomness) / 1000.0f;
- mVelocity.z += (rand() % mRandomness - rand()
- % mRandomness) / 1000.0f;
+ mVelocity.x += static_cast<float>((rand() % mRandomness - rand()
+ % mRandomness)) / 1000.0f;
+ mVelocity.y += static_cast<float>((rand() % mRandomness - rand()
+ % mRandomness)) / 1000.0f;
+ mVelocity.z += static_cast<float>((rand() % mRandomness - rand()
+ % mRandomness)) / 1000.0f;
}
mVelocity.z -= mGravity;
@@ -327,12 +327,12 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
}
// Read and set the basic properties of the particle
- float offsetX = XML::getFloatProperty(
- effectChildNode, "position-x", 0);
- float offsetY = XML::getFloatProperty(
- effectChildNode, "position-y", 0);
- float offsetZ = XML::getFloatProperty(
- effectChildNode, "position-z", 0);
+ float offsetX = static_cast<float>(XML::getFloatProperty(
+ effectChildNode, "position-x", 0));
+ float offsetY = static_cast<float>(XML::getFloatProperty(
+ effectChildNode, "position-y", 0));
+ float offsetZ = static_cast<float>(XML::getFloatProperty(
+ effectChildNode, "position-z", 0));
Vector position (mPos.x + static_cast<float>(pixelX) + offsetX,
mPos.y + static_cast<float>(pixelY) + offsetY,
mPos.z + offsetZ);
@@ -363,23 +363,28 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
char deathEffectConditions = 0x00;
if (XML::getBoolProperty(emitterNode, "on-floor", true))
{
- deathEffectConditions += Particle::DEAD_FLOOR;
+ deathEffectConditions += static_cast<char>(
+ Particle::DEAD_FLOOR);
}
if (XML::getBoolProperty(emitterNode, "on-sky", true))
{
- deathEffectConditions += Particle::DEAD_SKY;
+ deathEffectConditions += static_cast<char>(
+ Particle::DEAD_SKY);
}
if (XML::getBoolProperty(emitterNode, "on-other", false))
{
- deathEffectConditions += Particle::DEAD_OTHER;
+ deathEffectConditions += static_cast<char>(
+ Particle::DEAD_OTHER);
}
if (XML::getBoolProperty(emitterNode, "on-impact", true))
{
- deathEffectConditions += Particle::DEAD_IMPACT;
+ deathEffectConditions += static_cast<char>(
+ Particle::DEAD_IMPACT);
}
if (XML::getBoolProperty(emitterNode, "on-timeout", true))
{
- deathEffectConditions += Particle::DEAD_TIMEOUT;
+ deathEffectConditions += static_cast<char>(
+ Particle::DEAD_TIMEOUT);
}
newParticle->setDeathEffect(
deathEffect, deathEffectConditions);
@@ -398,9 +403,11 @@ Particle *Particle::addTextSplashEffect(const std::string &text, int x, int y,
{
Particle *newParticle = new TextParticle(mMap, text, color, font, outline);
newParticle->moveTo(static_cast<float>(x), static_cast<float>(y));
- newParticle->setVelocity(((rand() % 100) - 50) / 200.0f, // X
- ((rand() % 100) - 50) / 200.0f, // Y
- ((rand() % 100) / 200.0f) + 4.0f); // Z
+ newParticle->setVelocity(
+ static_cast<float>((rand() % 100) - 50) / 200.0f, // X
+ static_cast<float>((rand() % 100) - 50) / 200.0f, // Y
+ (static_cast<float>((rand() % 100)) / 200.0f) + 4.0f); // Z
+
newParticle->setGravity(0.1f);
newParticle->setBounce(0.5f);
newParticle->setLifetime(200);