mirror of
https://github.com/edubart/otclient.git
synced 2025-10-28 00:55:35 +01:00
Use float literals where applicable (#1140)
Use float literals to perform more calculation in float instead of performing implicit conversion to double and back to float. Co-authored-by: Kacper Piwiński <kacper.piwinski@arex.pl>
This commit is contained in:
@@ -25,8 +25,8 @@
|
||||
|
||||
#include "stdext/compiler.h"
|
||||
|
||||
#define DEG_TO_RAD (acos(-1)/180.0)
|
||||
#define RAD_TO_DEC (180.0/acos(-1))
|
||||
#define DEG_TO_RAD (std::acos(-1.f)/180.f)
|
||||
#define RAD_TO_DEC (180.f/std::acos(-1.f))
|
||||
|
||||
#ifndef BUILD_COMMIT
|
||||
#define BUILD_COMMIT "devel"
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
namespace Fw
|
||||
{
|
||||
static const float pi = 3.14159265;
|
||||
static const float pi = 3.14159265f;
|
||||
static const float MIN_ALPHA = 0.003f;
|
||||
enum Key : unsigned char {
|
||||
KeyUnknown = 0,
|
||||
|
||||
@@ -77,7 +77,7 @@ void GravityAffector::load(const OTMLNodePtr& node)
|
||||
ParticleAffector::load(node);
|
||||
|
||||
m_angle = 270 * DEG_TO_RAD;
|
||||
m_gravity = 9.8;
|
||||
m_gravity = 9.8f;
|
||||
|
||||
for(const OTMLNodePtr& childNode : node->children()) {
|
||||
if(childNode->tag() == "angle")
|
||||
@@ -132,5 +132,5 @@ void AttractionAffector::updateParticle(const ParticlePtr& particle, float elaps
|
||||
direction = PointF(-1, -1);
|
||||
|
||||
PointF pVelocity = particle->getVelocity() + (d / d.length() * m_acceleration * elapsedTime) * direction;
|
||||
particle->setVelocity(pVelocity - pVelocity * m_reduction/100.0 * elapsedTime);
|
||||
particle->setVelocity(pVelocity - pVelocity * m_reduction/100.f * elapsedTime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user