diff options
| author | notyouraveragehooman <65437533+notyouraveragehooman@users.noreply.github.com> | 2020-06-19 22:36:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-19 22:36:16 -0700 |
| commit | ff875f593f5248decc7403d60841d53665417a7b (patch) | |
| tree | 17df040c0a6cb997a0458bf8ac38fd40c610bd3a /src | |
| parent | 2c9cfcb6f16b0dd2a8ec1fa4af14a9d71b451396 (diff) | |
| parent | 31f1937534262e3c3567324a10b59e42ab590dfc (diff) | |
Merge pull request #16 from 21aslade/master
mask.c OK
Diffstat (limited to 'src')
| -rw-r--r-- | src/bladeBrothers.c | 2 | ||||
| -rw-r--r-- | src/bombPeahat.c | 2 | ||||
| -rw-r--r-- | src/flags.c | 2 | ||||
| -rw-r--r-- | src/greatFairy.c | 2 | ||||
| -rw-r--r-- | src/item.c | 2 | ||||
| -rw-r--r-- | src/keese.c | 2 | ||||
| -rw-r--r-- | src/mask.c | 142 | ||||
| -rw-r--r-- | src/npc.c | 2 | ||||
| -rw-r--r-- | src/object.c | 2 | ||||
| -rw-r--r-- | src/position.c | 2 | ||||
| -rw-r--r-- | src/rem.c | 2 | ||||
| -rw-r--r-- | src/simon.c | 2 | ||||
| -rw-r--r-- | src/syrup.c | 2 | ||||
| -rw-r--r-- | src/trig.c | 2 | ||||
| -rw-r--r-- | src/windTribeFlag.c | 2 | ||||
| -rw-r--r-- | src/windcrest.c | 2 |
16 files changed, 157 insertions, 15 deletions
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 @@ -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 new file mode 100644 index 00000000..d33f3481 --- /dev/null +++ b/src/mask.c @@ -0,0 +1,142 @@ +#include "global.h" +#include "entity.h" +#include "room.h" +#include "random.h" + +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 sub_0805457C(Entity *, s32); + + +void Mask(Entity *this) { + MaskActionFuncs[this->action](this); +} + +void sub_080929A4(Entity *this) { + if (this->entityType.parameter & 0xC0) { + if (CheckFlags(this->field_0x86)) { + s32 field_0x0a; + + switch (this->entityType.parameter & 0xC0) { + case 0x40: + field_0x0a = gUnk_030010A0[0x5]; + + switch (field_0x0a) { + case 0x44D ... 0x44F: + case 0x182: + DeleteThisEntity(); + goto switchEnd; + } + + ClearFlag(this->field_0x86); + break; + case 0x80: + DeleteThisEntity(); + break; + } + switchEnd: + } + } + + this->action = 1; + this->field_0x20 = 0x18000; + + this->field_0x78 = ((Random() & 7) << 10) | 0x2000; + + this->field_0xf = this->actionDelay >> 1; + this->actionDelay = 0; + + 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); + + this->itemCooldown = sub_080002E0(this->field_0x7c.HALF.HI, 1); + + 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; + } + + if (gLinkEntity.animationState != 0) { + return; + } + + // Check if link is close enough to the mask + if (this->y.HALF.HI + 40 < gLinkEntity.y.HALF.HI) { + return; + } + + if (this->x.HALF.HI - gLinkEntity.x.HALF.HI >= this->field_0xf || this->x.HALF.HI - gLinkEntity.x.HALF.HI <= -this->field_0xf) { + 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->actionDelay == 1) { + this->action = 3; + + this->actionDelay = 0; + switch (this->entityType.parameter & 0xC0) + { + case 0x80: + sub_08004488(0x72); + case 0x40: + SetFlag(this->field_0x86); + break; + + } + + CreateFx(this, 5, 0); + + sub_0805457C(this, 3); + } + else { + sub_080044EC(this, this->field_0x78); + + if (this->height.HALF.HI == 0) { + this->actionDelay++; + } + } +} + +void Mask_Delete(Entity *this) { + DeleteThisEntity(); +} @@ -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 +} @@ -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 @@ -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 +} |
