MOHAWK: Fix MSVC warnings

Fix assignments to float variables, by adding a float suffix
This commit is contained in:
Filippos Karapetis 2019-05-27 14:30:04 +03:00
parent e94026e800
commit f5ed07c3e7

View file

@ -832,11 +832,11 @@ const FliesEffect::FliesEffectData FliesEffect::_firefliesParameters = {
true, true,
true, true,
true, true,
3.0, 3.0F,
0.7, 0.7F,
40, 40,
2.0, 2.0F,
1.0, 1.0F,
8447718, 8447718,
30, 30,
10 10
@ -847,11 +847,11 @@ const FliesEffect::FliesEffectData FliesEffect::_fliesParameters = {
false, false,
false, false,
true, true,
8.0, 8.0F,
3.0, 3.0F,
80, 80,
3.0, 3.0F,
1.0, 1.0F,
661528, 661528,
30, 30,
10 10
@ -915,9 +915,9 @@ void FliesEffect::initFlyAtPosition(uint index, int posX, int posY, int posZ) {
fly.framesTillLightSwitch = randomBetween(_parameters->minFramesLit, _parameters->minFramesLit + _parameters->maxLightDuration); fly.framesTillLightSwitch = randomBetween(_parameters->minFramesLit, _parameters->minFramesLit + _parameters->maxLightDuration);
fly.hasBlur = false; fly.hasBlur = false;
fly.directionAngleRad = randomBetween(0, 300) / 100.0f; fly.directionAngleRad = randomBetween(0, 300) / 100.0F;
fly.directionAngleRadZ = randomBetween(0, 300) / 100.0f; fly.directionAngleRadZ = randomBetween(0, 300) / 100.0F;
fly.speed = randomBetween(0, 100) / 100.0f; fly.speed = randomBetween(0, 100) / 100.0F;
} }
void FliesEffect::update() { void FliesEffect::update() {
@ -953,17 +953,17 @@ void FliesEffect::updateFlies() {
void FliesEffect::updateFlyPosition(uint index) { void FliesEffect::updateFlyPosition(uint index) {
FliesEffectEntry &fly = _fly[index]; FliesEffectEntry &fly = _fly[index];
if (fly.directionAngleRad > 2.0f * M_PI) { if (fly.directionAngleRad > 2.0F * M_PI) {
fly.directionAngleRad = fly.directionAngleRad - 2.0f * M_PI; fly.directionAngleRad = fly.directionAngleRad - 2.0F * M_PI;
} }
if (fly.directionAngleRad < 0.0f) { if (fly.directionAngleRad < 0.0F) {
fly.directionAngleRad = fly.directionAngleRad + 2.0f * M_PI; fly.directionAngleRad = fly.directionAngleRad + 2.0F * M_PI;
} }
if (fly.directionAngleRadZ > 2.0f * M_PI) { if (fly.directionAngleRadZ > 2.0F * M_PI) {
fly.directionAngleRadZ = fly.directionAngleRadZ - 2.0f * M_PI; fly.directionAngleRadZ = fly.directionAngleRadZ - 2.0F * M_PI;
} }
if (fly.directionAngleRadZ < 0.0f) { if (fly.directionAngleRadZ < 0.0F) {
fly.directionAngleRadZ = fly.directionAngleRadZ + 2.0f * M_PI; fly.directionAngleRadZ = fly.directionAngleRadZ + 2.0F * M_PI;
} }
fly.posXFloat += cos(fly.directionAngleRad) * fly.speed; fly.posXFloat += cos(fly.directionAngleRad) * fly.speed;
fly.posYFloat += sin(fly.directionAngleRad) * fly.speed; fly.posYFloat += sin(fly.directionAngleRad) * fly.speed;
@ -975,7 +975,7 @@ void FliesEffect::updateFlyPosition(uint index) {
&fly.alphaMap, &fly.alphaMap,
&fly.width, &fly.width,
&fly.height); &fly.height);
fly.posZFloat += cos(fly.directionAngleRadZ) * (fly.speed / 2.0f); fly.posZFloat += cos(fly.directionAngleRadZ) * (fly.speed / 2.0F);
fly.posZ = fly.posZFloat; fly.posZ = fly.posZFloat;
if (_parameters->canBlur && fly.speed > _parameters->blurSpeedTreshold) { if (_parameters->canBlur && fly.speed > _parameters->blurSpeedTreshold) {
fly.hasBlur = true; fly.hasBlur = true;
@ -997,16 +997,16 @@ void FliesEffect::updateFlyPosition(uint index) {
maxAngularSpeed /= 2; maxAngularSpeed /= 2;
} }
int angularSpeed = randomBetween(-maxAngularSpeed, maxAngularSpeed); int angularSpeed = randomBetween(-maxAngularSpeed, maxAngularSpeed);
fly.directionAngleRad += angularSpeed / 100.0f; fly.directionAngleRad += angularSpeed / 100.0F;
} else { } else {
// Make the flies go down if they are too high in the screen // Make the flies go down if they are too high in the screen
int angularSpeed = randomBetween(0, 50); int angularSpeed = randomBetween(0, 50);
if (fly.directionAngleRad >= M_PI / 2.0f && fly.directionAngleRad <= 3.0f * M_PI / 2.0f) { if (fly.directionAngleRad >= M_PI / 2.0F && fly.directionAngleRad <= 3.0F * M_PI / 2.0F) {
// Going down // Going down
fly.directionAngleRad -= angularSpeed / 100.0f; fly.directionAngleRad -= angularSpeed / 100.0F;
} else { } else {
// Going up // Going up
fly.directionAngleRad += angularSpeed / 100.0f; fly.directionAngleRad += angularSpeed / 100.0F;
} }
if (fly.posY < 1) { if (fly.posY < 1) {
initFlyRandomPosition(index); initFlyRandomPosition(index);
@ -1026,23 +1026,23 @@ void FliesEffect::updateFlyPosition(uint index) {
distanceToScreenEdge = 30; distanceToScreenEdge = 30;
} }
if (fly.posZ <= distanceToScreenEdge) { if (fly.posZ <= distanceToScreenEdge) {
fly.directionAngleRadZ += randomBetween(-_parameters->maxAcceleration, _parameters->maxAcceleration) / 100.0f; fly.directionAngleRadZ += randomBetween(-_parameters->maxAcceleration, _parameters->maxAcceleration) / 100.0F;
} else { } else {
fly.posZ = distanceToScreenEdge; fly.posZ = distanceToScreenEdge;
fly.directionAngleRadZ += M_PI; fly.directionAngleRadZ += (float)M_PI;
} }
} else { } else {
fly.posZ = 0; fly.posZ = 0;
fly.directionAngleRadZ += M_PI; fly.directionAngleRadZ += (float)M_PI;
} }
float minSpeed = _parameters->minSpeed - fly.posZ / 40.0f; float minSpeed = _parameters->minSpeed - fly.posZ / 40.0F;
float maxSpeed = _parameters->maxSpeed - fly.posZ / 20.0f; float maxSpeed = _parameters->maxSpeed - fly.posZ / 20.0F;
fly.speed += randomBetween(-_parameters->maxAcceleration, _parameters->maxAcceleration) / 100.0f; fly.speed += randomBetween(-_parameters->maxAcceleration, _parameters->maxAcceleration) / 100.0F;
if (fly.speed > maxSpeed) { if (fly.speed > maxSpeed) {
fly.speed -= randomBetween(0, 50) / 100.0f; fly.speed -= randomBetween(0, 50) / 100.0F;
} }
if (fly.speed < minSpeed) { if (fly.speed < minSpeed) {
fly.speed += randomBetween(0, 50) / 100.0f; fly.speed += randomBetween(0, 50) / 100.0F;
} }
} }
@ -1200,9 +1200,9 @@ void FliesEffect::draw() {
} }
if (_vm->_rnd->getRandomBit()) { if (_vm->_rnd->getRandomBit()) {
fly.directionAngleRad += M_PI / 2.0; fly.directionAngleRad += (float)M_PI / 2.0F;
} else { } else {
fly.directionAngleRad -= M_PI / 2.0; fly.directionAngleRad -= (float)M_PI / 2.0F;
} }
} }
} }