diff options
| author | theo3 <arisstephenson2@gmail.com> | 2021-10-26 23:20:12 -0700 |
|---|---|---|
| committer | theo3 <arisstephenson2@gmail.com> | 2021-10-26 23:20:12 -0700 |
| commit | 57eec4def41b5bd3cc3ac791ef4bc26b75125b5d (patch) | |
| tree | 06117098718bb3224e2058793f2f8c5fc607e29b /src | |
| parent | 6ecaea44c5944acd4a5e8e11582e280e69e22e08 (diff) | |
decompile jar portal
Diffstat (limited to 'src')
| -rw-r--r-- | src/enemy/doorMimic.c | 1 | ||||
| -rw-r--r-- | src/manager/manager15.c | 2 | ||||
| -rw-r--r-- | src/manager/manager1A.c | 1 | ||||
| -rw-r--r-- | src/manager/manager3.c | 2 | ||||
| -rw-r--r-- | src/npc/bigGoron.c | 1 | ||||
| -rw-r--r-- | src/object/jarPortal.c | 181 |
6 files changed, 182 insertions, 6 deletions
diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index ff59c26d..c3fd44ee 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -5,7 +5,6 @@ extern s16 sub_080001DA(u32, u32); // ? extern void sub_08049CF4(); -extern u32 CheckPlayerProximity(u32, u32, u32, u32); void sub_080221C0(); typedef struct { diff --git a/src/manager/manager15.c b/src/manager/manager15.c index 24b214b5..b0ce0828 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -253,8 +253,6 @@ void sub_0805A664(Manager15* this) { sub_0805A68C(this); } -extern u32 CheckPlayerProximity(u32, u32, u32, u32); - void sub_0805A68C(Manager15* this) { if (CheckPlayerProximity(this->unk_38 - 0x18, this->unk_3a - 0x18, 0x30, 0x30)) { if (this->unk_2c <= 0x1007) { diff --git a/src/manager/manager1A.c b/src/manager/manager1A.c index 2b4027a2..c006ddaf 100644 --- a/src/manager/manager1A.c +++ b/src/manager/manager1A.c @@ -32,7 +32,6 @@ void Manager1A_Main(Manager1A* this) { } extern void sub_08052D74(void*, void*, void*); -extern u32 CheckPlayerProximity(u32, u32, u32, u32); typedef struct struct_08108764 { u8 unk_00; diff --git a/src/manager/manager3.c b/src/manager/manager3.c index 5652ad89..272baabc 100644 --- a/src/manager/manager3.c +++ b/src/manager/manager3.c @@ -7,6 +7,7 @@ #include "random.h" #include "audio.h" #include "object.h" +#include "functions.h" // Facilitates the usage of minish portals. @@ -25,7 +26,6 @@ typedef struct { } Manager3; extern s8 gUnk_08107C6C[]; -extern u32 CheckPlayerProximity(u32, u32, u32, u32); extern u32 sub_08057810(void); extern u32 sub_080002C0(u16, u16, u8); extern void sub_080577AC(u32, u32, u32); diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 611f6b24..34a336ff 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -34,7 +34,6 @@ extern Hitbox gUnk_080FD180; Entity* sub_0806D00C(Entity* this); void sub_0806D4C0(Entity*, u32); -extern u32 CheckPlayerProximity(u32, u32, u32, u32); void BigGoron(Entity* this) { gUnk_081140D4[this->type](this); diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c new file mode 100644 index 00000000..b625bb1b --- /dev/null +++ b/src/object/jarPortal.c @@ -0,0 +1,181 @@ +#include "global.h" +#include "entity.h" +#include "flags.h" +#include "functions.h" +#include "area.h" +#include "audio.h" + +extern void (*gUnk_08121488[])(Entity*); + +extern u32 sub_08057810(void); +extern void sub_080577AC(u32, u32, u32); + +u32 sub_0808C128(Entity*); +void sub_0808C13C(Entity*); +void sub_0808C148(Entity*, u32); +void sub_0808C01C(Entity*, u32); + +void JarPortal(Entity* this) { + gUnk_08121488[this->action](this); +} + +void sub_0808BE9C(Entity* this) { + this->flags |= 0x80; + this->damageType = 1; + this->field_0x3c = 0x47; + this->field_0x40 = 0x44; + this->flags2 = 0x80; + this->field_0x68.HALF.LO = 0; + if (CheckLocalFlag(this->type)) { + if (this->field_0x7c.BYTES.byte0 != 0) { + this->action = 1; + InitAnimationForceUpdate(this, 0); + } else { + this->action = 3; + InitAnimationForceUpdate(this, 1); + } + } else { + if (this->field_0x7c.BYTES.byte0 == 0) { + this->action = 1; + InitAnimationForceUpdate(this, 0); + } else { + this->action = 3; + InitAnimationForceUpdate(this, 1); + } + } +} + +void sub_0808BF14(Entity* this) { + if (sub_0808C128(this)) { + this->action++; + sub_0808C13C(this); + if (this->field_0x7c.BYTES.byte0 == 0) { + SetLocalFlag(this->type); + } else { + ClearLocalFlag(this->type); + } + sub_0808C148(this, 0); + } + sub_0808C01C(this, 0); +} + +void sub_0808BF58(Entity* this) { + sub_08003FC4(this, 0x2000); + switch (this->subAction) { + case 0: + if (this->field_0x20 <= 98303) { + ++this->subAction; + InitAnimationForceUpdate(this, 2); + } + break; + case 1: + UpdateAnimationSingleFrame(this); + if (!this->height.HALF.HI) { + ++this->subAction; + this->field_0x20 = 0x8000; + } + break; + case 2: + UpdateAnimationSingleFrame(this); + if (!this->height.HALF.HI) { + ++this->action; + this->field_0xf = 0; + InitAnimationForceUpdate(this, 1); + sub_0808C148(this, 1); + } + break; + } +} + +void sub_0808BFD8(Entity* this) { + if (sub_0808C128(this)) { + ++this->action; + sub_0808C13C(this); + if (!this->field_0x7c.BYTES.byte0) + ClearLocalFlag(this->type); + else + SetLocalFlag(this->type); + sub_0808C148(this, 0); + } + sub_0808C01C(this, 1); +} + +void sub_0808C01C(Entity* this, u32 r1) { + if (CheckPlayerProximity(this->x.HALF.HI - 0x18, this->y.HALF.HI - 0x18, 0x30, 0x30)) { + u32 type; + gArea.curPortalX = this->x.HALF.HI; + gArea.curPortalY = this->y.HALF.HI; + gArea.curPortalExitDirection = 2; + type = 4; + if (r1 != 0) + type = 2; + gArea.curPortalType = type; + if (r1 == 1) { + if (((gPlayerState.flags.all & 0x20) != 0) && (gPlayerState.jumpStatus == 0)) { + gArea.field_0x18 = 2; + } else { + if (sub_08057810() != 0) { + gArea.field_0x18 = 3; + } + } + sub_080577AC(this->x.HALF.HI, this->y.HALF.HI, this->collisionLayer); + if (this->field_0xf == 0) { + this->field_0xf = 1; + SoundReq(0x152); + } + } + } +} + +void sub_0808C0AC(Entity* this) { + sub_08003FC4(this, 0x2000); + switch (this->subAction) { + case 0: + if (this->field_0x20 <= 98303) { + this->subAction = 1; + InitAnimationForceUpdate(this, 3); + } + break; + case 1: + UpdateAnimationSingleFrame(this); + if (!this->height.HALF.HI) { + ++this->subAction; + this->field_0x20 = 0x8000; + } + break; + case 2: + UpdateAnimationSingleFrame(this); + if (!this->height.HALF.HI) { + this->action = 1; + InitAnimationForceUpdate(this, 0); + sub_0808C148(this, 1); + } + break; + } +} + +u32 sub_0808C128(Entity* this) { + return this->bitfield == 157; +} + +void sub_0808C13C(Entity* this) { + this->subAction = 0; + this->field_0x20 = 163840; +} + +void sub_0808C148(Entity* this, u32 a2) { + u32 pos; + + pos = COORD_TO_TILE(this); + if (!a2) { + SetTile(16530, pos - 1, this->collisionLayer); + SetTile(16531, pos, this->collisionLayer); + SetTile(16532, pos + 63, this->collisionLayer); + SetTile(16533, pos + 64, this->collisionLayer); + } else { + sub_0807BA8C(pos - 1, this->collisionLayer); + sub_0807BA8C(pos, this->collisionLayer); + sub_0807BA8C(pos + 63, this->collisionLayer); + sub_0807BA8C(pos + 64, this->collisionLayer); + } +} |
