diff options
| author | Behemoth <Luisscheurenbrand@gmail.com> | 2020-09-01 00:57:40 +0200 |
|---|---|---|
| committer | Behemoth <Luisscheurenbrand@gmail.com> | 2020-09-01 00:58:36 +0200 |
| commit | 662e221f89aaaed63e80c167822d5d51bf5e172e (patch) | |
| tree | 112d6f35534ea9b047af9b3c725627944825fe93 /src | |
| parent | cc5bb0133b20733958f2c112917f26314c681d54 (diff) | |
label a bunch of stuff
Diffstat (limited to 'src')
36 files changed, 434 insertions, 429 deletions
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 98e6f254..03e02143 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -4,7 +4,6 @@ extern u32 sub_080002D4(s32, s32, u32); extern s32 sub_080012DC(Entity*); -extern void sub_08001324(Entity*); extern u32 sub_080044EC(Entity*, u32); extern u32 sub_08031E04(Entity*); extern void sub_08031E48(Entity*, Entity*); @@ -344,7 +343,7 @@ void sub_08031EE8(Entity* this) { if (this->height.HALF.HI < 1) { draw = this->spriteSettings.b.draw; if (!draw) - sub_08004488(299); + EnqueSFX(299); this->spriteSettings.b.draw = 1; } @@ -415,7 +414,7 @@ void sub_08032008(Entity* this) { this->spriteSettings.b.flipX = (this->direction >> 4 ^ 1); - sub_080AEF88(this); + ProcessMovement(this); } else { if (this->field_0x76.HALF.HI == 0) { if (sub_0806FCB8(this, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) { diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index 3bdbfdad..a454402a 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -2,7 +2,7 @@ #include "functions.h" #include "player.h" -extern u32 sub_08049F64(Entity*, u32, u32); +extern u32 PlayerInRange(Entity*, u32, u32); u32 sub_08021D00(); void sub_08021D44(Entity* this, u32 param_2); @@ -86,7 +86,7 @@ void sub_08021888(Entity* this) { sub_08021818(this); } -void sub_0802189C(Entity* this) { +void Beetle_Initialize(Entity* this) { sub_0804A720(this); this->action = 1; this->field_0x1c = 1; @@ -131,7 +131,7 @@ void sub_08021984(Entity* this) { this->height.HALF.HI = -0x80; this->spriteRendering.b3 = 1; this->spriteOrientation.flipY = 1; - sub_08004488(0x12d); + EnqueSFX(0x12d); } if (sub_08003FC4(this, 0x1800) == 0) { @@ -178,7 +178,7 @@ void sub_08021A64(Entity* this) { } sub_08021D44(this, tmp); } - sub_080AEF88(this); + ProcessMovement(this); GetNextFrame(this); } } @@ -198,7 +198,7 @@ void sub_08021AD8(Entity* this) { return; } this->direction = (u8)tmp; - sub_08004488(0x7c); + EnqueSFX(0x7c); } sub_080AEFE0(this); if (!sub_08003FC4(this, 0x1800)) @@ -292,7 +292,7 @@ u32 sub_08021D00(Entity* this) { if (((u8*)&this->field_0x86)[0]) { ((u8*)&this->field_0x86)[0]--; ret = 0; - } else if (sub_08049F64(this, 1, 0x10) == 0) { + } else if (PlayerInRange(this, 1, 0x10) == 0) { ret = 0; } else { this->action = 4; @@ -305,11 +305,10 @@ u32 sub_08021D00(Entity* this) { return ret; } -void sub_08021D44(Entity* this, u32 param_2) { - param_2 += 4; - param_2 &= 0x18; - this->direction = param_2; - if (param_2 & 8) { +void sub_08021D44(Entity* this, u32 direction) { + direction = DirectionRoundUp(direction); + this->direction = direction; + if (DirectionIsHorizontal(direction)) { this->nonPlanarMovement = 0x180; } else { this->nonPlanarMovement = 0xc0; @@ -328,7 +327,7 @@ void (*const gUnk_080CB590[])(Entity*) = { }; void (*const gUnk_080CB5A8[])(Entity*) = { - sub_0802189C, + Beetle_Initialize, sub_080218B4, sub_08021A10, sub_08021A64, diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 7f77861c..2229aec2 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -3,7 +3,7 @@ #include "room.h" extern void sub_080A2CC0(); extern void sub_0806F69C(); -extern void sub_08004488(); +extern void EnqueSFX(); extern Entity* GetCurrentRoomProperty(); void BladeTrap(Entity* ent) { @@ -27,7 +27,7 @@ void BladeTrap(Entity* ent) { *puVar3 = uVar1 - 1; if ((*puVar3) == 0) { if ((u16)(ent->direction & 0x80) == 0) { - sub_08004488(0x74); + EnqueSFX(0x74); } sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, puVar3); } diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index 8dc5948c..738d2c13 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -6,7 +6,7 @@ extern s32 sub_080012DC(Entity*); extern void sub_08001318(Entity*); extern void sub_080043A8(Entity*); extern u32 sub_08049F1C(Entity*, Entity*, u32); -extern u32 sub_08049F64(Entity*, u32, u32); +extern u32 PlayerInRange(Entity*, u32, u32); extern void sub_0804AA1C(Entity*); extern void sub_080AF160(Entity*); @@ -25,7 +25,7 @@ void sub_0801FB14(Entity*); void sub_0801FB34(Entity*); void sub_0801FB68(Entity*); u32 sub_0801FBD0(Entity*); -void sub_0801FBE4(Entity*); +void Chuchu_JumpAtPlayer(Entity*); extern void (*const gUnk_080012C8[])(Entity*); extern void (*const gUnk_080CA21C[])(Entity*); @@ -78,7 +78,7 @@ void Chuchu(Entity* this) { } } -void sub_0801EEE4(Entity* this) { +void Chuchu_OnTick(Entity* this) { switch (this->entityType.form) { case 0: sub_0801F3AC(this); @@ -193,13 +193,13 @@ void sub_0801F12C(Entity* this) { if ((this->field_0xf++ & 7) == 0) { this->direction = sub_08049F84(this, 1); } - sub_080AEF88(this); + ProcessMovement(this); GetNextFrame(this); if (--this->actionDelay == 0) { - if (sub_08049F64(this, 1, 0x38)) { + if (PlayerInRange(this, 1, 0x38)) { this->action = 4; - sub_0801FBE4(this); - } else if (sub_08049F64(this, 1, 0x48)) { + Chuchu_JumpAtPlayer(this); + } else if (PlayerInRange(this, 1, 0x48)) { this->actionDelay = (Random() & 3) + 0xc; } else { sub_0801F328(this); @@ -213,7 +213,7 @@ void sub_0801F1B0(Entity* this) { if (this->frames.all & 1) { this->frames.all ^= 1; this->damageType = 90; - sub_08004488(299); + EnqueSFX(299); } sub_080AEFE0(this); if (sub_08003FC4(this, 0x4000) == 0) @@ -313,7 +313,7 @@ void sub_0801F3AC(Entity* this) { return; if (sub_08049FDC(this, 1)) { - if (this->field_0x82.HALF.LO || sub_08049F64(this, 1, 0x48)) { + if (this->field_0x82.HALF.LO || PlayerInRange(this, 1, 0x48)) { if (this->action == 1) { this->action = 2; this->spriteSettings.b.draw = 1; @@ -377,10 +377,10 @@ void sub_0801F508(Entity* this) { sub_0801F730(this); } else { u8 tmp = ++this->actionDelay & 7; - if (tmp == 0 && sub_08049F64(this, 1, 0x38)) { + if (tmp == 0 && PlayerInRange(this, 1, 0x38)) { if (Random() & 1) { this->action = 5; - sub_0801FBE4(this); + Chuchu_JumpAtPlayer(this); } else { this->field_0x82.HALF.HI = 120; sub_0801F730(this); @@ -389,7 +389,7 @@ void sub_0801F508(Entity* this) { if (tmp == 4) { this->direction = sub_08049F84(this, 1); } - sub_080AEF88(this); + ProcessMovement(this); GetNextFrame(this); } } @@ -400,7 +400,7 @@ void sub_0801F584(Entity* this) { if (this->frames.all & 0x1) { this->frames.all ^= 1; this->damageType = 91; - sub_08004488(299); + EnqueSFX(299); } sub_080AEFE0(this); if (sub_08003FC4(this, 0x4000) == 0) @@ -493,7 +493,7 @@ void sub_0801F764(Entity* this) { if (sub_08049FDC(this, 1)) { if (this->action == 1) { - if (this->field_0x82.HALF.LO || sub_08049F64(this, 1, 0x48)) { + if (this->field_0x82.HALF.LO || PlayerInRange(this, 1, 0x48)) { this->action = 2; this->spriteSettings.b.draw = 1; this->field_0x82.HALF.LO = 1; @@ -520,7 +520,7 @@ void sub_0801F7FC(Entity* this) { if (sub_08049FDC(this, 1) == 0) return; - if (this->field_0x82.HALF.LO || sub_08049F64(this, 1, 0x48)) { + if (this->field_0x82.HALF.LO || PlayerInRange(this, 1, 0x48)) { this->action = 2; this->spriteSettings.b.draw = 1; this->field_0x82.HALF.LO = 1; @@ -548,7 +548,7 @@ void sub_0801F884(Entity* this) { ent->entityType.parameter = 64; this->action = 4; this->damageType = 165; - sub_08004488(0x193); + EnqueSFX(0x193); } } } @@ -562,12 +562,12 @@ void sub_0801F8C0(Entity* this) { u8 tmp = ++this->actionDelay & 7; if (tmp == 0 && sub_08049F1C(this, gUnk_020000B0, 0x38)) { this->action = 5; - sub_0801FBE4(this); + Chuchu_JumpAtPlayer(this); } else { if (tmp == 4) { this->direction = GetFacingDirection(this, gUnk_020000B0); } - sub_080AEF88(this); + ProcessMovement(this); GetNextFrame(this); } } @@ -577,7 +577,7 @@ void sub_0801F940(Entity* this) { if (this->frames.all & 0x10) { if (this->frames.all & 1) { this->frames.all ^= 1; - sub_08004488(299); + EnqueSFX(299); } sub_080AEFE0(this); if (sub_08003FC4(this, 0x4000) == 0) @@ -704,7 +704,7 @@ u32 sub_0801FBD0(Entity* this) { } } -void sub_0801FBE4(Entity* this) { +void Chuchu_JumpAtPlayer(Entity* this) { this->nonPlanarMovement = 0x180; this->field_0x20 = 0x20000; this->direction = sub_08049F84(this, 1); @@ -713,7 +713,7 @@ void sub_0801FBE4(Entity* this) { // clang-format off void (*const gUnk_080CA21C[])(Entity*) = { - sub_0801EEE4, + Chuchu_OnTick, sub_0801EF40, sub_0801F02C, sub_0801F048, diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index 2fcfcc89..f1169ae7 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -49,10 +49,10 @@ void sub_08022988(Entity* this) { this->frameIndex = 1; this->field_0x20 = 0x10000; - sub_08004488(0xd6); + EnqueSFX(0xd6); } - sub_080AEF88(this); + ProcessMovement(this); if (sub_08003FC4(this, 0x2000) == 0) { if (--this->actionDelay == 0) { sub_08022A88(this); @@ -75,7 +75,7 @@ void sub_080229F8(Entity* this) { sub_08022B44(this); } else { this->field_0x20 = 0x10000; - sub_08004488(0xd6); + EnqueSFX(0xd6); } } } @@ -88,7 +88,7 @@ void sub_08022A40(Entity* this) { this->frameIndex = 1; } - sub_080AEF88(this); + ProcessMovement(this); if (sub_08003FC4(this, 0x2000) == 0) { if (--this->actionDelay == 0) { sub_08022A88(this); @@ -143,7 +143,7 @@ void sub_08022B44(Entity *this){ if (this->direction & 0xf) this->spriteSettings.b.flipX = (this->direction >> 4)^1; - sub_08004488(0xd6); + EnqueSFX(0xd6); } diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index f226026f..03c9c91e 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -17,7 +17,7 @@ u32 sub_080214FC(); void sub_08021540(); void sub_08021600(); void sub_080213B0(); -u32 sub_08049F64(); +u32 PlayerInRange(); u32 sub_0802169C(); void sub_0802124C(); void sub_08021644(); @@ -90,7 +90,7 @@ void sub_08020BB8(Entity* this) { } this->action = 10; sub_08021218(this, 0xb, this->animationState); - sub_08004488(0x15d); + EnqueSFX(0x15d); sub_08021588(this); break; case 0x4c: @@ -150,7 +150,7 @@ void sub_08020DD4(Entity* this) { } else { if (--this->actionDelay == 0) sub_08021540(this); - sub_080AEF88(this); + ProcessMovement(this); UpdateAnimationSingleFrame(this); } } @@ -178,13 +178,13 @@ void sub_08020E78(Entity* this) { } void sub_08020E98(Entity* this) { - if (sub_08049F64(this, 1, 0x38)) { + if (PlayerInRange(this, 1, 0x38)) { if (sub_0802169C(this, gUnk_020000B0)) { this->action = 8; sub_08021218(this, 7, this->animationState); } else { this->direction = GetFacingDirection(gUnk_020000B0, this); - if (sub_080AEF88(this) == 0) { + if (ProcessMovement(this) == 0) { this->action = 8; sub_08021218(this, 7, this->animationState); } else { @@ -198,7 +198,7 @@ void sub_08020E98(Entity* this) { sub_08021414(this); } else { this->direction = GetFacingDirection(this, gUnk_020000B0); - sub_080AEF88(this); + ProcessMovement(this); sub_0802124C(this); sub_08021644(this); } @@ -212,7 +212,7 @@ void sub_08020F28(Entity* this) { } void sub_08020F48(Entity* this) { - if (sub_08049F64(this, 1, 0x48)) { + if (PlayerInRange(this, 1, 0x48)) { if (sub_08021664(this, gUnk_020000B0)) { u32 uVar2 = sub_0804A044(this, gUnk_020000B0, 9); if (uVar2 == 0xff) { @@ -273,7 +273,7 @@ void sub_08021038(Entity* this) { pEVar2->parent = this; this->attachedEntity = pEVar2; } - sub_08004488(270); + EnqueSFX(270); } if (this->frames.all & 0x80) { @@ -295,7 +295,7 @@ void sub_080210A8(Entity* this) { if (this->frames.all & 1) { this->frames.all = 0; sub_08021588(this); - sub_08004488(349); + EnqueSFX(349); } else if (this->frames.all & 0x80) { sub_08021390(this); } @@ -313,12 +313,12 @@ void sub_080210E4(Entity* this) { this->attachedEntity = ent; } - sub_08004488(270); + EnqueSFX(270); } sub_08021644(this); if ((this->frames.all & 0x10) && - (!sub_080AEF88(this) || (this->attachedEntity && (this->attachedEntity->bitfield & 0x80)))) { + (!ProcessMovement(this) || (this->attachedEntity && (this->attachedEntity->bitfield & 0x80)))) { sub_080213D0(this, 0); } else { if (--this->field_0x76.HWORD == 0) @@ -516,7 +516,7 @@ void sub_08021424(Entity* this) { sub_080212B0(this); } else { this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y); - if (!sub_080AEF88(this)) { + if (!ProcessMovement(this)) { sub_080212B0(this); } else { UpdateAnimationSingleFrame(this); @@ -575,13 +575,13 @@ void sub_0802159C(Entity* this) { ent->parent = this; this->attachedEntity = ent; } - sub_08004488(0x116); + EnqueSFX(0x116); } else if (this->frames.all == 2) { this->frames.all = 0; sub_08021588(this); } else if (this->frames.all & 0x20) { this->frames.all &= ~0x20; - sub_08004488(0x115); + EnqueSFX(0x115); } } @@ -596,7 +596,7 @@ void sub_08021600(Entity* this) { ent->parent = this; this->attachedEntity = ent; } - sub_08004488(0x10e); + EnqueSFX(0x10e); } else if (this->frames.all == 2) { this->frames.all = 0; sub_08021588(this); @@ -606,7 +606,7 @@ void sub_08021600(Entity* this) { void sub_08021644(Entity* this) { if (this->frames.all & 0x20) { this->frames.all &= ~0x20; - sub_08004488(0x7d); + EnqueSFX(0x7d); } } diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index 587ce521..5d5ca031 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -102,7 +102,7 @@ void sub_080220F0(Entity* this) { fx->y.HALF.HI += off->v; } } - sub_08004488(260); + EnqueSFX(260); } else if (this->frames.all & 1) { this->field_0x44 = 4; } diff --git a/src/enemy/hangingSeed.c b/src/enemy/hangingSeed.c index cd204a6e..f819287f 100644 --- a/src/enemy/hangingSeed.c +++ b/src/enemy/hangingSeed.c @@ -1,14 +1,14 @@ #include "entity.h" #include "functions.h" -extern void (*const gUnk_080CB570[])(Entity*); +extern void (*const gHangingSeedFunctions[])(Entity*); extern void (*const gUnk_080CB588[])(Entity*); void HangingSeed(Entity* this) { - EnemyFunctionHandler(this, gUnk_080CB570); + EnemyFunctionHandler(this, gHangingSeedFunctions); } -void sub_080216E4(Entity* this) { +void HangingSeed_OnTick(Entity* this) { gUnk_080CB588[this->action](this); } @@ -20,9 +20,10 @@ void sub_080216FC(Entity* this) { } void nullsub_7(Entity* this) { + /* ... */ } -void sub_08021720(Entity* this) { +void HangingSeed_Initialize(Entity* this) { this->action = 1; this->spriteSettings.b.draw = 1; this->frameIndex = this->entityType.form; @@ -30,12 +31,13 @@ void sub_08021720(Entity* this) { this->spritePriority.b0 = 3; } -void nullsub_08(Entity* this) { +void HangingSeed_Hang(Entity* this) { + /* ... */ } // clang-format off -void (*const gUnk_080CB570[])(Entity*) = { - sub_080216E4, +void (*const gHangingSeedFunctions[])(Entity*) = { + HangingSeed_OnTick, sub_080216FC, sub_08001324, sub_0804A7D4, @@ -44,8 +46,8 @@ void (*const gUnk_080CB570[])(Entity*) = { }; void (*const gUnk_080CB588[])(Entity*) = { - sub_08021720, - nullsub_08, + HangingSeed_Initialize, + HangingSeed_Hang, }; // clang-format on diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index 94c2ab33..afc0e4b6 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -34,7 +34,7 @@ void sub_080323DC(Entity* this) { void sub_080323F4(Entity* this) { u32 var; - if ((u8)(this->action - 3) >= 2) { + if (this->action != 3 && this->action != 4) { this->action = 3; this->actionDelay = 0xC; var = ((this->field_0x3e + 4) & 0x18) ^ 0x10; @@ -69,7 +69,7 @@ void sub_0803248C(Entity* this) { if (this->actionDelay == 0) { sub_08032650(this); } - if (sub_080AEF88(this) == 0) { + if (ProcessMovement(this) == 0) { this->actionDelay = 1; } UpdateAnimationSingleFrame(this); diff --git a/src/enemy/keese.c b/src/enemy/keese.c index 14f5c520..d73475f3 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -10,31 +10,36 @@ extern void sub_0806F4E8(Entity*); extern u32 sub_0806F3E4(Entity*); extern void sub_0804A7D4(Entity*); extern void sub_0804A720(Entity*); -extern void sub_08021EF0(Entity*); +extern void Keese_StartFly(Entity*); extern void sub_080AEFB4(Entity*); extern void sub_08021F24(Entity*); extern u32 sub_0806FCB8(Entity*, s32, s32, u32); extern u32 sub_08049FA0(Entity*); extern u32 sub_08049EE4(Entity*); -extern void (*const gUnk_080CB69C[])(Entity*); -extern void (*const gUnk_080CB6B4[])(Entity*); +extern void (*const gKeeseFunctions[])(Entity*); +extern void (*const gKeeseActions[])(Entity*); extern void (*const gUnk_080CB6C4[])(Entity*); -extern const s8 gUnk_080CB6D0[]; -extern const u16 gUnk_080CB6D6[]; -extern const u8 gUnk_080CB6F6[]; +extern const s8 gKeeseSpriteOffsets[]; +extern const u16 gKeeseFlyDurations[]; +extern const u8 gKeeseRestDurations[]; + +enum { + KeeseAnimation_Fly, + KeeseAnimation_Rest, +}; void Keese(Entity* this) { - gUnk_080CB69C[GetNextFunction(this)](this); + gKeeseFunctions[GetNextFunction(this)](this); } -void sub_08021D80(Entity* this) { - gUnk_080CB6B4[this->action](this); +void Keese_OnTick(Entity* this) { + gKeeseActions[this->action](this); } void sub_08021d98(Entity* this) { - sub_0804AA30(this, gUnk_080CB69C); + sub_0804AA30(this, gKeeseFunctions); } void sub_08021DA8(Entity* this) { @@ -57,10 +62,9 @@ void sub_08021DDC(Entity* this) { } } -void sub_08021DF0(Entity* this) { - +void Keese_Initialize(Entity* this) { sub_0804A720(this); - if ((this->entityType).form != 0) { + if (this->entityType.form != 0) { this->spritePriority.b1 = 1; this->height.HALF.HI = -0x10; } @@ -69,15 +73,15 @@ void sub_08021DF0(Entity* this) { this->spritePriority.b0 = 3; this->collisionLayer = 3; UpdateSpriteForCollisionLayer(this); - sub_08021EF0(this); + Keese_StartFly(this); } -void sub_08021E4C(Entity* this) { +void Keese_Fly(Entity* this) { if (this->field_0x78.HWORD != 0) { this->field_0x78.HWORD--; } if (this->field_0x7a.HWORD != 0) { - (this->field_0x7a.HWORD)--; + this->field_0x7a.HWORD--; } GetNextFrame(this); if ((this->frames.b.f3) != 0) { @@ -85,62 +89,54 @@ void sub_08021E4C(Entity* this) { } else { sub_080AEFB4(this); } - this->spriteOffsetY = gUnk_080CB6D0[this->frames.all]; + this->spriteOffsetY = gKeeseSpriteOffsets[this->frames.all]; } -void sub_08021EA4(Entity* this) { +void Keese_Rest(Entity* this) { if (--this->actionDelay == 0) { - sub_08021EF0(this); + Keese_StartFly(this); } } -void sub_08021EBC(Entity* this) { - s32 iVar1; - +void Keese_Sleep(Entity* this) { if (this->actionDelay != 0) { this->actionDelay--; } else { - iVar1 = sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70); - if (iVar1 != 0) { - sub_08021EF0(this); - } + if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70)) + Keese_StartFly(this); } } -void sub_08021EF0(Entity* this) { - u32 uVar1; - +void Keese_StartFly(Entity* this) { this->action = 1; - this->field_0x78.HWORD = gUnk_080CB6D6[Random() & 0xf]; - this->field_0x7a.HWORD = 0x3c; - InitializeAnimation(this, 0); + this->field_0x78.HWORD = gKeeseFlyDurations[Random() & 0xf]; + this->field_0x7a.HWORD = 60; + InitializeAnimation(this, KeeseAnimation_Fly); } void sub_08021F24(Entity* this) { - u32 bVar1; - if (this->field_0x78.HWORD == 0) { this->action = 2; - this->actionDelay = gUnk_080CB6F6[Random() & 0xf]; - InitializeAnimation(this, 1); + this->actionDelay = gKeeseRestDurations[Random() & 0xf]; + InitializeAnimation(this, KeeseAnimation_Rest); } else if (!this->field_0x7a.HWORD && !(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) { this->action = 3; - this->actionDelay = 0x1e; - InitializeAnimation(this, 1); + this->actionDelay = 30; + InitializeAnimation(this, KeeseAnimation_Rest); } else { if (sub_08049FA0(this) != 0) { this->direction = Random() & 0x1f; } else { this->direction = sub_08049EE4(this); } - InitializeAnimation(this, 0); + InitializeAnimation(this, KeeseAnimation_Fly); } } // clang-format off -void (*const gUnk_080CB69C[])(Entity*) = { - sub_08021D80, +void (*const gKeeseFunctions[])(Entity*) = { + Keese_OnTick, sub_08021d98, sub_08001328, sub_0804A7D4, @@ -148,11 +144,11 @@ void (*const gUnk_080CB69C[])(Entity*) = { sub_08021DA8, }; -void (*const gUnk_080CB6B4[])(Entity*) = { - sub_08021DF0, - sub_08021E4C, - sub_08021EA4, - sub_08021EBC, +void (*const gKeeseActions[])(Entity*) = { + Keese_Initialize, + Keese_Fly, + Keese_Rest, + Keese_Sleep, }; void (*const gUnk_080CB6C4[])(Entity*) = { @@ -161,16 +157,16 @@ void (*const gUnk_080CB6C4[])(Entity*) = { sub_08021DDC, }; -const s8 gUnk_080CB6D0[] = { +const s8 gKeeseSpriteOffsets[] = { 1, -2, -5, -2, 1, 0, }; -const u16 gUnk_080CB6D6[] = { +const u16 gKeeseFlyDurations[] = { 180, 180, 300, 300, 300, 300, 300, 300, 480, 480, 480, 480, 480, 480, 720, 720, }; -const u8 gUnk_080CB6F6[] = { +const u8 gKeeseRestDurations[] = { 30, 30, 45, 45, 45, 45, 45, 45, 60, 60, 60, 60, 60, 60, 75, 75, }; diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index 585ec102..b4bbc198 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -50,7 +50,7 @@ extern u32 sub_080041A0(Entity *, Entity *, u32, u32); extern u32 GetFacingDirection(Entity *, Entity *); // sub_0803CB64 -extern void sub_08004488(u32); +extern void EnqueSFX(u32); typedef struct { s8 x; @@ -344,7 +344,7 @@ void sub_0803CB64(Entity *this) { PositionRelative(this, cloud, offset->x << 16, offset->y << 16); - sub_08004488(0x193); + EnqueSFX(0x193); } void sub_0803CBAC(Entity *this) { diff --git a/src/enemy/leever.c b/src/enemy/leever.c index 2a3b621f..959d8617 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -8,27 +8,39 @@ extern void sub_0804AA30(Entity*, void (*const func[])(Entity*)); extern void sub_0804A7D4(Entity*); extern Entity* CreateDeathFx(Entity*, u32, u32); extern void sub_0804A720(Entity*); -bool32 sub_0801FE68(Entity*, s32); -extern void sub_0801FED4(Entity*); extern u32 sub_080002D4(s32, s32, u32); extern u32 sub_080002BC(s32, s32, u32); extern u32 sub_08049FDC(Entity*, u32); -bool32 sub_0801FDE4(Entity*, s32, s32); -extern void (*const gUnk_080CA49C[])(Entity*); -extern void (*const gUnk_080CA4B4[])(Entity*); extern Entity* gUnk_020000B0; -extern const u8 gUnk_080CA4C8[]; -extern const u16 gUnk_080CA4CA[]; extern s16 gSineTable[]; +bool32 Leever_PlayerInRange(Entity*, s32); +void Leever_Move(Entity*); + +extern void (*const gLeeverFunctions[])(Entity*); +extern void (*const gLeeverActions[])(Entity*); +extern const s8 gLeeverDrift[]; +extern const u16 gUnk_080CA4CA[]; + +enum { + LeeverAnimation_DigUp, + LeeverAnimation_DigDown, + LeeverAnimation_Attack, +}; + +enum { + LeeverForm_Red, + LeeverForm_Blue, +}; + void Leever(Entity* this) { - EnemyFunctionHandler(this, gUnk_080CA49C); + EnemyFunctionHandler(this, gLeeverFunctions); SetChildOffset(this, 0, 1, -0x10); } -void sub_0801FC28(Entity* this) { - gUnk_080CA4B4[this->action](this); +void Leever_OnTick(Entity* this) { + gLeeverActions[this->action](this); } void sub_0801FC40(Entity* this) { @@ -41,30 +53,30 @@ void sub_0801FC40(Entity* this) { sub_0804A9FC(this, 0x1c); } } - sub_0804AA30(this, gUnk_080CA49C); + sub_0804AA30(this, gLeeverFunctions); } void sub_0801FC7C(Entity* this) { - if ((this->entityType).form == 0) { + if (this->entityType.form == LeeverForm_Red) { sub_0804A7D4(this); } else { CreateDeathFx(this, 0xf1, 0); } } -void sub_0801FC9C(Entity* this) { +void Leever_Initialize(Entity* this) { sub_0804A720(this); this->action = 1; this->actionDelay = Random(); } -void sub_0801FCB0(Entity* this) { +void Leever_Idle(Entity* this) { if (--this->actionDelay == 0) { - if (sub_0801FE68(this, Random() & 0x1f) != 0) { + if (Leever_PlayerInRange(this, Random() & 0x1f)) { this->action = 2; this->spriteSettings.b.draw = TRUE; - this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA4C8[Random() & 1]) & 0x1f; - InitializeAnimation(this, 0); + this->direction = (GetFacingDirection(this, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & 0x1f; + InitializeAnimation(this, LeeverAnimation_DigUp); UpdateSpriteForCollisionLayer(this); } else { this->actionDelay = (Random() & 0x18) + 8; @@ -72,38 +84,36 @@ void sub_0801FCB0(Entity* this) { } } -void sub_0801FD2C(Entity* this) { - +void Leever_DigUp(Entity* this) { GetNextFrame(this); if (this->frames.b.f3 != 0) { this->action = 3; - if (this->entityType.form == 0) { - this->field_0x74.HWORD = 0xb4; + if (this->entityType.form == LeeverForm_Red) { + this->field_0x74.HWORD = 180; } else { - this->field_0x74.HWORD = 0x6e; + this->field_0x74.HWORD = 110; } - InitializeAnimation(this, 2); + InitializeAnimation(this, LeeverAnimation_Attack); } else if (this->frames.b.f0 != 0) { this->frames.all &= 0xfe; this->flags |= 0x80; } } -void sub_0801FD80(Entity* this) { - - sub_0801FED4(this); +void Leever_Attack(Entity* this) { + Leever_Move(this); GetNextFrame(this); if (--this->field_0x74.HWORD == 0) { this->action = 4; this->flags &= 0x7f; - InitializeAnimation(this, 1); + InitializeAnimation(this, LeeverAnimation_DigDown); } } -void sub_0801FDB4(Entity* this) { - sub_0801FED4(this); +void Leever_DigDown(Entity* this) { + Leever_Move(this); GetNextFrame(this); if ((this->frames.b.f3) != 0) { this->action = 1; @@ -132,7 +142,7 @@ u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) { } } -bool32 sub_0801FE68(Entity* ent, s32 arg2) { +bool32 Leever_PlayerInRange(Entity* ent, s32 arg2) { s32 sin, cos; s32 x, y; u32 i; @@ -157,48 +167,46 @@ bool32 sub_0801FE68(Entity* ent, s32 arg2) { extern u32 sub_0800132C(Entity*, Entity*); -void sub_0801FED4(Entity* this) { - s16 sVar2; - +void Leever_Move(Entity* this) { if (sub_08049FDC(this, 1) == 0) { this->field_0x74.HWORD = 1; } - sVar2 = (this->frames.all & 0xf) * 0x20; - this->nonPlanarMovement = sVar2; - if (this->entityType.form == 0) { + + this->nonPlanarMovement = (this->frames.all & 0xf) * 0x20; + if (this->entityType.form == LeeverForm_Red) { if ((this->field_0xf++ & 0xf) == 0) { sub_08004596(this, sub_0800132C(this, gUnk_020000B0)); } } else { - this->nonPlanarMovement = sVar2 + 0x40; + this->nonPlanarMovement += 0x40; if ((this->field_0xf++ & 0x7) == 0) { sub_08004596(this, sub_0800132C(this, gUnk_020000B0)); } } - sub_080AEF88(this); + + ProcessMovement(this); } // clang-format off -void (*const gUnk_080CA49C[])(Entity*) = { - sub_0801FC28, +void (*const gLeeverFunctions[])(Entity*) = { + Leever_OnTick, sub_0801FC40, sub_08001324, sub_0801FC7C, sub_08001242, - sub_0801FC28, + Leever_OnTick, }; -void (*const gUnk_080CA4B4[])(Entity*) = { - sub_0801FC9C, - sub_0801FCB0, - sub_0801FD2C, - sub_0801FD80, - sub_0801FDB4, +void (*const gLeeverActions[])(Entity*) = { + Leever_Initialize, + Leever_Idle, + Leever_DigUp, + Leever_Attack, + Leever_DigDown, }; -const u8 gUnk_080CA4C8[] = { - 0x06, - 0xFA, +const s8 gLeeverDrift[] = { + 6, -6, }; const u16 gUnk_080CA4CA[] = { diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c index 64c9c089..70b1a029 100644 --- a/src/enemy/miniSlime.c +++ b/src/enemy/miniSlime.c @@ -87,7 +87,7 @@ void sub_080452FC(Entity *this) { } void sub_08045374(Entity* this) { - sub_080AEF88(this); + ProcessMovement(this); GetNextFrame(this); if (--this->actionDelay == 0) this->action = 1; diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index 530eeae1..3338a15a 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -96,7 +96,7 @@ void sub_08022D40(Entity* this) { } } else { sub_08022F14(this); - sub_080AEF88(this); + ProcessMovement(this); if (this->collisions) { sub_0800417E(this, this->collisions); diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index 90e53a23..3b9fe027 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -6,24 +6,25 @@ extern void EnemyFunctionHandler(); extern void SetChildOffset(); extern void sub_0804AA30(); extern void sub_0804A7D4(); -extern void sub_0801ECFC(); extern u32 sub_0806F520(); extern void sub_0806F4E8(); extern void UpdateAnimationVariableFrames(); extern void sub_0804A720(); extern u32 Random(); -extern void sub_0801ED14(); -extern u32 sub_0801EDEC(); extern Entity* sub_08049DF4(u32); +void Octorok_Pause(); +bool32 Octorok_FacesPlayer(); +void Octorok_Turn(); + extern void (*const gOctorok[6])(Entity*); -extern void (*const gOctorokIdle[4])(Entity*); +extern void (*const gOctorokActions[4])(Entity*); extern void (*const gUnk_080CA158[6])(Entity*); extern Entity* gUnk_020000B0; -extern const u8 gUnk_080CA170[4]; -extern const u8 gUnk_080CA174[2]; -extern const u8 gUnk_080CA176[8]; +extern const u8 gOctorokWalkDuration[4]; +extern const u8 gOctorokSpitChanceModifier[2]; +extern const u8 gOctorokNutOffset[8]; extern const s8 gUnk_080CA17E[2]; // Main @@ -33,8 +34,8 @@ void Octorok(Entity* this) { } // Idle -void sub_0801EAD0(Entity* this) { - gOctorokIdle[this->action](this); +void Octorok_OnTick(Entity* this) { + gOctorokActions[this->action](this); } // Touch player @@ -47,7 +48,7 @@ void sub_0801EAE8(Entity* this) { // Death void sub_0801EB0C(Entity* this) { - if ((this->entityType).form == 0) { + if (this->entityType.form == 0) { sub_0804A7D4(this); } else { CreateDeathFx(this, 241, 0); @@ -55,10 +56,8 @@ void sub_0801EB0C(Entity* this) { } void sub_0801EB2C(Entity* this) { - s32 iVar1; - - if ((this->previousActionFlag < 3) && (iVar1 = sub_0806F520(this), iVar1 == 0)) { - sub_0801ECFC(this); + if (this->previousActionFlag < 3 && !sub_0806F520(this)) { + Octorok_Pause(this); InitializeAnimation(this, this->animationState); } else { gUnk_080CA158[this->previousActionFlag](this); @@ -84,6 +83,7 @@ void sub_0801EB84(Entity* this) { } void nullsub_3(Entity* this) { + /* ... */ } void sub_0801EB9C(Entity* this) { @@ -96,7 +96,7 @@ void sub_0801EB9C(Entity* this) { } // Init -void sub_0801EBC8(Entity* this) { +void Octorok_Initialize(Entity* this) { sub_0804A720(this); if (this->entityType.form == 2) { this->animationState = this->entityType.form; @@ -104,105 +104,103 @@ void sub_0801EBC8(Entity* this) { this->animationState = Random() & 3; } this->field_0x1c = 18; - sub_0801ECFC(this); + Octorok_Pause(this); InitializeAnimation(this, this->animationState); } -void sub_0801EBF4(Entity* this) { - u32 uVar2; - +void Octorok_Idle(Entity* this) { if (--this->actionDelay == 0) { this->action = 2; - uVar2 = Random(); - this->actionDelay = gUnk_080CA170[uVar2 & 3]; - sub_0801ED14(this); + this->actionDelay = gOctorokWalkDuration[Random() & 3]; + Octorok_Turn(this); } GetNextFrame(this); } -void sub_0801EC2C(Entity* this) { - sub_080AEF88(this); +void Octorok_Move(Entity* this) { + ProcessMovement(this); GetNextFrame(this); if (--this->actionDelay == 0) { - if (sub_0801EDEC(this) && gUnk_080CA174[this->entityType.form] <= (Random() & 3)) { + if (Octorok_FacesPlayer(this) && gOctorokSpitChanceModifier[this->entityType.form] <= (Random() & 3)) { this->action = 3; InitializeAnimation(this, this->animationState + 4); } else { - sub_0801ECFC(this); + Octorok_Pause(this); } } } -void sub_0801EC80(Entity* this) { +void Octorok_ShootNut(Entity* this) { GetNextFrame(this); if (this->frames.all & 1) { Entity* ent = sub_0804A98C(this, 1, 0); if (ent) { const s8* off; ent->direction = this->direction; - off = &gUnk_080CA176[this->direction / 4]; + off = &gOctorokNutOffset[this->direction / 4]; ent->x.HALF.HI += off[0]; ent->y.HALF.HI += off[1]; ent->height.HALF.HI = -3; this->frames.all &= 0xfe; - sub_08004488(0x18d); + EnqueSFX(0x18d); } } if (this->frames.all & 0x80) - sub_0801ECFC(this); + Octorok_Pause(this); } -void sub_0801ECFC(Entity* this) { +void Octorok_Pause(Entity* this) { this->action = 1; this->actionDelay = (Random() & 0x38) + 0x18; } -void sub_0801ED14(Entity* this) { +void Octorok_Turn(Entity* this) { if (this->entityType.form != 2) { if (sub_08049FA0(this)) { if (this->entityType.form == 1 && (Random() & 3) == 0 && sub_08049FDC(this, 1)) { - this->direction = (GetFacingDirection(this, gUnk_020000B0) + 4) & 0x18; + this->direction = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0)); } else { - this->direction = Random() & 0x18; + this->direction = DirectionRound(Random()); } - } else if ((Random() & 3)) { - this->direction = (sub_08049EE4(this) + gUnk_080CA17E[Random() & 1]) & 0x18; + } else if (Random() & 3) { + this->direction = DirectionRound(sub_08049EE4(this) + gUnk_080CA17E[Random() & 1]); } else { - this->direction = Random() & 0x18; + this->direction = DirectionRound(Random()); } } else { if (sub_08049FDC(this, 1) == 0) { if (sub_08049FA0(this)) { - this->direction = Random() & 0x18; + this->direction = DirectionRound(Random()); } else if (Random() & 3) { - this->direction = (sub_08049EE4(this) + gUnk_080CA17E[Random() & 1]) & 0x18; + this->direction = DirectionRound(sub_08049EE4(this) + gUnk_080CA17E[Random() & 1]); } else { - this->direction = (GetFacingDirection(this, gUnk_020000B0) + 4) & 0x18; + this->direction = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0)); } } else { - this->direction = (GetFacingDirection(this, gUnk_020000B0) + 4) & 0x18; + this->direction = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0)); } } + this->animationState = this->direction >> 3; InitializeAnimation(this, this->animationState); } -u32 sub_0801EDEC(Entity* this) { +bool32 Octorok_FacesPlayer(Entity* this) { Entity* ent = sub_08049DF4(1); if (ent == NULL) - return 0; + return FALSE; - if (((GetFacingDirection(this, ent) + 4) & 0x18) != this->direction) - return 0; + if (DirectionRoundUp(GetFacingDirection(this, ent)) != this->direction) + return FALSE; - return 1; + return TRUE; } // clang-format off void (*const gOctorok[])(Entity*) = { - sub_0801EAD0, + Octorok_OnTick, sub_0801EAE8, sub_08001324, sub_0801EB0C, @@ -210,11 +208,11 @@ void (*const gOctorok[])(Entity*) = { sub_0801EB2C, }; -void (*const gOctorokIdle[])(Entity*) = { - sub_0801EBC8, - sub_0801EBF4, - sub_0801EC2C, - sub_0801EC80, +void (*const gOctorokActions[])(Entity*) = { + Octorok_Initialize, + Octorok_Idle, + Octorok_Move, + Octorok_ShootNut, }; void (*const gUnk_080CA158[])(Entity*) = { @@ -226,31 +224,19 @@ void (*const gUnk_080CA158[])(Entity*) = { sub_0801EB9C, }; -const u8 gUnk_080CA170[] = { - 30, - 60, - 60, - 90, +const u8 gOctorokWalkDuration[] = { + 30, 60, 60, 90, }; -const u8 gUnk_080CA174[] = { - 1, - 0, +const u8 gOctorokSpitChanceModifier[] = { + 1, 0, }; -const u8 gUnk_080CA176[] = { - 0x00, - 0xFD, - 0x04, - 0x00, - 0x00, - 0x02, - 0xFC, - 0x00, +const u8 gOctorokNutOffset[] = { + 0, -3, 4, 0, 0, 2, -4, 0, }; const s8 gUnk_080CA17E[] = { - 0x04, - 0xFC, + 4, -4, }; // clang-format on diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 728a7837..66ff3199 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -1,12 +1,12 @@ #include "entity.h" #include "functions.h" -extern void (*const gUnk_080CA570[])(Entity*); -extern void (*const gUnk_080CA588[])(Entity*); -extern void (*const gUnk_080CA590[])(Entity*); +extern void (*const gPeahatFunctions[])(Entity*); +extern void (*const gPeahatPropellerFunctions[])(Entity*); +extern void (*const gPeahatActions[])(Entity*); extern void (*const gUnk_080CA5BC[])(Entity*); -extern const s8 gUnk_080CA5B8[]; +extern const s8 gPeahatFlightHeights[]; extern const s8 gUnk_080CA5D4[]; void sub_080205F8(Entity*); @@ -18,45 +18,59 @@ extern void sub_0804AA1C(Entity*); extern Entity* gUnk_020000B0; +enum { + PeahatForm_Torso, + PeahatForm_Propeller, +}; + +enum { + PeahatAnimation_Flying, + PeahatAnimation_BrokenPropeller, + PeahatAnimation_SlicedPropeller, + PeahatAnimation_Propeller, + PeahatAnimation_NewPropeller, + PeahatAnimation_RepairPropeller, +}; + void Peahat(Entity* this) { - if (this->entityType.form == 0) { - EnemyFunctionHandler(this, gUnk_080CA570); + if (this->entityType.form == PeahatForm_Torso) { + EnemyFunctionHandler(this, gPeahatFunctions); SetChildOffset(this, 0, 1, -0x10); } else { - gUnk_080CA588[this->action](this); + gPeahatPropellerFunctions[this->action](this); } } -void sub_0801FF9C(Entity* this) { - gUnk_080CA590[this->action](this); +void Peahat_OnTick(Entity* this) { + gPeahatActions[this->action](this); if (this->field_0x80.HALF.HI) - this->height.HALF.HI = gUnk_080CA5B8[(this->field_0xf++ & 0x30) >> 4]; + this->height.HALF.HI = gPeahatFlightHeights[(this->field_0xf++ & 0x30) >> 4]; } void sub_0801FFDC(Entity* this) { if (this->field_0x82.HALF.LO) { if (this->bitfield == 0x94) { - Entity* ent = CreateEnemy(3, 1); + Entity* ent = CreateEnemy(3, PeahatForm_Propeller); if (ent) { CopyPosition(this, ent); ent->height.HALF.HI -= 8; } this->field_0x82.HALF.LO = 0; - this->animationState = 2; + this->animationState = PeahatAnimation_SlicedPropeller; this->action = 5; this->nonPlanarMovement = 0x80; this->hurtBlinkTime = -30; this->field_0x80.HALF.HI = 0; InitializeAnimation(this, this->animationState); } else if (this->bitfield == 0x9b) { - this->animationState = 1; + this->animationState = PeahatAnimation_BrokenPropeller; this->action = 5; this->nonPlanarMovement = 0x80; this->hurtBlinkTime = -30; this->field_0x80.HALF.HI = 0; InitializeAnimation(this, this->animationState); } else if (this->bitfield == 0x80) { - if (this->animationState == 0) { + if (this->animationState == PeahatAnimation_Flying) { this->action = 1; this->actionDelay = 30; this->nonPlanarMovement = 0x80; @@ -70,7 +84,7 @@ void sub_0801FFDC(Entity* this) { if (this->field_0x43) sub_0804A9FC(this, 0x1c); - sub_0804AA30(this, gUnk_080CA570); + sub_0804AA30(this, gPeahatFunctions); } void sub_08020088(Entity* this) { @@ -83,8 +97,8 @@ void sub_08020088(Entity* this) { void sub_080200B4(Entity* this) { this->previousActionFlag = 1; this->field_0x1d = 60; - if (this->animationState == 0) { - this->animationState = 1; + if (this->animationState == PeahatAnimation_Flying) { + this->animationState = PeahatAnimation_BrokenPropeller; this->action = 5; this->damageType = 0x71; this->field_0x80.HALF.HI = 0; @@ -116,7 +130,7 @@ void sub_08020104(Entity* this) { } } -void sub_08020130(Entity* this) { +void Peahat_Initialize(Entity* this) { sub_0804A720(this); this->action = 1; this->actionDelay = 16; @@ -126,11 +140,11 @@ void sub_08020130(Entity* this) { this->field_0x80.HALF.LO = (Random() & 1) ? 2 : -2; this->field_0x80.HALF.HI = 1; this->field_0x82.HALF.LO = 1; - this->animationState = 0; - InitializeAnimation(this, 0); + this->animationState = PeahatAnimation_Flying; + InitializeAnimation(this, this->animationState); } -void sub_08020180(Entity* this) { +void Peahat_Fly(Entity* this) { if (this->field_0x82.HALF.HI) this->field_0x82.HALF.HI--; @@ -155,7 +169,7 @@ void sub_08020180(Entity* this) { GetNextFrame(this); } -void sub_08020220(Entity* this) { +void Peahat_ChargeStart(Entity* this) { if (sub_08049FDC(this, 1)) { if (--this->actionDelay) { UpdateAnimationVariableFrames(this, 4 - ((this->actionDelay >> 4) & 0x3)); @@ -173,7 +187,7 @@ void sub_08020220(Entity* this) { UpdateAnimationVariableFrames(this, 4); } -void sub_08020294(Entity* this) { +void Peahat_ChargeTarget(Entity* this) { if (sub_08049FDC(this, 1)) { if (--this->actionDelay == 0) { sub_080205F8(this); @@ -192,7 +206,7 @@ void sub_08020294(Entity* this) { UpdateAnimationVariableFrames(this, 4); } -void sub_08020308(Entity* this) { +void Peahat_ChargeEnd(Entity* this) { if (--this->actionDelay == 0) { this->action = 1; this->actionDelay = 1; @@ -208,32 +222,35 @@ void sub_08020308(Entity* this) { } } -void sub_08020350(Entity* this) { - if (this->animationState != 2) { - if (sub_080044EC(this, 0x1800) == 0) { - this->action = 6; - this->actionDelay = -0x10; - this->field_0xf = 10; - this->damageType = 113; - } +void Peahat_Stunned(Entity* this) { + switch (this->animationState) { + default: + if (sub_080044EC(this, 0x1800) == 0) { + this->action = 6; + this->actionDelay = 240; + this->field_0xf = 10; + this->damageType = 0x71; + } - if (this->direction == 0xff) - this->direction = this->field_0x3e; + if (this->direction == 0xff) + this->direction = this->field_0x3e; - sub_080AEF88(this); - GetNextFrame(this); - } else { - sub_08003FC4(this, 0x1c00); - if (this->height.HALF.HI == 0) { - this->action = 7; - this->actionDelay = -106; - this->field_0xf = 10; - this->damageType = 113; - } - } + ProcessMovement(this); + GetNextFrame(this); + break; + case PeahatAnimation_SlicedPropeller: + sub_08003FC4(this, 0x1c00); + if (this->height.HALF.HI == 0) { + this->action = 7; + this->actionDelay = 150; + this->field_0xf = 10; + this->damageType = 0x71; + } + break; + }; } -void sub_080203C0(Entity* this) { +void Peahat_RepairPropeller(Entity* this) { if (this->field_0xf) if (--this->field_0xf == 0) sub_0804A9FC(this, 0x1c); @@ -245,11 +262,11 @@ void sub_080203C0(Entity* this) { this->field_0x20 = 0x18000; this->direction = Random() & 0x1f; sub_0804AA1C(this); - this->animationState = 5; - InitializeAnimation(this, 5); + this->animationState = PeahatAnimation_RepairPropeller; + InitializeAnimation(this, this->animationState); } -void sub_0802041C(Entity* this) { +void Peahat_Recover(Entity* this) { if (this->field_0xf) if (--this->field_0xf == 0) sub_0804A9FC(this, 0x1c); @@ -258,58 +275,56 @@ void sub_0802041C(Entity* this) { return; this->action = 8; - this->actionDelay = -16; + this->actionDelay = 240; this->direction = Random() & 0x1f; sub_0804AA1C(this); } -void sub_08020468(Entity* this) { +void Peahat_Hop(Entity* this) { GetNextFrame(this); if (--this->actionDelay == 0) { if (this->frames.all & 0x80) { this->action = 9; this->field_0x20 = 0x18000; - this->animationState = 4; - InitializeAnimation(this, 4); + this->animationState = PeahatAnimation_NewPropeller; + InitializeAnimation(this, this->animationState); } else { this->actionDelay = 1; } } if (this->frames.all & 2) { - this->frames.all &= 0xfd; + this->frames.all &= ~2; this->direction = Random() & 0x1f; } if (this->frames.all & 1) { sub_0800442E(this); } else { - sub_080AEF88(this); + ProcessMovement(this); } } -void sub_080204E0(Entity* this) { +void Peahat_Takeoff(Entity* this) { GetNextFrame(this); if (this->frames.all & 0x80) { this->action = 1; this->damageType = 0x70; this->field_0x82.HALF.LO = 1; this->field_0x80.HALF.HI = 1; - this->animationState = 0; - InitializeAnimation(this, 0); + this->animationState = PeahatAnimation_Flying; + InitializeAnimation(this, this->animationState); + } else if (this->frames.all & 1) { + sub_0800442E(this); } else { - if (this->frames.all & 1) { - sub_0800442E(this); - } else { - sub_08003FC4(this, 0x1c00); - sub_080AEF88(this); - } + sub_08003FC4(this, 0x1c00); + ProcessMovement(this); } } -void sub_0802053C(Entity* this) { +void PeahatPropeller_Initialize(Entity* this) { this->action = 1; - this->actionDelay = -16; + this->actionDelay = 240; this->field_0xf = 40; this->spriteSettings.b.draw = 1; this->spriteRendering.b3 = 1; @@ -317,12 +332,12 @@ void sub_0802053C(Entity* this) { this->spriteSettings.b.shadow = 0; this->nonPlanarMovement = 0x20; this->direction = (Random() & 0x10) + 8; - InitializeAnimation(this, 3); + InitializeAnimation(this, PeahatAnimation_Propeller); } -void sub_08020590(Entity* this) { +void PeahatPropeller_Fly(Entity* this) { GetNextFrame(this); - if (--this->actionDelay == '\0') { + if (--this->actionDelay == 0) { DeleteEntity(this); } else { if (this->actionDelay < 60) @@ -354,8 +369,8 @@ void sub_08020604(Entity *this){ // clang-format off -void (*const gUnk_080CA570[])(Entity*) = { - sub_0801FF9C, +void (*const gPeahatFunctions[])(Entity*) = { + Peahat_OnTick, sub_0801FFDC, sub_08001324, sub_0804A7D4, @@ -363,29 +378,26 @@ void (*const gUnk_080CA570[])(Entity*) = { sub_08020088, }; -void (*const gUnk_080CA588[])(Entity*) = { - sub_0802053C, - sub_08020590, +void (*const gPeahatPropellerFunctions[])(Entity*) = { + PeahatPropeller_Initialize, + PeahatPropeller_Fly, }; -void (*const gUnk_080CA590[])(Entity*) = { - sub_08020130, - sub_08020180, - sub_08020220, - sub_08020294, - sub_08020308, - sub_08020350, - sub_080203C0, - sub_0802041C, - sub_08020468, - sub_080204E0, +void (*const gPeahatActions[])(Entity*) = { + Peahat_Initialize, + Peahat_Fly, + Peahat_ChargeStart, + Peahat_ChargeTarget, + Peahat_ChargeEnd, + Peahat_Stunned, + Peahat_RepairPropeller, + Peahat_Recover, + Peahat_Hop, + Peahat_Takeoff, }; -const s8 gUnk_080CA5B8[] = { - -5, - -6, - -7, - -6, +const s8 gPeahatFlightHeights[] = { + -5, -6, -7, -6, }; void (*const gUnk_080CA5BC[])(Entity*) = { @@ -396,5 +408,11 @@ void (*const gUnk_080CA5BC[])(Entity*) = { nullsub_5, sub_08020104, }; + +/* Alignment issue +const s8 gUnk_080CA5D4[] = { + 4, -4, +}; +*/ // clang-format on diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index 337e21dc..8c4a82f3 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -79,7 +79,7 @@ void sub_08022390(Entity* this) { } if (this->field_0xf == 0) { - sub_080AEF88(this); + ProcessMovement(this); } else { this->field_0xf = this->field_0xf - 1; } diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index 1a9fc159..45d6f118 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -1,8 +1,8 @@ #include "entity.h" #include "functions.h" -extern void (*const gUnk_080CA66C[])(Entity*); -extern void (*const gUnk_080CA684[])(Entity*); +extern void (*const gRollobiteFunctions[])(Entity*); +extern void (*const gRollobiteActions[])(Entity*); extern void (*const gUnk_080CA6A4[])(Entity*); extern void (*const gUnk_080CA6BC[])(Entity*); @@ -11,57 +11,54 @@ extern const s8 gUnk_080CA6D4[]; void sub_08020A30(Entity*); void sub_08020A7C(Entity*); -u32 sub_08020AD0(Entity*); -u32 sub_08020B6C(Entity*); +bool32 Rollobite_TryToHoleUp(Entity*); +bool32 Rollobite_IsRolledUp(Entity*); extern void sub_080AE58C(); extern void sub_080AE7E8(); extern void sub_08078930(); void Rollobite(Entity* this) { - EnemyFunctionHandler(this, gUnk_080CA66C); + EnemyFunctionHandler(this, gRollobiteFunctions); } -void sub_08020648(Entity* this) { - sub_08020AD0(this); - gUnk_080CA684[this->action](this); +void Rollobite_OnTick(Entity* this) { + Rollobite_TryToHoleUp(this); + gRollobiteActions[this->action](this); } void sub_08020668(Entity* this) { if (this->damageType == 34 && this->currentHealth != 0xff) { this->action = 4; this->field_0x20 = 0x20000; - this->direction = -1; - this->currentHealth = -1; + this->direction = 0xff; + this->currentHealth = 0xff; this->damageType = 35; InitializeAnimation(this, this->animationState + 8); } if (this->bitfield != 0x80) { - u8 tmp = this->action - 4; - if (tmp < 2) { + if (this->action == 4 || this->action == 5) { this->action = 4; - this->actionDelay = -76; - this->direction = -1; + this->actionDelay = 180; + this->direction = 0xff; InitializeAnimation(this, this->animationState + 0x10); } } if (this->bitfield == 0x93) - sub_08020648(this); + Rollobite_OnTick(this); } void sub_080206E0(Entity* this) { - if (sub_08020AD0(this)) { + if (Rollobite_TryToHoleUp(this)) { this->field_0x42 = 0; + } else if (Rollobite_IsRolledUp(this)) { + this->field_0x42--; + sub_080AE58C(this, this->field_0x3e, 10); + sub_080AE7E8(this, this->field_0x46, this->field_0x3e, 10); } else { - if (sub_08020B6C(this)) { - this->field_0x42--; - sub_080AE58C(this, this->field_0x3e, 10); - sub_080AE7E8(this, this->field_0x46, this->field_0x3e, 10); - } else { - sub_08001324(this); - } + sub_08001324(this); } } @@ -69,7 +66,7 @@ void sub_08020734(Entity* this) { if (this->previousActionFlag < 3 && !sub_0806F520(this)) { this->action = 4; this->flags |= 0x80; - this->direction = -1; + this->direction = 0xff; InitializeAnimation(this, this->animationState + 0x10); } else { gUnk_080CA6A4[this->previousActionFlag](this); @@ -94,6 +91,7 @@ void sub_08020798(Entity* this) { } void nullsub_6(Entity* this) { + /* ... */ } void sub_080207A8(Entity* this) { @@ -107,7 +105,7 @@ void sub_080207A8(Entity* this) { InitializeAnimation(this, this->animationState + 0x10); } -void sub_080207F4(Entity* this) { +void Rollobite_Initialize(Entity* this) { sub_0804A720(this); this->field_0x16 = 0x30; this->field_0x1c = 18; @@ -116,11 +114,11 @@ void sub_080207F4(Entity* this) { sub_08020A30(this); } -void sub_08020820(Entity* this) { +void Rollobite_Walk(Entity* this) { GetNextFrame(this); if (this->frames.all & 0x1) { this->frames.all &= ~0x1; - if (!sub_080AEF88(this)) + if (!ProcessMovement(this)) this->actionDelay = 1; } @@ -164,12 +162,12 @@ void sub_08020904(Entity* this) { InitializeAnimation(this, this->animationState + 0x10); } -void sub_08020920(Entity* this) { +void Rollobite_Turn(Entity* this) { if (--this->actionDelay == 0) sub_08020A30(this); } -void sub_08020938(Entity* this) { +void Rollobite_RolledUp(Entity* this) { u32 unk; if ((this->frames.all & 0x80) == 0) @@ -185,14 +183,14 @@ void sub_08020938(Entity* this) { sub_08078930(this); } else { if (unk == 1) - sub_08004488(260); + EnqueSFX(260); if ((this->direction & 0x80) == 0) sub_080AEFE0(this); } } -void sub_080209A0(Entity* this) { +void Rollobite_Unroll(Entity* this) { GetNextFrame(this); if (this->frames.all & 0x80) { this->flags |= 0x80; @@ -207,7 +205,7 @@ void sub_080209A0(Entity* this) { } } -void sub_080209F4(Entity* this) { +void Rollobite_LinedUp(Entity* this) { if (sub_08003FC4(this, 0x1c00) == 0) { this->action = 7; this->spritePriority.b0 = 7; @@ -217,7 +215,7 @@ void sub_080209F4(Entity* this) { GetNextFrame(this); } -void sub_08020A28(Entity* this) { +void Rollobite_Holed(Entity* this) { GetNextFrame(this); } @@ -251,8 +249,8 @@ void sub_08020A7C(Entity* this) { InitializeAnimation(this, this->animationState); } -u32 sub_08020AD0(Entity* this) { - if (sub_08020B6C(this) && this->height.HALF.HI == 0) { +bool32 Rollobite_TryToHoleUp(Entity* this) { + if (Rollobite_IsRolledUp(this) && this->height.HALF.HI == 0) { int tile = COORD_TO_TILE(this); int iVar1 = GetTileType(tile, this->collisionLayer); if ((iVar1 * 0x10000 - 0x710000U) >> 0x10 < 2) { @@ -265,24 +263,24 @@ u32 sub_08020AD0(Entity* this) { this->field_0x20 = 0x20000; InitializeAnimation(this, this->animationState + 0x14); SetTile(0x4034, tile, this->collisionLayer); - return 1; + return TRUE; } } - return 0; + return FALSE; } -u32 sub_08020B6C(Entity* this) { - u32 tmp = this->animIndex - 0x10; - if (tmp < 4) { - return 1; +bool32 Rollobite_IsRolledUp(Entity* this) { + u32 tmp = this->animIndex; + if (16 <= tmp && tmp <= 19) { + return TRUE; } else { - return 0; + return FALSE; } } // clang-format off -void (*const gUnk_080CA66C[])(Entity*) = { - sub_08020648, +void (*const gRollobiteFunctions[])(Entity*) = { + Rollobite_OnTick, sub_08020668, sub_080206E0, sub_0804A7D4, @@ -290,15 +288,15 @@ void (*const gUnk_080CA66C[])(Entity*) = { sub_08020734, }; -void (*const gUnk_080CA684[])(Entity*) = { - sub_080207F4, - sub_08020820, +void (*const gRollobiteActions[])(Entity*) = { + Rollobite_Initialize, + Rollobite_Walk, sub_08020874, - sub_08020920, - sub_08020938, - sub_080209A0, - sub_080209F4, - sub_08020A28, + Rollobite_Turn, + Rollobite_RolledUp, + Rollobite_Unroll, + Rollobite_LinedUp, + Rollobite_Holed, }; void (*const gUnk_080CA6A4[])(Entity*) = { @@ -318,7 +316,6 @@ void (*const gUnk_080CA6BC[])(Entity*) = { }; const u8 gUnk_080CA6CC[] = { - 0,6,9,0,6,6,0,7 + 0, 6, 9, 0, 6, 6, 0, 7, }; // clang-format on - diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 8a011dad..9468d7a2 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -62,7 +62,7 @@ void sub_08029318(Entity* this) { this->field_0x82.HALF.HI = 0x41; this->flags2 &= 0xfc; this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1; - sub_08004488(0x104); + EnqueSFX(0x104); } else { if (this->field_0x43 != 0) { sub_0804A9FC(this, 0x1c); @@ -136,7 +136,7 @@ void sub_080294D4(Entity* this) { sub_08004596(this, GetFacingDirection(this, &gPlayerEntity)); sub_0802969C(this); } - sub_080AEF88(this); + ProcessMovement(this); sub_080296C8(this); } else { this->action = 6; diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 91238ab9..29ec7207 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -87,7 +87,7 @@ void sub_08045018(Entity* this) { } void sub_08045088(Entity* this) { - sub_080AEF88(this); + ProcessMovement(this); GetNextFrame(this); if (--this->actionDelay == 0) { this->action = 1; diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index a3d41a1b..6a6d19e8 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -3,7 +3,7 @@ #include "functions.h" extern void sub_08001318(Entity*); -extern u32 sub_08049F64(Entity*, u32, u32); +extern u32 PlayerInRange(Entity*, u32, u32); extern void sub_0804A4E4(Entity*, Entity*); extern void sub_0804AA1C(Entity*); @@ -69,7 +69,7 @@ void sub_0802244C(Entity* this) { if (this->action == 3) { this->action = 4; InitializeAnimation(this, 3); - sub_08004488(0x194); + EnqueSFX(0x194); } } } else { @@ -132,7 +132,7 @@ void sub_08022654(Entity* this) { this->previousActionFlag = 2; this->spriteSettings.b.draw = 1; InitializeAnimation(this, 5); - sub_08004488(0x7d); + EnqueSFX(0x7d); UpdateSpriteForCollisionLayer(this); /* fallthrough */ case 2: @@ -169,7 +169,7 @@ void sub_080226EC(Entity* this) { this->direction = sub_08049F84(this, 1); } - sub_080AEF88(this); + ProcessMovement(this); } GetNextFrame(this); @@ -180,7 +180,7 @@ void sub_08022780(Entity* this) { if (this->frames.all & 0x80) { this->action = 4; InitializeAnimation(this, 3); - sub_08004488(0x194); + EnqueSFX(0x194); } } @@ -223,7 +223,7 @@ void sub_08022854(Entity* this) { this->action = 7; this->damageType = 0x5c; InitializeAnimation(this, 5); - sub_08004488(0x7d); + EnqueSFX(0x7d); } } } @@ -240,7 +240,7 @@ void sub_0802289C(Entity* this) { u32 sub_080228CC(Entity* this) { if (this->field_0xf == 0) { - if (sub_08049F64(this, 1, 0x28)) + if (PlayerInRange(this, 1, 0x28)) return 1; } else { this->field_0xf--; @@ -250,7 +250,7 @@ u32 sub_080228CC(Entity* this) { u32 sub_080228F0(Entity* this) { if (this->field_0x80.HALF.HI == 0) { - if (sub_08049F64(this, 1, 0x40)) + if (PlayerInRange(this, 1, 0x40)) return 1; } else { this->field_0x80.HALF.HI--; diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index 4aec209c..c34a9dd8 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -113,7 +113,7 @@ void sub_0802F300(Entity* this) { u32 rand; GetNextFrame(this); - sub_080AEF88(this); + ProcessMovement(this); temp = this->height.HALF.HI; rand = Random() & 0xf; diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index f46a65e3..50012c83 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -100,7 +100,7 @@ void sub_08038048(Entity* this) { u32 rand; UpdateAnimationVariableFrames(this, 2); - sub_080AEF88(this); + ProcessMovement(this); temp = this->height.HALF.HI; rand = Random() & 0xf; diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index 2c7431d6..021a8b44 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -98,7 +98,7 @@ void sub_080336A8(Entity* this) { } else if (this->collisions != 0) { sub_0800417E(this, this->collisions); } - sub_080AEF88(this); + ProcessMovement(this); GetNextFrame(this); } diff --git a/src/npc/carlov.c b/src/npc/carlov.c index aaa447d0..25c983ae 100644 --- a/src/npc/carlov.c +++ b/src/npc/carlov.c @@ -10,7 +10,7 @@ extern void sub_0807DD50(Entity *); extern void sub_0807DD94(Entity *,u32); -extern void sub_08004488(u32); +extern void EnqueSFX(u32); extern void sub_08080964(u32,u32); @@ -25,11 +25,11 @@ void Carlov(Entity *this) } if ((this->frames.all & 0x10) != 0) { this->frames.all = this->frames.all & 0xef; - sub_08004488(0x104); + EnqueSFX(0x104); sub_08080964(0x10,0); } if ((this->frames.all & 0x20) != 0) { this->frames.all = this->frames.all & 0xdf; - sub_08004488(0x7c); + EnqueSFX(0x7c); } }
\ No newline at end of file diff --git a/src/npc/cow.c b/src/npc/cow.c index 54500e02..24fc90d8 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -94,7 +94,7 @@ void sub_08069068(Entity* ent) { InitAnimationForceUpdate(ent, ent->animationState + 4); } - sub_080AEF88(ent); + ProcessMovement(ent); UpdateAnimationSingleFrame(ent); { diff --git a/src/npc/melari.c b/src/npc/melari.c index 87afe16c..0aceb1e1 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -12,7 +12,7 @@ extern void sub_0806F118(Entity*); extern void sub_0807DDAC(Entity*, u32); extern void sub_0807DDE4(Entity*); extern u32 sub_080040A8(Entity*); -extern void sub_08004488(u32); +extern void EnqueSFX(u32); extern u32 sub_0801E99C(Entity*); extern void sub_08078784(Entity*, u32); extern void sub_0807000C(Entity*); @@ -99,7 +99,7 @@ void sub_08068780(Entity* this) { if (sub_080040A8(this) == 0) { PlaySFX(gUnk_0811153E[(s32)Random() % 3]); } else { - sub_08004488(gUnk_08111538[(s32)Random() % 3]); + EnqueSFX(gUnk_08111538[(s32)Random() % 3]); } ent = CreateFx(this, 0x3d, 0x20); if (ent != NULL) { diff --git a/src/npc/postman.c b/src/npc/postman.c index f7b6395d..8ffc696c 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -27,7 +27,7 @@ extern u32 GetFacingDirection(Entity*, Entity*); extern void sub_080606D8(Entity*); extern void sub_0807DD94(Entity*, u32); extern void sub_080788E0(Entity*); -extern void sub_08004488(u32); +extern void EnqueSFX(u32); extern void sub_080606C0(Entity*); extern void sub_0800451C(Entity*); extern void sub_08078784(Entity*, u32); @@ -178,7 +178,7 @@ void sub_08060528(Entity *this) this->field_0x20 = 0x20000; this->field_0x6c.HALF.HI = 1; sub_080788E0(this); - sub_08004488(0x7c); + EnqueSFX(0x7c); } else { this->field_0x6a.HWORD -= 1; diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 436dc186..242d85a1 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -222,7 +222,7 @@ void sub_08061E90(Entity* this, Entity* arg1) { if (animIndex != this->animIndex) { InitializeAnimation(this, animIndex); } - sub_080AEF88(this); + ProcessMovement(this); iVar4 = this->x.HALF.HI - *(s16*)&this->field_0x6a.HWORD; if (0x10 < iVar4) { this->x.HALF.HI = this->field_0x6a.HWORD + 0x10; diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index e9a1e8e0..efa72fb2 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -7,7 +7,7 @@ extern void sub_0809EB30(Entity*); extern void sub_0809EAD8(Entity*); extern void sub_0809EABC(Entity*); -extern void sub_08004488(u32); +extern void EnqueSFX(u32); extern void sub_080A2CC0(Entity*, Entity**, u16*); extern Entity* GetCurrentRoomProperty(u32); extern void SetTile(u32, u32, u32); @@ -50,7 +50,7 @@ void sub_0809EA80(Entity* this) { } else { SetFlag(this->field_0x86); } - sub_08004488(0x110); + EnqueSFX(0x110); } sub_0809EABC(this); } @@ -123,7 +123,7 @@ void sub_0809EBD8(Entity* this) { this->actionDelay = 0x10; this->frameIndex = 2; SetFlag(this->field_0x86); - sub_08004488(0x110); + EnqueSFX(0x110); } } @@ -137,7 +137,7 @@ void sub_0809EC08(Entity* this) { this->action = 1; this->frameIndex = 3; ClearFlag(this->field_0x86); - sub_08004488(0x110); + EnqueSFX(0x110); } } } diff --git a/src/object/mask.c b/src/object/mask.c index 675805b8..cd5d13f4 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -20,7 +20,7 @@ extern void sub_08000148(u16, u16, u32); extern s16 sub_080001DA(u16, u32); extern u16 sub_080002E0(u16, u32); -extern void sub_08004488(u32); +extern void EnqueSFX(u32); extern void sub_080044EC(Entity *, u16); extern void sub_0805457C(Entity *, s32); @@ -115,7 +115,7 @@ void sub_08092B0C(Entity *this) { switch (this->entityType.parameter & 0xC0) { case 0x80: - sub_08004488(0x72); + EnqueSFX(0x72); case 0x40: SetFlag(this->field_0x86); break; diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c index 381bf0d8..b0df5777 100644 --- a/src/object/metalDoor.c +++ b/src/object/metalDoor.c @@ -6,7 +6,7 @@ extern u32 sub_08083734(Entity*, u32); extern void sub_080A080C(Entity*); extern void sub_0806F69C(Entity*); -extern void sub_08004488(u32); +extern void EnqueSFX(u32); extern void sub_080A0870(Entity*); extern void PlaySFX(u32); extern u32 sub_080001DA(u32, u32); @@ -71,7 +71,7 @@ void sub_080A074C(Entity *this) ent->x.HALF.HI -= 0xc; ent->y.HALF.HI -= 0xc; } - sub_08004488(0x10b); + EnqueSFX(0x10b); } } diff --git a/src/object/object1A.c b/src/object/object1A.c index e903d21b..5f43ec2f 100644 --- a/src/object/object1A.c +++ b/src/object/object1A.c @@ -3,7 +3,7 @@ extern void sub_08086A6C(); extern s32 sub_080044EC(); -extern void sub_080AEF88(); +extern void ProcessMovement(); extern u32 Random(void); extern void (*gUnk_081206C4[99])(Entity*); @@ -42,7 +42,7 @@ void sub_08086A28(Entity* ent) { if (iVar1 == 0) { ent->action = 2; } - sub_080AEF88(ent); + ProcessMovement(ent); CopyPosition(ent, ent->attachedEntity); } } diff --git a/src/object/object2A.c b/src/object/object2A.c index d8f30b54..8db435e5 100644 --- a/src/object/object2A.c +++ b/src/object/object2A.c @@ -36,5 +36,5 @@ void sub_08089B18(Entity *this) return; } } - sub_08004488(0x124); + EnqueSFX(0x124); }
\ No newline at end of file diff --git a/src/object/pot.c b/src/object/pot.c index 5ea63ab5..8931598f 100755 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -92,7 +92,7 @@ void sub_08082310(Entity* this) { this->actionDelay = 64; } SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); - sub_08004488(0x10F); + EnqueSFX(0x10F); break; case 0x4067: SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); diff --git a/src/object/railtrack.c b/src/object/railtrack.c index 3cf693d2..d8227bef 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -6,7 +6,7 @@ extern u32* GetLayerByIndex(u32); extern void sub_08085394(Entity*); extern void sub_0808543C(Entity*); -extern void sub_08004488(u32); +extern void EnqueSFX(u32); extern u32 sub_080854A8(Entity*); extern void SetTile(u32, u32, u32); @@ -54,7 +54,7 @@ void sub_08085264(Entity* this) { this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3; InitializeAnimation(this, this->animationState); sub_0808543C(this); - sub_08004488(0x151); + EnqueSFX(0x151); } } @@ -66,7 +66,7 @@ void sub_080852B4(Entity* this) { this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3; InitializeAnimation(this, this->animationState); sub_08085394(this); - sub_08004488(0x151); + EnqueSFX(0x151); } } @@ -96,7 +96,7 @@ void sub_08085308(Entity* this) { this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3; InitializeAnimation(this, this->animationState); sub_0808543C(this); - sub_08004488(0x151); + EnqueSFX(0x151); } } } |
