From 4ec85404c0272c29152848d8bfc67ba6bb87d668 Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Sun, 6 Nov 2022 10:20:00 +0000 Subject: [PATCH] Match sub_08066570 --- asm/non_matching/npc23/sub_08066570.inc | 59 ------------------------- src/npc/npc23.c | 7 +-- 2 files changed, 4 insertions(+), 62 deletions(-) delete mode 100644 asm/non_matching/npc23/sub_08066570.inc diff --git a/asm/non_matching/npc23/sub_08066570.inc b/asm/non_matching/npc23/sub_08066570.inc deleted file mode 100644 index 00dc26d9..00000000 --- a/asm/non_matching/npc23/sub_08066570.inc +++ /dev/null @@ -1,59 +0,0 @@ - .syntax unified - push {r4, r5, r6, lr} - adds r5, r0, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _080665DE - ldrb r0, [r5, #0xc] - cmp r0, #3 - beq _080665DE - ldr r4, _080665E0 @ =gPlayerEntity - adds r0, r5, #0 - adds r1, r4, #0 - movs r2, #0x50 - bl sub_0806FC80 - cmp r0, #0 - beq _080665DE - adds r0, r5, #0 - adds r1, r4, #0 - bl GetFacingDirection - adds r3, r0, #0 - movs r6, #1 - movs r1, #0x18 - adds r4, r3, #0 - ands r4, r1 - ldrb r0, [r5, #0x15] - adds r2, r1, #0 - ands r2, r0 - cmp r2, r4 - bne _080665C8 - adds r2, r3, #5 - movs r1, #7 - ands r2, r1 - ldrb r0, [r5, #0x15] - adds r0, #5 - ands r0, r1 - cmp r0, #2 - bhi _080665C8 - cmp r2, #2 - bhi _080665C8 - movs r6, #0 -_080665C8: - cmp r6, #0 - beq _080665DE - strb r3, [r5, #0x15] - adds r3, #4 - movs r0, #0x18 - ands r3, r0 - lsrs r3, r3, #3 - adds r0, r5, #0 - adds r1, r3, #0 - bl InitializeAnimation -_080665DE: - pop {r4, r5, r6, pc} - .align 2, 0 -_080665E0: .4byte gPlayerEntity - .syntax divided diff --git a/src/npc/npc23.c b/src/npc/npc23.c index 6879c6a9..eccd933c 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -174,8 +174,9 @@ bool32 sub_0806650C(Entity* this) { return 1; } -NONMATCH("asm/non_matching/npc23/sub_08066570.inc", void sub_08066570(Entity* this)) { +void sub_08066570(Entity* this) { u32 direction; + s32 tmp; u32 dir1, dir2; bool32 cond; if ((this->frame & ANIM_DONE) == 0) { @@ -191,6 +192,7 @@ NONMATCH("asm/non_matching/npc23/sub_08066570.inc", void sub_08066570(Entity* th dir2 = (direction & 0x18); dir1 = (this->direction & 0x18); + tmp = 0x18; if (dir1 == dir2) { dir1 = (direction + 5) & 7; dir2 = (this->direction + 5) & 7; @@ -201,9 +203,8 @@ NONMATCH("asm/non_matching/npc23/sub_08066570.inc", void sub_08066570(Entity* th if (cond) { this->direction = direction; direction += 4; - direction &= 0x18; + direction &= tmp; direction >>= 3; InitializeAnimation(this, direction); } } -END_NONMATCH