From 5c9f68877276294e82c57b21153806f8b27ac702 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Fri, 15 Apr 2022 21:27:25 +0300 Subject: [PATCH] Put const data into kingDaltus --- assets/assets.json | 5 ----- data/const/npc/kingDaltus.s | 18 ------------------ linker.ld | 2 +- src/npc/kingDaltus.c | 32 +++++++++++++++++++++++++------- 4 files changed, 26 insertions(+), 31 deletions(-) delete mode 100644 data/const/npc/kingDaltus.s diff --git a/assets/assets.json b/assets/assets.json index eaf50413..b0d0d362 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -37027,11 +37027,6 @@ "size": 39, "type": "animation" }, - { - "path": "kingDaltus/gUnk_081104F8.bin", - "start": 1115384, - "size": 8 - }, { "path": "animations/gSpriteAnimations_MinisterPotho_0.bin", "start": 1115736, diff --git a/data/const/npc/kingDaltus.s b/data/const/npc/kingDaltus.s deleted file mode 100644 index 4273aad1..00000000 --- a/data/const/npc/kingDaltus.s +++ /dev/null @@ -1,18 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081104E0:: @ 081104E0 - .4byte sub_08066654 - .4byte sub_08066688 - .4byte sub_080666DC - -gUnk_081104EC:: @ 081104EC - .4byte sub_080666E4 - .4byte sub_0806670C - .4byte sub_08066718 - -gUnk_081104F8:: @ 081104F8 - .incbin "kingDaltus/gUnk_081104F8.bin" diff --git a/linker.ld b/linker.ld index 11d61238..9986bc6e 100644 --- a/linker.ld +++ b/linker.ld @@ -1212,7 +1212,7 @@ SECTIONS { src/npc/smith.o(.rodata); data/animations/npc/smith.o(.rodata); src/npc/npc23.o(.rodata); - data/const/npc/kingDaltus.o(.rodata); + src/npc/kingDaltus.o(.rodata); data/animations/npc/kingDaltus.o(.rodata); data/const/npc/ministerPotho.o(.rodata); data/animations/npc/ministerPotho.o(.rodata); diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c index 076a78a9..401ba7d6 100644 --- a/src/npc/kingDaltus.c +++ b/src/npc/kingDaltus.c @@ -4,12 +4,24 @@ #include "npc.h" #include "item.h" -extern u16 gUnk_081104F8[]; - -extern void (*const gUnk_081104E0[])(Entity*); -extern void (*const gUnk_081104EC[])(Entity*); +void sub_08066654(Entity*); +void sub_08066688(Entity*); +void sub_080666DC(Entity*); +void sub_080666E4(Entity*); +void sub_0806670C(Entity*); +void sub_08066718(Entity*); void KingDaltus(Entity* this) { + static void (*const actionFuncs[])(Entity*) = { + sub_08066654, + sub_08066688, + sub_080666DC, + }; + static void (*const scriptedActionFuncs[])(Entity*) = { + sub_080666E4, + sub_0806670C, + sub_08066718, + }; if ((this->flags & ENT_SCRIPTED) != 0) { if (this->interactType == 2) { this->interactType = 0; @@ -17,9 +29,9 @@ void KingDaltus(Entity* this) { InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); sub_0806F118(this); } - gUnk_081104EC[this->action](this); + scriptedActionFuncs[this->action](this); } else { - gUnk_081104E0[this->action](this); + actionFuncs[this->action](this); sub_0806ED78(this); } } @@ -79,6 +91,12 @@ void sub_0806672C(Entity* this) { } void sub_0806673C(Entity* this) { + static const u16 messageIndices[] = { + 0x1058, + 0x1326, + 0x1329, + 0x132e, + }; u32 index; if (CheckGlobalFlag(2) == 0) { index = 0; @@ -89,7 +107,7 @@ void sub_0806673C(Entity* this) { } else { index = 3; } - MessageNoOverlap(gUnk_081104F8[index], this); + MessageNoOverlap(messageIndices[index], this); } void KingDaltus_Fusion(Entity* this) {