diff options
Diffstat (limited to 'src/enemy')
39 files changed, 132 insertions, 114 deletions
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 426b3baf..ae071c63 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -104,7 +104,7 @@ void sub_080318DC(Entity* this) { void sub_08031A60(Entity* this) { if (this->iframes > 0) - GravityUpdate(this, 0x1800); + GravityUpdate(this, Q_8_8(24.0)); sub_08001324(this); } @@ -315,7 +315,7 @@ void sub_08031E90(Entity* this) { void sub_08031EA8(Entity* this) { this->action = 1; this->spritePriority.b1 = 1; - this->zVelocity = 0x40000; + this->zVelocity = Q_16_16(4.0); this->z.HALF.HI = (4 - this->type2) * 0xe; this->field_0x78.HALF.HI = Random(); InitializeAnimation(this, 4); @@ -325,7 +325,7 @@ void sub_08031EE8(Entity* this) { int draw; this->z.WORD -= this->zVelocity; - this->zVelocity -= 0x1800; + this->zVelocity -= Q_16_16(3.0 / 32.0); if (this->z.HALF.HI < 1) { draw = this->spriteSettings.draw; @@ -442,7 +442,7 @@ void sub_08032160(Entity* this) { this->spriteSettings.flipX = 0; } this->speed = 0xf0; - this->zVelocity = 0x12000; + this->zVelocity = Q_16_16(1.125); this->spritePriority.b1 = 1; InitializeAnimation(this, 12); } @@ -477,7 +477,7 @@ void sub_08032204(Entity* this) { } void sub_08032248(Entity* this) { - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { if (this->frame & 0x80) { ((Entity*)this->field_0x7c.WORD)->actionDelay--; diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index c03ff919..e01f69d1 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -109,7 +109,7 @@ void sub_080218CC(Entity* this) { this->spriteSettings.draw = 1; this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; this->speed = 0x100; - this->zVelocity = 0x12000; + this->zVelocity = Q_16_16(1.125); } GetNextFrame(this); @@ -242,7 +242,7 @@ void sub_08021B64(Entity* this) { if (iVar4 == 0) { this->action = 6; - this->zVelocity = 0x10000; + this->zVelocity = Q_16_16(1.0); ((u8*)&this->field_0x86)[1] = 0; if (gPlayerEntity.direction != 0xff) { this->direction = 0x10 ^ gPlayerEntity.direction; @@ -303,7 +303,7 @@ u32 sub_08021D00(Entity* this) { } else { this->action = 4; this->actionDelay = 1; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); InitializeAnimation(this, 4); ret = 1; } diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index ebc47375..ef6c9dcf 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -61,7 +61,7 @@ void sub_0802C688(Entity* this) { this->action = 3; this->hitType = 0x6e; this->field_0xf = 1; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); this->speed = 0; this->field_0x80.HALF.HI = 1; InitializeAnimation(this, this->direction >> 4 | 6); @@ -79,7 +79,7 @@ void sub_0802C7AC(Entity* this) { if (this->field_0x82.HALF.LO != 2) { this->speed = this->field_0x82.HALF.LO ? 0x200 : 0x80; } - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); this->field_0x82.HALF.HI = 0; this->field_0x80.HALF.HI = 0; } else { @@ -232,7 +232,7 @@ void sub_0802CA94(Entity* this) { COLLISION_OFF(this); this->field_0xf = 1; this->spritePriority.b1 = 1; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); this->speed = 0; this->field_0x82.HALF.HI = 0; this->field_0x80.HALF.HI = 0; diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 3a7a0064..bc6367ee 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -381,7 +381,7 @@ void sub_0802ADDC(Entity* this) { void sub_0802AE24(Entity* this) { this->action = 1; this->actionDelay = 0xf0; - this->zVelocity = 0x8000; + this->zVelocity = Q_16_16(0.5); this->hitbox = (Hitbox*)&gUnk_080CD174; this->field_0x3c = 3; this->field_0x16 = 0; diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index 9d8d4ff3..c8e7640e 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -722,7 +722,7 @@ u32 sub_0801FBD0(Entity* this) { void Chuchu_JumpAtPlayer(Entity* this) { this->speed = 0x180; - this->zVelocity = 0x20000; + this->zVelocity = Q_16_16(2.0); this->direction = sub_08049F84(this, 1); InitializeAnimation(this, 3); } diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index 2b6bb47f..94326739 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -52,7 +52,7 @@ void sub_08022988(Entity* this) { return; this->frameIndex = 1; - this->zVelocity = 0x10000; + this->zVelocity = Q_16_16(1.0); EnqueueSFX(0xd6); } @@ -78,7 +78,7 @@ void sub_080229F8(Entity* this) { this->speed = 0xc0; sub_08022B44(this); } else { - this->zVelocity = 0x10000; + this->zVelocity = Q_16_16(1.0); EnqueueSFX(0xd6); } } @@ -141,7 +141,7 @@ u32 sub_08022B20(Entity* this) { } void sub_08022B44(Entity* this) { - this->zVelocity = 0xc000; + this->zVelocity = Q_16_16(0.75); this->direction = GetFacingDirection(this, &gPlayerEntity); if (this->direction & 0xf) diff --git a/src/enemy/enemy66.c b/src/enemy/enemy66.c new file mode 100644 index 00000000..6975e5e8 --- /dev/null +++ b/src/enemy/enemy66.c @@ -0,0 +1,16 @@ +#include "entity.h" + +void (*const gUnk_080D2ABC[])(Entity*); +extern void sub_08029270(Entity* this); + +void Enemy66(Entity* this) { + if (gUnk_080D2ABC[this->field_0xf]) { + gUnk_080D2ABC[this->field_0xf](this); + } else { + DeleteThisEntity(); + } +} + +void (*const gUnk_080D2ABC[103])(Entity*) = { + [22] = sub_08029270, +}; diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index d414ce52..a9dfc7d6 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -37,7 +37,7 @@ void sub_0802C254(Entity* this) { void sub_0802C258(Entity* this) { sub_0804A720(this); - this->zVelocity = 0x20000; + this->zVelocity = Q_16_16(2.0); this->actionDelay = 2; this->field_0x7a.HWORD = Random() & 0x70; switch (this->type) { @@ -195,7 +195,7 @@ void sub_0802C4B0(Entity* this) { } rand = Random() & 7; - this->zVelocity = 0x20000; + this->zVelocity = Q_16_16(2.0); if (rand & 4) { if (rand & 3) { *(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 1]; diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index 5e81c1d6..a0546fb8 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -102,7 +102,7 @@ u32 sub_0804A024(Entity*, u32, u32); void sub_08045524(Entity* this) { u32 tmp, tmp1, tmp2; - this->zVelocity = 0x1c000; + this->zVelocity = Q_16_16(1.75); tmp = sub_0804A024(this, 1, 8); if (tmp != 0xff && (Random() & 3) == 0) { this->actionDelay = Random() & 3; diff --git a/src/enemy/flyingSkull.c b/src/enemy/flyingSkull.c index 3bfe18f5..28e2e06e 100644 --- a/src/enemy/flyingSkull.c +++ b/src/enemy/flyingSkull.c @@ -46,7 +46,7 @@ void sub_08039BF8(FlyingSkullEntity* this) { if (super->bitfield == 0x9d) { super->action = 7; COLLISION_OFF(super); - super->zVelocity = 0x2A000; + super->zVelocity = Q_16_16(2.625); super->spritePriority.b1 = 1; SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer); } else if (super->z.HALF.HI) { diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index 8066e3fc..cfad4857 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -605,7 +605,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D86C.inc", void sub_0802D86C(GleerokE super->parent->subAction = 4; super->parent->type2 = 0; ((GleerokEntity*)super->parent)->unk_7b = 0; - SoundReq(SFX_10C); + SoundReq(SFX_BUTTON_PRESS); } } else { if (super->actionDelay != this->unk_84->filler[1]) { diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index d846433b..368d68c6 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -1033,7 +1033,7 @@ void sub_08047DF0(GyorgMaleEntity* this, u32 unk1) { sub_08047EA4(this, unk1); oldX = super->x.HALF.HI; oldY = super->y.HALF.HI; - sub_0806F62C(super, super->speed, super->direction); + LinearMoveAngle(super, super->speed, super->direction); if (this->unk_7c & 1) { if (sub_08079F8C()) { gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX; @@ -1051,7 +1051,7 @@ void sub_08047E58(GyorgMaleEntity* this) { u32 oldX, oldY; oldX = super->x.HALF.HI; oldY = super->y.HALF.HI; - sub_0806F62C(super, super->speed, super->direction); + LinearMoveAngle(super, super->speed, super->direction); if (this->unk_7c & 1) { if (sub_08079F8C()) { gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX; diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 3187c340..be7f9dad 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -95,7 +95,7 @@ void sub_0802BCA8(Entity* this) { this->action = 7; this->actionDelay = 0x5a; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); this->hitType = 0x19; this->field_0x3a = this->field_0x3a & 0xfb; this->field_0x1c = 0x12; @@ -222,7 +222,7 @@ void sub_0802BEBC(Entity* this) { this->direction ^= 0x10; sub_080AEFE0(this); this->direction ^= 0x10; - if (!sub_080044EC(this, 0x2000)) { + if (!sub_080044EC(this, Q_16_16(0.125))) { sub_0802C1C0(this); } } @@ -234,7 +234,7 @@ void sub_0802BEEC(Entity* this) { this->direction = this->animationState << 3; InitializeAnimation(this, this->animationState + 4); } - } else if (!GravityUpdate(this, 0x1c00)) { + } else if (!GravityUpdate(this, Q_16_16(0.109375))) { this->action = 8; this->actionDelay = 30; this->speed = 0x120; @@ -356,7 +356,7 @@ void sub_0802C18C(Entity* this) { if ((this->field_0x78.HALF.LO & 7) == 0) { Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40); if (ent) { - PositionRelative(this, ent, 0, 0x10000); + PositionRelative(this, ent, 0, Q_16_16(1.0)); } } } @@ -374,8 +374,8 @@ void sub_0802C1CC(Entity* this) { void sub_0802C218(Entity* this) { this->action = 6; - this->speed = 0xe0; - this->zVelocity = 0x18000; + this->speed = Q_8_8(0.875); + this->zVelocity = Q_16_16(1.5); } // clang-format off diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index 3e1a0679..78349fbb 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -229,7 +229,7 @@ void sub_08032794(Entity* this) { target = CreateFx(this, FX_DASH, 0x40); if (target != NULL) { temp = &gUnk_080CE810[this->animationState * 2]; - PositionRelative(this, target, temp[0] << 0x10, temp[1] << 0x10); + PositionRelative(this, target, Q_16_16(temp[0]), Q_16_16(temp[1])); } } diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index 1c6015c4..be2c827a 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -59,7 +59,7 @@ void Lakitu_DoAction(Entity* this) { void sub_0803C784(Entity* this) { if ((this->bitfield & 0x7f) == 0x1d) { - this->zVelocity = 0x20000; + this->zVelocity = Q_16_16(2.0); sub_0803CBAC(this); } else { @@ -316,7 +316,7 @@ void Lakitu_SpawnLightning(Entity* this) { lightning->direction = this->field_0x78.HALF.LO; - PositionRelative(this, lightning, offset->x << 16, offset->y << 16); + PositionRelative(this, lightning, Q_16_16(offset->x), Q_16_16(offset->y)); EnqueueSFX(0x193); } @@ -346,6 +346,8 @@ void sub_0803CC08(Entity* this) { Entity* cloud; Entity* fx; + const s32 diff = Q_8_8(3.0 / 128.0); + cloud = this->child; if (cloud == NULL) { return; @@ -365,26 +367,26 @@ void sub_0803CC08(Entity* this) { fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { - fx->x.HALF.HI += 6; - fx->y.HALF.HI += 6; + fx->x.HALF.HI += diff; + fx->y.HALF.HI += diff; } fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { - fx->x.HALF.HI -= 6; - fx->y.HALF.HI += 6; + fx->x.HALF.HI -= diff; + fx->y.HALF.HI += diff; } fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { - fx->x.HALF.HI += 6; - fx->y.HALF.HI -= 6; + fx->x.HALF.HI += diff; + fx->y.HALF.HI -= diff; } fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { - fx->x.HALF.HI -= 6; - fx->y.HALF.HI -= 6; + fx->x.HALF.HI -= diff; + fx->y.HALF.HI -= diff; } this->child = NULL; diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index ca5f59e0..d65a4c8a 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -193,7 +193,7 @@ void sub_0802805C(Entity* this) { } else { ResetPlayer(); gPlayerState.mobility |= 0x80; - PositionRelative(this, &gPlayerEntity, 0, 0x10000); + PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0)); tmp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex); gPlayerEntity.spriteOffsetX = tmp[0]; @@ -215,7 +215,7 @@ NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity* gPlayerState.field_0xa = 0; gPlayerState.flags &= 0xffffffef; gPlayerEntity.flags |= 0x80; - gPlayerEntity.zVelocity = 0x18000; + gPlayerEntity.zVelocity = Q_16_16(1.5); gPlayerEntity.iframes = -60; gPlayerEntity.direction = gPlayerEntity.animationState << 2; gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI; diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 56ab79b4..763a529e 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -189,7 +189,7 @@ void sub_0803A274(Entity* this) { pEVar1 = CreateObject(OBJECT_7E, 1, 0); pEVar1->parent = this; pEVar1->child = this->child; - PositionRelative(this->parent, this, 0x100000, 0x200000); + PositionRelative(this->parent, this, Q_16_16(16.0), Q_16_16(32.0)); } else { pEVar1 = CreateEnemy(MAZAAL_HAND, 1); pEVar1->parent = this; @@ -201,7 +201,7 @@ void sub_0803A274(Entity* this) { pEVar1->parent = this; pEVar1->child = this->child; this->spriteSettings.flipX = 1; - PositionRelative(this->parent, this, -0x100000, 0x200000); + PositionRelative(this->parent, this, Q_16_16(-16.0), Q_16_16(32.0)); } if (gRoomTransition.field_0x38 != 0) { this->action = 3; @@ -917,7 +917,7 @@ void sub_0803B100(Entity* this) { Entity* temp; this->action = 0x29; - this->zVelocity = 0x14000; + this->zVelocity = Q_16_16(1.25); if (this->type == 0) { this->hitbox = &gUnk_080FD364; } else { @@ -974,7 +974,7 @@ void sub_0803B1B8(Entity* this) { if (temp != (Entity*)0x0) { temp->actionDelay = 0; temp->direction = 0x90; - PositionRelative(this, temp, this->hitbox->offset_x << 0x10, this->hitbox->offset_y << 0x10); + PositionRelative(this, temp, Q_16_16(this->hitbox->offset_x), Q_16_16(this->hitbox->offset_y)); } temp = *(Entity**)&this->field_0x74; temp->field_0x74.HALF.LO = 0x40; @@ -1086,7 +1086,7 @@ void sub_0803B480(Entity* this) { Entity* target; if (((this->field_0x7c.HALF.HI & 0x1f) == 0) && (target = CreateObject(SMOKE, 1, 0), target != (Entity*)0x0)) { - PositionRelative(this, target, gUnk_080CFD08[this->type] << 0x10, 0); + PositionRelative(this, target, Q_16_16(gUnk_080CFD08[this->type]), 0); } if (--this->field_0x7c.HALF.HI == 0) { sub_0803B6A4(this); @@ -1115,8 +1115,8 @@ u32 sub_0803B4E4(Entity* this) { } void sub_0803B538(Entity* this) { - PositionRelative(this, this->child, 0, -0x10000); - PositionRelative(this, *(Entity**)&this->field_0x74, 0, -0x20000); + PositionRelative(this, this->child, 0, Q_16_16(-1.0)); + PositionRelative(this, *(Entity**)&this->field_0x74, 0, Q_16_16(-2.0)); } void sub_0803B55C(Entity* this) { @@ -1231,7 +1231,7 @@ void sub_0803B798(void) { gPlayerState.field_0xa = 0; gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED); gPlayerEntity.flags |= 0x80; - gPlayerEntity.zVelocity = 0x18000; + gPlayerEntity.zVelocity = Q_16_16(1.5); gPlayerEntity.z.HALF.HI = -10; gPlayerEntity.direction = 0x10; gPlayerEntity.animationState = 4; diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index af37d745..fa44a8d4 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -741,7 +741,7 @@ void sub_08034A84(Entity* this) { } void sub_08034AC4(Entity* this) { - PositionRelative(this->parent, this, 0, 0x10000); + PositionRelative(this->parent, this, 0, Q_16_16(1.0)); gUnk_080CED74[this->action](this); } @@ -782,7 +782,7 @@ void sub_08034B38(Entity* this) { target->direction = this->actionDelay + 0x58; } ptr = &gUnk_080CED84[target->type * 2]; - PositionRelative(this, target, *(ptr++) << 0x10, *ptr << 0x10); + PositionRelative(this, target, Q_16_16(*(ptr++)), Q_16_16(*ptr)); } } } diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c index b9a64caf..fd6f54e2 100644 --- a/src/enemy/miniFireballGuy.c +++ b/src/enemy/miniFireballGuy.c @@ -57,7 +57,7 @@ void sub_08045654(Entity* this) { void sub_08045678(Entity* this) { - this->zVelocity = 0x1c000; + this->zVelocity = Q_16_16(1.75); if (this->actionDelay != 0) { this->actionDelay--; } else { diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index cb055f0b..80d1a055 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -87,7 +87,7 @@ void sub_080230E4(Entity* this) { CopyPosition(this, &gPlayerEntity); gPlayerEntity.flags = gPlayerEntity.flags | 0x80; gPlayerEntity.spriteSettings.draw = 1; - gPlayerEntity.zVelocity = 0x18000; + gPlayerEntity.zVelocity = Q_16_16(1.5); gPlayerEntity.direction = 0xff; gPlayerEntity.iframes = -0x14; gPlayerState.jump_status = 0x41; @@ -270,7 +270,7 @@ void sub_0802351C(Entity* this) { if (this->type2 == 0) { gPlayerEntity.animationState = this->animationState & 7; gPlayerState.flags |= PL_MOLDWORM_CAPTURED; - PositionRelative(this, &gPlayerEntity, 0, gUnk_080CBC90[this->animationState & 7] << 0x10); + PositionRelative(this, &gPlayerEntity, 0, Q_16_16(gUnk_080CBC90[this->animationState & 7])); gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[this->animationState & 7]; } } else { diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index c0aa2b65..f603afd8 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -617,7 +617,7 @@ void OctorokBoss_Action1(Entity* this) { this->field_0x74.HWORD += 4; } } - ResolveEntityBelow(this->parent, this); + SortEntityBelow(this->parent, this); if (((GET_HELPER(this)->field_0x2 != 0) || (this->parent->action == INTRO)) || (1 < (u8)(this->parent->subAction - 3))) { if ((s8)this->field_0xf < 0) { @@ -649,9 +649,9 @@ void OctorokBoss_Action1(Entity* this) { if ((GET_HELPER(this)->tailCount - 2) < this->type2) { DeleteThisEntity(); } - ResolveEntityOnTop(this->parent, this); + SortEntityAbove(this->parent, this); if (GET_HELPER(this)->tailCount - 2 == this->type2) { - ResolveEntityOnTop(this->parent, this); + SortEntityAbove(this->parent, this); radius = 0x10000 / this->parent->field_0x74.HWORD; radius = radius << 0xd >> 0x8; angle = -this->parent->field_0x7a.HALF.HI; @@ -693,7 +693,7 @@ void OctorokBoss_Action1(Entity* this) { if (this->health == 1) { this->health = 0; } else { - ResolveEntityBelow(this->parent, this); + SortEntityBelow(this->parent, this); if ((this->parent->subAction != 4) && (this->health != 1)) { if (GET_TIMER(this) > 0x1c) { GET_TIMER(this)--; @@ -939,7 +939,7 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) { if (sub_0806FC80(this, &gPlayerEntity, 0xf0) != 0) { if ((gPlayerState.flags & PL_FROZEN) == 0) { if ((gPlayerEntity.flags & PL_MINISH) != 0) { - sub_0806F62C(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this)); + LinearMoveAngle(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this)); if (sub_0806FC80(this, &gPlayerEntity, 0x48) != 0) { this->field_0x80.HALF.LO = 1; GET_TIMER(this) = 2; diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 2f08e47a..6389b179 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -265,7 +265,7 @@ void Peahat_RepairPropeller(Entity* this) { return; this->action = 9; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); this->direction = Random() & 0x1f; sub_0804AA1C(this); this->animationState = PeahatAnimation_RepairPropeller; @@ -291,7 +291,7 @@ void Peahat_Hop(Entity* this) { if (--this->actionDelay == 0) { if (this->frame & 0x80) { this->action = 9; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); this->animationState = PeahatAnimation_NewPropeller; InitializeAnimation(this, this->animationState); } else { diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 34e316cc..b52a69fc 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -811,7 +811,7 @@ void sub_08024E4C(Entity* this) { gPlayerState.field_0x38 = 0x14; gPlayerState.field_0x39 = 1; *(u8*)&gPlayerState.field_0x3a = 0; - PositionRelative(this, player, 0, 0x10000); + PositionRelative(this, player, 0, Q_16_16(1.0)); player->spriteOffsetY = 0x1a; player->animationState = 4; player->spritePriority.b1 = 0; diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 6e35dbfc..e4763610 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -198,7 +198,7 @@ void sub_080252E0(Entity* this) { this->action = 3; this->actionDelay = 0x1e; this->field_0xf = 0; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); InitializeAnimation(this, 1); } } @@ -210,8 +210,8 @@ void sub_0802538C(Entity* this) { if (this->frame == 0) { GetNextFrame(this); } else { - GravityUpdate(this, 0x2000); - if (this->zVelocity < 0x2000) { + GravityUpdate(this, Q_16_16(0.125)); + if (this->zVelocity < Q_16_16(0.125)) { this->action = 4; InitializeAnimation(this, 2); } @@ -240,7 +240,7 @@ void sub_0802541C(Entity* this) { if (this->frame & 0x80) { this->action = 3; this->field_0xf = 1; - this->zVelocity = 0x20000; + this->zVelocity = Q_16_16(2); InitializeAnimation(this, 1); } } @@ -257,7 +257,7 @@ void sub_0802544C(Entity* this) { } void sub_0802547C(Entity* this) { - GravityUpdate(this, 0x2000); + GravityUpdate(this, Q_16_16(0.125)); GetNextFrame(this); if ((this->actionDelay & 7) == 0) { sub_08025BD4(this); @@ -269,7 +269,7 @@ void sub_0802547C(Entity* this) { } void sub_080254B4(Entity* this) { - GravityUpdate(this, 0x2000); + GravityUpdate(this, Q_16_16(0.125)); if (this->frame & 0x80) { if (this->z.HALF.HI == 0) { if (this->cutsceneBeh.HWORD == 0) { @@ -553,7 +553,7 @@ void sub_08025B18(Entity* this) { ent = CreateObject(OBJECT_21, 2, 0); if (ent) { - PositionRelative(this, ent, offset[0] * 0x10000, offset[1] * 0x10000); + PositionRelative(this, ent, Q_16_16(offset[0]), Q_16_16(offset[1])); ent->x.HALF.HI &= -0x10; ent->x.HALF.HI += 8; ent->y.HALF.HI &= -0x10; @@ -567,8 +567,8 @@ void sub_08025BD4(Entity* this) { if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) { Entity* ent = CreateObject(OBJECT_21, 0, 0); if (ent) { - PositionRelative(this, ent, gUnk_080CC0BA[this->animationState * 2 + 0] * 0x10000, - gUnk_080CC0BA[this->animationState * 2 + 1] * 0x10000); + PositionRelative(this, ent, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]), + Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 1])); ent->z.HALF.HI = -10; } } diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index 9a86c115..c80786d3 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -37,7 +37,7 @@ void Rollobite_OnTick(Entity* this) { void sub_08020668(Entity* this) { if (this->hitType == 34 && this->health != 0xff) { this->action = 4; - this->zVelocity = 0x20000; + this->zVelocity = Q_16_16(2.0); this->direction = 0xff; this->health = 0xff; this->hitType = 35; @@ -107,7 +107,7 @@ void sub_080207A8(Entity* this) { this->spritePriority.b0 = 4; this->field_0x3a &= 0xfb; this->direction ^= 0x10; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); this->speed = 0x80; InitializeAnimation(this, this->animationState + 0x10); } @@ -267,7 +267,7 @@ bool32 Rollobite_TryToHoleUp(Entity* this) { this->x.HALF.HI += 8; this->y.HALF.HI &= 0xfff0; this->y.HALF.HI += 13; - this->zVelocity = 0x20000; + this->zVelocity = Q_16_16(2.0); InitializeAnimation(this, this->animationState + 0x14); SetTile(0x4034, tile, this->collisionLayer); return TRUE; diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index d2393187..bb8e176f 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -171,7 +171,7 @@ void sub_0802953C(Entity* this) { } else { ResetPlayer(); gPlayerState.mobility |= 0x80; - PositionRelative(this, &gPlayerEntity, 0, 0x10000); + PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0)); pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex); gPlayerEntity.spriteOffsetX = pbVar3[0]; gPlayerEntity.spriteOffsetY = pbVar3[1] - 1; @@ -240,7 +240,7 @@ void sub_080296D8(Entity* this) { gPlayerState.jump_status = 0x41; gPlayerState.flags &= ~PL_CAPTURED; gPlayerEntity.flags |= 0x80; - gPlayerEntity.zVelocity = 0x18000; + gPlayerEntity.zVelocity = Q_16_16(1.5); gPlayerEntity.iframes = 0xa6; gPlayerEntity.z.HALF.HI = -2; gPlayerEntity.direction = gPlayerEntity.animationState << 2; diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index 308d914f..720b3a50 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -124,7 +124,7 @@ void sub_08023CE0(Entity* this) { EnqueueSFX(0x12d); InitializeAnimation(this, 4); } - } else if (!GravityUpdate(this, 0x1800)) { + } else if (!GravityUpdate(this, Q_8_8(24))) { this->action = 3; this->spriteSettings.draw = 1; EnqueueSFX(0x84); @@ -169,7 +169,7 @@ void sub_08023E54(Entity* this) { ent = CreateEnemy(SLUGGULA, 2); if (ent) { const s8* ptr = &gUnk_080CBDF7[this->animationState * 2]; - PositionRelative(this, ent, ptr[0] << 0x10, ptr[1] << 0x10); + PositionRelative(this, ent, Q_16_16(ptr[0]), Q_16_16(ptr[1])); } } } diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index a6fa4ae6..f4f6792e 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -54,7 +54,7 @@ void sub_0802B628(Entity* this) { case 0x1d: if (this->action < 6) { this->action = 6; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); this->speed = 0xc0; this->direction = this->knockbackDirection; this->knockbackDuration = 0; @@ -171,7 +171,7 @@ void sub_0802B8E0(Entity* this) { } } else { this->action = 8; - this->zVelocity = 0x10000; + this->zVelocity = Q_16_16(1.0); this->speed = 0x60; this->hitType = 99; InitializeAnimation(this, this->animationState); diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index a51c8ac4..c6db356b 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -93,7 +93,7 @@ void sub_080225A0(Entity* this) { } void sub_080225BC(Entity* this) { - GravityUpdate(this, 0x1800); + GravityUpdate(this, Q_8_8(24.0)); if (this->frame & 1) { sub_0804A7D4(this); } else { @@ -132,7 +132,7 @@ void sub_08022654(Entity* this) { InitializeAnimation(this, 0); /* fallthrough */ case 1: - if (GravityUpdate(this, 0x1800)) + if (GravityUpdate(this, Q_8_8(24.0))) return; this->subAction = 2; @@ -163,7 +163,7 @@ void sub_080226EC(Entity* this) { if (sub_080228F0(this)) { this->action = 6; - this->zVelocity = 0x12000; + this->zVelocity = Q_16_16(1.125); this->speed = 0x140; this->direction = GetFacingDirection(this, gUnk_020000B0); this->hitType = 0x5a; @@ -211,7 +211,7 @@ void sub_080227AC(Entity* this) { } void sub_0802281C(Entity* this) { - GravityUpdate(this, 0x1800); + GravityUpdate(this, Q_8_8(24.0)); GetNextFrame(this); if (this->frame & 0x80) { this->action = 2; @@ -225,7 +225,7 @@ void sub_08022854(Entity* this) { GetNextFrame(this); if (this->frame & 1) { sub_080AEFE0(this); - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { this->action = 7; this->hitType = 0x5c; InitializeAnimation(this, 5); diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index 4c63076d..3841377e 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -89,7 +89,7 @@ void sub_08037Fe0(Entity* this) { this->action = 2; this->actionDelay = 6; this->field_0xf = 0; - this->zVelocity = 0x38000; + this->zVelocity = Q_16_16(3.5); sub_08038168(this); InitializeAnimation(this, 2); } @@ -145,7 +145,7 @@ void sub_08038110(Entity* this) { if (this->field_0x80.HALF.LO < 5) { this->action = 2; this->actionDelay = 8; - this->zVelocity = 0x38000; + this->zVelocity = Q_16_16(3.5); sub_08038168(this); InitializeAnimation(this, 2); } else { diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index fc3e8e21..42b24b13 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -951,7 +951,7 @@ void sub_08043490(Entity* this) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; if (entity->z.HALF.HI < -4) { - entity->zVelocity = 0x18000; + entity->zVelocity = Q_16_16(1.5); this->subAction = 2; this->field_0x7c.BYTES.byte2 = 0; ((VaatiArm_HeapStruct*)this->myHeap)->parent->subAction = 2; @@ -976,7 +976,7 @@ void sub_08043520(Entity* this) { Entity* entity; entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; - GravityUpdate(entity, 0x1a00); + GravityUpdate(entity, Q_8_8(26.0)); if ((entity->zVelocity < 0) && (-6 < entity->z.HALF.HI)) { entity->z.HALF.HI = -6; this->subAction = 3; diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 14970d34..82dd8948 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -71,7 +71,7 @@ void sub_0804468C(Entity* this) { this->field_0x82.HALF.HI = 0; this->spriteSettings.draw = 0; off = &gUnk_080D1620[this->field_0x78.HALF.HI & 3]; - PositionRelative(this->parent, this, off->h << 0x10, (off->v - 0x10) * 0x10000); + PositionRelative(this->parent, this, Q_16_16(off->h), Q_16_16(off->v - 0x10)); this->z.HALF.HI = this->parent->z.HALF.HI; InitAnimationForceUpdate(this, 0); break; @@ -397,7 +397,7 @@ void sub_08044B04(Entity* this) { this->field_0x74.HALF.LO = 1; this->actionDelay = 80; COLLISION_OFF(this); - PositionRelative(vaati, this, 0, -0x100000); + PositionRelative(vaati, this, 0, Q_16_16(-16.0)); if (this->field_0xf) this->spriteSettings.draw = 0; break; @@ -463,7 +463,7 @@ void sub_08044DEC(Entity* this) { this->speed = 0x300; off = this->parent->field_0x80.HALF.LO - 1; this->direction = gUnk_080D1628[off][this->field_0x78.HALF.HI]; - PositionRelative(this->parent, this, 0, -0x100000); + PositionRelative(this->parent, this, 0, Q_16_16(-16.0)); } void sub_08044E74(Entity* this, u32 state) { @@ -475,7 +475,7 @@ void sub_08044E74(Entity* this, u32 state) { this->action = 2; this->direction += 0x18; this->direction &= 0x1f; - PositionRelative(this->parent, this, 0, -0x100000); + PositionRelative(this->parent, this, 0, Q_16_16(-16.0)); this->speed = 12288; LinearMoveUpdate(this); this->direction += 0x8; @@ -509,5 +509,5 @@ void sub_08044E74(Entity* this, u32 state) { } this->actionDelay = 1; this->field_0x78.HALF.LO = 0; - this->speed = 1280; + this->speed = Q_8_8(5); } diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index c9d1fbbf..39e68307 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -121,7 +121,7 @@ void VaatiProjectileFunction0Action0(Entity* this) { this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY; this->spriteRendering.b3 = this->parent->spriteRendering.b3; this->spritePriority.b1 = 0; - PositionRelative(this->parent, this, 0, -0x10000); + PositionRelative(this->parent, this, 0, Q_16_16(-1.0)); InitializeAnimation(this, 1); } } @@ -207,7 +207,7 @@ void VaatiProjectileFunction0Action8(Entity* this) { if (this->parent->next == NULL) { DeleteThisEntity(); } - PositionRelative(this->parent, this, 0, -0x10000); + PositionRelative(this->parent, this, 0, Q_16_16(-1.0)); GetNextFrame(this); } diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index 612e3af4..99f1777b 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -135,7 +135,7 @@ void VaatiRebornEnemyType0Action0(Entity* this) { entity->parent = this; entity->spriteSettings.flipX = i; ptr = &gUnk_080D04A8[i]; - PositionRelative(this, entity, ptr->x << 0x10, ptr->y << 0x10); + PositionRelative(this, entity, Q_16_16(ptr->x), Q_16_16(ptr->y)); } InitAnimationForceUpdate(this, 0); } @@ -292,7 +292,7 @@ void VaatiRebornEnemyType0Action3(Entity* this) { break; case 0xff: if (this->z.HALF.HI != -4) { - this->z.WORD -= 0x2000; + this->z.WORD -= Q_16_16(0.125); } if (this->actionDelay == 2) { this->field_0x74.HALF.LO = 0xfe; @@ -442,7 +442,7 @@ void VaatiRebornEnemyType0Action6(Entity* this) { SoundReq(SFX_150); target = CreateProjectileWithParent(this, 0x18, 0); if (target != NULL) { - PositionRelative(this, target, 0, -0x100000); + PositionRelative(this, target, 0, Q_16_16(-16.0)); target->parent = this; } } else if (this->actionDelay == 0x40) { @@ -500,7 +500,7 @@ void VaatiRebornEnemyType1Action0(Entity* this) { this->field_0x74.HALF.HI = 1; this->actionDelay = 0; this->spriteOffsetY = -1; - PositionRelative(this->parent, this, 0, 0x10000); + PositionRelative(this->parent, this, 0, Q_16_16(1.0)); enemy = CreateEnemy(VAATI_REBORN_ENEMY, 2); enemy->parent = this; enemy->child = this->parent; @@ -546,7 +546,7 @@ void VaatiRebornEnemyType1Action1(Entity* this) { } this->spriteSettings.draw = parent->spriteSettings.draw; this->spriteOffsetX = parent->spriteOffsetX; - PositionRelative(this->parent, this, 0, 0x10000); + PositionRelative(this->parent, this, 0, Q_16_16(1.0)); UpdateAnimationSingleFrame(this); } @@ -559,7 +559,7 @@ void VaatiRebornEnemyType2Action0(Entity* this) { this->field_0x74.HALF.HI = 0; this->spriteOffsetY = -2; this->direction = 0xff; - PositionRelative(source, this, 0, 0x20000); + PositionRelative(source, this, 0, Q_16_16(2.0)); InitAnimationForceUpdate(this, 2); } @@ -595,7 +595,7 @@ void VaatiRebornEnemyType2Action1(Entity* this) { } this->spriteSettings.draw = parent->spriteSettings.draw; this->spriteOffsetX = parent->spriteOffsetX; - PositionRelative(parent->parent, this, 0, 0x20000); + PositionRelative(parent->parent, this, 0, Q_16_16(2.0)); UpdateAnimationSingleFrame(this); } @@ -637,7 +637,7 @@ void sub_0803DC0C(Entity* this) { tmp = &gUnk_080D04C8[this->actionDelay]; this->spriteSettings.draw = parent->spriteSettings.draw; this->spriteOffsetX = parent->spriteOffsetX; - PositionRelative(parent, this, tmp->x << 0x10, (tmp->y + 1) * 0x10000); + PositionRelative(parent, this, Q_16_16(tmp->x), Q_16_16(tmp->y + 1)); UpdateAnimationSingleFrame(this); } diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 2dd541ac..bf2ef39c 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -314,7 +314,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { if (this->actionDelay != 0) { if (--this->actionDelay == 0) { COLLISION_OFF(this); - this->zVelocity = 0x38000; + this->zVelocity = Q_16_16(3.5); this->field_0xf = 0x10; } break; @@ -380,12 +380,12 @@ void VaatiTransfiguredType0Action4(Entity* this) { this->field_0x74.HALF.LO = 0; this->actionDelay = 0x80; this->field_0xf = 0; - this->zVelocity = 0x24000; + this->zVelocity = Q_16_16(2.25); SoundReq(SFX_12B); } break; case 1: - if (GravityUpdate(this, 0x2800) != 0) + if (GravityUpdate(this, Q_8_8(40)) != 0) break; this->field_0x80.HALF.LO += 1; switch (this->cutsceneBeh.HALF.LO) { @@ -1062,7 +1062,7 @@ void sub_080409B0(Entity* this) { this->field_0x80.HALF.HI = 3; COLLISION_OFF(this); this->hitType = 0x36; - this->zVelocity = 0x18000; + this->zVelocity = Q_16_16(1.5); SoundReq(SFX_164); } } diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index 80fbb07f..e02f2f1b 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -215,7 +215,7 @@ void VaatiTransfiguredEyeFunction0Action4(Entity* this) { void sub_08045A00(Entity* this) { const struct xy* t = &gUnk_080D18B4[this->type2]; - PositionRelative(this->parent, this, t->x << 0x10, (t->y + 3) * 0x10000); + PositionRelative(this->parent, this, Q_16_16(t->x), Q_16_16(t->y + 3)); } void sub_08045A28(Entity* this) { @@ -291,7 +291,7 @@ void sub_08045A28(Entity* this) { break; } } else { - PositionRelative(this->parent, this, 0, -0x10000); + PositionRelative(this->parent, this, 0, Q_16_16(-1.0)); switch (this->field_0x82.HALF.HI) { case 0: switch (this->frame & 0x70) { diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index cb9c9dc9..41df9d76 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -453,7 +453,7 @@ void VaatiWrathType0ActionA(Entity* this) { this->subAction = 0; this->direction = 0; this->speed = 0x100; - this->zVelocity = 0x12000; + this->zVelocity = Q_16_16(1.125); ChangeObjPalette(this, 0x16b); InitAnimationForceUpdate(this, 5); type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1; diff --git a/src/enemy/vaatiWrathEye.c b/src/enemy/vaatiWrathEye.c index 3a076bb6..360ba2eb 100644 --- a/src/enemy/vaatiWrathEye.c +++ b/src/enemy/vaatiWrathEye.c @@ -148,7 +148,7 @@ void VaatiWrathEyeAction6(Entity* this) { if (pEVar3 != NULL) { pEVar3->parent = this; this->child = pEVar3; - PositionRelative(this, pEVar3, 0, 0xc0000); + PositionRelative(this, pEVar3, 0, Q_16_16(12.0)); } } } diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index 3ce0985c..d964ab45 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -26,7 +26,7 @@ void sub_0802A250(Entity* this) { this->action = 1; this->actionDelay = 0; - this->zVelocity = -0x30000; + this->zVelocity = Q_16_16(-3.0); this->speed = gUnk_080CD03C[Random() & 3]; this->direction = gUnk_080CD040[Random() & 3] + 0x18; this->collisionLayer = 2; |
