aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2014-06-02 01:00:15 +0200
committerJohannes Schickel2014-06-02 01:00:15 +0200
commitf2685a88769324044a843ebfd552f48f64675500 (patch)
treed9fcee81fab220c95a711e1125be21c184e9ca80
parent3630c588c65e55d83f11c46980d6df500d18d2c4 (diff)
downloadscummvm-rg350-f2685a88769324044a843ebfd552f48f64675500.tar.gz
scummvm-rg350-f2685a88769324044a843ebfd552f48f64675500.tar.bz2
scummvm-rg350-f2685a88769324044a843ebfd552f48f64675500.zip
BBVS: Use floating point constants of type float.
-rw-r--r--engines/bbvs/minigames/bbtennis.cpp48
-rw-r--r--engines/bbvs/walk.cpp12
2 files changed, 30 insertions, 30 deletions
diff --git a/engines/bbvs/minigames/bbtennis.cpp b/engines/bbvs/minigames/bbtennis.cpp
index 6f680d0f95..ddd5cfc804 100644
--- a/engines/bbvs/minigames/bbtennis.cpp
+++ b/engines/bbvs/minigames/bbtennis.cpp
@@ -412,10 +412,10 @@ bool MinigameBbTennis::updateStatus1(int mouseX, int mouseY, uint mouseButtons)
obj->targetY = mouseY;
obj->ballStep = 12;
obj->ballStepCtr = 0;
- obj->fltX = 160.0;
- obj->fltY = 240.0;
- obj->fltStepX = ((160 - mouseX) * 0.75) / 12.0;
- obj->fltStepY = ((240 - mouseY) * 0.75) / 12.0;
+ obj->fltX = 160.0f;
+ obj->fltY = 240.0f;
+ obj->fltStepX = ((160 - mouseX) * 0.75f) / 12.0f;
+ obj->fltStepY = ((240 - mouseY) * 0.75f) / 12.0f;
_newBallTimer = _initBallTimer;
++_numBalls;
playSound(31);
@@ -582,14 +582,14 @@ void MinigameBbTennis::updateTennisBall(int objIndex) {
obj->ballStep = 12;
++obj->ballStepCtr;
if (obj->ballStepCtr == 1) {
- obj->fltStepX = ((obj->fltX - (float)obj->targetX) * 0.75) / 12.0;
- obj->fltStepY = ((obj->fltY - (float)obj->targetY) * 0.75) / 12.0;
+ obj->fltStepX = ((obj->fltX - (float)obj->targetX) * 0.75f) / 12.0f;
+ obj->fltStepY = ((obj->fltY - (float)obj->targetY) * 0.75f) / 12.0f;
} else if (obj->ballStepCtr == 2) {
- obj->fltStepX = (obj->fltX - (float)obj->targetX) / 12.0;
- obj->fltStepY = (obj->fltY - (float)obj->targetY) / 12.0;
+ obj->fltStepX = (obj->fltX - (float)obj->targetX) / 12.0f;
+ obj->fltStepY = (obj->fltY - (float)obj->targetY) / 12.0f;
} else {
- obj->fltStepX = 0.0;
- obj->fltStepY = 0.0;
+ obj->fltStepX = 0.0f;
+ obj->fltStepY = 0.0f;
}
}
@@ -1087,11 +1087,11 @@ void MinigameBbTennis::updateEnemyTennisBall(int objIndex) {
obj->ballStep = 12;
--obj->ballStepCtr;
if (obj->ballStepCtr == 1) {
- obj->fltStepX = (obj->fltX - (float)obj->targetX) / 12.0;
- obj->fltStepY = (obj->fltY - (float)obj->targetY) / 12.0;
+ obj->fltStepX = (obj->fltX - (float)obj->targetX) / 12.0f;
+ obj->fltStepY = (obj->fltY - (float)obj->targetY) / 12.0f;
} else if (obj->ballStepCtr == 2) {
- obj->fltStepX = ((obj->fltX - (float)obj->targetX) * 0.18) / 12.0;
- obj->fltStepY = ((obj->fltY - (float)obj->targetY) * 0.18) / 12.0;
+ obj->fltStepX = ((obj->fltX - (float)obj->targetX) * 0.18f) / 12.0f;
+ obj->fltStepY = ((obj->fltY - (float)obj->targetY) * 0.18f) / 12.0f;
} else {
obj->kind = 0;
if (_numHearts > 0 && --_numHearts == 0)
@@ -1125,36 +1125,36 @@ void MinigameBbTennis::makeEnemyBall(int x, int y, int frameIndex) {
case 6:
obj->ballStep = 18;
obj->ballStepCtr = 3;
- obj->fltStepX = 0.0;
- obj->fltStepY = 0.0;
+ obj->fltStepX = 0.0f;
+ obj->fltStepY = 0.0f;
break;
case 5:
obj->ballStep = 12;
obj->ballStepCtr = 3;
- obj->fltStepX = ((float)(x - 160) * 0.07) / 12.0;
- obj->fltStepY = ((float)(y - 180) * 0.07) / 12.0;
+ obj->fltStepX = ((float)(x - 160) * 0.07f) / 12.0f;
+ obj->fltStepY = ((float)(y - 180) * 0.07f) / 12.0f;
break;
case 4:
obj->ballStep = 6;
obj->ballStepCtr = 3;
- obj->fltStepX = ((float)(x - 160) * 0.07) / 6.0;
- obj->fltStepY = ((float)(y - 180) * 0.07) / 6.0;
+ obj->fltStepX = ((float)(x - 160) * 0.07f) / 6.0f;
+ obj->fltStepY = ((float)(y - 180) * 0.07f) / 6.0f;
break;
case 3:
obj->ballStep = 12;
obj->ballStepCtr = 2;
- obj->fltStepX = ((float)(x - 160) * 0.18) / 12.0;
- obj->fltStepY = ((float)(y - 180) * 0.18) / 12.0;
+ obj->fltStepX = ((float)(x - 160) * 0.18f) / 12.0f;
+ obj->fltStepY = ((float)(y - 180) * 0.18f) / 12.0f;
break;
case 2:
obj->ballStep = 6;
obj->ballStepCtr = 2;
- obj->fltStepX = ((float)(x - 160) * 0.18) / 6.0;
- obj->fltStepY = ((float)(y - 180) * 0.18) / 6.0;
+ obj->fltStepX = ((float)(x - 160) * 0.18f) / 6.0f;
+ obj->fltStepY = ((float)(y - 180) * 0.18f) / 6.0f;
break;
case 1:
diff --git a/engines/bbvs/walk.cpp b/engines/bbvs/walk.cpp
index f3023b97c2..077110b867 100644
--- a/engines/bbvs/walk.cpp
+++ b/engines/bbvs/walk.cpp
@@ -111,10 +111,10 @@ void BbvsEngine::walkObject(SceneObject *sceneObject, const Common::Point &destP
int deltaY = destPt.y - (sceneObject->y >> 16);
float distance = (float)sqrt((double)(deltaX * deltaX + deltaY * deltaY));
// NOTE The original doesn't have this check but without it the whole pathfinding breaks
- if (distance > 0.0) {
- sceneObject->walkCount = (int)(distance / ((((float)ABS(deltaX) / distance) + 1.0) * ((float)walkSpeed / 120)));
- sceneObject->xIncr = (int)(((float)deltaX / sceneObject->walkCount) * 65536.0);
- sceneObject->yIncr = (int)(((float)deltaY / sceneObject->walkCount) * 65536.0);
+ if (distance > 0.0f) {
+ sceneObject->walkCount = (int)(distance / ((((float)ABS(deltaX) / distance) + 1.0f) * ((float)walkSpeed / 120)));
+ sceneObject->xIncr = (int)(((float)deltaX / sceneObject->walkCount) * 65536.0f);
+ sceneObject->yIncr = (int)(((float)deltaY / sceneObject->walkCount) * 65536.0f);
sceneObject->x = (sceneObject->x & 0xFFFF0000) | 0x8000;
sceneObject->y = (sceneObject->y & 0xFFFF0000) | 0x8000;
} else
@@ -334,10 +334,10 @@ bool BbvsEngine::walkTestLineWalkable(const Common::Point &sourcePt, const Commo
return true;
if (walkInfo->direction) {
const float nDeltaY = wDeltaX * ptDeltaY / ptDeltaX + (float)sourcePt.y - (float)walkInfo->y;
- return (nDeltaY >= 0.0) && (nDeltaY < (float)walkInfo->delta);
+ return (nDeltaY >= 0.0f) && (nDeltaY < (float)walkInfo->delta);
} else {
const float nDeltaX = wDeltaY / ptDeltaX * ptDeltaY + (float)sourcePt.x - (float)walkInfo->x;
- return (nDeltaX >= 0.0) && (nDeltaX < (float)walkInfo->delta);
+ return (nDeltaX >= 0.0f) && (nDeltaX < (float)walkInfo->delta);
}
return false;
}