Use float functions on float variables.

This commit is contained in:
Guus Sliepen 2011-08-24 22:43:54 +02:00
parent c14a9e7956
commit 9e32c230be
3 changed files with 13 additions and 13 deletions

View File

@ -801,8 +801,8 @@ void moveAndSeparate(object *theEnemy)
theEnemy->dy -= 0.02; theEnemy->dy -= 0.02;
} }
theEnemy->x -= (sin(theEnemy->dx) * 4); theEnemy->x -= (sinf(theEnemy->dx) * 4);
theEnemy->y -= (cos(theEnemy->dy) * 4); theEnemy->y -= (cosf(theEnemy->dy) * 4);
} }
else else
{ {
@ -899,8 +899,8 @@ void moveAndSeparate(object *theEnemy)
theEnemy->dy += 0.02; theEnemy->dy += 0.02;
} }
theEnemy->x += (sin(theEnemy->dx) * 4); theEnemy->x += (sinf(theEnemy->dx) * 4);
theEnemy->y += (cos(theEnemy->dy) * 4); theEnemy->y += (cosf(theEnemy->dy) * 4);
theEnemy->thinktime = 0; theEnemy->thinktime = 0;
} }
@ -1090,8 +1090,8 @@ void doAliens()
if (theEnemy->classDef == CD_BARRIER) if (theEnemy->classDef == CD_BARRIER)
{ {
theEnemy->dx = -10 + (sin(barrierLoop + theEnemy->speed) * 60); theEnemy->dx = -10 + (sinf(barrierLoop + theEnemy->speed) * 60);
theEnemy->dy = 20 + (cos(barrierLoop + theEnemy->speed) * 40); theEnemy->dy = 20 + (cosf(barrierLoop + theEnemy->speed) * 40);
} }
// ---------------------------------------- // ----------------------------------------

View File

@ -46,7 +46,7 @@ void addBullet(object *theWeapon, object *attacker, int y, int dy)
{ {
bullet->dx = theWeapon->speed; bullet->dx = theWeapon->speed;
if ((currentGame.area == 18) || (currentGame.area == 24)) if ((currentGame.area == 18) || (currentGame.area == 24))
bullet->dx += fabs(engine.ssx); bullet->dx += fabsf(engine.ssx);
} }
else else
{ {
@ -106,8 +106,8 @@ void addBullet(object *theWeapon, object *attacker, int y, int dy)
if (bullet->flags & WF_AIMED) if (bullet->flags & WF_AIMED)
{ {
tempX = (int)fabs(attacker->target->x - attacker->x); tempX = (int)fabsf(attacker->target->x - attacker->x);
tempY = (int)fabs(attacker->target->y - attacker->y); tempY = (int)fabsf(attacker->target->y - attacker->y);
steps = max(tempX, tempY); steps = max(tempX, tempY);
if (steps < 12) if (steps < 12)
@ -392,8 +392,8 @@ char checkPlayerShockDamage(float x, float y)
if ((engine.cheatShield) || (engine.missionCompleteTimer != 0)) if ((engine.cheatShield) || (engine.missionCompleteTimer != 0))
return 0; return 0;
float distX = fabs(x - player.x); float distX = fabsf(x - player.x);
float distY = fabs(y - player.y); float distY = fabsf(y - player.y);
if ((distX <= 50) && (distY <= 50)) if ((distX <= 50) && (distY <= 50))
{ {

View File

@ -256,8 +256,8 @@ signed char showSystem(float x, float y)
graphics.circle(400, 250, i, graphics.screen, graphics.darkGrey); graphics.circle(400, 250, i, graphics.screen, graphics.darkGrey);
r.x = int(400 + (sin(x) * i)); r.x = int(400 + (sinf(x) * i));
r.y = int(250 + (cos(y) * i)); r.y = int(250 + (cosf(y) * i));
r.w = 10; r.w = 10;
r.h = 10; r.h = 10;