From 778173eb4a1a5fdeb5ed0085ce3d52055aa23e97 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Apr 2022 23:57:30 +0300 Subject: [PATCH] Put const data in object49 --- assets/assets.json | 5 ----- data/const/object/object49.s | 31 --------------------------- linker.ld | 2 +- src/object/object49.c | 41 +++++++++++++++++++++++++++--------- 4 files changed, 32 insertions(+), 47 deletions(-) delete mode 100644 data/const/object/object49.s diff --git a/assets/assets.json b/assets/assets.json index b909612f..0337e58f 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -42652,11 +42652,6 @@ "size": 31, "type": "animation" }, - { - "path": "object49/gUnk_08121EA0.bin", - "start": 1187488, - "size": 4 - }, { "path": "backgroundCloud/gUnk_08121EB0.bin", "start": 1187504, diff --git a/data/const/object/object49.s b/data/const/object/object49.s deleted file mode 100644 index 956d0d24..00000000 --- a/data/const/object/object49.s +++ /dev/null @@ -1,31 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08121E5C:: @ 08121E5C - .4byte sub_0808F0B8 - .4byte sub_0808F1E0 - .4byte sub_0808F2C0 - .4byte sub_0808F370 - .4byte sub_0808F0B8 - .4byte sub_0808F3DC - .4byte sub_0808F3DC - .4byte sub_0808F3DC - .4byte sub_0808F3DC - .4byte sub_0808F498 - .4byte sub_0808F554 - -gUnk_08121E88:: @ 08121E88 - .4byte sub_0808F0D0 - .4byte sub_0808F14C - .4byte sub_0808F170 - .4byte sub_0808F1A4 - -gUnk_08121E98:: @ 08121E98 - .4byte sub_0808F1F8 - .4byte sub_0808F244 - -gUnk_08121EA0:: @ 08121EA0 - .incbin "object49/gUnk_08121EA0.bin" diff --git a/linker.ld b/linker.ld index 463fb3cd..82fa2941 100644 --- a/linker.ld +++ b/linker.ld @@ -1424,7 +1424,7 @@ SECTIONS { src/object/heartContainer.o(.rodata); src/object/fileScreenObjects.o(.rodata); data/animations/object/fileScreenObjects.o(.rodata); - data/const/object/object49.o(.rodata); + src/object/object49.o(.rodata); data/const/object/backgroundCloud.o(.rodata); src/object/object4B.o(.rodata); src/object/pushableFurniture.o(.rodata); diff --git a/src/object/object49.c b/src/object/object49.c index b67a7b86..7adbcc00 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -4,20 +4,36 @@ static void sub_0808F2B0(Entity*); void sub_0808F14C(Entity*); void sub_0808F244(Entity*); - -extern void sub_0808F5EC(Entity*); - -extern void (*const gUnk_08121E5C[])(Entity*); -extern void (*const gUnk_08121E88[])(Entity*); -extern void (*const gUnk_08121E98[])(Entity*); -extern const u16 gUnk_08121EA0[]; +void sub_0808F0B8(Entity*); +void sub_0808F1E0(Entity*); +void sub_0808F2C0(Entity*); +void sub_0808F370(Entity*); +void sub_0808F3DC(Entity*); +void sub_0808F498(Entity*); +void sub_0808F554(Entity*); +void sub_0808F0D0(Entity*); +void sub_0808F170(Entity*); +void sub_0808F1A4(Entity*); +void sub_0808F244(Entity*); +void sub_0808F1F8(Entity*); +void sub_0808F5EC(Entity*); void Object49(Entity* this) { - gUnk_08121E5C[this->type](this); + static void (*const typeFuncs[])(Entity*) = { + sub_0808F0B8, sub_0808F1E0, sub_0808F2C0, sub_0808F370, sub_0808F0B8, sub_0808F3DC, + sub_0808F3DC, sub_0808F3DC, sub_0808F3DC, sub_0808F498, sub_0808F554, + }; + typeFuncs[this->type](this); } void sub_0808F0B8(Entity* this) { - gUnk_08121E88[this->action](this); + static void (*const actionFuncs[])(Entity*) = { + sub_0808F0D0, + sub_0808F14C, + sub_0808F170, + sub_0808F1A4, + }; + actionFuncs[this->action](this); } void sub_0808F0D0(Entity* this) { @@ -80,7 +96,11 @@ void sub_0808F1A4(Entity* this) { } void sub_0808F1E0(Entity* this) { - gUnk_08121E98[this->action](this); + static void (*const actionFuncs[])(Entity*) = { + sub_0808F1F8, + sub_0808F244, + }; + actionFuncs[this->action](this); } void sub_0808F1F8(Entity* this) { @@ -143,6 +163,7 @@ void sub_0808F2C0(Entity* this) { } void sub_0808F370(Entity* this) { + static const u16 gUnk_08121EA0[] = { 0x1a4, 0x12c }; if (this->action == 0) { if (this->parent->subAction == 1) { this->action = 1;