From 878ad8878e4eace3ce5d76841bbbb6c9e5707a7d Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Fri, 15 Apr 2022 21:30:24 +0300 Subject: [PATCH] Put const data into ministerPotho --- assets/assets.json | 5 ----- data/const/npc/ministerPotho.s | 13 ------------- linker.ld | 2 +- src/npc/ministerPotho.c | 21 ++++++++++++++++----- 4 files changed, 17 insertions(+), 24 deletions(-) delete mode 100644 data/const/npc/ministerPotho.s diff --git a/assets/assets.json b/assets/assets.json index b0d0d362..f07c2224 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -37069,11 +37069,6 @@ "size": 38, "type": "animation" }, - { - "path": "ministerPotho/gUnk_08110650.bin", - "start": 1115728, - "size": 8 - }, { "path": "animations/gSpriteAnimations_Npc26_0.bin", "start": 1115880, diff --git a/data/const/npc/ministerPotho.s b/data/const/npc/ministerPotho.s deleted file mode 100644 index 767beb71..00000000 --- a/data/const/npc/ministerPotho.s +++ /dev/null @@ -1,13 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08110644:: @ 08110644 - .4byte sub_080667E4 - .4byte sub_08066808 - .4byte sub_0806685C - -gUnk_08110650:: @ 08110650 - .incbin "ministerPotho/gUnk_08110650.bin" diff --git a/linker.ld b/linker.ld index 9986bc6e..ecf901f2 100644 --- a/linker.ld +++ b/linker.ld @@ -1214,7 +1214,7 @@ SECTIONS { src/npc/npc23.o(.rodata); src/npc/kingDaltus.o(.rodata); data/animations/npc/kingDaltus.o(.rodata); - data/const/npc/ministerPotho.o(.rodata); + src/npc/ministerPotho.o(.rodata); data/animations/npc/ministerPotho.o(.rodata); src/npc/npc26.o(.rodata); data/animations/npc/npc26.o(.rodata); diff --git a/src/npc/ministerPotho.c b/src/npc/ministerPotho.c index f7c1652a..05da19f4 100644 --- a/src/npc/ministerPotho.c +++ b/src/npc/ministerPotho.c @@ -4,16 +4,21 @@ #include "npc.h" #include "item.h" -extern void (*const gUnk_08110644[])(Entity*); void sub_08066864(Entity*); - -extern u16 gUnk_08110650[]; +void sub_080667E4(Entity*); +void sub_08066808(Entity*); +void sub_0806685C(Entity*); void MinisterPotho(Entity* this) { + static void (*const actionFuncs[])(Entity*) = { + sub_080667E4, + sub_08066808, + sub_0806685C, + }; if ((this->flags & ENT_SCRIPTED) != 0) { sub_08066864(this); } else { - gUnk_08110644[this->action](this); + actionFuncs[this->action](this); sub_0806ED78(this); } } @@ -81,6 +86,12 @@ void sub_080668F0(Entity* this) { } void sub_08066904(Entity* this) { + static const u16 messageIndices[] = { + 0x105a, + 0x1327, + 0x132a, + 0x132f, + }; u32 index; if (CheckGlobalFlag(2) == 0) { index = 0; @@ -91,7 +102,7 @@ void sub_08066904(Entity* this) { } else { index = 3; } - MessageNoOverlap(gUnk_08110650[index], this); + MessageNoOverlap(messageIndices[index], this); } void MinisterPotho_Fusion(Entity* this) {