Merge pull request #1425 from Kurausukun/f32

Change Usages of float/double to f32/f64
This commit is contained in:
GriffinR 2021-05-04 15:52:04 -04:00 committed by GitHub
commit 7b3a1498d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 18 deletions

View file

@ -97,7 +97,7 @@ static void FormatMonSizeRecord(u8 *string, u32 size)
{ {
#ifdef UNITS_IMPERIAL #ifdef UNITS_IMPERIAL
//Convert size from centimeters to inches //Convert size from centimeters to inches
size = (double)(size * 10) / (CM_PER_INCH * 10); size = (f64)(size * 10) / (CM_PER_INCH * 10);
#endif #endif
string = ConvertIntToDecimalStringN(string, size / 10, STR_CONV_MODE_LEFT_ALIGN, 8); string = ConvertIntToDecimalStringN(string, size / 10, STR_CONV_MODE_LEFT_ALIGN, 8);

View file

@ -275,7 +275,7 @@ struct RouletteTable
struct Taillow taillow; struct Taillow taillow;
u16 ballSpeed; u16 ballSpeed;
u16 baseTravelDist; u16 baseTravelDist;
float var1C; f32 var1C;
}; };
struct GridSelection struct GridSelection
@ -340,13 +340,13 @@ static EWRAM_DATA struct Roulette
s16 ballTravelDistFast; s16 ballTravelDistFast;
u16 ballTravelDistMed; u16 ballTravelDistMed;
u16 ballTravelDistSlow; u16 ballTravelDistSlow;
float ballAngle; f32 ballAngle;
float ballAngleSpeed; f32 ballAngleSpeed;
float ballAngleAccel; f32 ballAngleAccel;
float ballDistToCenter; f32 ballDistToCenter;
float ballFallSpeed; f32 ballFallSpeed;
float ballFallAccel; f32 ballFallAccel;
float varA0; f32 varA0;
u8 playTaskId; u8 playTaskId;
u8 spinTaskId; u8 spinTaskId;
u8 filler_1[2]; u8 filler_1[2];
@ -3948,7 +3948,7 @@ static s16 UpdateBallRelativeWheelAngle(struct Sprite *sprite)
static u8 UpdateSlotBelowBall(struct Sprite *sprite) static u8 UpdateSlotBelowBall(struct Sprite *sprite)
{ {
sRoulette->hitSlot = UpdateBallRelativeWheelAngle(sprite) / (float) DEGREES_PER_SLOT; sRoulette->hitSlot = UpdateBallRelativeWheelAngle(sprite) / (f32)DEGREES_PER_SLOT;
return sRoulette->hitSlot; return sRoulette->hitSlot;
} }
@ -4050,7 +4050,7 @@ static void SpriteCB_UnstickBall_ShroomishBallFall(struct Sprite *sprite)
static void SpriteCB_UnstickBall_Shroomish(struct Sprite *sprite) static void SpriteCB_UnstickBall_Shroomish(struct Sprite *sprite)
{ {
float slotOffset, ballFallDist, ballFallSpeed; f32 slotOffset, ballFallDist, ballFallSpeed;
UpdateBallPos(sprite); UpdateBallPos(sprite);
switch (sprite->sBallAngle) switch (sprite->sBallAngle)
@ -4233,7 +4233,7 @@ static void SpriteCB_RollBall_TryLand(struct Sprite *sprite)
} }
else // fall left else // fall left
{ {
float temp; f32 temp;
sRoulette->ballAngleSpeed = (temp = sRouletteTables[sRoulette->tableId].var1C) * 2.0f; sRoulette->ballAngleSpeed = (temp = sRouletteTables[sRoulette->tableId].var1C) * 2.0f;
slotId = (sRoulette->hitSlot + NUM_ROULETTE_SLOTS - 1) % NUM_ROULETTE_SLOTS; slotId = (sRoulette->hitSlot + NUM_ROULETTE_SLOTS - 1) % NUM_ROULETTE_SLOTS;
sRoulette->stuckHitSlot = sRoulette->hitSlot; sRoulette->stuckHitSlot = sRoulette->hitSlot;
@ -4279,7 +4279,7 @@ static void SpriteCB_RollBall_Slow(struct Sprite *sprite)
{ {
// Reached slot to land in // Reached slot to land in
sRoulette->ballAngleAccel = 0.0f; sRoulette->ballAngleAccel = 0.0f;
sRoulette->ballAngleSpeed -= (float)(sRouletteTables[sRoulette->tableId].wheelSpeed) sRoulette->ballAngleSpeed -= (f32)(sRouletteTables[sRoulette->tableId].wheelSpeed)
/ (sRouletteTables[sRoulette->tableId].wheelDelay + 1); / (sRouletteTables[sRoulette->tableId].wheelDelay + 1);
sprite->sState = 4; sprite->sState = 4;
sprite->callback = SpriteCB_RollBall_TryLand; sprite->callback = SpriteCB_RollBall_TryLand;
@ -4304,8 +4304,8 @@ static void SpriteCB_RollBall_Medium(struct Sprite *sprite)
if (sRoulette->ballDistToCenter > 40.0f) if (sRoulette->ballDistToCenter > 40.0f)
return; return;
sRoulette->ballFallSpeed = -(4.0f / (float)(sRoulette->ballTravelDistSlow)); sRoulette->ballFallSpeed = -(4.0f / (f32)(sRoulette->ballTravelDistSlow));
sRoulette->ballAngleAccel = -(sRoulette->ballAngleSpeed / (float)(sRoulette->ballTravelDistSlow)); sRoulette->ballAngleAccel = -(sRoulette->ballAngleSpeed / (f32)(sRoulette->ballTravelDistSlow));
sprite->animNum = 2; sprite->animNum = 2;
sprite->animBeginning = TRUE; sprite->animBeginning = TRUE;
sprite->animEnded = FALSE; sprite->animEnded = FALSE;
@ -4320,8 +4320,8 @@ static void SpriteCB_RollBall_Fast(struct Sprite *sprite)
return; return;
m4aSongNumStartOrChange(SE_ROULETTE_BALL2); m4aSongNumStartOrChange(SE_ROULETTE_BALL2);
sRoulette->ballFallSpeed = -(20.0f / (float)(sRoulette->ballTravelDistMed)); sRoulette->ballFallSpeed = -(20.0f / (f32)(sRoulette->ballTravelDistMed));
sRoulette->ballAngleAccel = ((1.0f - sRoulette->ballAngleSpeed) / (float)(sRoulette->ballTravelDistMed)); sRoulette->ballAngleAccel = ((1.0f - sRoulette->ballAngleSpeed) / (f32)(sRoulette->ballTravelDistMed));
sprite->animNum = 1; sprite->animNum = 1;
sprite->animBeginning = TRUE; sprite->animBeginning = TRUE;
sprite->animEnded = FALSE; sprite->animEnded = FALSE;
@ -4558,7 +4558,7 @@ static void SpriteCB_ShroomishShakeScreen(struct Sprite *sprite)
static void SpriteCB_ShroomishFall(struct Sprite *sprite) static void SpriteCB_ShroomishFall(struct Sprite *sprite)
{ {
float timer; f32 timer;
sprite->data[1]++; sprite->data[1]++;
timer = sprite->data[1]; timer = sprite->data[1];
sprite->pos2.y = timer * 0.039f * timer; sprite->pos2.y = timer * 0.039f * timer;