Skip to content

Commit

Permalink
Merge pull request #14 from ubuntor/fabs
Browse files Browse the repository at this point in the history
use fabs where needed
  • Loading branch information
Drewol authored Oct 16, 2017
2 parents 87a14b1 + 3bf13f9 commit 564c396
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Main/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void Camera::Tick(float deltaTime, class BeatmapPlayback& playback)

float rollDelta = m_targetRoll - m_laserRoll;
rollSpeedLimit *= Math::Sign(rollDelta);
m_laserRoll += (abs(rollDelta) < abs(rollSpeedLimit)) ? rollDelta : rollSpeedLimit;
m_laserRoll += (fabs(rollDelta) < fabs(rollSpeedLimit)) ? rollDelta : rollSpeedLimit;


// Calculate camera spin
Expand Down Expand Up @@ -209,10 +209,10 @@ float Camera::GetRoll() const

float Camera::m_ClampRoll(float in) const
{
float ain = abs(in);
float ain = fabs(in);
if(ain < 1.0f)
return in;
bool odd = ((uint32)abs(in) % 2) == 1;
bool odd = ((uint32)fabs(in) % 2) == 1;
float sign = Math::Sign(in);
if(odd)
{
Expand Down
4 changes: 2 additions & 2 deletions Main/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ void Input::Update(float deltaTime)
{
float axisState = m_gamepad->GetAxis(m_controllerAxisMapping[i]);
float delta = axisState - m_prevLaserStates[i];
if (abs(delta) > 1.5f)
if (fabs(delta) > 1.5f)
delta += 2 * (Math::Sign(delta) * -1);
if (abs(delta) < m_controllerDeadzone)
if (fabs(delta) < m_controllerDeadzone)
m_laserStates[i] = 0.0f;
else
m_laserStates[i] = delta * m_controllerSensitivity;
Expand Down
4 changes: 2 additions & 2 deletions Main/Scoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ void Scoring::m_UpdateTicks()
}

// Check laser input
float laserDelta = abs(laserPositions[laserObject->index] - laserTargetPositions[laserObject->index]);\
float laserDelta = fabs(laserPositions[laserObject->index] - laserTargetPositions[laserObject->index]);\

if(laserDelta < laserDistanceLeniency)
{
Expand Down Expand Up @@ -770,7 +770,7 @@ void Scoring::m_UpdateLasers(float deltaTime)
if (laserDir == 0.0f && currentSegment->prev == nullptr)
laserPositions[i] = laserTargetPositions[i];
// Lock lasers on straight parts
else if (laserDir == 0.0f && abs(positionDelta) < laserDistanceLeniency)
else if (laserDir == 0.0f && fabs(positionDelta) < laserDistanceLeniency)
{
laserPositions[i] = laserTargetPositions[i];
if (m_autoLaserTick[i] < m_assistLevel)
Expand Down

0 comments on commit 564c396

Please sign in to comment.