diff --git a/data/data_902.s b/data/data_902.s index a1062359..f72f7efa 100644 --- a/data/data_902.s +++ b/data/data_902.s @@ -1360,7 +1360,7 @@ gUnk_08122794:: @ 08122794 gUnk_0812279C:: @ 0812279C .incbin "baserom.gba", 0x12279C, 0x0000008 -gUnk_081227A4:: @ 081227A4 +MaskActionFuncs:: @ 081227A4 .incbin "baserom.gba", 0x1227A4, 0x0000010 gUnk_081227B4:: @ 081227B4 diff --git a/src/bladeBrothers.c b/src/bladeBrothers.c index fedaef0f..69a981f0 100644 --- a/src/bladeBrothers.c +++ b/src/bladeBrothers.c @@ -411,4 +411,4 @@ void BladeBrothers_Fusion(Entity* this) { this->frames.all &= 0xfe; sub_08068BEC(this, 0); } -} \ No newline at end of file +} diff --git a/src/bombPeahat.c b/src/bombPeahat.c index efd14570..b5dda939 100644 --- a/src/bombPeahat.c +++ b/src/bombPeahat.c @@ -84,4 +84,4 @@ void nullsub_143(Entity* this){} void sub_0802A91C(Entity *this) { this->currentHealth = 0; -} \ No newline at end of file +} diff --git a/src/flags.c b/src/flags.c index 64351e6e..5cce7c9e 100644 --- a/src/flags.c +++ b/src/flags.c @@ -130,4 +130,4 @@ void ClearGlobalFlag(u32 flag) { void ClearRoomFlag(u32 flag) { ClearBit(&gRoomFlags, flag); -} \ No newline at end of file +} diff --git a/src/greatFairy.c b/src/greatFairy.c index 28e9de33..02b5268b 100644 --- a/src/greatFairy.c +++ b/src/greatFairy.c @@ -579,4 +579,4 @@ void (*const GreatFairy_Form2Behaviors[])(Entity*) = { sub_0808727C }; -//clang-format on \ No newline at end of file +//clang-format on diff --git a/src/item.c b/src/item.c index e89a3948..49afb9e6 100644 --- a/src/item.c +++ b/src/item.c @@ -35,4 +35,4 @@ void (*const gItemFunctions[])(ItemBehavior*, u32) = { JarEmpty, JarEmpty, JarEmpty, -}; \ No newline at end of file +}; diff --git a/src/keese.c b/src/keese.c index 22aee9d9..b9914c2f 100644 --- a/src/keese.c +++ b/src/keese.c @@ -131,4 +131,4 @@ void sub_08021EF0(Entity *this) this->field_0x78 = gUnk_080CB6D6[Random() & 0xf]; this->itemCooldown = 0x3c; InitializeAnimation(this, 0); -} \ No newline at end of file +} diff --git a/src/mask.c b/src/mask.c index 87e1f1a8..d33f3481 100644 --- a/src/mask.c +++ b/src/mask.c @@ -3,39 +3,44 @@ #include "room.h" #include "random.h" -#define COORD_TO_TILE(entity) ((((entity->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3fU) | (((entity->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3fU) << 6) - -extern void (*gUnk_081227A4[])(Entity *); -extern void DeleteThisEntity(); -extern u16 gUnk_030010A0[]; -extern bool32 CheckFlags(u16); -extern void ClearFlag(u16); -extern s16 sub_080001DA(u16, u32); -extern void SetTile(u32, u16, u32); -extern u16 sub_080002E0(u16, u32); -extern void sub_08000148(u16, u16, u32); extern Entity gLinkEntity; +extern u16 gUnk_030010A0[]; + +extern void (*MaskActionFuncs[])(Entity *); + +extern void DeleteThisEntity(); + +extern bool32 CheckFlags(u16); +extern void SetFlag(u16); +extern void ClearFlag(u16); + +extern void SetTile(u32, u16, u32); + +extern void CreateFx(Entity *, u16, u16); + +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 sub_080044EC(Entity *, u16); -extern void CreateFx(Entity *, u16, u16); extern void sub_0805457C(Entity *, s32); -extern void SetFlag(u16); + void Mask(Entity *this) { - gUnk_081227A4[this->action](this); + MaskActionFuncs[this->action](this); } void sub_080929A4(Entity *this) { - if (this->entityType.parameter2 & 0xC0) { + if (this->entityType.parameter & 0xC0) { if (CheckFlags(this->field_0x86)) { s32 field_0x0a; - switch (this->entityType.parameter2 & 0xC0) { + + switch (this->entityType.parameter & 0xC0) { case 0x40: field_0x0a = gUnk_030010A0[0x5]; switch (field_0x0a) { - default: - break; case 0x44D ... 0x44F: case 0x182: DeleteThisEntity(); @@ -57,10 +62,10 @@ void sub_080929A4(Entity *this) { this->field_0x78 = ((Random() & 7) << 10) | 0x2000; - this->field_0xf = this->parameter3 >> 1; - this->parameter3 = 0; + this->field_0xf = this->actionDelay >> 1; + this->actionDelay = 0; - this->animationList = this->entityType.parameter2 & 0x3f; + this->frameIndex = this->entityType.parameter & 0x3f; this->field_0x7c.HALF.HI = COORD_TO_TILE(this); this->field_0x7c.HALF.LO = sub_080001DA(this->field_0x7c.HALF.HI, 1); @@ -70,7 +75,9 @@ void sub_080929A4(Entity *this) { SetTile(0x4022, this->field_0x7c.HALF.HI, 1); } +// Probably related to knocking it down void sub_08092A94(Entity *this) { + // Check for the first frame of bonking animation if (gLinkEntity.action != 6) { return; } @@ -79,6 +86,7 @@ void sub_08092A94(Entity *this) { return; } + // Check if link is close enough to the mask if (this->y.HALF.HI + 40 < gLinkEntity.y.HALF.HI) { return; } @@ -87,21 +95,26 @@ void sub_08092A94(Entity *this) { return; } + // Presumably, make the mask fall SetTile((u16)this->field_0x7c.HALF.LO, this->field_0x7c.HALF.HI, 1); sub_08000148(this->itemCooldown, this->field_0x7c.HALF.HI, 1); this->action = 2; + this->height.HALF.HI -= 0x20; this->y.HALF.HI += 0x20; + this->spriteOrder.b3 = 2; } +// Probably falling down void sub_08092B0C(Entity *this) { - if (this->parameter3 == 1) { + if (this->actionDelay == 1) { this->action = 3; - this->parameter3 = 0; - switch (this->entityType.parameter2 & 0xC0) + + this->actionDelay = 0; + switch (this->entityType.parameter & 0xC0) { case 0x80: sub_08004488(0x72); @@ -110,18 +123,20 @@ void sub_08092B0C(Entity *this) { break; } + CreateFx(this, 5, 0); + sub_0805457C(this, 3); } else { sub_080044EC(this, this->field_0x78); if (this->height.HALF.HI == 0) { - this->parameter3++; + this->actionDelay++; } } } -void sub_08092B6C(Entity *this) { +void Mask_Delete(Entity *this) { DeleteThisEntity(); -} \ No newline at end of file +} diff --git a/src/npc.c b/src/npc.c index 49e6453f..dbd376e7 100644 --- a/src/npc.c +++ b/src/npc.c @@ -135,4 +135,4 @@ void (*const gNPCFunctions[][3])(Entity* ent) = { { DeleteEntity, NULL, NULL } }; //clang-format on -const u8 npc_unk[] = { 0x04, 0x05, 0x06, 0x06 }; \ No newline at end of file +const u8 npc_unk[] = { 0x04, 0x05, 0x06, 0x06 }; diff --git a/src/object.c b/src/object.c index d4062e0b..6e526824 100644 --- a/src/object.c +++ b/src/object.c @@ -198,4 +198,4 @@ void (*const gObjectFunctions[])(Entity*) = { EnemyItem, ObjectC1, }; -//clang-format on \ No newline at end of file +//clang-format on diff --git a/src/position.c b/src/position.c index f1711a4a..1c96046f 100644 --- a/src/position.c +++ b/src/position.c @@ -53,4 +53,4 @@ void ResolveEntityOnTop(Entity *param_1,Entity *param_2) void sub_0806FAD8(Entity *param_1,Entity *param_2) { param_2->ticks.b0 = gUnk_08114F80[param_1->ticks.b0]; -} \ No newline at end of file +} diff --git a/src/rem.c b/src/rem.c index 93180c5e..8e3fe38f 100644 --- a/src/rem.c +++ b/src/rem.c @@ -52,4 +52,4 @@ void sub_0806A3D8(Entity *this) uVar1 = StartCutscene(this,&gUnk_08012F0C); *(u32 *)&this->cutsceneBeh = (u32)uVar1; sub_0807DD94(this, 0); -} \ No newline at end of file +} diff --git a/src/simon.c b/src/simon.c index 1e56d6bc..45046de5 100644 --- a/src/simon.c +++ b/src/simon.c @@ -65,4 +65,4 @@ void sub_0806C2A0(u32 *param_1,struct_0806C2A0 *param_2) DoFade(0xc, 4); break; } -} \ No newline at end of file +} diff --git a/src/syrup.c b/src/syrup.c index 3e26793a..4f0badb4 100644 --- a/src/syrup.c +++ b/src/syrup.c @@ -74,4 +74,4 @@ void sub_0806A26C(Entity *this) { asm(".include \"asm/non_matching/syrup/sub_0806A26C.inc\""); } -#endif \ No newline at end of file +#endif diff --git a/src/trig.c b/src/trig.c index 7f546eae..a406599f 100644 --- a/src/trig.c +++ b/src/trig.c @@ -327,4 +327,4 @@ const s16 gCosineTable[] = { Q_8_8(0.99609375), // sin(317*(π/128)) Q_8_8(0.99609375), // sin(318*(π/128)) Q_8_8(0.99609375), // sin(319*(π/128)) -}; \ No newline at end of file +}; diff --git a/src/windTribeFlag.c b/src/windTribeFlag.c index b8257ff5..b17e9e9e 100644 --- a/src/windTribeFlag.c +++ b/src/windTribeFlag.c @@ -22,4 +22,4 @@ void WindTribeFlag(Entity *this) if (this->frameDuration == 0xff) { this->frameDuration = (Random() & 0xf) + 0x10; } -} \ No newline at end of file +} diff --git a/src/windcrest.c b/src/windcrest.c index 0429a658..231eb425 100644 --- a/src/windcrest.c +++ b/src/windcrest.c @@ -38,4 +38,4 @@ void Windcrest_Unlock(Entity *this) PlaySFX(0x72); gUnk_02002A40.windcrests = gUnk_02002A40.windcrests | 1 << (this->entityType.parameter + 0x18); CreateFx(this, 0x46, 0); -} \ No newline at end of file +}