From 29d8ee9b06d1651de785c51835db85150e0f126c Mon Sep 17 00:00:00 2001 From: gamestabled Date: Fri, 12 Jun 2020 00:13:00 -0400 Subject: [PATCH 1/2] bell matching --- asm/bell.s | 58 ------------------------------------------------------ linker.ld | 4 ++-- src/bell.c | 26 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 60 deletions(-) delete mode 100644 asm/bell.s create mode 100644 src/bell.c diff --git a/asm/bell.s b/asm/bell.s deleted file mode 100644 index f51caaba..00000000 --- a/asm/bell.s +++ /dev/null @@ -1,58 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start sub_08097D78 -sub_08097D78: @ 0x08097D78 - push {lr} - ldr r2, _08097D8C @ =gUnk_08123384 - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08097D8C: .4byte gUnk_08123384 - - thumb_func_start sub_08097D90 -sub_08097D90: @ 0x08097D90 - push {r4, lr} - adds r4, r0, #0 - movs r3, #1 - movs r2, #1 - strb r2, [r4, #0xc] - ldrb r1, [r4, #0x18] - movs r0, #4 - rsbs r0, r0, #0 - ands r0, r1 - orrs r0, r3 - strb r0, [r4, #0x18] - adds r0, r4, #0 - adds r0, #0x38 - strb r2, [r0] - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r1 - strb r0, [r2] - adds r0, r4, #0 - bl UpdateSpriteOrderAndFlip - adds r0, r4, #0 - movs r1, #0 - bl LoadAnimation - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08097DCC -sub_08097DCC: @ 0x08097DCC - push {lr} - bl sub_080042B8 - pop {pc} diff --git a/linker.ld b/linker.ld index 80b4ccc0..3ad8b8e3 100644 --- a/linker.ld +++ b/linker.ld @@ -697,7 +697,7 @@ SECTIONS { asm/object72.o(.text); asm/lilypadSmall.o(.text); asm/object74.o(.text); - asm/bell.o(.text); + src/bell.o(.text); asm/macroDecorations.o(.text); asm/object79.o(.text); asm/steam.o(.text); @@ -765,7 +765,7 @@ SECTIONS { asm/windTribeTeleporter.o(.text); asm/objectB9.o(.text); asm/objectBA.o(.text); - asm/windCrest.o(.text); + asm/windcrest.o(.text); asm/litArea.o(.text); asm/objectBD.o(.text); asm/pinwheel.o(.text); diff --git a/src/bell.c b/src/bell.c new file mode 100644 index 00000000..69311064 --- /dev/null +++ b/src/bell.c @@ -0,0 +1,26 @@ +#include "global.h" +#include "entity.h" + +extern void sub_080042B8(); +extern void (*gUnk_08123384[])(Entity *); + +extern void UpdateSpriteOrderAndFlip(Entity *); +extern void LoadAnimation(); + + +void sub_08097D78(Entity* this){ + gUnk_08123384[this->action](this); +} + +void sub_08097D90(Entity* this){ + this->action = 1; + this->spriteSettings.b.ss0 = 1; + this->collisionLayer = 1; + this->ticks.b0 = 0; + UpdateSpriteOrderAndFlip(this); + LoadAnimation(this, 0); +} + +void sub_08097DCC(Entity* this){ + sub_080042B8(this); +} \ No newline at end of file From c8ae131cd99297194dc57b159fff9207c9b98e7a Mon Sep 17 00:00:00 2001 From: chandler Date: Fri, 12 Jun 2020 01:52:58 -0400 Subject: [PATCH 2/2] style --- src/bell.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/bell.c b/src/bell.c index 69311064..589d0117 100644 --- a/src/bell.c +++ b/src/bell.c @@ -1,26 +1,28 @@ -#include "global.h" #include "entity.h" +#include "global.h" extern void sub_080042B8(); -extern void (*gUnk_08123384[])(Entity *); +extern void (*gUnk_08123384[])(Entity*); -extern void UpdateSpriteOrderAndFlip(Entity *); +extern void UpdateSpriteOrderAndFlip(Entity*); extern void LoadAnimation(); - -void sub_08097D78(Entity* this){ - gUnk_08123384[this->action](this); +void sub_08097D78(Entity *ent) +{ + gUnk_08123384[ent->action](ent); } -void sub_08097D90(Entity* this){ - this->action = 1; - this->spriteSettings.b.ss0 = 1; - this->collisionLayer = 1; - this->ticks.b0 = 0; - UpdateSpriteOrderAndFlip(this); - LoadAnimation(this, 0); +void sub_08097D90(Entity *ent) +{ + ent->action = 1; + ent->spriteSettings.b.ss0 = 1; + ent->collisionLayer = 1; + ent->ticks.b0 = 0; + UpdateSpriteOrderAndFlip(ent); + LoadAnimation(ent, 0); } -void sub_08097DCC(Entity* this){ - sub_080042B8(this); -} \ No newline at end of file +void sub_08097DCC(Entity *ent) +{ + sub_080042B8(ent); +}