From 8cb4e0b9b0312cf2de3cde48c39c0b4f6a46174e Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Mon, 4 Jul 2022 01:00:07 +0300 Subject: [PATCH] Match sub_08024C48 --- asm/non_matching/pesto/sub_08024C48.inc | 36 ------------------------- src/enemy/pesto.c | 25 ++++++++++++++++- 2 files changed, 24 insertions(+), 37 deletions(-) delete mode 100644 asm/non_matching/pesto/sub_08024C48.inc diff --git a/asm/non_matching/pesto/sub_08024C48.inc b/asm/non_matching/pesto/sub_08024C48.inc deleted file mode 100644 index 858df9a6..00000000 --- a/asm/non_matching/pesto/sub_08024C48.inc +++ /dev/null @@ -1,36 +0,0 @@ - - .syntax unified - - .text - - - push {r4, r5, lr} - adds r3, r0, #0 - movs r4, #1 - cmp r1, #0 - beq _08024C60 - movs r0, #3 - bl sub_08049DF4 - rsbs r1, r0, #0 - orrs r1, r0 - lsrs r4, r1, #0x1f - b _08024C78 -_08024C60: - ldr r2, [r3, #0x54] - cmp r2, #0 - beq _08024C74 - ldr r0, [r2, #4] - cmp r0, #0 - beq _08024C74 - movs r5, #0x36 - ldrsh r0, [r2, r5] - cmp r0, #0 - bge _08024C78 -_08024C74: - str r1, [r3, #0x54] - movs r4, #0 -_08024C78: - adds r0, r4, #0 - pop {r4, r5, pc} - - .syntax divided diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index ee374b41..5969fc6d 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -697,7 +697,30 @@ bool32 sub_08024B38(Entity* this) { return iVar4; } -ASM_FUNC("asm/non_matching/pesto/sub_08024C48.inc", bool32 sub_08024C48(Entity* this, bool32 unk)) +bool32 sub_08024C48(Entity* this, bool32 unk) { + bool32 rv = TRUE; + u32 val; + + if (unk) { + if (sub_08049DF4(3)) { + rv = TRUE; + } else { + rv = FALSE; + } + } else { + if (this->child == NULL) { + this->child = NULL; + rv = FALSE; + } else if (this->child->next == NULL) { + this->child = NULL; + rv = FALSE; + } else if (this->child->z.HALF.HI < 0) { + this->child = NULL; + rv = FALSE; + } + } + return rv; +} void sub_08024C7C(Entity* this) { this->action = 1;