From 9e32c230bea6b3df1c090ed2e20ce69c55e2f8fe Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Wed, 24 Aug 2011 22:43:54 +0200 Subject: [PATCH] Use float functions on float variables. --- code/aliens.cpp | 12 ++++++------ code/bullets.cpp | 10 +++++----- code/intermission.cpp | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/code/aliens.cpp b/code/aliens.cpp index 1af2860..3061065 100644 --- a/code/aliens.cpp +++ b/code/aliens.cpp @@ -801,8 +801,8 @@ void moveAndSeparate(object *theEnemy) theEnemy->dy -= 0.02; } - theEnemy->x -= (sin(theEnemy->dx) * 4); - theEnemy->y -= (cos(theEnemy->dy) * 4); + theEnemy->x -= (sinf(theEnemy->dx) * 4); + theEnemy->y -= (cosf(theEnemy->dy) * 4); } else { @@ -899,8 +899,8 @@ void moveAndSeparate(object *theEnemy) theEnemy->dy += 0.02; } - theEnemy->x += (sin(theEnemy->dx) * 4); - theEnemy->y += (cos(theEnemy->dy) * 4); + theEnemy->x += (sinf(theEnemy->dx) * 4); + theEnemy->y += (cosf(theEnemy->dy) * 4); theEnemy->thinktime = 0; } @@ -1090,8 +1090,8 @@ void doAliens() if (theEnemy->classDef == CD_BARRIER) { - theEnemy->dx = -10 + (sin(barrierLoop + theEnemy->speed) * 60); - theEnemy->dy = 20 + (cos(barrierLoop + theEnemy->speed) * 40); + theEnemy->dx = -10 + (sinf(barrierLoop + theEnemy->speed) * 60); + theEnemy->dy = 20 + (cosf(barrierLoop + theEnemy->speed) * 40); } // ---------------------------------------- diff --git a/code/bullets.cpp b/code/bullets.cpp index c5f23f0..8866a76 100644 --- a/code/bullets.cpp +++ b/code/bullets.cpp @@ -46,7 +46,7 @@ void addBullet(object *theWeapon, object *attacker, int y, int dy) { bullet->dx = theWeapon->speed; if ((currentGame.area == 18) || (currentGame.area == 24)) - bullet->dx += fabs(engine.ssx); + bullet->dx += fabsf(engine.ssx); } else { @@ -106,8 +106,8 @@ void addBullet(object *theWeapon, object *attacker, int y, int dy) if (bullet->flags & WF_AIMED) { - tempX = (int)fabs(attacker->target->x - attacker->x); - tempY = (int)fabs(attacker->target->y - attacker->y); + tempX = (int)fabsf(attacker->target->x - attacker->x); + tempY = (int)fabsf(attacker->target->y - attacker->y); steps = max(tempX, tempY); if (steps < 12) @@ -392,8 +392,8 @@ char checkPlayerShockDamage(float x, float y) if ((engine.cheatShield) || (engine.missionCompleteTimer != 0)) return 0; - float distX = fabs(x - player.x); - float distY = fabs(y - player.y); + float distX = fabsf(x - player.x); + float distY = fabsf(y - player.y); if ((distX <= 50) && (distY <= 50)) { diff --git a/code/intermission.cpp b/code/intermission.cpp index f4f1ee7..3a0720e 100644 --- a/code/intermission.cpp +++ b/code/intermission.cpp @@ -256,8 +256,8 @@ signed char showSystem(float x, float y) graphics.circle(400, 250, i, graphics.screen, graphics.darkGrey); - r.x = int(400 + (sin(x) * i)); - r.y = int(250 + (cos(y) * i)); + r.x = int(400 + (sinf(x) * i)); + r.y = int(250 + (cosf(y) * i)); r.w = 10; r.h = 10;