diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2024-01-06 12:26:39 +0100 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2024-01-06 12:26:39 +0100 |
| commit | c3b771a20923b335bbea2ab97a68ac29d04fcc43 (patch) | |
| tree | 4d9c0857239ae7b7fab16ca5f4907575b7d07510 /src/enemy | |
| parent | 109b1020dcbfa17e80d28c522b5d792f7b3c6d46 (diff) | |
| parent | 6fb8b41a8e003d0a4997740f4178aeb0c3f24ead (diff) | |
Merge branch 'master' into tilemap-docs
Diffstat (limited to 'src/enemy')
78 files changed, 322 insertions, 321 deletions
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index a7e47aab..4e6854b9 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -81,7 +81,7 @@ void AcroBandit(AcroBanditEntity* this) { gUnk_080012C8[index](super); } else { AcroBandit_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } } @@ -96,7 +96,7 @@ void AcroBandit_OnTick(AcroBanditEntity* this) { void AcroBandit_OnCollision(AcroBanditEntity* this) { Entity* brother; - if (super->contactFlags != 0x80 && super->contactFlags != 0x81) { + if (super->contactFlags != CONTACT_NOW && super->contactFlags != (CONTACT_NOW | 0x1)) { if (super->type == 1) { if (super->action < 7 && super->knockbackDuration != 0) { brother = super->child; @@ -150,7 +150,7 @@ void AcroBandit_OnCollision(AcroBanditEntity* this) { } if (super->confusedTime) - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); EnemyFunctionHandlerAfterCollision(super, AcroBandit_Functions); } @@ -528,7 +528,7 @@ void AcroBandit_Type1Action6(AcroBanditEntity* this) { void AcroBandit_Type1Action7(AcroBanditEntity* this) { ProcessMovement2(super); - if (sub_080044EC(super, 0x2000) == 0) + if (BounceUpdate(super, Q_8_8(32.0)) == BOUNCE_DONE_ALL) super->action = 8; } diff --git a/src/enemy/armos.c b/src/enemy/armos.c index d9f451b2..e3145454 100644 --- a/src/enemy/armos.c +++ b/src/enemy/armos.c @@ -85,7 +85,7 @@ void sub_08030150(ArmosEntity* this) { void Armos(ArmosEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)&gUnk_080CE124); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); sub_08030150(this); } @@ -103,7 +103,7 @@ void sub_080301D4(ArmosEntity* this) { sub_080309E8(this); } if (super->confusedTime != 0) { - Create0x68FX(super, 0x1c); + EnemyCreateFX(super, 0x1c); } this->unk_81 = super->health; EnemyFunctionHandlerAfterCollision(super, gUnk_080CE124); @@ -178,7 +178,7 @@ void sub_08030338(ArmosEntity* this) { if (super->frame == 2) { super->frame = 0; if (this->unk_80 != 2) { - super->flags2 = 0xb; + super->collisionMask = 0xb; super->hitType = 8; super->hitbox = (Hitbox*)&gUnk_080FD2F0; } @@ -283,7 +283,7 @@ void sub_08030580(ArmosEntity* this) { void sub_08030590(ArmosEntity* this) { super->action = 5; - super->flags2 = 1; + super->collisionMask = 1; super->hitType = 1; super->hitbox = (Hitbox*)&gHitbox_15; sub_080309C8(this, 5); @@ -339,7 +339,7 @@ bool32 sub_080305BC(ArmosEntity* this) { bool32 sub_08030650(ArmosEntity* this) { if (super->type == 0) { - if (super->contactFlags == 0x80) { + if (super->contactFlags == CONTACT_NOW) { return 1; } } else if (this->unk_80 != 2) { diff --git a/src/enemy/ballChainSoldier.c b/src/enemy/ballChainSoldier.c index b2a34518..bc6ff6d2 100644 --- a/src/enemy/ballChainSoldier.c +++ b/src/enemy/ballChainSoldier.c @@ -55,7 +55,7 @@ void BallChainSoldier_OnKnockback(BallChainSoldierEntity* this) { } void BallChainSoldier_OnDeath(BallChainSoldierEntity* this) { - CreateDeathFx(super, 0xff, 0x57); + EnemyCreateDeathFX((Enemy*)super, 0xff, 0x57); } void BallChainSoldier_OnGrabbed(BallChainSoldierEntity* this) { @@ -64,7 +64,7 @@ void BallChainSoldier_OnGrabbed(BallChainSoldierEntity* this) { void BallChainSoldier_Init(BallChainSoldierEntity* this) { Entity* entity; sub_0804A720(super); - entity = CreateProjectileWithParent(super, BALL_AND_CHAIN, 0); + entity = EnemyCreateProjectile(super, BALL_AND_CHAIN, 0); if (entity == NULL) return; diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index 6b83d6dc..19603462 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -35,7 +35,7 @@ void Beetle_OnTick(BeetleEntity* this) { void Beetle_OnCollision(BeetleEntity* this) { switch (super->contactFlags) { - case 0x80: + case CONTACT_NOW: if (gPlayerState.framestate == PL_STATE_CLIMB) { Beetle_OnTick(this); } else { @@ -50,7 +50,7 @@ void Beetle_OnCollision(BeetleEntity* this) { InitializeAnimation(super, 6); } break; - case 0x93: + case CONTACT_NOW | 0x13: Beetle_OnTick(this); break; } @@ -70,7 +70,7 @@ void Beetle_OnDeath(BeetleEntity* this) { entity->subtimer--; super->parent = NULL; } - CreateDeathFx(super, 0xf0, 0); + EnemyCreateDeathFX((Enemy*)super, 0xf0, 0); } } @@ -120,7 +120,7 @@ void sub_080218CC(BeetleEntity* this) { GetNextFrame(super); if (super->frame & 1) { ProcessMovement2(super); - if (sub_080044EC(super, 0x1c00) == 0) + if (BounceUpdate(super, Q_8_8(28.0)) == BOUNCE_DONE_ALL) super->frameDuration = 1; } diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 5c15c015..f1ae158b 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -38,7 +38,7 @@ void Bobomb_OnTick(BobombEntity* this) { } void Bobomb_OnCollision(BobombEntity* this) { - if (super->contactFlags & 0x80) { + if (super->contactFlags & CONTACT_NOW) { switch (super->contactFlags & 0x7f) { case 0: case 1: @@ -250,7 +250,7 @@ void sub_0802CAF8(BobombEntity* this) { if (--super->timer == 0) { sub_0802CBC4(this); } else { - if (this->unk_81 && sub_080044EC(super, 0x2800) == 1) { + if (this->unk_81 && BounceUpdate(super, Q_8_8(40.0)) == BOUNCE_INIT_NEXT) { EnqueueSFX(SFX_PLACE_OBJ); } sub_0802CC18(this); diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index b1171b50..71ccd7e2 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -96,8 +96,8 @@ void sub_0802A8F4(BombPeahatEntity* this) { } void sub_0802A8FC(BombPeahatEntity* this) { - if ((gPlayerState.field_0x1c & 0xf) == 0) { - super->health = gPlayerState.field_0x1c & 0xf; + if ((gPlayerState.gustJarState & 0xf) == 0) { + super->health = gPlayerState.gustJarState & 0xf; } } @@ -474,7 +474,7 @@ void sub_0802AEBC(BombPeahatEntity* this) { void sub_0802AED4(BombPeahatEntity* this) { GetNextFrame(super); if (this->unk_81 < 2) { - if (sub_080044EC(super, 0x2800) == 1) { + if (BounceUpdate(super, Q_8_8(40.0)) == BOUNCE_INIT_NEXT) { this->unk_81++; } } else { @@ -673,7 +673,7 @@ void sub_0802B1BC(BombPeahatEntity* this) { #endif void sub_0802B204(BombPeahatEntity* this) { - if (sub_080044EC(super, 0x2800) == 1) { + if (BounceUpdate(super, Q_8_8(40.0)) == BOUNCE_INIT_NEXT) { Entity* entity = CreateEnemy(BOBOMB, 1); if (entity != NULL) { CopyPosition(super, entity); diff --git a/src/enemy/bowMoblin.c b/src/enemy/bowMoblin.c index 93358b37..b071ced4 100644 --- a/src/enemy/bowMoblin.c +++ b/src/enemy/bowMoblin.c @@ -42,7 +42,7 @@ const s8 gUnk_080CFFC4[8]; void BowMoblin(Entity* this) { EnemyFunctionHandler(this, BowMoblin_Functions); - SetChildOffset(this, 0, 1, -0x18); + EnemySetFXOffset(this, 0, 1, -0x18); } void BowMoblin_OnTick(BowMoblinEntity* this) { @@ -53,10 +53,10 @@ void BowMoblin_OnCollision(BowMoblinEntity* this) { Entity* pEVar1; if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)BowMoblin_Functions); - if ((super->contactFlags & 0x80) != 0) { + if (super->contactFlags & CONTACT_NOW) { sub_0803C5F0(this); pEVar1 = super->child; if (pEVar1 != NULL) { @@ -213,7 +213,7 @@ void sub_0803C400(BowMoblinEntity* this) { switch (++super->timer) { case 1: super->direction = super->animationState << 2; - projectile = CreateProjectileWithParent(super, ARROW_PROJECTILE, super->animationState >> 1); + projectile = EnemyCreateProjectile(super, ARROW_PROJECTILE, super->animationState >> 1); if (projectile) { super->child = projectile; projectile->direction = (super->direction + 4) & 0x18; diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index ac8ecdcc..f1cd770e 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -155,7 +155,7 @@ void BusinessScrub_Action2(BusinessScrubEntity* this) { unk = 1; sub_080290FC(this); if (super->frame & 1) { - Entity* entity = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0); + Entity* entity = EnemyCreateProjectile(super, DEKU_SEED_PROJECTILE, 0); if (entity != NULL) { entity->parent = super; entity->direction = super->direction; @@ -222,7 +222,7 @@ void BusinessScrub_Action3(BusinessScrubEntity* this) { super->timer = 30; super->subtimer = 5; sub_080290E0(this, 0); - iVar1 = Create0x68FX(super, FX_STARS); + iVar1 = EnemyCreateFX(super, FX_STARS); if (iVar1 != NULL) { iVar1->spritePriority.b0 = 3; iVar1->z.HALF.HI -= 12; @@ -238,7 +238,7 @@ void BusinessScrub_Action3(BusinessScrubEntity* this) { sub_0800445C(super); } -extern void sub_0804AA1C(Entity*); +extern void EnemyDetachFX(Entity*); void sub_08028F0C(BusinessScrubEntity*); void BusinessScrub_Action4(BusinessScrubEntity* this) { @@ -246,7 +246,7 @@ void BusinessScrub_Action4(BusinessScrubEntity* this) { super->timer = 48; if (super->subtimer) { if (--super->subtimer == 0) { - sub_0804AA1C(super); + EnemyDetachFX(super); } } else if (sub_08028FDC(this) || this->unk_80) { this->unk_80 = 0; @@ -382,7 +382,7 @@ void sub_08028F0C(BusinessScrubEntity* this) { const struct SalesOffering* offer = (const struct SalesOffering*)this->unk_7c; super->interactType = INTERACTION_NONE; - sub_0804AA1C(super); + EnemyDetachFX(super); super->direction = (GetAnimationState(super) << 3); sub_080290E0(this, 3); this->unk_80 = 1; diff --git a/src/enemy/businessScrubPrologue.c b/src/enemy/businessScrubPrologue.c index b7b7bc16..0f84737b 100644 --- a/src/enemy/businessScrubPrologue.c +++ b/src/enemy/businessScrubPrologue.c @@ -127,7 +127,7 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) { r6 = 1; sub_0804604C(this); if (super->frame & 1) { - entity = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0); + entity = EnemyCreateProjectile(super, DEKU_SEED_PROJECTILE, 0); if (entity != NULL) { entity->parent = super; entity->direction = super->direction; @@ -190,7 +190,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) { super->action = 5; super->subAction = 0; sub_08046030(this, 0); - entity = Create0x68FX(super, FX_STARS); + entity = EnemyCreateFX(super, FX_STARS); if (entity != NULL) { entity->spritePriority.b0 = 3; entity->z.HALF.HI -= 0xc; @@ -329,7 +329,7 @@ void sub_08046078(BusinessScrubPrologueEntity* this) { super->child->action = 0xff; } - sub_0804AA1C(super); + EnemyDetachFX(super); } void (*const BusinessScrubPrologue_Functions[])(Entity*) = { diff --git a/src/enemy/chaser.c b/src/enemy/chaser.c index 9255b1f1..a17f4c96 100644 --- a/src/enemy/chaser.c +++ b/src/enemy/chaser.c @@ -43,7 +43,7 @@ void sub_0802B540(Entity* this) { void sub_0802B56C(Entity* this) { GetNextFrame(this); - if (this->contactFlags & 0x80) { + if (this->contactFlags & CONTACT_NOW) { this->speed = 0x40; } diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index 153e9cea..d7c2f68d 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -35,7 +35,7 @@ void sub_0801FAF8(ChuchuEntity* this); void sub_0801FB14(ChuchuEntity* this); void sub_0801FB34(ChuchuEntity* this); void sub_0801FB68(ChuchuEntity* this); -u32 sub_0801FBD0(ChuchuEntity* this); +u32 CheckWaterTile(ChuchuEntity* this); void Chuchu_JumpAtPlayer(ChuchuEntity* this); extern void (*const Chuchu_Functions[])(ChuchuEntity*); @@ -73,7 +73,7 @@ void Chuchu(ChuchuEntity* this) { /* ... */ break; case 2: - sub_080043A8(super); + CreateDrownFX(super); return; } } @@ -82,7 +82,7 @@ void Chuchu(ChuchuEntity* this) { this->unk_81 = index; Chuchu_Functions[GetNextFunction(super)](this); if (this->unk_68->type == 0x1c) { - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } else if (super->type == 2) { sub_0801FB34(this); } @@ -118,14 +118,14 @@ void Chuchu_OnCollision(ChuchuEntity* this) { if (health) { if (super->contactFlags == 0x94) { sub_0801FB68(this); - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); InitializeAnimation(super, 6); } else if (this->unk_80 != health) { sub_0801FB68(this); InitializeAnimation(super, 6); } } else { - sub_0804AA1C(super); + EnemyDetachFX(super); super->zVelocity = 0; InitializeAnimation(super, 9); } @@ -135,7 +135,7 @@ void Chuchu_OnCollision(ChuchuEntity* this) { void Chuchu_OnGrabbed(ChuchuEntity* this) { if (!sub_0806F520(super) && super->confusedTime) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); InitializeAnimation(super, 6); } else { if (super->animIndex != 8) { @@ -159,9 +159,9 @@ void Chuchu_OnDeath(ChuchuEntity* this) { if (super->type == 0) { GenericDeath(super); } else if (super->type == 1) { - CreateDeathFx(super, 0xf2, 0); + EnemyCreateDeathFX((Enemy*)super, 0xf2, 0); } else { - CreateDeathFx(super, 0xf1, 0); + EnemyCreateDeathFX((Enemy*)super, 0xf1, 0); } } @@ -197,7 +197,7 @@ void sub_0801F0C8(ChuchuEntity* this) { } void sub_0801F12C(ChuchuEntity* this) { - if (sub_0801FBD0(this)) { + if (CheckWaterTile(this)) { sub_0801F328(this); } else { if ((super->subtimer++ & 7) == 0) { @@ -233,7 +233,7 @@ void sub_0801F1B0(ChuchuEntity* this) { } if (super->frame & ANIM_DONE) { - if (sub_0801FBD0(this)) { + if (CheckWaterTile(this)) { sub_0801F328(this); } else { sub_0801F340(this); @@ -262,7 +262,7 @@ void sub_0801F270(ChuchuEntity* this) { ProcessMovement5(super); GetNextFrame(super); - if (sub_0801FBD0(this)) + if (CheckWaterTile(this)) return; if (--super->timer != 0) @@ -290,7 +290,7 @@ void sub_0801F2F8(ChuchuEntity* this) { GetNextFrame(super); if (super->frame & ANIM_DONE) { sub_0801F340(this); - sub_0804AA1C(super); + EnemyDetachFX(super); } } @@ -391,7 +391,7 @@ void sub_0801F4EC(ChuchuEntity* this) { } void sub_0801F508(ChuchuEntity* this) { - if (sub_0801FBD0(this)) { + if (CheckWaterTile(this)) { this->unk_83 = 0; sub_0801F730(this); } else { @@ -430,7 +430,7 @@ void sub_0801F584(ChuchuEntity* this) { } if (super->frame & ANIM_DONE) { - if (sub_0801FBD0(this)) { + if (CheckWaterTile(this)) { this->unk_83 = 0; sub_0801F730(this); } else { @@ -465,7 +465,7 @@ void sub_0801F688(ChuchuEntity* this) { if (this->unk_83) this->unk_83--; - if (sub_0801FBD0(this) || this->unk_83) { + if (CheckWaterTile(this) || this->unk_83) { super->direction = sub_08049F84(super, 1); ProcessMovement5(super); GetNextFrame(super); @@ -489,7 +489,7 @@ void sub_0801F6F8(ChuchuEntity* this) { if (super->frame & ANIM_DONE) { super->action = 4; super->speed = 0x20; - sub_0804AA1C(super); + EnemyDetachFX(super); InitializeAnimation(super, 2); } } @@ -562,7 +562,7 @@ void sub_0801F884(ChuchuEntity* this) { if (super->subtimer) { super->subtimer--; } else { - Entity* entity = Create0x68FX(super, FX_LIGHTNING_STRIKE); + Entity* entity = EnemyCreateFX(super, FX_LIGHTNING_STRIKE); if (entity != NULL) { entity->type2 = 64; super->action = 4; @@ -573,7 +573,7 @@ void sub_0801F884(ChuchuEntity* this) { } void sub_0801F8C0(ChuchuEntity* this) { - if (sub_0801FBD0(this)) { + if (CheckWaterTile(this)) { sub_0801FAE0(this); } else if (sub_08049FDC(super, 1) == 0) { sub_0801F730(this); @@ -606,7 +606,7 @@ void sub_0801F940(ChuchuEntity* this) { } if (super->frame & ANIM_DONE) { - if (sub_0801FBD0(this)) { + if (CheckWaterTile(this)) { sub_0801FAE0(this); } else { super->action = 6; @@ -636,7 +636,7 @@ void sub_0801F9E0(ChuchuEntity* this) { } void sub_0801FA30(ChuchuEntity* this) { - if (sub_0801FBD0(this)) { + if (CheckWaterTile(this)) { super->direction = sub_08049F84(super, 1); ProcessMovement5(super); GetNextFrame(super); @@ -654,7 +654,7 @@ void sub_0801FA78(ChuchuEntity* this) { super->action = 1; super->spriteSettings.draw = 0; InitializeAnimation(super, 4); - sub_0804AA1C(super); + EnemyDetachFX(super); } } @@ -664,7 +664,7 @@ void sub_0801FAAC(ChuchuEntity* this) { if (super->frame & ANIM_DONE) { sub_0801FB14(this); super->speed = 0x20; - sub_0804AA1C(super); + EnemyDetachFX(super); } } @@ -708,14 +708,14 @@ void sub_0801FB68(ChuchuEntity* this) { case 2: super->action = 10; super->hitType = 92; - sub_0804AA1C(super); + EnemyDetachFX(super); break; } super->zVelocity = 0; } -bool32 sub_0801FBD0(ChuchuEntity* this) { +bool32 CheckWaterTile(ChuchuEntity* this) { if (GetVvvAtEntity(super) == VVV_16) { return TRUE; } else { diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 947ae80d..20973723 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -284,9 +284,9 @@ void ChuchuBoss_OnDeath(ChuchuBossEntity* this) { break; case 1: if (this->unk_7d-- == 0) { - ((GenericEntity*)super->child)->field_0x6c.HALF.HI |= 2; + ((Enemy*)super->child)->enemyFlags |= EM_FLAG_BOSS_KILLED; this->unk_68->unk_6d.unk1 = 1; - ((GenericEntity*)super->parent)->field_0x6c.HALF.HI |= 2; + ((Enemy*)super->parent)->enemyFlags |= EM_FLAG_BOSS_KILLED; parent = super->child; child = super->parent; this->unk_68->base.health = 0; @@ -979,13 +979,13 @@ void sub_08026BE8(ChuchuBossEntity* this) { Entity* child; child = super->child; - child->flags2 &= ~1; + child->collisionMask &= ~1; if (this->unk_7c == 0) { super->subAction = 7; this->unk_84->unk_03 = 0; this->unk_7d = 0x2d; child->flags &= ~0x80; - child->flags2 |= 1; + child->collisionMask |= 1; SoundReq(SFX_155); } else { this->unk_7c--; @@ -1347,7 +1347,7 @@ void sub_080272D4(ChuchuBossEntity* this) { super->hitbox->height = (u32)((0x10000 / this->unk_74.HALF_U.HI) * 5) >> 6; if (*(char*)&this->unk_84 == 0) break; - if ((super->contactFlags & 0x80) != 0) { + if (super->contactFlags & CONTACT_NOW) { if (super->iframes != 0) { ((ChuchuBossEntity*)super->child)->unk_68->base.iframes = super->iframes; super->child->parent->iframes = super->iframes; @@ -1698,7 +1698,7 @@ bool32 sub_08027AA4(ChuchuBossEntity* this) { s32 iVar4; Helper* pHelper; - if ((super->contactFlags & 0x80) == 0) { + if ((super->contactFlags & CONTACT_NOW) == 0) { return FALSE; } switch (super->contactFlags & 0x7f) { diff --git a/src/enemy/cloudPiranha.c b/src/enemy/cloudPiranha.c index 628adbbc..ca05564e 100644 --- a/src/enemy/cloudPiranha.c +++ b/src/enemy/cloudPiranha.c @@ -42,7 +42,7 @@ void (*const gUnk_080CF4F0[])(CloudPiranhaEntity*) = { void CloudPiranha(CloudPiranhaEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)&gUnk_080CF4F0); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void CloudPiranha_OnTick(CloudPiranhaEntity* this) { @@ -56,10 +56,10 @@ void CloudPiranha_OnTick(CloudPiranhaEntity* this) { void CloudPiranha_OnCollision(CloudPiranhaEntity* this) { if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, gUnk_080CF4F0); - if ((super->contactFlags & 0x80) != 0) { + if (super->contactFlags & CONTACT_NOW) { if (super->hitType == 0x5a) { switch (super->contactFlags & 0x3f) { case 0x14: @@ -176,7 +176,7 @@ void CloudPiranha_Action3(CloudPiranhaEntity* this) { void CloudPiranha_Action4(CloudPiranhaEntity* this) { Entity* effect; sub_080387F0(this); - if (sub_080044EC(super, 0x1800) == 1) { + if (BounceUpdate(super, Q_8_8(24.0)) == BOUNCE_INIT_NEXT) { super->action = 1; super->hitType = 0x72; super->timer = 1; diff --git a/src/enemy/crow.c b/src/enemy/crow.c index 4f0c587b..5c882480 100644 --- a/src/enemy/crow.c +++ b/src/enemy/crow.c @@ -44,7 +44,7 @@ void Crow_OnTick(CrowEntity* this) { } void Crow_OnCollision(CrowEntity* this) { - if (super->contactFlags & 0x80) { + if (super->contactFlags & CONTACT_NOW) { if ((super->contactFlags & 0x3f) == 0) { COLLISION_OFF(super); super->subtimer = 16; diff --git a/src/enemy/cuccoAggr.c b/src/enemy/cuccoAggr.c index 03a158ea..bf749082 100644 --- a/src/enemy/cuccoAggr.c +++ b/src/enemy/cuccoAggr.c @@ -50,7 +50,7 @@ void CuccoAggr(Entity* this) { gUnk_080012C8[index](this); } else { CuccoAggr_Functions[GetNextFunction(this)](this); - SetChildOffset(this, 0, 1, -0x10); + EnemySetFXOffset(this, 0, 1, -0x10); sub_080391B4((CuccoAggrEntity*)this); } } @@ -74,7 +74,7 @@ void CuccoAggr_OnCollision(CuccoAggrEntity* this) { } if (super->confusedTime) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, CuccoAggr_Functions); @@ -176,7 +176,7 @@ void sub_08038F44(CuccoAggrEntity* this) { super->direction = GetFacingDirection(&gPlayerEntity.base, super); sub_080390F8(this); ProcessMovement0(super); - sub_080044EC(super, 0x1800); + BounceUpdate(super, Q_8_8(24.0)); GetNextFrame(super); sub_08039298(this); if (--this->unk_78 == 0) { diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index 9192857d..6a7a17db 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -67,7 +67,7 @@ extern void (*const gUnk_080CAB58[])(DarkNutEntity*); void DarkNut(DarkNutEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)DarkNut_Functions); - SetChildOffset(super, 0, 1, -22); + EnemySetFXOffset(super, 0, 1, -22); } void DarkNut_OnTick(DarkNutEntity* this) { @@ -82,7 +82,7 @@ void DarkNut_OnCollision(DarkNutEntity* this) { super->hitType = 81; sub_08021218(this, 8, DirectionToAnimationState(super->knockbackDirection ^ 0x10)); sub_08021588(this); - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); break; case 0x16: super->action = 11; @@ -90,7 +90,7 @@ void DarkNut_OnCollision(DarkNutEntity* this) { super->hitType = 81; sub_08021218(this, 8, DirectionToAnimationState(super->knockbackDirection ^ 0x10)); sub_08021588(this); - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); break; case 0x4b: if (super->action == 13 || super->action == 15 || super->action == 19 || super->action == 18) @@ -128,7 +128,7 @@ void DarkNut_OnCollision(DarkNutEntity* this) { if (super->health != this->unk_78) { sub_08021588(this); sub_08021390(this); - sub_0804AA1C(super); + EnemyDetachFX(super); } break; } @@ -240,7 +240,7 @@ void sub_08020F48(DarkNutEntity* this) { super->action = 14; sub_08021218(this, 13, uVar2 >> 3); - pEVar3 = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 1); + pEVar3 = EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 1); if (pEVar3) { pEVar3->parent = super; super->child = pEVar3; @@ -272,7 +272,7 @@ void sub_08020FE4(DarkNutEntity* this) { if (--super->timer == 0) { super->action = 12; sub_08021218(this, 9, super->animationState); - sub_0804AA1C(super); + EnemyDetachFX(super); } } @@ -286,7 +286,7 @@ void sub_08021010(DarkNutEntity* this) { void sub_08021038(DarkNutEntity* this) { if (super->child == NULL && super->frame) { - Entity* pEVar2 = (Entity*)CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 0); + Entity* pEVar2 = (Entity*)EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 0); if (pEVar2) { pEVar2->parent = super; super->child = pEVar2; @@ -325,7 +325,7 @@ void sub_080210E4(DarkNutEntity* this) { Entity* entity; super->frame &= ~1; - entity = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 2); + entity = EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 2); if (entity != NULL) { entity->parent = super; super->child = entity; @@ -335,7 +335,8 @@ void sub_080210E4(DarkNutEntity* this) { } sub_08021644(this); - if ((super->frame & 0x10) && (!ProcessMovement0(super) || (super->child && (super->child->contactFlags & 0x80)))) { + if ((super->frame & 0x10) && + (!ProcessMovement0(super) || (super->child && (super->child->contactFlags & CONTACT_NOW)))) { sub_080213D0(this, 0); } else { if (--this->unk_76 == 0) @@ -594,7 +595,7 @@ void sub_0802159C(DarkNutEntity* this) { super->frame = 0; super->hitType = 0x51; - entity = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 3); + entity = EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 3); if (entity != NULL) { entity->parent = super; super->child = entity; @@ -615,7 +616,7 @@ void sub_08021600(DarkNutEntity* this) { super->frame = 0; super->hitType = 0x51; - entity = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 4); + entity = EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 4); if (entity != NULL) { entity->parent = super; super->child = entity; diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index c6a4c876..b599372f 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -51,7 +51,7 @@ void DoorMimic_OnCollision(DoorMimicEntity* this) { void DoorMimic_OnDeath(DoorMimicEntity* this) { SetMetaTile(this->unk_7c, this->unk_7e, super->collisionLayer); CreateFx(super, FX_POT_SHATTER, 0); - SetRoomTrackerFlag(super); + EnemyDisableRespawn(super); DeleteThisEntity(); } diff --git a/src/enemy/dust.c b/src/enemy/dust.c index e6d3ca7a..7fd8c6d0 100644 --- a/src/enemy/dust.c +++ b/src/enemy/dust.c @@ -303,7 +303,7 @@ void sub_08044550(DustEntity* this) { u8 uVar1; const s8* ptr; - if ((gPlayerState.field_0x1c & 0xf) == 1) { + if ((gPlayerState.gustJarState & 0xf) == 1) { if (super->speed < 0x100) { super->speed += 0x10; } diff --git a/src/enemy/enemy4D.c b/src/enemy/enemy4D.c index f333f9cb..4fe0acfa 100644 --- a/src/enemy/enemy4D.c +++ b/src/enemy/enemy4D.c @@ -90,7 +90,7 @@ void Enemy4D_OnKnockback(Enemy4DEntity* this) { } void Enemy4D_OnDeath(Enemy4DEntity* this) { - CreateDeathFx(super, 0xff, 0x57); + EnemyCreateDeathFX((Enemy*)super, 0xff, 0x57); } void Enemy4D_OnGrabbed(Enemy4DEntity* this) { @@ -100,7 +100,7 @@ void Enemy4D_Init(Enemy4DEntity* this) { Entity* projectile; sub_0804A720(super); - projectile = CreateProjectileWithParent(super, BALL_AND_CHAIN, 0); + projectile = EnemyCreateProjectile(super, BALL_AND_CHAIN, 0); if (projectile != NULL) { projectile->parent = super; super->child = projectile; diff --git a/src/enemy/enemy50.c b/src/enemy/enemy50.c index bb18b5bd..36156ce7 100644 --- a/src/enemy/enemy50.c +++ b/src/enemy/enemy50.c @@ -65,7 +65,7 @@ void Enemy50(Enemy50Entity* this) { DeleteThisEntity(); } Enemy50_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void Enemy50_OnTick(Enemy50Entity* this) { @@ -79,21 +79,21 @@ void Enemy50_OnCollision(Enemy50Entity* this) { sub_08041134(this); sub_0803F6EC(this); } - if (super->hitType == 0x25 && super->contactFlags == 0x80) { + if (super->hitType == 0x25 && super->contactFlags == CONTACT_NOW) { super->action = 8; InitializeAnimation(super, 3); } else { - if (super->contactFlags == 0x80) { + if (super->contactFlags == CONTACT_NOW) { this->unk_7c = 0x78; sub_08041128(this); } - if (super->contactFlags == 0x9d) { + if (super->contactFlags == (CONTACT_NOW | 0x1d)) { super->zVelocity = Q_16_16(1.5); } if (super->confusedTime != 0) { super->animationState = super->knockbackDirection >> 4; InitializeAnimation(super, super->animationState + 7); - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } if (super->health != this->unk_7a) { if (super->type == 0) { @@ -422,7 +422,7 @@ void sub_0804122C(Enemy50Entity* this) { #ifndef EU bool32 sub_08041300(Enemy50Entity* this) { - if ((super->hitType == 0x25) && (super->contactFlags == 0x80)) { + if ((super->hitType == 0x25) && (super->contactFlags == CONTACT_NOW)) { return TRUE; } else { return super->action == 8 || super->action == 9; diff --git a/src/enemy/eyegore.c b/src/enemy/eyegore.c index a4b6110f..c8f03231 100644 --- a/src/enemy/eyegore.c +++ b/src/enemy/eyegore.c @@ -83,14 +83,14 @@ void Eyegore_OnTick(EyegoreEntity* this) { void Eyegore_OnCollision(EyegoreEntity* this) { u32 tmp; - if ((super->contactFlags == 0x95) || (super->contactFlags == 0x8e)) { + if ((super->contactFlags == (CONTACT_NOW | 0x15)) || (super->contactFlags == (CONTACT_NOW | 0xe))) { Entity* entity = super->contactedEntity; tmp = (((entity->direction + 4) & 0x18) ^ 0x10) >> 3; if (tmp == super->animationState) { if ((tmp & 1) != 0) { if (0x10 < ((entity->y.HALF.HI + entity->z.HALF.HI) - (super->y.HALF.HI + super->z.HALF.HI)) + 0x14U) { } else { - if (super->contactFlags == 0x8e) { + if (super->contactFlags == (CONTACT_NOW | 0xe)) { super->health = 0; } else { super->health--; @@ -106,7 +106,7 @@ void Eyegore_OnCollision(EyegoreEntity* this) { EnqueueSFX(SFX_BUTTON_PRESS); sub_08031344(this); } else { - if (super->contactFlags == 0x8e) { + if (super->contactFlags == (CONTACT_NOW | 0xe)) { super->health = 0; } else { super->health--; @@ -441,8 +441,8 @@ void sub_08031024(EyegoreEntity* this) { void sub_08031250(EyegoreEntity* this) { u32 tmp2; u32 tmp = (u32)super->animationState * 4; - sub_08008796(super, 9, super->x.HALF.HI + gUnk_080CE2C0[tmp], super->y.HALF.HI + gUnk_080CE2C0[tmp + 1]); - sub_08008796(super, 9, super->x.HALF.HI + gUnk_080CE2C0[tmp + 2], super->y.HALF.HI + gUnk_080CE2C0[tmp + 3]); + DoTileInteraction(super, 9, super->x.HALF.HI + gUnk_080CE2C0[tmp], super->y.HALF.HI + gUnk_080CE2C0[tmp + 1]); + DoTileInteraction(super, 9, super->x.HALF.HI + gUnk_080CE2C0[tmp + 2], super->y.HALF.HI + gUnk_080CE2C0[tmp + 3]); if (this->unk_79 != 0) { tmp2 = 0; if ((super->x.HALF.HI - (u32)this->unk_74) + 2 < 5) { diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 5704c295..834a6e95 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -93,7 +93,7 @@ void sub_0802C334(FallingBoulderEntity* this) { GetNextFrame(super); this->unk_7e = COORD_TO_TILE(super); - if (sub_080044EC(super, this->unk_84) == 1) { + if (BounceUpdate(super, this->unk_84) == BOUNCE_INIT_NEXT) { EnqueueSFX(0x14c); COLLISION_ON(super); this->unk_7a = 12; diff --git a/src/enemy/flyingPot.c b/src/enemy/flyingPot.c index 44dc7291..7eb5e879 100644 --- a/src/enemy/flyingPot.c +++ b/src/enemy/flyingPot.c @@ -94,7 +94,7 @@ void FlyingPot_OnTick(FlyingPotEntity* this) { void FlyingPot_OnCollision(FlyingPotEntity* this) { sub_08037418(this); - if (super->contactFlags == 0x9D) { + if (super->contactFlags == (CONTACT_NOW | 0x1d)) { super->action = FLYING_POT_ACTION_6; COLLISION_OFF(super); super->zVelocity = Q_16_16(2.625); @@ -157,7 +157,7 @@ void FlyingPot_SubAction2(FlyingPotEntity* this) { } void FlyingPot_SubAction3(FlyingPotEntity* this) { - if (!(gPlayerState.field_0x1c & 0xF)) { + if (!(gPlayerState.gustJarState & 0xF)) { sub_08037408(this); } } @@ -208,7 +208,7 @@ void FlyingPot_Action2(FlyingPotEntity* this) { super->spritePriority.b1 = 1; super->spriteOffsetX = 0; super->hitType = 0xA0; - super->flags2 = 0xF; + super->collisionMask = 0xF; super->hitbox = &gUnk_080FD34C; SetMetaTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); diff --git a/src/enemy/flyingSkull.c b/src/enemy/flyingSkull.c index 17aa92c5..9846c640 100644 --- a/src/enemy/flyingSkull.c +++ b/src/enemy/flyingSkull.c @@ -46,7 +46,7 @@ void FlyingSkull_OnTick(FlyingSkullEntity* this) { void FlyingSkull_OnCollision(FlyingSkullEntity* this) { sub_0803A100(this); - if (super->contactFlags == 0x9d) { + if (super->contactFlags == (CONTACT_NOW | 0x1d)) { super->action = 7; COLLISION_OFF(super); super->zVelocity = Q_16_16(2.625); @@ -101,7 +101,7 @@ void sub_08039CE0(FlyingSkullEntity* this) { } void sub_08039D4C(FlyingSkullEntity* this) { - if ((gPlayerState.field_0x1c & 0xf) == 0) { + if ((gPlayerState.gustJarState & 0xf) == 0) { sub_0803A0E0(this); } } @@ -199,7 +199,7 @@ void sub_08039FAC(FlyingSkullEntity* this) { super->spritePriority.b1 = 1; super->spriteOffsetX = 0; super->hitType = 0xa0; - super->flags2 = 0xf; + super->collisionMask = 0xf; super->hitbox = (Hitbox*)&gUnk_080FD34C; SetMetaTile(this->metaTileIndex, COORD_TO_TILE(super), super->collisionLayer); } diff --git a/src/enemy/ghini.c b/src/enemy/ghini.c index 5b408126..f835ec1f 100644 --- a/src/enemy/ghini.c +++ b/src/enemy/ghini.c @@ -44,7 +44,7 @@ void sub_0803F528(GhiniEntity*); void Ghini(GhiniEntity* this) { Ghini_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void Ghini_OnTick(GhiniEntity* this) { @@ -59,17 +59,17 @@ void Ghini_OnCollision(GhiniEntity* this) { sub_0803F630(this); sub_0803F6EC(this); } - if ((super->hitType == 0x25) && (super->contactFlags == 0x80)) { + if ((super->hitType == 0x25) && (super->contactFlags == CONTACT_NOW)) { super->action = 8; InitializeAnimation(super, 3); } else { - if (super->contactFlags == 0x9d) { + if (super->contactFlags == (CONTACT_NOW | 0x1d)) { super->zVelocity = 0x18000; } if (super->confusedTime != 0) { super->animationState = super->knockbackDirection >> 4; InitializeAnimation(super, super->animationState + 7); - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } if (super->health != this->unk_7a) { this->unk_7a = super->health; diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index 0732a282..e0813e6d 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -44,7 +44,7 @@ extern Entity* gUnk_020000B0; void Gibdo(Entity* this) { EnemyFunctionHandler(this, Gibdo_Functions); - SetChildOffset(this, 0, 1, -0x15); + EnemySetFXOffset(this, 0, 1, -0x15); } void Gibdo_OnTick(GibdoEntity* this) { @@ -52,7 +52,7 @@ void Gibdo_OnTick(GibdoEntity* this) { } void Gibdo_OnCollision(GibdoEntity* this) { - if (super->contactFlags == 0x87) { + if (super->contactFlags == (CONTACT_NOW | 0x7)) { if (super->action == 0x6) { sub_08037ACC(this); } @@ -62,7 +62,7 @@ void Gibdo_OnCollision(GibdoEntity* this) { Gibdo_CreateObjects(this); } else { if (super->action != 0x6) { - if (super->hitType == 0x27 && super->contactFlags == 0x80) { + if (super->hitType == 0x27 && super->contactFlags == CONTACT_NOW) { sub_08037A14(this); } else { if ((u8)(super->action - 1) < 2) { @@ -83,7 +83,7 @@ void Gibdo_OnCollision(GibdoEntity* this) { } } if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, Gibdo_Functions); } @@ -192,7 +192,7 @@ void sub_0803775C(GibdoEntity* this) { if (--super->timer == 0) { stalfos = CreateEnemy(STALFOS, 0); if (stalfos != NULL) { - sub_0804A4E4(super, stalfos); + EnemyCopyParams(super, stalfos); Gibdo_MoveObjectsToStalfos(this, stalfos); } DeleteEntity(super); @@ -326,7 +326,7 @@ void sub_08037A14(GibdoEntity* this) { super->timer = 24; super->spritePriority.b0 &= super->timer - 32; super->spritePriority.b0 |= 3; - super->flags2 &= 0xfe; + super->collisionMask &= 0xfe; this->field_0x7c = 5; CopyPosition(super, super->contactedEntity); InitAnimationForceUpdate(super, super->animationState + 0xc); @@ -341,7 +341,7 @@ void sub_08037A58(GibdoEntity* this) { super->iframes = 0xec; } super->hitType = 0x26; - super->flags2 |= 1; + super->collisionMask |= 1; super->iframes = 0xf4; super->knockbackDirection = DirectionFromAnimationState(super->animationState) ^ 0x10; super->knockbackDuration = 8; diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index 19399037..e88550f1 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -300,7 +300,7 @@ void sub_0802D33C(GleerokEntity* this) { } unk_84->entities[i]->health = 0; - ((GenericEntity*)unk_84->entities[i])->field_0x6c.HALF.HI |= 1; + ((Enemy*)(unk_84->entities[i]))->enemyFlags |= EM_FLAG_BOSS; unk_84->ent2->health = 0; unk_84->ent2->type2 = 0; unk_84->ent2->spriteSettings.draw &= ~1; @@ -383,7 +383,7 @@ void sub_0802D3B8(GleerokEntity* this) { case 1: if (super->type2 == 1) { COLLISION_ON(super); - super->flags2 |= 0x80; + super->collisionMask |= 0x80; } super->spritePriority.b0 = gUnk_080CD7C4[super->type2].unk0.HALF.HI; @@ -399,7 +399,7 @@ void sub_0802D3B8(GleerokEntity* this) { this->unk_74 = gUnk_080CD884[0]; this->unk_75 = 0; super->spritePriority.b0 = 6; - super->flags2 |= 0x80; + super->collisionMask |= 0x80; CopyPosition(super->parent, super); InitializeAnimation(super, 0x4f); break; @@ -659,7 +659,7 @@ void sub_0802D86C(GleerokEntity* this) { } } - if ((super->contactFlags & 0x80) && this->unk_74 == 0) { + if ((super->contactFlags & CONTACT_NOW) && this->unk_74 == 0) { if ((super->contactFlags & 0x7f) == 0x1d) { super->zVelocity = Q_16_16(3.0); super->parent->subAction = 4; @@ -815,7 +815,7 @@ void sub_0802DCE0(GleerokEntity* this) { } } else { if (this->unk_84->ent2->subtimer == 0) { - super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, 0); + super->child = EnemyCreateProjectile(super, GLEEROK_PROJECTILE, 0); if (super->child != NULL) { super->child->direction = this->unk_84->filler[5].unk0.HALF.HI; @@ -883,7 +883,7 @@ void sub_0802DDD8(GleerokEntity* this) { } if (this->unk_84->ent2->subtimer == 1) { - super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, r2); + super->child = EnemyCreateProjectile(super, GLEEROK_PROJECTILE, r2); if (super->child != NULL) { super->child->direction = this->unk_84->filler[5].unk0.HALF.HI; super->child->type2 = this->unk_84->ent2->frame & 0xf; @@ -1039,7 +1039,7 @@ void sub_0802E0B8(GleerokEntity* this) { super->type2 = 4; InitializeAnimation(super, 0x4e); } else { - if (super->contactFlags & 0x80) { + if (super->contactFlags & CONTACT_NOW) { if (super->iframes > 0) { SoundReq(SFX_BOSS_HIT); } @@ -1160,7 +1160,7 @@ void sub_0802E300(GleerokEntity* this) { heap->ent2->timer = 24; } else { if ((gRoomTransition.frameCount & 0xf) == 0) { - CreateProjectileWithParent(super, GLEEROK_PROJECTILE, 0x3); + EnemyCreateProjectile(super, GLEEROK_PROJECTILE, 0x3); } } diff --git a/src/enemy/gyorgFemale.c b/src/enemy/gyorgFemale.c index 0d267b15..f69178c0 100644 --- a/src/enemy/gyorgFemale.c +++ b/src/enemy/gyorgFemale.c @@ -250,7 +250,7 @@ void sub_080464C0(GyorgFemaleEntity* this) { void sub_08046518(void) { u16* ptr = gMapTop.metatileTypes; u16* sl = &gMapTop.mapData[sub_08046518_offset]; - u16* stack1 = &gMapTop.mapDataClone[sub_08046518_offset]; + u16* stack1 = &gMapTop.mapDataOriginal[sub_08046518_offset]; u8* stack2 = &gMapTop.vvv[sub_08046518_offset]; u8* r6 = &gMapTop.collisionData[sub_08046518_offset]; u32 i; diff --git a/src/enemy/hangingSeed.c b/src/enemy/hangingSeed.c index 1a383efb..2f52e0ab 100644 --- a/src/enemy/hangingSeed.c +++ b/src/enemy/hangingSeed.c @@ -20,7 +20,7 @@ void HangingSeed_OnTick(Entity* this) { } void HangingSeed_OnCollision(Entity* this) { - if (this->contactFlags & 0x80) { + if (this->contactFlags & CONTACT_NOW) { CreateFx(this, FX_BUSH, 0x80); DeleteThisEntity(); } diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 9d6bd30f..9de3ac59 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -39,7 +39,7 @@ extern const s8 gUnk_080CD464[]; void Helmasaur(HelmasaurEntity* this) { if (super->type == 0) { EnemyFunctionHandler(super, (EntityActionArray)Helmasaur_Functions); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } else { gUnk_080CD3FC[super->action](this); } @@ -63,7 +63,7 @@ void Helmasaur_OnCollision(HelmasaurEntity* this) { } } if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, Helmasaur_Functions); @@ -224,7 +224,7 @@ void sub_0802BEBC(HelmasaurEntity* this) { super->direction ^= DirectionSouth; ProcessMovement2(super); super->direction ^= DirectionSouth; - if (!sub_080044EC(super, Q_16_16(0.125))) { + if (BounceUpdate(super, Q_16_16(0.125)) == BOUNCE_DONE_ALL) { sub_0802C1C0(this); } } @@ -261,7 +261,7 @@ void sub_0802BF3C(HelmasaurEntity* this) { void sub_0802BF78(HelmasaurEntity* this) { super->action = 1; - super->flags2 = 4; + super->collisionMask = 4; super->gustJarFlags = 1; super->direction = super->animationState << 3; InitializeAnimation(super, super->animationState + 8); @@ -373,8 +373,8 @@ void sub_0802C1C0(HelmasaurEntity* this) { void sub_0802C1CC(HelmasaurEntity* this) { const s8* ptr = &gUnk_080CD464[super->animationState << 2]; - sub_08008796(super, 9, super->x.HALF.HI + ptr[0], super->y.HALF.HI + ptr[1]); - sub_08008796(super, 9, super->x.HALF.HI + ptr[2], super->y.HALF.HI + ptr[3]); + DoTileInteraction(super, 9, super->x.HALF.HI + ptr[0], super->y.HALF.HI + ptr[1]); + DoTileInteraction(super, 9, super->x.HALF.HI + ptr[2], super->y.HALF.HI + ptr[3]); } void sub_0802C218(HelmasaurEntity* this) { diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index c92b2ade..40688bfe 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -51,7 +51,7 @@ void sub_080327E0(KeatonEntity* this); void Keaton(KeatonEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)Keaton_Functions); - SetChildOffset(super, 0, 1, -18); + EnemySetFXOffset(super, 0, 1, -18); } void Keaton_OnTick(KeatonEntity* this) { @@ -75,7 +75,7 @@ void Keaton_OnCollision(KeatonEntity* this) { } } if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, Keaton_Functions); } @@ -143,7 +143,7 @@ void Keaton_Action3(KeatonEntity* this) { } void Keaton_Action4(KeatonEntity* this) { - if (super->child && (super->child->contactFlags & 0x80)) { + if (super->child && (super->child->contactFlags & CONTACT_NOW)) { sub_0803275C(this); return; } @@ -262,7 +262,7 @@ void sub_08032794(KeatonEntity* this) { void sub_080327C8(KeatonEntity* this) { Entity* child; - child = CreateProjectileWithParent(super, KEATON_DAGGER, 0); + child = EnemyCreateProjectile(super, KEATON_DAGGER, 0); if (child != NULL) { child->parent = super; super->child = child; diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index 107afd16..c0dba3db 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -54,7 +54,7 @@ extern const OffsetCoords gUnk_080D0154[]; void Lakitu(LakituEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)Lakitu_Functions); - SetChildOffset(super, 0, 1, -16); + EnemySetFXOffset(super, 0, 1, -16); } void Lakitu_OnTick(LakituEntity* this) { @@ -96,7 +96,7 @@ void Lakitu_OnCollision(LakituEntity* this) { } if (super->confusedTime) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, Lakitu_Functions); @@ -128,7 +128,7 @@ void sub_0803C86C(LakituEntity* this) { } void Lakitu_Initialize(LakituEntity* this) { - Entity* cloud = CreateProjectileWithParent(super, 17, 0); + Entity* cloud = EnemyCreateProjectile(super, 17, 0); if (cloud == NULL) { return; } @@ -313,7 +313,7 @@ void Lakitu_SpawnLightning(LakituEntity* this) { Entity* lightning; const OffsetCoords* offset; - lightning = CreateProjectileWithParent(super, LAKITU_LIGHTNING, 0); + lightning = EnemyCreateProjectile(super, LAKITU_LIGHTNING, 0); if (lightning == NULL) { return; @@ -342,7 +342,7 @@ void sub_0803CBAC(LakituEntity* this) { super->spritePriority.b1 = 1; - super->flags2 &= 0x7b; + super->collisionMask &= 0x7b; super->hitType = 0x42; diff --git a/src/enemy/leever.c b/src/enemy/leever.c index afe72922..1d52eff8 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -38,7 +38,7 @@ enum { void Leever(LeeverEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)Leever_Functions); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void Leever_OnTick(LeeverEntity* this) { @@ -46,13 +46,13 @@ void Leever_OnTick(LeeverEntity* this) { } void Leever_OnCollision(LeeverEntity* this) { - if (super->contactFlags == 0x80) { + if (super->contactFlags == CONTACT_NOW) { if (super->action == 3) { this->unk_74 = 1; } } else { if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } } EnemyFunctionHandlerAfterCollision(super, Leever_Functions); @@ -62,7 +62,7 @@ void Leever_OnDeath(LeeverEntity* this) { if (super->type == LeeverForm_Red) { GenericDeath(super); } else { - CreateDeathFx(super, 0xf1, 0); + EnemyCreateDeathFX((Enemy*)super, 0xf1, 0); } } diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index fef316b6..0a124fe5 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -31,7 +31,7 @@ extern void (*const gUnk_080CC714[])(LikeLikeEntity*); void LikeLike(Entity* this) { EnemyFunctionHandler(this, LikeLike_Functions); - SetChildOffset(this, 0, 1, -0x10); + EnemySetFXOffset(this, 0, 1, -0x10); } void LikeLike_OnTick(LikeLikeEntity* this) { @@ -46,13 +46,13 @@ void LikeLike_OnCollision(LikeLikeEntity* this) { } else { if (super->action == 7) { LikeLike_ReleasePlayer(this); - } else if (super->contactFlags & 0x80) { - u8 tmp = super->contactFlags & ~0x80; + } else if (super->contactFlags & CONTACT_NOW) { + u8 tmp = super->contactFlags & ~CONTACT_NOW; if (tmp == 0) { super->action = 7; super->timer = 95; super->subtimer = tmp; - super->flags2 &= 0xfc; + super->collisionMask &= 0xfc; this->prevSpritePriority = gPlayerEntity.base.spritePriority.b1; } } @@ -63,7 +63,7 @@ void LikeLike_OnCollision(LikeLikeEntity* this) { } if (super->confusedTime) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, LikeLike_Functions); @@ -153,7 +153,7 @@ void sub_08027FB4(LikeLikeEntity* this) { if (--super->timer == 0) { super->action = 1; super->timer = 1; - super->flags2 |= 1; + super->collisionMask |= 1; } GetNextFrame(super); } @@ -236,7 +236,7 @@ void LikeLike_ReleasePlayer(LikeLikeEntity* this) { super->action = 4; super->timer = 80; super->subtimer = tmp; - super->flags2 |= 2; + super->collisionMask |= 2; if (super->iframes == 0) { super->iframes = -18; } diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index ac34a6f0..34925a76 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -518,7 +518,7 @@ void sub_0802A098(MadderpillarEntity* this) { void sub_0802A0F8(MadderpillarEntity* this) { if (super->health != 0) { - if ((super->contactFlags & 0x80) && super->iframes != 0) { + if ((super->contactFlags & CONTACT_NOW) && super->iframes != 0) { Entity* entity = super; u32 i; for (i = 0; i < 6; i++) { @@ -549,7 +549,7 @@ void sub_0802A16C(MadderpillarEntity* this) { } void sub_0802A18C(MadderpillarEntity* this) { - if (super->contactFlags & 0x80) { + if (super->contactFlags & CONTACT_NOW) { switch (super->contactFlags & 0x7f) { case 0: case 1: diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index c2afcae9..a4ec8dd8 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -167,7 +167,8 @@ void MazaalBracelet_OnCollision(MazaalBraceletEntity* this) { if (super->type < 2) { if (super->action != 0x2b) { - if ((0 < super->iframes) && ((super->contactFlags == 0x95 || (super->contactFlags == 0x8e)))) { + if ((0 < super->iframes) && + ((super->contactFlags == (CONTACT_NOW | 0x15) || (super->contactFlags == (CONTACT_NOW | 0xe))))) { super->action = 0x28; COLLISION_OFF(super); entity = (MazaalBraceletEntity*)super->parent; @@ -1299,7 +1300,7 @@ u32 sub_0803B870(MazaalBraceletEntity* this) { Entity* entity; entity = super->child; - if ((entity->contactFlags & 0x80) != 0 && (gPlayerState.flags & PL_CAPTURED)) { + if ((entity->contactFlags & CONTACT_NOW) != 0 && (gPlayerState.flags & PL_CAPTURED)) { super->action = 0x18; super->timer = 68; super->spriteSettings.draw = 0; diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c index bef76f86..856651e6 100644 --- a/src/enemy/miniSlime.c +++ b/src/enemy/miniSlime.c @@ -36,7 +36,7 @@ static void (*const MiniSlime_Functions[])(MiniSlimeEntity*) = { void MiniSlime(MiniSlimeEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)MiniSlime_Functions); - SetChildOffset(super, 0, 1, -8); + EnemySetFXOffset(super, 0, 1, -8); } void MiniSlime_OnTick(MiniSlimeEntity* this) { @@ -51,7 +51,7 @@ void MiniSlime_OnTick(MiniSlimeEntity* this) { void MiniSlime_OnCollision(MiniSlimeEntity* this) { if (super->confusedTime) - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); EnemyFunctionHandlerAfterCollision(super, MiniSlime_Functions); } diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index 0aec625e..20714560 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -102,7 +102,7 @@ void Moldworm_OnCollision(MoldwormEntity* this) { super->iframes = -8; this->unk_7f = 0; this->unk_7b = 0; - if (super->contactFlags == 0x80 || super->contactFlags == 0x9e) { + if (super->contactFlags == CONTACT_NOW || super->contactFlags == (CONTACT_NOW | 0x1e)) { super->type2 = 0; this->unk_80 = 0x14; } else { @@ -442,7 +442,7 @@ void sub_08023894(MoldwormEntity* this) { } void sub_0802390C(MoldwormEntity* this) { - if (super->contactFlags & 0x80) { + if (super->contactFlags & CONTACT_NOW) { Entity* ent = super->child; do { ent->iframes = super->iframes; @@ -450,7 +450,7 @@ void sub_0802390C(MoldwormEntity* this) { } else { Entity* ent = super->child; do { - if (ent->contactFlags & 0x80) { + if (ent->contactFlags & CONTACT_NOW) { u8 bVar2 = 0xff - ent->health; if (bVar2 != 0) { u32 tmp; diff --git a/src/enemy/mulldozer.c b/src/enemy/mulldozer.c index fbc3f09c..9afd925a 100644 --- a/src/enemy/mulldozer.c +++ b/src/enemy/mulldozer.c @@ -43,7 +43,7 @@ void sub_080332E8(MulldozerEntity*, s32); void Mulldozer(MulldozerEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)Mulldozer_Functions); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void Mulldozer_OnInit(MulldozerEntity* this) { @@ -52,10 +52,10 @@ void Mulldozer_OnInit(MulldozerEntity* this) { void Mulldozer_OnCollision(MulldozerEntity* this) { if (super->confusedTime != 0) { - Create0x68FX(super, 0x1c); + EnemyCreateFX(super, 0x1c); } EnemyFunctionHandlerAfterCollision(super, Mulldozer_Functions); - if ((super->contactFlags & 0x80) != 0) { + if ((super->contactFlags & CONTACT_NOW) != 0) { switch (super->contactFlags & 0x3f) { case 2: case 3: diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index d33a9a54..bdf9c73f 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -24,7 +24,7 @@ extern const s8 gUnk_080CA17E[2]; // Main void Octorok(Entity* this) { EnemyFunctionHandler(this, Octorok_Functions); - SetChildOffset(this, 0, 1, -16); + EnemySetFXOffset(this, 0, 1, -16); } // Idle @@ -35,7 +35,7 @@ void Octorok_OnTick(Entity* this) { // Touch player void Octorok_OnCollision(Entity* this) { if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + EnemyCreateFX(this, FX_STARS); } EnemyFunctionHandlerAfterCollision(this, Octorok_Functions); } @@ -45,7 +45,7 @@ void Octorok_OnDeath(Entity* this) { if (this->type == 0) { GenericDeath(this); } else { - CreateDeathFx(this, 241, 0); + EnemyCreateDeathFX((Enemy*)this, 241, 0); } } @@ -127,7 +127,7 @@ void Octorok_Move(Entity* this) { void Octorok_ShootNut(Entity* this) { GetNextFrame(this); if (this->frame & 1) { - Entity* entity = CreateProjectileWithParent(this, ROCK_PROJECTILE, 0); + Entity* entity = EnemyCreateProjectile(this, ROCK_PROJECTILE, 0); if (entity != NULL) { const s8* off; entity->direction = this->direction; diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index 381e5e1d..0f12becc 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -343,7 +343,7 @@ void OctorokBoss_Init(OctorokBossEntity* this) { (this->heap)->field_0x2 = 0; (this->heap)->tailCount = 5; super->spriteRendering.b0 = 3; - this->field_0x6c.HALF.HI |= 1; + ((Enemy*)this)->enemyFlags |= EM_FLAG_BOSS; this->unk_76 = 0xa0; this->unk_74 = 0xa0; this->angle.HWORD = 0; @@ -557,7 +557,7 @@ void OctorokBoss_Action1(OctorokBossEntity* this) { case LEG_FR: case LEG_FL: case LEG_BL: - if ((((OctorokBossEntity*)super->parent)->field_0x6c.HALF.HI & 2) != 0) { + if (((Enemy*)super->parent)->enemyFlags & EM_FLAG_BOSS_KILLED) { DeleteThisEntity(); } if (this->heap->mouthObject->base.health == 1) { @@ -677,7 +677,7 @@ void OctorokBoss_Action1(OctorokBossEntity* this) { this->heap->fallingStonesTimer--; if ((gRoomTransition.frameCount & 3) == 0) { // Falling stones - CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 3); + EnemyCreateProjectile(super, OCTOROK_BOSS_PROJECTILE, 3); } } OctorokBoss_Action1_SubActions[super->subAction](this); @@ -885,7 +885,7 @@ void OctorokBoss_Action1_Attack_Type2_3(OctorokBossEntity* this) { } void OctorokBoss_ExecuteAttackSpitRock(OctorokBossEntity* this) { - super->child = CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 0); + super->child = EnemyCreateProjectile(super, OCTOROK_BOSS_PROJECTILE, 0); if (super->child != NULL) { super->child->parent = super; super->child->direction = ((u8) - this->angle.HALF.HI ^ 0x80); @@ -1006,7 +1006,7 @@ void OctorokBoss_ExecuteAttackFreeze(OctorokBossEntity* this) { } else { this->timer--; if ((gRoomTransition.frameCount & 3) == 0) { - super->child = CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 2); + super->child = EnemyCreateProjectile(super, OCTOROK_BOSS_PROJECTILE, 2); if (super->child != NULL) { super->child->parent = super; super->child->direction = (u8) - this->angle.HALF.HI ^ 0x80; @@ -1026,7 +1026,7 @@ void OctorokBoss_Burning(OctorokBossEntity* this) { this->heap->fallingStonesTimer--; if ((gRoomTransition.frameCount & 7) == 0) { // Falling stones - CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 3); + EnemyCreateProjectile(super, OCTOROK_BOSS_PROJECTILE, 3); } } SetAffineInfo(super, this->unk_76, this->unk_74, this->angle.HWORD); diff --git a/src/enemy/octorokGolden.c b/src/enemy/octorokGolden.c index 80342aa7..23b92aa5 100644 --- a/src/enemy/octorokGolden.c +++ b/src/enemy/octorokGolden.c @@ -26,7 +26,7 @@ void OctorokGolden(Entity* this) { gUnk_080012C8[index](this); } else { OctorokGolden_Functions[GetNextFunction(this)](this); - SetChildOffset(this, 0, 1, -0x10); + EnemySetFXOffset(this, 0, 1, -0x10); } } @@ -36,7 +36,7 @@ void OctorokGolden_OnTick(Entity* this) { void OctorokGolden_OnCollision(Entity* this) { if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + EnemyCreateFX(this, FX_STARS); } EnemyFunctionHandlerAfterCollision(this, OctorokGolden_Functions); @@ -47,7 +47,7 @@ void OctorokGolden_OnDeath(Entity* this) { SetGlobalFlag(this->type2); } - CreateDeathFx(this, 0xff, ITEM_RUPEE100); + EnemyCreateDeathFX((Enemy*)this, 0xff, ITEM_RUPEE100); } void sub_08037CE4(Entity* this) { @@ -83,7 +83,7 @@ static void sub_08037D54(Entity* this) { this->frame ^= 2; if (this->frame & 0x2) { - Entity* proj = CreateProjectileWithParent(this, ROCK_PROJECTILE, 0); + Entity* proj = EnemyCreateProjectile(this, ROCK_PROJECTILE, 0); if (proj) { const s8* ptr; s32 dir; @@ -112,16 +112,16 @@ static void sub_08037D54(Entity* this) { void sub_08037E14(Entity* this) { u32 dir; - u8* layer; + u8* collisionData; const s8* ptr; s32 x, y; this->timer = 8; dir = (GetFacingDirection(this, &gPlayerEntity.base) + 4) & 0x18; - layer = (u8*)GetLayerByIndex(this->collisionLayer)->collisionData; + collisionData = GetLayerByIndex(this->collisionLayer)->collisionData; ptr = gUnk_080CF498 + (dir >> 2); x = this->x.HALF.HI + *ptr; y = this->y.HALF.HI + *(ptr + 1); - if (IsTileCollision(layer, x, y, 0)) { + if (IsTileCollision(collisionData, x, y, 0)) { this->direction = Random() & 0x18; } else { this->direction = dir; diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index fee43028..a8404af9 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -47,7 +47,7 @@ enum { void Peahat(PeahatEntity* this) { if (super->type == PeahatForm_Torso) { EnemyFunctionHandler(super, (EntityActionArray)Peahat_Functions); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } else { gPeahatPropellerFunctions[super->action](this); } @@ -61,7 +61,7 @@ void Peahat_OnTick(PeahatEntity* this) { void Peahat_OnCollision(PeahatEntity* this) { if (this->unk_82) { - if (super->contactFlags == 0x94) { + if (super->contactFlags == (CONTACT_NOW | 0x14)) { Entity* entity = CreateEnemy(PEAHAT, PeahatForm_Propeller); if (entity != NULL) { CopyPosition(super, entity); @@ -74,14 +74,14 @@ void Peahat_OnCollision(PeahatEntity* this) { super->iframes = -30; this->unk_81 = 0; InitializeAnimation(super, super->animationState); - } else if (super->contactFlags == 0x9b) { + } else if (super->contactFlags == (CONTACT_NOW | 0x1b)) { super->animationState = PeahatAnimation_BrokenPropeller; super->action = 5; super->speed = 0x80; super->iframes = -30; this->unk_81 = 0; InitializeAnimation(super, super->animationState); - } else if (super->contactFlags == 0x80) { + } else if (super->contactFlags == CONTACT_NOW) { if (super->animationState == PeahatAnimation_Flying) { super->action = 1; super->timer = 30; @@ -94,7 +94,7 @@ void Peahat_OnCollision(PeahatEntity* this) { } if (super->confusedTime) - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); EnemyFunctionHandlerAfterCollision(super, Peahat_Functions); } @@ -240,7 +240,7 @@ void Peahat_ChargeEnd(PeahatEntity* this) { void Peahat_Stunned(PeahatEntity* this) { switch (super->animationState) { default: - if (sub_080044EC(super, 0x1800) == 0) { + if (BounceUpdate(super, Q_8_8(24.0)) == BOUNCE_DONE_ALL) { super->action = 6; super->timer = 240; super->subtimer = 10; @@ -267,14 +267,14 @@ void Peahat_Stunned(PeahatEntity* this) { void Peahat_RepairPropeller(PeahatEntity* this) { if ((super->subtimer != 0) && (--super->subtimer == 0)) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } if (sub_0800442E(super) || (--super->timer == 0)) { super->action = 9; super->zVelocity = Q_16_16(1.5); super->direction = Random() & 0x1f; - sub_0804AA1C(super); + EnemyDetachFX(super); super->animationState = PeahatAnimation_RepairPropeller; InitializeAnimation(super, super->animationState); } @@ -282,14 +282,14 @@ void Peahat_RepairPropeller(PeahatEntity* this) { void Peahat_Recover(PeahatEntity* this) { if ((super->subtimer != 0) && (--super->subtimer == 0)) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } if (sub_0800442E(super) || (--super->timer == 0)) { super->action = 8; super->timer = 240; super->direction = Random() & 0x1f; - sub_0804AA1C(super); + EnemyDetachFX(super); } } diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 92f31448..f0bd9233 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -65,7 +65,7 @@ void Pesto_OnTick(PestoEntity* this) { void Pesto_OnCollision(PestoEntity* this) { if (super->hitType != 0x6e) { - if (super->contactFlags == 0x80) { + if (super->contactFlags == CONTACT_NOW) { this->unk_86 = 0x30; if ((this->unk_83 & 0xf) == 3 && super->action == 6) { @@ -185,7 +185,7 @@ void sub_080240B8(PestoEntity* this) { Entity* entity; this->unk_83 = 0; - entity = CreateProjectileWithParent(super, DIRT_BALL_PROJECTILE, this->unk_83); + entity = EnemyCreateProjectile(super, DIRT_BALL_PROJECTILE, this->unk_83); if (entity != NULL) { super->child = entity; entity->parent = super; @@ -406,7 +406,7 @@ void sub_080244E8(PestoEntity* this) { super->direction = DirectionSouth; super->speed = tmp; this->unk_84 = 0; - super->flags2 &= 0xfc; + super->collisionMask &= 0xfc; sub_080249DC(this); this->unk_85 = gPlayerEntity.base.spritePriority.b1; gPlayerEntity.base.flags &= ~ENT_COLLIDE; @@ -428,7 +428,7 @@ void sub_080244E8(PestoEntity* this) { super->z.HALF.HI -= 0xe; this->unk_78 -= 0xe; - entity = CreateProjectileWithParent(super, DIRT_BALL_PROJECTILE, this->unk_83); + entity = EnemyCreateProjectile(super, DIRT_BALL_PROJECTILE, this->unk_83); if (entity != NULL) { entity->parent = super; entity->z.HALF.HI += 0xe; @@ -451,7 +451,7 @@ void sub_080244E8(PestoEntity* this) { super->z.HALF.HI -= 0xe; this->unk_78 -= 0xe; - entity = CreateProjectileWithParent(super, DIRT_BALL_PROJECTILE, this->unk_83); + entity = EnemyCreateProjectile(super, DIRT_BALL_PROJECTILE, this->unk_83); if (entity != NULL) { entity->parent = super; entity->z.HALF.HI += 0xe; @@ -877,7 +877,7 @@ void sub_08024F50(PestoEntity* this) { gPlayerEntity.base.spritePriority.b1 = this->unk_85; gPlayerEntity.base.z.HALF.HI = gPlayerEntity.base.spriteOffsetY; gPlayerEntity.base.spriteOffsetY = 0; - super->flags2 |= 3; + super->collisionMask |= 3; this->unk_83 = 0xc0; this->unk_80 += 2; this->unk_84 = 0; diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index c6c139e9..06a754ea 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -57,7 +57,7 @@ extern const s8 gUnk_080CC0C2[]; void Puffstool(PuffstoolEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)Puffstool_Functions); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void Puffstool_OnTick(PuffstoolEntity* this) { @@ -72,7 +72,7 @@ void Puffstool_OnCollide(PuffstoolEntity* this) { /* ... */ break; case 0x1b: - sub_0804AA1C(super); + EnemyDetachFX(super); tmp = gUnk_080CBFE8[(*(Entity**)&super->contactedEntity)->type]; if (tmp < this->unk_82) { @@ -133,7 +133,7 @@ void sub_08025180(PuffstoolEntity* this) { super->timer = Random(); super->animationState = (((*(Entity**)&super->contactedEntity)->direction ^ 0x10) >> 3); InitializeAnimation(super, super->animationState + 4); - sub_0804AA1C(super); + EnemyDetachFX(super); } void sub_080251AC(PuffstoolEntity* this) { @@ -292,7 +292,7 @@ void sub_080254B4(PuffstoolEntity* this) { sub_080256B4(this); } else { super->action = 0xc; - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } InitializeAnimation(super, 0); } @@ -376,7 +376,7 @@ void sub_0802563C(PuffstoolEntity* this) { super->hitType = 0x82; this->unk_82 = 240; sub_080256B4(this); - sub_0804AA1C(super); + EnemyDetachFX(super); } else if (this->unk_84 < 120) { u32 tmp3 = gUnk_080CBFF8[this->unk_84 >> 4]; if ((this->unk_84 & tmp3) == 0) { diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index dc3af233..72e18f8d 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -49,7 +49,7 @@ void RockChuchu_OnCollision(Entity* this) { #ifndef EU entity->iframes = -8; #endif - sub_0804A4E4(this, entity); + EnemyCopyParams(this, entity); this->action = 2; COLLISION_OFF(this); this->spriteSettings.draw = 0; @@ -100,7 +100,7 @@ void sub_080223E4(Entity* this) { entity = this->child; if (entity != NULL) { - entity->contactFlags = 0x94; + entity->contactFlags = (CONTACT_NOW | 0x14); entity->iframes = 0x10; #ifndef EU entity->knockbackDuration = 0xc; diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index 0a1c9ba1..9630acd0 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -52,7 +52,7 @@ void Rollobite_OnCollision(RollobiteEntity* this) { InitializeAnimation(super, super->animationState + 8); } - if (super->contactFlags != 0x80) { + if (super->contactFlags != CONTACT_NOW) { if (super->action == 4 || super->action == 5) { super->action = 4; super->timer = 180; @@ -61,7 +61,7 @@ void Rollobite_OnCollision(RollobiteEntity* this) { } } - if (super->contactFlags == 0x93) + if (super->contactFlags == (CONTACT_NOW | 0x13)) Rollobite_OnTick(this); } @@ -188,16 +188,16 @@ void Rollobite_RolledUp(RollobiteEntity* this) { if ((super->frame & ANIM_DONE) == 0) GetNextFrame(super); - unk = sub_080044EC(super, 0x2800); + unk = BounceUpdate(super, Q_8_8(40.0)); - if (unk == 0) { + if (unk == BOUNCE_DONE_ALL) { if (--super->timer == 0) { super->action = 5; InitializeAnimation(super, super->animationState + 12); } RegisterCarryEntity(super); } else { - if (unk == 1) + if (unk == BOUNCE_INIT_NEXT) EnqueueSFX(SFX_PLACE_OBJ); if (!(super->direction & DIR_NOT_MOVING_CHECK)) diff --git a/src/enemy/rope.c b/src/enemy/rope.c index 3a07af0a..77fbafab 100644 --- a/src/enemy/rope.c +++ b/src/enemy/rope.c @@ -43,7 +43,7 @@ u32 sub_0803163C(RopeEntity* this); void Rope(RopeEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)Rope_Functions); - SetChildOffset(super, 0, 1, -16); + EnemySetFXOffset(super, 0, 1, -16); } void Rope_OnTick(RopeEntity* this) { @@ -63,7 +63,7 @@ void Rope_OnCollision(RopeEntity* this) { sub_08031600(this); } if (super->confusedTime) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, Rope_Functions); } diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index fd83dc53..0e653b80 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -45,7 +45,7 @@ void RopeGolden(RopeGoldenEntity* this) { gUnk_080012C8[x](super); } else { RopeGolden_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } } @@ -61,7 +61,7 @@ void RopeGolden_OnTick(RopeGoldenEntity* this) { void RopeGolden_OnCollision(RopeGoldenEntity* this) { if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, RopeGolden_Functions); } @@ -70,7 +70,7 @@ void RopeGolden_OnDeath(RopeGoldenEntity* this) { if ((super->gustJarState & 2) == 0) { SetGlobalFlag(super->type2); } - CreateDeathFx(super, 0xff, ITEM_RUPEE100); + EnemyCreateDeathFX((Enemy*)super, 0xff, ITEM_RUPEE100); } void sub_08038258(RopeGoldenEntity* this) { diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index b749e900..ada5434e 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -40,7 +40,7 @@ void RupeeLike(RupeeLikeEntity* this) { u32 uVar1; if (super->type2 == 0) { - uVar1 = (u8)sub_080043E8(super); + uVar1 = (u8)GetTileHazardType(super); if (uVar1 != 0) { if (super->action == 4) { sub_080296D8(this); @@ -48,7 +48,7 @@ void RupeeLike(RupeeLikeEntity* this) { sub_08001290(super, uVar1); } else { RupeeLike_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } } else { sub_080293DC(this); @@ -75,12 +75,12 @@ void RupeeLike_OnCollision(RupeeLikeEntity* this) { super->timer = 60; super->subtimer = 0; this->unk_83 = 0x41; - super->flags2 &= 0xfc; + super->collisionMask &= 0xfc; this->unk_80 = gPlayerEntity.base.spritePriority.b1; EnqueueSFX(SFX_PLACE_OBJ); } else { if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } } } @@ -88,7 +88,7 @@ void RupeeLike_OnCollision(RupeeLikeEntity* this) { } void RupeeLike_OnDeath(RupeeLikeEntity* this) { - CreateDeathFx(super, 0xff, gUnk_080CCC34[this->unk_84 * 3 + super->type]); + EnemyCreateDeathFX((Enemy*)super, 0xff, gUnk_080CCC34[this->unk_84 * 3 + super->type]); } void RupeeLike_OnGrabbed(RupeeLikeEntity* this) { @@ -255,7 +255,7 @@ void sub_080296D8(RupeeLikeEntity* this) { gPlayerEntity.base.speed = 0x140; super->action = 5; super->subtimer = 60; - super->flags2 |= 3; + super->collisionMask |= 3; if ((s8)super->iframes == 0) { super->iframes = 0xf4; } diff --git a/src/enemy/scissorsBeetle.c b/src/enemy/scissorsBeetle.c index 7b76a9fd..72bb2f8a 100644 --- a/src/enemy/scissorsBeetle.c +++ b/src/enemy/scissorsBeetle.c @@ -30,7 +30,7 @@ void sub_08038B90(ScissorsBeetleEntity*); void ScissorsBeetle(Entity* this) { EnemyFunctionHandler(this, ScissorsBeetle_Functions); - SetChildOffset(this, 0, 1, -0x10); + EnemySetFXOffset(this, 0, 1, -0x10); } void ScissorsBeetle_OnTick(ScissorsBeetleEntity* this) { @@ -40,11 +40,11 @@ void ScissorsBeetle_OnTick(ScissorsBeetleEntity* this) { void ScissorsBeetle_OnCollision(ScissorsBeetleEntity* this) { Entity* child; if (super->confusedTime) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, ScissorsBeetle_Functions); - if ((super->contactFlags & 0x80) && super->action != 4) { + if ((super->contactFlags & CONTACT_NOW) && super->action != 4) { u32 knockbackDir; child = super->child; child->iframes = super->iframes; diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 0a55ab40..536eec67 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -40,7 +40,7 @@ static void (*const Slime_Functions[])(SlimeEntity*) = { void Slime(SlimeEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)Slime_Functions); - SetChildOffset(super, 0, 1, -12); + EnemySetFXOffset(super, 0, 1, -12); } void Slime_OnTick(SlimeEntity* this) { @@ -58,7 +58,7 @@ void Slime_OnCollision(SlimeEntity* this) { } if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } } @@ -149,7 +149,7 @@ void sub_08045178(SlimeEntity* this, Entity* child, int offsetX, int offsetY) { if (child == NULL) return; - sub_0804A4E4(super, child); + EnemyCopyParams(super, child); if (GetCollisionDataRelativeTo(child, offsetX, offsetY)) return; diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index 2397c3aa..cd371ec4 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -23,7 +23,7 @@ void Sluggula(Entity* this) { if (this->type == 1) { EnemyFunctionHandler(this, Sluggula_Functions); - SetChildOffset(this, 0, 1, -0x10); + EnemySetFXOffset(this, 0, 1, -0x10); } else if (this->type == 0) { if (this->z.HALF.HI == 0) { u32 idx = sub_080012DC(this); @@ -34,7 +34,7 @@ void Sluggula(Entity* this) { } gUnk_080CBDD4[GetNextFunction(this)](this); - SetChildOffset(this, 0, 1, -0x10); + EnemySetFXOffset(this, 0, 1, -0x10); } else { sub_08023E10(this); } @@ -46,7 +46,7 @@ void Sluggula_OnTick(Entity* this) { void Sluggula_OnCollision(Entity* this) { if (this->confusedTime) - Create0x68FX(this, FX_STARS); + EnemyCreateFX(this, FX_STARS); if (this->type == 1) { EnemyFunctionHandlerAfterCollision(this, Sluggula_Functions); @@ -130,7 +130,7 @@ void sub_08023CE0(Entity* this) { if (this->frame & ANIM_DONE) { Entity* entity = CreateEnemy(SLUGGULA, 1); if (entity != NULL) { - sub_0804A4E4(this, entity); + EnemyCopyParams(this, entity); DeleteThisEntity(); } } else { diff --git a/src/enemy/spark.c b/src/enemy/spark.c index e135424b..79a65afe 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -22,7 +22,7 @@ void Spark_OnTick(Entity* this) { void Spark_OnCollision(Entity* this) { Entity* entity; - if (this->contactFlags & 0x80) { + if (this->contactFlags & CONTACT_NOW) { if ((this->contactFlags & 0x7f) == 0x14) { COLLISION_OFF(this); this->iframes = 0; diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c index 089f0ba8..271a4c23 100644 --- a/src/enemy/spearMoblin.c +++ b/src/enemy/spearMoblin.c @@ -42,7 +42,7 @@ extern const Hitbox* const gUnk_080CC944[]; void SpearMoblin(SpearMoblinEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)SpearMoblin_Functions); - SetChildOffset(super, 0, 1, -0x20); + EnemySetFXOffset(super, 0, 1, -0x20); if (super->child && super->child->next) { CopyPosition(super, super->child); } @@ -54,10 +54,10 @@ void SpearMoblin_OnTick(SpearMoblinEntity* this) { void SpearMoblin_OnCollision(SpearMoblinEntity* this) { if (super->confusedTime != 0) - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); EnemyFunctionHandlerAfterCollision(super, SpearMoblin_Functions); - if (super->contactFlags & 0x80) { + if (super->contactFlags & CONTACT_NOW) { if (super->action != 4) { sub_08028754(this); } else { @@ -398,7 +398,7 @@ bool32 sub_080288A4(SpearMoblinEntity* this) { void sub_080288C0(SpearMoblinEntity* this) { Entity* entity = super->child; - if ((entity != NULL) && (entity->contactFlags & 0x80)) { + if ((entity != NULL) && (entity->contactFlags & CONTACT_NOW)) { super->knockbackDirection = entity->knockbackDirection; super->iframes = -entity->iframes; super->knockbackSpeed = entity->knockbackSpeed; diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index 92406dda..4dcd1ec3 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -22,7 +22,7 @@ extern const s8 gUnk_080CD318[]; void SpikedBeetle(Entity* this) { EnemyFunctionHandler(this, SpikedBeetle_Functions); - SetChildOffset(this, 0, 1, -0x10); + EnemySetFXOffset(this, 0, 1, -0x10); } void SpikedBeetle_OnTick(Entity* this) { @@ -63,7 +63,7 @@ void SpikedBeetle_OnCollision(Entity* this) { } } if (this->confusedTime) { - Create0x68FX(this, FX_STARS); + EnemyCreateFX(this, FX_STARS); } EnemyFunctionHandlerAfterCollision(this, SpikedBeetle_Functions); } @@ -152,12 +152,12 @@ void sub_0802B880(Entity* this) { void sub_0802B8B0(Entity* this) { ProcessMovement2(this); - switch (sub_080044EC(this, 0x1800)) { - case 0: + switch (BounceUpdate(this, Q_8_8(24.0))) { + case BOUNCE_DONE_ALL: this->action = 7; this->timer = 150; /* fallthrough */ - case 1: + case BOUNCE_INIT_NEXT: EnqueueSFX(SFX_12B); break; } diff --git a/src/enemy/spinyBeetle.c b/src/enemy/spinyBeetle.c index 15d4f04e..34ad027e 100644 --- a/src/enemy/spinyBeetle.c +++ b/src/enemy/spinyBeetle.c @@ -37,7 +37,7 @@ extern u32 sub_0804A024(Entity*, u32, u32); void SpinyBeetle(Entity* this) { EnemyFunctionHandler(this, SpinyBeetle_Functions); - SetChildOffset(this, 0, 1, -0x10); + EnemySetFXOffset(this, 0, 1, -0x10); } void SpinyBeetle_OnTick(SpinyBeetleEntity* this) { @@ -46,11 +46,11 @@ void SpinyBeetle_OnTick(SpinyBeetleEntity* this) { void SpinyBeetle_OnCollision(SpinyBeetleEntity* this) { if (super->confusedTime) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, SpinyBeetle_Functions); - if (super->contactFlags & 0x80) { + if (super->contactFlags & CONTACT_NOW) { if (super->iframes > 0 && super->child) { sub_08033E1C(this); } diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index 03b7f09c..72329b9f 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -27,7 +27,7 @@ extern Entity* gUnk_020000B0; void SpinyChuchu(SpinyChuchuEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)SpinyChuchu_Functions); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void SpinyChuchu_OnTick(SpinyChuchuEntity* this) { @@ -55,13 +55,13 @@ void SpinyChuchu_OnCollision(SpinyChuchuEntity* this) { case 0x18: case 0x19: case 0x1a: - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); super->action = 5; super->hitType = 0x5c; InitializeAnimation(super, 1); } - } else if (super->contactFlags == 0x94) { - Create0x68FX(super, FX_STARS); + } else if (super->contactFlags == (CONTACT_NOW | 0x14)) { + EnemyCreateFX(super, FX_STARS); super->action = 5; InitializeAnimation(super, 1); } @@ -216,7 +216,7 @@ void sub_0802281C(SpinyChuchuEntity* this) { super->action = 2; super->speed = 0x20; InitializeAnimation(super, 0); - sub_0804AA1C(super); + EnemyDetachFX(super); } } diff --git a/src/enemy/stalfos.c b/src/enemy/stalfos.c index 6a42dd3f..8af47b4f 100644 --- a/src/enemy/stalfos.c +++ b/src/enemy/stalfos.c @@ -49,7 +49,7 @@ u32 sub_08039B28(StalfosEntity*); void Stalfos(StalfosEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)&Stalfos_Functions); - SetChildOffset(super, 0, 1, -0x12); + EnemySetFXOffset(super, 0, 1, -0x12); } void Stalfos_OnTick(StalfosEntity* this) { @@ -93,7 +93,7 @@ void Stalfos_OnCollision(StalfosEntity* this) { r1 = super->child; if (r1 == NULL) { if (super->action < 9) { - r1 = CreateProjectileWithParent(super, STALFOS_PROJECTILE, 1); + r1 = EnemyCreateProjectile(super, STALFOS_PROJECTILE, 1); if (r1 != NULL) { r1->frameIndex = super->animationState << 1; r1->type2 = 2; @@ -110,17 +110,17 @@ void Stalfos_OnCollision(StalfosEntity* this) { sub_08039A48(this); this->unk_78 += 0x5a; } - super->flags2 &= 0xfb; + super->collisionMask &= 0xfb; } if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, Stalfos_Functions); } void Stalfos_OnDeath(StalfosEntity* this) { if (super->type == 0) { - CreateDeathFx(super, 0xf3, 0); + EnemyCreateDeathFX((Enemy*)super, 0xf3, 0); } else { GenericDeath(super); } @@ -144,7 +144,7 @@ void Stalfos_SubAction1(StalfosEntity* this) { void Stalfos_SubAction2(StalfosEntity* this) { Entity* projectile = super->child; if (projectile == NULL) { - projectile = CreateProjectileWithParent(super, STALFOS_PROJECTILE, 1); + projectile = EnemyCreateProjectile(super, STALFOS_PROJECTILE, 1); if (projectile != NULL) { projectile->frameIndex = super->animationState << 1; projectile->type2 = 1; @@ -154,7 +154,7 @@ void Stalfos_SubAction2(StalfosEntity* this) { } super->child = NULL; super->gustJarState &= 0xfb; - super->flags2 &= 0xfb; + super->collisionMask &= 0xfb; sub_08039A48(this); this->unk_78 += 0x5a; } @@ -280,7 +280,7 @@ void Stalfos_Action12(StalfosEntity* this) { } else { sub_08039A48(this); } - super->flags2 |= 4; + super->collisionMask |= 4; this->unk_78 += 0x3c; } } @@ -397,7 +397,7 @@ void sub_08039A00(StalfosEntity* this, u32 param_2) { } void sub_08039A20(StalfosEntity* this) { - Entity* projectile = CreateProjectileWithParent(super, BONE_PROJECTILE, 0); + Entity* projectile = EnemyCreateProjectile(super, BONE_PROJECTILE, 0); if (projectile != NULL) { projectile->direction = super->direction; this->unk_7c = 0x3c; @@ -432,7 +432,7 @@ void sub_08039A70(StalfosEntity* this) { void sub_08039AD4(StalfosEntity* this) { u32 position = sub_08039B28(this); if (position != 0xffff) { - Entity* projectile = CreateProjectileWithParent(super, STALFOS_PROJECTILE, super->type2); + Entity* projectile = EnemyCreateProjectile(super, STALFOS_PROJECTILE, super->type2); if (projectile != NULL) { projectile->parent = super; super->action = 0xb; diff --git a/src/enemy/takkuri.c b/src/enemy/takkuri.c index 20dd168a..fc5c90bd 100644 --- a/src/enemy/takkuri.c +++ b/src/enemy/takkuri.c @@ -46,7 +46,7 @@ void Takkuri_OnTick(TakkuriEntity* this) { } void Takkuri_OnCollision(TakkuriEntity* this) { - if (super->contactFlags & 0x80) { + if (super->contactFlags & CONTACT_NOW) { if ((super->contactFlags & 0x7f) == 0) { u32 direction; sub_0803C0AC(super); diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index e2c07aae..08de7ef8 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -38,7 +38,7 @@ static void (*const Tektite_Functions[])(TektiteEntity*) = { void Tektite(TektiteEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)Tektite_Functions); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void Tektite_OnTick(TektiteEntity* this) { @@ -60,10 +60,10 @@ static const u8 gUnk_080CDEF8[] = { void Tektite_OnCollision(TektiteEntity* this) { if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, Tektite_Functions); - if ((super->contactFlags & 0x80) != 0) { + if ((super->contactFlags & CONTACT_NOW) != 0) { switch (super->contactFlags & 0x3f) { case 0x14: super->action = 1; @@ -147,7 +147,7 @@ void sub_0802F300(TektiteEntity* this) { temp = super->z.HALF.HI; rand = Random() & 0xf; - if (sub_080044EC(super, this->unk_80) == 1) { + if (BounceUpdate(super, this->unk_80) == BOUNCE_INIT_NEXT) { super->action = 3; super->subAction = 0; if (super->type != 0) { diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index 0e4d8366..290ae3f1 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -33,7 +33,7 @@ static void (*const TektiteGolden_Functions[])(TektiteGoldenEntity*) = { void TektiteGolden(TektiteGoldenEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)TektiteGolden_Functions); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void TektiteGolden_OnTick(TektiteGoldenEntity* this) { @@ -48,10 +48,10 @@ void TektiteGolden_OnTick(TektiteGoldenEntity* this) { void TektiteGolden_OnCollision(TektiteGoldenEntity* this) { if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, TektiteGolden_Functions); - if (super->contactFlags == 0x94) { + if (super->contactFlags == (CONTACT_NOW | 0x14)) { super->action = 1; super->subAction = 0; super->timer = 20; @@ -78,7 +78,7 @@ void TektiteGolden_OnDeath(TektiteGoldenEntity* this) { } else { uVar1 = ITEM_RUPEE100; } - CreateDeathFx(super, 0xff, uVar1); + EnemyCreateDeathFX((Enemy*)super, 0xff, uVar1); } void TektiteGolden_OnConfused(TektiteGoldenEntity* this) { @@ -129,7 +129,7 @@ void sub_08038048(TektiteGoldenEntity* this) { temp = super->z.HALF.HI; rand = Random() & 0xf; - if (sub_080044EC(super, 0x3000) == 1) { + if (BounceUpdate(super, Q_8_8(48.0)) == BOUNCE_INIT_NEXT) { super->action = 3; super->subAction = 0; super->timer = 20; diff --git a/src/enemy/torchTrap.c b/src/enemy/torchTrap.c index 73dee83a..bf066844 100644 --- a/src/enemy/torchTrap.c +++ b/src/enemy/torchTrap.c @@ -122,7 +122,7 @@ void TorchTrap_Reset(TorchTrapEntity* this) { } void TorchTrap_CreateProjectile(TorchTrapEntity* this) { - Entity* proj = CreateProjectileWithParent(super, TORCH_TRAP_PROJECTILE, 0); + Entity* proj = EnemyCreateProjectile(super, TORCH_TRAP_PROJECTILE, 0); if (proj) { u16 speed = super->speed; if (super->speed) { diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index 4cb85e5f..2e1e9a34 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -5,6 +5,7 @@ * @brief Tree Item enemy */ #include "enemy.h" +#include "functions.h" #include "item.h" #include "object.h" @@ -15,8 +16,6 @@ typedef struct { static bool32 ShouldSpawnTreeItem(TreeItemEntity*); -extern void SetRoomTrackerFlag(Entity*); - const u8 gTreeItemDropTables[][16] = { { 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, @@ -74,7 +73,7 @@ void TreeItem(TreeItemEntity* this) { break; } - SetRoomTrackerFlag(super); + EnemyDisableRespawn(super); DeleteThisEntity(); } diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index 476730df..facc5527 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -43,7 +43,7 @@ typedef struct VaatiArm_HeapStruct { VaatiArm_HeapStruct1 s1[5]; } VaatiArm_HeapStruct; -extern void sub_0804AA1C(Entity*); +extern void EnemyDetachFX(Entity*); static u32 sub_080437DC(VaatiArmEntity*); static bool32 sub_08043C98(VaatiArmEntity*); @@ -835,7 +835,7 @@ static void sub_08043130(VaatiArmEntity* this) { if (super->spriteSettings.draw == 0) { super->subAction = 9; super->timer = 60; - sub_0804AA1C(super); + EnemyDetachFX(super); } } } @@ -913,7 +913,7 @@ void sub_080432A8(VaatiArmEntity* this) { super->subAction = 1; super->timer = 0x1e; ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk04.HWORD = 0x4000; - sub_0804AA1C(&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base); + EnemyDetachFX(&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base); } } @@ -1066,7 +1066,7 @@ static void sub_08043580(VaatiArmEntity* this) { entity->collisionFlags = entity->collisionFlags | 0x10; entity->hitType = 0x39; entity->hitbox = (Hitbox*)&gUnk_080FD538; - sub_0804AA1C(super); + EnemyDetachFX(super); } } @@ -1401,7 +1401,7 @@ static void sub_08043C40(VaatiArmEntity* this, VaatiArm_HeapStruct1* heapStruct) static bool32 sub_08043C98(VaatiArmEntity* this) { #if defined EU || defined JP Entity* e1 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; - if ((e1->contactFlags == 0x9d)) { + if ((e1->contactFlags == (CONTACT_NOW | 0x1d))) { sub_08043D08(this); return TRUE; } else { @@ -1410,7 +1410,7 @@ static bool32 sub_08043C98(VaatiArmEntity* this) { #else Entity* e1 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base; Entity* e2 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; - if ((e1->contactFlags == 0x9d) || (e2->contactFlags == 0x9d)) { + if ((e1->contactFlags == (CONTACT_NOW | 0x1d)) || (e2->contactFlags == (CONTACT_NOW | 0x1d))) { sub_08043D08(this); gRoomTransition.field_0x38 |= 2; return TRUE; @@ -1423,7 +1423,7 @@ static bool32 sub_08043C98(VaatiArmEntity* this) { static void sub_08043CD4(VaatiArmEntity* this) { u32 i; for (i = 0; i < 5; i++) { - if (((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.contactFlags == 0x9d) { + if (((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.contactFlags == (CONTACT_NOW | 0x1d)) { this->unk_7c = 0x78; this->unk_7d = i; return; @@ -1443,7 +1443,7 @@ static void sub_08043D08(VaatiArmEntity* this) { entity->flags &= ~ENT_COLLIDE; entity->spriteSettings.draw = 0; InitializeAnimation(entity, 0x13); - sub_0804AA1C(entity); + EnemyDetachFX(entity); fx = CreateFx(entity, FX_GIANT_EXPLOSION4, 0); if (fx != NULL) { fx->x.HALF.HI += gUnk_080D13E9[super->type2]; diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 7e0d04a6..94e040be 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -58,7 +58,7 @@ void VaatiBall(VaatiBallEntity* this) { super->health = -1; } - if (super->contactFlags & 0x80) { + if (super->contactFlags & CONTACT_NOW) { if ((super->contactFlags & 0x3f) == 0 && super->action == 6) { ModHealth(-2); } @@ -213,7 +213,7 @@ void sub_08044868(VaatiBallEntity* this) { if (vaati->unk_86 > 1) { u8 draw = super->spriteSettings.draw; if (draw == 1 && this->unk_84 == 0) { - vaati = (VaatiBallEntity*)CreateProjectileWithParent(super, V1_DARK_MAGIC_PROJECTILE, 0); + vaati = (VaatiBallEntity*)EnemyCreateProjectile(super, V1_DARK_MAGIC_PROJECTILE, 0); if (vaati) { vaati->base.type2 = 1; vaati->base.parent = super; @@ -303,7 +303,7 @@ void sub_080449F8(VaatiBallEntity* this) { this->unk_74++; draw = super->spriteSettings.draw; if (draw) { - vaati = (VaatiBallEntity*)CreateProjectileWithParent(super, V1_EYE_LASER, 0); + vaati = (VaatiBallEntity*)EnemyCreateProjectile(super, V1_EYE_LASER, 0); if (vaati) { vaati->base.y.HALF.HI += 4; vaati->base.parent = super; diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index d6766348..d5624de0 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -62,7 +62,7 @@ const u16 gUnk_080CDE98[] = { 0xc0, 0x100, 0x140, 0x180 }; void VaatiEyesMacro(VaatiEyesMacroEntity* this) { VaatiEyesMacro_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void VaatiEyesMacro_OnTick(VaatiEyesMacroEntity* this) { @@ -98,7 +98,7 @@ void VaatiEyesMacro_OnCollision(VaatiEyesMacroEntity* this) { } } if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)VaatiEyesMacro_Functions); } diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index d1f4713a..5a43f66f 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -67,7 +67,7 @@ void VaatiProjectile_OnTick(VaatiProjectileEntity* this) { void VaatiProjectile_OnCollision(VaatiProjectileEntity* this) { Entity* entity; - if (super->contactFlags == 0x80) { + if (super->contactFlags == CONTACT_NOW) { #ifndef EU if (super->health != 0) { #endif @@ -119,7 +119,7 @@ void VaatiProjectileFunction0Action0(VaatiProjectileEntity* this) { } else { super->action = 9; super->z.HALF.HI = -0x80; - super->flags2 = 1; + super->collisionMask = 1; } InitializeAnimation(super, 0); } diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index 7ff9174e..5463b4f0 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -369,7 +369,7 @@ void VaatiRebornEnemyType0Action4(VaatiRebornEnemyEntity* this) { super->subtimer = 0; } if ((super->subtimer < 0x10) && - (entity = CreateProjectileWithParent(super, V1_FIRE_PROJECTILE, this->unk_84), entity != NULL)) { + (entity = EnemyCreateProjectile(super, V1_FIRE_PROJECTILE, this->unk_84), entity != NULL)) { entity->subtimer = super->subtimer; entity->parent = super; entity->z.HALF.HI = super->z.HALF.HI; @@ -456,7 +456,7 @@ void VaatiRebornEnemyType0Action6(VaatiRebornEnemyEntity* this) { if (--super->timer == 0) { this->unk_74++; SoundReq(SFX_150); - target = CreateProjectileWithParent(super, V1_DARK_MAGIC_PROJECTILE, 0); + target = EnemyCreateProjectile(super, V1_DARK_MAGIC_PROJECTILE, 0); if (target != NULL) { PositionRelative(super, target, 0, Q_16_16(-16.0)); target->parent = super; @@ -539,7 +539,7 @@ void VaatiRebornEnemyType1Action1(VaatiRebornEnemyEntity* this) { super->hitType = 0x2f; InitAnimationForceUpdate(super, this->unk_74); } else { - if (((super->contactFlags & 0x80) != 0) && (0 < super->iframes)) { + if (((super->contactFlags & CONTACT_NOW) != 0) && (0 < super->iframes)) { parent->iframes = super->iframes; parent->contactFlags = super->contactFlags; } @@ -665,7 +665,7 @@ void VaatiRebornEnemyType1PreAction(VaatiRebornEnemyEntity* this) { } parent = super->parent; this->unk_77 = 0; - if ((super->contactFlags & 0x80) != 0) { + if ((super->contactFlags & CONTACT_NOW) != 0) { if (gUnk_080D04D0[((VaatiRebornEnemyEntity*)parent)->unk_86] > super->health) { if (2 < ++((VaatiRebornEnemyEntity*)parent)->unk_86) { COLLISION_OFF(super); diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 265b5a98..663133fe 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -288,7 +288,7 @@ void VaatiTransfiguredType0Action3(VaatiTransfiguredEntity* this) { switch (this->unk_80) { case 0: - uVar4 = sub_080044EC(super, 0x2800); + uVar4 = BounceUpdate(super, Q_8_8(40.0)); if (uVar4 != 1) break; this->unk_80 = 1; @@ -436,7 +436,7 @@ void VaatiTransfiguredType0Action4(VaatiTransfiguredEntity* this) { super->timer = gUnk_080D0ABF[((u32)super->animationState << 1 | 1)]; } else { if ((super->timer & 7) == 0) { - CreateProjectileWithParent(super, V2_PROJECTILE, super->subtimer); + EnemyCreateProjectile(super, V2_PROJECTILE, super->subtimer); } if (((super->subtimer != 0) && (1 < super->animationState)) && (super->timer < 6)) { super->timer = 128; @@ -482,7 +482,7 @@ void VaatiTransfiguredType0Action5(VaatiTransfiguredEntity* this) { } else { if (super->subtimer) { if ((super->timer & 7) == 0) { - CreateProjectileWithParent(super, V2_PROJECTILE, super->subtimer); + EnemyCreateProjectile(super, V2_PROJECTILE, super->subtimer); } if (super->timer < 6) { super->timer = 64; @@ -490,7 +490,7 @@ void VaatiTransfiguredType0Action5(VaatiTransfiguredEntity* this) { } } else { if ((super->timer & 0xf) == 0) { - entity = CreateProjectileWithParent(super, V2_PROJECTILE, 2); + entity = EnemyCreateProjectile(super, V2_PROJECTILE, 2); if (entity != NULL) { entity->type2 = 0; if (this->unk_81 != 0) { @@ -534,7 +534,7 @@ void VaatiTransfiguredType0Action6(VaatiTransfiguredEntity* this) { } else { if (super->subtimer) { if ((super->timer & 7) == 0) { - CreateProjectileWithParent(super, V2_PROJECTILE, super->subtimer); + EnemyCreateProjectile(super, V2_PROJECTILE, super->subtimer); } if (super->timer < 6) { super->timer = 128; @@ -542,7 +542,7 @@ void VaatiTransfiguredType0Action6(VaatiTransfiguredEntity* this) { } } else { if ((super->timer & 0x1f) == 0) { - pEVar2 = CreateProjectileWithParent(super, V2_PROJECTILE, 2); + pEVar2 = EnemyCreateProjectile(super, V2_PROJECTILE, 2); if (pEVar2 != NULL) { pEVar2->type2 = 1; pEVar2->y.HALF.HI += -0x20; @@ -1097,11 +1097,11 @@ void sub_080409B0(VaatiTransfiguredEntity* this) { Knockback1(super); } } else { - if (((super->contactFlags & 0x80) != 0) && (0 < super->iframes)) { + if (((super->contactFlags & CONTACT_NOW) != 0) && (0 < super->iframes)) { InitScreenShake(12, 1); SoundReq(SFX_BOSS_HIT); } - if ((super->contactFlags == 0x8a) && (gPlayerState.chargeState.action == 5)) { + if ((super->contactFlags == (CONTACT_NOW | 0xa)) && (gPlayerState.chargeState.action == 5)) { super->health = 0xc0; } } diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index e417c2fd..c3e33442 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -72,7 +72,7 @@ void VaatiTransfiguredEye_OnCollision(VaatiTransfiguredEyeEntity* this) { if (super->type != 0) { pEVar4 = super->parent->parent; - if ((super->contactFlags & 0x80) != 0) { + if ((super->contactFlags & CONTACT_NOW) != 0) { bVar1 = super->contactFlags & 0x3f; if ((bVar1 == 0xe) || (bVar1 == 0x15)) { diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index b8bd9b20..21f5c506 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -101,7 +101,7 @@ const s8 gUnk_080D0EB0[] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd }; void VaatiWrath(VaatiWrathEntity* this) { - if (((super->type == 0) && ((super->contactFlags & 0x80) != 0)) && (super->health == 0)) { + if (((super->type == 0) && ((super->contactFlags & CONTACT_NOW) != 0)) && (super->health == 0)) { COLLISION_ON(super); super->health = 0xff; if (--this->unk_84 == 0) { diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index 8f37a64f..e48becaa 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -30,7 +30,7 @@ extern const s8 gUnk_080CD0B0[]; void WallMaster(WallMasterEntity* this) { WallMaster_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void WallMaster_OnTick(WallMasterEntity* this) { @@ -55,7 +55,7 @@ void WallMaster_OnCollision(WallMasterEntity* this) { super->knockbackDuration -= 4; if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)WallMaster_Functions); diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index e5a20d2c..63f14826 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -34,7 +34,7 @@ extern const s8 gUnk_080CD740[]; void WallMaster2(WallMaster2Entity* this) { WallMaster2_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void WallMaster2_OnTick(WallMaster2Entity* this) { @@ -53,7 +53,7 @@ void WallMaster2_OnCollision(WallMaster2Entity* this) { break; } if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)WallMaster2_Functions); } diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index 1ed368b6..e5c4c5e5 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -57,7 +57,7 @@ void Wisp_OnCollision(WispEntity* this) { Entity* entity; bits = super->contactFlags; - if ((bits & 0x80) == 0) { + if ((bits & CONTACT_NOW) == 0) { return; } diff --git a/src/enemy/wizzrobeFire.c b/src/enemy/wizzrobeFire.c index cf78d2bb..d032ecb9 100644 --- a/src/enemy/wizzrobeFire.c +++ b/src/enemy/wizzrobeFire.c @@ -13,7 +13,7 @@ extern void (*const WizzrobeFire_Actions[])(WizzrobeEntity*); void WizzrobeFire(WizzrobeEntity* this) { WizzrobeFire_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void WizzrobeFire_OnTick(WizzrobeEntity* this) { @@ -22,7 +22,7 @@ void WizzrobeFire_OnTick(WizzrobeEntity* this) { void WizzrobeFire_OnCollision(WizzrobeEntity* this) { if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, WizzrobeFire_Functions); if (super->health == 0) { @@ -40,7 +40,7 @@ void WizzrobeFire_Init(WizzrobeEntity* this) { super->timer = 40; super->subtimer = 96; sub_0802F888(this); - projectile = CreateProjectileWithParent(super, FIRE_PROJECTILE, 0); + projectile = EnemyCreateProjectile(super, FIRE_PROJECTILE, 0); if (projectile != NULL) { super->child = projectile; projectile->parent = super; @@ -96,7 +96,7 @@ void WizzrobeFire_Action2(WizzrobeEntity* this) { break; case 6: if (EntityInRectRadius(super, &gPlayerEntity.base, 0xa0, 0xa0) && CheckOnScreen(super)) { - Entity* projectile = CreateProjectileWithParent(super, FIRE_PROJECTILE, 1); + Entity* projectile = EnemyCreateProjectile(super, FIRE_PROJECTILE, 1); if (projectile != NULL) { projectile->direction = super->direction & 0x18; } diff --git a/src/enemy/wizzrobeIce.c b/src/enemy/wizzrobeIce.c index 074d997a..c8185345 100644 --- a/src/enemy/wizzrobeIce.c +++ b/src/enemy/wizzrobeIce.c @@ -14,7 +14,7 @@ extern void (*const WizzrobeIce_Actions[])(WizzrobeEntity*); void WizzrobeIce(WizzrobeEntity* this) { WizzrobeIce_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void WizzrobeIce_OnTick(WizzrobeEntity* this) { @@ -23,10 +23,10 @@ void WizzrobeIce_OnTick(WizzrobeEntity* this) { void WizzrobeIce_OnCollision(WizzrobeEntity* this) { if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, WizzrobeIce_Functions); - if (super->contactFlags == 0x87) { + if (super->contactFlags == (CONTACT_NOW | 0x7)) { Entity* obj = CreateObject(FLAME, 3, 0); if (obj != NULL) { obj->spritePriority.b0 = 3; @@ -49,7 +49,7 @@ void WizzrobeIce_Init(WizzrobeEntity* this) { super->timer = 40; super->subtimer = 96; sub_0802F888(this); - projectile = CreateProjectileWithParent(super, ICE_PROJECTILE, 0); + projectile = EnemyCreateProjectile(super, ICE_PROJECTILE, 0); if (projectile != NULL) { super->child = projectile; projectile->parent = super; @@ -103,7 +103,7 @@ void WizzrobeIce_Action2(WizzrobeEntity* this) { break; case 0xa: if (EntityInRectRadius(super, &gPlayerEntity.base, 0xa0, 0xa0) && CheckOnScreen(super)) { - Entity* projectile = CreateProjectileWithParent(super, ICE_PROJECTILE, 1); + Entity* projectile = EnemyCreateProjectile(super, ICE_PROJECTILE, 1); if (projectile != NULL) { projectile->direction = super->direction & 0x18; } diff --git a/src/enemy/wizzrobeWind.c b/src/enemy/wizzrobeWind.c index 018e6b2d..e1b62c85 100644 --- a/src/enemy/wizzrobeWind.c +++ b/src/enemy/wizzrobeWind.c @@ -23,7 +23,7 @@ void sub_0802F8E4(WizzrobeEntity*); void WizzrobeWind(WizzrobeEntity* this) { WizzrobeWind_Functions[GetNextFunction(super)](this); - SetChildOffset(super, 0, 1, -0x10); + EnemySetFXOffset(super, 0, 1, -0x10); } void WizzrobeWind_OnTick(WizzrobeEntity* this) { @@ -32,10 +32,10 @@ void WizzrobeWind_OnTick(WizzrobeEntity* this) { void WizzrobeWind_OnCollision(WizzrobeEntity* this) { if (super->confusedTime != 0) { - Create0x68FX(super, FX_STARS); + EnemyCreateFX(super, FX_STARS); } EnemyFunctionHandlerAfterCollision(super, WizzrobeWind_Functions); - if (super->contactFlags == 0x87) { + if (super->contactFlags == (CONTACT_NOW | 0x7)) { Entity* obj = CreateObject(FLAME, 3, 0); if (obj != NULL) { obj->spritePriority.b0 = 3; @@ -68,7 +68,7 @@ void WizzrobeWind_Init(WizzrobeEntity* this) { super->subtimer = 96; sub_0802F888(this); } - projectile = CreateProjectileWithParent(super, WIND_PROJECTILE, 0); + projectile = EnemyCreateProjectile(super, WIND_PROJECTILE, 0); if (projectile != NULL) { super->parent = projectile; projectile->parent = super; @@ -121,7 +121,7 @@ void WizzrobeWind_Action2(WizzrobeEntity* this) { break; case 8: if (EntityInRectRadius(super, &gPlayerEntity.base, 0xa0, 0xa0) && CheckOnScreen(super)) { - Entity* projectile = CreateProjectileWithParent(super, WIND_PROJECTILE, 1); + Entity* projectile = EnemyCreateProjectile(super, WIND_PROJECTILE, 1); if (projectile != NULL) { projectile->direction = super->direction & 0x18; } @@ -192,7 +192,7 @@ void WizzrobeWind_Action3(WizzrobeEntity* this) { parent->spriteSettings.draw = 0; InitializeAnimation(super, super->animationState >> 1); } else if (super->timer == 8) { - parent = CreateProjectileWithParent(super, WIND_PROJECTILE, 1); + parent = EnemyCreateProjectile(super, WIND_PROJECTILE, 1); if (parent != NULL) { parent->direction = super->direction & 0x18; } |
