From 6047d2ec3e2233ddf813c41f08482f4aa1333b67 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Fri, 15 Apr 2022 21:48:44 +0300 Subject: [PATCH] Put const data into carpenter --- assets/assets.json | 15 --------------- data/const/npc/carpenter.s | 14 -------------- linker.ld | 2 +- src/npc/carpenter.c | 19 ++++++++++++------- 4 files changed, 13 insertions(+), 37 deletions(-) delete mode 100644 data/const/npc/carpenter.s diff --git a/assets/assets.json b/assets/assets.json index 7a351941..5f6d3734 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -37405,21 +37405,6 @@ "size": 5, "type": "animation" }, - { - "path": "carpenter/gUnk_08110CA8.bin", - "start": 1117352, - "size": 64 - }, - { - "path": "carpenter/gUnk_08110CE8.bin", - "start": 1117416, - "size": 24 - }, - { - "path": "carpenter/gUnk_08110D00.bin", - "start": 1117440, - "size": 8 - }, { "path": "animations/gSpriteAnimations_CastorWildsStatue_0.bin", "start": 1117852, diff --git a/data/const/npc/carpenter.s b/data/const/npc/carpenter.s deleted file mode 100644 index abe3d184..00000000 --- a/data/const/npc/carpenter.s +++ /dev/null @@ -1,14 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08110CA8:: @ 08110CA8 - .incbin "carpenter/gUnk_08110CA8.bin" - -gUnk_08110CE8:: @ 08110CE8 - .incbin "carpenter/gUnk_08110CE8.bin" - -gUnk_08110D00:: @ 08110D00 - .incbin "carpenter/gUnk_08110D00.bin" diff --git a/linker.ld b/linker.ld index fac0986a..00076aa9 100644 --- a/linker.ld +++ b/linker.ld @@ -1223,7 +1223,7 @@ SECTIONS { src/npc/zelda.o(.rodata); src/npc/mutoh.o(.rodata); data/animations/npc/mutoh.o(.rodata); - data/const/npc/carpenter.o(.rodata); + src/npc/carpenter.o(.rodata); data/animations/npc/carpenter.o(.rodata); data/const/npc/castorWildsStatue.o(.rodata); data/animations/npc/castorWildsStatue.o(.rodata); diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index eae33283..846c5d5a 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -4,11 +4,12 @@ #include "npc.h" #include "item.h" -extern SpriteLoadData gUnk_08110CA8[]; - -extern u16 gUnk_08110CE8[]; - -extern Dialog gUnk_08110D00; +static const SpriteLoadData gUnk_08110CA8[] = { + { 0x51, 0x3f, 0x4 }, { 0x1451, 0x3f, 0x4 }, { 0x4001, 0x3f, 0x4 }, { 0, 0, 0 }, + { 0x51, 0x3f, 0x4 }, { 0x1451, 0x3f, 0x4 }, { 0x4001, 0x3f, 0x4 }, { 0, 0, 0 }, + { 0x51, 0x3f, 0x4 }, { 0x1451, 0x3f, 0x4 }, { 0, 0, 0 }, { 0, 0, 0 }, + { 0x51, 0x3f, 0x4 }, { 0x1451, 0x3f, 0x4 }, { 0, 0, 0 }, { 0, 0, 0 }, +}; void Carpenter(Entity* this) { if (*(u32*)&this->cutsceneBeh == 0) { @@ -67,6 +68,9 @@ void sub_080672B0(Entity* this, ScriptExecutionContext* context) { } void sub_080672C8(Entity* this) { + static const u16 messageIndices[] = { + 0x1b0d, 0x1b0e, 0x0, 0x1b18, 0x1b19, 0x0, 0x1b23, 0x1b23, 0x0, 0x1b26, 0x1b26, 0x0, + }; u32 dialog = 0; u32 tmp; if (GetInventoryValue(ITEM_GUST_JAR) == 0) { @@ -74,11 +78,12 @@ void sub_080672C8(Entity* this) { dialog = 1; } } - MessageNoOverlap(gUnk_08110CE8[(dialog * 2 + this->type * 6) / 2], this); + MessageNoOverlap(messageIndices[(dialog * 2 + this->type * 6) / 2], this); } void sub_08067304(Entity* this) { - ShowNPCDialogue(this, &gUnk_08110D00); + static const Dialog dialog = { 0xb, 3, 4, 1, { 0x3642, 0x3641 } }; + ShowNPCDialogue(this, &dialog); } void sub_08067314(Entity* this) {