From e0f57b7acf2ac525d3bdc63fb12381b5de35eb96 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Apr 2022 14:33:06 +0300 Subject: [PATCH] Put const data in smallTownMinish --- assets/assets.json | 15 ------- data/const/npc/smallTownMinish.s | 14 ------- linker.ld | 2 +- src/npc/smallTownMinish.c | 69 ++++++++++++++++++++++++++++---- 4 files changed, 62 insertions(+), 38 deletions(-) delete mode 100644 data/const/npc/smallTownMinish.s diff --git a/assets/assets.json b/assets/assets.json index 5bd874b3..356e478a 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -39909,21 +39909,6 @@ "size": 5, "type": "animation" }, - { - "path": "smallTownMinish/gUnk_081142FC.bin", - "start": 1131260, - "size": 8 - }, - { - "path": "smallTownMinish/gUnk_08114304.bin", - "start": 1131268, - "size": 4 - }, - { - "path": "smallTownMinish/gUnk_08114308.bin", - "start": 1131272, - "size": 448 - }, { "path": "animations/gSpriteAnimations_HurdyGurdyMan_8.bin", "start": 1131836, diff --git a/data/const/npc/smallTownMinish.s b/data/const/npc/smallTownMinish.s deleted file mode 100644 index 2e75c5ba..00000000 --- a/data/const/npc/smallTownMinish.s +++ /dev/null @@ -1,14 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081142FC:: @ 081142FC - .incbin "smallTownMinish/gUnk_081142FC.bin" - -gUnk_08114304:: @ 08114304 - .incbin "smallTownMinish/gUnk_08114304.bin" - -gUnk_08114308:: @ 08114308 - .incbin "smallTownMinish/gUnk_08114308.bin" diff --git a/linker.ld b/linker.ld index 01c227d3..4a2bc997 100644 --- a/linker.ld +++ b/linker.ld @@ -1290,7 +1290,7 @@ SECTIONS { src/npc/clothesRack.o(.rodata); data/animations/npc/clothesRack.o(.rodata); src/npc/picolyteBottle.o(.rodata); - data/const/npc/smallTownMinish.o(.rodata); + src/npc/smallTownMinish.o(.rodata); data/animations/npc/smallTownMinish.o(.rodata); data/const/npc/hurdyGurdyMan.o(.rodata); data/animations/npc/hurdyGurdyMan.o(.rodata); diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index b9526d34..77f99193 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -6,17 +6,14 @@ #include "npc.h" #include "functions.h" -extern Hitbox gUnk_081142FC; -extern u32 gUnk_08114304; - -extern Dialog gUnk_08114308[]; - void SmallTownMinish(Entity* this) { + static const Hitbox gUnk_081142FC = { -2, 1, { 0, 0, 0, 0 }, 6, 6 }; + static const u8 gUnk_08114304[] = { -2, 1, 6, 6 }; if (this->action == 0) { this->action += 1; - this->hitbox = &gUnk_081142FC; + this->hitbox = (Hitbox*)&gUnk_081142FC; sub_0807DD50(this); - sub_08078850(this, 1, 0, &gUnk_08114304); + sub_08078850(this, 1, 0, gUnk_08114304); } else { sub_0807DD94(this, NULL); } @@ -28,9 +25,65 @@ void SmallTownMinish(Entity* this) { } void sub_0806E2DC(Entity* this) { + static const Dialog gUnk_08114308[][8] = { { { 0x0, 0x0, 1, 1, { 0x0, 0x3539 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3539 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3539 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3638 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3737 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3839 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x392c } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x392c } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x353a } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x353a } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x353a } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3639 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3738 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x383a } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x392d } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x392d } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x353b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x353b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x353b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x363a } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3739 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x383b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x392e } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x392e } } }, + { { 0x45, 0x4, 4, 1, { 0x363c, 0x363b } }, + { 0x45, 0x4, 4, 1, { 0x363c, 0x363b } }, + { 0x45, 0x4, 4, 1, { 0x363c, 0x363b } }, + { 0x45, 0x4, 4, 1, { 0x363c, 0x363b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x373a } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x383c } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x392f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x392f } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x373b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x373b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x373b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x373b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x373b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x383d } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3930 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x3930 } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x4e1c } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e1c } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e1c } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e1c } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e1c } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e1c } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e1c } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e1c } } }, + { { 0x45, 0x4, 4, 1, { 0x4e1e, 0x4e1d } }, + { 0x45, 0x4, 4, 1, { 0x4e1e, 0x4e1d } }, + { 0x45, 0x4, 4, 1, { 0x4e1e, 0x4e1d } }, + { 0x45, 0x4, 4, 1, { 0x4e1e, 0x4e1d } }, + { 0x45, 0x4, 4, 1, { 0x4e1e, 0x4e1d } }, + { 0x45, 0x4, 4, 1, { 0x4e1e, 0x4e1d } }, + { 0x45, 0x4, 4, 1, { 0x4e1e, 0x4e1d } }, + { 0x45, 0x4, 4, 1, { 0x4e1e, 0x4e1d } } } }; s32 dialog = gSave.global_progress - 2; if (dialog < 0) { dialog = 0; } - ShowNPCDialogue(this, gUnk_08114308 + this->type2 * 8 + dialog); + ShowNPCDialogue(this, &gUnk_08114308[this->type2][dialog]); }