From 1e50eed7a5243f03095868083c916de1037116d7 Mon Sep 17 00:00:00 2001 From: macrepeh Date: Sun, 16 Aug 2020 22:13:59 -0400 Subject: [PATCH 1/2] Carlov --- src/npc/carlov.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/npc/carlov.c diff --git a/src/npc/carlov.c b/src/npc/carlov.c new file mode 100644 index 00000000..aaa447d0 --- /dev/null +++ b/src/npc/carlov.c @@ -0,0 +1,35 @@ +#include "global.h" +#include "entity.h" +#include "player.h" +#include "room.h" +#include "flags.h" +#include "sprite.h" +#include "textbox.h" +#include "npc.h" +#include "structures.h" + +extern void sub_0807DD50(Entity *); +extern void sub_0807DD94(Entity *,u32); +extern void sub_08004488(u32); +extern void sub_08080964(u32,u32); + + +void Carlov(Entity *this) +{ + if (this->action == 0) { + this->action++; + sub_0807DD50(this); + } + else { + sub_0807DD94(this,0); + } + if ((this->frames.all & 0x10) != 0) { + this->frames.all = this->frames.all & 0xef; + sub_08004488(0x104); + sub_08080964(0x10,0); + } + if ((this->frames.all & 0x20) != 0) { + this->frames.all = this->frames.all & 0xdf; + sub_08004488(0x7c); + } +} \ No newline at end of file From 6f1ffdc024ab26cf455a5f0aae9fea8fa0e8f892 Mon Sep 17 00:00:00 2001 From: macrepeh Date: Sun, 16 Aug 2020 22:14:47 -0400 Subject: [PATCH 2/2] Carlov --- asm/carlov.s | 53 ---------------------------------------------------- linker.ld | 2 +- 2 files changed, 1 insertion(+), 54 deletions(-) delete mode 100644 asm/carlov.s diff --git a/asm/carlov.s b/asm/carlov.s deleted file mode 100644 index d076b873..00000000 --- a/asm/carlov.s +++ /dev/null @@ -1,53 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start Carlov -Carlov: @ 0x0806BD54 - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xc] - cmp r0, #0 - bne _0806BD6A - adds r0, #1 - strb r0, [r4, #0xc] - adds r0, r4, #0 - bl sub_0807DD50 - b _0806BD72 -_0806BD6A: - adds r0, r4, #0 - movs r1, #0 - bl sub_0807DD94 -_0806BD72: - adds r4, #0x5a - ldrb r1, [r4] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _0806BD94 - movs r0, #0xef - ands r0, r1 - strb r0, [r4] - movs r0, #0x82 - lsls r0, r0, #1 - bl sub_08004488 - movs r0, #0x10 - movs r1, #0 - bl sub_08080964 -_0806BD94: - ldrb r1, [r4] - movs r0, #0x20 - ands r0, r1 - cmp r0, #0 - beq _0806BDAA - movs r0, #0xdf - ands r0, r1 - strb r0, [r4] - movs r0, #0x7c - bl sub_08004488 -_0806BDAA: - pop {r4, pc} \ No newline at end of file diff --git a/linker.ld b/linker.ld index 56aabb33..e12d18f3 100644 --- a/linker.ld +++ b/linker.ld @@ -607,7 +607,7 @@ SECTIONS { src/npc/moblinLady.o(.text); asm/librarians.o(.text); asm/farmers.o(.text); - asm/carlov.o(.text); + src/npc/carlov.o(.text); src/npc/dampe.o(.text); asm/drLeft.o(.text); asm/kingGustaf.o(.text);