diff --git a/asm/hangingSeed.s b/asm/hangingSeed.s deleted file mode 100644 index e73cdaee..00000000 --- a/asm/hangingSeed.s +++ /dev/null @@ -1,87 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start HangingSeed -HangingSeed: @ 0x080216D4 - push {lr} - ldr r1, _080216E0 @ =gUnk_080CB570 - bl EnemyFunctionHandler - pop {pc} - .align 2, 0 -_080216E0: .4byte gUnk_080CB570 - - thumb_func_start sub_080216E4 -sub_080216E4: @ 0x080216E4 - push {lr} - ldr r2, _080216F8 @ =gUnk_080CB588 - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_080216F8: .4byte gUnk_080CB588 - - thumb_func_start sub_080216FC -sub_080216FC: @ 0x080216FC - push {lr} - adds r2, r0, #0 - adds r0, #0x41 - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _0802171A - adds r0, r2, #0 - movs r1, #3 - movs r2, #0x80 - bl CreateFx - bl DeleteThisEntity -_0802171A: - pop {pc} - - thumb_func_start nullsub_7 -nullsub_7: @ 0x0802171C - bx lr - .align 2, 0 - - thumb_func_start sub_08021720 -sub_08021720: @ 0x08021720 - movs r3, #1 - movs r1, #1 - strb r1, [r0, #0xc] - ldrb r2, [r0, #0x18] - subs r1, #5 - ands r1, r2 - orrs r1, r3 - strb r1, [r0, #0x18] - ldrb r1, [r0, #0xa] - strb r1, [r0, #0x1e] - ldrb r2, [r0, #0x19] - movs r1, #0x3f - ands r1, r2 - movs r2, #0x40 - orrs r1, r2 - strb r1, [r0, #0x19] - adds r0, #0x29 - ldrb r2, [r0] - movs r1, #8 - rsbs r1, r1, #0 - ands r1, r2 - movs r2, #3 - orrs r1, r2 - strb r1, [r0] - bx lr - .align 2, 0 - - thumb_func_start nullsub_08 -nullsub_08: @ 0x08021754 - bx lr - .align 2, 0 diff --git a/linker.ld b/linker.ld index 71862820..646ca903 100644 --- a/linker.ld +++ b/linker.ld @@ -325,7 +325,7 @@ SECTIONS { asm/peahat.o(.text); asm/rollobite.o(.text); asm/darkNut.o(.text); - asm/hangingSeed.o(.text); + src/hangingSeed.o(.text); asm/beetle.o(.text); src/keese.o(.text); asm/keese.o(.text); diff --git a/src/hangingSeed.c b/src/hangingSeed.c new file mode 100644 index 00000000..35653f43 --- /dev/null +++ b/src/hangingSeed.c @@ -0,0 +1,40 @@ +#include "global.h" +#include "entity.h" + +extern void EnemyFunctionHandler(Entity*, void (*const funcs[])(Entity*)); +extern void CreateFx(Entity*, u32, u32); +extern void DeleteThisEntity(); + +extern void (*const gUnk_080CB570[])(Entity*); +extern void (*const gUnk_080CB588[])(Entity*); + +void HangingSeed(Entity *this) +{ + EnemyFunctionHandler(this, gUnk_080CB570); +} + +void sub_080216E4(Entity *this) +{ + gUnk_080CB588[this->action](this); +} + +void sub_080216FC(Entity *this) +{ + if ((this->bitfield & 0x80) != 0) { + CreateFx(this, 3, 0x80); + DeleteThisEntity(); + } +} + +void nullsub_7(Entity* this){} + +void sub_08021720(Entity *this) +{ + this->action = 1; + this->spriteSettings.b.ss0 = 1; + this->frameIndex = (this->entityType).form; + this->spriteOrder.b3 = 1; + this->ticks.b0 = 3; +} + +void nullsub_08(Entity* this){} \ No newline at end of file