Merge pull request #533 from hatal175/sub_0809028C

This commit is contained in:
notyourav 2022-07-17 00:44:25 -07:00 committed by GitHub
commit 0123ca26bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 920 additions and 2967 deletions

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

@ -11,14 +11,17 @@
#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;
u8 unk_06;
u8 unk_07[7];
u8 unk_07;
u32 unk_08;
u8 unk_0c;
u8 unk_0d;
u16 unk_0e;
} Helper;
@ -27,7 +30,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;
@ -36,10 +39,12 @@ 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;
union SplitHWord unk_82;
Helper* unk_84;
} ChuchuBossEntity;
@ -114,12 +119,12 @@ 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();
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();
@ -255,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 {
@ -274,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);
}
@ -303,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);
@ -450,3 +462,801 @@ void sub_08026090(ChuchuBossEntity* this) {
}
}
}
void sub_08026110(ChuchuBossEntity* this) {
s32 uVar2;
s32 uVar3;
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) {
if (super->timer == 0) {
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.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.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.HALF.LO;
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 * 0x1000;
this->unk_78.WORD += this->unk_80 * 0x1000;
uVar3 = this->unk_74.HALF_U.HI;
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_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_81;
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);
}
}
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();
}
}
void sub_080262A8(ChuchuBossEntity* this) {
this->unk_82.HALF.LO = 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;
this->unk_7d = 0x1e;
this->unk_84->unk_03 = 3;
gPlayerEntity.animationState = 0;
gRoomControls.camera_target = super;
gRoomControls.unk5 = 1;
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);
}
}
void sub_08026358(ChuchuBossEntity* this) {
u32 bVar1;
if (gPlayerEntity.action != 15) {
bVar1 = --this->unk_7d;
if (bVar1 == 0) {
this->unk_7c = 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;
}
}
}
}
void sub_080263B4(ChuchuBossEntity* this) {
u32 bVar3;
if (this->unk_7d-- == 0) {
bVar3 = this->unk_7d = gUnk_080CC234[this->unk_7c++];
if ((bVar3 & 0xff) == 0xff) {
this->unk_7c = 0x78;
this->unk_84->unk_03++;
} else {
CreateObjectWithParent(super, OBJECT_49, super->type2, 0);
}
}
}
void sub_08026414(ChuchuBossEntity* this) {
Entity* parent;
Entity* child;
if (this->unk_7c-- == 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);
}
}
void sub_0802647C(ChuchuBossEntity* this) {
if (GravityUpdate(super, 0x4000) == 0) {
InitScreenShake(0x10, 0);
SoundReq(SFX_1A1);
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);
}
}
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);
}
void sub_0802650C(ChuchuBossEntity* this) {
if (((ChuchuBossEntity*)super->child)->unk_81 == 0) {
this->unk_84->unk_03++;
gRoomControls.camera_target = &gPlayerEntity;
}
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;
}
}
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 = 0x3c;
super->direction = GetFacingDirection(super, &gPlayerEntity);
if (this->unk_84->unk_04 == 2) {
this->unk_80 = 0x48;
this->unk_81 += 16;
} else {
this->unk_80 = 16;
}
if ((this->unk_84->unk_01 & 0xa0) != 0) {
this->unk_7d = 0;
this->unk_7c = 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);
}
}
void sub_08026634(ChuchuBossEntity* this) {
if (sub_08027AA4(this)) {
return;
}
if (this->unk_7d == 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--;
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 = 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_81) {
this->unk_7d--;
}
}
sub_08027870(super);
}
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_82.HALF.HI | ((ChuchuBossEntity*)super->parent)->unk_82.HALF.HI |
this->unk_68->unk_82.HALF.HI) == 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);
}
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);
}
}
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);
}
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);
}
}
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);
}
}
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);
}
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 (DirectionIsVertical(super->direction)) {
sVar5 = 0x100;
} else {
sVar5 = -0x100;
}
pEVar8->unk_82.HWORD += sVar5;
pEVar6->unk_82.HWORD += sVar5;
pEVar7->unk_82.HWORD += sVar5;
}
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 (DirectionIsVertical(super->direction)) {
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 (DirectionIsVertical(super->direction)) {
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 (DirectionIsVertical(super->direction)) {
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);
}
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);
}
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 (DirectionIsVertical(super->direction)) {
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 (DirectionIsVertical(super->direction)) {
iVar5 = 0x300;
} else {
iVar5 = -0x300;
}
} else {
if (DirectionIsVertical(super->direction)) {
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 (DirectionIsVertical(super->direction)) {
*(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);
}
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();
}
}
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);
}
}
}
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);
}
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);
}

View File

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

View File

@ -365,7 +365,7 @@ void Bird_Type10(Entity* this) {
}
}
void CreateBird(void) {
void CreateBird(Entity* this) {
Entity* birdEnt;
#ifndef EU

View File

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