From 05b2f892b39ff8a9b7c980f2d39fda2d4cd19e92 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 12 Feb 2022 07:35:05 +0200 Subject: [PATCH] match Farmers --- asm/non_matching/farmers/Farmers.inc | 58 ---------------------------- src/npc/farmers.c | 22 ++++++++++- 2 files changed, 20 insertions(+), 60 deletions(-) delete mode 100644 asm/non_matching/farmers/Farmers.inc diff --git a/asm/non_matching/farmers/Farmers.inc b/asm/non_matching/farmers/Farmers.inc deleted file mode 100644 index 8e428da6..00000000 --- a/asm/non_matching/farmers/Farmers.inc +++ /dev/null @@ -1,58 +0,0 @@ - .syntax unified - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xc] - cmp r0, #0 - bne _0806BC40 - ldrb r0, [r4, #0xa] - lsls r1, r0, #1 - adds r1, r1, r0 - lsls r1, r1, #2 - ldr r0, _0806BC28 @ =gUnk_08113140 - adds r1, r1, r0 - adds r0, r4, #0 - bl LoadExtraSpriteData - cmp r0, #0 - beq _0806BC54 - ldrb r0, [r4, #0xc] - adds r0, #1 - strb r0, [r4, #0xc] - ldrb r1, [r4, #0xe] - movs r0, #1 - ands r1, r0 - lsls r1, r1, #6 - ldrb r2, [r4, #0x18] - movs r0, #0x41 - rsbs r0, r0, #0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, #0x18] - lsls r0, r0, #0x19 - cmp r0, #0 - blt _0806BC2C - movs r0, #6 - b _0806BC2E - .align 2, 0 -_0806BC28: .4byte gUnk_08113140 -_0806BC2C: - movs r0, #2 -_0806BC2E: - strb r0, [r4, #0x14] - ldrb r0, [r4, #0x14] - strb r0, [r4, #0xe] - adds r0, r4, #0 - bl sub_0806BC58 - adds r0, r4, #0 - bl sub_0807DD64 -_0806BC40: - adds r0, r4, #0 - movs r1, #0 - bl ExecuteScriptForEntity - adds r0, r4, #0 - bl HandleEntity0x82Actions - adds r0, r4, #0 - bl GetNextFrame -_0806BC54: - pop {r4, pc} - .align 2, 0 - .syntax divided diff --git a/src/npc/farmers.c b/src/npc/farmers.c index 06dea3c3..92d520da 100644 --- a/src/npc/farmers.c +++ b/src/npc/farmers.c @@ -8,7 +8,26 @@ extern Dialog gUnk_08113158[]; extern SpriteLoadData gUnk_08113140[]; void sub_0806BC58(Entity* this); -ASM_FUNC("asm/non_matching/farmers/Farmers.inc", void Farmers(Entity* this)) +void Farmers(Entity* this) { + if (this->action == 0) { + if (LoadExtraSpriteData(this, &gUnk_08113140[this->type * 3]) == 0) { + return; + } + this->action++; + this->spriteSettings.flipX = this->actionDelay; + if (this->spriteSettings.flipX == 0) { + this->animationState = 6; + } else { + this->animationState = 2; + } + this->actionDelay = this->animationState; + sub_0806BC58(this); + sub_0807DD64(this); + } + ExecuteScriptForEntity(this, 0); + HandleEntity0x82Actions(this); + GetNextFrame(this); +} void sub_0806BC58(Entity* this) { SetDefaultPriority(this, PRIO_MESSAGE); @@ -48,7 +67,6 @@ void sub_0806BCE8(Entity* this) { } void Farmers_Fusion(Entity* this) { - if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08113140[this->type * 3]) != 0) { this->action = this->action + 1;