decompile madderpillar

This commit is contained in:
Behemoth 2020-09-18 01:20:53 +02:00
parent 7e9ef1afa7
commit 34d16a7db5
23 changed files with 753 additions and 1346 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,115 @@
.syntax unified
.text
push {r4, r5, r6, r7, lr}
mov r7, sl
mov r6, sb
mov r5, r8
push {r5, r6, r7}
sub sp, #8
adds r5, r0, #0
ldrb r0, [r5, #0x15]
lsrs r0, r0, #3
lsls r1, r0, #1
adds r1, r1, r0
ldr r0, _08029EE0 @ =gUnk_080CCDC8
adds r1, r1, r0
str r1, [sp]
bl Random
movs r1, #1
ands r1, r0
lsls r1, r1, #1
subs r1, #1
mov sl, r1
bl Random
adds r1, r0, #0
movs r0, #0xf
ands r0, r1
movs r1, #3
bl __modsi3
mov sb, r0
movs r1, #0x2e
ldrsh r0, [r5, r1]
ldr r3, _08029EE4 @ =gRoomControls
ldrh r1, [r3, #6]
subs r0, r0, r1
asrs r0, r0, #4
mov r8, r0
movs r2, #0x3f
ands r0, r2
mov r8, r0
movs r1, #0x32
ldrsh r0, [r5, r1]
ldrh r1, [r3, #8]
subs r0, r0, r1
asrs r0, r0, #4
ands r0, r2
lsls r0, r0, #6
mov r1, r8
orrs r1, r0
mov r8, r1
movs r7, #0
_08029E72:
ldr r0, [sp]
add r0, sb
ldrb r4, [r0]
lsrs r0, r4, #3
lsls r0, r0, #1
ldr r1, _08029EE8 @ =gUnk_080B4488
adds r0, r0, r1
movs r1, #0
ldrsh r0, [r0, r1]
add r0, r8
adds r1, r5, #0
adds r1, #0x38
ldrb r1, [r1]
bl sub_080002E0
adds r6, r5, #0
adds r6, #0x74
cmp r0, #0
bne _08029EA6
str r4, [sp, #4]
ldrb r1, [r5, #0x15]
ldrb r0, [r6]
subs r0, r1, r0
subs r1, r4, r1
cmp r0, r1
bne _08029EBA
_08029EA6:
mov r0, sb
add r0, sl
adds r0, #3
movs r1, #3
bl __modsi3
mov sb, r0
adds r7, #1
cmp r7, #2
bls _08029E72
_08029EBA:
cmp r7, #3
bne _08029EC0
ldr r4, [sp, #4]
_08029EC0:
ldrb r1, [r5, #0x15]
ldrb r0, [r6]
cmp r0, r1
beq _08029ECA
strb r1, [r6]
_08029ECA:
strb r4, [r5, #0x15]
adds r0, r5, #0
bl sub_08029F0C
add sp, #8
pop {r3, r4, r5}
mov r8, r3
mov sb, r4
mov sl, r5
pop {r4, r5, r6, r7, pc}
.align 2, 0
_08029EE0: .4byte gUnk_080CCDC8
_08029EE4: .4byte gRoomControls
_08029EE8: .4byte gUnk_080B4488
.syntax divided

View File

@ -135,7 +135,7 @@ typedef struct Entity {
/*0x80*/ union SplitHWord field_0x80;
/*0x82*/ union SplitHWord field_0x82;
/*0x84*/ union SplitHWord cutsceneBeh;
/*0x86*/ u16 field_0x86;
/*0x86*/ union SplitHWord field_0x86;
} Entity;
#define COORD_TO_TILE(entity) \

View File

@ -349,7 +349,7 @@ SECTIONS {
src/enemy/spearMoblin.o(.text);
asm/businessScrub.o(.text);
src/enemy/rupeeLike.o(.text);
asm/madderpillar.o(.text);
src/enemy/madderpillar.o(.text);
asm/waterDrop.o(.text);
asm/wallMaster.o(.text);
src/enemy/bombPeahat.o(.text);

View File

@ -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;
}

584
src/enemy/madderpillar.c Normal file
View File

@ -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
*/

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;
}

View File

@ -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;

View File

@ -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();