summaryrefslogtreecommitdiff
path: root/src/particle
diff options
context:
space:
mode:
Diffstat (limited to 'src/particle')
-rw-r--r--src/particle/imageparticle.cpp4
-rw-r--r--src/particle/particle.cpp12
-rw-r--r--src/particle/particle.h4
-rw-r--r--src/particle/particleemitter.cpp18
-rw-r--r--src/particle/particlevector.cpp6
-rw-r--r--src/particle/textparticle.cpp8
-rw-r--r--src/particle/textparticle.h4
7 files changed, 28 insertions, 28 deletions
diff --git a/src/particle/imageparticle.cpp b/src/particle/imageparticle.cpp
index 651c879d7..d6914eafc 100644
--- a/src/particle/imageparticle.cpp
+++ b/src/particle/imageparticle.cpp
@@ -75,9 +75,9 @@ void ImageParticle::draw(Graphics *restrict const graphics,
if (mAlive != AliveStatus::ALIVE || !mImage)
return;
- const int screenX = static_cast<int>(mPos.x)
+ const int screenX = CAST_S32(mPos.x)
+ offsetX - mImage->mBounds.w / 2;
- const int screenY = static_cast<int>(mPos.y) - static_cast<int>(mPos.z)
+ const int screenY = CAST_S32(mPos.y) - CAST_S32(mPos.z)
+ offsetY - mImage->mBounds.h / 2;
// Check if on screen
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index f22f11252..73cbb4b0d 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -223,7 +223,7 @@ bool Particle::update() restrict2
if (mAlive != AliveStatus::ALIVE &&
mAlive != AliveStatus::DEAD_LONG_AGO)
{
- if ((static_cast<unsigned int>(mAlive) & mDeathEffectConditions)
+ if ((CAST_U32(mAlive) & mDeathEffectConditions)
> 0x00 && !mDeathEffect.empty())
{
Particle *restrict const deathEffect = particleEngine->addEffect(
@@ -396,27 +396,27 @@ Particle *Particle::addEffect(const std::string &restrict particleEffectFile,
char deathEffectConditions = 0x00;
if (XML::getBoolProperty(emitterNode, "on-floor", true))
{
- deathEffectConditions += static_cast<signed char>(
+ deathEffectConditions += CAST_S8(
AliveStatus::DEAD_FLOOR);
}
if (XML::getBoolProperty(emitterNode, "on-sky", true))
{
- deathEffectConditions += static_cast<signed char>(
+ deathEffectConditions += CAST_S8(
AliveStatus::DEAD_SKY);
}
if (XML::getBoolProperty(emitterNode, "on-other", false))
{
- deathEffectConditions += static_cast<signed char>(
+ deathEffectConditions += CAST_S8(
AliveStatus::DEAD_OTHER);
}
if (XML::getBoolProperty(emitterNode, "on-impact", true))
{
- deathEffectConditions += static_cast<signed char>(
+ deathEffectConditions += CAST_S8(
AliveStatus::DEAD_IMPACT);
}
if (XML::getBoolProperty(emitterNode, "on-timeout", true))
{
- deathEffectConditions += static_cast<signed char>(
+ deathEffectConditions += CAST_S8(
AliveStatus::DEAD_TIMEOUT);
}
newParticle->setDeathEffect(
diff --git a/src/particle/particle.h b/src/particle/particle.h
index 9c2cb1a09..72c40493d 100644
--- a/src/particle/particle.h
+++ b/src/particle/particle.h
@@ -94,13 +94,13 @@ class Particle notfinal : public Actor
* Necessary for sorting with the other sprites.
*/
int getPixelY() const restrict2 override A_WARN_UNUSED
- { return static_cast<int>(mPos.y) - 16; }
+ { 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 static_cast<int>(mPos.y) - 16; }
+ { return CAST_S32(mPos.y) - 16; }
/**
* Creates a blank particle as a child of the current particle
diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp
index a512cff94..d82282060 100644
--- a/src/particle/particleemitter.cpp
+++ b/src/particle/particleemitter.cpp
@@ -323,27 +323,27 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtrConst emitterNode,
mDeathEffectConditions = 0x00;
if (XML::getBoolProperty(propertyNode, "on-floor", true))
{
- mDeathEffectConditions += static_cast<signed char>(
+ mDeathEffectConditions += CAST_S8(
AliveStatus::DEAD_FLOOR);
}
if (XML::getBoolProperty(propertyNode, "on-sky", true))
{
- mDeathEffectConditions += static_cast<signed char>(
+ mDeathEffectConditions += CAST_S8(
AliveStatus::DEAD_SKY);
}
if (XML::getBoolProperty(propertyNode, "on-other", false))
{
- mDeathEffectConditions += static_cast<signed char>(
+ mDeathEffectConditions += CAST_S8(
AliveStatus::DEAD_OTHER);
}
if (XML::getBoolProperty(propertyNode, "on-impact", true))
{
- mDeathEffectConditions += static_cast<signed char>(
+ mDeathEffectConditions += CAST_S8(
AliveStatus::DEAD_IMPACT);
}
if (XML::getBoolProperty(propertyNode, "on-timeout", true))
{
- mDeathEffectConditions += static_cast<signed char>(
+ mDeathEffectConditions += CAST_S8(
AliveStatus::DEAD_TIMEOUT);
}
}
@@ -593,8 +593,8 @@ void ParticleEmitter::adjustSize(const int w, const int h)
return; // new dimensions are illegal
// calculate the old rectangle
- const int oldArea = static_cast<int>(
- mParticlePosX.maxVal - mParticlePosX.minVal) * static_cast<int>(
+ const int oldArea = CAST_S32(
+ mParticlePosX.maxVal - mParticlePosX.minVal) * CAST_S32(
mParticlePosX.maxVal - mParticlePosY.minVal);
if (oldArea == 0)
{
@@ -610,8 +610,8 @@ void ParticleEmitter::adjustSize(const int w, const int h)
// adjust the output so that the particle density stays the same
const float outputFactor = static_cast<float>(newArea)
/ static_cast<float>(oldArea);
- mOutput.minVal = static_cast<int>(static_cast<float>(
+ mOutput.minVal = CAST_S32(static_cast<float>(
mOutput.minVal) * outputFactor);
- mOutput.maxVal = static_cast<int>(static_cast<float>(
+ mOutput.maxVal = CAST_S32(static_cast<float>(
mOutput.maxVal) * outputFactor);
}
diff --git a/src/particle/particlevector.cpp b/src/particle/particlevector.cpp
index a09f6d7ae..d0594a2dd 100644
--- a/src/particle/particlevector.cpp
+++ b/src/particle/particlevector.cpp
@@ -41,7 +41,7 @@ void ParticleVector::setLocally(const int index, Particle *const particle)
delLocally(index);
- if (mIndexedElements.size() <= static_cast<size_t>(index))
+ if (mIndexedElements.size() <= CAST_SIZE(index))
mIndexedElements.resize(index + 1, nullptr);
if (particle)
@@ -54,7 +54,7 @@ void ParticleVector::delLocally(const int index)
if (index < 0)
return;
- if (mIndexedElements.size() <= static_cast<size_t>(index))
+ if (mIndexedElements.size() <= CAST_SIZE(index))
return;
Particle *const p = mIndexedElements[index];
@@ -68,7 +68,7 @@ void ParticleVector::delLocally(const int index)
void ParticleVector::clearLocally()
{
for (unsigned int i = 0;
- i < static_cast<unsigned int>(mIndexedElements.size());
+ i < CAST_U32(mIndexedElements.size());
i++)
{
delLocally(i);
diff --git a/src/particle/textparticle.cpp b/src/particle/textparticle.cpp
index 8a886f27d..399e00a01 100644
--- a/src/particle/textparticle.cpp
+++ b/src/particle/textparticle.cpp
@@ -55,8 +55,8 @@ void TextParticle::draw(Graphics *restrict const graphics,
return;
}
- const int screenX = static_cast<int>(mPos.x) + offsetX;
- const int screenY = static_cast<int>(mPos.y) - static_cast<int>(mPos.z)
+ const int screenX = CAST_S32(mPos.x) + offsetX;
+ const int screenY = CAST_S32(mPos.y) - CAST_S32(mPos.z)
+ offsetY;
float alpha = mAlpha * 255.0F;
@@ -74,13 +74,13 @@ void TextParticle::draw(Graphics *restrict const graphics,
}
Color color = *mColor;
- color.a = static_cast<unsigned int>(alpha);
+ color.a = CAST_U32(alpha);
graphics->setColor(color);
if (mOutline)
{
const Color &restrict color2 = theme->getColor(ThemeColorId::OUTLINE,
- static_cast<int>(alpha));
+ CAST_S32(alpha));
mTextFont->drawString(graphics,
color, color2,
mText,
diff --git a/src/particle/textparticle.h b/src/particle/textparticle.h
index 70dbad956..7064a5358 100644
--- a/src/particle/textparticle.h
+++ b/src/particle/textparticle.h
@@ -48,11 +48,11 @@ class TextParticle final : public Particle
// hack to improve text visibility
int getPixelY() const restrict2 override final A_WARN_UNUSED
- { return static_cast<int>(mPos.y + mPos.z); }
+ { return CAST_S32(mPos.y + mPos.z); }
// hack to improve text visibility (for sorting only)
int getSortPixelY() const restrict2 override final A_WARN_UNUSED
- { return static_cast<int>(mPos.y + mPos.z); }
+ { return CAST_S32(mPos.y + mPos.z); }
private:
std::string mText; /**< Text of the particle. */