summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyouraveragehooman <65437533+notyouraveragehooman@users.noreply.github.com>2020-08-09 16:20:59 -0700
committerGitHub <noreply@github.com>2020-08-09 16:20:59 -0700
commit149ae2e2d242909a982eebc05e95128698a13d0d (patch)
treea46a3bf9c799f33ab489a1494e66097377c33ad6 /src
parent133984ad5b5b85c339095dcec2a0dc1a18533231 (diff)
parent001845ba3a226c33ceb7479c1cf8bc5fa182700a (diff)
Merge branch 'master' into master
Diffstat (limited to 'src')
-rw-r--r--src/enemy/bombPeahat.c2
-rw-r--r--src/enemy/keese.c2
-rw-r--r--src/enemy/octorok.c2
-rw-r--r--src/enemy/rupeeLike.c2
-rw-r--r--src/enemy/smallPesto.c2
-rw-r--r--src/enemy/wisp.c2
-rw-r--r--src/manager/managerA.c168
-rwxr-xr-xsrc/object/pot.c169
8 files changed, 343 insertions, 6 deletions
diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c
index 932c7f6a..90ae7830 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 825c75ed..980237ef 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 c127367e..714d3788 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 b54bda31..b56ff33a 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/manager/managerA.c b/src/manager/managerA.c
new file mode 100644
index 00000000..699c5634
--- /dev/null
+++ b/src/manager/managerA.c
@@ -0,0 +1,168 @@
+#include "global.h"
+#include "entity.h"
+#include "player.h"
+#include "manager.h"
+#include "flags.h"
+#include "area.h"
+
+
+extern void (*gUnk_081081F4[])(Manager*);
+
+void sub_08058380(Manager* this) {
+ gUnk_081081F4[this->unk_0c](this);
+}
+
+
+
+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;
+ }
+}
+
+
+void sub_08058408(Manager*);
+
+void sub_080583EC(Manager* this) {
+ if (CheckFlags(this->unk_3e) != 0) {
+ this->unk_0c = 2;
+ 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 = (gPlayerState.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 ((gPlayerState.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 (gPlayerState.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 ((gPlayerState.flags.all & 0x1235) != 0)
+ return;
+ if (gPlayerEntity.height.HALF.HI != 0)
+ return;
+ gPlayerState.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 (gPlayerEntity.action != 1 && gPlayerEntity.action != 9) return;
+ gPlayerState.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();
+ }
+}
diff --git a/src/object/pot.c b/src/object/pot.c
new file mode 100755
index 00000000..a31a5567
--- /dev/null
+++ b/src/object/pot.c
@@ -0,0 +1,169 @@
+#include "global.h"
+#include "entity.h"
+#include "functions.h"
+#include "flags.h"
+#include "player.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 (gPlayerState.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) {
+ gPlayerState.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 = gPlayerEntity.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, &gPlayerEntity);
+ return;
+ }
+
+ DeleteThisEntity();
+}
+
+void sub_080825E8(Entity* this) {
+ DeleteThisEntity();
+}
+
+void sub_080825F0(Entity* this) {
+ if (gPlayerState.heldObject == 0) {
+ sub_08082608(this);
+ }
+}
+
+void sub_08082608(Entity* this) {
+ this->action = 1;
+ this->previousActionFlag = 0;
+}