From e7198ba633ecf86938631b7cdc10f6c06ceb54ed Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Fri, 15 Jul 2022 08:55:56 +0300 Subject: [PATCH 01/34] Match sub_0809028C --- .../pushableFurniture/sub_0809028C.inc | 256 ------------------ src/object/pushableFurniture.c | 92 ++++++- 2 files changed, 90 insertions(+), 258 deletions(-) delete mode 100644 asm/non_matching/pushableFurniture/sub_0809028C.inc diff --git a/asm/non_matching/pushableFurniture/sub_0809028C.inc b/asm/non_matching/pushableFurniture/sub_0809028C.inc deleted file mode 100644 index 00af45a0..00000000 --- a/asm/non_matching/pushableFurniture/sub_0809028C.inc +++ /dev/null @@ -1,256 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sb - mov r6, r8 - push {r6, r7} - adds r6, r0, #0 - adds r4, r6, #0 - adds r4, #0x83 - ldrb r0, [r4] - movs r2, #0x30 - ands r2, r0 - movs r0, #0 - mov sb, r0 - strb r2, [r4] - adds r0, r6, #0 - adds r0, #0x70 - ldrh r5, [r0] - adds r7, r5, #0 - subs r7, #0x80 - adds r0, #2 - ldrh r3, [r0] - movs r0, #0x80 - rsbs r0, r0, #0 - adds r0, r0, r3 - mov r8, r0 - cmp r1, #1 - bne _0809039A - movs r0, #0x20 - ands r0, r2 - cmp r0, #0 - beq _080902D4 - adds r1, r3, #0 - subs r1, #0x7f - movs r0, #0 - bl sub_08090480 - b _080902FE -_080902D4: - mov r0, r8 - movs r1, #2 - bl GetTileType - adds r1, r0, #0 - ldr r0, _080902EC @ =0x00000301 - cmp r1, r0 - beq _080902F0 - adds r0, #7 - cmp r1, r0 - beq _080902F6 - b _080902FE - .align 2, 0 -_080902EC: .4byte 0x00000301 -_080902F0: - ldrb r0, [r4] - movs r1, #8 - b _080902FA -_080902F6: - ldrb r0, [r4] - movs r1, #2 -_080902FA: - orrs r0, r1 - strb r0, [r4] -_080902FE: - adds r2, r6, #0 - adds r2, #0x83 - ldrb r1, [r2] - movs r0, #0x2a - ands r0, r1 - adds r4, r2, #0 - cmp r0, #0 - beq _0809031E - movs r0, #0 - adds r1, r7, #0 - bl sub_08090480 - movs r0, #0 - mov r1, r8 - bl sub_08090480 -_0809031E: - ldrb r1, [r4] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _0809034E - subs r4, r7, #1 - adds r0, r4, #0 - movs r1, #1 - bl GetTileType - movs r1, #0xc0 - lsls r1, r1, #2 - cmp r0, r1 - bne _0809033C - b _08090478 -_0809033C: - movs r0, #0 - adds r1, r4, #0 - bl sub_08090480 - subs r1, r7, #2 - movs r0, #2 - bl sub_08090480 - b _08090478 -_0809034E: - subs r0, r7, #1 - movs r1, #2 - bl GetTileType - adds r1, r0, #0 - movs r0, #0xc0 - lsls r0, r0, #2 - cmp r1, r0 - beq _08090368 - adds r0, #8 - cmp r1, r0 - beq _0809036E - b _08090376 -_08090368: - ldrb r1, [r4] - movs r0, #4 - b _08090372 -_0809036E: - ldrb r1, [r4] - movs r0, #1 -_08090372: - orrs r0, r1 - strb r0, [r4] -_08090376: - ldrb r1, [r4] - movs r0, #0x15 - ands r0, r1 - cmp r0, #0 - beq _08090478 - movs r0, #0x2a - ands r0, r1 - cmp r0, #0 - bne _08090478 - movs r0, #0 - adds r1, r7, #0 - bl sub_08090480 - movs r0, #1 - mov r1, r8 - bl sub_08090480 - b _08090478 -_0809039A: - movs r0, #0x10 - ands r0, r2 - cmp r0, #0 - beq _080903AE - adds r1, r5, #0 - subs r1, #0x81 - movs r0, #0 - bl sub_08090480 - b _080903DA -_080903AE: - adds r0, r7, #0 - movs r1, #2 - bl GetTileType - adds r1, r0, #0 - ldr r0, _080903C8 @ =0x00000302 - cmp r1, r0 - beq _080903CC - adds r0, #4 - cmp r1, r0 - beq _080903D2 - b _080903DA - .align 2, 0 -_080903C8: .4byte 0x00000302 -_080903CC: - ldrb r0, [r4] - movs r1, #4 - b _080903D6 -_080903D2: - ldrb r0, [r4] - movs r1, #1 -_080903D6: - orrs r0, r1 - strb r0, [r4] -_080903DA: - adds r2, r6, #0 - adds r2, #0x83 - ldrb r1, [r2] - movs r0, #0x15 - ands r0, r1 - adds r4, r2, #0 - cmp r0, #0 - beq _080903FA - movs r0, #0 - adds r1, r7, #0 - bl sub_08090480 - movs r0, #0 - mov r1, r8 - bl sub_08090480 -_080903FA: - ldrb r1, [r4] - movs r0, #0x20 - ands r0, r1 - cmp r0, #0 - beq _0809042C - mov r4, r8 - adds r4, #1 - adds r0, r4, #0 - movs r1, #1 - bl GetTileType - movs r1, #0xc0 - lsls r1, r1, #2 - cmp r0, r1 - beq _08090478 - movs r0, #0 - adds r1, r4, #0 - bl sub_08090480 - mov r1, r8 - adds r1, #2 - movs r0, #1 - bl sub_08090480 - b _08090478 -_0809042C: - mov r0, r8 - adds r0, #1 - movs r1, #2 - bl GetTileType - adds r1, r0, #0 - movs r0, #0xc0 - lsls r0, r0, #2 - cmp r1, r0 - beq _08090448 - adds r0, #6 - cmp r1, r0 - beq _0809044E - b _08090456 -_08090448: - ldrb r1, [r4] - movs r0, #8 - b _08090452 -_0809044E: - ldrb r1, [r4] - movs r0, #2 -_08090452: - orrs r0, r1 - strb r0, [r4] -_08090456: - ldrb r1, [r4] - movs r0, #0x2a - ands r0, r1 - cmp r0, #0 - beq _08090478 - movs r0, #0x15 - ands r0, r1 - cmp r0, #0 - bne _08090478 - movs r0, #2 - adds r1, r7, #0 - bl sub_08090480 - movs r0, #0 - mov r1, r8 - bl sub_08090480 -_08090478: - pop {r3, r4} - mov r8, r3 - mov sb, r4 - pop {r4, r5, r6, r7, pc} - .syntax divided diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c index 9bef57d6..00bc0ffb 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -425,8 +425,96 @@ void sub_08090254(PushableFurnitureEntity* this) { } } -ASM_FUNC("asm/non_matching/pushableFurniture/sub_0809028C.inc", - void sub_0809028C(PushableFurnitureEntity* this, u32 param_2)) +void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) { + u32 uVar2; + u32 pos; + + this->unk_83 &= 0x30; + pos = this->unk_70 - 0x80; + uVar2 = this->unk_72 - 0x80; + if (param_2 == 1) { + if ((this->unk_83 & 0x20) != 0) { + sub_08090480(0, uVar2 + 1); + } else { + switch (GetTileType(uVar2, 2)) { + case 0x301: + this->unk_83 |= 8; + break; + case 0x308: + this->unk_83 |= 2; + break; + } + } + if ((this->unk_83 & 0x2a) != 0) { + sub_08090480(0, pos); + sub_08090480(0, uVar2); + } + if ((this->unk_83 & 0x10) != 0) { + switch (GetTileType(pos - 1, 1)) { + case 0x300: + break; + default: + sub_08090480(0, pos - 1); + sub_08090480(2, pos - 2); + break; + } + return; + } + switch (GetTileType(pos - 1, 2)) { + case 0x300: + this->unk_83 |= 4; + break; + case 0x308: + this->unk_83 |= 1; + break; + } + + if (((this->unk_83 & 0x15) != 0) && ((this->unk_83 & 0x2a) == 0)) { + sub_08090480(0, pos); + sub_08090480(1, uVar2); + } + } else { + if ((this->unk_83 & 0x10) != 0) { + sub_08090480(0, pos - 1); + } else { + switch (GetTileType(pos, 2)) { + case 0x302: + this->unk_83 |= 4; + break; + case 0x306: + this->unk_83 |= 1; + break; + } + } + if ((this->unk_83 & 0x15) != 0) { + sub_08090480(0, pos); + sub_08090480(0, uVar2); + } + if ((this->unk_83 & 0x20) != 0) { + switch (GetTileType(uVar2 + 1, 1)) { + case 0x300: + break; + default: + sub_08090480(0, uVar2 + 1); + sub_08090480(1, uVar2 + 2); + break; + } + return; + } + switch (GetTileType(uVar2 + 1, 2)) { + case 0x300: + this->unk_83 |= 8; + break; + case 0x306: + this->unk_83 |= 2; + break; + } + if ((this->unk_83 & 0x2a) != 0 && (this->unk_83 & 0x15) == 0) { + sub_08090480(2, pos); + sub_08090480(0, uVar2); + } + } +} void sub_08090480(u32 param_1, u32 param_2) { SetTile(gUnk_08121EF0[param_1], param_2, 1); From 542b20b914446cfc9e74bee676f5e59f44121e61 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Fri, 15 Jul 2022 09:01:07 +0300 Subject: [PATCH 02/34] Match OcarinaUpdate and sub_08026110 --- asm/enemy/chuchuBoss.s | 182 --------------------- asm/non_matching/ocarina/OcarinaUpdate.inc | 38 ----- src/enemy/chuchuBoss.c | 73 ++++++++- src/item/itemOcarina.c | 7 +- src/object/bird.c | 2 +- 5 files changed, 76 insertions(+), 226 deletions(-) delete mode 100644 asm/non_matching/ocarina/OcarinaUpdate.inc diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 2db094e1..30728ada 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -6,188 +6,6 @@ .text - thumb_func_start sub_08026110 -sub_08026110: @ 0x08026110 - push {r4, r5, r6, r7, lr} - adds r6, r0, #0 - ldr r1, _08026144 @ =gUnk_080CC1DC - ldrb r0, [r6, #0xd] - lsls r0, r0, #2 - adds r0, r0, r1 - ldr r1, [r0] - adds r0, r6, #0 - bl _call_via_r1 - adds r0, r6, #0 - adds r0, #0x84 - ldr r2, [r0] - ldr r0, [r2, #8] - cmp r0, #0 - bne _08026160 - ldrb r1, [r2, #5] - cmp r1, #0 - beq _08026160 - ldrb r0, [r6, #0xd] - cmp r0, #8 - bne _08026148 - adds r0, r1, #0 - subs r0, #0x40 - b _0802614C - .align 2, 0 -_08026144: .4byte gUnk_080CC1DC -_08026148: - adds r0, r1, #0 - subs r0, #0x20 -_0802614C: - strb r0, [r2, #5] - adds r0, r6, #0 - adds r0, #0x84 - ldr r1, [r0] - movs r0, #5 - ldrsb r0, [r1, r0] - cmp r0, #0 - bge _08026160 - movs r0, #0 - strb r0, [r1, #5] -_08026160: - adds r2, r6, #0 - adds r2, #0x80 - ldrb r0, [r2] - movs r1, #0x76 - adds r1, r1, r6 - mov ip, r1 - adds r7, r6, #0 - adds r7, #0x7a - cmp r0, #0 - beq _08026230 - ldrb r0, [r6, #0xe] - cmp r0, #0 - bne _080261D2 - ldrb r1, [r2] - lsls r1, r1, #0xc - ldr r0, [r6, #0x74] - subs r0, r0, r1 - str r0, [r6, #0x74] - ldrb r1, [r2] - lsls r1, r1, #0xc - ldr r0, [r6, #0x78] - subs r0, r0, r1 - str r0, [r6, #0x78] - mov r0, ip - ldrh r2, [r0] - adds r4, r6, #0 - adds r4, #0x82 - ldrb r1, [r4] - adds r3, r6, #0 - adds r3, #0x84 - ldr r0, [r3] - ldrb r0, [r0, #5] - adds r1, r1, r0 - cmp r2, r1 - bgt _080261AA - mov r0, ip - strh r1, [r0] -_080261AA: - ldrh r2, [r7] - ldrb r1, [r4] - ldr r0, [r3] - ldrb r0, [r0, #5] - adds r1, r1, r0 - cmp r2, r1 - bgt _080261BA - strh r1, [r7] -_080261BA: - mov r1, ip - ldrh r2, [r1] - ldrb r1, [r4] - ldr r0, [r3] - ldrb r0, [r0, #5] - adds r1, r1, r0 - cmp r2, r1 - bgt _08026230 - ldrh r0, [r7] - cmp r0, r1 - bgt _08026230 - b _08026228 -_080261D2: - ldrb r1, [r2] - lsls r1, r1, #0xc - ldr r0, [r6, #0x74] - adds r0, r0, r1 - str r0, [r6, #0x74] - ldrb r1, [r2] - lsls r1, r1, #0xc - ldr r0, [r6, #0x78] - adds r0, r0, r1 - str r0, [r6, #0x78] - mov r0, ip - ldrh r2, [r0] - adds r4, r6, #0 - adds r4, #0x81 - ldrb r1, [r4] - adds r3, r6, #0 - adds r3, #0x84 - ldr r0, [r3] - ldrb r0, [r0, #5] - adds r1, r1, r0 - cmp r2, r1 - blt _08026202 - mov r0, ip - strh r1, [r0] -_08026202: - ldrh r2, [r7] - ldrb r1, [r4] - ldr r0, [r3] - ldrb r0, [r0, #5] - adds r1, r1, r0 - cmp r2, r1 - blt _08026212 - strh r1, [r7] -_08026212: - mov r1, ip - ldrh r2, [r1] - ldrb r1, [r4] - ldr r0, [r3] - ldrb r0, [r0, #5] - adds r1, r1, r0 - cmp r2, r1 - blt _08026230 - ldrh r0, [r7] - cmp r0, r1 - blt _08026230 -_08026228: - ldrb r0, [r6, #0xe] - movs r1, #1 - eors r0, r1 - strb r0, [r6, #0xe] -_08026230: - ldr r5, [r6, #0x48] - mov r0, ip - ldrh r1, [r0] - movs r4, #0x80 - lsls r4, r4, #9 - adds r0, r4, #0 - bl __divsi3 - lsls r1, r0, #3 - subs r1, r1, r0 - lsrs r1, r1, #7 - strb r1, [r5, #6] - ldr r5, [r6, #0x48] - ldrh r1, [r7] - adds r0, r4, #0 - bl __divsi3 - lsls r1, r0, #1 - adds r1, r1, r0 - lsrs r1, r1, #7 - strb r1, [r5, #7] - movs r1, #0x36 - ldrsh r0, [r6, r1] - cmp r0, #0 - bne _08026268 - adds r0, r6, #0 - bl sub_0800445C -_08026268: - pop {r4, r5, r6, r7, pc} - .align 2, 0 thumb_func_start sub_0802626C sub_0802626C: @ 0x0802626C diff --git a/asm/non_matching/ocarina/OcarinaUpdate.inc b/asm/non_matching/ocarina/OcarinaUpdate.inc deleted file mode 100644 index 5a46f81b..00000000 --- a/asm/non_matching/ocarina/OcarinaUpdate.inc +++ /dev/null @@ -1,38 +0,0 @@ - .syntax unified - push {r4, r5, r6, lr} - adds r5, r0, #0 - adds r6, r1, #0 - bl UpdateItemAnim - ldrb r1, [r5, #0xe] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08076C6E - ldr r0, _08076C70 @ =gPlayerEntity - ldrb r2, [r0, #0x10] - movs r4, #0 - movs r1, #0x80 - orrs r1, r2 - strb r1, [r0, #0x10] - ldr r2, _08076C74 @ =gPlayerState - ldr r1, [r2, #0x30] - ldr r3, _08076C78 @ =0xEFFFFFFF - ands r1, r3 - str r1, [r2, #0x30] - adds r2, #0x27 - strb r4, [r2] - ldr r1, _08076C7C @ =gPauseMenuOptions - strb r4, [r1] - bl CreateBird - bl ResetPlayerEventPriority - adds r0, r5, #0 - adds r1, r6, #0 - bl DeletePlayerItem -_08076C6E: - pop {r4, r5, r6, pc} - .align 2, 0 -_08076C70: .4byte gPlayerEntity -_08076C74: .4byte gPlayerState -_08076C78: .4byte 0xEFFFFFFF -_08076C7C: .4byte gPauseMenuOptions - .syntax divided diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 4952324c..73e78bad 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -18,7 +18,9 @@ typedef struct { u8 unk_04; s8 unk_05; u8 unk_06; - u8 unk_07[7]; + u8 unk_07; + u32 unk_08; + u16 unk_0c; u16 unk_0e; } Helper; @@ -450,3 +452,72 @@ void sub_08026090(ChuchuBossEntity* this) { } } } + +void sub_08026110(ChuchuBossEntity* this) { + s32 uVar2; + int iVar4; + s32 uVar3; + Hitbox* pHVar8; + + gUnk_080CC1DC[super->subAction](this); + if ((this->unk_84->unk_08 == 0) && ((u8)this->unk_84->unk_05 != 0)) { + if (super->subAction == 8) { + this->unk_84->unk_05 -= 0x40; + } else { + this->unk_84->unk_05 -= 0x20; + } + if (this->unk_84->unk_05 < 0) { + this->unk_84->unk_05 = 0; + } + } + + if (this->unk_80[0] != 0) { + if (super->timer == 0) { + this->unk_74.WORD -= this->unk_80[0] * 0x1000; + this->unk_78.WORD -= this->unk_80[0] * 0x1000; + uVar3 = this->unk_74.HALF_U.HI; + uVar2 = this->unk_80[2] + (u8)this->unk_84->unk_05; + if (uVar3 <= uVar2) { + this->unk_74.HALF.HI = uVar2; + } + uVar3 = this->unk_78.HALF_U.HI; + uVar2 = this->unk_80[2]; + uVar2 += (u8)this->unk_84->unk_05; + if (uVar3 <= uVar2) { + this->unk_78.HALF.HI = uVar2; + } + uVar3 = this->unk_74.HALF_U.HI; + uVar2 = this->unk_80[2]; + uVar2 += (u8)this->unk_84->unk_05; + if ((uVar3 <= uVar2) && (this->unk_78.HALF_U.HI <= uVar2)) { + super->timer ^= 1; + } + } else { + this->unk_74.WORD += this->unk_80[0] * 0x1000; + this->unk_78.WORD += this->unk_80[0] * 0x1000; + uVar3 = this->unk_74.HALF_U.HI; + uVar2 = this->unk_80[1] + (u8)this->unk_84->unk_05; + if (uVar3 >= uVar2) { + this->unk_74.HALF.HI = uVar2; + } + uVar3 = this->unk_78.HALF_U.HI; + uVar2 = this->unk_80[1]; + uVar2 += (u8)this->unk_84->unk_05; + if (uVar3 >= uVar2) { + this->unk_78.HALF.HI = uVar2; + } + uVar3 = this->unk_74.HALF_U.HI; + uVar2 = this->unk_80[1]; + uVar2 += (u8)this->unk_84->unk_05; + if ((uVar3 >= uVar2) && (this->unk_78.HALF_U.HI >= uVar2)) { + + super->timer ^= 1; + } + } + } + super->hitbox->width = (u8)((u32)((0x10000 / this->unk_74.HALF_U.HI) * 7) >> 7); + super->hitbox->height = (u8)((u32)((0x10000 / this->unk_78.HALF_U.HI) * 3) >> 7); + if (super->z.HALF.HI == 0) { + sub_0800445C(super); + } +} diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c index caa7b1f7..38d323d6 100644 --- a/src/item/itemOcarina.c +++ b/src/item/itemOcarina.c @@ -3,7 +3,7 @@ #include "functions.h" extern void ResetPlayerVelocity(void); -extern void CreateBird(void); +extern void CreateBird(Entity*); void OcarinaUse(ItemBehavior*, u32); void OcarinaUpdate(ItemBehavior*, u32); @@ -37,7 +37,7 @@ void OcarinaUse(ItemBehavior* this, u32 idx) { } } -NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBehavior* this, u32 idx)) { +void OcarinaUpdate(ItemBehavior* this, u32 idx) { // TODO regalloc UpdateItemAnim(this); if ((this->field_0x5[9] & 0x80) != 0) { @@ -45,9 +45,8 @@ NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBe gPlayerState.flags &= ~PL_USE_OCARINA; gPlayerState.field_0x27[0] = 0; gPauseMenuOptions.disabled = 0; - CreateBird(); + CreateBird(&gPlayerEntity); ResetPlayerEventPriority(); DeletePlayerItem(this, idx); } } -END_NONMATCH diff --git a/src/object/bird.c b/src/object/bird.c index e7346656..499f413b 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -365,7 +365,7 @@ void Bird_Type10(Entity* this) { } } -void CreateBird(void) { +void CreateBird(Entity* this) { Entity* birdEnt; #ifndef EU From feb2565528b60f06df0ce863f5ae8d06a3db0d36 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 08:32:59 +0300 Subject: [PATCH 03/34] Match sub_0802626C --- asm/enemy/chuchuBoss.s | 28 ---------------------------- src/enemy/chuchuBoss.c | 8 ++++++++ 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 30728ada..b971ec5b 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -7,34 +7,6 @@ .text - thumb_func_start sub_0802626C -sub_0802626C: @ 0x0802626C - push {lr} - ldr r2, _0802629C @ =gPauseMenuOptions - movs r1, #1 - strb r1, [r2] - ldr r2, _080262A0 @ =gUnk_080CC20C - adds r1, r0, #0 - adds r1, #0x84 - ldr r1, [r1] - ldrb r1, [r1, #3] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - ldr r0, _080262A4 @ =gPlayerEntity - ldrb r0, [r0, #0xc] - cmp r0, #0x17 - beq _08026298 - cmp r0, #0xf - beq _08026298 - bl sub_08078B48 -_08026298: - pop {pc} - .align 2, 0 -_0802629C: .4byte gPauseMenuOptions -_080262A0: .4byte gUnk_080CC20C -_080262A4: .4byte gPlayerEntity thumb_func_start sub_080262A8 sub_080262A8: @ 0x080262A8 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 73e78bad..87ab2a3d 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -521,3 +521,11 @@ void sub_08026110(ChuchuBossEntity* this) { sub_0800445C(super); } } + +void sub_0802626C(ChuchuBossEntity* this) { + gPauseMenuOptions.disabled = 1; + gUnk_080CC20C[this->unk_84->unk_03](this); + if (gPlayerEntity.action != 23 && gPlayerEntity.action != 15) { + sub_08078B48(); + } +} From efa25f2da24a941282f952734e2c2ae830be386d Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 08:37:12 +0300 Subject: [PATCH 04/34] Match sub_080262A8 --- asm/enemy/chuchuBoss.s | 64 ------------------------------------------ src/enemy/chuchuBoss.c | 20 +++++++++++++ 2 files changed, 20 insertions(+), 64 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index b971ec5b..af5eca52 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -8,70 +8,6 @@ - thumb_func_start sub_080262A8 -sub_080262A8: @ 0x080262A8 - push {r4, r5, r6, lr} - adds r4, r0, #0 - adds r1, r4, #0 - adds r1, #0x82 - movs r6, #0 - movs r0, #0x90 - strb r0, [r1] - subs r1, #1 - movs r0, #0xb0 - strb r0, [r1] - subs r1, #1 - movs r0, #8 - strb r0, [r1] - movs r5, #1 - strb r5, [r4, #0xe] - adds r0, r4, #0 - movs r1, #6 - movs r2, #1 - bl sub_080276F4 - ldrb r0, [r4, #0xb] - cmp r0, #0 - bne _080262EC - ldr r1, _080262E8 @ =gPlayerState - movs r0, #0x82 - lsls r0, r0, #1 - strh r0, [r1, #8] - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - strb r5, [r0, #3] - b _0802631A - .align 2, 0 -_080262E8: .4byte gPlayerState -_080262EC: - adds r0, r4, #0 - adds r0, #0x7c - strb r6, [r0] - adds r1, r4, #0 - adds r1, #0x7d - movs r0, #0x1e - strb r0, [r1] - adds r0, r4, #0 - adds r0, #0x84 - ldr r1, [r0] - movs r0, #3 - strb r0, [r1, #3] - ldr r0, _0802631C @ =gPlayerEntity - strb r6, [r0, #0x14] - ldr r0, _08026320 @ =gRoomControls - str r4, [r0, #0x30] - strb r5, [r0, #0xe] - ldr r0, _08026324 @ =0x00004022 - movs r1, #0xb2 - lsls r1, r1, #2 - movs r2, #1 - bl SetTile -_0802631A: - pop {r4, r5, r6, pc} - .align 2, 0 -_0802631C: .4byte gPlayerEntity -_08026320: .4byte gRoomControls -_08026324: .4byte 0x00004022 thumb_func_start sub_08026328 sub_08026328: @ 0x08026328 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 87ab2a3d..f6a1e040 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -529,3 +529,23 @@ void sub_0802626C(ChuchuBossEntity* this) { sub_08078B48(); } } + +void sub_080262A8(ChuchuBossEntity* this) { + this->unk_80[2] = 0x90; + this->unk_80[1] = 0xb0; + this->unk_80[0] = 8; + super->timer = 1; + sub_080276F4(super, 6, 1); + if (super->type2 == 0) { + gPlayerState.animation = 0x104; + this->unk_84->unk_03 = 1; + } else { + this->unk_7c[0] = 0; + this->unk_7d = 0x1e; + this->unk_84->unk_03 = 3; + gPlayerEntity.animationState = 0; + gRoomControls.camera_target = super; + gRoomControls.unk5 = 1; + SetTile(0x4022, 0x2c8, 1); + } +} From e656423cbfd9db90b74ec581b3b1f1ea357d0635 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 08:39:03 +0300 Subject: [PATCH 05/34] Match sub_08026328 --- asm/enemy/chuchuBoss.s | 28 ---------------------------- src/enemy/chuchuBoss.c | 8 ++++++++ 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index af5eca52..f847c3ca 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -8,34 +8,6 @@ - - thumb_func_start sub_08026328 -sub_08026328: @ 0x08026328 - push {lr} - adds r2, r0, #0 - ldr r0, _08026354 @ =gPlayerEntity - ldrb r0, [r0, #0xc] - cmp r0, #0x17 - beq _08026352 - adds r1, r2, #0 - adds r1, #0x7d - movs r0, #0x78 - strb r0, [r1] - adds r0, r2, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - movs r0, #0xa - movs r1, #0 - movs r2, #0 - bl sub_08078AC0 -_08026352: - pop {pc} - .align 2, 0 -_08026354: .4byte gPlayerEntity - thumb_func_start sub_08026358 sub_08026358: @ 0x08026358 push {r4, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index f6a1e040..8e0c8622 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -549,3 +549,11 @@ void sub_080262A8(ChuchuBossEntity* this) { SetTile(0x4022, 0x2c8, 1); } } + +void sub_08026328(ChuchuBossEntity* this) { + if (gPlayerEntity.action != 23) { + this->unk_7d = 0x78; + this->unk_84->unk_03++; + sub_08078AC0(10, 0, 0); + } +} From e04505657e33275a4003cafb055523727f855181 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 08:43:52 +0300 Subject: [PATCH 06/34] Match sub_08026358 --- asm/enemy/chuchuBoss.s | 51 ------------------------------------------ src/enemy/chuchuBoss.c | 22 ++++++++++++++++++ 2 files changed, 22 insertions(+), 51 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index f847c3ca..23e7a51a 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -8,57 +8,6 @@ - thumb_func_start sub_08026358 -sub_08026358: @ 0x08026358 - push {r4, lr} - adds r3, r0, #0 - ldr r4, _08026398 @ =gPlayerEntity - ldrb r0, [r4, #0xc] - cmp r0, #0xf - beq _080263B0 - adds r1, r3, #0 - adds r1, #0x7d - ldrb r0, [r1] - subs r0, #1 - strb r0, [r1] - lsls r0, r0, #0x18 - lsrs r2, r0, #0x18 - cmp r2, #0 - bne _080263A0 - adds r0, r3, #0 - adds r0, #0x7c - strb r2, [r0] - movs r0, #0x1e - strb r0, [r1] - adds r0, r3, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - strb r2, [r4, #0x14] - ldr r1, _0802639C @ =gRoomControls - str r3, [r1, #0x30] - movs r0, #1 - strb r0, [r1, #0xe] - b _080263B0 - .align 2, 0 -_08026398: .4byte gPlayerEntity -_0802639C: .4byte gRoomControls -_080263A0: - cmp r2, #0x60 - bhi _080263B0 - cmp r2, #0x5b - bhi _080263AC - movs r0, #4 - b _080263AE -_080263AC: - movs r0, #2 -_080263AE: - strb r0, [r4, #0x14] -_080263B0: - pop {r4, pc} - .align 2, 0 thumb_func_start sub_080263B4 sub_080263B4: @ 0x080263B4 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 8e0c8622..9eac27a3 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -557,3 +557,25 @@ void sub_08026328(ChuchuBossEntity* this) { sub_08078AC0(10, 0, 0); } } + +void sub_08026358(ChuchuBossEntity* this) { + u32 bVar1; + + if (gPlayerEntity.action != 15) { + bVar1 = --this->unk_7d; + if (bVar1 == 0) { + this->unk_7c[0] = 0; + this->unk_7d = 0x1e; + this->unk_84->unk_03++; + gPlayerEntity.animationState = 0; + gRoomControls.camera_target = super; + gRoomControls.unk5 = 1; + } else if (bVar1 < 0x61) { + if (bVar1 < 0x5c) { + gPlayerEntity.animationState = 4; + } else { + gPlayerEntity.animationState = 2; + } + } + } +} From ae8dd3048a31a705d94d8a162e6d5ce0998c72a6 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 08:54:50 +0300 Subject: [PATCH 07/34] Match sub_080263B4 --- asm/enemy/chuchuBoss.s | 52 ------------------------------------------ src/enemy/chuchuBoss.c | 15 ++++++++++++ 2 files changed, 15 insertions(+), 52 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 23e7a51a..e0d11428 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -9,58 +9,6 @@ - thumb_func_start sub_080263B4 -sub_080263B4: @ 0x080263B4 - push {r4, r5, lr} - adds r4, r0, #0 - movs r0, #0x7d - adds r0, r0, r4 - mov ip, r0 - ldrb r0, [r0] - subs r0, #1 - mov r1, ip - strb r0, [r1] - lsls r0, r0, #0x18 - lsrs r5, r0, #0x18 - cmp r5, #0xff - bne _08026410 - ldr r2, _08026400 @ =gUnk_080CC234 - adds r3, r4, #0 - adds r3, #0x7c - ldrb r0, [r3] - adds r1, r0, #1 - strb r1, [r3] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - adds r0, r0, r2 - ldrb r1, [r0] - mov r0, ip - strb r1, [r0] - adds r0, r5, #0 - ands r0, r1 - cmp r0, #0xff - bne _08026404 - movs r0, #0x78 - strb r0, [r3] - adds r0, r4, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - b _08026410 - .align 2, 0 -_08026400: .4byte gUnk_080CC234 -_08026404: - ldrb r2, [r4, #0xb] - adds r0, r4, #0 - movs r1, #0x49 - movs r3, #0 - bl CreateObjectWithParent -_08026410: - pop {r4, r5, pc} - .align 2, 0 - thumb_func_start sub_08026414 sub_08026414: @ 0x08026414 push {r4, r5, r6, r7, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 9eac27a3..0ca3bf18 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -579,3 +579,18 @@ void sub_08026358(ChuchuBossEntity* this) { } } } + +void sub_080263B4(ChuchuBossEntity* this) { + u32 bVar2; + u32 bVar3; + + if (this->unk_7d-- == 0) { + bVar3 = this->unk_7d = gUnk_080CC234[this->unk_7c[0]++]; + if ((bVar3 & 0xff) == 0xff) { + this->unk_7c[0] = 0x78; + this->unk_84->unk_03++; + } else { + CreateObjectWithParent(super, OBJECT_49, super->type2, 0); + } + } +} From d4f2b2fcb6a200e570c9c97a868e276b45410068 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:01:33 +0300 Subject: [PATCH 08/34] Match sub_08026414 --- asm/enemy/chuchuBoss.s | 54 +----------------------------------------- src/enemy/chuchuBoss.c | 17 +++++++++++++ 2 files changed, 18 insertions(+), 53 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index e0d11428..db5472e7 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -9,59 +9,7 @@ - thumb_func_start sub_08026414 -sub_08026414: @ 0x08026414 - push {r4, r5, r6, r7, lr} - adds r7, r0, #0 - adds r1, r7, #0 - adds r1, #0x7c - ldrb r0, [r1] - subs r0, #1 - strb r0, [r1] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xff - bne _08026474 - ldr r0, _08026478 @ =0x0000FF40 - strh r0, [r7, #0x36] - ldr r6, [r7, #0x54] - ldr r5, [r7, #0x50] - ldr r4, [r7, #0x68] - ldrb r2, [r4, #0x18] - movs r1, #4 - rsbs r1, r1, #0 - adds r0, r1, #0 - ands r0, r2 - movs r3, #1 - orrs r0, r3 - strb r0, [r4, #0x18] - ldrb r2, [r5, #0x18] - adds r0, r1, #0 - ands r0, r2 - orrs r0, r3 - strb r0, [r5, #0x18] - ldrb r2, [r6, #0x18] - adds r0, r1, #0 - ands r0, r2 - orrs r0, r3 - strb r0, [r6, #0x18] - ldrb r0, [r7, #0x18] - ands r1, r0 - orrs r1, r3 - strb r1, [r7, #0x18] - adds r0, r7, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - movs r0, #0xd1 - lsls r0, r0, #1 - bl SoundReq -_08026474: - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08026478: .4byte 0x0000FF40 + thumb_func_start sub_0802647C sub_0802647C: @ 0x0802647C diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 0ca3bf18..2ea8d84f 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -594,3 +594,20 @@ void sub_080263B4(ChuchuBossEntity* this) { } } } + +void sub_08026414(ChuchuBossEntity* this) { + Entity* parent; + Entity* child; + + if (this->unk_7c[0]-- == 0) { + super->z.HALF.HI = 0xff40; + child = super->child; + parent = super->parent; + this->unk_68->base.spriteSettings.draw = 1; + parent->spriteSettings.draw = 1; + child->spriteSettings.draw = 1; + super->spriteSettings.draw = 1; + this->unk_84->unk_03++; + SoundReq(SFX_1A2); + } +} From 27f9666970ecd020b4ad556b03009bda6ac02705 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:03:31 +0300 Subject: [PATCH 09/34] Match sub_0802647C --- asm/enemy/chuchuBoss.s | 24 ------------------------ src/enemy/chuchuBoss.c | 8 ++++++++ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index db5472e7..d8f9c18a 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -11,30 +11,6 @@ - thumb_func_start sub_0802647C -sub_0802647C: @ 0x0802647C - push {r4, lr} - adds r4, r0, #0 - movs r1, #0x80 - lsls r1, r1, #7 - bl GravityUpdate - cmp r0, #0 - bne _080264A6 - movs r0, #0x10 - movs r1, #0 - bl InitScreenShake - ldr r0, _080264A8 @ =0x000001A1 - bl SoundReq - adds r0, r4, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] -_080264A6: - pop {r4, pc} - .align 2, 0 -_080264A8: .4byte 0x000001A1 thumb_func_start sub_080264AC sub_080264AC: @ 0x080264AC diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 2ea8d84f..2c5b7351 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -611,3 +611,11 @@ void sub_08026414(ChuchuBossEntity* this) { SoundReq(SFX_1A2); } } + +void sub_0802647C(ChuchuBossEntity* this) { + if (GravityUpdate(super, 0x4000) == 0) { + InitScreenShake(0x10, 0); + SoundReq(SFX_1A1); + this->unk_84->unk_03++; + } +} From 1112df0a2ac100c4d8a0a50bbddcb3b42276cc16 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:04:59 +0300 Subject: [PATCH 10/34] Match sub_080264AC --- asm/enemy/chuchuBoss.s | 20 -------------------- src/enemy/chuchuBoss.c | 8 ++++++++ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index d8f9c18a..75a52f58 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -12,26 +12,6 @@ - thumb_func_start sub_080264AC -sub_080264AC: @ 0x080264AC - push {r4, lr} - adds r4, r0, #0 - movs r1, #0xd0 - movs r2, #8 - bl sub_080277B8 - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - ldrb r0, [r0, #3] - cmp r0, #6 - beq _080264D2 - ldr r0, [r4, #0x54] - movs r1, #4 - bl InitAnimationForceUpdate - adds r0, r4, #0 - bl sub_08027D20 -_080264D2: - pop {r4, pc} thumb_func_start sub_080264D4 sub_080264D4: @ 0x080264D4 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 2c5b7351..cb722832 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -619,3 +619,11 @@ void sub_0802647C(ChuchuBossEntity* this) { this->unk_84->unk_03++; } } + +void sub_080264AC(ChuchuBossEntity* this) { + sub_080277B8(this, 0xd0, 8); + if (this->unk_84->unk_03 != 6) { + InitAnimationForceUpdate(super->child, 4); + sub_08027D20(this); + } +} From 47a9d7deec20c306883074787b9169b125920c92 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:08:23 +0300 Subject: [PATCH 11/34] Match sub_080264D4 --- asm/enemy/chuchuBoss.s | 29 ----------------------------- src/enemy/chuchuBoss.c | 12 +++++++++++- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 75a52f58..8765e69b 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -12,35 +12,6 @@ - - thumb_func_start sub_080264D4 -sub_080264D4: @ 0x080264D4 - push {r4, lr} - adds r4, r0, #0 - bl sub_080279E8 - cmp r0, #0 - beq _08026504 - adds r0, r4, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - adds r1, r4, #0 - adds r1, #0x7d - movs r0, #0x3c - strb r0, [r1] - adds r0, r4, #0 - movs r1, #5 - movs r2, #0 - bl sub_080276F4 - movs r0, #0x2e - bl SoundReq -_08026504: - adds r0, r4, #0 - bl sub_080277F8 - pop {r4, pc} - thumb_func_start sub_0802650C sub_0802650C: @ 0x0802650C push {lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index cb722832..5653fa2b 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -116,7 +116,7 @@ void sub_080277F8(); void sub_08027870(); void sub_08027984(); void sub_080279AC(); -void sub_080279E8(); +bool32 sub_080279E8(ChuchuBossEntity*); void sub_08027A60(); void sub_08027AA4(); void sub_08027B98(); @@ -627,3 +627,13 @@ void sub_080264AC(ChuchuBossEntity* this) { sub_08027D20(this); } } + +void sub_080264D4(ChuchuBossEntity* this) { + if (sub_080279E8(this)) { + this->unk_84->unk_03++; + this->unk_7d = 0x3c; + sub_080276F4(this, 5, 0); + SoundReq(BGM_BOSS_THEME); + } + sub_080277F8(this); +} From 385cf5c6583d912efb5ee85380e01208243a8c7d Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:10:52 +0300 Subject: [PATCH 12/34] Match sub_0802650C --- asm/enemy/chuchuBoss.s | 25 ------------------------- src/enemy/chuchuBoss.c | 8 ++++++++ 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 8765e69b..6af3aa95 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -12,31 +12,6 @@ - thumb_func_start sub_0802650C -sub_0802650C: @ 0x0802650C - push {lr} - adds r2, r0, #0 - ldr r0, [r2, #0x54] - adds r0, #0x81 - ldrb r0, [r0] - cmp r0, #0 - bne _0802652C - adds r0, r2, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - ldr r1, _08026534 @ =gRoomControls - ldr r0, _08026538 @ =gPlayerEntity - str r0, [r1, #0x30] -_0802652C: - adds r0, r2, #0 - bl sub_08027870 - pop {pc} - .align 2, 0 -_08026534: .4byte gRoomControls -_08026538: .4byte gPlayerEntity thumb_func_start sub_0802653C sub_0802653C: @ 0x0802653C diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 5653fa2b..0ca38dcf 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -637,3 +637,11 @@ void sub_080264D4(ChuchuBossEntity* this) { } sub_080277F8(this); } + +void sub_0802650C(ChuchuBossEntity* this) { + if (((ChuchuBossEntity*)super->child)->unk_80[1] == 0) { + this->unk_84->unk_03++; + gRoomControls.camera_target = &gPlayerEntity; + } + sub_08027870(super); +} From c7eb76171ab22138ddb9ca97638d011c258be13b Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:12:03 +0300 Subject: [PATCH 13/34] Match sub_0802653C --- asm/enemy/chuchuBoss.s | 32 -------------------------------- src/enemy/chuchuBoss.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 6af3aa95..ce6713c6 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -13,38 +13,6 @@ - thumb_func_start sub_0802653C -sub_0802653C: @ 0x0802653C - push {r4, r5, lr} - sub sp, #4 - adds r4, r0, #0 - ldr r1, _08026578 @ =gRoomControls - ldrh r5, [r1] - cmp r5, #0 - bne _08026572 - movs r0, #4 - strb r0, [r1, #0xe] - movs r0, #0xff - str r0, [sp] - adds r0, r4, #0 - movs r1, #0x90 - movs r2, #0xb0 - movs r3, #4 - bl sub_08027B98 - adds r0, r4, #0 - movs r1, #0 - bl sub_08027548 - ldr r0, [r4, #0x54] - movs r1, #0 - bl InitAnimationForceUpdate - ldr r0, _0802657C @ =gPauseMenuOptions - strb r5, [r0] -_08026572: - add sp, #4 - pop {r4, r5, pc} - .align 2, 0 -_08026578: .4byte gRoomControls -_0802657C: .4byte gPauseMenuOptions thumb_func_start sub_08026580 sub_08026580: @ 0x08026580 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 0ca38dcf..cb405e9d 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -645,3 +645,13 @@ void sub_0802650C(ChuchuBossEntity* this) { } sub_08027870(super); } + +void sub_0802653C(ChuchuBossEntity* this) { + if (gRoomControls.reload_flags == 0) { + gRoomControls.unk5 = 4; + sub_08027B98(this, 0x90, 0xb0, 4, 0xff); + sub_08027548(this, 0); + InitAnimationForceUpdate(super->child, 0); + gPauseMenuOptions.disabled = 0; + } +} From f700cf49f8c746786566972fbe244f0525fd468d Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:21:39 +0300 Subject: [PATCH 14/34] Match sub_08026580 --- asm/enemy/chuchuBoss.s | 92 ------------------------------------------ src/enemy/chuchuBoss.c | 32 +++++++++++++++ 2 files changed, 32 insertions(+), 92 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index ce6713c6..143d655c 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -14,98 +14,6 @@ - thumb_func_start sub_08026580 -sub_08026580: @ 0x08026580 - push {r4, r5, r6, r7, lr} - adds r5, r0, #0 - bl sub_08027AA4 - adds r7, r5, #0 - adds r7, #0x84 - ldr r0, [r7] - ldrb r0, [r0, #1] - cmp r0, #0x40 - bne _0802659C - adds r0, r5, #0 - bl sub_08027BBC - b _0802662C -_0802659C: - adds r1, r5, #0 - adds r1, #0x7d - ldrb r0, [r1] - subs r0, #1 - strb r0, [r1] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - adds r6, r1, #0 - cmp r0, #0xff - bne _08026626 - movs r0, #0 - strh r0, [r5, #0x24] - movs r0, #2 - strb r0, [r5, #0xd] - adds r4, r5, #0 - adds r4, #0x7c - movs r0, #0x3c - strb r0, [r4] - ldr r1, _080265E4 @ =gPlayerEntity - adds r0, r5, #0 - bl GetFacingDirection - strb r0, [r5, #0x15] - ldr r0, [r7] - ldrb r0, [r0, #4] - adds r2, r4, #0 - cmp r0, #2 - bne _080265E8 - adds r1, r5, #0 - adds r1, #0x80 - movs r0, #0x48 - strb r0, [r1] - adds r1, #1 - ldrb r0, [r1] - adds r0, #0x10 - b _080265EE - .align 2, 0 -_080265E4: .4byte gPlayerEntity -_080265E8: - adds r1, r5, #0 - adds r1, #0x80 - movs r0, #0x10 -_080265EE: - strb r0, [r1] - adds r4, r5, #0 - adds r4, #0x84 - ldr r0, [r4] - ldrb r1, [r0, #1] - movs r0, #0xa0 - ands r0, r1 - cmp r0, #0 - beq _08026608 - movs r0, #0 - strb r0, [r6] - strb r0, [r2] - b _08026626 -_08026608: - bl Random - ldr r2, _08026630 @ =gUnk_080CC24F - movs r1, #7 - ands r1, r0 - adds r1, r1, r2 - ldrb r0, [r1] - adds r1, r0, #1 - strb r1, [r6] - ldr r0, [r4] - ldrb r0, [r0, #4] - cmp r0, #2 - bne _08026626 - lsls r0, r1, #1 - strb r0, [r6] -_08026626: - adds r0, r5, #0 - bl sub_08027870 -_0802662C: - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08026630: .4byte gUnk_080CC24F thumb_func_start sub_08026634 sub_08026634: @ 0x08026634 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index cb405e9d..3afd937c 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -655,3 +655,35 @@ void sub_0802653C(ChuchuBossEntity* this) { gPauseMenuOptions.disabled = 0; } } + +void sub_08026580(ChuchuBossEntity* this) { + u32 cVar2; + + sub_08027AA4(this); + if (this->unk_84->unk_01 == 64) { + sub_08027BBC(this); + } else { + if (this->unk_7d-- == 0) { + super->speed = 0; + super->subAction = 2; + this->unk_7c[0] = 0x3c; + super->direction = GetFacingDirection(super, &gPlayerEntity); + if (this->unk_84->unk_04 == 2) { + this->unk_80[0] = 0x48; + this->unk_80[1] += 16; + } else { + this->unk_80[0] = 16; + } + if ((this->unk_84->unk_01 & 0xa0) != 0) { + this->unk_7d = 0; + this->unk_7c[0] = 0; + } else { + this->unk_7d = cVar2 = gUnk_080CC24F[Random() & 7] + 1; + if (this->unk_84->unk_04 == 2) { + this->unk_7d = cVar2 * 2; + } + } + } + sub_08027870(super); + } +} From 1ff5774c989135a143666d36989d6ce9b2a6de84 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:38:37 +0300 Subject: [PATCH 15/34] Match sub_08026634 --- asm/enemy/chuchuBoss.s | 147 ----------------------------------------- src/enemy/chuchuBoss.c | 51 +++++++++++++- 2 files changed, 50 insertions(+), 148 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 143d655c..e2bacff2 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -15,153 +15,6 @@ - thumb_func_start sub_08026634 -sub_08026634: @ 0x08026634 - push {r4, r5, lr} - sub sp, #4 - adds r4, r0, #0 - bl sub_08027AA4 - cmp r0, #0 - beq _08026644 - b _08026748 -_08026644: - adds r0, r4, #0 - adds r0, #0x7d - ldrb r1, [r0] - adds r5, r0, #0 - cmp r1, #0 - bne _080266D6 - adds r1, r4, #0 - adds r1, #0x7c - ldrb r0, [r1] - subs r0, #1 - strb r0, [r1] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xff - bne _08026748 - adds r1, #8 - ldr r2, [r1] - ldrb r3, [r2, #1] - movs r0, #0x40 - ands r0, r3 - adds r5, r1, #0 - cmp r0, #0 - bne _080266B0 - movs r0, #0x80 - ands r0, r3 - cmp r0, #0 - beq _0802668C - ldrb r0, [r2] - subs r0, #1 - strb r0, [r2] - ldr r1, [r5] - ldrb r0, [r1] - cmp r0, #0 - bne _080266B0 - movs r0, #1 - b _080266AE -_0802668C: - movs r0, #1 - strb r0, [r2, #1] - ldr r0, [r5] - ldrb r0, [r0, #4] - cmp r0, #2 - bne _080266B0 - bl Random - movs r1, #3 - ands r1, r0 - cmp r1, #0 - beq _080266B0 - ldr r1, [r5] - movs r0, #4 - strb r0, [r1] - ldr r1, [r5] - movs r0, #0x81 -_080266AE: - strb r0, [r1, #1] -_080266B0: - movs r1, #0 - movs r0, #3 - strb r0, [r4, #0xd] - ldr r0, [r5] - strb r1, [r0, #3] - str r1, [sp] - adds r0, r4, #0 - movs r1, #0x90 - movs r2, #0x90 - movs r3, #0xc - bl sub_08027B98 - movs r0, #0xe0 - lsls r0, r0, #0xb - str r0, [r4, #0x20] - movs r0, #0xc0 - lsls r0, r0, #1 - strh r0, [r4, #0x24] - b _08026742 -_080266D6: - ldr r0, _08026700 @ =gRoomTransition - ldr r0, [r0] - movs r1, #0x7f - ands r0, r1 - cmp r0, #0 - bne _080266EC - ldr r1, _08026704 @ =gPlayerEntity - adds r0, r4, #0 - bl GetFacingDirection - strb r0, [r4, #0x15] -_080266EC: - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - ldrb r0, [r0, #4] - cmp r0, #2 - bne _08026708 - movs r0, #0x80 - lsls r0, r0, #1 - b _0802670A - .align 2, 0 -_08026700: .4byte gRoomTransition -_08026704: .4byte gPlayerEntity -_08026708: - movs r0, #0xc0 -_0802670A: - strh r0, [r4, #0x24] - ldrb r0, [r4, #0xe] - cmp r0, #0 - beq _0802672C - ldr r0, _0802674C @ =gRoomTransition - ldr r0, [r0] - movs r1, #7 - ands r0, r1 - cmp r0, #0 - bne _08026726 - movs r0, #0xcf - lsls r0, r0, #1 - bl SoundReq -_08026726: - adds r0, r4, #0 - bl ProcessMovement0 -_0802672C: - adds r0, r4, #0 - adds r0, #0x76 - adds r1, r4, #0 - adds r1, #0x81 - ldrh r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bne _08026742 - ldrb r0, [r5] - subs r0, #1 - strb r0, [r5] -_08026742: - adds r0, r4, #0 - bl sub_08027870 -_08026748: - add sp, #4 - pop {r4, r5, pc} - .align 2, 0 -_0802674C: .4byte gRoomTransition thumb_func_start sub_08026750 sub_08026750: @ 0x08026750 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 3afd937c..77bb14b4 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -118,7 +118,7 @@ void sub_08027984(); void sub_080279AC(); bool32 sub_080279E8(ChuchuBossEntity*); void sub_08027A60(); -void sub_08027AA4(); +bool32 sub_08027AA4(ChuchuBossEntity*); void sub_08027B98(); void sub_08027BBC(); void sub_08027C54(); @@ -687,3 +687,52 @@ void sub_08026580(ChuchuBossEntity* this) { sub_08027870(super); } } + +void sub_08026634(ChuchuBossEntity* this) { + if (sub_08027AA4(this)) { + return; + } + if (this->unk_7d == 0) { + if (this->unk_7c[0]-- != 0) { + return; + } + if ((this->unk_84->unk_01 & 0x40) == 0) { + if ((this->unk_84->unk_01 & 0x80) != 0) { + this->unk_84->unk_00[0]--; + if (this->unk_84->unk_00[0] == 0) { + this->unk_84->unk_01 = 1; + } + } else { + this->unk_84->unk_01 = 1; + if (this->unk_84->unk_04 == 2 && ((Random() & 3) != 0)) { + this->unk_84->unk_00[0] = 4; + this->unk_84->unk_01 = 0x81; + } + } + } + super->subAction = 3; + this->unk_84->unk_03 = 0; + sub_08027B98(this, 0x90, 0x90, 0xc, 0); + super->zVelocity = Q_16_16(7); + super->speed = 0x180; + } else { + if ((gRoomTransition.frameCount & 0x7f) == 0) { + super->direction = GetFacingDirection(super, &gPlayerEntity); + } + if (this->unk_84->unk_04 == 2) { + super->speed = 0x100; + } else { + super->speed = 0xc0; + } + if (super->timer != 0) { + if ((gRoomTransition.frameCount & 7) == 0) { + SoundReq(SFX_19E); + } + ProcessMovement0(super); + } + if (this->unk_74.HALF_U.HI == this->unk_80[1]) { + this->unk_7d--; + } + } + sub_08027870(super); +} From c05b92e0413bfab8e8e2ded34e829e425d317746 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:40:21 +0300 Subject: [PATCH 16/34] Match sub_08026750 --- asm/enemy/chuchuBoss.s | 19 ------------------- src/enemy/chuchuBoss.c | 5 +++++ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index e2bacff2..b23c3abd 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -16,25 +16,6 @@ - thumb_func_start sub_08026750 -sub_08026750: @ 0x08026750 - push {r4, lr} - adds r4, r0, #0 - bl sub_08027AA4 - ldr r1, _08026770 @ =gUnk_080CC258 - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - ldrb r0, [r0, #3] - lsls r0, r0, #2 - adds r0, r0, r1 - ldr r1, [r0] - adds r0, r4, #0 - bl _call_via_r1 - pop {r4, pc} - .align 2, 0 -_08026770: .4byte gUnk_080CC258 - thumb_func_start sub_08026774 sub_08026774: @ 0x08026774 push {r4, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 77bb14b4..59bf6d76 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -736,3 +736,8 @@ void sub_08026634(ChuchuBossEntity* this) { } sub_08027870(super); } + +void sub_08026750(ChuchuBossEntity* this) { + sub_08027AA4(this); + gUnk_080CC258[this->unk_84->unk_03](this); +} From 78d262be7edb0a68135592a622bb381f5c4cdfa6 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:44:08 +0300 Subject: [PATCH 17/34] Match sub_08026774 --- asm/enemy/chuchuBoss.s | 47 ------------------------------------------ src/enemy/chuchuBoss.c | 13 ++++++++++++ 2 files changed, 13 insertions(+), 47 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index b23c3abd..030e8d44 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -16,53 +16,6 @@ - thumb_func_start sub_08026774 -sub_08026774: @ 0x08026774 - push {r4, lr} - sub sp, #4 - adds r4, r0, #0 - ldr r1, [r4, #0x54] - adds r1, #0x83 - ldr r0, [r4, #0x50] - adds r0, #0x83 - ldrb r1, [r1] - ldrb r0, [r0] - orrs r1, r0 - ldr r0, [r4, #0x68] - adds r0, #0x83 - ldrb r0, [r0] - orrs r1, r0 - cmp r1, #0 - bne _080267C6 - adds r2, r4, #0 - adds r2, #0x7d - ldrb r0, [r2] - subs r0, #1 - strb r0, [r2] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xff - bne _080267CC - str r1, [sp] - adds r0, r4, #0 - movs r1, #0x80 - movs r2, #0x80 - movs r3, #0x40 - bl sub_08027B98 - adds r0, r4, #0 - adds r0, #0x84 - ldr r1, [r0] - movs r0, #1 - strb r0, [r1, #3] - ldr r0, [r4, #0x54] - movs r1, #1 - bl InitAnimationForceUpdate -_080267C6: - adds r0, r4, #0 - bl sub_080277F8 -_080267CC: - add sp, #4 - pop {r4, pc} thumb_func_start sub_080267D0 sub_080267D0: @ 0x080267D0 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 59bf6d76..176af40d 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -741,3 +741,16 @@ void sub_08026750(ChuchuBossEntity* this) { sub_08027AA4(this); gUnk_080CC258[this->unk_84->unk_03](this); } + +void sub_08026774(ChuchuBossEntity* this) { + if ((((ChuchuBossEntity*)super->child)->unk_80[3] | ((ChuchuBossEntity*)super->parent)->unk_80[3] | + this->unk_68->unk_80[3]) == 0) { + if (this->unk_7d-- != 0) { + return; + } + sub_08027B98(this, 0x80, 0x80, 0x40, 0); + this->unk_84->unk_03 = 1; + InitAnimationForceUpdate(super->child, 1); + } + sub_080277F8(this); +} From ce2cec75e7d235dd7a5f7282ec6736aa40aeb341 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 09:45:30 +0300 Subject: [PATCH 18/34] Match sub_080267D0 --- asm/enemy/chuchuBoss.s | 28 ---------------------------- src/enemy/chuchuBoss.c | 8 ++++++++ 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 030e8d44..568ec0f5 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -17,34 +17,6 @@ - thumb_func_start sub_080267D0 -sub_080267D0: @ 0x080267D0 - push {r4, lr} - sub sp, #4 - adds r4, r0, #0 - movs r1, #0xf0 - movs r2, #8 - bl sub_080277B8 - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - ldrb r0, [r0, #3] - cmp r0, #1 - beq _08026802 - movs r0, #0xff - str r0, [sp] - adds r0, r4, #0 - movs r1, #0xe0 - movs r2, #0xc0 - movs r3, #0x20 - bl sub_08027B98 - ldr r0, [r4, #0x54] - movs r1, #2 - bl InitAnimationForceUpdate -_08026802: - add sp, #4 - pop {r4, pc} - .align 2, 0 thumb_func_start sub_08026808 sub_08026808: @ 0x08026808 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 176af40d..34557a84 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -754,3 +754,11 @@ void sub_08026774(ChuchuBossEntity* this) { } sub_080277F8(this); } + +void sub_080267D0(ChuchuBossEntity* this) { + sub_080277B8(this, 0xf0, 8); + if (this->unk_84->unk_03 != 1) { + sub_08027B98(this, 0xe0, 0xc0, 0x20, 0xff); + InitAnimationForceUpdate(super->child, 2); + } +} From 4bd83d06dd0fa658ad4cdef9408a1eb60aa08ac9 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 17:56:22 +0300 Subject: [PATCH 19/34] Match sub_08026808 --- asm/enemy/chuchuBoss.s | 52 ------------------------------------------ src/enemy/chuchuBoss.c | 27 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 52 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 568ec0f5..0e2530ef 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -18,58 +18,6 @@ - thumb_func_start sub_08026808 -sub_08026808: @ 0x08026808 - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - ldr r2, [r4, #0x54] - ldr r7, [r4, #0x68] - ldr r6, [r4, #0x50] - adds r1, r2, #0 - adds r1, #0x76 - ldrh r0, [r1] - cmp r0, #0xbf - bhi _08026820 - adds r0, #4 - strh r0, [r1] -_08026820: - adds r5, r2, #0 - adds r5, #0x7a - ldrh r0, [r5] - cmp r0, #0xb0 - bls _08026830 - subs r0, #8 - strh r0, [r5] - b _08026860 -_08026830: - ldr r1, _08026868 @ =gPlayerEntity - adds r0, r4, #0 - bl GetFacingDirection - strb r0, [r4, #0x15] - movs r0, #4 - strb r0, [r4, #0xd] - movs r1, #0xa0 - strh r1, [r5] - adds r0, r6, #0 - adds r0, #0x7a - strh r1, [r0] - adds r0, r7, #0 - adds r0, #0x7a - strh r1, [r0] - adds r0, r4, #0 - movs r1, #1 - movs r2, #0 - bl sub_080276F4 - movs r0, #0xd1 - lsls r0, r0, #1 - bl SoundReq -_08026860: - adds r0, r4, #0 - bl sub_080277F8 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08026868: .4byte gPlayerEntity - thumb_func_start sub_0802686C sub_0802686C: @ 0x0802686C push {r4, r5, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 34557a84..a573f3c9 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -762,3 +762,30 @@ void sub_080267D0(ChuchuBossEntity* this) { InitAnimationForceUpdate(super->child, 2); } } + +void sub_08026808(ChuchuBossEntity* this) { + u32 uVar1; + ChuchuBossEntity* pEVar4; + ChuchuBossEntity* pEVar5; + ChuchuBossEntity* pEVar6; + + pEVar4 = (ChuchuBossEntity*)super->child; + pEVar6 = this->unk_68; + pEVar5 = (ChuchuBossEntity*)super->parent; + + if (pEVar4->unk_74.HALF_U.HI < 0xc0) { + pEVar4->unk_74.HALF_U.HI += 4; + } + if (pEVar4->unk_78.HALF_U.HI > 0xb0) { + pEVar4->unk_78.HALF_U.HI -= 8; + } else { + super->direction = GetFacingDirection(super, &gPlayerEntity); + super->subAction = 4; + pEVar4->unk_78.HALF_U.HI = 0xa0; + pEVar5->unk_78.HALF_U.HI = 0xa0; + pEVar6->unk_78.HALF_U.HI = 0xa0; + sub_080276F4(this, 1, 0); + SoundReq(SFX_1A2); + } + sub_080277F8(this); +} From 0e4883c719372baaa578e6b702632b18c46d1b8f Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 17:59:06 +0300 Subject: [PATCH 20/34] Match sub_0802686C --- asm/enemy/chuchuBoss.s | 44 ------------------------------------------ src/enemy/chuchuBoss.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 44 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 0e2530ef..753967b5 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -17,50 +17,6 @@ - - thumb_func_start sub_0802686C -sub_0802686C: @ 0x0802686C - push {r4, r5, lr} - sub sp, #4 - adds r4, r0, #0 - movs r1, #0x80 - lsls r1, r1, #7 - bl GravityUpdate - adds r5, r0, #0 - cmp r5, #0 - beq _08026888 - adds r0, r4, #0 - bl ProcessMovement0 - b _080268BE -_08026888: - movs r0, #0x10 - movs r1, #0 - bl InitScreenShake - movs r0, #5 - strb r0, [r4, #0xd] - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - strb r5, [r0, #3] - str r5, [sp] - adds r0, r4, #0 - movs r1, #0x80 - movs r2, #0x80 - movs r3, #0x80 - bl sub_08027B98 - adds r0, r4, #0 - bl sub_08027870 - ldr r0, [r4, #0x54] - movs r1, #3 - bl InitAnimationForceUpdate - ldr r0, _080268C4 @ =0x000001A1 - bl SoundReq -_080268BE: - add sp, #4 - pop {r4, r5, pc} - .align 2, 0 -_080268C4: .4byte 0x000001A1 - thumb_func_start sub_080268C8 sub_080268C8: @ 0x080268C8 push {r4, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index a573f3c9..015ad3d4 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -789,3 +789,17 @@ void sub_08026808(ChuchuBossEntity* this) { } sub_080277F8(this); } + +void sub_0802686C(ChuchuBossEntity* this) { + if (GravityUpdate(super, 0x4000) != 0) { + ProcessMovement0(super); + } else { + InitScreenShake(0x10, 0); + super->subAction = 5; + this->unk_84->unk_03 = 0; + sub_08027B98(this, 0x80, 0x80, 0x80, 0); + sub_08027870(super); + InitAnimationForceUpdate(super->child, 3); + SoundReq(SFX_1A1); + } +} From 3f6deb211b0eb0aed77e38678bb65538c8128ac3 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 18:01:58 +0300 Subject: [PATCH 21/34] Adjust ChuchuBossEntity --- src/enemy/chuchuBoss.c | 77 ++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 015ad3d4..51977ad3 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -11,9 +11,9 @@ #include "functions.h" typedef struct { - u8 unk_00[1]; + u8 unk_00; u8 unk_01; - u8 unk_02[1]; + u8 unk_02; u8 unk_03; u8 unk_04; s8 unk_05; @@ -29,7 +29,7 @@ static_assert(sizeof(Helper) == 0x10); typedef struct _ChuchuBossEntity { Entity base; struct _ChuchuBossEntity* unk_68; - u8 unk_6c[1]; + u8 unk_6c; struct { u8 unk0 : 1; u8 unk1 : 1; @@ -38,10 +38,13 @@ typedef struct _ChuchuBossEntity { u8 unk_70[0x4]; union SplitWord unk_74; union SplitWord unk_78; - u8 unk_7c[1]; + u8 unk_7c; u8 unk_7d; u16 unk_7e; - u8 unk_80[4]; + u8 unk_80; + u8 unk_81; + u8 unk_82; + u8 unk_83; Helper* unk_84; } ChuchuBossEntity; @@ -471,43 +474,43 @@ void sub_08026110(ChuchuBossEntity* this) { } } - if (this->unk_80[0] != 0) { + if (this->unk_80 != 0) { if (super->timer == 0) { - this->unk_74.WORD -= this->unk_80[0] * 0x1000; - this->unk_78.WORD -= this->unk_80[0] * 0x1000; + this->unk_74.WORD -= this->unk_80 * 0x1000; + this->unk_78.WORD -= this->unk_80 * 0x1000; uVar3 = this->unk_74.HALF_U.HI; - uVar2 = this->unk_80[2] + (u8)this->unk_84->unk_05; + uVar2 = this->unk_82 + (u8)this->unk_84->unk_05; if (uVar3 <= uVar2) { this->unk_74.HALF.HI = uVar2; } uVar3 = this->unk_78.HALF_U.HI; - uVar2 = this->unk_80[2]; + uVar2 = this->unk_82; uVar2 += (u8)this->unk_84->unk_05; if (uVar3 <= uVar2) { this->unk_78.HALF.HI = uVar2; } uVar3 = this->unk_74.HALF_U.HI; - uVar2 = this->unk_80[2]; + uVar2 = this->unk_82; uVar2 += (u8)this->unk_84->unk_05; if ((uVar3 <= uVar2) && (this->unk_78.HALF_U.HI <= uVar2)) { super->timer ^= 1; } } else { - this->unk_74.WORD += this->unk_80[0] * 0x1000; - this->unk_78.WORD += this->unk_80[0] * 0x1000; + this->unk_74.WORD += this->unk_80 * 0x1000; + this->unk_78.WORD += this->unk_80 * 0x1000; uVar3 = this->unk_74.HALF_U.HI; - uVar2 = this->unk_80[1] + (u8)this->unk_84->unk_05; + uVar2 = this->unk_81 + (u8)this->unk_84->unk_05; if (uVar3 >= uVar2) { this->unk_74.HALF.HI = uVar2; } uVar3 = this->unk_78.HALF_U.HI; - uVar2 = this->unk_80[1]; + uVar2 = this->unk_81; uVar2 += (u8)this->unk_84->unk_05; if (uVar3 >= uVar2) { this->unk_78.HALF.HI = uVar2; } uVar3 = this->unk_74.HALF_U.HI; - uVar2 = this->unk_80[1]; + uVar2 = this->unk_81; uVar2 += (u8)this->unk_84->unk_05; if ((uVar3 >= uVar2) && (this->unk_78.HALF_U.HI >= uVar2)) { @@ -531,16 +534,16 @@ void sub_0802626C(ChuchuBossEntity* this) { } void sub_080262A8(ChuchuBossEntity* this) { - this->unk_80[2] = 0x90; - this->unk_80[1] = 0xb0; - this->unk_80[0] = 8; + this->unk_82 = 0x90; + this->unk_81 = 0xb0; + this->unk_80 = 8; super->timer = 1; sub_080276F4(super, 6, 1); if (super->type2 == 0) { gPlayerState.animation = 0x104; this->unk_84->unk_03 = 1; } else { - this->unk_7c[0] = 0; + this->unk_7c = 0; this->unk_7d = 0x1e; this->unk_84->unk_03 = 3; gPlayerEntity.animationState = 0; @@ -564,7 +567,7 @@ void sub_08026358(ChuchuBossEntity* this) { if (gPlayerEntity.action != 15) { bVar1 = --this->unk_7d; if (bVar1 == 0) { - this->unk_7c[0] = 0; + this->unk_7c = 0; this->unk_7d = 0x1e; this->unk_84->unk_03++; gPlayerEntity.animationState = 0; @@ -585,9 +588,9 @@ void sub_080263B4(ChuchuBossEntity* this) { u32 bVar3; if (this->unk_7d-- == 0) { - bVar3 = this->unk_7d = gUnk_080CC234[this->unk_7c[0]++]; + bVar3 = this->unk_7d = gUnk_080CC234[this->unk_7c++]; if ((bVar3 & 0xff) == 0xff) { - this->unk_7c[0] = 0x78; + this->unk_7c = 0x78; this->unk_84->unk_03++; } else { CreateObjectWithParent(super, OBJECT_49, super->type2, 0); @@ -599,7 +602,7 @@ void sub_08026414(ChuchuBossEntity* this) { Entity* parent; Entity* child; - if (this->unk_7c[0]-- == 0) { + if (this->unk_7c-- == 0) { super->z.HALF.HI = 0xff40; child = super->child; parent = super->parent; @@ -639,7 +642,7 @@ void sub_080264D4(ChuchuBossEntity* this) { } void sub_0802650C(ChuchuBossEntity* this) { - if (((ChuchuBossEntity*)super->child)->unk_80[1] == 0) { + if (((ChuchuBossEntity*)super->child)->unk_81 == 0) { this->unk_84->unk_03++; gRoomControls.camera_target = &gPlayerEntity; } @@ -666,17 +669,17 @@ void sub_08026580(ChuchuBossEntity* this) { if (this->unk_7d-- == 0) { super->speed = 0; super->subAction = 2; - this->unk_7c[0] = 0x3c; + this->unk_7c = 0x3c; super->direction = GetFacingDirection(super, &gPlayerEntity); if (this->unk_84->unk_04 == 2) { - this->unk_80[0] = 0x48; - this->unk_80[1] += 16; + this->unk_80 = 0x48; + this->unk_81 += 16; } else { - this->unk_80[0] = 16; + this->unk_80 = 16; } if ((this->unk_84->unk_01 & 0xa0) != 0) { this->unk_7d = 0; - this->unk_7c[0] = 0; + this->unk_7c = 0; } else { this->unk_7d = cVar2 = gUnk_080CC24F[Random() & 7] + 1; if (this->unk_84->unk_04 == 2) { @@ -693,19 +696,19 @@ void sub_08026634(ChuchuBossEntity* this) { return; } if (this->unk_7d == 0) { - if (this->unk_7c[0]-- != 0) { + if (this->unk_7c-- != 0) { return; } if ((this->unk_84->unk_01 & 0x40) == 0) { if ((this->unk_84->unk_01 & 0x80) != 0) { - this->unk_84->unk_00[0]--; - if (this->unk_84->unk_00[0] == 0) { + this->unk_84->unk_00--; + if (this->unk_84->unk_00 == 0) { this->unk_84->unk_01 = 1; } } else { this->unk_84->unk_01 = 1; if (this->unk_84->unk_04 == 2 && ((Random() & 3) != 0)) { - this->unk_84->unk_00[0] = 4; + this->unk_84->unk_00 = 4; this->unk_84->unk_01 = 0x81; } } @@ -730,7 +733,7 @@ void sub_08026634(ChuchuBossEntity* this) { } ProcessMovement0(super); } - if (this->unk_74.HALF_U.HI == this->unk_80[1]) { + if (this->unk_74.HALF_U.HI == this->unk_81) { this->unk_7d--; } } @@ -743,8 +746,8 @@ void sub_08026750(ChuchuBossEntity* this) { } void sub_08026774(ChuchuBossEntity* this) { - if ((((ChuchuBossEntity*)super->child)->unk_80[3] | ((ChuchuBossEntity*)super->parent)->unk_80[3] | - this->unk_68->unk_80[3]) == 0) { + if ((((ChuchuBossEntity*)super->child)->unk_83 | ((ChuchuBossEntity*)super->parent)->unk_83 | + this->unk_68->unk_83) == 0) { if (this->unk_7d-- != 0) { return; } From 94b9110a010a87f087fb18a3aaf474a430cb5321 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 18:03:33 +0300 Subject: [PATCH 22/34] Match sub_080268C8 --- asm/enemy/chuchuBoss.s | 18 ------------------ src/enemy/chuchuBoss.c | 5 +++++ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 753967b5..5df4b236 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -17,24 +17,6 @@ - thumb_func_start sub_080268C8 -sub_080268C8: @ 0x080268C8 - push {r4, lr} - adds r4, r0, #0 - bl sub_08027AA4 - ldr r1, _080268E8 @ =gUnk_080CC264 - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - ldrb r0, [r0, #3] - lsls r0, r0, #2 - adds r0, r0, r1 - ldr r1, [r0] - adds r0, r4, #0 - bl _call_via_r1 - pop {r4, pc} - .align 2, 0 -_080268E8: .4byte gUnk_080CC264 thumb_func_start sub_080268EC sub_080268EC: @ 0x080268EC diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 51977ad3..ca0b91c7 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -806,3 +806,8 @@ void sub_0802686C(ChuchuBossEntity* this) { SoundReq(SFX_1A1); } } + +void sub_080268C8(ChuchuBossEntity* this) { + sub_08027AA4(this); + gUnk_080CC264[this->unk_84->unk_03](this); +} From d53611e5066337e1a32817ebbe7610c55acce2da Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 18:04:45 +0300 Subject: [PATCH 23/34] Match sub_080268EC --- asm/enemy/chuchuBoss.s | 21 --------------------- src/enemy/chuchuBoss.c | 8 ++++++++ 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 5df4b236..2909ed75 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -18,27 +18,6 @@ - thumb_func_start sub_080268EC -sub_080268EC: @ 0x080268EC - push {r4, lr} - adds r4, r0, #0 - movs r1, #0xd0 - movs r2, #8 - bl sub_080277B8 - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - ldrb r0, [r0, #3] - cmp r0, #0 - beq _08026912 - ldr r0, [r4, #0x54] - movs r1, #4 - bl InitAnimationForceUpdate - adds r0, r4, #0 - bl sub_08027D20 -_08026912: - pop {r4, pc} - thumb_func_start sub_08026914 sub_08026914: @ 0x08026914 push {r4, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index ca0b91c7..b16983ac 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -811,3 +811,11 @@ void sub_080268C8(ChuchuBossEntity* this) { sub_08027AA4(this); gUnk_080CC264[this->unk_84->unk_03](this); } + +void sub_080268EC(ChuchuBossEntity* this) { + sub_080277B8(this, 0xd0, 8); + if (this->unk_84->unk_03 != 0) { + InitAnimationForceUpdate(super->child, 4); + sub_08027D20(this); + } +} From 71dda3da8385de7661faf054d6504ec7924b8dd6 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 18:06:27 +0300 Subject: [PATCH 24/34] Match sub_08026914 --- asm/enemy/chuchuBoss.s | 26 -------------------------- src/enemy/chuchuBoss.c | 9 +++++++++ 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 2909ed75..7a66f221 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -18,32 +18,6 @@ - thumb_func_start sub_08026914 -sub_08026914: @ 0x08026914 - push {r4, lr} - sub sp, #4 - adds r4, r0, #0 - bl sub_080279E8 - cmp r0, #0 - beq _08026942 - movs r0, #0xff - str r0, [sp] - adds r0, r4, #0 - movs r1, #0x90 - movs r2, #0xb0 - movs r3, #4 - bl sub_08027B98 - adds r0, r4, #0 - movs r1, #0 - bl sub_08027548 - ldr r0, [r4, #0x54] - movs r1, #0 - bl InitAnimationForceUpdate -_08026942: - adds r0, r4, #0 - bl sub_080277F8 - add sp, #4 - pop {r4, pc} thumb_func_start sub_0802694C sub_0802694C: @ 0x0802694C diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index b16983ac..684152bd 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -819,3 +819,12 @@ void sub_080268EC(ChuchuBossEntity* this) { sub_08027D20(this); } } + +void sub_08026914(ChuchuBossEntity* this) { + if (sub_080279E8(this)) { + sub_08027B98(this, 0x90, 0xb0, 4, 0xff); + sub_08027548(this, 0); + InitAnimationForceUpdate(super->child, 0); + } + sub_080277F8(this); +} From 36579fb5eccdf1b80130fb848222c57e24c94a13 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 18:07:49 +0300 Subject: [PATCH 25/34] Match sub_0802694C --- asm/enemy/chuchuBoss.s | 17 ----------------- src/enemy/chuchuBoss.c | 4 ++++ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 7a66f221..b0db57d7 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -18,23 +18,6 @@ - - thumb_func_start sub_0802694C -sub_0802694C: @ 0x0802694C - push {lr} - ldr r2, _08026964 @ =gUnk_080CC26C - adds r1, r0, #0 - adds r1, #0x84 - ldr r1, [r1] - ldrb r1, [r1, #3] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08026964: .4byte gUnk_080CC26C - thumb_func_start sub_08026968 sub_08026968: @ 0x08026968 push {r4, r5, r6, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 684152bd..286c7adc 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -828,3 +828,7 @@ void sub_08026914(ChuchuBossEntity* this) { } sub_080277F8(this); } + +void sub_0802694C(ChuchuBossEntity* this) { + gUnk_080CC26C[this->unk_84->unk_03](this); +} From 4b4065ba77d062a38f6cbc42f7abaee895ba69f8 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 18:15:30 +0300 Subject: [PATCH 26/34] Match sub_08026968 --- asm/enemy/chuchuBoss.s | 55 ------------------------------------------ src/enemy/chuchuBoss.c | 39 ++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 63 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index b0db57d7..b81ae5c7 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -18,61 +18,6 @@ - thumb_func_start sub_08026968 -sub_08026968: @ 0x08026968 - push {r4, r5, r6, lr} - adds r2, r0, #0 - adds r1, r2, #0 - adds r1, #0x7d - ldrb r0, [r1] - subs r0, #1 - strb r0, [r1] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xff - bne _0802698C - adds r0, r2, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - b _080269C0 -_0802698C: - ldr r6, [r2, #0x54] - ldr r4, [r2, #0x68] - ldr r5, [r2, #0x50] - ldrb r1, [r2, #0x15] - movs r0, #0x10 - ands r0, r1 - ldr r3, _080269C8 @ =0xFFFFFF00 - cmp r0, #0 - beq _080269A2 - movs r3, #0x80 - lsls r3, r3, #1 -_080269A2: - adds r1, r4, #0 - adds r1, #0x82 - ldrh r0, [r1] - adds r0, r0, r3 - strh r0, [r1] - adds r1, r5, #0 - adds r1, #0x82 - ldrh r0, [r1] - adds r0, r0, r3 - strh r0, [r1] - adds r1, r6, #0 - adds r1, #0x82 - ldrh r0, [r1] - adds r0, r0, r3 - strh r0, [r1] -_080269C0: - adds r0, r2, #0 - bl sub_08027870 - pop {r4, r5, r6, pc} - .align 2, 0 -_080269C8: .4byte 0xFFFFFF00 - thumb_func_start sub_080269CC sub_080269CC: @ 0x080269CC .ifdef EU diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 286c7adc..632ddf0c 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -43,8 +43,7 @@ typedef struct _ChuchuBossEntity { u16 unk_7e; u8 unk_80; u8 unk_81; - u8 unk_82; - u8 unk_83; + union SplitHWord unk_82; Helper* unk_84; } ChuchuBossEntity; @@ -479,18 +478,18 @@ void sub_08026110(ChuchuBossEntity* this) { this->unk_74.WORD -= this->unk_80 * 0x1000; this->unk_78.WORD -= this->unk_80 * 0x1000; uVar3 = this->unk_74.HALF_U.HI; - uVar2 = this->unk_82 + (u8)this->unk_84->unk_05; + uVar2 = this->unk_82.HALF.LO + (u8)this->unk_84->unk_05; if (uVar3 <= uVar2) { this->unk_74.HALF.HI = uVar2; } uVar3 = this->unk_78.HALF_U.HI; - uVar2 = this->unk_82; + uVar2 = this->unk_82.HALF.LO; uVar2 += (u8)this->unk_84->unk_05; if (uVar3 <= uVar2) { this->unk_78.HALF.HI = uVar2; } uVar3 = this->unk_74.HALF_U.HI; - uVar2 = this->unk_82; + uVar2 = this->unk_82.HALF.LO; uVar2 += (u8)this->unk_84->unk_05; if ((uVar3 <= uVar2) && (this->unk_78.HALF_U.HI <= uVar2)) { super->timer ^= 1; @@ -534,7 +533,7 @@ void sub_0802626C(ChuchuBossEntity* this) { } void sub_080262A8(ChuchuBossEntity* this) { - this->unk_82 = 0x90; + this->unk_82.HALF.LO = 0x90; this->unk_81 = 0xb0; this->unk_80 = 8; super->timer = 1; @@ -746,8 +745,8 @@ void sub_08026750(ChuchuBossEntity* this) { } void sub_08026774(ChuchuBossEntity* this) { - if ((((ChuchuBossEntity*)super->child)->unk_83 | ((ChuchuBossEntity*)super->parent)->unk_83 | - this->unk_68->unk_83) == 0) { + if ((((ChuchuBossEntity*)super->child)->unk_82.HALF.HI | ((ChuchuBossEntity*)super->parent)->unk_82.HALF.HI | + this->unk_68->unk_82.HALF.HI) == 0) { if (this->unk_7d-- != 0) { return; } @@ -832,3 +831,27 @@ void sub_08026914(ChuchuBossEntity* this) { void sub_0802694C(ChuchuBossEntity* this) { gUnk_080CC26C[this->unk_84->unk_03](this); } + +void sub_08026968(ChuchuBossEntity* this) { + s32 sVar5; + ChuchuBossEntity* pEVar6; + ChuchuBossEntity* pEVar7; + ChuchuBossEntity* pEVar8; + + if (this->unk_7d-- == 0) { + this->unk_84->unk_03++; + } else { + pEVar7 = (ChuchuBossEntity*)super->child; + pEVar8 = this->unk_68; + pEVar6 = (ChuchuBossEntity*)super->parent; + if ((super->direction & 0x10) != 0) { + sVar5 = 0x100; + } else { + sVar5 = -0x100; + } + pEVar8->unk_82.HWORD += sVar5; + pEVar6->unk_82.HWORD += sVar5; + pEVar7->unk_82.HWORD += sVar5; + } + sub_08027870(super); +} From e6caca78d7168d382a83357ab27fab6dca591cce Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Jul 2022 19:25:33 +0300 Subject: [PATCH 27/34] Match sub_080269CC --- asm/enemy/chuchuBoss.s | 551 +---------------------------------------- src/enemy/chuchuBoss.c | 106 ++++++++ 2 files changed, 107 insertions(+), 550 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index b81ae5c7..74006d38 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -18,556 +18,7 @@ - thumb_func_start sub_080269CC -sub_080269CC: @ 0x080269CC -.ifdef EU - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - adds r6, r0, #0 - movs r7, #0 - ldr r5, [r6, #0x54] - ldr r0, [r6, #0x68] - mov sl, r0 - ldr r1, [r6, #0x50] - mov sb, r1 - ldrb r1, [r6, #0x15] - movs r0, #0x10 - ands r0, r1 - movs r1, #0xc0 - lsls r1, r1, #2 - mov r8, r1 - cmp r0, #0 - beq _080269DC - ldr r0, _080269FC @ =0xFFFFFD00 - mov r8, r0 -_080269DC: - mov r0, sl - adds r0, #0x83 - ldrb r0, [r0] - adds r4, r0, #0 - adds r4, #0x20 - lsls r0, r4, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0x3f - bhi _08026A00 - mov r1, sl - adds r1, #0x82 - ldrh r0, [r1] - add r0, r8 - strh r0, [r1] - b _08026A02 - .align 2, 0 -_080269FC: .4byte 0xFFFFFD00 -_08026A00: - movs r7, #1 -_08026A02: - mov r0, sb - adds r0, #0x83 - ldrb r0, [r0] - adds r4, r0, #0 - adds r4, #0x44 - lsls r0, r4, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0x87 - bhi _08026A20 - mov r1, sb - adds r1, #0x82 - ldrh r0, [r1] - add r0, r8 - strh r0, [r1] - b _08026A22 -_08026A20: - adds r7, #1 -_08026A22: - adds r0, r5, #0 - adds r0, #0x83 - ldrb r0, [r0] - adds r4, r0, #0 - adds r4, #0x40 - adds r0, #0x20 - cmp r0, #0x40 - bls _08026A62 - ldrb r1, [r6, #0x15] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08026A50 - adds r0, r5, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #6 - beq _08026A62 - adds r0, r5, #0 - movs r1, #6 - bl InitAnimationForceUpdate - b _08026A62 -_08026A50: - adds r0, r5, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #5 - beq _08026A62 - adds r0, r5, #0 - movs r1, #5 - bl InitAnimationForceUpdate -_08026A62: - lsls r0, r4, #0x18 - cmp r0, #0 - blt _08026A74 - adds r1, r5, #0 - adds r1, #0x82 - ldrh r0, [r1] - add r0, r8 - strh r0, [r1] - b _08026A76 -_08026A74: - adds r7, #1 -_08026A76: - cmp r7, #3 - beq _08026A7C - b _08026B98 -_08026A7C: - ldrb r1, [r6, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r6, #0x10] - ldrb r1, [r5, #0x10] - movs r0, #0x80 - orrs r0, r1 - strb r0, [r5, #0x10] - adds r1, r5, #0 - adds r1, #0x76 - ldrh r0, [r1] - adds r0, #3 - strh r0, [r1] - movs r0, #0x20 - movs r1, #0 - bl InitScreenShake - ldr r0, _08026B24 @ =0x0000010B - bl SoundReq - adds r0, r6, #0 - movs r1, #0x15 - movs r2, #0 - movs r3, #0 - bl CreateObjectWithParent - adds r4, r0, #0 - cmp r4, #0 - beq _08026B2E - movs r0, #0xc9 - strh r0, [r4, #0x12] - adds r0, r6, #0 - adds r0, #0x60 - ldrh r1, [r0] - adds r0, r4, #0 - adds r0, #0x60 - strh r1, [r0] - ldrb r1, [r6, #0x1a] - lsls r1, r1, #0x1c - lsrs r1, r1, #0x1c - ldrb r2, [r4, #0x1a] - movs r0, #0x10 - rsbs r0, r0, #0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, #0x1a] - adds r1, r4, #0 - adds r1, #0x58 - movs r0, #1 - strb r0, [r1] - ldrh r0, [r4, #0x32] - adds r0, #0x10 - strh r0, [r4, #0x32] - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r1 - strb r0, [r2] - ldrb r2, [r5, #0x19] - lsrs r2, r2, #6 - lsls r2, r2, #6 - ldrb r3, [r4, #0x19] - movs r1, #0x3f - adds r0, r1, #0 - ands r0, r3 - orrs r0, r2 - strb r0, [r4, #0x19] - ldrb r0, [r5, #0x1b] - lsrs r0, r0, #6 - lsls r0, r0, #6 - ldrb r2, [r4, #0x1b] - ands r1, r2 - orrs r1, r0 - strb r1, [r4, #0x1b] - ldrb r1, [r6, #0x15] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08026B28 - ldrh r0, [r4, #0x2e] - subs r0, #0x38 - b _08026B2C - .align 2, 0 -_08026B24: .4byte 0x0000010B -_08026B28: - ldrh r0, [r4, #0x2e] - adds r0, #0x38 -_08026B2C: - strh r0, [r4, #0x2e] -_08026B2E: - ldr r3, [r6, #0x50] - ldr r2, [r6, #0x54] - ldr r0, [r6, #0x68] - adds r0, #0x84 - movs r1, #1 - strb r1, [r0] - adds r2, #0x84 - strb r1, [r2] - adds r3, #0x84 - strb r1, [r3] - mov r0, sb - adds r0, #0x7a - movs r1, #0x98 - strh r1, [r0] - mov r0, sl - adds r0, #0x7a - strh r1, [r0] - adds r0, r5, #0 - adds r0, #0x7a - strh r1, [r0] - bl Random - ldr r2, _08026B94 @ =gUnk_080CC278 - movs r1, #3 - ands r1, r0 - adds r1, r1, r2 - ldrb r0, [r1] - adds r7, r6, #0 - adds r7, #0x7c - strb r0, [r7] - adds r0, r6, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - adds r0, r5, #0 - movs r1, #0x49 - movs r2, #0xa - movs r3, #0 - bl CreateObjectWithParent - adds r4, r0, #0 - cmp r4, #0 - beq _08026BB4 - adds r1, r4, #0 - adds r1, #0x84 - ldrb r0, [r7] - str r0, [r1] - b _08026BB4 - .align 2, 0 -_08026B94: .4byte gUnk_080CC278 -_08026B98: - adds r0, r5, #0 - adds r0, #0x76 - ldrh r0, [r0] - cmp r0, #0xef - bhi _08026BB4 - ldr r0, [r5, #0x74] - movs r1, #0x80 - lsls r1, r1, #0xb - adds r0, r0, r1 - str r0, [r5, #0x74] - ldr r0, [r5, #0x78] - ldr r1, _08026BC4 @ =0xFFFF8000 - adds r0, r0, r1 - str r0, [r5, #0x78] -_08026BB4: - adds r0, r6, #0 - bl sub_08027870 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08026BC4: .4byte 0xFFFF8000 -.else - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - adds r6, r0, #0 - movs r7, #0 - ldr r5, [r6, #0x54] - ldr r0, [r6, #0x68] - mov sl, r0 - ldr r1, [r6, #0x50] - mov sb, r1 - ldrb r1, [r6, #0x15] - movs r0, #0x10 - ands r0, r1 - movs r1, #0xc0 - lsls r1, r1, #2 - mov r8, r1 - cmp r0, #0 - beq _080269F8 - ldr r0, _08026A18 @ =0xFFFFFD00 - mov r8, r0 -_080269F8: - mov r0, sl - adds r0, #0x83 - ldrb r0, [r0] - adds r4, r0, #0 - adds r4, #0x20 - lsls r0, r4, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0x3f - bhi _08026A1C - mov r1, sl - adds r1, #0x82 - ldrh r0, [r1] - add r0, r8 - strh r0, [r1] - b _08026A1E - .align 2, 0 -_08026A18: .4byte 0xFFFFFD00 -_08026A1C: - movs r7, #1 -_08026A1E: - mov r0, sb - adds r0, #0x83 - ldrb r0, [r0] - adds r4, r0, #0 - adds r4, #0x44 - lsls r0, r4, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0x87 - bhi _08026A3C - mov r1, sb - adds r1, #0x82 - ldrh r0, [r1] - add r0, r8 - strh r0, [r1] - b _08026A3E -_08026A3C: - adds r7, #1 -_08026A3E: - adds r0, r5, #0 - adds r0, #0x83 - ldrb r0, [r0] - adds r4, r0, #0 - adds r4, #0x40 - adds r0, #0x20 - cmp r0, #0x40 - bls _08026A7E - ldrb r1, [r6, #0x15] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08026A6C - adds r0, r5, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #6 - beq _08026A7E - adds r0, r5, #0 - movs r1, #6 - bl InitAnimationForceUpdate - b _08026A7E -_08026A6C: - adds r0, r5, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #5 - beq _08026A7E - adds r0, r5, #0 - movs r1, #5 - bl InitAnimationForceUpdate -_08026A7E: - lsls r0, r4, #0x18 - cmp r0, #0 - blt _08026A90 - adds r1, r5, #0 - adds r1, #0x82 - ldrh r0, [r1] - add r0, r8 - strh r0, [r1] - b _08026A92 -_08026A90: - adds r7, #1 -_08026A92: - cmp r7, #3 - beq _08026A98 - b _08026BB8 -_08026A98: - ldrb r1, [r6, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r6, #0x10] - ldrb r1, [r5, #0x10] - movs r0, #0x80 - orrs r0, r1 - strb r0, [r5, #0x10] - adds r1, r5, #0 - adds r1, #0x76 - ldrh r0, [r1] - adds r0, #3 - strh r0, [r1] - movs r0, #0x20 - movs r1, #0 - bl InitScreenShake - ldr r0, _08026B24 @ =0x0000010B - bl SoundReq - adds r0, r6, #0 - movs r1, #0x15 - movs r2, #0 - movs r3, #0 - bl CreateObjectWithParent - adds r4, r0, #0 - cmp r4, #0 - beq _08026B4E - movs r0, #0xc9 - strh r0, [r4, #0x12] - adds r1, r4, #0 - adds r1, #0x58 - movs r0, #1 - strb r0, [r1] - ldrh r0, [r4, #0x32] - adds r0, #0x10 - strh r0, [r4, #0x32] - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r1 - strb r0, [r2] - ldrb r2, [r5, #0x19] - lsrs r2, r2, #6 - lsls r2, r2, #6 - ldrb r3, [r4, #0x19] - movs r1, #0x3f - adds r0, r1, #0 - ands r0, r3 - orrs r0, r2 - strb r0, [r4, #0x19] - ldrb r0, [r5, #0x1b] - lsrs r0, r0, #6 - lsls r0, r0, #6 - ldrb r2, [r4, #0x1b] - ands r1, r2 - orrs r1, r0 - strb r1, [r4, #0x1b] - ldrb r1, [r6, #0x15] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08026B28 - ldrh r0, [r4, #0x2e] - subs r0, #0x38 - b _08026B2C - .align 2, 0 -_08026B24: .4byte 0x0000010B -_08026B28: - ldrh r0, [r4, #0x2e] - adds r0, #0x38 -_08026B2C: - strh r0, [r4, #0x2e] - adds r0, r4, #0 - movs r1, #0x3e - bl LoadFixedGFX - ldrb r0, [r6, #0xb] - cmp r0, #0 - bne _08026B46 - adds r0, r4, #0 - movs r1, #0x2b - bl LoadObjPalette - b _08026B4E -_08026B46: - adds r0, r4, #0 - movs r1, #0x2c - bl LoadObjPalette -_08026B4E: - ldr r3, [r6, #0x50] - ldr r2, [r6, #0x54] - ldr r0, [r6, #0x68] - adds r0, #0x84 - movs r1, #1 - strb r1, [r0] - adds r2, #0x84 - strb r1, [r2] - adds r3, #0x84 - strb r1, [r3] - mov r0, sb - adds r0, #0x7a - movs r1, #0x98 - strh r1, [r0] - mov r0, sl - adds r0, #0x7a - strh r1, [r0] - adds r0, r5, #0 - adds r0, #0x7a - strh r1, [r0] - bl Random - ldr r2, _08026BB4 @ =gUnk_080CC278 - movs r1, #3 - ands r1, r0 - adds r1, r1, r2 - ldrb r0, [r1] - adds r7, r6, #0 - adds r7, #0x7c - strb r0, [r7] - adds r0, r6, #0 - adds r0, #0x84 - ldr r1, [r0] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - adds r0, r5, #0 - movs r1, #0x49 - movs r2, #0xa - movs r3, #0 - bl CreateObjectWithParent - adds r4, r0, #0 - cmp r4, #0 - beq _08026BD4 - adds r1, r4, #0 - adds r1, #0x84 - ldrb r0, [r7] - str r0, [r1] - b _08026BD4 - .align 2, 0 -_08026BB4: .4byte gUnk_080CC278 -_08026BB8: - adds r0, r5, #0 - adds r0, #0x76 - ldrh r0, [r0] - cmp r0, #0xef - bhi _08026BD4 - ldr r0, [r5, #0x74] - movs r1, #0x80 - lsls r1, r1, #0xb - adds r0, r0, r1 - str r0, [r5, #0x74] - ldr r0, [r5, #0x78] - ldr r1, _08026BE4 @ =0xFFFF8000 - adds r0, r0, r1 - str r0, [r5, #0x78] -_08026BD4: - adds r0, r6, #0 - bl sub_08027870 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08026BE4: .4byte 0xFFFF8000 -.endif + thumb_func_start sub_08026BE8 sub_08026BE8: @ 0x08026BE8 push {r4, r5, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 632ddf0c..f393d286 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -855,3 +855,109 @@ void sub_08026968(ChuchuBossEntity* this) { } sub_08027870(super); } + +void sub_080269CC(ChuchuBossEntity* this) { + s32 sVar1; + ChuchuBossEntity* pEVar2; + u32 uVar3; + GenericEntity* entity; + ChuchuBossEntity* pEVar4; + ChuchuBossEntity* pEVar5; + ChuchuBossEntity* pEVar6; + ChuchuBossEntity* pEVar7; + u8 temp; + s32 temp2; + u32 cVar8 = 0; + + pEVar7 = (ChuchuBossEntity*)super->child; + pEVar2 = this->unk_68; + pEVar4 = (ChuchuBossEntity*)super->parent; + if ((super->direction & 0x10) != 0) { + sVar1 = -0x300; + } else { + sVar1 = 0x300; + } + + temp2 = pEVar2->unk_82.HALF.HI + 0x20; + if ((u8)temp2 <= 0x3f) { + pEVar2->unk_82.HWORD += sVar1; + } else { + cVar8 = 1; + } + temp2 = pEVar4->unk_82.HALF.HI + 0x44; + if ((u8)temp2 < 0x88) { + pEVar4->unk_82.HWORD += sVar1; + } else { + cVar8++; + } + temp2 = pEVar7->unk_82.HALF.HI + 0x40; + if ((u32)(temp2 - 0x20) > 0x40) { + if ((super->direction & 0x10) != 0) { + if (pEVar7->base.animIndex != 6) { + InitAnimationForceUpdate(&pEVar7->base, 6); + } + } else { + if (pEVar7->base.animIndex != 5) { + InitAnimationForceUpdate(&pEVar7->base, 5); + } + } + } + + if ((temp2 << 0x18) >= 0) { + pEVar7->unk_82.HWORD += sVar1; + } else { + cVar8++; + } + + if (cVar8 == 3) { + COLLISION_OFF(super); + COLLISION_ON(&pEVar7->base); + pEVar7->unk_74.HALF.HI += 3; + InitScreenShake(0x20, 0); + SoundReq(SFX_10B); + entity = (GenericEntity*)CreateObjectWithParent(super, OBJECT_15, 0, 0); + if (entity != NULL) { + entity->base.spriteIndex = 0xc9; +#ifdef EU + entity->base.spriteVramOffset = super->spriteVramOffset; + entity->base.palette.b.b0 = super->palette.b.b0; +#endif + entity->base.animIndex = 1; + entity->base.y.HALF.HI += 0x10; + entity->base.spritePriority.b0 = 0; + entity->base.spriteRendering.b3 = pEVar7->base.spriteRendering.b3; + entity->base.spriteOrientation.flipY = pEVar7->base.spriteOrientation.flipY; + if ((super->direction & 0x10) != 0) { + entity->base.x.HALF.HI -= 0x38; + } else { + entity->base.x.HALF.HI += 0x38; + } +#ifndef EU + LoadFixedGFX(&entity->base, 0x3e); + if (super->type2 == 0) { + LoadObjPalette(&entity->base, 0x2b); + } else { + LoadObjPalette(&entity->base, 0x2c); + } +#endif + } + pEVar6 = (ChuchuBossEntity*)super->parent; + pEVar5 = (ChuchuBossEntity*)super->child; + *(u8*)&this->unk_68->unk_84 = 1; + *(u8*)&pEVar5->unk_84 = 1; + *(u8*)&pEVar6->unk_84 = 1; + pEVar4->unk_78.HALF.HI = 0x98; + pEVar2->unk_78.HALF.HI = 0x98; + pEVar7->unk_78.HALF.HI = 0x98; + this->unk_7c = gUnk_080CC278[Random() & 3]; + this->unk_84->unk_03++; + entity = (GenericEntity*)CreateObjectWithParent(&pEVar7->base, OBJECT_49, 10, 0); + if (entity != NULL) { + *(u32*)&entity->cutsceneBeh = this->unk_7c; + } + } else if (pEVar7->unk_74.HALF_U.HI < 0xf0) { + pEVar7->unk_74.WORD += 0x40000; + pEVar7->unk_78.WORD -= 0x8000; + } + sub_08027870(super); +} From a3c3eb24ad7c99ed402c7a1cdc20cf6ac6513f26 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Jul 2022 05:39:20 +0300 Subject: [PATCH 28/34] Match sub_08026BE8 --- asm/enemy/chuchuBoss.s | 46 ------------------------------------------ src/enemy/chuchuBoss.c | 18 +++++++++++++++++ 2 files changed, 18 insertions(+), 46 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 74006d38..707cf631 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -19,52 +19,6 @@ - thumb_func_start sub_08026BE8 -sub_08026BE8: @ 0x08026BE8 - push {r4, r5, lr} - adds r4, r0, #0 - ldr r5, [r4, #0x54] - adds r3, r5, #0 - adds r3, #0x3b - ldrb r1, [r3] - movs r0, #0xfe - ands r0, r1 - strb r0, [r3] - adds r1, r4, #0 - adds r1, #0x7c - ldrb r0, [r1] - adds r2, r0, #0 - cmp r2, #0 - bne _08026C34 - movs r0, #7 - strb r0, [r4, #0xd] - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - strb r2, [r0, #3] - adds r1, #1 - movs r0, #0x2d - strb r0, [r1] - ldrb r1, [r5, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r5, #0x10] - ldrb r0, [r3] - movs r1, #1 - orrs r0, r1 - strb r0, [r3] - ldr r0, _08026C30 @ =0x00000155 - bl SoundReq - b _08026C38 - .align 2, 0 -_08026C30: .4byte 0x00000155 -_08026C34: - subs r0, #1 - strb r0, [r1] -_08026C38: - adds r0, r4, #0 - bl sub_08027870 - pop {r4, r5, pc} thumb_func_start sub_08026C40 sub_08026C40: @ 0x08026C40 diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index f393d286..0d84698d 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -961,3 +961,21 @@ void sub_080269CC(ChuchuBossEntity* this) { } sub_08027870(super); } + +void sub_08026BE8(ChuchuBossEntity* this) { + Entity* child; + + child = super->child; + child->flags2 &= ~1; + if (this->unk_7c == 0) { + super->subAction = 7; + this->unk_84->unk_03 = 0; + this->unk_7d = 0x2d; + child->flags &= ~0x80; + child->flags2 |= 1; + SoundReq(SFX_155); + } else { + this->unk_7c--; + } + sub_08027870(super); +} From 1f0a99b0111acecca875a4f338f49eb5e193e1b8 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Jul 2022 06:01:00 +0300 Subject: [PATCH 29/34] Match sub_08026C40 --- asm/enemy/chuchuBoss.s | 248 ----------------------------------------- src/enemy/chuchuBoss.c | 91 +++++++++++++++ 2 files changed, 91 insertions(+), 248 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 707cf631..70db6c1a 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -20,254 +20,6 @@ - thumb_func_start sub_08026C40 -sub_08026C40: @ 0x08026C40 - push {r4, r5, r6, r7, lr} - mov r7, r8 - push {r7} - sub sp, #4 - adds r5, r0, #0 - ldr r4, [r5, #0x54] - ldr r7, [r5, #0x68] - ldr r6, [r5, #0x50] - adds r2, r5, #0 - adds r2, #0x7d - ldrb r0, [r2] - cmp r0, #0 - beq _08026CCC - subs r1, r0, #1 - strb r1, [r2] - lsls r0, r1, #0x18 - cmp r0, #0 - beq _08026C9C - movs r0, #8 - ands r1, r0 - cmp r1, #0 - beq _08026C82 - ldr r0, [r4, #0x74] - movs r1, #0x80 - lsls r1, r1, #0xa - adds r0, r0, r1 - str r0, [r4, #0x74] - ldr r0, [r4, #0x78] - movs r2, #0x80 - lsls r2, r2, #9 - adds r0, r0, r2 - str r0, [r4, #0x78] - b _08026E12 -_08026C82: - ldr r0, [r4, #0x74] - ldr r3, _08026C94 @ =0xFFFE0000 - adds r0, r0, r3 - str r0, [r4, #0x74] - ldr r0, [r4, #0x78] - ldr r1, _08026C98 @ =0xFFFF0000 - adds r0, r0, r1 - str r0, [r4, #0x78] - b _08026E12 - .align 2, 0 -_08026C94: .4byte 0xFFFE0000 -_08026C98: .4byte 0xFFFF0000 -_08026C9C: - ldrb r1, [r5, #0x15] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08026CBA - adds r0, r4, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #8 - beq _08026CCC - adds r0, r4, #0 - movs r1, #8 - bl InitAnimationForceUpdate - b _08026CCC -_08026CBA: - adds r0, r4, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #7 - beq _08026CCC - adds r0, r4, #0 - movs r1, #7 - bl InitAnimationForceUpdate -_08026CCC: - adds r0, r5, #0 - adds r0, #0x7c - ldrb r1, [r0] - mov r8, r0 - cmp r1, #0 - bne _08026CF0 - ldrb r1, [r5, #0x15] - movs r0, #0x10 - ands r0, r1 - ldr r2, _08026CEC @ =0xFFFFFD00 - cmp r0, #0 - beq _08026D00 - movs r2, #0xc0 - lsls r2, r2, #2 - b _08026D00 - .align 2, 0 -_08026CEC: .4byte 0xFFFFFD00 -_08026CF0: - ldrb r1, [r5, #0x15] - movs r0, #0x10 - ands r0, r1 - ldr r2, _08026D30 @ =0xFFFFFB80 - cmp r0, #0 - beq _08026D00 - movs r2, #0x90 - lsls r2, r2, #3 -_08026D00: - adds r0, r7, #0 - adds r0, #0x83 - ldrb r0, [r0] - adds r0, #6 - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xc - bls _08026D34 - adds r1, r7, #0 - adds r1, #0x82 - lsls r0, r2, #1 - ldrh r3, [r1] - adds r0, r0, r3 - strh r0, [r1] - adds r1, r6, #0 - adds r1, #0x82 - ldrh r0, [r1] - adds r0, r0, r2 - strh r0, [r1] - adds r1, r4, #0 - adds r1, #0x82 - ldrh r0, [r1] - b _08026D7E - .align 2, 0 -_08026D30: .4byte 0xFFFFFB80 -_08026D34: - adds r0, r7, #0 - adds r0, #0x82 - movs r1, #0 - strh r1, [r0] - adds r0, r6, #0 - adds r0, #0x83 - ldrb r0, [r0] - adds r0, #6 - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xc - bls _08026D60 - adds r1, r6, #0 - adds r1, #0x82 - lsls r0, r2, #1 - ldrh r3, [r1] - adds r0, r0, r3 - strh r0, [r1] - adds r1, r4, #0 - adds r1, #0x82 - ldrh r0, [r1] - b _08026D7E -_08026D60: - adds r0, r6, #0 - adds r0, #0x82 - strh r1, [r0] - adds r0, r4, #0 - adds r0, #0x83 - ldrb r0, [r0] - adds r0, #6 - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xc - bls _08026D84 - adds r1, r4, #0 - adds r1, #0x82 - lsls r0, r2, #1 - ldrh r2, [r1] -_08026D7E: - adds r0, r0, r2 - strh r0, [r1] - b _08026D8A -_08026D84: - adds r0, r4, #0 - adds r0, #0x82 - strh r1, [r0] -_08026D8A: - adds r1, r4, #0 - adds r1, #0x76 - ldrh r0, [r1] - cmp r0, #0xa0 - bls _08026DA4 - ldr r0, [r4, #0x74] - ldr r3, _08026DA0 @ =0xFFFC0000 - adds r0, r0, r3 - str r0, [r4, #0x74] - b _08026DA8 - .align 2, 0 -_08026DA0: .4byte 0xFFFC0000 -_08026DA4: - movs r0, #0xa0 - strh r0, [r1] -_08026DA8: - adds r0, r4, #0 - adds r0, #0x7a - ldrh r0, [r0] - cmp r0, #0x9f - bhi _08026DBE - ldr r0, [r4, #0x78] - movs r1, #0x80 - lsls r1, r1, #8 - adds r0, r0, r1 - str r0, [r4, #0x78] - b _08026E0C -_08026DBE: - adds r0, r5, #0 - movs r1, #3 - movs r2, #0 - bl sub_080276F4 - adds r0, r4, #0 - adds r0, #0x7d - movs r2, #0 - strb r2, [r0] - ldrb r1, [r5, #0x15] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08026DEE - adds r1, r6, #0 - adds r1, #0x85 - movs r0, #1 - strb r0, [r1] - adds r1, r7, #0 - adds r1, #0x85 - strb r0, [r1] - adds r1, r4, #0 - adds r1, #0x85 - strb r0, [r1] -_08026DEE: - movs r0, #8 - strb r0, [r5, #0xd] - movs r0, #4 - mov r3, r8 - strb r0, [r3] - strb r2, [r6, #0xf] - strb r2, [r7, #0xf] - strb r2, [r4, #0xf] - str r2, [sp] - adds r0, r5, #0 - movs r1, #0x90 - movs r2, #0xb0 - movs r3, #0x10 - bl sub_08027B98 -_08026E0C: - adds r0, r5, #0 - bl sub_08027870 -_08026E12: - add sp, #4 - pop {r3} - mov r8, r3 - pop {r4, r5, r6, r7, pc} - .align 2, 0 thumb_func_start sub_08026E1C sub_08026E1C: @ 0x08026E1C diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 0d84698d..5908e50a 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -979,3 +979,94 @@ void sub_08026BE8(ChuchuBossEntity* this) { } sub_08027870(super); } + +void sub_08026C40(ChuchuBossEntity* this) { + u8 bVar2; + int iVar5; + ChuchuBossEntity* pEVar6; + ChuchuBossEntity* pEVar7; + ChuchuBossEntity* pEVar8; + + pEVar6 = (ChuchuBossEntity*)super->child; + pEVar8 = this->unk_68; + pEVar7 = (ChuchuBossEntity*)super->parent; + if (this->unk_7d != 0) { + if (--this->unk_7d != 0) { + if ((this->unk_7d & 8) != 0) { + pEVar6->unk_74.WORD += 0x20000; + pEVar6->unk_78.WORD += 0x10000; + return; + } + pEVar6->unk_74.WORD -= 0x20000; + pEVar6->unk_78.WORD -= 0x10000; + return; + } + if ((super->direction & 0x10) != 0) { + if (pEVar6->base.animIndex != 8) { + InitAnimationForceUpdate(&pEVar6->base, 8); + } + } else { + if (pEVar6->base.animIndex != 7) { + InitAnimationForceUpdate(&pEVar6->base, 7); + } + } + } + if (this->unk_7c == 0) { + if ((super->direction & 0x10) != 0) { + iVar5 = 0x300; + } else { + iVar5 = -0x300; + } + } else { + if ((super->direction & 0x10) != 0) { + iVar5 = 0x480; + } else { + iVar5 = -0x480; + } + } + bVar2 = pEVar8->unk_82.HALF.HI + 6; + if (bVar2 >= 0xd) { + pEVar8->unk_82.HWORD += iVar5 * 2; + pEVar7->unk_82.HWORD += iVar5; + pEVar6->unk_82.HWORD += iVar5; + } else { + pEVar8->unk_82.HWORD = 0; + bVar2 = pEVar7->unk_82.HALF.HI + 6U; + if (bVar2 >= 0xd) { + pEVar7->unk_82.HWORD += iVar5 * 2; + pEVar6->unk_82.HWORD += iVar5; + } else { + pEVar7->unk_82.HWORD = 0; + bVar2 = pEVar6->unk_82.HALF.HI + 6U; + if (bVar2 >= 0xd) { + pEVar6->unk_82.HWORD += iVar5 * 2; + } else { + pEVar6->unk_82.HWORD = 0; + } + } + } + if (pEVar6->unk_74.HALF_U.HI >= 0xa1) { + pEVar6->unk_74.WORD -= 0x40000; + } else { + pEVar6->unk_74.HALF_U.HI = 0xa0; + } + + if (pEVar6->unk_78.HALF_U.HI < 0xa0) { + pEVar6->unk_78.WORD += 0x8000; + } else { + sub_080276F4(this, 3, 0); + pEVar6->unk_7d = 0; + if ((super->direction & 0x10) != 0) { + *(u8*)((int)pEVar7 + 0x85) = 1; + *(u8*)((int)pEVar8 + 0x85) = 1; + *(u8*)((int)pEVar6 + 0x85) = 1; + } + super->subAction = 8; + this->unk_7c = 4; + pEVar7->base.subtimer = 0; + pEVar8->base.subtimer = 0; + pEVar6->base.subtimer = 0; + sub_08027B98(this, 0x90, 0xb0, 0x10, 0); + } + sub_08027870(super); +} From 204bc4e9a472b656f5d2900cc9f747c7692f7958 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Jul 2022 06:12:14 +0300 Subject: [PATCH 30/34] Match sub_08026E1C --- asm/enemy/chuchuBoss.s | 142 ----------------------------------------- src/enemy/chuchuBoss.c | 48 +++++++++++++- 2 files changed, 47 insertions(+), 143 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 70db6c1a..ef8a3936 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -9,148 +9,6 @@ - - - - - - - - - - - - - thumb_func_start sub_08026E1C -sub_08026E1C: @ 0x08026E1C - push {r4, r5, r6, r7, lr} - mov r7, r8 - push {r7} - sub sp, #4 - adds r4, r0, #0 - adds r1, r4, #0 - adds r1, #0x7c - ldrb r0, [r1] - adds r6, r0, #0 - cmp r6, #0 - bne _08026EE0 - ldr r0, [r4, #0x54] - ldrb r0, [r0, #0xf] - ldr r1, [r4, #0x50] - ldrb r1, [r1, #0xf] - ldr r2, [r4, #0x68] - adds r0, r0, r1 - ldrb r2, [r2, #0xf] - adds r0, r0, r2 - cmp r0, #0xa - ble _08026EF2 - ldrb r0, [r4, #0x10] - movs r1, #0x80 - mov r8, r1 - movs r7, #0 - mov r1, r8 - orrs r0, r1 - strb r0, [r4, #0x10] - adds r0, r4, #0 - bl sub_08027C54 - adds r5, r4, #0 - adds r5, #0x84 - cmp r0, #0 - beq _08026E72 - ldr r1, [r5] - ldrb r0, [r1, #4] - adds r0, #1 - strb r0, [r1, #4] - ldr r0, [r4, #0x54] - adds r0, #0x45 - movs r1, #0xff - strb r1, [r0] -_08026E72: - ldr r1, [r5] - ldrb r0, [r1, #4] - cmp r0, #3 - bne _08026EA0 - adds r0, r4, #0 - adds r0, #0x45 - strb r6, [r0] - ldrb r0, [r4, #0x10] - movs r1, #0x7f - ands r1, r0 - strb r1, [r4, #0x10] - ldr r3, [r4, #0x54] - ldr r2, [r4, #0x50] - ldr r0, [r4, #0x68] - strb r1, [r0, #0x10] - ldrb r0, [r4, #0x10] - strb r0, [r2, #0x10] - strb r0, [r3, #0x10] - adds r1, r4, #0 - adds r1, #0x3d - movs r0, #0xc4 - strb r0, [r1] - b _08026F14 -_08026EA0: - movs r0, #4 - strb r0, [r1] - ldr r1, [r5] - movs r0, #0x81 - strb r0, [r1, #1] - ldrb r0, [r4, #0x10] - mov r1, r8 - orrs r0, r1 - strb r0, [r4, #0x10] - adds r1, r4, #0 - adds r1, #0x3f - movs r0, #0x7d - strb r0, [r1] - movs r0, #0xb - strb r0, [r4, #0xd] - ldr r0, [r5] - strb r6, [r0, #3] - ldr r0, [r4, #0x54] - movs r1, #0 - bl InitAnimationForceUpdate - str r6, [sp] - adds r0, r4, #0 - movs r1, #0x80 - movs r2, #0x80 - movs r3, #0x80 - bl sub_08027B98 - ldr r1, [r5] - movs r0, #0x21 - strb r0, [r1, #1] - b _08026EF2 -_08026EE0: - subs r0, #1 - movs r2, #0 - strb r0, [r1] - adds r1, r4, #0 - adds r1, #0x84 - ldr r0, [r1] - str r2, [r0, #8] - ldr r0, [r1] - strb r2, [r0, #6] -_08026EF2: - adds r0, r4, #0 - bl sub_08027C54 - cmp r0, #0 - beq _08026F14 - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - ldrb r0, [r0, #4] - cmp r0, #2 - bne _08026F14 - adds r0, r4, #0 - movs r1, #0x3f - bl sub_08027C7C - bl sub_08078B48 -_08026F14: - add sp, #4 - pop {r3} - mov r8, r3 - pop {r4, r5, r6, r7, pc} - thumb_func_start sub_08026F1C sub_08026F1C: @ 0x08026F1C push {r4, r5, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 5908e50a..8b739c98 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -123,7 +123,7 @@ void sub_08027A60(); bool32 sub_08027AA4(ChuchuBossEntity*); void sub_08027B98(); void sub_08027BBC(); -void sub_08027C54(); +bool32 sub_08027C54(); void sub_08027C7C(ChuchuBossEntity*, u32); void sub_08027C9C(); void sub_08027D20(); @@ -1070,3 +1070,49 @@ void sub_08026C40(ChuchuBossEntity* this) { } sub_08027870(super); } + +void sub_08026E1C(ChuchuBossEntity* this) { + u32 uVar2; + Entity* pEVar5; + Entity* pEVar6; + + if (this->unk_7c == 0) { + if (10 < super->child->subtimer + super->parent->subtimer + this->unk_68->base.subtimer) { + COLLISION_ON(super); + if (sub_08027C54(this)) { + this->unk_84->unk_04++; + ; + super->child->health = 0xff; + } + if (this->unk_84->unk_04 == 3) { + super->health = 0; + COLLISION_OFF(super); + pEVar6 = super->child; + pEVar5 = super->parent; + this->unk_68->base.flags = super->flags; + uVar2 = super->flags; + pEVar5->flags = uVar2; + pEVar6->flags = uVar2; + super->iframes = -0x3c; + return; + } + this->unk_84->unk_00 = 4; + this->unk_84->unk_01 = 0x81; + COLLISION_ON(super); + super->hitType = 0x7d; + super->subAction = 11; + this->unk_84->unk_03 = 0; + InitAnimationForceUpdate(super->child, 0); + sub_08027B98(this, 0x80, 0x80, 0x80, 0); + this->unk_84->unk_01 = 0x21; + } + } else { + this->unk_7c--; + this->unk_84->unk_08 = 0; + this->unk_84->unk_06 = 0; + } + if ((sub_08027C54(this)) && this->unk_84->unk_04 == 2) { + sub_08027C7C(this, 0x3f); + sub_08078B48(); + } +} From 2fe066b64ec6f592a3be198f41936637556f1c07 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Jul 2022 08:43:39 +0300 Subject: [PATCH 31/34] Match sub_08026F1C --- asm/enemy/chuchuBoss.s | 69 ------------------------------------------ src/enemy/chuchuBoss.c | 20 ++++++++++++ 2 files changed, 20 insertions(+), 69 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index ef8a3936..b7f4f239 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -8,75 +8,6 @@ - - thumb_func_start sub_08026F1C -sub_08026F1C: @ 0x08026F1C - push {r4, r5, lr} - sub sp, #4 - adds r4, r0, #0 - adds r5, r4, #0 - adds r5, #0x7c - ldrb r1, [r5] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08026F70 - adds r0, r4, #0 - bl sub_080279E8 - cmp r0, #0 - beq _08026F68 - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - movs r2, #0 - strb r2, [r0, #3] - ldrb r1, [r5] - movs r0, #0xf - ands r0, r1 - strb r0, [r5] - str r2, [sp] - adds r0, r4, #0 - movs r1, #0x80 - movs r2, #0x80 - movs r3, #0x80 - bl sub_08027B98 - ldrb r0, [r5] - cmp r0, #2 - bne _08026F68 - adds r0, r4, #0 - movs r1, #0 - bl sub_08027548 -_08026F68: - adds r0, r4, #0 - bl sub_080277F8 - b _08026FA0 -_08026F70: - adds r0, r4, #0 - movs r1, #0xf0 - movs r2, #0x10 - bl sub_080277B8 - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - ldrb r0, [r0, #3] - cmp r0, #0 - beq _08026FA0 - ldrb r0, [r5] - adds r0, #1 - movs r1, #0x80 - orrs r0, r1 - strb r0, [r5] - movs r0, #1 - str r0, [sp] - adds r0, r4, #0 - movs r1, #0xc0 - movs r2, #0xc0 - movs r3, #0x20 - bl sub_08027B98 -_08026FA0: - add sp, #4 - pop {r4, r5, pc} - thumb_func_start sub_08026FA4 sub_08026FA4: @ 0x08026FA4 push {r4, r5, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 8b739c98..347a61b6 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -1116,3 +1116,23 @@ void sub_08026E1C(ChuchuBossEntity* this) { sub_08078B48(); } } + +void sub_08026F1C(ChuchuBossEntity* this) { + if ((this->unk_7c & 0x80) != 0) { + if (sub_080279E8(this) != 0) { + this->unk_84->unk_03 = 0; + this->unk_7c &= 0xf; + sub_08027B98(this, 0x80, 0x80, 0x80, 0); + if (this->unk_7c == 2) { + sub_08027548(this, 0); + } + } + sub_080277F8(this); + } else { + sub_080277B8(this, 0xf0, 0x10); + if (this->unk_84->unk_03 != 0) { + this->unk_7c = (this->unk_7c + 1U) | 0x80; + sub_08027B98(this, 0xc0, 0xc0, 0x20, 1); + } + } +} From 6e077ed02b20d1a74c48a4127b4908c2c22e8255 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Jul 2022 09:02:18 +0300 Subject: [PATCH 32/34] Match sub_08026FA4 --- asm/enemy/chuchuBoss.s | 98 ------------------------------------------ src/enemy/chuchuBoss.c | 57 +++++++++++++++++++----- 2 files changed, 46 insertions(+), 109 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index b7f4f239..b785358e 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -7,104 +7,6 @@ .text - - thumb_func_start sub_08026FA4 -sub_08026FA4: @ 0x08026FA4 - push {r4, r5, lr} - adds r4, r0, #0 - bl sub_08078B48 - ldrb r0, [r4, #0x10] - movs r5, #0x7f - adds r1, r5, #0 - ands r1, r0 - strb r1, [r4, #0x10] - ldr r3, [r4, #0x54] - ldr r2, [r4, #0x50] - ldr r0, [r4, #0x68] - strb r1, [r0, #0x10] - ldrb r0, [r4, #0x10] - strb r0, [r2, #0x10] - strb r0, [r3, #0x10] - adds r3, r4, #0 - adds r3, #0x7c - ldrb r0, [r3] - cmp r0, #0 - beq _08026FD2 - movs r0, #1 - strb r0, [r3] -_08026FD2: - ldr r2, [r4, #0x54] - adds r0, r2, #0 - adds r0, #0x7a - ldrh r0, [r0] - cmp r0, #0x97 - bhi _08026FFE - movs r1, #0x80 - lsls r1, r1, #9 - ldrb r0, [r3] - lsls r1, r0 - ldr r0, [r2, #0x78] - adds r0, r0, r1 - str r0, [r2, #0x78] - ldr r2, [r4, #0x54] - movs r1, #0x80 - lsls r1, r1, #0xa - ldrb r3, [r3] - lsls r1, r3 - ldr r0, [r2, #0x74] - subs r0, r0, r1 - str r0, [r2, #0x74] - b _0802705C -_08026FFE: - movs r0, #7 - strb r0, [r4, #0xd] - ldrb r1, [r2, #0x10] - adds r0, r5, #0 - ands r0, r1 - strb r0, [r2, #0x10] - adds r0, r4, #0 - adds r0, #0x84 - ldr r1, [r0] - movs r0, #0 - strb r0, [r1, #3] - adds r1, r4, #0 - adds r1, #0x7d - movs r0, #0x2d - strb r0, [r1] - ldr r0, _08027044 @ =0x00000155 - bl SoundReq - ldrb r1, [r4, #0x15] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08027048 - ldr r1, [r4, #0x54] - adds r0, r1, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #8 - beq _0802705C - adds r0, r1, #0 - movs r1, #8 - bl InitAnimationForceUpdate - b _0802705C - .align 2, 0 -_08027044: .4byte 0x00000155 -_08027048: - ldr r1, [r4, #0x54] - adds r0, r1, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #7 - beq _0802705C - adds r0, r1, #0 - movs r1, #7 - bl InitAnimationForceUpdate -_0802705C: - adds r0, r4, #0 - bl sub_08027870 - pop {r4, r5, pc} - thumb_func_start sub_08027064 sub_08027064: @ 0x08027064 push {r4, r5, r6, r7, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 347a61b6..cb57a477 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -457,9 +457,7 @@ void sub_08026090(ChuchuBossEntity* this) { void sub_08026110(ChuchuBossEntity* this) { s32 uVar2; - int iVar4; s32 uVar3; - Hitbox* pHVar8; gUnk_080CC1DC[super->subAction](this); if ((this->unk_84->unk_08 == 0) && ((u8)this->unk_84->unk_05 != 0)) { @@ -583,7 +581,6 @@ void sub_08026358(ChuchuBossEntity* this) { } void sub_080263B4(ChuchuBossEntity* this) { - u32 bVar2; u32 bVar3; if (this->unk_7d-- == 0) { @@ -844,7 +841,7 @@ void sub_08026968(ChuchuBossEntity* this) { pEVar7 = (ChuchuBossEntity*)super->child; pEVar8 = this->unk_68; pEVar6 = (ChuchuBossEntity*)super->parent; - if ((super->direction & 0x10) != 0) { + if (DirectionIsVertical(super->direction)) { sVar5 = 0x100; } else { sVar5 = -0x100; @@ -872,7 +869,7 @@ void sub_080269CC(ChuchuBossEntity* this) { pEVar7 = (ChuchuBossEntity*)super->child; pEVar2 = this->unk_68; pEVar4 = (ChuchuBossEntity*)super->parent; - if ((super->direction & 0x10) != 0) { + if (DirectionIsVertical(super->direction)) { sVar1 = -0x300; } else { sVar1 = 0x300; @@ -892,7 +889,7 @@ void sub_080269CC(ChuchuBossEntity* this) { } temp2 = pEVar7->unk_82.HALF.HI + 0x40; if ((u32)(temp2 - 0x20) > 0x40) { - if ((super->direction & 0x10) != 0) { + if (DirectionIsVertical(super->direction)) { if (pEVar7->base.animIndex != 6) { InitAnimationForceUpdate(&pEVar7->base, 6); } @@ -927,7 +924,7 @@ void sub_080269CC(ChuchuBossEntity* this) { entity->base.spritePriority.b0 = 0; entity->base.spriteRendering.b3 = pEVar7->base.spriteRendering.b3; entity->base.spriteOrientation.flipY = pEVar7->base.spriteOrientation.flipY; - if ((super->direction & 0x10) != 0) { + if (DirectionIsVertical(super->direction)) { entity->base.x.HALF.HI -= 0x38; } else { entity->base.x.HALF.HI += 0x38; @@ -1001,7 +998,7 @@ void sub_08026C40(ChuchuBossEntity* this) { pEVar6->unk_78.WORD -= 0x10000; return; } - if ((super->direction & 0x10) != 0) { + if (DirectionIsVertical(super->direction)) { if (pEVar6->base.animIndex != 8) { InitAnimationForceUpdate(&pEVar6->base, 8); } @@ -1012,13 +1009,13 @@ void sub_08026C40(ChuchuBossEntity* this) { } } if (this->unk_7c == 0) { - if ((super->direction & 0x10) != 0) { + if (DirectionIsVertical(super->direction)) { iVar5 = 0x300; } else { iVar5 = -0x300; } } else { - if ((super->direction & 0x10) != 0) { + if (DirectionIsVertical(super->direction)) { iVar5 = 0x480; } else { iVar5 = -0x480; @@ -1056,7 +1053,7 @@ void sub_08026C40(ChuchuBossEntity* this) { } else { sub_080276F4(this, 3, 0); pEVar6->unk_7d = 0; - if ((super->direction & 0x10) != 0) { + if (DirectionIsVertical(super->direction)) { *(u8*)((int)pEVar7 + 0x85) = 1; *(u8*)((int)pEVar8 + 0x85) = 1; *(u8*)((int)pEVar6 + 0x85) = 1; @@ -1136,3 +1133,41 @@ void sub_08026F1C(ChuchuBossEntity* this) { } } } + +void sub_08026FA4(ChuchuBossEntity* this) { + u32 uVar1; + ChuchuBossEntity* pEVar3; + ChuchuBossEntity* pEVar4; + + sub_08078B48(); + COLLISION_OFF(super); + pEVar4 = (ChuchuBossEntity*)super->child; + pEVar3 = (ChuchuBossEntity*)super->parent; + this->unk_68->base.flags = super->flags; + uVar1 = super->flags; + pEVar3->base.flags = uVar1; + pEVar4->base.flags = uVar1; + if (this->unk_7c != 0) { + this->unk_7c = 1; + } + if (((ChuchuBossEntity*)super->child)->unk_78.HALF_U.HI < 0x98) { + ((ChuchuBossEntity*)super->child)->unk_78.WORD += (0x10000 << this->unk_7c); + ((ChuchuBossEntity*)super->child)->unk_74.WORD -= (0x20000 << this->unk_7c); + } else { + super->subAction = 7; + COLLISION_OFF(super->child); + this->unk_84->unk_03 = 0; + this->unk_7d = 0x2d; + SoundReq(SFX_155); + if (DirectionIsVertical(super->direction)) { + if (super->child->animIndex != 8) { + InitAnimationForceUpdate(super->child, 8); + } + } else { + if (super->child->animIndex != 7) { + InitAnimationForceUpdate(super->child, 7); + } + } + } + sub_08027870(super); +} From 09f4a3267a7e96e09ab81a7cd8c6c6c2628ed3be Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Jul 2022 09:37:49 +0300 Subject: [PATCH 33/34] Match sub_08027064 --- asm/enemy/chuchuBoss.s | 225 ----------------------------------------- src/enemy/chuchuBoss.c | 84 ++++++++++++++- 2 files changed, 83 insertions(+), 226 deletions(-) diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index b785358e..cbe2102c 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -7,231 +7,6 @@ .text - thumb_func_start sub_08027064 -sub_08027064: @ 0x08027064 - push {r4, r5, r6, r7, lr} - mov r7, sb - mov r6, r8 - push {r6, r7} - adds r5, r0, #0 - ldr r6, [r5, #0x54] - ldr r0, [r5, #0x68] - mov sb, r0 - ldr r1, [r5, #0x50] - mov r8, r1 - movs r0, #0x60 - strh r0, [r5, #0x24] - adds r0, r6, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r0, #0xa - beq _08027098 - ldr r0, _080270C8 @ =gRoomTransition - ldr r0, [r0] - movs r1, #0xf - ands r0, r1 - cmp r0, #0 - bne _08027098 - movs r0, #0x7c - bl SoundReq -_08027098: - adds r0, r5, #0 - adds r0, #0x84 - ldr r3, [r0] - ldrb r1, [r3, #3] - adds r7, r0, #0 - cmp r1, #0 - beq _080270E0 - ldr r0, _080270CC @ =gPlayerEntity - movs r2, #0x32 - ldrsh r4, [r5, r2] - movs r1, #0x32 - ldrsh r2, [r0, r1] - cmp r4, r2 - beq _080270E0 - ldr r0, _080270C8 @ =gRoomTransition - ldr r1, [r0] - movs r0, #0xf - ands r1, r0 - cmp r1, #0 - bne _080270D4 - cmp r4, r2 - ble _080270D0 - strb r1, [r3, #0xc] - b _080270D4 - .align 2, 0 -_080270C8: .4byte gRoomTransition -_080270CC: .4byte gPlayerEntity -_080270D0: - movs r0, #0x10 - strb r0, [r3, #0xc] -_080270D4: - ldr r0, [r7] - ldrb r0, [r0, #0xc] - strb r0, [r5, #0x15] - adds r0, r5, #0 - bl ProcessMovement0 -_080270E0: - adds r0, r6, #0 - adds r0, #0x85 - ldrb r0, [r0] - cmp r0, #1 - bne _080270FC - adds r0, r6, #0 - adds r0, #0x83 - ldrb r0, [r0] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - cmp r0, #0 - bgt _0802710E - movs r0, #0x18 - b _08027110 -_080270FC: - adds r0, r6, #0 - adds r0, #0x83 - ldrb r0, [r0] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - cmp r0, #0 - bge _0802710E - movs r0, #0x18 - b _08027110 -_0802710E: - movs r0, #8 -_08027110: - strb r0, [r5, #0x15] - ldr r1, [r7] - ldrb r0, [r1, #3] - cmp r0, #0 - bne _08027152 - movs r2, #0x2e - ldrsh r0, [r5, r2] - ldrh r1, [r1, #0xe] - cmp r0, r1 - bne _0802714A - mov r0, r8 - adds r0, #0x84 - movs r1, #1 - strb r1, [r0] - mov r0, sb - adds r0, #0x84 - strb r1, [r0] - adds r0, r6, #0 - adds r0, #0x84 - strb r1, [r0] - adds r1, r5, #0 - adds r1, #0x7c - movs r0, #0x1e - strb r0, [r1] - ldr r1, [r7] - ldrb r0, [r1, #3] - adds r0, #1 - strb r0, [r1, #3] - b _080271FE -_0802714A: - adds r0, r5, #0 - bl ProcessMovement0 - b _080271FE -_08027152: - adds r0, r6, #0 - adds r0, #0x7d - ldrb r0, [r0] - cmp r0, #0 - beq _080271E6 - mov r0, sb - adds r0, #0x7d - ldrb r0, [r0] - cmp r0, #0 - beq _080271E6 - mov r0, r8 - adds r0, #0x7d - ldrb r0, [r0] - cmp r0, #0 - beq _080271E6 - adds r1, r5, #0 - adds r1, #0x7c - ldrb r0, [r1] - subs r0, #1 - strb r0, [r1] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xff - bne _080271FE - mov r0, r8 - adds r0, #0x84 - movs r1, #1 - strb r1, [r0] - mov r0, sb - adds r0, #0x84 - strb r1, [r0] - adds r0, r6, #0 - adds r0, #0x84 - strb r1, [r0] - movs r3, #0 - ldr r0, [r7] - ldrb r0, [r0, #3] - cmp r0, #1 - bls _080271B2 - ldr r0, _080271DC @ =gPlayerEntity - movs r2, #0x2e - ldrsh r1, [r5, r2] - movs r2, #0x2e - ldrsh r0, [r0, r2] - movs r3, #8 - cmp r1, r0 - ble _080271B2 - movs r3, #0x18 -_080271B2: - ldr r2, [r7] - ldrb r1, [r2, #3] - cmp r1, #5 - beq _080271C0 - ldrb r0, [r5, #0x15] - cmp r0, r3 - bne _080271E0 -_080271C0: - movs r4, #0 - movs r0, #6 - strb r0, [r5, #0xd] - adds r0, r5, #0 - movs r1, #7 - movs r2, #1 - bl sub_080276F4 - ldr r0, [r7] - strb r4, [r0, #3] - adds r1, r5, #0 - adds r1, #0x7d - movs r0, #0xf - b _080271FC - .align 2, 0 -_080271DC: .4byte gPlayerEntity -_080271E0: - adds r0, r1, #1 - strb r0, [r2, #3] - b _080271FE -_080271E6: - ldr r0, [r7] - ldrb r0, [r0, #3] - cmp r0, #4 - beq _080271F6 - adds r1, r5, #0 - adds r1, #0x7c - movs r0, #0x1e - b _080271FC -_080271F6: - adds r1, r5, #0 - adds r1, #0x7c - movs r0, #0x3c -_080271FC: - strb r0, [r1] -_080271FE: - adds r0, r5, #0 - bl sub_08027870 - pop {r3, r4} - mov r8, r3 - mov sb, r4 - pop {r4, r5, r6, r7, pc} - thumb_func_start sub_0802720C sub_0802720C: @ 0x0802720C push {r4, lr} diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index cb57a477..4350ae9c 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -20,7 +20,8 @@ typedef struct { u8 unk_06; u8 unk_07; u32 unk_08; - u16 unk_0c; + u8 unk_0c; + u8 unk_0d; u16 unk_0e; } Helper; @@ -1171,3 +1172,84 @@ void sub_08026FA4(ChuchuBossEntity* this) { } sub_08027870(super); } + +void sub_08027064(ChuchuBossEntity* this) { + u32 uVar2; + ChuchuBossEntity* pEVar5; + ChuchuBossEntity* pEVar7; + ChuchuBossEntity* pEVar10; + + pEVar10 = (ChuchuBossEntity*)super->child; + pEVar5 = this->unk_68; + pEVar7 = (ChuchuBossEntity*)super->parent; + super->speed = 0x60; + if (pEVar10->base.animIndex != 10 && ((gRoomTransition.frameCount & 0xf) == 0)) { + SoundReq(SFX_PLY_JUMP); + } + if (this->unk_84->unk_03 != 0) { + if (super->y.HALF.HI != gPlayerEntity.y.HALF.HI) { + if ((gRoomTransition.frameCount & 0xf) == 0) { + if (super->y.HALF.HI > gPlayerEntity.y.HALF.HI) { + this->unk_84->unk_0c = 0; + } else { + this->unk_84->unk_0c = 0x10; + } + } + super->direction = this->unk_84->unk_0c; + ProcessMovement0(super); + } + } + if (*(char*)((int)pEVar10 + 0x85) == 1) { + if ((s8)pEVar10->unk_82.HALF.HI < 1) { + super->direction = 24; + } else { + super->direction = 8; + } + } else { + if ((s8)pEVar10->unk_82.HALF.HI <= -1) { + super->direction = 24; + } else { + super->direction = 8; + } + } + if (this->unk_84->unk_03 == 0) { + if (super->x.HALF.HI == this->unk_84->unk_0e) { + *(char*)((int)pEVar7 + 0x84) = 1; + *(char*)((int)pEVar5 + 0x84) = 1; + *(char*)((int)pEVar10 + 0x84) = 1; + this->unk_7c = 0x1e; + this->unk_84->unk_03++; + } else { + ProcessMovement0(super); + } + } else if (pEVar10->unk_7d != 0 && pEVar5->unk_7d != 0 && pEVar7->unk_7d != 0) { + if (this->unk_7c-- == 0) { + *(char*)((int)pEVar7 + 0x84) = 1; + *(char*)((int)pEVar5 + 0x84) = 1; + *(char*)((int)pEVar10 + 0x84) = 1; + uVar2 = 0; + if (this->unk_84->unk_03 > 1) { + if (super->x.HALF.HI > gPlayerEntity.x.HALF.HI) { + uVar2 = 24; + } else { + uVar2 = 8; + } + } + if (this->unk_84->unk_03 == 5 || super->direction == uVar2) { + super->subAction = 6; + sub_080276F4(this, 7, 1); + this->unk_84->unk_03 = 0; + this->unk_7d = 0xf; + } else { + this->unk_84->unk_03++; + } + } + } else { + if (this->unk_84->unk_03 != 4) { + this->unk_7c = 0x1e; + } else { + this->unk_7c = 0x3c; + } + } + sub_08027870(super); +} From 896d39bdbbf34b02770cae3bbcdfcf7db960070d Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Jul 2022 10:05:18 +0300 Subject: [PATCH 34/34] Match ChuchuBoss_OnDeath --- .../chuchuBoss/ChuchuBoss_OnDeath.inc | 120 ------------------ src/enemy/chuchuBoss.c | 21 ++- 2 files changed, 14 insertions(+), 127 deletions(-) delete mode 100644 asm/non_matching/chuchuBoss/ChuchuBoss_OnDeath.inc diff --git a/asm/non_matching/chuchuBoss/ChuchuBoss_OnDeath.inc b/asm/non_matching/chuchuBoss/ChuchuBoss_OnDeath.inc deleted file mode 100644 index 236841ec..00000000 --- a/asm/non_matching/chuchuBoss/ChuchuBoss_OnDeath.inc +++ /dev/null @@ -1,120 +0,0 @@ - .syntax unified - push {r4, r5, lr} - adds r4, r0, #0 - bl sub_08078B48 - ldrb r3, [r4, #0xa] - cmp r3, #0 - bne _08025DA4 - ldrb r0, [r4, #0xd] - cmp r0, #0xc - beq _08025CFE - movs r0, #0xc - strb r0, [r4, #0xd] - adds r0, r4, #0 - adds r0, #0x84 - ldr r0, [r0] - strb r3, [r0, #3] - ldr r0, [r4, #0x54] - movs r1, #9 - bl InitAnimationForceUpdate - b _08025D9C -_08025CFE: - adds r5, r4, #0 - adds r5, #0x84 - ldr r0, [r5] - ldrb r0, [r0, #3] - cmp r0, #0 - beq _08025D10 - cmp r0, #1 - beq _08025D28 - b _08025D9C -_08025D10: - adds r0, r4, #0 - movs r1, #0x3f - bl sub_08027C7C - ldr r0, [r5] - movs r1, #1 - strb r1, [r0, #3] - adds r1, r4, #0 - adds r1, #0x7d - movs r0, #0x78 - strb r0, [r1] - b _08025D9C -_08025D28: - adds r2, r4, #0 - adds r2, #0x7d - ldrb r0, [r2] - subs r1, r0, #1 - strb r1, [r2] - lsls r0, r1, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xff - bne _08025D84 - ldr r1, [r4, #0x54] - adds r1, #0x6d - ldrb r0, [r1] - movs r2, #2 - orrs r0, r2 - strb r0, [r1] - ldr r1, [r4, #0x68] - adds r1, #0x6d - ldrb r0, [r1] - orrs r0, r2 - strb r0, [r1] - ldr r1, [r4, #0x50] - adds r1, #0x6d - ldrb r0, [r1] - orrs r0, r2 - strb r0, [r1] - ldr r2, [r4, #0x54] - ldr r1, [r4, #0x50] - ldr r0, [r4, #0x68] - adds r0, #0x45 - strb r3, [r0] - adds r1, #0x45 - strb r3, [r1] - adds r2, #0x45 - strb r3, [r2] - ldr r0, _08025D80 @ =gPauseMenuOptions - strb r3, [r0] - movs r0, #0x94 - lsls r0, r0, #1 - bl SoundReq - adds r0, r4, #0 - bl GenericDeath - b _08025D9C - .align 2, 0 -_08025D80: .4byte gPauseMenuOptions -_08025D84: - lsls r0, r1, #0x18 - lsrs r0, r0, #0x18 - movs r1, #0x3f - cmp r0, #0x50 - bhi _08025D96 - movs r1, #0xf - cmp r0, #0x1e - bls _08025D96 - movs r1, #0x1f -_08025D96: - adds r0, r4, #0 - bl sub_08027C7C -_08025D9C: - adds r0, r4, #0 - bl sub_08027870 - b _08025DBC -_08025DA4: - adds r2, r4, #0 - adds r2, #0x6d - ldrb r1, [r2] - movs r0, #2 - ands r0, r1 - cmp r0, #0 - beq _08025DBC - movs r0, #2 - orrs r0, r1 - strb r0, [r2] - bl DeleteThisEntity -_08025DBC: - pop {r4, r5, pc} - .align 2, 0 - .syntax divided diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 4350ae9c..fe228005 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -260,11 +260,14 @@ void ChuchuBoss_OnKnockback(ChuchuBossEntity* this) { } } -NONMATCH("asm/non_matching/chuchuBoss/ChuchuBoss_OnDeath.inc", void ChuchuBoss_OnDeath(ChuchuBossEntity* this)) { +void ChuchuBoss_OnDeath(ChuchuBossEntity* this) { + Entity* child; + Entity* parent; + sub_08078B48(); if (super->type == 0) { - if (super->subAction != 0xC) { - super->subAction = 0xC; + if (super->subAction != 12) { + super->subAction = 12; this->unk_84->unk_03 = 0; InitAnimationForceUpdate(super->child, 9); } else { @@ -279,19 +282,24 @@ NONMATCH("asm/non_matching/chuchuBoss/ChuchuBoss_OnDeath.inc", void ChuchuBoss_O ((GenericEntity*)super->child)->field_0x6c.HALF.HI |= 2; this->unk_68->unk_6d.unk1 = 1; ((GenericEntity*)super->parent)->field_0x6c.HALF.HI |= 2; - super->child->health = 0; + parent = super->child; + child = super->parent; this->unk_68->base.health = 0; - super->parent->health = 0; + child->health = 0; + parent->health = 0; gPauseMenuOptions.disabled = 0; SoundReq(SFX_BOSS_DIE); GenericDeath(super); } else { + bool32 b = this->unk_7d <= 0x50; u32 tmp = 0x3F; if (this->unk_7d <= 0x50) { - tmp = 0xF; if (this->unk_7d > 0x1E) { tmp = 0x1F; + } else { + tmp = 0xF; } + } else { } sub_08027C7C(this, tmp); } @@ -308,7 +316,6 @@ NONMATCH("asm/non_matching/chuchuBoss/ChuchuBoss_OnDeath.inc", void ChuchuBoss_O } } } -END_NONMATCH void ChuchuBoss_OnTick(ChuchuBossEntity* this) { gUnk_080CC1B0[super->action](this);