From 5aec68f2ef9f9fba76290068d197f695b13fd75d Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Apr 2022 19:58:38 +0300 Subject: [PATCH] Put const data in houseDoorExterior --- assets/assets.json | 5 ----- data/const/object/houseDoorExterior.s | 14 -------------- linker.ld | 2 +- src/object/houseDoorExterior.c | 18 +++++++++++++----- 4 files changed, 14 insertions(+), 25 deletions(-) delete mode 100644 data/const/object/houseDoorExterior.s diff --git a/assets/assets.json b/assets/assets.json index 402901aa..cdcbe84a 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -42006,11 +42006,6 @@ "size": 6, "type": "animation" }, - { - "path": "houseDoorExterior/gUnk_081206AC.bin", - "start": 1181356, - "size": 8 - }, { "path": "greatFairy/gUnk_0812079C.bin", "start": 1181596, diff --git a/data/const/object/houseDoorExterior.s b/data/const/object/houseDoorExterior.s deleted file mode 100644 index f1a0bb7d..00000000 --- a/data/const/object/houseDoorExterior.s +++ /dev/null @@ -1,14 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081206AC:: @ 081206AC - .incbin "houseDoorExterior/gUnk_081206AC.bin" - -gUnk_081206B4:: @ 081206B4 - .4byte sub_080866D8 - .4byte sub_080867E4 - .4byte sub_0808681C - .4byte sub_080868B0 diff --git a/linker.ld b/linker.ld index 6d594db6..1c1241c1 100644 --- a/linker.ld +++ b/linker.ld @@ -1358,7 +1358,7 @@ SECTIONS { src/object/object17.o(.rodata); data/const/object/evilSpirit.o(.rodata); data/animations/object/evilSpirit.o(.rodata); - data/const/object/houseDoorExterior.o(.rodata); + src/object/houseDoorExterior.o(.rodata); src/object/rupee.o(.rodata); src/object/greatFairy.o(.rodata); data/animations/npc/greatFairy.o(.rodata); diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 828497e4..80dcef12 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -26,13 +26,21 @@ typedef struct { static void sub_080868EC(Entity* entity, unk_80868EC* arg1); static bool32 sub_080867CC(u32); void sub_0808681C(Entity*); +void sub_080866D8(Entity*); +void sub_080867E4(Entity*); +void sub_080868B0(Entity*); static u8 sub_08086954(Entity*); -extern void (*const gUnk_081206B4[])(Entity*); -extern Hitbox gUnk_081206AC; // TODO: should be const +static const Hitbox gUnk_081206AC = { 0, -5, { 5, 3, 3, 5 }, 10, 4 }; void HouseDoorExterior(Entity* this) { - gUnk_081206B4[this->type2](this); + static void (*const typeFuncs[])(Entity*) = { + sub_080866D8, + sub_080867E4, + sub_0808681C, + sub_080868B0, + }; + typeFuncs[this->type2](this); } void sub_080866D8(Entity* this) { @@ -97,7 +105,7 @@ void sub_0808681C(Entity* this) { this->timer = 8; this->spriteSettings.draw = 1; this->frameIndex = 0; - this->hitbox = &gUnk_081206AC; + this->hitbox = (Hitbox*)&gUnk_081206AC; if (this->subAction == 1) { this->action = 2; this->frameIndex = 1; @@ -126,7 +134,7 @@ void sub_080868B0(Entity* this) { if (this->action == 0) { this->action = 1; this->spriteSettings.draw = 1; - this->hitbox = &gUnk_081206AC; + this->hitbox = (Hitbox*)&gUnk_081206AC; this->timer = 8; } ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh);