From b3dc734ad8a809a378c00fabf988bf5298ce8f98 Mon Sep 17 00:00:00 2001 From: Ibot02 Date: Sat, 8 Aug 2020 17:01:13 +0200 Subject: partial managerA.c ok first three functions decomped --- src/manager/managerA.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/manager/managerA.c (limited to 'src') diff --git a/src/manager/managerA.c b/src/manager/managerA.c new file mode 100644 index 00000000..35729c55 --- /dev/null +++ b/src/manager/managerA.c @@ -0,0 +1,39 @@ +#include "global.h" +#include "entity.h" + +extern void (*gUnk_081081F4[])(Entity*); + +void sub_08058380(Entity* this) { + gUnk_081081F4[this->action](this); +} + + +extern u32 CheckFlags(u32); +extern void DeleteThisEntity(); +extern void sub_0805E3A0(Manager*, u32); + +void sub_08058398(Manager* this) { + + if (CheckFlags(this->unk_3c) != 0) { + DeleteThisEntity(); + } + this->unk_24 = this->unk_3a<<3; + this->unk_26 = this->unk_3b<<3; + this->unk_20 = this->unk_24 + (this->unk_38<<4); + this->unk_22 = this->unk_26 + (this->unk_39<<4); + sub_0805E3A0(this, 0x06); + if (this->unk_3e == 0) { + this->unk_0c = 2; + } else { + this->unk_0c = 1; + } +} + +extern void sub_08058408(Manager* this); + +void sub_080583EC(Manager* this) { + if (CheckFlags(this->unk_3e) != 0) { + this->unk_0c = 2; + sub_08058408(this); + } +} -- cgit v1.2.3 From 6a68cca275c05355743fad27e40835953430d40e Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sat, 8 Aug 2020 16:49:10 -0500 Subject: Start decompiling pot.c --- src/enemy/bombPeahat.c | 2 +- src/enemy/keese.c | 2 +- src/enemy/octorok.c | 2 +- src/enemy/rupeeLike.c | 2 +- src/enemy/smallPesto.c | 2 +- src/enemy/wisp.c | 2 +- src/object/pot.c | 169 +++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 175 insertions(+), 6 deletions(-) create mode 100755 src/object/pot.c (limited to 'src') diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 1dc3d30f..176480a0 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -57,7 +57,7 @@ void sub_0802A8C8(Entity* this) void sub_0802A8E0(Entity *this) { this->previousActionFlag = 1; - this->filler[1] = 0x3c; + this->field_0x1d = 0x3c; } void sub_0802A8EC(Entity *this) diff --git a/src/enemy/keese.c b/src/enemy/keese.c index ea25214b..d9dd7991 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -73,7 +73,7 @@ void sub_08021DF0(Entity *this) this->height.HALF.HI = -0x10; } this->direction = Random() & 0x1f; - this->filler[0] = 1; + this->field_0x1c = 1; this->spritePriority.b0 = 3; this->collisionLayer = 3; UpdateSpriteForCollisionLayer(this); diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index 57fc25e3..a5b63f96 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -62,7 +62,7 @@ void sub_0801EB2C(Entity* ent) { void sub_0801EB68(Entity* ent) { ent->previousActionFlag = 1; - ent->filler[1] = 60; + ent->field_0x1d = 60; } void sub_0801EB74(Entity* ent) { diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index cbd991c4..79f127e0 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -25,7 +25,7 @@ void RupeeLike(Entity* this) { u32 uVar1; if (this->entityType.parameter == 0) { - uVar1 = sub_080043E8(this); + uVar1 = (u8)sub_080043E8(this); if (uVar1 != 0) { if (this->action == 4) { sub_080296D8(this); diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index c29fe80c..94eb8822 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -46,7 +46,7 @@ void sub_0803169C(Entity *this) void sub_080316DC(Entity *this) { this->previousActionFlag = 1; - this->filler[1] = 0x3c; + this->field_0x1d = 0x3c; } void sub_080316E8(Entity *this) diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index d6729201..9b95541c 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -85,7 +85,7 @@ void sub_08033674(Entity* this) { sub_0804A720(this); this->actionDelay = 0; this->action = 1; - this->filler[0] = 1; + this->field_0x1c = 1; this->field_0x80.HWORD = this->x.HALF.HI; this->field_0x82.HWORD = this->y.HALF.HI; sub_08033744(this); diff --git a/src/object/pot.c b/src/object/pot.c new file mode 100755 index 00000000..25d82b50 --- /dev/null +++ b/src/object/pot.c @@ -0,0 +1,169 @@ +#include "global.h" +#include "entity.h" +#include "functions.h" +#include "flags.h" +#include "link.h" +#include "room.h" + +extern void (*const gUnk_0811F090[])(Entity*); +extern void (*const gUnk_0811F0A8[])(Entity*); + +extern BoundingBox gUnk_080FD338; // TODO: should be const +extern BoundingBox gUnk_080FD340; // TODO: should be const + +extern u32 sub_08016A30(Entity*); +extern u32 sub_080001DA(u32, u32); +extern u32 GetTileTypeByEntity(Entity*); +extern void sub_08078930(Entity*); +extern void sub_08082824(Entity*); +extern u32 sub_080002B8(Entity*); +extern void sub_08082850(Entity*, Entity*); +extern void sub_08082608(Entity*); + +void Pot(Entity* this) { + gUnk_0811F090[this->action](this); + this->bitfield = 0; +} + +void sub_0808222C(Entity* this) { + if (this->entityType.parameter == 1 && CheckFlags(this->field_0x86)) { + DeleteThisEntity(); + } + + this->action = 1; + this->boundingBox = &gUnk_080FD338; + this->nonPlanarMovement = 0x80; + this->y.HALF.HI += 3; + this->possibleBool = 0; + this->flags |= 0x80; + this->currentHealth = 1; + this->field_0x3c = 7; + this->damageType = 0x6E; + this->flags2 = 0x84; + this->field_0x1c = 0x12; + if (this->collisionLayer == 0) { + sub_08016A30(this); + } + + this->field_0x70.HALF.LO = sub_080001DA(COORD_TO_TILE(this), this->collisionLayer); + if ((u16)this->field_0x70.HALF.LO == 0x4000) { + DeleteThisEntity(); + } + + SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); + InitializeAnimation(this, 5); +} + +void sub_08082310(Entity* this) { + u32 tileType; + u32 var0 = this->bitfield & 0x7F; + switch (var0) { + case 0x13: + this->action = 3; + this->previousActionFlag = 0; + break; + case 0x1D: + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + this->action = 5; + this->field_0x20 = 0x2A000; + this->spriteOffsetY = 0; + this->spriteSettings.b.shadow = 1; + this->spritePriority.b1 = 3; + this->flags &= 0x7F; + sub_08082824(this); + break; + default: + tileType = GetTileTypeByEntity(this); + if (tileType != 0x4000) { + switch (tileType) { + case 0x4004: + case 0x4003: + case 0x4002: + case 0x4001: + this->direction = (tileType - 0x4001) * 8; + this->actionDelay = 32; + this->action = 4; + if (gLinkState.flags.all & 0x80) { + this->nonPlanarMovement >>= 1; + this->actionDelay = 64; + } + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + sub_08004488(0x10F); + break; + case 0x4067: + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + DeleteThisEntity(); + break; + default: + if (sub_080002B8(this) == 13) { + CreateFx(this, 0, 0); + } else if (tileType == 0x4005) { + gLinkState.field_0xab = 4; + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + } + sub_08082850(this, NULL); + break; + } + } else { + sub_08078930(this); + } + break; + } +} + +void sub_080824F8(Entity* this) { + gUnk_0811F0A8[this->previousActionFlag](this); +} + +void sub_08082510(Entity* this) { + this->flags |= 0x80; + this->boundingBox = &gUnk_080FD340; + this->field_0x3c = 7; + this->damageType = 1; + this->flags2 = gLinkEntity.flags2; + this->spriteOffsetY = 0; + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + this->previousActionFlag++; +} + + +void nullsub_511(Entity* this) { +} + +void sub_08082588(Entity* this) { + this->spritePriority.b1 = 3; +} + +void sub_0808259C(Entity* this) { + switch (sub_080043E8(this)) { + case 2: + CreateFx(this, 11, 0); + break; + case 1: + CreateFx(this, 0, 0); + break; + case 3: + CreateFx(this, 12, 0); + break; + default: + sub_08082850(this, &gLinkEntity); + return; + } + + DeleteThisEntity(); +} + +void sub_080825E8(Entity* this) { + DeleteThisEntity(); +} + +void sub_080825F0(Entity* this) { + if (gLinkState.heldObject == 0) { + sub_08082608(this); + } +} + +void sub_08082608(Entity* this) { + this->action = 1; + this->previousActionFlag = 0; +} -- cgit v1.2.3 From a609afcf8372ff837564c16fb0ba1ed1e9004a39 Mon Sep 17 00:00:00 2001 From: Ibot02 Date: Sun, 9 Aug 2020 12:13:02 +0200 Subject: managerA.c ok --- src/manager/managerA.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 135 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/manager/managerA.c b/src/manager/managerA.c index 35729c55..5eb869e5 100644 --- a/src/manager/managerA.c +++ b/src/manager/managerA.c @@ -1,15 +1,19 @@ #include "global.h" #include "entity.h" +#include "link.h" +#include "manager.h" +#include "flags.h" +#include "area.h" -extern void (*gUnk_081081F4[])(Entity*); -void sub_08058380(Entity* this) { - gUnk_081081F4[this->action](this); +extern void (*gUnk_081081F4[])(Manager*); + +void sub_08058380(Manager* this) { + gUnk_081081F4[this->unk_0c](this); } -extern u32 CheckFlags(u32); -extern void DeleteThisEntity(); + extern void sub_0805E3A0(Manager*, u32); void sub_08058398(Manager* this) { @@ -29,7 +33,8 @@ void sub_08058398(Manager* this) { } } -extern void sub_08058408(Manager* this); + +void sub_08058408(Manager*); void sub_080583EC(Manager* this) { if (CheckFlags(this->unk_3e) != 0) { @@ -37,3 +42,127 @@ void sub_080583EC(Manager* this) { sub_08058408(this); } } + +extern u32 CheckPlayerInRegion(u32, u32, u32, u32); +extern void sub_0805E544(void); +extern void sub_08078A90(u32); +extern void sub_08078AA8(u32, u32); +extern void sub_080186C0(u16); +extern void sub_08078B48(void); + +u32 sub_0805848C(Manager*); +void sub_080585DC(Manager*); + +void sub_08058408(Manager* this){ + u32 tmp2; + tmp2 = (gLinkState.flags.all & 0x08); + if (tmp2 != 0) return; + if (!CheckPlayerInRegion(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) return; + switch (this->unk_0a) { + case 1: + return; + case 2: + sub_080585DC(this); + if ((gLinkState.flags.all & 0x80) == 0) return; + case 0: + default: + sub_080585DC(this); + if (sub_0805848C(this) == 0) return; + sub_08078A90(3); + sub_08078B48(); + sub_0805E544(); + this->unk_0c = 3; + this->unk_0d = 0; + this->unk_0e = 0x1e; + return; + case 3: + this->unk_0c = 4; + this->unk_0d = tmp2; + sub_080186C0(this->unk_36); + return; + } +} + + +u32 sub_0805848C(Manager* this) { + switch (gLinkState.field_0xa8[0]-5) { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 22: + case 23: + return 0; + case 1: + case 4: + case 20: + case 21: + default: + return 1; + } +} + + +extern void UnfreezeTime(void); + +void sub_08058514(Manager* this) { + switch (this->unk_0d) { + case 1: + if ((gLinkState.flags.all & 0x1235) != 0) + return; + if (gLinkEntity.height.HALF.HI != 0) + return; + gLinkState.jumpStatus = 0; + sub_08078AA8(this->unk_36, this->unk_35); + this->unk_0d++; + this->unk_0e = 0x1E; + return; + case 0: + case 2: + if (((--this->unk_0e)<<0x18) == 0) { + this->unk_0d++; + } + return; + case 3: + if (gLinkEntity.action != 1 && gLinkEntity.action != 9) return; + gLinkState.field_0x8b = 1; + UnfreezeTime(); + SetFlag(this->unk_3c); + DeleteThisEntity(); + return; + default: + return; + } +} + + +extern void sub_0801855C(void); + +void sub_080585B0(Manager* this) { + if (gArea.filler4[0] != 0xFF) { + DeleteThisEntity(); + } + if (CheckFlags(this->unk_3c)) { + sub_0801855C(); + DeleteThisEntity(); + } +} +void sub_080585DC(Manager* this) { + if (CheckFlags(this->unk_3c)) { + DeleteThisEntity(); + } +} -- cgit v1.2.3