From 2c0b39832e30964515fdfad3e1a3e3047fbd17d7 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sat, 8 Aug 2020 09:06:54 -0500 Subject: [PATCH] Match keaton/sub_08032574 --- asm/non_matching/keaton/sub_08032574.inc | 50 ------------------------ src/enemy/keaton.c | 30 ++++++-------- 2 files changed, 13 insertions(+), 67 deletions(-) delete mode 100644 asm/non_matching/keaton/sub_08032574.inc diff --git a/asm/non_matching/keaton/sub_08032574.inc b/asm/non_matching/keaton/sub_08032574.inc deleted file mode 100644 index c6caea9d..00000000 --- a/asm/non_matching/keaton/sub_08032574.inc +++ /dev/null @@ -1,50 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - push {r4, r5, lr} - adds r4, r0, #0 - ldr r0, [r4, #0x54] - cmp r0, #0 - beq _0803258A - adds r0, #0x41 - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _080325A4 -_0803258A: - adds r5, r4, #0 - adds r5, #0x76 - ldrh r0, [r5] - subs r0, #1 - strh r0, [r5] - lsls r0, r0, #0x10 - cmp r0, #0 - beq _080325A4 - adds r0, r4, #0 - bl sub_080AEFE0 - cmp r0, #0 - bne _080325AC -_080325A4: - adds r0, r4, #0 - bl sub_0803275C - b _080325C2 -_080325AC: - adds r0, r4, #0 - bl UpdateAnimationSingleFrame - ldrh r1, [r5] - movs r0, #7 - ands r0, r1 - cmp r0, #0 - bne _080325C2 - adds r0, r4, #0 - bl sub_08032794 -_080325C2: - pop {r4, r5, pc} - .align 2, 0 - .syntax divided diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index 7c960ac7..b30c65df 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -115,26 +115,22 @@ void sub_080324FC(Entity* this) { } } -#if NON_MATCHING // r4-r5 register swap void sub_08032574(Entity* this) { - if (this->attachedEntity == NULL || !(this->attachedEntity->bitfield & 0x80)) { - (this->field_0x76)--; - if ((this->field_0x76 == 0) || (sub_080AEFE0(this) == 0)) { - sub_0803275C(this); - } else { - UpdateAnimationSingleFrame(this); - if (!(this->field_0x76 & 0x7)) { - sub_08032794(this); - } - } + if (this->attachedEntity && (this->attachedEntity->bitfield & 0x80)) { + sub_0803275C(this); + return; + } + + if (--this->field_0x76 == 0 || !sub_080AEFE0(this)) { + sub_0803275C(this); + return; + } + + UpdateAnimationSingleFrame(this); + if ((this->field_0x76 & 0x7) == 0) { + sub_08032794(this); } } -#else -NAKED -void sub_08032574(Entity* this) { - asm(".include \"asm/non_matching/keaton/sub_08032574.inc\""); -} -#endif void sub_080325C4(Entity* this) { this->actionDelay--;