summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-07-19 02:29:25 +0300
committerTal Hayon <talhayon1@gmail.com>2022-07-19 02:29:25 +0300
commit49ebdffa11767f2f9b16a8545be9ce2fc22e99d3 (patch)
tree5a27fa9e504fc879287c44f3e76b08b65bd131f3
parentd88ce744863fff731401857745469759fc00b93f (diff)
Match sub_08027870
-rw-r--r--asm/enemy/chuchuBoss.s145
-rw-r--r--include/functions.h1
-rw-r--r--src/enemy/chuchuBoss.c81
3 files changed, 68 insertions, 159 deletions
diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s
index bae3f1c2..5bd91cf9 100644
--- a/asm/enemy/chuchuBoss.s
+++ b/asm/enemy/chuchuBoss.s
@@ -10,151 +10,6 @@
- thumb_func_start sub_08027870
-sub_08027870: @ 0x08027870
- push {r4, r5, r6, r7, lr}
- adds r7, r0, #0
- ldr r4, [r7, #0x54]
- ldr r5, [r7, #0x68]
- ldr r6, [r7, #0x50]
- ldr r0, [r4, #0x74]
- str r0, [r6, #0x74]
- ldr r0, [r4, #0x78]
- str r0, [r6, #0x78]
- ldr r0, [r4, #0x74]
- str r0, [r5, #0x74]
- ldr r0, [r4, #0x78]
- str r0, [r5, #0x78]
- adds r0, r4, #0
- adds r0, #0x83
- ldrb r0, [r0]
- rsbs r0, r0, #0
- adds r1, r4, #0
- adds r1, #0x7f
- strb r0, [r1]
- adds r0, r5, #0
- adds r0, #0x83
- ldrb r0, [r0]
- rsbs r0, r0, #0
- adds r1, r5, #0
- adds r1, #0x7f
- strb r0, [r1]
- adds r0, r6, #0
- adds r0, #0x83
- ldrb r0, [r0]
- rsbs r0, r0, #0
- adds r1, r6, #0
- adds r1, #0x7f
- strb r0, [r1]
- adds r1, r5, #0
- adds r1, #0x7a
- ldrh r0, [r1]
- cmp r0, #0xa0
- bls _080278C2
- movs r0, #0xe
- b _080278CC
-_080278C2:
- ldrh r1, [r1]
- movs r0, #0xa0
- subs r0, r0, r1
- asrs r0, r0, #3
- adds r0, #0xe
-_080278CC:
- strb r0, [r5, #0xe]
- adds r1, r6, #0
- adds r1, #0x7a
- ldrh r0, [r1]
- cmp r0, #0xa0
- bls _080278EA
- adds r2, r4, #0
- adds r2, #0x7a
- ldrh r1, [r2]
- subs r1, #0xa0
- asrs r1, r1, #4
- movs r0, #0x12
- subs r0, r0, r1
- strb r0, [r6, #0xe]
- b _080278FA
-_080278EA:
- ldrh r1, [r1]
- movs r0, #0xa0
- subs r0, r0, r1
- asrs r0, r0, #2
- adds r0, #0x12
- strb r0, [r6, #0xe]
- adds r2, r4, #0
- adds r2, #0x7a
-_080278FA:
- adds r0, r2, #0
- ldrh r1, [r0]
- cmp r1, #0xa0
- bls _0802791A
- adds r0, r1, #0
- subs r0, #0xa0
- asrs r0, r0, #2
- movs r1, #0xe
- subs r1, r1, r0
- strb r1, [r4, #0xe]
- movs r0, #0x80
- ands r1, r0
- cmp r1, #0
- beq _08027934
- movs r0, #0
- b _08027932
-_0802791A:
- cmp r1, #0x7f
- bhi _08027928
- ldrh r1, [r0]
- movs r0, #0xa0
- subs r0, r0, r1
- asrs r0, r0, #2
- b _08027930
-_08027928:
- ldrh r1, [r2]
- movs r0, #0xa0
- subs r0, r0, r1
- asrs r0, r0, #1
-_08027930:
- adds r0, #0xe
-_08027932:
- strb r0, [r4, #0xe]
-_08027934:
- ldr r0, [r7, #0x2c]
- str r0, [r5, #0x2c]
- ldr r0, [r7, #0x30]
- str r0, [r5, #0x30]
- ldrb r1, [r5, #0xe]
- lsls r1, r1, #8
- adds r0, r5, #0
- adds r0, #0x83
- ldrb r2, [r0]
- adds r0, r5, #0
- bl LinearMoveAngle
- ldr r0, [r5, #0x2c]
- str r0, [r6, #0x2c]
- ldr r0, [r5, #0x30]
- str r0, [r6, #0x30]
- ldrb r1, [r6, #0xe]
- lsls r1, r1, #8
- adds r0, r6, #0
- adds r0, #0x83
- ldrb r2, [r0]
- adds r0, r6, #0
- bl LinearMoveAngle
- ldr r0, [r6, #0x2c]
- str r0, [r4, #0x2c]
- ldr r0, [r6, #0x30]
- str r0, [r4, #0x30]
- ldrb r1, [r4, #0xe]
- lsls r1, r1, #8
- adds r0, r4, #0
- adds r0, #0x83
- ldrb r2, [r0]
- adds r0, r4, #0
- bl LinearMoveAngle
- adds r0, r7, #0
- bl sub_08027984
- pop {r4, r5, r6, r7, pc}
thumb_func_start sub_08027984
sub_08027984: @ 0x08027984
diff --git a/include/functions.h b/include/functions.h
index 18cc67e7..11de5285 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -78,7 +78,6 @@ extern u32 sub_0801766C(Entity*);
extern void sub_0801AFE4(void);
extern void UpdateUIElements(void);
extern void sub_0801E104(void);
-extern void sub_08027870(Entity*);
extern void sub_08030118(u32);
extern void sub_0803C0AC(Entity*);
extern void sub_08049CF4(Entity*);
diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c
index 04c38521..9e138ff5 100644
--- a/src/enemy/chuchuBoss.c
+++ b/src/enemy/chuchuBoss.c
@@ -122,7 +122,7 @@ void sub_0802757C();
void sub_080276F4();
void sub_080277B8();
void sub_080277F8();
-void sub_08027870();
+void sub_08027870(ChuchuBossEntity*);
void sub_08027984();
void sub_080279AC();
bool32 sub_080279E8(ChuchuBossEntity*);
@@ -262,7 +262,7 @@ void ChuchuBoss(Entity* this) {
void ChuchuBoss_OnKnockback(ChuchuBossEntity* this) {
GenericKnockback(super);
if (super->type == 0) {
- sub_08027870(super);
+ sub_08027870(this);
}
}
@@ -314,7 +314,7 @@ void ChuchuBoss_OnDeath(ChuchuBossEntity* this) {
break;
}
}
- sub_08027870(super);
+ sub_08027870(this);
} else {
if (this->unk_6d.unk1) {
this->unk_6d.unk1 = 1;
@@ -656,7 +656,7 @@ void sub_0802650C(ChuchuBossEntity* this) {
this->unk_84->unk_03++;
gRoomControls.camera_target = &gPlayerEntity;
}
- sub_08027870(super);
+ sub_08027870(this);
}
void sub_0802653C(ChuchuBossEntity* this) {
@@ -697,7 +697,7 @@ void sub_08026580(ChuchuBossEntity* this) {
}
}
}
- sub_08027870(super);
+ sub_08027870(this);
}
}
@@ -747,7 +747,7 @@ void sub_08026634(ChuchuBossEntity* this) {
this->unk_7d--;
}
}
- sub_08027870(super);
+ sub_08027870(this);
}
void sub_08026750(ChuchuBossEntity* this) {
@@ -811,7 +811,7 @@ void sub_0802686C(ChuchuBossEntity* this) {
super->subAction = 5;
this->unk_84->unk_03 = 0;
sub_08027B98(this, 0x80, 0x80, 0x80, 0);
- sub_08027870(super);
+ sub_08027870(this);
InitAnimationForceUpdate(super->child, 3);
SoundReq(SFX_1A1);
}
@@ -864,7 +864,7 @@ void sub_08026968(ChuchuBossEntity* this) {
pEVar6->unk_82.HWORD += sVar5;
pEVar7->unk_82.HWORD += sVar5;
}
- sub_08027870(super);
+ sub_08027870(this);
}
void sub_080269CC(ChuchuBossEntity* this) {
@@ -970,7 +970,7 @@ void sub_080269CC(ChuchuBossEntity* this) {
pEVar7->unk_74.WORD += 0x40000;
pEVar7->unk_78.WORD -= 0x8000;
}
- sub_08027870(super);
+ sub_08027870(this);
}
void sub_08026BE8(ChuchuBossEntity* this) {
@@ -988,7 +988,7 @@ void sub_08026BE8(ChuchuBossEntity* this) {
} else {
this->unk_7c--;
}
- sub_08027870(super);
+ sub_08027870(this);
}
void sub_08026C40(ChuchuBossEntity* this) {
@@ -1079,7 +1079,7 @@ void sub_08026C40(ChuchuBossEntity* this) {
pEVar6->base.subtimer = 0;
sub_08027B98(this, 0x90, 0xb0, 0x10, 0);
}
- sub_08027870(super);
+ sub_08027870(this);
}
void sub_08026E1C(ChuchuBossEntity* this) {
@@ -1183,7 +1183,7 @@ void sub_08026FA4(ChuchuBossEntity* this) {
}
}
}
- sub_08027870(super);
+ sub_08027870(this);
}
void sub_08027064(ChuchuBossEntity* this) {
@@ -1264,7 +1264,7 @@ void sub_08027064(ChuchuBossEntity* this) {
this->unk_7c = 0x3c;
}
}
- sub_08027870(super);
+ sub_08027870(this);
}
void sub_0802720C(ChuchuBossEntity* this) {
@@ -1566,3 +1566,58 @@ void sub_080277F8(ChuchuBossEntity* this) {
pEVar5->unk_78.WORD = pEVar3->unk_78.WORD;
sub_08027984(this);
}
+
+void sub_08027870(ChuchuBossEntity* this) {
+ u32 cVar1;
+ u32 uVar2;
+ u32 uVar3;
+ ChuchuBossEntity* pEVar5;
+ ChuchuBossEntity* pEVar7;
+ ChuchuBossEntity* pEVar6;
+
+ pEVar5 = (ChuchuBossEntity*)super->child;
+ pEVar7 = this->unk_68;
+ pEVar6 = (ChuchuBossEntity*)super->parent;
+ pEVar6->unk_74.WORD = pEVar5->unk_74.WORD;
+ pEVar6->unk_78.WORD = pEVar5->unk_78.WORD;
+ pEVar7->unk_74.WORD = pEVar5->unk_74.WORD;
+ pEVar7->unk_78.WORD = pEVar5->unk_78.WORD;
+ pEVar5->unk_7e.HALF.HI = -pEVar5->unk_82.HALF.HI;
+ pEVar7->unk_7e.HALF.HI = -pEVar7->unk_82.HALF.HI;
+ pEVar6->unk_7e.HALF.HI = -pEVar6->unk_82.HALF.HI;
+ if (pEVar7->unk_78.HALF_U.HI >= 0xa1) {
+ uVar2 = 14;
+ } else {
+ uVar2 = ((0xa0 - pEVar7->unk_78.HALF_U.HI) >> 3) + 14;
+ }
+ pEVar7->base.timer = uVar2;
+ if (pEVar6->unk_78.HALF_U.HI >= 0xa1) {
+ pEVar6->base.timer = 18 - ((pEVar5->unk_78.HALF_U.HI - 0xa0) >> 4);
+ } else {
+ pEVar6->base.timer = ((0xa0 - pEVar6->unk_78.HALF_U.HI) >> 2) + 18;
+ }
+ if (pEVar5->unk_78.HALF_U.HI >= 0xa1) {
+ uVar3 = 0xe - ((pEVar5->unk_78.HALF_U.HI - 0xa0) >> 2);
+ pEVar5->base.timer = uVar3;
+ if ((uVar3 & 0x80) != 0) {
+ pEVar5->base.timer = 0;
+ }
+ } else {
+ if (pEVar5->unk_78.HALF_U.HI < 0x80) {
+ cVar1 = ((0xa0 - pEVar5->unk_78.HALF_U.HI) >> 2);
+ } else {
+ cVar1 = ((0xa0 - pEVar5->unk_78.HALF_U.HI) >> 1);
+ }
+ pEVar5->base.timer = cVar1 + 14;
+ }
+ pEVar7->base.x.WORD = super->x.WORD;
+ pEVar7->base.y.WORD = super->y.WORD;
+ LinearMoveAngle(&pEVar7->base, pEVar7->base.timer << 8, pEVar7->unk_82.HALF.HI);
+ pEVar6->base.x.WORD = pEVar7->base.x.WORD;
+ pEVar6->base.y.WORD = pEVar7->base.y.WORD;
+ LinearMoveAngle(&pEVar6->base, pEVar6->base.timer << 8, pEVar6->unk_82.HALF.HI);
+ pEVar5->base.x.WORD = pEVar6->base.x.WORD;
+ pEVar5->base.y.WORD = pEVar6->base.y.WORD;
+ LinearMoveAngle(&pEVar5->base, pEVar5->base.timer << 8, pEVar5->unk_82.HALF.HI);
+ sub_08027984(this);
+}