diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 3adbbea4..1d73d3f7 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -385,7 +385,7 @@ void AcroBandit_Type1Action1(Entity* this) { if (draw == 1) GetNextFrame(this); - if (this->zVelocity < 1) { + if (this->zVelocity <= 0) { this->action = 2; COLLISION_ON(this); InitializeAnimation(this, 5); @@ -393,7 +393,7 @@ void AcroBandit_Type1Action1(Entity* this) { } void AcroBandit_Type1Action2(Entity* this) { - static const u16 banditGravity[] = { 0x1600, 0x1300, 0x1000, 0xD00, 0xB00 }; + static const u16 banditGravity[] = { Q_8_8(22.0), Q_8_8(19.0), Q_8_8(16.0), Q_8_8(13.0), Q_8_8(11.0) }; GravityUpdate(this, banditGravity[this->type2]); if (this->type2 * -0xe <= this->z.HALF.HI) { @@ -470,7 +470,7 @@ void AcroBandit_Type1Action4(Entity* this) { } void AcroBandit_Type1Action5(Entity* this) { - if (GravityUpdate(this, 0x2000)) + if (GravityUpdate(this, Q_8_8(32.0))) return; sub_08032290(this); diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index 0abdeeeb..ee952124 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -138,7 +138,7 @@ void sub_08021984(Entity* this) { EnqueueSFX(SFX_12D); } - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { this->action = 2; this->timer = 16; this->subtimer = 1; @@ -205,7 +205,7 @@ void sub_08021AD8(Entity* this) { EnqueueSFX(SFX_PLY_JUMP); } ProcessMovement2(this); - if (!GravityUpdate(this, 0x1800)) + if (!GravityUpdate(this, Q_8_8(24.0))) this->frameDuration = 1; } @@ -264,7 +264,7 @@ void sub_08021C58(Entity* this) { GetNextFrame(this); if (this->frame & 1) { ProcessMovement2(this); - if (GravityUpdate(this, 0x1800) == 0) + if (GravityUpdate(this, Q_8_8(24.0)) == 0) this->frameDuration = 1; } diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index a162e302..6fd0387c 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -131,7 +131,7 @@ void Chuchu_OnGrabbed(Entity* this) { sub_0801FB68(this); InitializeAnimation(this, 8); } - GravityUpdate(this, 0x1800); + GravityUpdate(this, Q_8_8(24.0)); GetNextFrame(this); } } @@ -143,7 +143,7 @@ void Chuchu_OnKnockback(Entity* this) { } void Chuchu_OnDeath(Entity* this) { - GravityUpdate(this, 0x1800); + GravityUpdate(this, Q_8_8(24.0)); GetNextFrame(this); if (this->type == 0) { GenericDeath(this); @@ -215,7 +215,7 @@ void sub_0801F1B0(Entity* this) { EnqueueSFX(SFX_12B); } ProcessMovement2(this); - if (GravityUpdate(this, 0x4000) == 0) + if (GravityUpdate(this, Q_8_8(64.0)) == 0) GetNextFrame(this); } else { GetNextFrame(this); @@ -275,7 +275,7 @@ void sub_0801F2CC(Entity* this) { } void sub_0801F2F8(Entity* this) { - GravityUpdate(this, 0x1800); + GravityUpdate(this, Q_8_8(24.0)); GetNextFrame(this); if (this->frame & ANIM_DONE) { sub_0801F340(this); @@ -411,7 +411,7 @@ void sub_0801F584(Entity* this) { EnqueueSFX(SFX_12B); } ProcessMovement2(this); - if (GravityUpdate(this, 0x4000) == 0) + if (GravityUpdate(this, Q_8_8(64.0)) == 0) GetNextFrame(this); } else { @@ -473,7 +473,7 @@ void sub_0801F6CC(Entity* this) { } void sub_0801F6F8(Entity* this) { - GravityUpdate(this, 0x1800); + GravityUpdate(this, Q_8_8(24.0)); GetNextFrame(this); if (this->frame & ANIM_DONE) { this->action = 4; @@ -588,7 +588,7 @@ void sub_0801F940(Entity* this) { EnqueueSFX(SFX_12B); } ProcessMovement2(this); - if (GravityUpdate(this, 0x4000) == 0) + if (GravityUpdate(this, Q_8_8(64.0)) == 0) GetNextFrame(this); } else { GetNextFrame(this); @@ -648,7 +648,7 @@ void sub_0801FA78(Entity* this) { } void sub_0801FAAC(Entity* this) { - GravityUpdate(this, 0x1800); + GravityUpdate(this, Q_8_8(24.0)); GetNextFrame(this); if (this->frame & ANIM_DONE) { sub_0801FB14(this); diff --git a/src/enemy/cloudPiranha.c b/src/enemy/cloudPiranha.c index 9e519d4b..ea8178e7 100644 --- a/src/enemy/cloudPiranha.c +++ b/src/enemy/cloudPiranha.c @@ -218,7 +218,7 @@ void sub_08038754(CloudPiranhaEntity* this) { #else super->speed = 0xc0; #endif - super->zVelocity = 0x20000; + super->zVelocity = Q_16_16(2); this->unk_81 = 0; super->spritePriority.b1 = 3; EnqueueSFX(SFX_12B); diff --git a/src/enemy/cuccoAggr.c b/src/enemy/cuccoAggr.c index da22f6a2..eab4b59c 100644 --- a/src/enemy/cuccoAggr.c +++ b/src/enemy/cuccoAggr.c @@ -151,11 +151,11 @@ void sub_08038EE0(CuccoAggrEntity* this) { ProcessMovement0(super); GetNextFrame(super); sub_08039298(this); - if (GravityUpdate(super, 0x1C00) == 0) { + if (GravityUpdate(super, Q_8_8(28.0)) == 0) { if (--super->timer == 0) { sub_0803901C(this); } else { - super->zVelocity = 0x8000; + super->zVelocity = Q_16_16(0.5); } } } @@ -234,7 +234,7 @@ void sub_0803901C(CuccoAggrEntity* this) { case 1: super->action = 3; super->timer = ((r3 >> 8) & 3) + 2; - super->zVelocity = 0x8000; + super->zVelocity = Q_16_16(0.5); sub_080390C0(this); InitializeAnimation(super, 1); if (Random() & 1) { diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index 004283b5..ca4f3585 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -57,7 +57,7 @@ void sub_08022988(Entity* this) { } ProcessMovement0(this); - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { if (--this->timer == 0) { sub_08022A88(this); } else { @@ -69,7 +69,7 @@ void sub_08022988(Entity* this) { } void sub_080229F8(Entity* this) { - if (GravityUpdate(this, 0x2800) == 0) { + if (GravityUpdate(this, Q_8_8(40.0)) == 0) { if (--this->timer == 0) { this->action = 4; this->timer = 6; @@ -93,7 +93,7 @@ void sub_08022A40(Entity* this) { } ProcessMovement0(this); - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { if (--this->timer == 0) { sub_08022A88(this); } else { diff --git a/src/enemy/enemy50.c b/src/enemy/enemy50.c index 8842b97f..ac08bf32 100644 --- a/src/enemy/enemy50.c +++ b/src/enemy/enemy50.c @@ -93,7 +93,7 @@ void sub_08040B9C(Enemy50Entity* this) { sub_08041128(this); } if (super->contactFlags == 0x9d) { - super->zVelocity = 0x18000; + super->zVelocity = Q_16_16(1.5); } if (super->confusedTime != 0) { super->animationState = super->knockbackDirection >> 4; diff --git a/src/enemy/eyegore.c b/src/enemy/eyegore.c index d23978ea..c852c589 100644 --- a/src/enemy/eyegore.c +++ b/src/enemy/eyegore.c @@ -131,7 +131,7 @@ void Eyegore_OnCollision(EyegoreEntity* this) { void Eyegore_OnDeath(EyegoreEntity* this) { if (this->unk_7e != 0) { this->unk_7e--; - GravityUpdate(super, 0x1c00); + GravityUpdate(super, Q_8_8(28.0)); } else { if ((super->gustJarState & 2) == 0) { CreateFx(super, FX_GIANT_EXPLOSION4, 0); @@ -221,7 +221,7 @@ void Eyegore_Action4(EyegoreEntity* this) { if (this->unk_7a != 0) { sub_08031250(this); } - if (GravityUpdate(super, 0x1c00) == 0) { + if (GravityUpdate(super, Q_8_8(28.0)) == 0) { sub_08030E70(this); } @@ -256,7 +256,7 @@ void Eyegore_Action5(EyegoreEntity* this) { super->animationState = this->unk_7f; InitializeAnimation(super, super->animationState + 4); } - if (GravityUpdate(super, 0x1c00) == 0) { + if (GravityUpdate(super, Q_8_8(28.0)) == 0) { sub_08030E70(this); } break; @@ -287,7 +287,7 @@ void Eyegore_Action6(EyegoreEntity* this) { void sub_08030E3C(EyegoreEntity* this) { super->frame = 0; - super->zVelocity = 0x11800; + super->zVelocity = Q_16_16(1.0 + 3.0 / 32.0); EnqueueSFX(SFX_157); } diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index 73c0771a..0d116679 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -54,7 +54,7 @@ void sub_080453E8(Entity* this) { void sub_08045430(Entity* this) { ProcessMovement2(this); GetNextFrame(this); - if (GravityUpdate(this, 0x1800) == 0) + if (GravityUpdate(this, Q_8_8(24.0)) == 0) sub_08045524(this); } diff --git a/src/enemy/flyingPot.c b/src/enemy/flyingPot.c index c38a24b9..610f2967 100644 --- a/src/enemy/flyingPot.c +++ b/src/enemy/flyingPot.c @@ -98,7 +98,7 @@ void FlyingPot_OnCollision(FlyingPotEntity* this) { if (super->contactFlags == 0x9D) { super->action = FLYING_POT_ACTION_6; COLLISION_OFF(super); - super->zVelocity = 0x2A000; + super->zVelocity = Q_16_16(2.625); super->spritePriority.b1 = 1; SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); @@ -217,7 +217,7 @@ void FlyingPot_Action2(FlyingPotEntity* this) { } void FlyingPot_Action3(FlyingPotEntity* this) { - super->z.WORD -= 0x10000; + super->z.WORD -= Q_16_16(1.0); if (super->z.HALF.HI <= -6) { super->action = FLYING_POT_ACTION_4; @@ -245,7 +245,7 @@ void FlyingPot_Action6(FlyingPotEntity* this) { super->spriteSettings.flipY = 1; } - if (!GravityUpdate(super, 0x2000)) { + if (!GravityUpdate(super, Q_8_8(32.0))) { sub_08037408(this); } } diff --git a/src/enemy/flyingSkull.c b/src/enemy/flyingSkull.c index 944094a3..7110c455 100644 --- a/src/enemy/flyingSkull.c +++ b/src/enemy/flyingSkull.c @@ -203,7 +203,7 @@ void sub_08039FAC(FlyingSkullEntity* this) { void sub_0803A048(FlyingSkullEntity* this) { GetNextFrame(super); - super->z.WORD += 0xFFFF0000; + super->z.WORD -= Q_16_16(1.0); if (super->z.HALF.HI <= -6) { super->action = 5; super->timer = 10; @@ -233,7 +233,7 @@ void sub_0803A0B8(FlyingSkullEntity* this) { super->spriteSettings.flipY = 1; } - if (GravityUpdate(super, 0x2000) == 0) { + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { sub_0803A0E0(this); } } diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index 67127b77..0ca18b24 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -530,7 +530,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D86C.inc", void sub_0802D86C(GleerokE return; } - if (GravityUpdate(super, 0x1800)) + if (GravityUpdate(super, Q_8_8(24.0))) return; ((GleerokEntity*)(super->parent))->unk_7b = 1; @@ -601,7 +601,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D86C.inc", void sub_0802D86C(GleerokE if ((super->contactFlags & 0x80) && this->unk_74 == 0) { if ((super->contactFlags & 0x7f) == 0x1d) { - super->zVelocity = 0x30000; + super->zVelocity = Q_16_16(3.0); super->parent->subAction = 4; super->parent->type2 = 0; ((GleerokEntity*)super->parent)->unk_7b = 0; @@ -626,7 +626,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D86C.inc", void sub_0802D86C(GleerokE if (super->zVelocity <= 0) return; - GravityUpdate(super, 0x1800); + GravityUpdate(super, Q_8_8(24.0)); if (super->zVelocity > 0) return; diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index bce46d65..553e20e9 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -233,7 +233,7 @@ void sub_0802BEEC(Entity* this) { this->direction = this->animationState << 3; InitializeAnimation(this, this->animationState + 4); } - } else if (!GravityUpdate(this, Q_16_16(0.109375))) { + } else if (!GravityUpdate(this, Q_8_8(28.0))) { this->action = 8; this->timer = 30; this->speed = 0x120; diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index 784c21a5..7b1cfda5 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -232,7 +232,7 @@ void Lakitu_LightningDelay(Entity* this) { } void Lakitu_Cloudless(Entity* this) { - if (GravityUpdate(this, 0x1800) == 0 && this->animIndex <= 19) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0 && this->animIndex <= 19) { InitAnimationForceUpdate(this, this->animationState + 20); this->spritePriority.b1 = 0; diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 1f6ff296..04b242c3 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -928,7 +928,7 @@ void sub_0803B100(Entity* this) { void sub_0803B144(Entity* this) { UpdateAnimationSingleFrame(this->child); - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { this->action = 0x2a; InitializeAnimation(this, 0x16); sub_0803B8E8(this, 0x14); diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index 8b8432b3..374b3b53 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -183,7 +183,7 @@ void sub_08033FFC(Entity* this) { } break; case 4: - this->z.WORD += -0x8000; + this->z.WORD -= Q_16_16(0.5); if (this->z.HALF.HI == -10) { this->subAction = 5; this->field_0x80.HALF.HI = 1; @@ -320,7 +320,7 @@ void sub_080342C8(Entity* this) { this->spriteOffsetX = gUnk_080CECEC[this->timer >> 1 & 7]; } else { this->spriteOffsetX = 0; - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { this->action = 0xc; this->field_0x7c.HALF.HI = 0x708; this->field_0x7c.BYTES.byte1 = 0; diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c index 5bc32f2b..a51aa38e 100644 --- a/src/enemy/miniFireballGuy.c +++ b/src/enemy/miniFireballGuy.c @@ -50,7 +50,7 @@ void sub_08045618(Entity* this) { void sub_08045654(Entity* this) { ProcessMovement2(this); GetNextFrame(this); - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { sub_08045678(this); } } diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 2af3a5ff..d99cd598 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -243,7 +243,7 @@ void Peahat_Stunned(Entity* this) { GetNextFrame(this); break; case PeahatAnimation_SlicedPropeller: - GravityUpdate(this, 0x1c00); + GravityUpdate(this, Q_8_8(28.0)); if (this->z.HALF.HI == 0) { this->action = 7; this->timer = 150; @@ -321,7 +321,7 @@ void Peahat_Takeoff(Entity* this) { } else if (this->frame & 1) { sub_0800442E(this); } else { - GravityUpdate(this, 0x1c00); + GravityUpdate(this, Q_8_8(28.0)); ProcessMovement0(this); } } @@ -347,7 +347,7 @@ void PeahatPropeller_Fly(Entity* this) { if (this->timer < 60) this->spriteSettings.draw ^= 1; - this->z.WORD -= 0xc000; + this->z.WORD -= Q_16_16(0.75); LinearMoveUpdate(this); if (--this->subtimer == 0) { this->subtimer = 40; diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index f07f5bc0..ae2d6bbe 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -105,7 +105,7 @@ void Puffstool_OnDeath(Entity* this) { } void Puffstool_OnGrabbed(Entity* this) { - GravityUpdate(this, 0x2000); + GravityUpdate(this, Q_8_8(32.0)); if (sub_0806F520(this)) { gUnk_080CBFEC[this->subAction](this); } else { @@ -210,7 +210,7 @@ void sub_0802538C(Entity* this) { if (this->frame == 0) { GetNextFrame(this); } else { - GravityUpdate(this, Q_16_16(0.125)); + GravityUpdate(this, Q_8_8(32.0)); if (this->zVelocity < Q_16_16(0.125)) { this->action = 4; InitializeAnimation(this, 2); @@ -221,7 +221,7 @@ void sub_0802538C(Entity* this) { void sub_080253D4(Entity* this) { GetNextFrame(this); - if (!GravityUpdate(this, 0x2000)) { + if (!GravityUpdate(this, Q_8_8(32.0))) { if (this->subtimer == 0) { this->action = 5; InitializeAnimation(this, 3); @@ -240,7 +240,7 @@ void sub_0802541C(Entity* this) { if (this->frame & ANIM_DONE) { this->action = 3; this->subtimer = 1; - this->zVelocity = Q_16_16(2); + this->zVelocity = Q_16_16(2.0); InitializeAnimation(this, 1); } } @@ -257,7 +257,7 @@ void sub_0802544C(Entity* this) { } void sub_0802547C(Entity* this) { - GravityUpdate(this, Q_16_16(0.125)); + GravityUpdate(this, Q_8_8(32.0)); GetNextFrame(this); if ((this->timer & 7) == 0) { sub_08025BD4(this); @@ -269,7 +269,7 @@ void sub_0802547C(Entity* this) { } void sub_080254B4(Entity* this) { - GravityUpdate(this, Q_16_16(0.125)); + GravityUpdate(this, Q_8_8(32.0)); if (this->frame & ANIM_DONE) { if (this->z.HALF.HI == 0) { if (this->cutsceneBeh.HWORD == 0) { diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index a8fd55e8..f55a3c34 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -214,7 +214,7 @@ void Rollobite_Unroll(Entity* this) { } void Rollobite_LinedUp(Entity* this) { - if (GravityUpdate(this, 0x1c00) == 0) { + if (GravityUpdate(this, Q_8_8(28.0)) == 0) { this->action = 7; this->spritePriority.b0 = 7; } diff --git a/src/enemy/rope.c b/src/enemy/rope.c index c21b7540..91c74c7b 100644 --- a/src/enemy/rope.c +++ b/src/enemy/rope.c @@ -89,7 +89,7 @@ void sub_08031480(Entity* this) { SoundReq(SFX_12D); } } else { - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { this->action = 2; this->subtimer = 0xf; this->spriteSettings.draw = 1; diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index d4c1fb77..2e4884ce 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -180,7 +180,7 @@ void sub_0802B8E0(Entity* this) { } void sub_0802B948(Entity* this) { - if (!GravityUpdate(this, 0x1800)) { + if (!GravityUpdate(this, Q_8_8(24.0))) { this->action = 1; this->timer = 1; } diff --git a/src/enemy/stalfos.c b/src/enemy/stalfos.c index a8209b1f..9fea0d69 100644 --- a/src/enemy/stalfos.c +++ b/src/enemy/stalfos.c @@ -174,7 +174,7 @@ void Stalfos_Init(StalfosEntity* this) { } void Stalfos_Action1(StalfosEntity* this) { - if (GravityUpdate(super, 0x1800) == 0 && sub_08039758(this) == 0 && --this->unk_78 == 0) { + if (GravityUpdate(super, Q_8_8(24.0)) == 0 && sub_08039758(this) == 0 && --this->unk_78 == 0) { super->action = 2; super->timer = 0xa; sub_08039858(this); @@ -203,7 +203,7 @@ void Stalfos_Action3(StalfosEntity* this) { void Stalfos_Action4(StalfosEntity* this) { ProcessMovement2(super); - if (GravityUpdate(super, 0x1800) == 0) { + if (GravityUpdate(super, Q_8_8(24.0)) == 0) { sub_0803998C(this); this->unk_7c = 0x5a; EnqueueSFX(SFX_PLY_LAND); @@ -212,7 +212,7 @@ void Stalfos_Action4(StalfosEntity* this) { void Stalfos_Action5(StalfosEntity* this) { ProcessMovement2(super); - GravityUpdate(super, 0x1800); + GravityUpdate(super, Q_8_8(24.0)); if (super->zVelocity < 0) { super->action = 6; super->timer = 0x0f; @@ -255,7 +255,7 @@ void Stalfos_Action8(StalfosEntity* this) { } void Stalfos_Action9(StalfosEntity* this) { - if (GravityUpdate(super, 0x1800) == 0 && --this->unk_78 == 0) { + if (GravityUpdate(super, Q_8_8(24.0)) == 0 && --this->unk_78 == 0) { sub_08039A70(this); } } @@ -297,7 +297,7 @@ bool32 sub_08039758(StalfosEntity* this) { sub_0803981C(this); super->hitType = 0x46; this->unk_7d = 0x46; - super->zVelocity = 0x28000; + super->zVelocity = Q_16_16(2.5); return TRUE; } } else { @@ -314,7 +314,7 @@ bool32 sub_08039758(StalfosEntity* this) { } void sub_0803981C(StalfosEntity* this) { - super->zVelocity = 0x20000; + super->zVelocity = Q_16_16(2.0); if (super->iframes == 0) { super->iframes = -0xc; } diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index da49b413..3a7875d8 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -82,9 +82,9 @@ void sub_0802F210(Entity* this) { this->subtimer = 0; *(u8*)&this->field_0x7c = 0; - this->field_0x80.HWORD = this->type == 0 ? 0x1800 : 0x2800; + this->field_0x80.HWORD = this->type == 0 ? Q_8_8(24.0) : Q_8_8(40.0); - this->field_0x82.HWORD = this->type == 0 ? 0x2800 : 0x3000; + this->field_0x82.HWORD = this->type == 0 ? (Q_16_16(2.5) >> 4) : (Q_16_16(3.0) >> 4); InitializeAnimation(this, 0); } diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index c77cfdaa..09c4f3f0 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -63,7 +63,7 @@ void TektiteGolden_OnDeath(Entity* this) { void TektiteGolden_OnConfused(Entity* this) { GenericConfused(this); if (this->z.HALF.HI != 0) { - GravityUpdate(this, 0x3000); + GravityUpdate(this, Q_8_8(48.0)); } } diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 8d3da887..f8a959ba 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -509,5 +509,5 @@ void sub_08044E74(Entity* this, u32 state) { } this->timer = 1; this->field_0x78.HALF.LO = 0; - this->speed = Q_8_8(5); + this->speed = Q_8_8(5.0); } diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index e9d7b344..c9b59664 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -319,7 +319,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { } break; } - if (GravityUpdate(this, 0x2800) == 0) { + if (GravityUpdate(this, Q_8_8(40.0)) == 0) { this->field_0x80.HALF.LO = 5; this->timer = 0x10; COLLISION_ON(this); diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 4b05b5e1..8097dd49 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -167,7 +167,7 @@ void VaatiWrathType0Action1(Entity* this) { break; case 1: this->spritePriority.b1 = 1; - this->z.WORD += 0x8000; + this->z.WORD += Q_16_16(0.5); if ((this->z.HALF.HI & 0x3f) == 0) { SoundReq(SFX_1A9); } @@ -473,7 +473,7 @@ void VaatiWrathType0ActionB(Entity* this) { UpdateAnimationSingleFrame(this); GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type1); GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { this->subAction = 1; this->timer = 0xf0; this->health = 8; @@ -517,7 +517,7 @@ void VaatiWrathType0ActionC(Entity* this) { } switch (this->subAction) { case 0: - this->z.WORD -= 0x8000; + this->z.WORD -= Q_16_16(0.5); if (this->z.HALF.HI < -4) { this->subAction = 1; this->timer = 120; diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index 0e06f87e..709f2939 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -171,7 +171,7 @@ void sub_0802A734(Entity* this) { SetInitializationPriority(); DoExitTransition(gUnk_0813AB1C[gArea.dungeon_idx]); } else { - this->z.WORD -= 0x20000; + this->z.WORD -= Q_16_16(2); gPlayerState.field_0xa |= 0x80; gPlayerState.mobility |= 0x80; } diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index 59a3e042..5f07b006 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -147,7 +147,7 @@ void sub_0802CEF4(Entity* this) { SetInitializationPriority(); DoExitTransition(gUnk_0813AB1C[gArea.dungeon_idx]); } else { - this->z.WORD -= 0x20000; + this->z.WORD -= Q_16_16(2); if (this->z.HALF.HI < -0x30) { this->spriteSettings.shadow = 1; } diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index 51da1e65..cdd7298b 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -40,7 +40,7 @@ void sub_0802A250(Entity* this) { } void sub_0802A2B4(Entity* this) { - if (!GravityUpdate(this, 0x2800)) { + if (!GravityUpdate(this, Q_8_8(40.0))) { this->action = 2; this->spritePriority.b0 = 7; EnqueueSFX(SFX_WATER_SPLASH); diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index 486fc90e..a2bf43a3 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -23,7 +23,7 @@ void ItemRocsCape(ItemBehavior* this, u32 arg1) { gPlayerState.jump_status = 1; gPlayerState.field_0xe = -1; gPlayerState.item = NULL; - gPlayerEntity.zVelocity = 0x20000; + gPlayerEntity.zVelocity = Q_16_16(2.0); sub_08077F84(); SoundReq(SFX_PLY_VO4); return; @@ -43,8 +43,8 @@ void ItemRocsCape(ItemBehavior* this, u32 arg1) { if ((gPlayerState.jump_status != 0) && ((gPlayerState.jump_status & 7) != 3)) { sub_08076758(this, arg1); return; - } else if (-1 < gPlayerEntity.z.WORD) { - gPlayerEntity.zVelocity = 0x20000; + } else if (gPlayerEntity.z.WORD >= 0) { + gPlayerEntity.zVelocity = Q_16_16(2.0); gPlayerState.jump_status = 1; gPlayerState.item = NULL; this->stateID += 1; @@ -66,7 +66,7 @@ void sub_08076758(ItemBehavior* this, u32 arg1) { ((gPlayerState.jump_status & 7) != 3)) { if (sub_08077EFC(this)) { if (this->stateID < 2) { - if ((gPlayerEntity.zVelocity < 1) && ((gPlayerState.jump_status & 0x10) == 0)) { + if ((gPlayerEntity.zVelocity <= 0) && ((gPlayerState.jump_status & 0x10) == 0)) { this->stateID = 2; gPlayerEntity.field_0x7a.HWORD = 2; gPlayerEntity.zVelocity = Q_16_16(2.0); diff --git a/src/item/itemSword.c b/src/item/itemSword.c index c0a24c68..5c3dca2d 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -30,8 +30,8 @@ void sub_08075338(ItemBehavior* this, u32 idx) { if (gPlayerState.jump_status) { if ((gPlayerState.jump_status & 7) != 3) { - if ((gPlayerState.jump_status & 0x78) == 0 && (u32)gPlayerEntity.zVelocity <= 0x17fff && - (gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD) { + if ((gPlayerState.jump_status & 0x78) == 0 && (u32)gPlayerEntity.zVelocity < Q_16_16(1.5) && + (gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD != 0) { gPlayerState.jump_status |= 0x20; gPlayerState.field_0xab = 7; gPlayerState.field_0x3[1] |= (8 >> idx) | ((8 >> idx) << 4); diff --git a/src/npc/castorWildsStatue.c b/src/npc/castorWildsStatue.c index 92cd3358..086889da 100644 --- a/src/npc/castorWildsStatue.c +++ b/src/npc/castorWildsStatue.c @@ -182,7 +182,7 @@ void sub_080676E0(Entity* this, ScriptExecutionContext* context) { break; } default: { - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { return; } break; diff --git a/src/npc/cucco.c b/src/npc/cucco.c index 7b022a00..c1d20510 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -51,16 +51,16 @@ void Cucco_Fly(Entity* this) { } this->timer = (Random() & 1) + 1; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); InitAnimationForceUpdate(this, 1); } - if (GravityUpdate(this, 0x2800) == 0) { + if (GravityUpdate(this, Q_8_8(40.0)) == 0) { if (--this->timer == 0) { this->action = 1; this->subAction = 0; } else { - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); } } diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index 476c44cd..c7496ee6 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -53,15 +53,15 @@ void CuccoChick_Fly(Entity* this) { this->spriteSettings.flipX ^= 1; } this->timer = (Random() & 3) + 1; - this->zVelocity = 0x10000; + this->zVelocity = Q_16_16(1.0); this->frameIndex = 1; } - if (GravityUpdate(this, 0x3000) == 0) { + if (GravityUpdate(this, Q_8_8(48.0)) == 0) { if (--this->timer == 0) { this->action = 1; this->subAction = 0; } else { - this->zVelocity = 0x10000; + this->zVelocity = Q_16_16(1.0); } } sub_0806E838(this); @@ -100,7 +100,7 @@ void CuccoChick_Fusion(Entity* this) { this->spriteSettings.draw = 1; this->frameIndex = 1; } else { - if (GravityUpdate(this, 0x3000) == 0) { + if (GravityUpdate(this, Q_8_8(48.0)) == 0) { this->zVelocity = Q_16_16(1.0); } } diff --git a/src/npc/npc5.c b/src/npc/npc5.c index 163f8c88..031e255b 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -286,7 +286,7 @@ void sub_08060DFC(Entity* this) { LinearMoveUpdate(this); sub_08060E94(this); - uVar1 = GravityUpdate(this, 0x2000); + uVar1 = GravityUpdate(this, Q_8_8(32.0)); if (uVar1 == 0) { this->action = 7; this->collisionLayer = 1; diff --git a/src/npc/postman.c b/src/npc/postman.c index bced68a9..5b5946be 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -153,12 +153,12 @@ void sub_08060528(Entity* this) { this->field_0x6a.HWORD -= 1; } } - GravityUpdate(this, 0x1800); + GravityUpdate(this, Q_8_8(24.0)); if (((this->field_0x6c.HALF.HI != 0) && (this->zVelocity == 0)) && this->z.WORD == 0) { this->field_0x6c.HALF.HI = 0; sub_080606C0(this); } - if ((-1 < this->z.WORD) && + if (this->z.WORD >= 0 && ((gPlayerEntity.collisionLayer == 0 || (this->collisionLayer == gPlayerEntity.collisionLayer)))) { sub_0806ED78(this); } diff --git a/src/npc/rem.c b/src/npc/rem.c index c0e26933..2fbfdc08 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -416,17 +416,17 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) { case 0: gRoomVars.entities[0] = this; PrependEntityToList(this, NPC); - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); break; case 1: pEnt = FindNextDuplicateID(gRoomVars.entities[0], NPC); gRoomVars.entities[1] = pEnt; - pEnt->zVelocity = 0x18000; + pEnt->zVelocity = Q_16_16(1.5); break; case 2: pEnt = FindNextDuplicateID(gRoomVars.entities[1], NPC); gRoomVars.entities[2] = pEnt; - pEnt->zVelocity = 0x18000; + pEnt->zVelocity = Q_16_16(1.5); break; } if (messageIndex == 0x441e) { @@ -440,7 +440,7 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) { if (pEnt->z.HALF.HI < 0) { break; } - pEnt->zVelocity = 0x18000; + pEnt->zVelocity = Q_16_16(1.5); context->unk_18 = 2; break; case 2: diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index 28d815b3..d8b01c3e 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -168,7 +168,7 @@ void sub_0806AEA8(Entity* this) { int old = this->field_0x82.HWORD; this->field_0x82.HWORD &= ~0x20; if (old & 0x20) { - GravityUpdate(this, 0x4000); + GravityUpdate(this, Q_8_8(64.0)); } HandleEntity0x82Actions(this); this->field_0x82.HWORD = old; @@ -220,8 +220,8 @@ void sub_0806AF70(Entity* this, ScriptExecutionContext* context) { } void sub_0806AF78(Entity* this, ScriptExecutionContext* context) { - GravityUpdate(this, 0x1800); - if (0 <= this->z.WORD && this->zVelocity < 1) { + GravityUpdate(this, Q_8_8(24.0)); + if (0 <= this->z.WORD && this->zVelocity <= 0) { this->z.WORD = 0; sub_0806AF70(this, context); } diff --git a/src/npc/zelda.c b/src/npc/zelda.c index 7978a1eb..be151753 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -134,7 +134,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) { break; case 2: LinearMoveAngle(this, 0x100, 0x80); - GravityUpdate(this, 0x2000); + GravityUpdate(this, Q_8_8(32.0)); if (!(this->frame & 1)) { UpdateAnimationSingleFrame(this); } @@ -145,7 +145,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) { case 3: LinearMoveAngle(this, 0x100, 0x80); UpdateAnimationSingleFrame(this); - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { context->unk_18++; InitAnimationForceUpdate(this, 0x1E); } diff --git a/src/object/bird.c b/src/object/bird.c index 44af688e..0ec0b1b6 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -50,7 +50,7 @@ void Bird_Type0_Init(Entity* this) { this->subtimer = 1; this->zVelocity = Q_16_16(-1.5); this->z.WORD = Q_16_16(-56.75); - this->field_0x68.HWORD = Q_16_16(-0.03125); + this->field_0x68.HWORD = Q_8_8(-8.0); this->speed = 0x280; this->direction = 8; this->collisionLayer = 2; @@ -225,7 +225,7 @@ void Bird_Type8(Entity* this) { this->action = 2; this->timer = 8; this->speed = 0x300; - this->field_0x68.HWORD = 0xe000; + this->field_0x68.HWORD = Q_8_8(-32.0); PlayerDropHeldObject(); sub_08078B48(); ResetPlayerAnimationAndAction(); @@ -286,9 +286,9 @@ void Bird_Type9(Entity* this) { if (this->action == 0) { this->action = 1; this->spriteSettings.draw = 1; - this->zVelocity = -0x28000; - this->z.WORD = 0xffb4c000; - this->field_0x68.HWORD = 0xf000; + this->zVelocity = Q_16_16(-2.5); + this->z.WORD = Q_16_16(-75.25); + this->field_0x68.HWORD = Q_8_8(-16.0); this->speed = 0x300; this->direction = 8; this->collisionLayer = 1; diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index ab865f7d..a953c47e 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -190,7 +190,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { gPlayerState.heldObject = 0; super->action = 5; super->speed = 0x100; - super->zVelocity = 0x20000; + super->zVelocity = Q_16_16(2); super->spritePriority.b1 = 1; super->spriteSettings.shadow = 1; RestorePrevTileEntity(0xdc, super->collisionLayer); @@ -256,7 +256,7 @@ void CrenelBeanSprout_Action5(CrenelBeanSproutEntity* this) { super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->unk_70, this->unk_72); LinearMoveUpdate(super); } - if (GravityUpdate(super, 0x4000) == 0) { + if (GravityUpdate(super, Q_8_8(64.0)) == 0) { sub_08096A78(this); } } diff --git a/src/object/ezloCap.c b/src/object/ezloCap.c index 39c7793a..9780c525 100644 --- a/src/object/ezloCap.c +++ b/src/object/ezloCap.c @@ -220,7 +220,7 @@ void sub_08082C5C(EzloCapEntity* this) { return; } } - GravityUpdate(super, 0x2000); + GravityUpdate(super, Q_8_8(32.0)); UpdateAnimationSingleFrame(super); } @@ -273,7 +273,7 @@ void sub_08082D20(EzloCapEntity* this, ScriptExecutionContext* context) { void EzloCap_ScriptedAction2(EzloCapEntity* this) { ExecuteScript(super, this->unk_84); - GravityUpdate(super, 0x1800); + GravityUpdate(super, Q_8_8(24.0)); switch (super->subAction) { case 0: if (super->zVelocity < 0) { diff --git a/src/object/fairy.c b/src/object/fairy.c index 988d56e7..349fdf68 100644 --- a/src/object/fairy.c +++ b/src/object/fairy.c @@ -115,7 +115,7 @@ void Fairy_Init(FairyEntity* this) { switch (super->type2) { case 0: - super->zVelocity = 0x1e000; + super->zVelocity = Q_16_16(1.875); super->z.HALF.HI += 8; // fallthrough default: @@ -131,7 +131,7 @@ void Fairy_Init(FairyEntity* this) { } void Fairy_Action1(FairyEntity* this) { - super->z.WORD -= 0xe000; + super->z.WORD -= Q_16_16(0.875); if (super->frame != 0) { if (super->timer != 0) { this->unk_78 *= 0x1e; diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c index 100ec565..4004cfe4 100644 --- a/src/object/frozenOctorok.c +++ b/src/object/frozenOctorok.c @@ -84,10 +84,10 @@ void FrozenOctorok_Action1SubAction0(FrozenOctorokEntity* this) { if (this->unk_7e == 0) { child = super->child; if (child->z.HALF.HI > -0x10) { - child->z.WORD -= 0x4000; + child->z.WORD -= Q_16_16(0.25); } else { - child->z.WORD -= 0x1000; - (super->child)->zVelocity = 0x3000; + child->z.WORD -= Q_16_16(0.0625); + (super->child)->zVelocity = Q_16_16(0.1875); this->unk_7e = 0x200; } } diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index ab08f369..fdc16d3e 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -229,7 +229,7 @@ void GreatFairy_MiniRisingUpdate(Entity* this) { Entity* target; GetNextFrame(this); - this->z.WORD -= 0x8000; + this->z.WORD -= Q_16_16(0.5); if (this->z.HALF.HI == -20) { this->action = 2; SoundReq(SFX_HEART_CONTAINER_SPAWN); diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index f9806ec8..8a29ce8c 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -206,7 +206,7 @@ void sub_080811EC(Entity* this) { LinearMoveUpdate(this); } - GravityUpdate(this, 0x2800); + GravityUpdate(this, Q_8_8(40.0)); if (this->zVelocity <= 0) { this->action = 2; COLLISION_ON(this); @@ -293,7 +293,7 @@ void sub_0808136C(Entity* this) { this->y.WORD = other->y.WORD; this->spriteOrientation.flipY = other->spriteOrientation.flipY; this->spriteRendering.b3 = other->spriteRendering.b3; - GravityUpdate(this, 0x2800); + GravityUpdate(this, Q_8_8(40.0)); } else { sub_08081404(this, 1); } @@ -397,14 +397,14 @@ void sub_0808153C(Entity* this) { return; if (this->field_0x68.HALF.LO == 0) { - if (!GravityUpdate(this, 0x1000) && !sub_0800442E(this)) { + if (!GravityUpdate(this, Q_8_8(16.0)) && !sub_0800442E(this)) { this->field_0x68.HALF.LO = 1; this->zVelocity = Q_16_16(1.875); sub_0808148C(this->type); UpdateSpriteForCollisionLayer(this); } } else { - if (!GravityUpdate(this, 0x2800)) { + if (!GravityUpdate(this, Q_8_8(40.0))) { this->field_0x68.HALF.LO = 2; sub_0808148C(this->type); } diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index 355a6b78..4cdcf642 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -56,7 +56,7 @@ void sub_0808BF14(Entity* this) { } void sub_0808BF58(Entity* this) { - GravityUpdate(this, 0x2000); + GravityUpdate(this, Q_8_8(32.0)); switch (this->subAction) { case 0: if (this->zVelocity < Q_16_16(1.5)) { @@ -124,7 +124,7 @@ void sub_0808C01C(Entity* this, u32 r1) { } void sub_0808C0AC(Entity* this) { - GravityUpdate(this, 0x2000); + GravityUpdate(this, Q_8_8(32.0)); switch (this->subAction) { case 0: if (this->zVelocity < Q_16_16(1.5)) { diff --git a/src/object/keyStealingTakkuri.c b/src/object/keyStealingTakkuri.c index d1dc56bf..9d6390f7 100644 --- a/src/object/keyStealingTakkuri.c +++ b/src/object/keyStealingTakkuri.c @@ -80,8 +80,8 @@ void KeyStealingTakkuri_Type0_Init(KeyStealingTakkuriEntity* this) { void KeyStealingTakkuri_Type0_Action1(KeyStealingTakkuriEntity* this) { if (--super->timer == 0) { super->action++; - super->y.WORD += 0x100000; - super->z.WORD -= 0x100000; + super->y.WORD += Q_16_16(16.0); + super->z.WORD -= Q_16_16(16.0); InitAnimationForceUpdate(super, 3); } } @@ -159,7 +159,7 @@ void KeyStealingTakkuri_Type5_Init(KeyStealingTakkuriEntity* this) { super->spriteSettings.draw = 1; super->direction = 0x18; super->speed = 0x100; - super->zVelocity = 0x20000; + super->zVelocity = Q_16_16(2.0); super->timer = 1; SoundReq(SFX_RUPEE_BOUNCE); } @@ -169,7 +169,7 @@ void KeyStealingTakkuri_Type5_Action1(KeyStealingTakkuriEntity* this) { if (sub_080044EC(super, 0x2000) < 2) { if (super->timer != 0) { super->timer--; - super->zVelocity = 0x10000; + super->zVelocity = Q_16_16(1.0); } else { super->action++; super->collisionLayer = gPlayerEntity.collisionLayer; @@ -194,8 +194,8 @@ void KeyStealingTakkuri_Type2_Init(KeyStealingTakkuriEntity* this) { super->spriteRendering.b3 = 1; super->speed = 0; super->direction = 0x18; - super->y.WORD += 0x100000; - super->z.WORD -= 0x100000; + super->y.WORD += Q_16_16(16.0); + super->z.WORD -= Q_16_16(16.0); this->unk_68 = super->x.HALF.HI; this->unk_6a = super->y.HALF.HI; this->unk_6c = 0; diff --git a/src/object/ladderUp.c b/src/object/ladderUp.c index 98a3b01a..b173b5f6 100644 --- a/src/object/ladderUp.c +++ b/src/object/ladderUp.c @@ -34,7 +34,7 @@ void LadderUp(Entity* this) { SetTile(0x4023, COORD_TO_TILE(this), this->collisionLayer); break; case 1: - if (GravityUpdate(this, 0x1000) == 0) { + if (GravityUpdate(this, Q_8_8(16.0)) == 0) { fxEnt = CreateFx(this, FX_GIANT_EXPLOSION, 0x40); if (fxEnt) { fxEnt->y.HALF.HI += 8; diff --git a/src/object/lavaPlatform.c b/src/object/lavaPlatform.c index 4459128b..be0e619f 100644 --- a/src/object/lavaPlatform.c +++ b/src/object/lavaPlatform.c @@ -77,7 +77,7 @@ void LavaPlatform_Type0Action1(LavaPlatformEntity* this) { if (*(u8*)&this->timer != 0) { // Use this entity to show the platform flipping animation. super->action = 2; - super->zVelocity = 0x2c000; + super->zVelocity = Q_16_16(2.75); super->spriteSettings.draw = 1; UpdateSpriteForCollisionLayer(super); InitAnimationForceUpdate(super, (super->child)->animationState); @@ -87,7 +87,7 @@ void LavaPlatform_Type0Action1(LavaPlatformEntity* this) { } void LavaPlatform_Type0Action2(LavaPlatformEntity* this) { - if (GravityUpdate(super, 0x2400) == 0) { + if (GravityUpdate(super, Q_8_8(36.0)) == 0) { // Finished flipping platform. super->action = 1; super->spriteSettings.draw = 0; @@ -95,7 +95,7 @@ void LavaPlatform_Type0Action2(LavaPlatformEntity* this) { (super->child)->spriteOffsetY = 0; InitializeAnimation(super->child, super->child->animationState); CreateFx(super, FX_LAVA_SPLASH_HUGE, 0); - } else if ((super->zVelocity < 0x18000) && ((super->frame & ANIM_DONE) == 0)) { + } else if ((super->zVelocity < Q_16_16(1.5)) && ((super->frame & ANIM_DONE) == 0)) { UpdateAnimationSingleFrame(super); } } diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 241ee9de..e447e036 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -145,7 +145,7 @@ void sub_08085A98(LilypadLargeEntity* this) { void sub_08085B40(LilypadLargeEntity* this) { if (super->z.WORD != 0) { - if (GravityUpdate(super, 0x2000) != 0) { + if (GravityUpdate(super, Q_8_8(32.0)) != 0) { if ((u32)this->unk_78.WORD < 0x1200000) { this->unk_78.WORD += 0x100000; SetAffineInfo(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI); @@ -168,7 +168,7 @@ void sub_08085B40(LilypadLargeEntity* this) { } if (this->unk_82 == 0) { - if (GravityUpdate(&gPlayerEntity, 0x2000) == 0) { + if (GravityUpdate(&gPlayerEntity, Q_8_8(32.0)) == 0) { ResetCollisionLayer(&gPlayerEntity); sub_08085F1C(this); super->action = 1; diff --git a/src/object/macroBook.c b/src/object/macroBook.c index 722ce8a4..675ac74c 100644 --- a/src/object/macroBook.c +++ b/src/object/macroBook.c @@ -116,7 +116,7 @@ void MacroBook_Action3(MacroBookEntity* this) { if (super->timer) { this->unk80 += 8; - super->x.WORD += 0x400; + super->x.WORD += Q_16_16(1.0 / 64.0); SetAffineInfo(super, this->unk80, this->unk80, 0); } else { sub_0809AA9C(this, super->child, 0); diff --git a/src/object/macroPlayer.c b/src/object/macroPlayer.c index 5a75369b..603251e6 100644 --- a/src/object/macroPlayer.c +++ b/src/object/macroPlayer.c @@ -130,11 +130,11 @@ void sub_0808CC88(MacroPlayerEntity* this) { void MacroPlayer_Type0_Action1(MacroPlayerEntity* this) { sub_0808CC88(this); - if (GravityUpdate(super, 0x1000) == 0) { + if (GravityUpdate(super, Q_8_8(16.0)) == 0) { super->action++; super->direction = DirectionSouthWest; super->speed = 0x100; - super->zVelocity = 0x30000; + super->zVelocity = Q_16_16(3.0); super->spriteSettings.shadow = 0; super->child->subAction = 1; gUnk_02018EB0.unk_18 = 1; @@ -144,13 +144,13 @@ void MacroPlayer_Type0_Action1(MacroPlayerEntity* this) { void MacroPlayer_Type0_Action2(MacroPlayerEntity* this) { sub_0808CC88(this); UpdateAnimationSingleFrame(super); - if (GravityUpdate(super, 0x2000)) { + if (GravityUpdate(super, Q_8_8(32.0))) { LinearMoveUpdate(super); } else { super->action++; super->direction = 10; super->speed = 0xc0; - super->zVelocity = 0x28000; + super->zVelocity = Q_16_16(2.5); gUnk_02018EB0.unk_19 = 1; } } @@ -158,20 +158,20 @@ void MacroPlayer_Type0_Action2(MacroPlayerEntity* this) { void MacroPlayer_Type0_Action3(MacroPlayerEntity* this) { sub_0808CC88(this); UpdateAnimationSingleFrame(super); - if (GravityUpdate(super, 0x2000)) { + if (GravityUpdate(super, Q_8_8(32.0))) { LinearMoveUpdate(super); } else { super->action++; super->direction = 17; super->speed = 0x100; - super->zVelocity = 0x24000; + super->zVelocity = Q_16_16(2.25); gUnk_02018EB0.unk_1a = 1; } } void MacroPlayer_Type0_Action4(MacroPlayerEntity* this) { sub_0808CC88(this); - if (GravityUpdate(super, 0x1800)) { + if (GravityUpdate(super, Q_8_8(24.0))) { UpdateAnimationSingleFrame(super); LinearMoveUpdate(super); if (super->x.HALF.HI < 0x80) { diff --git a/src/object/minecart.c b/src/object/minecart.c index f49042bf..1b2988d1 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -295,7 +295,7 @@ void sub_08091D90(MinecartEntity* this) { if (super->zVelocity < 0) { UpdateAnimationSingleFrame(super); } - if (((super->frame & 0x7f) == 0) && GravityUpdate(super, 0x2000) == 0) { + if (((super->frame & 0x7f) == 0) && GravityUpdate(super, Q_8_8(32.0)) == 0) { super->type2 ^= 4; super->action = 1; this->minecartData->field_0x6 = super->type2; diff --git a/src/object/object1F.c b/src/object/object1F.c index 351ff739..efa7f8db 100644 --- a/src/object/object1F.c +++ b/src/object/object1F.c @@ -41,7 +41,7 @@ void Object1F_Init(Object1FEntity* this) { u32 temp; super->action = 1; - super->zVelocity = 0x2c000; + super->zVelocity = Q_16_16(2.75); super->direction = super->animationState << 2 ^ 0x10; if (super->animationState == 0) { super->spritePriority.b0--; @@ -66,7 +66,7 @@ void Object1F_Action1(Object1FEntity* this) { uVar1 = gPlayerState.field_0x3c[1]; } else { ProcessMovement2(super); - uVar1 = GravityUpdate(super, 0x2800); + uVar1 = GravityUpdate(super, Q_8_8(40.0)); } if (uVar1 == 0) { diff --git a/src/object/object30.c b/src/object/object30.c index 5dc2cff7..6a999eb3 100644 --- a/src/object/object30.c +++ b/src/object/object30.c @@ -17,7 +17,7 @@ typedef struct { /*0x68*/ u16 unk_68; /*0x6a*/ u16 unk_6a; /*0x6c*/ u16* unk_6c; - /*0x70*/ u32 unk_70; + /*0x70*/ u32 gravity; } Object30Entity; extern u32 sub_0806F798(Entity*); @@ -73,19 +73,19 @@ void Object30_Action2(Object30Entity* this) { u8 tmp; switch (super->type) { case 0: - if (this->unk_70 != 0) { + if (this->gravity != 0) { if (super->zVelocity < 0) { if (super->z.HALF.HI > -8) { - this->unk_70 = 0; + this->gravity = 0; } else { - if (super->zVelocity < -0x4000) { - this->unk_70 = -0x400; + if (super->zVelocity < Q_16_16(-0.25)) { + this->gravity = Q_8_8(-4.0); } else { - this->unk_70 = 0x400; + this->gravity = Q_8_8(4.0); } } } - GravityUpdate(super, this->unk_70); + GravityUpdate(super, this->gravity); return; } // fallthrough @@ -105,11 +105,11 @@ void sub_0808A968(Object30Entity* this) { super->action = 2; super->timer = 0x1e; super->spriteSettings.draw = 1; - super->zVelocity = 0x28000; + super->zVelocity = Q_16_16(2.5); super->spritePriority.b1 = 3; super->spriteSettings.shadow = 0; super->collisionFlags |= 0x10; super->hitbox = (Hitbox*)&gUnk_08121C58; SetDefaultPriority(super, 2); - this->unk_70 = 0x2800; + this->gravity = Q_8_8(40.0); } diff --git a/src/object/object37.c b/src/object/object37.c index 99eca229..e4cbc8f9 100644 --- a/src/object/object37.c +++ b/src/object/object37.c @@ -43,7 +43,7 @@ void Object37_Action1(Object37Entity* this) { if (item != 0) { item->direction = gPlayerEntity.animationState << 2; item->speed = 0x80; - item->zVelocity = 0x20000; + item->zVelocity = Q_16_16(2.0); } gSave.unk24E[0] = 1; DeleteThisEntity(); diff --git a/src/object/object45.c b/src/object/object45.c index 1de0e0f1..ba89d886 100644 --- a/src/object/object45.c +++ b/src/object/object45.c @@ -39,6 +39,6 @@ void sub_0808E448(Entity* this) { } if (this->type == 0) { - this->z.WORD -= 0x8000; + this->z.WORD -= Q_16_16(0.5); } } diff --git a/src/object/object49.c b/src/object/object49.c index 75998481..b67a7b86 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -51,7 +51,7 @@ void sub_0808F0D0(Entity* this) { void sub_0808F14C(Entity* this) { sub_0808F2B0(this); - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { this->action++; SoundReq(SFX_WATER_SPLASH); } diff --git a/src/object/object4B.c b/src/object/object4B.c index 94fd9943..42677c72 100644 --- a/src/object/object4B.c +++ b/src/object/object4B.c @@ -61,7 +61,7 @@ void Object4B_Action3(Object4BEntity* this) { super->action++; super->direction = 0; super->speed = 0x100; - super->zVelocity = 0x20000; + super->zVelocity = Q_16_16(2.0); super->spriteOrientation.flipY = 0; super->timer = 0; InitializeAnimation(super, 3); @@ -72,7 +72,7 @@ void Object4B_Action3(Object4BEntity* this) { void Object4B_Action4(Object4BEntity* this) { if ((super->frame & 0x10) != 0) { LinearMoveUpdate(super); - if (GravityUpdate(super, 0x2000) == 0) { + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { GetNextFrame(super); } } else { @@ -86,7 +86,7 @@ void Object4B_Action4(Object4BEntity* this) { InitializeAnimation(super, 2); } } else if ((super->frame & ANIM_DONE) != 0) { - super->zVelocity = 0x20000; + super->zVelocity = Q_16_16(2.0); InitializeAnimation(super, 3); SoundReq(SFX_12B); } diff --git a/src/object/object53.c b/src/object/object53.c index c4717fce..44f567f7 100644 --- a/src/object/object53.c +++ b/src/object/object53.c @@ -34,7 +34,7 @@ void sub_08091120(Entity* this) { this->spriteIndex = gUnk_08122288[this->type].spriteIndex; this->spriteSettings.draw = 1; this->spriteRendering.b3 = 2; - this->zVelocity = 0x2a000; + this->zVelocity = Q_16_16(2.625); InitializeAnimation(this, gUnk_08122288[this->type].animationState); sub_08004168(this); } @@ -44,7 +44,7 @@ void sub_08091198(Entity* this) { this->spriteSettings.flipY = 1; } - if (GravityUpdate(this, 0x2000)) { + if (GravityUpdate(this, Q_8_8(32.0))) { return; } diff --git a/src/object/object63.c b/src/object/object63.c index 120adaf5..1cd03832 100644 --- a/src/object/object63.c +++ b/src/object/object63.c @@ -24,7 +24,7 @@ void sub_08093D88(Entity* this) { this->action = 1; this->z.HALF.HI -= 8; - this->zVelocity = 0x2a000; + this->zVelocity = Q_16_16(2.625); this->timer = 32; switch (this->type) { case 0: diff --git a/src/object/object67.c b/src/object/object67.c index dec36521..e73c7a0b 100644 --- a/src/object/object67.c +++ b/src/object/object67.c @@ -89,11 +89,11 @@ void sub_08094148(Object67Entity* this) { super->spriteSettings.flipY = 1; } if (super->type2 < 4) { - super->zVelocity = (Random() & 0x1ffff) | 0x28000; + super->zVelocity = (Random() & 0x1ffff) | Q_16_16(2.5); super->speed = 0x100; InitializeAnimation(super, 0x56); } else { - super->zVelocity = 0x28000; + super->zVelocity = Q_16_16(2.5); super->speed = 0x100; super->direction = (Random() & 3) | super->direction; InitializeAnimation(super, 0x57); @@ -166,7 +166,7 @@ void sub_08094398(Object67Entity* this) { case 0: GetNextFrame(super); LinearMoveUpdate(super); - if (GravityUpdate(super, 0x4000) == 0) { + if (GravityUpdate(super, Q_8_8(64.0)) == 0) { if (super->type2 < 4) { CreateFx(super, FX_LAVA_SPLASH, 0); } diff --git a/src/object/object68.c b/src/object/object68.c index f08b1659..c0878931 100644 --- a/src/object/object68.c +++ b/src/object/object68.c @@ -89,7 +89,7 @@ void sub_080948D0(Object68Entity* this) { void sub_080948E8(Object68Entity* this) { if (super->timer < 0x3c) { - super->z.WORD -= 0x4000; + super->z.WORD -= Q_16_16(0.25); if ((super->timer & 3) == 0) { super->child = CreateFx(super, FX_DASH, 0x40); if (super->child != NULL) { diff --git a/src/object/object6A.c b/src/object/object6A.c index 83e29ec0..6fdfce59 100644 --- a/src/object/object6A.c +++ b/src/object/object6A.c @@ -162,7 +162,7 @@ void sub_08094B0C(Object6AEntity* this) { } void sub_08094B3C(Object6AEntity* this) { - super->z.WORD += 0x8000; + super->z.WORD += Q_16_16(0.5); if (super->z.HALF.HI >= -13) super->z.HALF.HI = -13; else @@ -323,7 +323,7 @@ void sub_08094E30(Object6AEntity* this) { switch (super->action) { case 0: super->action++; - super->z.WORD = -0xA00000; + super->z.WORD = Q_16_16(-160.0); super->zVelocity = 0; SetDefaultPriority(super, PRIO_PLAYER_EVENT); InitializeAnimation(super, 0); @@ -1297,7 +1297,7 @@ void sub_0809629C(Object6AEntity* this, u32 type) { } ExecuteScriptForEntity(super, 0); HandleEntity0x82Actions(super); - GravityUpdate(super, 0x1000); + GravityUpdate(super, Q_8_8(16.0)); tmp = super->type; super->type = type; sub_08080CB4(super); diff --git a/src/object/object79.c b/src/object/object79.c index fdcf8824..19b4bd0d 100644 --- a/src/object/object79.c +++ b/src/object/object79.c @@ -108,6 +108,6 @@ void sub_08098130(Object79Entity* this) { super->direction = this->objDir.HALF.HI; super->speed = this->unk7a; LinearMoveUpdate(super); - super->y.WORD -= 0x140000; + super->y.WORD -= Q_16_16(20.0); super->y.WORD += this->unk6c; } diff --git a/src/object/object96.c b/src/object/object96.c index ab630662..114b748e 100644 --- a/src/object/object96.c +++ b/src/object/object96.c @@ -39,8 +39,8 @@ void Object96_Action2(Entity*, const struct_gUnk_08123FB0*); void Object96_Action3(Entity*, const struct_gUnk_08123FB0*); static const struct_gUnk_08123FB0 gUnk_08123FB0[] = { - { sub_0809D91C, sub_0809D93C, 0, 0, 0x30, 0x30, 0x1, 0x3c, 0x3c, 0x13, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, - 0x0 }, + { sub_0809D91C, sub_0809D93C, 0, 0, 0x30, 0x30, 0x1, 0x3c, 0x3c, 0x13, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, + 0x1, 0x0 }, { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x63, 0x63, 0x10, 0, 0x1800, 0, 0x18, #if defined(JP) || defined(DEMO_JP) || defined(EU) 0xCD, @@ -48,11 +48,11 @@ static const struct_gUnk_08123FB0 gUnk_08123FB0[] = { 0xd0, #endif 0, 0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0xf, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0x2, 0x10000, 0x1800, 0x140, 0x40, 0x4021, 0x1, 0x0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0xd, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x1a, 0x10000, 0x1800, 0x100, 0x40, 0x4021, 0x1, 0x0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x13, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0xf, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0x2, Q_16_16(1.0), 0x1800, 0x140, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0xd, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x1a, Q_16_16(1.0), 0x1800, 0x100, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x13, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, { NULL, NULL, 0, 0, 0, 0, 0x0, 0x5c, 0x5c, 0x81, 0, 0x1800, 0x100, 0x20, 0x0, 0x1, 0x0 }, }; diff --git a/src/object/objectA2.c b/src/object/objectA2.c index 68a79fe4..1eb2fe12 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -98,7 +98,7 @@ void sub_0809F448(Entity* this) { int rand = Random(); const struct_08124708* tmp2 = &gUnk_08124708[this->subtimer]; this->subtimer++; - tmp = 0x280000 - this->x.WORD; + tmp = Q_16_16(40.0) - this->x.WORD; switch (tmp2->unk_0) { case 0: tmp = rand % 0x180000; diff --git a/src/object/objectA8.c b/src/object/objectA8.c index 83f9d422..98baa343 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -67,7 +67,7 @@ void ObjectA8_Init(ObjectA8Entity* this) { super->action = 1; switch (super->type2) { case 0: - super->zVelocity = 0x1e000; + super->zVelocity = Q_16_16(1.875); super->z.HALF.HI += 8; break; case 2: @@ -88,7 +88,7 @@ void ObjectA8_Init(ObjectA8Entity* this) { } void ObjectA8_Action1(ObjectA8Entity* this) { - super->z.WORD -= 0xe000; + super->z.WORD -= Q_16_16(0.875); if (super->frame != 0) { if (super->timer != 0) { super->timer *= 0x1e; diff --git a/src/object/objectB3.c b/src/object/objectB3.c index de0313ee..49d5588c 100644 --- a/src/object/objectB3.c +++ b/src/object/objectB3.c @@ -63,7 +63,7 @@ void sub_080A0AC4(Entity* this) { } void sub_080A0AD0(Entity* this) { - GravityUpdate(this, 0x80); + GravityUpdate(this, Q_8_8(0.5)); } void sub_080A0ADC(Entity* this) { @@ -79,7 +79,7 @@ void sub_080A0AF0(Entity* this) { DeleteThisEntity(); } } - GravityUpdate(this, 0x80); + GravityUpdate(this, Q_8_8(0.5)); } void sub_080A0B28(Entity* this, ScriptExecutionContext* context) { @@ -102,5 +102,5 @@ void sub_080A0B60(Entity* this) { } void sub_080A0B80(Entity* this) { - this->y.WORD -= 0x28000; + this->y.WORD -= Q_16_16(2.5); } diff --git a/src/object/objectOnSpinyBeetle.c b/src/object/objectOnSpinyBeetle.c index fe046591..e6a96a3c 100644 --- a/src/object/objectOnSpinyBeetle.c +++ b/src/object/objectOnSpinyBeetle.c @@ -84,7 +84,7 @@ void ObjectOnSpinyBeetle_Action1(ObjectOnSpinyBeetleEntity* this) { case 0xf: case 0x1d: super->action = 4; - super->zVelocity = 0x2a000; + super->zVelocity = Q_16_16(2.625); super->spriteOffsetY = 0; super->spriteSettings.shadow = 1; super->spritePriority.b1 = 3; @@ -250,7 +250,7 @@ void ObjectOnSpinyBeetle_Action4(ObjectOnSpinyBeetleEntity* this) { if (super->zVelocity < 0) { super->spriteSettings.flipY = 1; } - if (GravityUpdate(super, 0x2000) == 0) { + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { sub_080989C0(this); } } diff --git a/src/object/pot.c b/src/object/pot.c index 18f69ed2..6f8744ca 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -252,7 +252,7 @@ void sub_08082824(Entity* this) { this->spriteSettings.flipY = 1; } - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { sub_08082850(this, NULL); } } diff --git a/src/object/specialFx.c b/src/object/specialFx.c index 9f00d303..a278428e 100644 --- a/src/object/specialFx.c +++ b/src/object/specialFx.c @@ -215,7 +215,7 @@ void sub_08084630(SpecialFxObject* this) { } void sub_08084680(SpecialFxObject* this) { - super->z.WORD += 0x4000; + super->z.WORD += Q_16_16(0.25); sub_080845DC(this); } @@ -273,12 +273,12 @@ void sub_0808471C(SpecialFxObject* this) { } void sub_08084770(SpecialFxObject* this) { - super->z.WORD -= 0x4000; + super->z.WORD -= Q_16_16(0.25); sub_080845DC(this); } void sub_08084784(SpecialFxObject* this) { - super->z.WORD += 0x4000; + super->z.WORD += Q_16_16(0.25); sub_080845DC(this); } @@ -290,7 +290,7 @@ void sub_08084798(SpecialFxObject* this) { } void sub_080847BC(SpecialFxObject* this) { - super->z.WORD -= 0x2000; + super->z.WORD -= Q_16_16(0.125); sub_080845DC(this); } diff --git a/src/player.c b/src/player.c index 18dbb005..944138c8 100644 --- a/src/player.c +++ b/src/player.c @@ -1163,7 +1163,7 @@ static void PortalShrinkUpdate(Entity* this) { uVar5 = gUnk_0811BABC[uVar5 >> 5]; } } - iVar3 = 0x10000; + iVar3 = Q_16_16(1); switch (this->frame) { case 1: @@ -2872,7 +2872,7 @@ static void sub_080737BC(Entity* this) { UpdateAnimationSingleFrame(this); LinearMoveUpdate(this); - this->z.WORD += 0x4C00; + this->z.WORD += Q_16_16(0.296875); if (DirectionIsHorizontal(this->direction)) pos = this->x.HALF.HI; else @@ -3860,7 +3860,7 @@ void sub_08074D34(Entity* this, ScriptExecutionContext* ctx) { gPlayerState.animation = 1052; else gPlayerState.animation = 2060; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); break; case 0x10: CreateSpeechBubbleExclamationMark(this, 8, -24); @@ -3977,7 +3977,7 @@ void sub_0807501C(Entity* this) { this->spritePriority.b1 = 1; this->direction = Direction8FromAnimationState(this->animationState); this->speed = 200; - this->zVelocity = 0x20000; + this->zVelocity = Q_16_16(2.0); this->timer = 8; this->field_0x68.HALF.LO++; SoundReq(SFX_PLY_JUMP); diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index 98449501..8d58c563 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -177,7 +177,7 @@ void sub_0801917C(PlayerItemBowEntity* this) { super->action = 3; super->direction ^= 0x10; super->speed = 0x100; - super->zVelocity = 0x8000; + super->zVelocity = Q_16_16(0.5); super->flags &= 0x7f; InitializeAnimation(super, 6); } else { @@ -235,7 +235,7 @@ void sub_08019410(Entity* this) { void sub_08019444(Entity* this) { GetNextFrame(this); LinearMoveUpdate(this); - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { DeleteThisEntity(); } } diff --git a/src/playerItem/playerItemHeldObject.c b/src/playerItem/playerItemHeldObject.c index 1f8ea7fc..5cc41771 100644 --- a/src/playerItem/playerItemHeldObject.c +++ b/src/playerItem/playerItemHeldObject.c @@ -86,7 +86,7 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) { ProcessMovement10(super); } } - if (GravityUpdate(super, 0x2000) == 0) { + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { (child->base).zVelocity = super->zVelocity; (child->base).x = super->x; (child->base).y = super->y; @@ -145,7 +145,7 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) { } else { SoundReq(SFX_PLACE_OBJ); super->timer++; - super->zVelocity = 0x10000; + super->zVelocity = Q_16_16(1.0); super->speed /= 2; return; } diff --git a/src/playerItem/playerItemPacciCaneProjectile.c b/src/playerItem/playerItemPacciCaneProjectile.c index 08109fbe..bdb9e215 100644 --- a/src/playerItem/playerItemPacciCaneProjectile.c +++ b/src/playerItem/playerItemPacciCaneProjectile.c @@ -140,7 +140,7 @@ void sub_0807037C(Entity* this) { void sub_08070398(Entity* this) { GetNextFrame(this); LinearMoveUpdate(this); - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { DeleteThisEntity(); } } diff --git a/src/playerUtils.c b/src/playerUtils.c index c8179c97..c8af20b5 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -1014,7 +1014,7 @@ bool32 sub_08078F74(Entity* this) { gPlayerState.jump_status = 0x81; this->action = 0x15; this->subAction = 0; - this->zVelocity = 0x20000; + this->zVelocity = Q_16_16(2.0); return TRUE; } else { return FALSE; @@ -1535,7 +1535,7 @@ void sub_0807B144(PlayerEntity* this) { super->spriteSettings.draw = 1; super->direction = super->animationState << 2; super->speed = 0xa0; - super->zVelocity = 0x40000; + super->zVelocity = Q_16_16(4.0); gPlayerState.jump_status = 0x81; SetPlayerActionNormal(); } @@ -1547,7 +1547,7 @@ void sub_0807B178(PlayerEntity* this) { super->spriteSettings.draw = 1; super->direction = 0x10; super->speed = 0; - super->zVelocity = 0x40000; + super->zVelocity = Q_16_16(4.0); gPlayerState.jump_status = 0x81; SetPlayerActionNormal(); } @@ -1567,7 +1567,7 @@ void sub_0807B1DC(PlayerEntity* this) { void sub_0807B1EC(PlayerEntity* this) { if (--super->timer == 0) { this->unk_6e++; - super->zVelocity = 0x10000; + super->zVelocity = Q_16_16(1.0); gPlayerState.animation = 0x2c2; } } @@ -1575,11 +1575,11 @@ void sub_0807B1EC(PlayerEntity* this) { void sub_0807B21C(PlayerEntity* this) { UpdateAnimationSingleFrame(super); if (super->zVelocity < 0) { - GravityUpdate(super, 0x400); + GravityUpdate(super, Q_8_8(4.0)); } else { - GravityUpdate(super, 0x800); + GravityUpdate(super, Q_8_8(8.0)); } - if (super->zVelocity < -0x8000) { + if (super->zVelocity < -Q_16_16(0.5)) { super->timer = 0x78; super->subtimer = 0; this->unk_6e++; @@ -1597,7 +1597,7 @@ void sub_0807B264(PlayerEntity* this) { super->z.WORD = this->unk_68 + tmp; if (--super->timer == 0) { super->timer = 0x50; - super->zVelocity = 0x8000; + super->zVelocity = Q_16_16(0.5); this->unk_6e++; #ifndef EU SoundReq(SFX_NEAR_PORTAL); @@ -1606,7 +1606,7 @@ void sub_0807B264(PlayerEntity* this) { } void sub_0807B2B8(PlayerEntity* this) { - GravityUpdate(super, -0x2000); + GravityUpdate(super, Q_8_8(-32.0)); UpdateAnimationSingleFrame(super); if (super->timer != 0 && --super->timer == 0) { DoExitTransition(&gUnk_0813AD88[this->unk_6d]); diff --git a/src/projectile/arrowProjectile.c b/src/projectile/arrowProjectile.c index a5284759..a90e3016 100644 --- a/src/projectile/arrowProjectile.c +++ b/src/projectile/arrowProjectile.c @@ -46,7 +46,7 @@ void ArrowProjectile_Init(Entity* this) { COLLISION_OFF(this); this->timer = 0x6a; this->subtimer = 0; - this->zVelocity = 0xa00; + this->zVelocity = Q_16_16(10.0 / 256.0); sub_080A94C0(this, this->type); } @@ -88,7 +88,7 @@ void ArrowProjectile_Action3(Entity* this) { } void ArrowProjectile_Action4(Entity* this) { - if (GravityUpdate(this, 0x2800) == 0) { + if (GravityUpdate(this, Q_8_8(40.0)) == 0) { CreateDust(this); DeleteThisEntity(); } else { @@ -104,7 +104,7 @@ void sub_080A9488(Entity* this) { this->action = 4; COLLISION_OFF(this); this->timer = 2; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); this->animationState = (this->knockbackDirection & 0x18) >> 3; EnqueueSFX(SFX_METAL_CLINK); sub_080A94C0(this, this->animationState); diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c index 88c5bc75..6d033095 100644 --- a/src/projectile/boneProjectile.c +++ b/src/projectile/boneProjectile.c @@ -52,11 +52,11 @@ void BoneProjectile_Action1(Entity* this) { void BoneProjectile_Action2(Entity* this) { GetNextFrame(this); ProcessMovement3(this); - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { this->action = 3; COLLISION_OFF(this); this->speed = 0xe0; - this->zVelocity = 0xe000; + this->zVelocity = Q_16_16(0.875); } } diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index e852e92b..7db97e98 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -64,7 +64,7 @@ void GleerokProjectile_Init(Entity* this) { this->zVelocity = (this->z.WORD / 0x18000) << 0xc; break; case 3: - this->z.WORD = 0xff600000; + this->z.WORD = Q_16_16(-160.0); uVar1 = (Random() & 3) * 2; this->x.HALF.HI = gUnk_08129978[uVar1] + this->x.HALF.HI; this->y.HALF.HI = gUnk_08129978[uVar1 + 1] + this->y.HALF.HI; @@ -83,7 +83,7 @@ void GleerokProjectile_Init(Entity* this) { void GleerokProjectile_Action1(Entity* this) { if (this->type == 3) { - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { sub_08008790(this, 7); CreateFx(this, FX_ROCK, 0); DeleteThisEntity(); diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index 0f67d14f..d338e65c 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -64,7 +64,7 @@ void OctorokBossProjectile_Init(Entity* this) { break; case 3: CopyPosition(&gPlayerEntity, this); - this->z.WORD = 0xff600000; + this->z.WORD = Q_16_16(-160.0); this->x.HALF.HI += 0x60; this->y.HALF.HI += 0x40; this->x.HALF.HI -= (s32)Random() % 0xc0; @@ -150,7 +150,7 @@ void OctorokBossProjectile_Action1(Entity* this) { OctorokBossProjectile_Action2(this); } GetNextFrame(this); - if (GravityUpdate(this, 0x1800) != 0) { + if (GravityUpdate(this, Q_8_8(24.0)) != 0) { CalculateEntityTileCollisions(this, this->direction >> 3, 0); if (this->collisions == COL_NONE) { LinearMoveAngle(this, (s32)this->speed, (u32)this->direction); @@ -185,7 +185,7 @@ void OctorokBossProjectile_Action1(Entity* this) { DeleteThisEntity(); break; case 3: - if (GravityUpdate(this, 0x1800) != 0) { + if (GravityUpdate(this, Q_8_8(24.0)) != 0) { return; } CreateFx(this, FX_ROCK, 0); diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c index dff50413..9b82fc4b 100644 --- a/src/projectile/rockProjectile.c +++ b/src/projectile/rockProjectile.c @@ -52,7 +52,7 @@ void RockProjectile_Action1(Entity* this) { void RockProjectile_Action2(Entity* this) { LinearMoveUpdate(this); GetNextFrame(this); - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { DeleteEntity(this); } } diff --git a/src/projectile/stalfosProjectile.c b/src/projectile/stalfosProjectile.c index 0d317738..736a5b75 100644 --- a/src/projectile/stalfosProjectile.c +++ b/src/projectile/stalfosProjectile.c @@ -119,7 +119,7 @@ void StalfosProjectile_Action3(Entity* this) { if (this->zVelocity < 0) { this->spriteSettings.flipY = 1; } - if (GravityUpdate(this, 0x2000) == 0) { + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { sub_080A9BA8(this); } } diff --git a/src/projectile/v2Projectile.c b/src/projectile/v2Projectile.c index 2d30f43b..072d745f 100644 --- a/src/projectile/v2Projectile.c +++ b/src/projectile/v2Projectile.c @@ -151,7 +151,7 @@ void sub_080ABE04(Entity* this) { } void sub_080ABE88(Entity* this) { - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { CreateFx(this, FX_ROCK, 0); DeleteThisEntity(); } diff --git a/src/projectile/v3ElectricProjectile.c b/src/projectile/v3ElectricProjectile.c index 697113dd..bbbec2ab 100644 --- a/src/projectile/v3ElectricProjectile.c +++ b/src/projectile/v3ElectricProjectile.c @@ -114,7 +114,7 @@ void V3ElectricProjectile_Action2(Entity* this) { void sub_080AC168(Entity* this) { u8 timer; GetNextFrame(this); - this->z.WORD += 0xffff8000; + this->z.WORD -= Q_16_16(0.5); timer = --this->timer; if (timer == 0) { u32 rand; diff --git a/src/script.c b/src/script.c index 46ffb747..92fad99a 100644 --- a/src/script.c +++ b/src/script.c @@ -386,7 +386,7 @@ void HandleEntity0x82Actions(Entity* entity) { } break; case 1 << 5: - GravityUpdate(entity, 0x2000); + GravityUpdate(entity, Q_8_8(32.0)); break; } } diff --git a/src/scroll.c b/src/scroll.c index d987b2c1..6a1e8673 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -107,7 +107,7 @@ void sub_0807FDF8(RoomControls* controls) { controls->scroll_y -= 4; pEVar2 = controls->camera_target; if (pEVar2 == &gPlayerEntity) { - pEVar2->y.WORD = gPlayerEntity.y.WORD - 0x6000; + pEVar2->y.WORD = gPlayerEntity.y.WORD - Q_16_16(0.375); } if (controls->filler2[0] == 0x28) { sub_0807FEC8(controls); @@ -116,7 +116,7 @@ void sub_0807FDF8(RoomControls* controls) { case 1: controls->scroll_x = controls->scroll_x + 4; if (controls->camera_target == &gPlayerEntity) { - gPlayerEntity.x.WORD += 0x4000; + gPlayerEntity.x.WORD += Q_16_16(0.25); } if (controls->filler2[0] == 0x3c) { sub_0807FEC8(controls); @@ -126,7 +126,7 @@ void sub_0807FDF8(RoomControls* controls) { controls->scroll_y = controls->scroll_y + 4; pEVar2 = controls->camera_target; if (pEVar2 == &gPlayerEntity) { - pEVar2->y.WORD = gPlayerEntity.y.WORD + 0x6000; + pEVar2->y.WORD = gPlayerEntity.y.WORD + Q_16_16(0.375); } if (controls->filler2[0] == 0x28) { sub_0807FEC8(controls); @@ -135,7 +135,7 @@ void sub_0807FDF8(RoomControls* controls) { case 3: controls->scroll_x -= 4; if (controls->camera_target == &gPlayerEntity) { - gPlayerEntity.x.WORD -= 0x4000; + gPlayerEntity.x.WORD -= Q_16_16(0.25); } if (controls->filler2[0] == 0x3c) { sub_0807FEC8(controls);