Clean up math functions

- Remove checking for standard functions from the build system
- Prefix all invocations with std::
- Replace suffixed functions with unprefixed versions
- Include <cmath> in all files that use it and remove the global include

e.g. floorf(x) -> std::floor(x)
This commit is contained in:
Martin Natano
2023-04-19 19:31:40 +02:00
parent f39ed52dbf
commit b68ca517e6
111 changed files with 1831 additions and 1785 deletions
+17 -15
View File
@@ -14,6 +14,8 @@
#include "AutoActor.h"
#include "ThemeManager.h"
#include <cmath>
const float PARTICLE_SPEED = 300;
@@ -72,7 +74,7 @@ BGAnimationLayer::~BGAnimationLayer()
void BGAnimationLayer::LoadFromAniLayerFile( const RString& sPath )
{
/* Generic BGAs are new. Animation directories with no INI are old and obsolete.
/* Generic BGAs are new. Animation directories with no INI are old and obsolete.
* Don't combine them. */
RString lcPath = sPath;
lcPath.MakeLower();
@@ -404,16 +406,16 @@ void BGAnimationLayer::LoadFromNode( const XNode* pNode )
}
else if( StringToInt(type) == 1 )
{
m_Type = TYPE_SPRITE;
bStretch = true;
m_Type = TYPE_SPRITE;
bStretch = true;
}
else if( StringToInt(type) == 2 )
{
m_Type = TYPE_PARTICLES;
m_Type = TYPE_PARTICLES;
}
else if( StringToInt(type) == 3 )
{
m_Type = TYPE_TILES;
m_Type = TYPE_TILES;
}
else
{
@@ -488,7 +490,7 @@ void BGAnimationLayer::LoadFromNode( const XNode* pNode )
pActor->SetXY( randomf(float(FullScreenRectF.left),float(FullScreenRectF.right)),
randomf(float(FullScreenRectF.top),float(FullScreenRectF.bottom)) );
pActor->SetZoom( randomf(fZoomMin,fZoomMax) );
m_vParticleVelocity.push_back( RageVector3(
m_vParticleVelocity.push_back( RageVector3(
randomf(fVelocityXMin,fVelocityXMax),
randomf(fVelocityYMin,fVelocityYMax),
randomf(fVelocityZMin,fVelocityZMax) ) );
@@ -573,28 +575,28 @@ void BGAnimationLayer::UpdateInternal( float fDeltaTime )
pActor->SetZ( pActor->GetZ() + fDeltaTime*vel.z );
if( m_bParticlesBounce )
{
if( HitGuardRailLeft(pActor) )
if( HitGuardRailLeft(pActor) )
{
vel.x *= -1;
pActor->SetX( GetGuardRailLeft(pActor) );
}
if( HitGuardRailRight(pActor) )
if( HitGuardRailRight(pActor) )
{
vel.x *= -1;
pActor->SetX( GetGuardRailRight(pActor) );
}
if( HitGuardRailTop(pActor) )
if( HitGuardRailTop(pActor) )
{
vel.y *= -1;
pActor->SetY( GetGuardRailTop(pActor) );
}
if( HitGuardRailBottom(pActor) )
if( HitGuardRailBottom(pActor) )
{
vel.y *= -1;
pActor->SetY( GetGuardRailBottom(pActor) );
}
}
else // !m_bParticlesBounce
else // !m_bParticlesBounce
{
if( vel.x<0 && IsOffScreenLeft(pActor) )
pActor->SetX( GetOffScreenRight(pActor) );
@@ -627,8 +629,8 @@ void BGAnimationLayer::UpdateInternal( float fDeltaTime )
fX += m_fTilesSpacingX/2;
fY += m_fTilesSpacingY/2;
fX = fmodf( fX, fTotalWidth );
fY = fmodf( fY, fTotalHeight );
fX = std::fmod( fX, fTotalWidth );
fY = std::fmod( fY, fTotalHeight );
if( fX < 0 ) fX += fTotalWidth;
if( fY < 0 ) fY += fTotalHeight;
@@ -650,7 +652,7 @@ void BGAnimationLayer::UpdateInternal( float fDeltaTime )
/*
* (c) 2001-2004 Ben Nordstrom, Chris Danford, Glenn Maynard
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -660,7 +662,7 @@ void BGAnimationLayer::UpdateInternal( float fDeltaTime )
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF