summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBehemoth <Luisscheurenbrand@gmail.com>2020-09-18 01:20:53 +0200
committerBehemoth <Luisscheurenbrand@gmail.com>2020-09-18 01:21:13 +0200
commit34d16a7db5098015386b092cbfcdad8ffdfe9c86 (patch)
treedeb552c98d3c7e40d6c98b6d9bb226bfe36917e5 /src
parent7e9ef1afa7054073b2dc24d203b676d83df67297 (diff)
decompile madderpillar
Diffstat (limited to 'src')
-rw-r--r--src/createObject.c2
-rw-r--r--src/enemy/madderpillar.c584
-rw-r--r--src/enemy/pesto.c22
-rw-r--r--src/enemy/puffstool.c6
-rw-r--r--src/manager/manager20.c2
-rw-r--r--src/object/bigVortex.c4
-rw-r--r--src/object/button.c6
-rw-r--r--src/object/fan.c4
-rw-r--r--src/object/heartContainer.c2
-rw-r--r--src/object/hiddenLadderDown.c4
-rw-r--r--src/object/jailBars.c4
-rw-r--r--src/object/lightableSwitch.c12
-rw-r--r--src/object/mask.c6
-rw-r--r--src/object/metalDoor.c2
-rw-r--r--src/object/object2A.c2
-rw-r--r--src/object/objectA.c4
-rwxr-xr-xsrc/object/pot.c6
-rw-r--r--src/object/railtrack.c12
-rw-r--r--src/object/treeHidingPortal.c4
19 files changed, 636 insertions, 52 deletions
diff --git a/src/createObject.c b/src/createObject.c
index 25adbe29..ad852900 100644
--- a/src/createObject.c
+++ b/src/createObject.c
@@ -78,7 +78,7 @@ Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) {
ent = CreateObjectWithParent(parent, 0, form, subtype);
if (ent != NULL) {
ent->actionDelay = 5;
- ent->field_0x86 = param_4;
+ ent->field_0x86.HWORD = param_4;
}
return ent;
}
diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c
new file mode 100644
index 00000000..78a579e9
--- /dev/null
+++ b/src/enemy/madderpillar.c
@@ -0,0 +1,584 @@
+#include "enemy.h"
+#include "entity.h"
+#include "functions.h"
+
+extern u8 gEntCount;
+extern BoundingBox gUnk_080FD298;
+extern BoundingBox gUnk_080FD2A0;
+
+void sub_08029E0C(Entity*);
+void sub_08029EEC(Entity*);
+void sub_0802A098(Entity*);
+void sub_0802A16C(Entity*);
+void sub_0802A058(Entity*);
+bool32 sub_0802A14C(Entity*);
+void sub_0802A18C(Entity*);
+bool32 sub_08029FE4(Entity*);
+void sub_08029FB4(Entity*, u32, u32);
+void sub_0802A0F8(Entity*);
+
+extern void (*const gUnk_080CCD44[])(Entity*);
+extern void (*const gUnk_080CCD60[])(Entity*);
+extern void (*const gUnk_080CCD78[])(Entity*);
+extern void (*const gUnk_080CCD88[])(Entity*);
+extern const u8 gUnk_080CCDA0[];
+extern void (*const gUnk_080CCDA8[])(Entity*);
+extern const u8 gUnk_080CCDC8[];
+extern const u16 gUnk_080CCDD4[];
+
+void Madderpillar(Entity* this) {
+ gUnk_080CCD44[this->entityType.form](this);
+}
+
+void sub_08029870(Entity* this) {
+ gUnk_080CCD60[GetNextFunction(this)](this);
+}
+
+void sub_0802988C(Entity* this) {
+ gUnk_080CCD78[this->action](this);
+}
+
+void sub_080298A4(Entity* this) {
+ if (this->action == 1) {
+ switch (this->bitfield & 0x7f) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 0xf:
+ case 0x13:
+ case 0x1b:
+ case 0x1e:
+ break;
+ default:
+ this->action = 2;
+ this->actionDelay = 0;
+ this->damageType = 0x6b;
+ this->field_0x76.HALF.HI = 0;
+ sub_0801D2B4(this, 0x7f);
+ EnqueueSFX(0xfe);
+ this->attachedEntity->action = 2;
+ break;
+ }
+ }
+
+ sub_0804AA30(this, gUnk_080CCD60);
+}
+
+void sub_08029980(Entity* this) {
+ if (this->field_0xf) {
+ this->field_0xf--;
+ } else {
+ sub_0804A7D4(this);
+ }
+}
+
+void nullsub_14(Entity* this) {
+ /* ... */
+}
+
+void sub_0802999C(Entity* this) {
+ if (gEntCount < 0x44) {
+ Entity *ent1, *ent2, *ent3, *ent4, *ent5, *ent6;
+
+ ent1 = CreateEnemy(0x18, 1);
+ ent1->parent = this;
+ PositionRelative(this, ent1, 0, 5);
+ this->attachedEntity = ent1;
+
+ ent2 = CreateEnemy(0x18, 2);
+ ent2->parent = this;
+ PositionRelative(this, ent2, 0, 4);
+ ent1->attachedEntity = ent2;
+
+ ent3 = CreateEnemy(0x18, 3);
+ ent3->parent = this;
+ PositionRelative(this, ent3, 0, 3);
+ ent2->attachedEntity = ent3;
+
+ ent4 = CreateEnemy(0x18, 4);
+ ent4->parent = this;
+ PositionRelative(this, ent4, 0, 2);
+ ent3->attachedEntity = ent4;
+
+ ent5 = CreateEnemy(0x18, 5);
+ ent5->parent = this;
+ PositionRelative(this, ent5, 0, 1);
+ ent4->attachedEntity = ent5;
+
+ ent6 = CreateEnemy(0x18, 6);
+ ent6->attachedEntity = this;
+ ent6->parent = this;
+ PositionRelative(this, ent6, 0, 0);
+ ent5->attachedEntity = ent6;
+
+ this->action = 1;
+ this->flags |= 0x80;
+ this->direction = DirectionRound(Random());
+ this->nonPlanarMovement = 0xa0;
+ this->animationState = 0xff;
+ this->y.WORD += 6;
+ this->parent = this;
+ this->field_0x74.HALF.LO = 0xff;
+ this->field_0x74.HALF.HI = 0;
+ this->field_0x76.HALF.HI = 1;
+ sub_08029E0C(this);
+ sub_08029EEC(this);
+ }
+}
+
+void sub_08029A94(Entity* this) {
+ UpdateAnimationSingleFrame(this);
+ sub_0802A098(this);
+}
+
+void sub_08029AA4(Entity* this) {
+ if (this->field_0x76.HALF.HI != 0) {
+ this->action = 3;
+ this->nonPlanarMovement = 0x108;
+ this->damageType = 0x6a;
+ this->field_0x7a.HWORD = 0x168;
+ this->field_0x74.HALF.HI = 4;
+ sub_08029EEC(this);
+ EnqueueSFX(0x19d);
+ }
+}
+
+void sub_08029AE0(Entity* this) {
+ UpdateAnimationSingleFrame(this);
+ sub_0802A16C(this);
+ sub_0802A098(this);
+ if (--this->field_0x7a.HWORD == 0) {
+ this->action = 1;
+ this->nonPlanarMovement = 0xa0;
+ this->field_0x74.HALF.HI = 0;
+ sub_08029EEC(this);
+ sub_0801D2B4(this, 0x77);
+ EnqueueSFX(0x182);
+ }
+}
+
+void sub_08029B2C(Entity* this) {
+ if (sub_0802A14C(this)) {
+ if (this->field_0x86.HALF.LO) {
+ if (--this->actionDelay == 0) {
+ CreateFx(this, 0x48, 0);
+ DeleteEntity(this);
+ }
+ } else {
+ this->flags &= ~0x80;
+ this->actionDelay = -(this->entityType.form * 15 - 90);
+ this->field_0x86.HALF.LO = 1;
+ }
+ } else {
+ gUnk_080CCD88[this->action](this);
+ }
+}
+
+void sub_08029B90(Entity* this) {
+ this->action = 1;
+ this->spriteSettings.b.draw = 1;
+ sub_0802A058(this);
+ if (this->entityType.form < 2) {
+ InitializeAnimation(this, 0);
+ } else {
+ InitializeAnimation(this, 4);
+ }
+}
+
+void sub_08029BC4(Entity* this) {
+ u32 uVar1;
+ u32 uVar2;
+
+ sub_0802A18C(this);
+ uVar1 = this->x.HALF.HI;
+ uVar2 = this->y.HALF.HI;
+ if (sub_08029FE4(this)) {
+ u32 index;
+ if (this->entityType.form < 2) {
+ index = 0;
+ } else {
+ index = 4;
+ }
+ InitializeAnimation(this, this->animationState + index);
+ }
+ sub_08029FB4(this, this->x.HALF.HI - uVar1, this->y.HALF.HI - uVar2);
+}
+
+void sub_08029C08(Entity* this) {
+ this->action = 3;
+ this->actionDelay = gUnk_080CCDA0[this->entityType.form];
+ this->damageType = 0x6b;
+ this->attachedEntity->action = 2;
+}
+
+void sub_08029C2C(Entity* this) {
+ if (--this->actionDelay == 0) {
+ this->action = 4;
+ sub_0801D2B4(this, 0x7f);
+ EnqueueSFX(0x6c);
+ }
+}
+
+void sub_08029C50(Entity* this) {
+ if (this->parent->field_0x76.HALF.HI != 0) {
+ this->action = 5;
+ this->damageType = 0x6a;
+ }
+}
+
+void sub_08029C6C(Entity* this) {
+ sub_0802A18C(this);
+ sub_08029BC4(this);
+ if (this->parent->action != 3) {
+ this->action = 1;
+ sub_0801D2B4(this, 0x77);
+ } else {
+ sub_0802A16C(this);
+ }
+}
+
+void sub_08029C98(Entity* this) {
+ if (sub_0802A14C(this)) {
+ CreateFx(this, 0x48, 0);
+ DeleteEntity(this);
+ } else {
+ gUnk_080CCDA8[this->action](this);
+ }
+}
+
+void sub_08029CCC(Entity* this) {
+ this->action = 1;
+ this->spriteSettings.b.draw = 1;
+ sub_0802A058(this);
+ InitializeAnimation(this, 8);
+}
+
+void sub_08029CF0(Entity* this) {
+ if (sub_08029FE4(this)) {
+ InitializeAnimation(this, this->animationState + 8);
+ }
+}
+
+void sub_08029D08(Entity* this) {
+ this->action = 3;
+ this->actionDelay = 0x47;
+}
+
+void sub_08029D14(Entity* this) {
+ if (this->actionDelay) {
+ if (--this->actionDelay == 0) {
+ InitializeAnimation(this, this->animationState + 0xc);
+ sub_0801D2B4(this, 0x7f);
+ EnqueueSFX(0x6c);
+ }
+ } else {
+ GetNextFrame(this);
+ if (this->frames.all & 0x80) {
+ this->action = 4;
+ this->actionDelay = 0x78;
+ this->damageType = 0x6c;
+ this->boundingBox = &gUnk_080FD298;
+ EnqueueSFX(0x6b);
+ }
+ }
+}
+
+void sub_08029D78(Entity* this) {
+ sub_0802A0F8(this);
+ if (--this->actionDelay == 0) {
+ this->action = 5;
+ this->damageType = 0x6a;
+ this->boundingBox = (BoundingBox*)&gUnk_080FD2A0;
+ InitializeAnimation(this, this->animationState + 0x10);
+ }
+}
+
+void sub_08029DAC(Entity* this) {
+ GetNextFrame(this);
+ if (this->frames.all & 0x80) {
+ this->action = 6;
+ this->parent->field_0x76.HALF.HI = 1;
+ InitializeAnimation(this, this->animationState + 8);
+ }
+}
+
+void sub_08029DDC(Entity* this) {
+ this->action = 7;
+}
+
+void sub_08029DE4(Entity* this) {
+ sub_08029CF0(this);
+ if (this->parent->action != 3) {
+ this->action = 1;
+ sub_0801D2B4(this, 0x77);
+ } else {
+ sub_0802A16C(this);
+ }
+}
+
+NAKED
+void sub_08029E0C(Entity* this) {
+ asm(".include \"asm/non_matching/madderpillar/sub_08029E0C.inc\"");
+}
+
+void sub_08029EEC(Entity* this) {
+ u32 uVar1 = (this->direction >> 3) + this->field_0x74.HALF.HI;
+ if (uVar1 != this->animationState) {
+ this->animationState = uVar1;
+ InitAnimationForceUpdate(this, uVar1);
+ }
+}
+
+void sub_08029F0C(Entity* this) {
+ switch (this->direction >> 3) {
+ case 0:
+ this->field_0x78.HWORD = this->y.HALF.HI - 0x10;
+ break;
+ case 1:
+ this->field_0x78.HWORD = this->x.HALF.HI + 0x10;
+ break;
+ case 2:
+ this->field_0x78.HWORD = this->y.HALF.HI + 0x10;
+ break;
+ case 3:
+ this->field_0x78.HWORD = this->x.HALF.HI - 0x10;
+ break;
+ }
+}
+
+bool32 sub_08029F48(Entity* this) {
+ switch (this->direction >> 3) {
+ case 0:
+ if (this->y.HALF.HI <= this->field_0x78.HWORD) {
+ this->y.HALF.HI = this->field_0x78.HWORD;
+ return TRUE;
+ }
+ break;
+ case 1:
+ if (this->x.HALF.HI >= this->field_0x78.HWORD) {
+ this->x.HALF.HI = this->field_0x78.HWORD;
+ return TRUE;
+ }
+ break;
+ case 2:
+ if (this->y.HALF.HI >= this->field_0x78.HWORD) {
+ this->y.HALF.HI = this->field_0x78.HWORD;
+ return TRUE;
+ }
+ break;
+ case 3:
+ if (this->x.HALF.HI <= this->field_0x78.HWORD) {
+ this->x.HALF.HI = this->field_0x78.HWORD;
+ return TRUE;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+void sub_08029FB4(Entity* this, u32 x, u32 y) {
+ u8* dst = (u8*)&this->attachedEntity->field_0x78;
+ s32 unk = this->parent->field_0x7c.BYTES.byte2;
+ u8 idx = unk % 0xe;
+ dst[idx] = ((x + 8) & 0xf) | (((y + 8) & 0xf) << 4);
+}
+
+/* The optimizer is strong within you. */
+bool32 sub_08029FE4(Entity* this) {
+ u8 state;
+ u8* dst = (u8*)&this->field_0x78;
+ s32 unk = this->parent->field_0x7c.BYTES.byte2 + 1;
+ s8 iVar6 = (dst[unk % 0xe] & 0xf) - 8;
+ s8 iVar5 = (dst[unk % 0xe] >> 4) - 8;
+ this->x.HALF.HI += iVar6;
+ this->y.HALF.HI += iVar5;
+ GetNextFrame(this);
+
+ state = 0xff;
+ if (iVar6 != 0) {
+ if (0 < iVar6) {
+ state = 1;
+ } else {
+ state = 3;
+ }
+ }
+
+ if (iVar5 != 0) {
+ if (0 < iVar5) {
+ state = 2;
+ } else {
+ state = 0;
+ }
+ }
+
+ if (state != 0xff && state != this->animationState) {
+ this->animationState = state;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+void sub_0802A058(Entity* this) {
+ this->field_0x78.HALF.LO = 0x88;
+ this->field_0x78.HALF.HI = 0x88;
+ this->field_0x7a.HALF.LO = 0x88;
+ this->field_0x7a.HALF.HI = 0x88;
+ this->field_0x7c.BYTES.byte0 = 0x88;
+ this->field_0x7c.BYTES.byte1 = 0x88;
+ this->field_0x7c.BYTES.byte2 = 0x88;
+ this->field_0x7c.BYTES.byte3 = 0x88;
+ this->field_0x80.HALF.LO = 0x88;
+ this->field_0x80.HALF.HI = 0x88;
+ this->field_0x82.HALF.LO = 0x88;
+ this->field_0x82.HALF.HI = 0x88;
+ this->cutsceneBeh.HALF.LO = 0x88;
+ this->cutsceneBeh.HALF.HI = 0x88;
+}
+
+void sub_0802A098(Entity* this) {
+ u32 uVar1;
+ u32 uVar2;
+ s32 unk = (++this->field_0x7c.BYTES.byte2, this->field_0x7c.BYTES.byte2);
+ u8 idx = unk % 0xe;
+ if (idx == 0) {
+ this->field_0x7c.BYTES.byte2 = 0;
+ }
+ uVar1 = this->x.HALF.HI;
+ uVar2 = this->y.HALF.HI;
+ ProcessMovement(this);
+ if (sub_08029F48(this)) {
+ sub_08029E0C(this);
+ sub_08029EEC(this);
+ EnqueueSFX(0x104);
+ }
+
+ sub_08029FB4(this, this->x.HALF.HI - uVar1, this->y.HALF.HI - uVar2);
+}
+
+void sub_0802A0F8(Entity* this) {
+ if (this->currentHealth != 0) {
+ if ((this->bitfield & 0x80) && this->hurtBlinkTime != 0) {
+ Entity* ent = this;
+ u32 i;
+ for (i = 0; i < 6; i++) {
+ ent = ent->attachedEntity;
+ ent->hurtBlinkTime = this->hurtBlinkTime;
+ }
+ }
+ } else {
+ this->parent->flags &= ~0x80;
+ this->parent->currentHealth = 0;
+ this->parent->field_0xf = 0x69;
+ }
+}
+
+bool32 sub_0802A14C(Entity* this) {
+ u32 ret = FALSE;
+
+ if (this->parent->currentHealth == 0 || this->field_0x86.HALF.LO) {
+ ret = TRUE;
+ } else {
+ ret = FALSE;
+ }
+ return ret;
+}
+
+void sub_0802A16C(Entity* this) {
+ sub_0801D2B4(this, gUnk_080CCDD4[this->parent->field_0x7a.HWORD >> 2 & 3]);
+}
+
+void sub_0802A18C(Entity* this) {
+ if (this->bitfield & 0x80) {
+ switch (this->bitfield & 0x7f) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 0xf:
+ case 0x13:
+ case 0x1b:
+ case 0x1e:
+ break;
+ default:
+ EnqueueSFX(0x12e);
+ break;
+ }
+ }
+}
+
+/*
+// clang-format off
+void (*const gUnk_080CCD44[])(Entity*) = {
+ sub_08029870,
+ sub_08029B2C,
+ sub_08029B2C,
+ sub_08029B2C,
+ sub_08029B2C,
+ sub_08029B2C,
+ sub_08029C98,
+};
+
+void (*const gUnk_080CCD60[])(Entity*) = {
+ sub_0802988C,
+ sub_080298A4,
+ sub_0802988C,
+ sub_08029980,
+ sub_08001242,
+ nullsub_14,
+};
+
+void (*const gUnk_080CCD78[])(Entity*) = {
+ sub_0802999C,
+ sub_08029A94,
+ sub_08029AA4,
+ sub_08029AE0,
+};
+
+void (*const gUnk_080CCD88[])(Entity*) = {
+ sub_08029B90,
+ sub_08029BC4,
+ sub_08029C08,
+ sub_08029C2C,
+ sub_08029C50,
+ sub_08029C6C,
+};
+
+const u8 gUnk_080CCDA0[] = {
+ 0x00, 0x24,
+ 0x30,
+ 0x3A,
+ 0x41,
+ 0x45,
+ 0x00,
+ 0x00,
+};
+
+void (*const gUnk_080CCDA8[])(Entity*) = {
+ sub_08029CCC,
+ sub_08029CF0,
+ sub_08029D08,
+ sub_08029D14,
+ sub_08029D78,
+ sub_08029DAC,
+ sub_08029DDC,
+ sub_08029DE4,
+};
+
+const u8 gUnk_080CCDC8[] = {
+ 0x08, 0x00,
+ 0x18, 0x00,
+ 0x10, 0x08,
+ 0x10, 0x08,
+ 0x18, 0x00,
+ 0x18, 0x10,
+};
+
+const u16 gUnk_080CCDD4[] = {
+ 0x80, 0x81,
+ 0x82, 0x81,
+};
+// clang-format on
+*/
diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c
index 5849d45a..8147d832 100644
--- a/src/enemy/pesto.c
+++ b/src/enemy/pesto.c
@@ -49,7 +49,7 @@ void sub_08023F44(Entity* this) {
void sub_08023F5C(Entity* this) {
if (this->damageType != 0x6e) {
if (this->bitfield == 0x80) {
- *(u8*)&this->field_0x86 = 0x30;
+ this->field_0x86.HALF.LO = 0x30;
if ((this->field_0x82.HALF.HI & 0xf) == 3 && this->action == 6) {
switch (this->field_0x80.HALF.LO) {
@@ -155,8 +155,8 @@ void sub_080240B8(Entity* this) {
this->field_0x80.HALF.HI = Random() & 0x40;
this->field_0x82.HALF.LO = 0;
this->field_0x82.HALF.HI = 0x80;
- *((u8*)&this->field_0x86 + 0) = 0;
- *((u8*)&this->field_0x86 + 1) = 0;
+ this->field_0x86.HALF.LO = 0;
+ this->field_0x86.HALF.HI = 0;
this->actionDelay = 0;
this->field_0xf = 0x20;
this->field_0x3c |= 0x10;
@@ -727,19 +727,19 @@ void sub_08024C94(Entity* this) {
bool32 sub_08024CC0(Entity* this) {
bool32 uVar2;
- uVar2 = 1;
+ uVar2 = TRUE;
if (!sub_08024C48(this, 1)) {
- uVar2 = 0;
+ uVar2 = FALSE;
} else if (!sub_08049F1C(this, gUnk_020000B0, 0x50) || !sub_08049FDC(this, 3)) {
- uVar2 = 0;
+ uVar2 = FALSE;
sub_08024C7C(this);
}
return uVar2;
}
void sub_08024D00(Entity* this) {
- if (*(u8*)&this->field_0x86) {
- (*(u8*)&this->field_0x86)--;
+ if (this->field_0x86.HALF.LO) {
+ this->field_0x86.HALF.LO--;
GetNextFrame(this);
} else {
sub_08024940(this);
@@ -804,9 +804,9 @@ void sub_08024E4C(Entity* this) {
this->cutsceneBeh.HALF.LO += 1 + (Random() & 1);
}
- if (gUnk_02002A40.stats.health == 0 || *((u8*)&this->field_0x86 + 1) == 4) {
+ if (gUnk_02002A40.stats.health == 0 || this->field_0x86.HALF.HI == 4) {
this->cutsceneBeh.HALF.LO = 0x30;
- *((u8*)&this->field_0x86 + 1) = 0;
+ this->field_0x86.HALF.HI = 0;
sub_08024F50(this);
this->field_0x80.HALF.LO = 0;
this->nonPlanarMovement = 0x40;
@@ -828,7 +828,7 @@ void sub_08024E4C(Entity* this) {
player->animationState = 4;
player->spritePriority.b1 = 0;
if (this->field_0xf == 0) {
- (*((u8*)&this->field_0x86 + 1))++;
+ (this->field_0x86.HALF.HI++;
player->hurtBlinkTime = 8;
ModHealth(-2);
sub_0800449C(player, 0x7a);
diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c
index 2a87dc68..881437f5 100644
--- a/src/enemy/puffstool.c
+++ b/src/enemy/puffstool.c
@@ -169,7 +169,7 @@ void sub_08025230(Entity* this) {
if (sub_0802571C(this)) {
this->action = 2;
this->actionDelay = 240;
- this->field_0x86 = COORD_TO_TILE(this);
+ this->field_0x86.HWORD = COORD_TO_TILE(this);
}
} else {
this->field_0x78.HWORD--;
@@ -186,12 +186,12 @@ void sub_080252E0(Entity* this) {
GetNextFrame(this);
tile = COORD_TO_TILE(this);
- if (tile == this->field_0x86) {
+ if (tile == this->field_0x86.HWORD) {
if (--this->actionDelay == 0) {
sub_080256B4(this);
}
} else {
- this->field_0x86 = tile;
+ this->field_0x86.HWORD = tile;
this->actionDelay = 240;
}
diff --git a/src/manager/manager20.c b/src/manager/manager20.c
index 1f989f10..fe50967e 100644
--- a/src/manager/manager20.c
+++ b/src/manager/manager20.c
@@ -22,7 +22,7 @@ extern void DeleteManager(Manager20*);
void sub_0805B7A0(Manager20* this) {
Entity* tmp = CreateObject(this->manager.unk_0e, this->manager.unk_0a, this->manager.unk_0b);
if (!tmp) return;
- tmp->field_0x86 = this->unk_3e;
+ tmp->field_0x86.HWORD = this->unk_3e;
if (CheckFlags(this->unk_3e)) {
tmp->x.HALF.HI = this->unk_36 | (this->unk_37&0xF)<<8;//r1
tmp->y.HALF.HI = this->unk_3c & 0xFFF;
diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c
index 73c6a034..8e8522c0 100644
--- a/src/object/bigVortex.c
+++ b/src/object/bigVortex.c
@@ -23,7 +23,7 @@ void sub_08098D1C(Entity* this) {
this->action = 1;
this->height.HALF.HI = -0x10;
- temp = this->field_0x86;
+ temp = this->field_0x86.HWORD;
if ((temp != 0) && !CheckFlags(temp)) {
this->action = 1;
@@ -39,7 +39,7 @@ void sub_08098D1C(Entity* this) {
void sub_08098D6C(Entity* this) {
Entity* ent;
- if (CheckFlags(this->field_0x86)) {
+ if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 2;
this->actionDelay = 0x2d;
ent = CreateFx(this, 0x43, 0);
diff --git a/src/object/button.c b/src/object/button.c
index b66c7f2d..99d018b3 100644
--- a/src/object/button.c
+++ b/src/object/button.c
@@ -22,7 +22,7 @@ void sub_08081AE0(Entity* this) {
this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.roomOriginX)>>4) & 0x3F) |
((((this->y.HALF.HI - gRoomControls.roomOriginY)>>4) & 0x3F) << 6);
this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
- if (this->entityType.form == 0 && CheckFlags(this->field_0x86)) {
+ if (this->entityType.form == 0 && CheckFlags(this->field_0x86.HWORD)) {
this->action = 5;
SetTileType(0x7A, this->field_0x74.HWORD, this->collisionLayer);
} else {
@@ -92,7 +92,7 @@ void sub_08081C30(Entity* this) {
}
} else {
this->action = 2;
- ClearFlag(this->field_0x86);
+ ClearFlag(this->field_0x86.HWORD);
SetTileType(0x77, this->field_0x74.HWORD, this->collisionLayer);
PlaySFX(0x10C);
}
@@ -257,7 +257,7 @@ u32 sub_08081F7C(Entity* this, u32 r7) {
this->attachedEntity->spriteOffsetY = 0xfc;
} else {
if (this->actionDelay == 6) {
- SetFlag(this->field_0x86);
+ SetFlag(this->field_0x86.HWORD);
SetTileType(r7, this->field_0x74.HWORD, this->collisionLayer);
sub_08081F24(this);
PlaySFX(0x10C);
diff --git a/src/object/fan.c b/src/object/fan.c
index c73cec9b..564ff69c 100644
--- a/src/object/fan.c
+++ b/src/object/fan.c
@@ -40,8 +40,8 @@ void sub_0809ED88(Entity *this)
{
sub_0809F08C();
sub_0809EE44(this);
- if (this->field_0x86 != 0) {
- if (this->cutsceneBeh.HWORD == this->field_0x86) {
+ if (this->field_0x86.HWORD != 0) {
+ if (this->cutsceneBeh.HWORD == this->field_0x86.HWORD) {
if (CheckFlags(this->cutsceneBeh.HWORD)) {
return;
}
diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c
index 9222f36f..a2a35887 100644
--- a/src/object/heartContainer.c
+++ b/src/object/heartContainer.c
@@ -37,7 +37,7 @@ static void sub_0808E6A0(Entity* this) {
}
static void sub_0808E6E4(Entity* this) {
- if (CheckFlags(this->field_0x86)) {
+ if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 2;
this->spriteSettings.b.draw = 1;
this->spriteRendering.b0 = 3;
diff --git a/src/object/hiddenLadderDown.c b/src/object/hiddenLadderDown.c
index f878f055..932018c8 100644
--- a/src/object/hiddenLadderDown.c
+++ b/src/object/hiddenLadderDown.c
@@ -20,7 +20,7 @@ void sub_08091F14(Entity* this) {
this->animIndex = 0;
this->field_0x70.HALF.LO = COORD_TO_TILE(this);
puVar3 = &this->field_0x70.HALF.LO;
- if (CheckFlags(this->field_0x86) != 0) {
+ if (CheckFlags(this->field_0x86.HWORD) != 0) {
this->action = 2;
this->spriteSettings.b.draw = TRUE;
SetTileType(0x1a2, *puVar3 - 0x41, this->collisionLayer);
@@ -39,6 +39,6 @@ void sub_08092000(Entity* this) {
if (GetTileType(*(u16*)&this->field_0x70.HALF.LO, this->collisionLayer) == 0x1a6) {
this->action = 2;
this->spriteSettings.b.draw = TRUE;
- SetFlag(this->field_0x86);
+ SetFlag(this->field_0x86.HWORD);
}
} \ No newline at end of file
diff --git a/src/object/jailBars.c b/src/object/jailBars.c
index c72713b6..4fe3cb26 100644
--- a/src/object/jailBars.c
+++ b/src/object/jailBars.c
@@ -18,7 +18,7 @@ void JailBars(Entity *this)
void sub_080A08C4(Entity *this)
{
- if (CheckFlags(this->field_0x86) == 0) {
+ if (CheckFlags(this->field_0x86.HWORD) == 0) {
this->action = 1;
sub_080A0960(this, 0);
}
@@ -34,7 +34,7 @@ void sub_080A08C4(Entity *this)
void sub_080A0910(Entity *this)
{
- if (CheckFlags(this->field_0x86) != 0) {
+ if (CheckFlags(this->field_0x86.HWORD) != 0) {
this->action = 2;
sub_080A0960(this, 1);
PlaySFX(0x10b);
diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c
index 047f5282..3d33dcfe 100644
--- a/src/object/lightableSwitch.c
+++ b/src/object/lightableSwitch.c
@@ -45,10 +45,10 @@ void sub_0809EA34(Entity* this) {
void sub_0809EA80(Entity* this) {
if ((this->bitfield & 0x80) != 0) {
- if (CheckFlags(this->field_0x86) != 0) {
- ClearFlag(this->field_0x86);
+ if (CheckFlags(this->field_0x86.HWORD) != 0) {
+ ClearFlag(this->field_0x86.HWORD);
} else {
- SetFlag(this->field_0x86);
+ SetFlag(this->field_0x86.HWORD);
}
EnqueueSFX(0x110);
}
@@ -59,7 +59,7 @@ void sub_0809EABC(Entity* this) {
bool32 anySet;
u32 f;
- f = CheckFlags(this->field_0x86);
+ f = CheckFlags(this->field_0x86.HWORD);
anySet = (-f | f) >> 0x1F;
if (this->frameIndex != anySet) {
this->frameIndex = anySet;
@@ -122,7 +122,7 @@ void sub_0809EBD8(Entity* this) {
this->action = 2;
this->actionDelay = 0x10;
this->frameIndex = 2;
- SetFlag(this->field_0x86);
+ SetFlag(this->field_0x86.HWORD);
EnqueueSFX(0x110);
}
}
@@ -136,7 +136,7 @@ void sub_0809EC08(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 1;
this->frameIndex = 3;
- ClearFlag(this->field_0x86);
+ ClearFlag(this->field_0x86.HWORD);
EnqueueSFX(0x110);
}
}
diff --git a/src/object/mask.c b/src/object/mask.c
index a936e7e1..9fb42c68 100644
--- a/src/object/mask.c
+++ b/src/object/mask.c
@@ -31,7 +31,7 @@ void Mask(Entity *this) {
void sub_080929A4(Entity *this) {
if (this->entityType.parameter & 0xC0) {
- if (CheckFlags(this->field_0x86)) {
+ if (CheckFlags(this->field_0x86.HWORD)) {
s32 field_0x0a;
switch (this->entityType.parameter & 0xC0) {
@@ -45,7 +45,7 @@ void sub_080929A4(Entity *this) {
goto switchEnd;
}
- ClearFlag(this->field_0x86);
+ ClearFlag(this->field_0x86.HWORD);
break;
case 0x80:
DeleteThisEntity();
@@ -117,7 +117,7 @@ void sub_08092B0C(Entity *this) {
case 0x80:
EnqueueSFX(0x72);
case 0x40:
- SetFlag(this->field_0x86);
+ SetFlag(this->field_0x86.HWORD);
break;
}
diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c
index 7aa6ec5d..ec363f4d 100644
--- a/src/object/metalDoor.c
+++ b/src/object/metalDoor.c
@@ -77,7 +77,7 @@ void sub_080A074C(Entity *this)
void sub_080A07BC(Entity *this)
{
- if (CheckFlags(this->field_0x86)) {
+ if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 4;
this->actionDelay = 0xc;
this->direction = 0x10;
diff --git a/src/object/object2A.c b/src/object/object2A.c
index 032db162..f98b8cd0 100644
--- a/src/object/object2A.c
+++ b/src/object/object2A.c
@@ -30,7 +30,7 @@ void sub_08089B18(Entity *this)
CopyPosition(this->parent, this);
break;
case 4:
- if (!CheckFlags(this->field_0x86)) {
+ if (!CheckFlags(this->field_0x86.HWORD)) {
this->spriteSettings.b.draw = FALSE;
this->previousActionFlag = 1;
return;
diff --git a/src/object/objectA.c b/src/object/objectA.c
index 72c4e61a..60be0b74 100644
--- a/src/object/objectA.c
+++ b/src/object/objectA.c
@@ -20,7 +20,7 @@ void ObjectA(Entity *this) {
uVar2 = 0x34;
}
this->field_0x70.HALF.LO = uVar2;
- if (CheckFlags(this->field_0x86) != 0) {
+ if (CheckFlags(this->field_0x86.HWORD) != 0) {
SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
if ((gRoomControls.unk2 & 1) != 0) {
gUnk_02000070 = 0;
@@ -31,7 +31,7 @@ void ObjectA(Entity *this) {
}
} else if (this->interactType != 0) {
SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
- SetFlag(this->field_0x86);
+ SetFlag(this->field_0x86.HWORD);
CreateDust(this);
sub_080526F8(-1);
DeleteThisEntity();
diff --git a/src/object/pot.c b/src/object/pot.c
index b7cfc8d6..a415b3fb 100755
--- a/src/object/pot.c
+++ b/src/object/pot.c
@@ -30,7 +30,7 @@ void Pot(Entity* this) {
}
void sub_0808222C(Entity* this) {
- if (this->entityType.parameter == 1 && CheckFlags(this->field_0x86)) {
+ if (this->entityType.parameter == 1 && CheckFlags(this->field_0x86.HWORD)) {
DeleteThisEntity();
}
@@ -271,7 +271,7 @@ static void sub_08082850(Entity* this, Entity* parent) {
}
if (this->entityType.parameter == 1) {
- SetFlag(this->field_0x86);
+ SetFlag(this->field_0x86.HWORD);
}
DeleteThisEntity();
@@ -292,7 +292,7 @@ u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) {
if (entity) {
if (arg3 == 2) {
entity->actionDelay = 5;
- entity->field_0x86 = this->field_0x86;
+ entity->field_0x86.HWORD = this->field_0x86.HWORD;
} else {
entity->actionDelay = 0;
}
diff --git a/src/object/railtrack.c b/src/object/railtrack.c
index ef45e554..01222738 100644
--- a/src/object/railtrack.c
+++ b/src/object/railtrack.c
@@ -32,7 +32,7 @@ void sub_080851AC(Entity* this) {
}
this->animationState = this->entityType.parameter & 2;
if ((this->entityType).form == 3) {
- uVar1 = CheckFlags(this->field_0x86);
+ uVar1 = CheckFlags(this->field_0x86.HWORD);
this->field_0x7a.HWORD = uVar1;
if ((u16)(uVar1 & -1) != 0) {
this->animationState = (this->animationState + 2) & 3;
@@ -45,11 +45,11 @@ void sub_080851AC(Entity* this) {
}
void sub_08085264(Entity* this) {
- if (CheckFlags(this->field_0x86)) {
+ if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 2;
this->field_0xf = 8;
if (this->entityType.form == 1) {
- ClearFlag(this->field_0x86);
+ ClearFlag(this->field_0x86.HWORD);
}
this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3;
InitializeAnimation(this, this->animationState);
@@ -62,7 +62,7 @@ void sub_080852B4(Entity* this) {
if (--this->field_0xf == 0) {
this->action = 3;
this->field_0xf = this->actionDelay;
- this->field_0x7a.HWORD = CheckFlags(this->field_0x86);
+ this->field_0x7a.HWORD = CheckFlags(this->field_0x86.HWORD);
this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3;
InitializeAnimation(this, this->animationState);
sub_08085394(this);
@@ -77,13 +77,13 @@ void sub_08085308(Entity* this) {
case 1:
break;
case 2:
- if (CheckFlags(this->field_0x86) == 0) {
+ if (CheckFlags(this->field_0x86.HWORD) == 0) {
this->action = 1;
return;
}
break;
case 3:
- if (CheckFlags(this->field_0x86) == *(u16*)&this->field_0x7a) {
+ if (CheckFlags(this->field_0x86.HWORD) == *(u16*)&this->field_0x7a) {
this->field_0xf = 0xff;
} else {
this->field_0xf = 1;
diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c
index ab7888c5..eb507c93 100644
--- a/src/object/treeHidingPortal.c
+++ b/src/object/treeHidingPortal.c
@@ -23,7 +23,7 @@ void TreeHidingPortal(Entity* this) {
}
void sub_0809E83C(Entity* this) {
- if (CheckFlags(this->field_0x86)) {
+ if (CheckFlags(this->field_0x86.HWORD)) {
sub_0809E96C(this);
DeleteThisEntity();
}
@@ -60,7 +60,7 @@ void sub_0809E8BC(Entity* this) {
void sub_0809E8EC(Entity* this) {
if (--this->actionDelay == 0) {
- SetFlag(this->field_0x86);
+ SetFlag(this->field_0x86.HWORD);
sub_08078A90(0);
PlaySFX(0x73);
DeleteThisEntity();