diff --git a/asm/non_matching/wallMaster2/sub_0802CF8C.inc b/asm/non_matching/wallMaster2/sub_0802CF8C.inc deleted file mode 100644 index 6f2147b1..00000000 --- a/asm/non_matching/wallMaster2/sub_0802CF8C.inc +++ /dev/null @@ -1,43 +0,0 @@ - .syntax unified - push {r4, lr} - adds r3, r0, #0 - ldrb r1, [r3, #0x15] - adds r2, r1, #2 - movs r0, #0x1c - ands r2, r0 - ldrb r4, [r3, #0x14] - lsls r0, r4, #2 - subs r0, r2, r0 - adds r0, #6 - cmp r0, #0xc - bls _0802CFA8 - lsrs r0, r2, #2 - b _0802CFB8 -_0802CFA8: - adds r0, r1, #1 - movs r1, #7 - ands r0, r1 - cmp r0, #2 - ble _0802CFD0 - lsrs r0, r2, #2 - cmp r0, r4 - beq _0802CFD0 -_0802CFB8: - strb r0, [r3, #0x14] - lsrs r0, r2, #3 - lsls r0, r0, #2 - ldr r1, _0802CFD4 @ =gUnk_080CD730 - adds r2, r0, r1 - ldrh r1, [r2] - adds r0, r3, #0 - adds r0, #0x74 - strh r1, [r0] - ldrh r1, [r2, #2] - adds r0, #2 - strh r1, [r0] -_0802CFD0: - pop {r4, pc} - .align 2, 0 -_0802CFD4: .4byte gUnk_080CD730 - - .syntax divided diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index 696b36ad..2669bddd 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -165,23 +165,26 @@ void sub_0802CF64(Entity* this) { sub_0802CF8C(this); } -NONMATCH("asm/non_matching/wallMaster2/sub_0802CF8C.inc", void sub_0802CF8C(Entity* this)) { +void sub_0802CF8C(Entity* this) { int iVar1; - u32 uVar2; + u32 dir; const u16* ptr; - u16* ptr2; - uVar2 = (this->direction + 2) & 0x1c; - if ((uVar2 - this->animationState * 4 + 6 > 0xc) || - ((((this->direction + 1) & 7) > 2 && (uVar2 >> 2 != this->animationState)))) { - this->animationState = (uVar2 >> 2); - iVar1 = (uVar2 >> 3) * 2; + dir = Direction8RoundUp(this->direction); + if (dir - Direction8FromAnimationState(this->animationState) + 6 > 12) { + this->animationState = Direction8ToAnimationState(dir); + iVar1 = (dir >> 3) * 2; + ptr = &gUnk_080CD730[iVar1]; + this->field_0x74.HWORD = ptr[0]; + this->field_0x76.HWORD = ptr[1]; + } else if (((this->direction + 1) & 7) > 2 && (Direction8ToAnimationState(dir) != this->animationState)) { + this->animationState = Direction8ToAnimationState(dir); + iVar1 = (dir >> 3) * 2; ptr = &gUnk_080CD730[iVar1]; this->field_0x74.HWORD = ptr[0]; this->field_0x76.HWORD = ptr[1]; } } -END_NONMATCH void sub_0802CFD8(Entity* this) { u32 unk = gUnk_080CD740[(this->field_0x7a.HALF.LO++ >> 3) & 7];