From 0ab1dec741fa0d671a2dd32457c6a95fbe37901b Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Thu, 21 Apr 2022 15:55:21 +0300 Subject: [PATCH] Put const data in townMinish --- assets/assets.json | 290 ---------------------------- data/const/npc/townMinish.s | 158 ---------------- linker.ld | 2 +- src/npc/townMinish.c | 363 ++++++++++++++++++++++++++++++++---- 4 files changed, 331 insertions(+), 482 deletions(-) delete mode 100644 data/const/npc/townMinish.s diff --git a/assets/assets.json b/assets/assets.json index 404c0f1b..2571a08d 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -38304,296 +38304,6 @@ "size": 5, "type": "animation" }, - { - "path": "townMinish/gUnk_081125F4.bin", - "start": 1123828, - "size": 128 - }, - { - "path": "townMinish/gUnk_08112674.bin", - "start": 1123956, - "size": 96 - }, - { - "path": "townMinish/gUnk_081126D4.bin", - "start": 1124052, - "size": 16 - }, - { - "path": "townMinish/gUnk_081126E4.bin", - "start": 1124068, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0.bin", - "start": 1124080, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_1.bin", - "start": 1124088, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_2.bin", - "start": 1124096, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_3.bin", - "start": 1124104, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_4.bin", - "start": 1124112, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_5.bin", - "start": 1124120, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_6.bin", - "start": 1124128, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_7.bin", - "start": 1124136, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_8.bin", - "start": 1124144, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_9.bin", - "start": 1124152, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_10.bin", - "start": 1124160, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_11.bin", - "start": 1124168, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_12.bin", - "start": 1124176, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_13.bin", - "start": 1124184, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_14.bin", - "start": 1124192, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_15.bin", - "start": 1124200, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_16.bin", - "start": 1124208, - "size": 324 - }, - { - "path": "townMinish/gUnk_081126F0_17.bin", - "start": 1124536, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_18.bin", - "start": 1124544, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_19.bin", - "start": 1124552, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_20.bin", - "start": 1124560, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_21.bin", - "start": 1124568, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_22.bin", - "start": 1124576, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_23.bin", - "start": 1124584, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_24.bin", - "start": 1124592, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_25.bin", - "start": 1124600, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_26.bin", - "start": 1124608, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_27.bin", - "start": 1124616, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_28.bin", - "start": 1124624, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_29.bin", - "start": 1124632, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_30.bin", - "start": 1124640, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_31.bin", - "start": 1124648, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_32.bin", - "start": 1124656, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_33.bin", - "start": 1124664, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_34.bin", - "start": 1124672, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_35.bin", - "start": 1124680, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_36.bin", - "start": 1124688, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_37.bin", - "start": 1124696, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_38.bin", - "start": 1124704, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_39.bin", - "start": 1124712, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_40.bin", - "start": 1124720, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_41.bin", - "start": 1124728, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_42.bin", - "start": 1124736, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_43.bin", - "start": 1124744, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_44.bin", - "start": 1124752, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_45.bin", - "start": 1124760, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_46.bin", - "start": 1124768, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_47.bin", - "start": 1124776, - "size": 4 - }, - { - "path": "townMinish/gUnk_081126F0_48.bin", - "start": 1124784, - "size": 576 - }, - { - "path": "townMinish/gUnk_08112C40.bin", - "start": 1125440, - "size": 10 - }, - { - "path": "townMinish/gUnk_08112C4A.bin", - "start": 1125450, - "size": 6 - }, - { - "path": "townMinish/gUnk_08112C50.bin", - "start": 1125456, - "size": 12 - }, - { - "path": "townMinish/gUnk_08112C5C.bin", - "start": 1125468, - "size": 4 - }, - { - "path": "townMinish/gUnk_08112C60.bin", - "start": 1125472, - "size": 8 - }, { "path": "animations/gSpriteAnimations_Librari_0.bin", "start": 1125722, diff --git a/data/const/npc/townMinish.s b/data/const/npc/townMinish.s deleted file mode 100644 index c7730ab1..00000000 --- a/data/const/npc/townMinish.s +++ /dev/null @@ -1,158 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081125F4:: @ 081125F4 - .incbin "townMinish/gUnk_081125F4.bin" - -gUnk_08112674:: @ 08112674 - .incbin "townMinish/gUnk_08112674.bin" - -gUnk_081126D4:: @ 081126D4 - .incbin "townMinish/gUnk_081126D4.bin" - -gUnk_081126E4:: @ 081126E4 - .incbin "townMinish/gUnk_081126E4.bin" - -gUnk_081126E8:: @ 081126E8 - .4byte sub_0806ABFC - .4byte sub_0806AC3C - -gUnk_081126F0:: @ 081126F0 - .incbin "townMinish/gUnk_081126F0.bin" - .4byte sub_0806B004 - .incbin "townMinish/gUnk_081126F0_1.bin" - .4byte sub_0806B004 - .incbin "townMinish/gUnk_081126F0_2.bin" - .4byte sub_0806B004 - .incbin "townMinish/gUnk_081126F0_3.bin" - .4byte sub_0806B004 - .incbin "townMinish/gUnk_081126F0_4.bin" - .4byte sub_0806B004 - .incbin "townMinish/gUnk_081126F0_5.bin" - .4byte sub_0806B004 - .incbin "townMinish/gUnk_081126F0_6.bin" - .4byte sub_0806B004 - .incbin "townMinish/gUnk_081126F0_7.bin" - .4byte sub_0806B004 - .incbin "townMinish/gUnk_081126F0_8.bin" - .4byte sub_0806B064 - .incbin "townMinish/gUnk_081126F0_9.bin" - .4byte sub_0806B064 - .incbin "townMinish/gUnk_081126F0_10.bin" - .4byte sub_0806B064 - .incbin "townMinish/gUnk_081126F0_11.bin" - .4byte sub_0806B064 - .incbin "townMinish/gUnk_081126F0_12.bin" - .4byte sub_0806B064 - .incbin "townMinish/gUnk_081126F0_13.bin" - .4byte sub_0806B064 - .incbin "townMinish/gUnk_081126F0_14.bin" - .4byte sub_0806B064 - .incbin "townMinish/gUnk_081126F0_15.bin" - .4byte sub_0806B064 - .incbin "townMinish/gUnk_081126F0_16.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_17.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_18.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_19.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_20.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_21.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_22.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_23.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_24.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_25.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_26.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_27.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_28.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_29.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_30.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_31.bin" - .4byte sub_0806B098 - .incbin "townMinish/gUnk_081126F0_32.bin" - .4byte sub_0806B0E0 - .incbin "townMinish/gUnk_081126F0_33.bin" - .4byte sub_0806B0E0 - .incbin "townMinish/gUnk_081126F0_34.bin" - .4byte sub_0806B0E0 - .incbin "townMinish/gUnk_081126F0_35.bin" - .4byte sub_0806B0E0 - .incbin "townMinish/gUnk_081126F0_36.bin" - .4byte sub_0806B0E0 - .incbin "townMinish/gUnk_081126F0_37.bin" - .4byte sub_0806B0E0 - .incbin "townMinish/gUnk_081126F0_38.bin" - .4byte sub_0806B0E0 - .incbin "townMinish/gUnk_081126F0_39.bin" - .4byte sub_0806B0E0 - .incbin "townMinish/gUnk_081126F0_40.bin" - .4byte sub_0806B134 - .incbin "townMinish/gUnk_081126F0_41.bin" - .4byte sub_0806B134 - .incbin "townMinish/gUnk_081126F0_42.bin" - .4byte sub_0806B134 - .incbin "townMinish/gUnk_081126F0_43.bin" - .4byte sub_0806B134 - .incbin "townMinish/gUnk_081126F0_44.bin" - .4byte sub_0806B134 - .incbin "townMinish/gUnk_081126F0_45.bin" - .4byte sub_0806B134 - .incbin "townMinish/gUnk_081126F0_46.bin" - .4byte sub_0806B134 - .incbin "townMinish/gUnk_081126F0_47.bin" - .4byte sub_0806B134 - .incbin "townMinish/gUnk_081126F0_48.bin" - -gUnk_08112BF0:: @ 08112BF0 - .4byte sub_0806B004 - .4byte sub_0806B064 - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806B098 - .4byte sub_0806B098 - .4byte sub_0806B0E0 - .4byte sub_0806B134 - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - .4byte sub_0806AFBC - -gUnk_08112C40:: @ 08112C40 - .incbin "townMinish/gUnk_08112C40.bin" - -gUnk_08112C4A:: @ 08112C4A - .incbin "townMinish/gUnk_08112C4A.bin" - -gUnk_08112C50:: @ 08112C50 - .incbin "townMinish/gUnk_08112C50.bin" - -gUnk_08112C5C:: @ 08112C5C - .incbin "townMinish/gUnk_08112C5C.bin" - -gUnk_08112C60:: @ 08112C60 - .incbin "townMinish/gUnk_08112C60.bin" - diff --git a/linker.ld b/linker.ld index f0f4bc20..0b57a0d3 100644 --- a/linker.ld +++ b/linker.ld @@ -1250,7 +1250,7 @@ SECTIONS { data/animations/npc/syrup.o(.rodata); src/npc/rem.o(.rodata); data/animations/npc/rem.o(.rodata); - data/const/npc/townMinish.o(.rodata); + src/npc/townMinish.o(.rodata); data/animations/npc/townMinish.o(.rodata); src/npc/librari.o(.rodata); data/animations/npc/librari.o(.rodata); diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index d8b01c3e..213fa8c7 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -5,27 +5,145 @@ #include "item.h" extern u32 sub_080B1AC8(u32, u32, u32); -extern void sub_0806ACC4(Entity*); -extern void sub_0806AEA8(Entity*); -extern void sub_0806AEE4(Entity*); -extern void sub_0806AFE8(Entity*, ScriptExecutionContext*); +void sub_0806ACC4(Entity*); +void sub_0806ABFC(Entity*); +void sub_0806AC3C(Entity*); +void sub_0806AEA8(Entity*); +void sub_0806AEE4(Entity*); +void sub_0806AFE8(Entity*, ScriptExecutionContext*); +void sub_0806B004(Entity*, ScriptExecutionContext*); +void sub_0806B098(Entity*, ScriptExecutionContext*); +void sub_0806B0E0(Entity*, ScriptExecutionContext*); +void sub_0806B064(Entity*, ScriptExecutionContext*); +void sub_0806B134(Entity*, ScriptExecutionContext*); -extern u8 gUnk_081125F4[12]; -extern SpriteLoadData gUnk_08112674[]; -extern u32 gUnk_081126D4[4]; -extern u8 gUnk_081126E4[4]; -extern void (*gUnk_081126E8[])(Entity*); -extern Dialog gUnk_081126F0[0x10]; -extern void (*gUnk_08112BF0[])(Entity*, ScriptExecutionContext*); -extern u16 gUnk_08112C40[5]; -extern u16 gUnk_08112C4A[3]; -extern u16 gUnk_08112C50[6]; -extern u16 gUnk_08112C5C[2]; -extern u16 gUnk_08112C60[4]; +static const u8 gUnk_081125F4[][0x10][2] = { + { + { 0x24, 0x1a }, + { 0x25, 0x1a }, + { 0x26, 0x1a }, + { 0x27, 0x9b }, + { 0x28, 0x9b }, + { 0x29, 0x9b }, + { 0x2a, 0x9b }, + { 0x2b, 0x98 }, + { 0x1c, 0x98 }, + { 0x1d, 0x98 }, + { 0x1e, 0x99 }, + { 0x1f, 0x99 }, + { 0x20, 0x99 }, + { 0x21, 0x99 }, + { 0x22, 0x1a }, + { 0x23, 0x1a }, + }, + { + { 0x24, 0x9a }, + { 0x25, 0x9a }, + { 0x26, 0x1b }, + { 0x27, 0x1b }, + { 0x28, 0x1b }, + { 0x29, 0x1b }, + { 0x2a, 0x1b }, + { 0x2b, 0x98 }, + { 0x1c, 0x98 }, + { 0x1d, 0x98 }, + { 0x1e, 0x98 }, + { 0x1f, 0x99 }, + { 0x20, 0x99 }, + { 0x21, 0x99 }, + { 0x22, 0x9a }, + { 0x23, 0x9a }, + }, + { + { 0x24, 0x9a }, + { 0x25, 0x9a }, + { 0x26, 0x9b }, + { 0x27, 0x9b }, + { 0x28, 0x9b }, + { 0x29, 0x9b }, + { 0x2a, 0x18 }, + { 0x2b, 0x18 }, + { 0x1c, 0x18 }, + { 0x1d, 0x18 }, + { 0x1e, 0x18 }, + { 0x1f, 0x99 }, + { 0x20, 0x99 }, + { 0x21, 0x99 }, + { 0x22, 0x99 }, + { 0x23, 0x9a }, + }, + { + { 0x24, 0x9a }, + { 0x25, 0x9a }, + { 0x26, 0x9a }, + { 0x27, 0x9b }, + { 0x28, 0x9b }, + { 0x29, 0x9b }, + { 0x2a, 0x98 }, + { 0x2b, 0x98 }, + { 0x1c, 0x98 }, + { 0x1d, 0x98 }, + { 0x1e, 0x19 }, + { 0x1f, 0x19 }, + { 0x20, 0x19 }, + { 0x21, 0x19 }, + { 0x22, 0x19 }, + { 0x23, 0x9a }, + }, +}; +static const SpriteLoadData gUnk_08112674[][4] = { + { + { 0xea, 0x1d, 0x4 }, + { 0x20ea, 0x1d, 0x4 }, + { 0x0, 0x0, 0x0 }, + { 0x0, 0x0, 0x0 }, + }, + { + { 0xea, 0x1d, 0x4 }, + { 0x20ea, 0x1d, 0x4 }, + { 0x0, 0x0, 0x0 }, + { 0x0, 0x0, 0x0 }, + }, + { + { 0xeb, 0x1d, 0x4 }, + { 0x20eb, 0x1d, 0x4 }, + { 0x0, 0x0, 0x0 }, + { 0x0, 0x0, 0x0 }, + }, + { + { 0xec, 0x1d, 0x4 }, + { 0x20ec, 0x1d, 0x4 }, + { 0x0, 0x0, 0x0 }, + { 0x0, 0x0, 0x0 }, + }, + { + { 0xed, 0x1d, 0x4 }, + { 0x20ed, 0x1d, 0x4 }, + { 0x0, 0x0, 0x0 }, + { 0x0, 0x0, 0x0 }, + }, + { + { 0xee, 0x1d, 0x4 }, + { 0x20ee, 0x1d, 0x4 }, + { 0x0, 0x0, 0x0 }, + { 0x0, 0x0, 0x0 }, + }, +}; +static const u8 gUnk_081126D4[][4] = { + { 0x0, 0x8, 0x8, 0x10 }, + { 0xf8, 0xfe, 0x10, 0x8 }, + { 0x0, 0x8, 0x8, 0x10 }, + { 0x8, 0xfe, 0x10, 0x8 }, +}; +static const u8 gUnk_081126E4[4] = { 14, 13, 11, 7 }; void TownMinish(Entity* this) { + static void (*const scriptedActionFuncs[])(Entity*) = { + sub_0806ABFC, + sub_0806AC3C, + }; if ((this->flags & ENT_SCRIPTED) == 0) { - gUnk_081126E8[this->action](this); + scriptedActionFuncs[this->action](this); sub_0806ED78(this); } else { sub_0806ACC4(this); @@ -33,7 +151,7 @@ void TownMinish(Entity* this) { } void sub_0806ABFC(Entity* this) { - SpriteLoadData* SpriteLoadData = &gUnk_08112674[this->type * 4]; + const SpriteLoadData* SpriteLoadData = gUnk_08112674[this->type]; if (!LoadExtraSpriteData(this, SpriteLoadData)) { return; } @@ -81,7 +199,7 @@ void sub_0806ACC4(Entity* this) { u8 delay; switch (this->action) { case 0: - if (LoadExtraSpriteData(this, &gUnk_08112674[this->type * 4]) == 0) + if (LoadExtraSpriteData(this, gUnk_08112674[this->type]) == 0) return; this->action = 1; @@ -110,7 +228,7 @@ void sub_0806ACC4(Entity* this) { } if (this->type == 1) { u8 idx = gPlayerEntity.animationState >> 1; - sub_08078850(this, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]); + sub_08078850(this, 1, gUnk_081126E4[idx], gUnk_081126D4[idx]); } } break; @@ -181,7 +299,7 @@ void sub_0806AED8(Entity* this) { void sub_0806AEE4(Entity* this) { int index; - u8* idx3; + const u8* idx3; u8 tmp1, tmp2; if (this->timer) { @@ -195,7 +313,7 @@ void sub_0806AEE4(Entity* this) { index = state * 8; } - idx3 = gUnk_081125F4 + (this->animationState / 2) * 0x20 + (index >> 1) * 2; + idx3 = gUnk_081125F4[this->animationState / 2][index >> 1]; tmp1 = idx3[0]; tmp2 = idx3[1]; @@ -233,20 +351,188 @@ void sub_0806AFA0(Entity* this) { } } -void sub_0806AFBC(Entity* this) { +void sub_0806AFBC(Entity* this, ScriptExecutionContext* context) { + //! @bug sub_0806B004 uses context but ShowNPCDialogue doesn't pass it. + // In fact r1 contains sub_0806B004's address. + static const Dialog dialogs[][8] = { { { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B004 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B004 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B004 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B004 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B004 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B004 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B004 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B004 } } }, + { { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B064 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B064 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B064 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B064 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B064 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B064 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B064 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B064 } } }, + { { 0x46, 0x4, 4, 1, { 0x4b0a, 0x4b04 } }, + { 0x46, 0x4, 4, 1, { 0x4b0a, 0x4b04 } }, + { 0x46, 0x4, 4, 1, { 0x4b0a, 0x4b04 } }, + { 0x46, 0x4, 4, 1, { 0x4b0a, 0x4b04 } }, + { 0x46, 0x4, 4, 1, { 0x4b0a, 0x4b04 } }, + { 0x46, 0x4, 4, 1, { 0x4b0a, 0x4b04 } }, + { 0x46, 0x4, 4, 1, { 0x4b0a, 0x4b04 } }, + { 0x46, 0x4, 4, 1, { 0x4b0a, 0x4b04 } } }, + { { 0x46, 0x4, 4, 1, { 0x4b07, 0x4b01 } }, + { 0x46, 0x4, 4, 1, { 0x4b07, 0x4b01 } }, + { 0x46, 0x4, 4, 1, { 0x4b07, 0x4b01 } }, + { 0x46, 0x4, 4, 1, { 0x4b07, 0x4b01 } }, + { 0x46, 0x4, 4, 1, { 0x4b07, 0x4b01 } }, + { 0x46, 0x4, 4, 1, { 0x4b07, 0x4b01 } }, + { 0x46, 0x4, 4, 1, { 0x4b07, 0x4b01 } }, + { 0x46, 0x4, 4, 1, { 0x4b07, 0x4b01 } } }, + { { 0x46, 0x4, 4, 1, { 0x4b08, 0x4b02 } }, + { 0x46, 0x4, 4, 1, { 0x4b08, 0x4b02 } }, + { 0x46, 0x4, 4, 1, { 0x4b08, 0x4b02 } }, + { 0x46, 0x4, 4, 1, { 0x4b08, 0x4b02 } }, + { 0x46, 0x4, 4, 1, { 0x4b08, 0x4b02 } }, + { 0x46, 0x4, 4, 1, { 0x4b08, 0x4b02 } }, + { 0x46, 0x4, 4, 1, { 0x4b08, 0x4b02 } }, + { 0x46, 0x4, 4, 1, { 0x4b08, 0x4b02 } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x4c05 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c05 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c05 } }, + { 0x46, 0x4, 4, 1, { 0x4c0a, 0x4c05 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c05 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c05 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c05 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c05 } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x4c06 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c06 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c06 } }, + { 0x46, 0x4, 4, 1, { 0x4c0b, 0x4c06 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c06 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c06 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c06 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4c06 } } }, + { { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } } }, + { { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B098 } } }, + { { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B0E0 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B0E0 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B0E0 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B0E0 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B0E0 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B0E0 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B0E0 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B0E0 } } }, + { { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B134 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B134 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B134 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B134 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B134 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B134 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B134 } }, + { 0x0, 0x0, 5, 0, { .func = (EntityActionPtr)sub_0806B134 } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x4e2f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e2f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e2f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e2f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e30 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e31 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e32 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4e33 } } }, + { { 0x0, 0x0, 3, 1, { 0x4f15, 0x4f14 } }, + { 0x0, 0x0, 3, 1, { 0x4f15, 0x4f14 } }, + { 0x0, 0x0, 3, 1, { 0x4f15, 0x4f14 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f22 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f2e } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f3a } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f3a } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f3a } } }, + { { 0x1, 0x0, 3, 1, { 0x4f17, 0x4f16 } }, + { 0x1, 0x0, 3, 1, { 0x4f17, 0x4f16 } }, + { 0x1, 0x0, 3, 1, { 0x4f17, 0x4f16 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f23 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f2f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f3b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f3b } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4f3b } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x4b0d } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b0d } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b0d } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b0d } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b11 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b11 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b15 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b15 } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x4b0e } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b0e } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b0e } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b0e } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b12 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b12 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b16 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b16 } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x4b0f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b0f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b0f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b0f } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b13 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b13 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b17 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b17 } } }, + { { 0x0, 0x0, 1, 1, { 0x0, 0x4b10 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b10 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b10 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b10 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b14 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b14 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b18 } }, + { 0x0, 0x0, 1, 1, { 0x0, 0x4b18 } } }, + { { 0x0, 0x0, 3, 1, { 0x4e26, 0x4e25 } }, + { 0x0, 0x0, 3, 1, { 0x4e26, 0x4e25 } }, + { 0x0, 0x0, 3, 1, { 0x4e26, 0x4e25 } }, + { 0x0, 0x0, 3, 1, { 0x4e26, 0x4e25 } }, + { 0x0, 0x0, 3, 1, { 0x4e26, 0x4e25 } }, + { 0x0, 0x0, 3, 1, { 0x4e26, 0x4e25 } }, + { 0x0, 0x0, 3, 1, { 0x4e26, 0x4e25 } }, + { 0x0, 0x0, 3, 1, { 0x4e26, 0x4e25 } } }, + { { 0x9c, 0x1, 2, 1, { 0x4e28, 0x4e27 } }, + { 0x9c, 0x1, 2, 1, { 0x4e28, 0x4e27 } }, + { 0x9c, 0x1, 2, 1, { 0x4e28, 0x4e27 } }, + { 0x9c, 0x1, 2, 1, { 0x4e28, 0x4e27 } }, + { 0x9c, 0x1, 2, 1, { 0x4e28, 0x4e27 } }, + { 0x9c, 0x1, 2, 1, { 0x4e28, 0x4e27 } }, + { 0x9c, 0x1, 2, 1, { 0x4e28, 0x4e27 } }, + { 0x9c, 0x1, 2, 1, { 0x4e28, 0x4e27 } } } }; int idx = gSave.global_progress - 2; if (idx < 0) idx = 0; - ShowNPCDialogue(this, gUnk_081126F0 + this->type2 * 8 + idx); + ShowNPCDialogue(this, &dialogs[this->type2][idx]); } void sub_0806AFE8(Entity* this, ScriptExecutionContext* context) { + static void (*const typeFuncs[])(Entity*, ScriptExecutionContext*) = { + sub_0806B004, sub_0806B064, sub_0806AFBC, sub_0806AFBC, sub_0806AFBC, sub_0806AFBC, sub_0806AFBC, + sub_0806B098, sub_0806B098, sub_0806B0E0, sub_0806B134, sub_0806AFBC, sub_0806AFBC, sub_0806AFBC, + sub_0806AFBC, sub_0806AFBC, sub_0806AFBC, sub_0806AFBC, sub_0806AFBC, sub_0806AFBC, + }; context->condition = 0; - gUnk_08112BF0[this->type2](this, context); + typeFuncs[this->type2](this, context); } void sub_0806B004(Entity* this, ScriptExecutionContext* context) { + static const u16 messageIndices[5] = { 0x4a11, 0x4a01, 0x4a03, 0x4a05, 0x4a13 }; int idx = 0; if (CheckGlobalFlag(MIZUKAKI_START)) { @@ -266,10 +552,15 @@ void sub_0806B004(Entity* this, ScriptExecutionContext* context) { SetLocalFlag(MIZUKAKI_KOBITO); } } - MessageNoOverlap(gUnk_08112C40[idx], this); + MessageNoOverlap(messageIndices[idx], this); } -void sub_0806B064(Entity* this) { +void sub_0806B064(Entity* this, ScriptExecutionContext* context) { + static const u16 messageIndices[3] = { + 0x4a09, + 0x4a0b, + 0x4a0c, + }; int idx = 0; if (CheckGlobalFlag(MIZUKAKI_START)) { @@ -278,10 +569,14 @@ void sub_0806B064(Entity* this) { idx = 2; } } - MessageNoOverlap(gUnk_08112C4A[idx], this); + MessageNoOverlap(messageIndices[idx], this); } -void sub_0806B098(Entity* this) { +void sub_0806B098(Entity* this, ScriptExecutionContext* context) { + static const u16 messageIndices[][3] = { + { 0x4b1f, 0x4b20, 0x4b21 }, + { 0x4b22, 0x4b23, 0x4b24 }, + }; int idx = 2; if (GetInventoryValue(ITEM_FLIPPERS) == 0) { @@ -292,10 +587,11 @@ void sub_0806B098(Entity* this) { } } } - MessageNoOverlap(gUnk_08112C50[(this->type2 - 7) * 3 + idx], this); + MessageNoOverlap(messageIndices[this->type2 - 7][idx], this); } -void sub_0806B0E0(Entity* this) { +void sub_0806B0E0(Entity* this, ScriptExecutionContext* context) { + static const u16 gUnk_08112C5C[2] = { 0x4b25, 0x4b26 }; int idx = 0; if (sub_080B1AC8(0x38, 0xb8, 1) == 0x57 && sub_080B1AC8(0x48, 0xb8, 1) == 0x57 && @@ -306,7 +602,8 @@ void sub_0806B0E0(Entity* this) { MessageNoOverlap(gUnk_08112C5C[idx], this); } -void sub_0806B134(Entity* this) { +void sub_0806B134(Entity* this, ScriptExecutionContext* context) { + static const u16 gUnk_08112C60[4] = { 0x4d0b, 0x4d0c, 0x4d0d, 0x4d0e }; int idx; if (GetInventoryValue(ITEM_POWER_BRACELETS)) { @@ -327,7 +624,7 @@ void sub_0806B134(Entity* this) { void TownMinish_Fusion(Entity* this) { if (this->action == 0) { - if (LoadExtraSpriteData(this, &gUnk_08112674[this->type * 4])) { + if (LoadExtraSpriteData(this, gUnk_08112674[this->type])) { this->action++; this->spriteSettings.draw = 1; InitializeAnimation(this, 6);