Merge pull request #534 from hatal175/chuchuboss

This commit is contained in:
notyourav 2022-07-22 10:46:10 -07:00 committed by GitHub
commit 4d8d671769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 618 additions and 1590 deletions

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -317,7 +317,6 @@ SECTIONS {
src/enemy/pesto.o(.text);
src/enemy/puffstool.o(.text);
src/enemy/chuchuBoss.o(.text);
asm/enemy/chuchuBoss.o(.text);
src/enemy/likeLike.o(.text);
src/enemy/spearMoblin.o(.text);
src/enemy/businessScrub.o(.text);

View File

@ -41,7 +41,7 @@ typedef struct _ChuchuBossEntity {
union SplitWord unk_78;
u8 unk_7c;
u8 unk_7d;
u16 unk_7e;
union SplitHWord unk_7e;
u8 unk_80;
u8 unk_81;
union SplitHWord unk_82;
@ -63,9 +63,15 @@ extern void (*const gUnk_080CC258[])(ChuchuBossEntity*);
extern void (*const gUnk_080CC264[])(ChuchuBossEntity*);
extern void (*const gUnk_080CC26C[])(ChuchuBossEntity*);
extern const u8 gUnk_080CC278[];
extern const u16 gUnk_080CC27C[];
extern const u16 gUnk_080CC29C[];
extern const u16 gUnk_080CC2BC[];
typedef struct {
u16 unk0;
u8 unk2;
} ChuchuStruct;
extern const ChuchuStruct gUnk_080CC27C[];
extern const ChuchuStruct gUnk_080CC29C[];
extern const ChuchuStruct gUnk_080CC2BC[];
extern const s8 gUnk_080CC2DC[];
extern Hitbox gUnk_080FD238;
@ -116,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*);
@ -127,7 +133,7 @@ void sub_08027BBC();
bool32 sub_08027C54();
void sub_08027C7C(ChuchuBossEntity*, u32);
void sub_08027C9C();
void sub_08027D20();
Entity* sub_08027D20(ChuchuBossEntity*);
// clang-format off
void (*const ChuchuBoss_Functions[])(ChuchuBossEntity*) = {
@ -222,25 +228,25 @@ const u8 gUnk_080CC278[] = {
150, 180, 210, 250,
};
const u16 gUnk_080CC27C[] = {
0x80, 0x8, 0x100, 0x6,
0x80, 0x18, 0x100, 0x8,
0x180, 0x6, 0x100, 0x10,
0x0, 0x0, 0xA0, 0x18,
const ChuchuStruct gUnk_080CC27C[] = {
{0x80, 0x8}, {0x100, 0x6},
{0x80, 0x18}, {0x100, 0x8},
{0x180, 0x6}, {0x100, 0x10},
{0x0, 0x0}, {0xA0, 0x18},
};
const u16 gUnk_080CC29C[] = {
0x80, 0x8, 0x100, 0x4,
0x80, 0xC, 0x80, 0x6,
0x200, 0x6, 0x100, 0xC,
0x0, 0x0, 0xA0, 0x14,
const ChuchuStruct gUnk_080CC29C[] = {
{0x80, 0x8}, {0x100, 0x4},
{0x80, 0xC}, { 0x80, 0x6},
{0x200, 0x6}, {0x100, 0xC},
{0x0, 0x0}, {0xA0, 0x14},
};
const u16 gUnk_080CC2BC[] = {
0x80, 0x8, 0x100, 0x0,
0x60, 0x2, 0x80, 0x2,
0x200, 0x6, 0x100, 0x8,
0x0, 0x0, 0xA0, 0x10,
const ChuchuStruct gUnk_080CC2BC[] = {
{0x80, 0x8}, {0x100, 0x0},
{0x60, 0x2}, { 0x80, 0x2},
{0x200, 0x6}, {0x100, 0x8},
{0x0, 0x0}, {0xA0, 0x10},
};
@ -256,7 +262,7 @@ void ChuchuBoss(Entity* this) {
void ChuchuBoss_OnKnockback(ChuchuBossEntity* this) {
GenericKnockback(super);
if (super->type == 0) {
sub_08027870(super);
sub_08027870(this);
}
}
@ -308,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;
@ -330,7 +336,7 @@ NONMATCH("asm/non_matching/chuchuBoss/sub_08025DD8.inc", void sub_08025DD8(Chuch
super->spritePriority.b0 = gUnk_080CC1B8[super->type & 3].unk_01;
this->unk_74.HALF.HI = 0xa0;
this->unk_78.HALF.HI = 0xa0;
this->unk_7e = 0;
this->unk_7e.HWORD = 0;
super->spriteRendering.b0 = 3;
if ((super->type & 3) == 1) {
InitAnimationForceUpdate(super, 0);
@ -435,7 +441,7 @@ END_NONMATCH
void sub_08026060(ChuchuBossEntity* this) {
gUnk_080CC1C8[super->type](this);
SetAffineInfo(super, this->unk_74.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7e);
SetAffineInfo(super, this->unk_74.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7e.HWORD);
}
void sub_08026090(ChuchuBossEntity* this) {
@ -650,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) {
@ -691,7 +697,7 @@ void sub_08026580(ChuchuBossEntity* this) {
}
}
}
sub_08027870(super);
sub_08027870(this);
}
}
@ -741,7 +747,7 @@ void sub_08026634(ChuchuBossEntity* this) {
this->unk_7d--;
}
}
sub_08027870(super);
sub_08027870(this);
}
void sub_08026750(ChuchuBossEntity* this) {
@ -805,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);
}
@ -858,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) {
@ -964,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) {
@ -982,7 +988,7 @@ void sub_08026BE8(ChuchuBossEntity* this) {
} else {
this->unk_7c--;
}
sub_08027870(super);
sub_08027870(this);
}
void sub_08026C40(ChuchuBossEntity* this) {
@ -1073,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) {
@ -1177,7 +1183,7 @@ void sub_08026FA4(ChuchuBossEntity* this) {
}
}
}
sub_08027870(super);
sub_08027870(this);
}
void sub_08027064(ChuchuBossEntity* this) {
@ -1258,5 +1264,582 @@ void sub_08027064(ChuchuBossEntity* this) {
this->unk_7c = 0x3c;
}
}
sub_08027870(super);
sub_08027870(this);
}
void sub_0802720C(ChuchuBossEntity* this) {
super->subAction = super->parent->subAction;
switch (super->subAction) {
case 1:
case 2:
case 12:
this->unk_78.HALF.HI = 0xa0;
this->unk_74.HALF.HI = 0xa0;
sub_0802757C(this);
break;
case 3:
case 5:
if (this->unk_82.HALF.HI == 0)
break;
this->unk_7d = 0;
sub_0802757C(this);
break;
default:
break;
case 8:
if (super->subtimer < 4) {
sub_0802757C(this);
if (this->unk_82.HALF.HI == 0) {
super->subtimer++;
}
}
break;
case 10:
if (this->unk_7d == 0) {
case 4:
sub_0802757C(this);
break;
} else {
if (*(char*)&this->unk_84 != 0) {
this->unk_7d = 0;
*(char*)&this->unk_84 = 0;
}
break;
}
case 0:
sub_0802757C(this);
break;
}
super->z.WORD = super->parent->z.WORD;
}
void sub_080272D4(ChuchuBossEntity* this) {
Entity* pEVar3;
u8 temp;
switch (super->parent->subAction) {
case 1:
case 2:
case 12:
this->unk_78.HALF.HI = 0xa0;
this->unk_74.HALF.HI = 0xa0;
sub_0802757C(this);
break;
case 3:
case 5:
if (this->unk_82.HALF.HI == 0)
break;
case 4:
sub_0802757C(this);
break;
case 8:
if (super->subtimer < 3) {
sub_0802757C(this);
if (this->unk_82.HALF.HI == 0) {
super->subtimer++;
}
}
break;
case 6:
super->hitbox->width = (u32)((0x10000 / this->unk_78.HALF_U.HI) * 9) >> 7;
super->hitbox->height = (u32)((0x10000 / this->unk_74.HALF_U.HI) * 5) >> 6;
if (*(char*)&this->unk_84 == 0)
break;
if ((super->contactFlags & 0x80) != 0) {
if (super->iframes != 0) {
((ChuchuBossEntity*)super->child)->unk_68->base.iframes = super->iframes;
super->child->parent->iframes = super->iframes;
super->child->iframes = super->iframes;
pEVar3 = sub_08027D20((ChuchuBossEntity*)super->child);
if (pEVar3 != NULL) {
pEVar3->x.HALF.HI = super->x.HALF.HI + 1;
pEVar3->spriteOffsetY = super->spriteOffsetY + 0x20;
pEVar3->spriteOffsetX = super->spriteOffsetX;
}
if (sub_08027C54(super->child) == 0 || ((ChuchuBossEntity*)super->child)->unk_84->unk_04 != 2) {
SoundReq(SFX_BOSS_HIT);
} else {
sub_08078B48();
gRoomControls.camera_target = super->child;
gPauseMenuOptions.disabled = 1;
gRoomControls.camera_target->subAction = 9;
SoundReq(SFX_BOSS_DIE);
}
}
}
sub_08027A60(this);
sub_0800445C(super);
break;
case 9:
super->hitbox->width = (u32)((0x10000 / this->unk_78.HALF_U.HI) * 9) >> 7;
super->hitbox->height = (u32)((0x10000 / this->unk_74.HALF_U.HI) * 5) >> 6;
sub_0800445C(super);
break;
case 10:
if (this->unk_7d == 0) {
sub_0802757C(this);
} else if (*(char*)&this->unk_84 != 0) {
this->unk_7d = 0;
*(char*)&this->unk_84 = 0;
}
temp = this->unk_82.HALF.HI + (this->unk_81 / 2);
if ((temp) > (u32)this->unk_81) {
if ((s8)this->unk_82.HALF.HI > 0) {
if (super->animIndex != 12) {
InitAnimationForceUpdate(super, 12);
}
} else if (super->animIndex != 11) {
InitAnimationForceUpdate(super, 11);
}
} else if (super->animIndex != 10) {
InitAnimationForceUpdate(super, 10);
}
break;
case 0:
if (((ChuchuBossEntity*)super->child)->unk_84->unk_03 == 8) {
sub_0802757C(this);
if (this->unk_7d == 1) {
if (this->unk_81 != 0) {
this->unk_81 -= 4;
}
}
}
break;
}
super->z.WORD = super->parent->z.WORD;
super->contactFlags = 0;
UpdateAnimationSingleFrame(super);
}
void sub_08027548(ChuchuBossEntity* this, u32 param_2) {
super->subAction = 1;
sub_08027B98(this, 0x90, 0xb0, 8, 0xff);
this->unk_7d = 0;
sub_080276F4(this, 0, param_2);
}
void sub_0802757C(ChuchuBossEntity* this) {
u32 cVar2;
if (this->unk_7d != 0) {
if (super->type != 1) {
if (((ChuchuBossEntity*)super->child)->unk_7d != 0) {
this->unk_7d = 0;
}
} else {
this->unk_7d--;
}
} else {
if (*(u8*)((int)this + 0x85) == 1) {
this->unk_82.HWORD += *(u16*)((int)this + 0x86);
if ((s8)this->unk_82.HALF.HI >= (s8)this->unk_81) {
*(u8*)((int)this + 0x85) = 0;
if (super->type == 1) {
this->unk_7d =
(((ChuchuBossEntity*)super->parent)->unk_81 << 8) / *(u16*)((int)super->parent + 0x86) + 1;
} else {
this->unk_7d = 1;
}
this->unk_82.HWORD = this->unk_81 << 8;
}
} else {
this->unk_82.HWORD -= *(u16*)((int)this + 0x86);
if ((s8)this->unk_82.HALF.HI <= -this->unk_81) {
cVar2 = 1;
*(u8*)((int)this + 0x85) = cVar2;
if (super->type == 1) {
this->unk_7d =
(((ChuchuBossEntity*)super->parent)->unk_81 << 8) / *(u16*)((int)super->parent + 0x86) + 1;
} else {
this->unk_7d = 1;
}
this->unk_82.HWORD = (-this->unk_81) << 8;
}
}
}
super->y.WORD = super->parent->y.WORD + super->parent->spriteOffsetY * 0x10000;
super->x.WORD = super->parent->x.WORD + (s8)super->parent->spriteOffsetX * 0x10000;
LinearMoveAngle(super, super->timer << 8, this->unk_82.HALF.HI);
if (super->type != 1) {
super->child->y.WORD = super->y.WORD;
super->child->x.WORD = super->x.WORD;
LinearMoveAngle(super->child, super->child->timer << 8, ((ChuchuBossEntity*)super->child)->unk_82.HALF.HI);
sub_080279AC(this->unk_68, super->child, super->child->type);
}
sub_080279AC(this->unk_68, this, super->type);
this->unk_7e.HALF.HI = -this->unk_82.HALF.HI;
}
void sub_080276F4(ChuchuBossEntity* this, u32 param_2, u32 param_3) {
u32 tempzero;
ChuchuBossEntity* pEVar2;
ChuchuBossEntity* pEVar5;
ChuchuBossEntity* pEVar6;
int iVar3;
int iVar4;
int iVar5;
const ChuchuStruct* ptr;
const ChuchuStruct* ptr2;
const ChuchuStruct* ptr3;
pEVar6 = (ChuchuBossEntity*)super->child;
pEVar5 = this->unk_68;
pEVar2 = (ChuchuBossEntity*)super->parent;
*(u8*)((int)pEVar2 + 0x84) = tempzero = 0;
*(u8*)((int)pEVar5 + 0x84) = 0;
*(u8*)((int)pEVar6 + 0x84) = 0;
pEVar2->unk_7e.HWORD = tempzero;
pEVar5->unk_7e.HWORD = 0;
pEVar6->unk_7e.HWORD = 0;
pEVar2->unk_7d = 0;
pEVar5->unk_7d = 0;
ptr = gUnk_080CC27C;
ptr += param_2;
iVar3 = ptr->unk0;
*(u16*)((int)pEVar6 + 0x86) = iVar3;
pEVar6->unk_81 = ptr->unk2;
ptr2 = gUnk_080CC2BC;
ptr2 += param_2;
iVar4 = ptr2->unk0;
*(u16*)((int)pEVar5 + 0x86) = iVar4;
pEVar5->unk_81 = ptr2->unk2;
ptr3 = (ChuchuStruct*)gUnk_080CC29C;
iVar5 = ptr3[param_2].unk0;
*(u16*)((int)pEVar2 + 0x86) = iVar5;
pEVar2->unk_81 = ptr3[param_2].unk2;
if (param_3 == 0) {
*(u8*)((int)pEVar2 + 0x85) = 0;
*(u8*)((int)pEVar5 + 0x85) = 0;
*(u8*)((int)pEVar6 + 0x85) = 0;
pEVar2->unk_82.HWORD = 0;
pEVar5->unk_82.HWORD = 0;
pEVar6->unk_82.HWORD = 0;
pEVar6->unk_7d = (pEVar2->unk_81 << 7) / (*(u16*)((int)pEVar2 + 0x86)) + 1;
}
}
void sub_080277B8(ChuchuBossEntity* this, u32 param_2, s32 param_3) {
ChuchuBossEntity* pEVar1;
pEVar1 = (ChuchuBossEntity*)super->child;
if (param_2 > pEVar1->unk_78.HALF_U.HI) {
pEVar1->unk_78.HALF.HI += param_3;
pEVar1->unk_74.WORD -= Q_16_16(1.5);
} else {
pEVar1->unk_78.HALF.HI = param_2;
pEVar1->unk_7c = 8;
this->unk_84->unk_03++;
}
sub_080277F8(this);
}
void sub_080277F8(ChuchuBossEntity* this) {
u32 uVar1;
ChuchuBossEntity* pEVar3;
ChuchuBossEntity* pEVar4;
ChuchuBossEntity* pEVar5;
pEVar3 = (ChuchuBossEntity*)super->child;
pEVar5 = this->unk_68;
pEVar4 = (ChuchuBossEntity*)super->parent;
uVar1 = super->x.HALF_U.HI;
pEVar5->base.x.HALF.HI = uVar1;
pEVar5->base.timer = 14;
pEVar5->base.y.HALF.HI = super->y.HALF.HI - 14;
pEVar4->base.x.HALF.HI = uVar1;
pEVar4->base.timer = 18 - ((pEVar3->unk_78.HALF_U.HI - 0xa0) >> 4);
pEVar4->base.y.HALF.HI = pEVar5->base.y.HALF.HI - pEVar4->base.timer;
pEVar3->base.x.HALF.HI = uVar1;
if (pEVar3->unk_78.HALF_U.HI >= 0xa1) {
pEVar3->base.timer = 14 - ((pEVar3->unk_78.HALF_U.HI - 0xa0) >> 2);
if ((pEVar3->base.timer & 0x80) != 0) {
pEVar3->base.timer = 0;
}
} else {
pEVar3->base.timer = 14;
}
pEVar3->base.y.HALF.HI = pEVar4->base.y.HALF.HI - pEVar3->base.timer;
pEVar4->unk_74.WORD = pEVar3->unk_74.WORD;
pEVar4->unk_78.WORD = pEVar3->unk_78.WORD;
pEVar5->unk_74.WORD = pEVar3->unk_74.WORD;
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);
}
void sub_08027984(ChuchuBossEntity* this) {
ChuchuBossEntity* child;
ChuchuBossEntity* pEVar1;
ChuchuBossEntity* pEVar2;
child = (ChuchuBossEntity*)super->child;
pEVar1 = this->unk_68;
pEVar2 = (ChuchuBossEntity*)super->parent;
sub_080279AC(this, child, child->base.type);
sub_080279AC(this, pEVar1, pEVar1->base.type);
sub_080279AC(this, pEVar2, pEVar2->base.type);
}
void sub_080279AC(ChuchuBossEntity* this, Entity* param_2, s32 param_3) {
s32 temp;
temp = 4 - param_3;
param_2->spriteOffsetX = param_2->x.HALF_U.HI - super->x.HALF_U.HI;
param_2->spriteOffsetY = param_2->y.HALF.HI - (super->y.HALF.HI + temp);
param_2->x.HALF.HI = super->x.HALF_U.HI;
param_2->y.HALF.HI = super->y.HALF.HI + temp;
param_2->hitbox->offset_x = param_2->spriteOffsetX;
param_2->hitbox->offset_y = param_2->spriteOffsetY;
}
bool32 sub_080279E8(ChuchuBossEntity* this) {
u32 sVar1;
u32 sVar2;
ChuchuBossEntity* pEVar4;
pEVar4 = (ChuchuBossEntity*)super->child;
if (this->unk_81 == 0x80) {
if (this->unk_74.HALF_U.HI - (u8)this->unk_84->unk_05 == 0x80) {
sub_08027B98(this, this->unk_82.HALF.LO, 0xa0, 0x20, 1);
}
} else {
if (pEVar4->unk_74.HALF_U.HI >= 0xa1) {
pEVar4->unk_74.HALF_U.HI = pEVar4->unk_74.HALF_U.HI - 4;
} else {
pEVar4->unk_74.HALF_U.HI = 0xa0;
}
if (pEVar4->unk_78.HALF_U.HI >= 0xa1) {
pEVar4->unk_78.HALF_U.HI = pEVar4->unk_78.HALF_U.HI - 4;
} else {
pEVar4->unk_78.HALF_U.HI = 0xa0;
}
if ((pEVar4->unk_74.HALF_U.HI == 0xa0) && (pEVar4->unk_78.HALF_U.HI == 0xa0)) {
return TRUE;
}
}
return FALSE;
}
void sub_08027A60(ChuchuBossEntity* this) {
int iVar1;
int iVar2;
u32 bVar3;
if ((this->unk_7c & 0x80) != 0) {
this->unk_74.WORD += Q_16_16(0.25);
} else {
this->unk_74.WORD -= Q_16_16(0.25);
}
this->unk_7c++;
if ((this->unk_7c & 0x7f) == 0x28) {
this->unk_7c = (this->unk_7c & 0x80) ^ 0x80;
}
}
bool32 sub_08027AA4(ChuchuBossEntity* this) {
u32 uVar3;
s32 iVar4;
Helper* pHelper;
if ((super->contactFlags & 0x80) == 0) {
return FALSE;
}
switch (super->contactFlags & 0x7f) {
case 19:
SoundReq(SFX_WATER_SPLASH);
CreateObjectWithParent(super, OBJECT_49, 9, super->type2);
SoundReq(SFX_155);
pHelper = this->unk_84;
super->iframes = 3;
pHelper->unk_06++;
iVar4 = pHelper->unk_06;
uVar3 = (iVar4 / 3);
if (((u8)uVar3 << 3) != (u8)pHelper->unk_05) {
pHelper->unk_05 = (uVar3 << 3);
}
pHelper->unk_08 = 0xb4;
if (-1 < pHelper->unk_05) {
break;
}
pHelper->unk_01 = 0x40;
super->hitType = 0;
if (super->subAction == 2) {
sub_08027BBC(this);
}
sub_08027D20(this);
SoundReq(SFX_BOSS_HIT);
return TRUE;
case 27:
super->iframes = -30;
switch (super->contactedEntity->type + 1) {
case 3:
super->knockbackDuration = 26;
super->knockbackSpeed = Q_8_8(1.75);
break;
case 2:
super->knockbackDuration = 20;
super->knockbackSpeed = Q_8_8(1.5);
break;
case 1:
super->knockbackDuration = 16;
super->knockbackSpeed = Q_8_8(1);
break;
}
return TRUE;
}
return FALSE;
}
void sub_08027B98(ChuchuBossEntity* this, u32 unk1, u32 unk2, u32 unk3, u32 unk4) {
this->unk_82.HALF.LO = unk1;
this->unk_81 = unk2;
this->unk_80 = unk3;
if (unk4 != 0xff) {
super->timer = unk4;
} else {
super->timer = 1;
}
}
void sub_08027BBC(ChuchuBossEntity* this) {
ChuchuBossEntity* pEVar3;
ChuchuBossEntity* pEVar5;
ChuchuBossEntity* pEVar6;
ChuchuBossEntity* pEVar7;
super->subAction = 10;
this->unk_84->unk_01 = 0;
sub_080276F4(this, 7, 1);
((ChuchuBossEntity*)super->child)->unk_7d = 0;
super->speed = 0;
this->unk_84->unk_03 = 0;
if (super->x.HALF.HI > this->unk_84->unk_0e) {
super->direction = 0x18;
pEVar5 = (ChuchuBossEntity*)super->child;
pEVar3 = (ChuchuBossEntity*)super->parent;
*(u8*)((int)this->unk_68 + 0x85) = 0;
*(u8*)((int)pEVar3 + 0x85) = 0;
*(u8*)((int)pEVar5 + 0x85) = 0;
} else {
super->direction = 8;
pEVar6 = (ChuchuBossEntity*)super->child;
pEVar7 = (ChuchuBossEntity*)super->parent;
*(u8*)((int)this->unk_68 + 0x85) = 1;
*(u8*)((int)pEVar7 + 0x85) = 1;
*(u8*)((int)pEVar6 + 0x85) = 1;
}
super->animationState = super->direction >> 2;
if (super->y.HALF.HI != gPlayerEntity.y.HALF.HI) {
if (super->y.HALF.HI > gPlayerEntity.y.HALF.HI) {
this->unk_84->unk_0c = 0;
} else {
this->unk_84->unk_0c = 0x10;
}
}
}
bool32 sub_08027C54(ChuchuBossEntity* this) {
if ((u8)gUnk_080CC2DC[this->unk_84->unk_04] > super->child->health) {
return TRUE;
} else {
return FALSE;
}
}
void sub_08027C7C(ChuchuBossEntity* this, u32 param_2) {
sub_08027C9C(super->child, param_2);
sub_08027C9C(this->unk_68, param_2);
sub_08027C9C(super->parent, param_2);
}
void sub_08027C9C(ChuchuBossEntity* this, u32 param_2) {
Entity* fxEnt;
if ((Random() & param_2) == 0) {
fxEnt = CreateFx(super, FX_GIANT_EXPLOSION3, 0);
if (fxEnt != NULL) {
fxEnt->x.HALF.HI = ((s8)super->spriteOffsetX - super->hitbox->width) + fxEnt->x.HALF.HI;
fxEnt->x.HALF.HI += ((s32)Random()) % (super->hitbox->width << 1);
fxEnt->y.HALF.HI += ((short)super->spriteOffsetY - super->hitbox->height);
fxEnt->y.HALF.HI += ((s32)Random()) % (super->hitbox->height << 1);
fxEnt->spritePriority.b0 = 0;
}
}
}
Entity* sub_08027D20(ChuchuBossEntity* this) {
Entity* r4 = CreateObjectWithParent(super, OBJECT_15, 0, 0);
if (r4 != NULL) {
r4->spriteIndex = 0xc9;
#ifdef EU
r4->spriteVramOffset = super->spriteVramOffset;
r4->palette.b.b0 = super->palette.b.b0;
#endif
r4->y.HALF.HI += 1;
r4->spriteOffsetY = 8;
#ifndef EU
LoadFixedGFX(r4, 0x3e);
if (super->type2 == 0) {
LoadObjPalette(r4, 0x2b);
} else {
LoadObjPalette(r4, 0x2c);
}
#endif
}
return r4;
}