From 8dd7d84cefaad631b966bda1cc35e7df6bd5ed4d Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Mon, 18 Apr 2022 00:00:59 +0300 Subject: [PATCH] Put const data in backgroundCloud --- assets/assets.json | 10 ---------- data/const/object/backgroundCloud.s | 16 ---------------- linker.ld | 2 +- src/object/backgroundCloud.c | 15 +++++++++++---- 4 files changed, 12 insertions(+), 31 deletions(-) delete mode 100644 data/const/object/backgroundCloud.s diff --git a/assets/assets.json b/assets/assets.json index 0337e58f..243eb377 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -42652,16 +42652,6 @@ "size": 31, "type": "animation" }, - { - "path": "backgroundCloud/gUnk_08121EB0.bin", - "start": 1187504, - "size": 3 - }, - { - "path": "backgroundCloud/gUnk_08121EB3.bin", - "start": 1187507, - "size": 5 - }, { "path": "furniture/gUnk_08122128.bin", "start": 1188136, diff --git a/data/const/object/backgroundCloud.s b/data/const/object/backgroundCloud.s deleted file mode 100644 index 4bb365bf..00000000 --- a/data/const/object/backgroundCloud.s +++ /dev/null @@ -1,16 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08121EA4:: @ 08121EA4 - .4byte sub_0808F658 - .4byte sub_0808F6E0 - .4byte sub_0808F70C - -gUnk_08121EB0:: @ 08121EB0 - .incbin "backgroundCloud/gUnk_08121EB0.bin" - -gUnk_08121EB3:: @ 08121EB3 - .incbin "backgroundCloud/gUnk_08121EB3.bin" diff --git a/linker.ld b/linker.ld index 82fa2941..48af070d 100644 --- a/linker.ld +++ b/linker.ld @@ -1425,7 +1425,7 @@ SECTIONS { src/object/fileScreenObjects.o(.rodata); data/animations/object/fileScreenObjects.o(.rodata); src/object/object49.o(.rodata); - data/const/object/backgroundCloud.o(.rodata); + src/object/backgroundCloud.o(.rodata); src/object/object4B.o(.rodata); src/object/pushableFurniture.o(.rodata); data/const/object/furniture.o(.rodata); diff --git a/src/object/backgroundCloud.c b/src/object/backgroundCloud.c index 617ce505..bd76632d 100644 --- a/src/object/backgroundCloud.c +++ b/src/object/backgroundCloud.c @@ -1,14 +1,20 @@ #include "object.h" -extern void (*const gUnk_08121EA4[])(Entity*); -extern const u8 gUnk_08121EB0[]; -extern const u8 gUnk_08121EB3[]; +void sub_0808F658(Entity*); +void sub_0808F6E0(Entity*); +void sub_0808F70C(Entity*); void BackgroundCloud(Entity* this) { - gUnk_08121EA4[this->action](this); + static void (*const actionFuncs[])(Entity*) = { + sub_0808F658, + sub_0808F6E0, + sub_0808F70C, + }; + actionFuncs[this->action](this); } void sub_0808F658(Entity* this) { + static const u8 gUnk_08121EB0[] = { 0x30, 0x28, 0x20 }; this->action = 1; this->spriteSettings.draw = 1; this->spriteOrientation.flipY = 3; @@ -33,6 +39,7 @@ void sub_0808F6E0(Entity* this) { } void sub_0808F70C(Entity* this) { + static const u8 gUnk_08121EB3[] = { 0x8, 0x28, 0x48, 0x98, 0 }; if (this->subAction == 0) { this->subAction = 1; this->timer = ((Random() & 7) << 3) + 31;