Removed all uses of float for optimization
This commit is contained in:
+1
-1
@@ -1576,7 +1576,7 @@ static void played_cards_update_loop(bool* discarded_card, int* played_selection
|
|||||||
|
|
||||||
FIXED played_x = int2fx(120);
|
FIXED played_x = int2fx(120);
|
||||||
FIXED played_y = int2fx(70);
|
FIXED played_y = int2fx(70);
|
||||||
FIXED played_scale = float2fx(1.0f);
|
FIXED played_scale = FIX_ONE;
|
||||||
|
|
||||||
played_x = played_x + (int2fx(played_top - i) - int2fx(played_top) / 2) * -27;
|
played_x = played_x + (int2fx(played_top - i) - int2fx(played_top) / 2) * -27;
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -145,9 +145,9 @@ void sprite_object_reset_transform(SpriteObject* sprite_object)
|
|||||||
sprite_object->y = 0;
|
sprite_object->y = 0;
|
||||||
sprite_object->vx = 0;
|
sprite_object->vx = 0;
|
||||||
sprite_object->vy = 0;
|
sprite_object->vy = 0;
|
||||||
sprite_object->tscale = float2fx(1.0f); // Target scale
|
sprite_object->tscale = FIX_ONE; // Target scale
|
||||||
sprite_object->scale = float2fx(1.0f);
|
sprite_object->scale = FIX_ONE;
|
||||||
sprite_object->vscale = float2fx(0.0f);
|
sprite_object->vscale = 0;
|
||||||
sprite_object->trotation = 0; // Target rotation
|
sprite_object->trotation = 0; // Target rotation
|
||||||
sprite_object->rotation = 0;
|
sprite_object->rotation = 0;
|
||||||
sprite_object->vrotation = 0;
|
sprite_object->vrotation = 0;
|
||||||
@@ -163,7 +163,7 @@ void sprite_object_update(SpriteObject* sprite_object)
|
|||||||
sprite_object->vrotation += (sprite_object->trotation - sprite_object->rotation) / 8; // Rotate the card when it's played
|
sprite_object->vrotation += (sprite_object->trotation - sprite_object->rotation) / 8; // Rotate the card when it's played
|
||||||
|
|
||||||
// set velocity to 0 if it's close enough to the target
|
// set velocity to 0 if it's close enough to the target
|
||||||
const float epsilon = float2fx(0.01f);
|
const FIXED epsilon = FIX_ONE>>7; // 1/(2^7) = 1/128 = 0.0078125
|
||||||
if (sprite_object->vx < epsilon && sprite_object->vx > -epsilon && sprite_object->vy < epsilon && sprite_object->vy > -epsilon)
|
if (sprite_object->vx < epsilon && sprite_object->vx > -epsilon && sprite_object->vy < epsilon && sprite_object->vy > -epsilon)
|
||||||
{
|
{
|
||||||
sprite_object->vx = 0;
|
sprite_object->vx = 0;
|
||||||
@@ -211,8 +211,8 @@ void sprite_object_update(SpriteObject* sprite_object)
|
|||||||
|
|
||||||
void sprite_object_shake(SpriteObject* sprite_object, mm_word sound_id)
|
void sprite_object_shake(SpriteObject* sprite_object, mm_word sound_id)
|
||||||
{
|
{
|
||||||
sprite_object->vscale = float2fx(0.3f); // Scale down the card when it's scored
|
sprite_object->vscale = FIX_ONE >> 2; // (1/4 = 0.25) Scale down the card when it's scored
|
||||||
sprite_object->vrotation = float2fx(8.0f); // Rotate the card when it's scored
|
sprite_object->vrotation = FIX_ONE << 3; // (2^3 = 8) Rotate the card when it's scored
|
||||||
|
|
||||||
if (sound_id == UNDEFINED) return; // If no sound ID is provided, do nothing
|
if (sound_id == UNDEFINED) return; // If no sound ID is provided, do nothing
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user