match non-matching forestMinish function

This commit is contained in:
Behemoth 2020-08-25 18:08:10 +02:00
parent f94263db8e
commit 7dc04f3b42
2 changed files with 31 additions and 105 deletions

View File

@ -1,72 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
push {r4, r5, r6, r7, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xe]
adds r7, r0, #0
cmp r7, #0
beq _0806016A
subs r0, #1
strb r0, [r4, #0xe]
b _080601CC
_0806016A:
movs r0, #2
strb r0, [r4, #0xe]
adds r0, r4, #0
movs r1, #0x20
movs r2, #0x20
bl sub_0806EDD8
adds r3, r0, #0
cmp r3, #0
bge _08060188
adds r0, r4, #0
adds r0, #0x69
ldrb r0, [r0]
strb r0, [r4, #0x14]
lsls r3, r0, #2
_08060188:
ldrb r0, [r4, #0x14]
lsrs r0, r0, #1
lsls r0, r0, #5
asrs r1, r3, #1
lsls r1, r1, #1
ldr r2, _080601D0 @ =gUnk_08109C98
adds r1, r1, r2
adds r0, r0, r1
ldrb r6, [r0]
ldrb r5, [r0, #1]
movs r0, #0x80
ands r0, r5
cmp r0, #0
beq _080601AC
adds r0, r3, #0
bl sub_0806F5B0
strb r0, [r4, #0x14]
_080601AC:
movs r0, #0x7f
ands r5, r0
adds r0, r4, #0
adds r0, #0x5a
strb r6, [r0]
strb r5, [r4, #0x1e]
adds r1, r4, #0
adds r1, #0x5b
movs r0, #1
strb r0, [r1]
adds r0, r4, #0
adds r0, #0x58
strb r7, [r0]
subs r1, #2
movs r0, #0xf0
strb r0, [r1]
_080601CC:
pop {r4, r5, r6, r7, pc}
.align 2, 0
_080601D0: .4byte gUnk_08109C98
.syntax divided

View File

@ -12,6 +12,8 @@ extern void sub_0806F118(Entity*);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern void sub_080600F0(Entity*);
extern s32 sub_0806EDD8(Entity*, u32, u32);
extern u32 sub_0806F5B0(u32);
extern u32 sub_0801E99C(Entity*);
extern void sub_08078784(Entity*, u32);
extern void sub_0807000C(Entity*);
@ -114,40 +116,36 @@ void sub_0806014C(Entity* this) {
sub_08060158(this);
}
#if 0
void sub_08060158(Entity *this)
{
u8 bVar1;
u8 bVar2;
s32 iVar4;
u32 temp;
if (this->actionDelay != 0) {
this->actionDelay--;
}
else {
this->actionDelay = 2;
iVar4 = sub_0806EDD8(this, 0x20, 0x20);
if (iVar4 < 0) {
this->animationState = this->field_0x68.HALF.HI;
iVar4 = this->field_0x68.HALF.HI << 2;
}
temp = (this->animationState >> 1) * 0x20 + (iVar4 >> 1) * 2;
bVar1 = gUnk_08109C98[temp];
bVar2 = gUnk_08109C98[temp + 1];
if ((bVar2 & 0x80) != 0) {
this->animationState = sub_0806F5B0(iVar4);
}
this->frames.all = bVar1;
this->frameIndex = bVar2 & 0x7f;
this->frameSpriteSettings = 1;
this->animIndex = 0;
this->frameDuration = 0xf0;
}
}
#endif
NAKED
void sub_08060158(Entity* this) {
asm(".include \"asm/non_matching/forestMinish/sub_08060158.inc\"");
int index;
u8* idx3;
u8 tmp1, tmp2;
if (this->actionDelay) {
this->actionDelay--;
} else {
this->actionDelay = 2;
index = sub_0806EDD8(this, 0x20, 0x20);
if (index < 0) {
int state = this->field_0x68.HALF.HI;
this->animationState = state;
index = state * 4;
}
idx3 = gUnk_08109C98 + (this->animationState / 2) * 0x20 + (index >> 1) * 2;
tmp1 = idx3[0];
tmp2 = idx3[1];
if (tmp2 & 0x80) {
this->animationState = sub_0806F5B0(index);
}
tmp2 &= 0x7f;
this->frames.all = tmp1;
this->frameIndex = tmp2;
this->frameSpriteSettings = 1;
this->animIndex = 0;
this->frameDuration = 0xf0;
}
}
void sub_080601D4(Entity* this) {