Match sub_08028604

This commit is contained in:
Tal Hayon 2022-09-01 22:57:23 +03:00
parent 137ce4b6e2
commit b826037bf2
2 changed files with 12 additions and 116 deletions

View File

@ -1,104 +0,0 @@
.syntax unified
.text
push {r4, r5, r6, lr}
adds r4, r0, #0
movs r1, #0
strb r1, [r4, #0xf]
adds r0, #0x82
ldrb r0, [r0]
cmp r0, #1
bne _080286B0
bl Random
ldr r2, _08028650 @ =gUnk_080CC7BC
movs r1, #3
ands r1, r0
adds r1, r1, r2
ldrb r0, [r1]
strb r0, [r4, #0xe]
movs r0, #0x80
strh r0, [r4, #0x24]
adds r0, r4, #0
bl sub_08049FA0
cmp r0, #0
beq _08028658
bl Random
ldr r2, _08028654 @ =gUnk_080CC7D0
movs r1, #7
ands r1, r0
adds r1, r1, r2
movs r0, #0
ldrsb r0, [r1, r0]
adds r0, #0x18
ldrb r1, [r4, #0x15]
adds r0, r0, r1
movs r1, #0x18
ands r0, r1
strb r0, [r4, #0x15]
b _080286B8
.align 2, 0
_08028650: .4byte gUnk_080CC7BC
_08028654: .4byte gUnk_080CC7D0
_08028658:
adds r0, r4, #0
bl sub_08049EE4
adds r5, r0, #0
adds r6, r4, #0
adds r6, #0x83
ldrb r0, [r6]
cmp r0, #0
bne _08028684
bl Random
ldr r2, _08028680 @ =gUnk_080CC7C0
movs r1, #0xf
ands r1, r0
adds r1, r1, r2
movs r0, #0
ldrsb r0, [r1, r0]
adds r5, r5, r0
b _080286A2
.align 2, 0
_08028680: .4byte gUnk_080CC7C0
_08028684:
bl Random
ldr r2, _080286AC @ =gUnk_080CC7C0
movs r1, #7
ands r1, r0
adds r1, r1, r2
movs r0, #0
ldrsb r0, [r1, r0]
adds r5, r5, r0
ldrb r0, [r4, #0xe]
adds r0, #0x10
strb r0, [r4, #0xe]
ldrb r0, [r6]
subs r0, #1
strb r0, [r6]
_080286A2:
adds r0, r5, #4
movs r1, #0x18
ands r0, r1
strb r0, [r4, #0x15]
b _080286B8
.align 2, 0
_080286AC: .4byte gUnk_080CC7C0
_080286B0:
movs r0, #0xc
strb r0, [r4, #0xe]
strh r1, [r4, #0x24]
ldrb r0, [r4, #0x15]
_080286B8:
lsrs r5, r0, #2
ldrb r0, [r4, #0x14]
cmp r5, r0
beq _080286C8
strb r5, [r4, #0x14]
adds r0, r4, #0
bl sub_080287E0
_080286C8:
pop {r4, r5, r6, pc}
.align 2, 0
.syntax divided

View File

@ -24,7 +24,7 @@ extern void (*const SpearMoblin_Functions[])(Entity*);
extern void (*const gUnk_080CC7A8[])(Entity*);
extern const u8 gUnk_080CC7BC[];
extern const s8 gUnk_080CC7C0[];
extern const u8 gUnk_080CC7D0[];
extern const s8 gUnk_080CC7D0[];
extern const u16 gUnk_080CC7D8[];
extern const Hitbox* const gUnk_080CC944[];
@ -242,7 +242,8 @@ void sub_08028528(Entity* this) {
}
}
NONMATCH("asm/non_matching/spearMoblin/sub_08028604.inc", void sub_08028604(Entity* this)) {
void sub_08028604(Entity* this) {
u32 iVar3;
this->subtimer = 0;
if (this->field_0x82.HALF.LO == 1) {
this->timer = gUnk_080CC7BC[Random() & 3];
@ -251,12 +252,10 @@ NONMATCH("asm/non_matching/spearMoblin/sub_08028604.inc", void sub_08028604(Enti
u32 rand = Random();
u32 tmp;
tmp = gUnk_080CC7D0[rand & 7] + 0x18;
tmp += this->direction;
tmp &= 0x18;
this->direction = tmp;
this->direction = DirectionRound(tmp + this->direction);
iVar3 = Direction8ToAnimationState(this->direction);
} else {
u32 iVar3 = sub_08049EE4(this);
s8 uVar1;
iVar3 = sub_08049EE4(this);
if (this->field_0x82.HALF.HI == 0) {
u32 rand = Random();
iVar3 += gUnk_080CC7C0[rand & 0xf];
@ -267,18 +266,19 @@ NONMATCH("asm/non_matching/spearMoblin/sub_08028604.inc", void sub_08028604(Enti
this->field_0x82.HALF.HI--;
}
this->direction = (iVar3 + 4U) & 0x18;
iVar3 = Direction8ToAnimationState(this->direction);
}
} else {
this->timer = 0xc;
this->timer = 12;
this->speed = 0;
iVar3 = Direction8ToAnimationState(this->direction);
}
if (this->direction >> 2 != this->animationState) {
this->animationState = this->direction >> 2;
if (iVar3 != this->animationState) {
this->animationState = iVar3;
sub_080287E0(this);
}
}
END_NONMATCH
bool32 sub_080286CC(Entity* this) {
if (this->field_0x80.HALF.HI == 0) {
@ -429,7 +429,7 @@ const s8 gUnk_080CC7C0[] = {
0x00, 0xFE,
};
const u8 gUnk_080CC7D0[] = {
const s8 gUnk_080CC7D0[] = {
0x08, 0x10,
0x08, 0x00,
0x10, 0x08,