diff --git a/source/shared_lib/sources/graphics/particle.cpp b/source/shared_lib/sources/graphics/particle.cpp index deffe560..c1a59d51 100644 --- a/source/shared_lib/sources/graphics/particle.cpp +++ b/source/shared_lib/sources/graphics/particle.cpp @@ -1288,17 +1288,18 @@ void UnitParticleSystem::updateParticle(Particle *p){ if(alternations > 0){ int interval= (maxParticleEnergy / alternations); float moduloValue= (float)((int)(static_cast (p->energy)) % interval); + float floatInterval=static_cast (interval); - if(moduloValue < interval / 2){ - energyRatio= (interval - moduloValue) / interval; + if(moduloValue < floatInterval / 2.0f){ + energyRatio= (floatInterval - moduloValue) / floatInterval; } else{ - energyRatio= moduloValue / interval; + energyRatio= moduloValue / floatInterval; } energyRatio= clamp(energyRatio, 0.f, 1.f); } else{ - energyRatio= clamp(static_cast (p->energy) / maxParticleEnergy, 0.f, 1.f); + energyRatio= clamp(static_cast (p->energy) / static_cast (maxParticleEnergy), 0.f, 1.f); } energyRatio = truncateDecimal(energyRatio,6);