diff --git a/assets/assets.json b/assets/assets.json index b72b0d71..c5b10da5 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -39030,11 +39030,6 @@ "size": 17, "type": "animation" }, - { - "path": "librarians/gUnk_08113078.bin", - "start": 1126520, - "size": 6 - }, { "path": "animations/gSpriteAnimations_Farmers_0_0.bin", "start": 1126760, @@ -39083,16 +39078,6 @@ "size": 5, "type": "animation" }, - { - "path": "farmers/gUnk_08113140.bin", - "start": 1126720, - "size": 24 - }, - { - "path": "farmers/gUnk_08113158.bin", - "start": 1126744, - "size": 16 - }, { "path": "animations/gSpriteAnimations_Carlov_0_0.bin", "start": 1127000, @@ -39141,16 +39126,6 @@ "size": 9, "type": "animation" }, - { - "path": "dampe/gUnk_08113344.bin", - "start": 1127236, - "size": 6 - }, - { - "path": "dampe/gUnk_0811334A.bin", - "start": 1127242, - "size": 6 - }, { "path": "animations/gSpriteAnimations_DrLeft_0.bin", "start": 1127352, @@ -39199,16 +39174,6 @@ "size": 65, "type": "animation" }, - { - "path": "drLeft/gUnk_081133A4.bin", - "start": 1127332, - "size": 16 - }, - { - "path": "drLeft/gUnk_081133B4.bin", - "start": 1127348, - "size": 4 - }, { "path": "animations/gSpriteAnimations_KingGustaf_0.bin", "start": 1127636, @@ -39377,16 +39342,6 @@ "size": 8, "type": "animation" }, - { - "path": "mama/gUnk_08113754.bin", - "start": 1128276, - "size": 12 - }, - { - "path": "mama/gUnk_08113760.bin", - "start": 1128288, - "size": 80 - }, { "path": "animations/gSpriteAnimations_Emma_0.bin", "start": 1128668, @@ -39417,16 +39372,6 @@ "size": 30, "type": "animation" }, - { - "path": "teachers/gUnk_08113910.bin", - "start": 1128720, - "size": 32 - }, - { - "path": "teachers/gUnk_08113930.bin", - "start": 1128752, - "size": 128 - }, { "path": "animations/gSpriteAnimations_WindTribespeople_0_0.bin", "start": 1129279, @@ -39821,11 +39766,6 @@ "size": 7, "type": "animation" }, - { - "path": "gregal/gUnk_08113D84.bin", - "start": 1129860, - "size": 8 - }, { "path": "animations/gSpriteAnimations_MayorHagen_0.bin", "start": 1130432, @@ -39892,31 +39832,6 @@ "size": 14, "type": "animation" }, - { - "path": "mayorHagen/gUnk_08113F44.bin", - "start": 1130308, - "size": 4 - }, - { - "path": "mayorHagen/gUnk_08113F48.bin", - "start": 1130312, - "size": 120 - }, - { - "path": "bigGoron/gUnk_081140CC.bin", - "start": 1130700, - "size": 8 - }, - { - "path": "bigGoron/gUnk_08114100.bin", - "start": 1130752, - "size": 4 - }, - { - "path": "bigGoron/gUnk_08114104.bin", - "start": 1130756, - "size": 48 - }, { "offsets": { "EU": -2232 @@ -39994,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, @@ -40045,21 +39945,6 @@ "size": 7, "type": "animation" }, - { - "path": "hurdyGurdyMan/gUnk_081144F0.bin", - "start": 1131760, - "size": 12 - }, - { - "path": "hurdyGurdyMan/gUnk_081144FC.bin", - "start": 1131772, - "size": 64 - }, - { - "path": "phonograph/gUnk_081145E4.bin", - "start": 1132004, - "size": 212 - }, { "path": "npc58/gUnk_081146B8.bin", "start": 1132216, diff --git a/data/const/npc/bigGoron.s b/data/const/npc/bigGoron.s deleted file mode 100644 index ec61b7d5..00000000 --- a/data/const/npc/bigGoron.s +++ /dev/null @@ -1,27 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081140CC:: @ 081140CC - .incbin "bigGoron/gUnk_081140CC.bin" - -gUnk_081140D4:: @ 081140D4 - .4byte sub_0806CF30 - .4byte sub_0806D1D0 - .4byte sub_0806D274 - .4byte sub_0806D348 - .4byte sub_0806D3C0 - .4byte sub_0806D41C - .4byte sub_0806D4F0 - .4byte sub_0806D4FC - .4byte sub_0806D508 - .4byte sub_0806D514 - .4byte sub_0806D40C - -gUnk_08114100:: @ 08114100 - .incbin "bigGoron/gUnk_08114100.bin" - -gUnk_08114104:: @ 08114104 - .incbin "bigGoron/gUnk_08114104.bin" diff --git a/data/const/npc/clothesRack.s b/data/const/npc/clothesRack.s deleted file mode 100644 index c9157cd7..00000000 --- a/data/const/npc/clothesRack.s +++ /dev/null @@ -1,9 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_0811423C:: @ 0811423C - .4byte sub_0806DD90 - .4byte sub_0806DEC8 diff --git a/data/const/npc/dampe.s b/data/const/npc/dampe.s deleted file mode 100644 index 4405c9cd..00000000 --- a/data/const/npc/dampe.s +++ /dev/null @@ -1,11 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08113344:: @ 08113344 - .incbin "dampe/gUnk_08113344.bin" - -gUnk_0811334A:: @ 0811334A - .incbin "dampe/gUnk_0811334A.bin" diff --git a/data/const/npc/drLeft.s b/data/const/npc/drLeft.s deleted file mode 100644 index 44da66f9..00000000 --- a/data/const/npc/drLeft.s +++ /dev/null @@ -1,11 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081133A4:: @ 081133A4 - .incbin "drLeft/gUnk_081133A4.bin" - -gUnk_081133B4:: @ 081133B4 - .incbin "drLeft/gUnk_081133B4.bin" diff --git a/data/const/npc/farmers.s b/data/const/npc/farmers.s deleted file mode 100644 index 459c789c..00000000 --- a/data/const/npc/farmers.s +++ /dev/null @@ -1,11 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08113140:: @ 08113140 - .incbin "farmers/gUnk_08113140.bin" - -gUnk_08113158:: @ 08113158 - .incbin "farmers/gUnk_08113158.bin" diff --git a/data/const/npc/gregal.s b/data/const/npc/gregal.s deleted file mode 100644 index 0ffb2446..00000000 --- a/data/const/npc/gregal.s +++ /dev/null @@ -1,14 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08113D84:: @ 08113D84 - .incbin "gregal/gUnk_08113D84.bin" - -gUnk_08113D8C:: @ 08113D8C - .4byte sub_0806CAF4 - .4byte sub_0806CB80 - .4byte sub_0806CBB4 - .4byte sub_0806CC08 diff --git a/data/const/npc/hurdyGurdyMan.s b/data/const/npc/hurdyGurdyMan.s deleted file mode 100644 index e72fb275..00000000 --- a/data/const/npc/hurdyGurdyMan.s +++ /dev/null @@ -1,11 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081144F0:: @ 081144F0 - .incbin "hurdyGurdyMan/gUnk_081144F0.bin" - -gUnk_081144FC:: @ 081144FC - .incbin "hurdyGurdyMan/gUnk_081144FC.bin" diff --git a/data/const/npc/librarians.s b/data/const/npc/librarians.s deleted file mode 100644 index 5d8a519d..00000000 --- a/data/const/npc/librarians.s +++ /dev/null @@ -1,9 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08113078:: @ 08113078 - .incbin "librarians/gUnk_08113078.bin" - diff --git a/data/const/npc/mama.s b/data/const/npc/mama.s deleted file mode 100644 index 4d0fcbe5..00000000 --- a/data/const/npc/mama.s +++ /dev/null @@ -1,11 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08113754:: @ 08113754 - .incbin "mama/gUnk_08113754.bin" - -gUnk_08113760:: @ 08113760 - .incbin "mama/gUnk_08113760.bin" diff --git a/data/const/npc/mayorHagen.s b/data/const/npc/mayorHagen.s deleted file mode 100644 index f978b008..00000000 --- a/data/const/npc/mayorHagen.s +++ /dev/null @@ -1,11 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08113F44:: @ 08113F44 - .incbin "mayorHagen/gUnk_08113F44.bin" - -gUnk_08113F48:: @ 08113F48 - .incbin "mayorHagen/gUnk_08113F48.bin" diff --git a/data/const/npc/phonograph.s b/data/const/npc/phonograph.s deleted file mode 100644 index daec8b24..00000000 --- a/data/const/npc/phonograph.s +++ /dev/null @@ -1,8 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081145E4:: @ 081145E4 - .incbin "phonograph/gUnk_081145E4.bin" 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/data/const/npc/teachers.s b/data/const/npc/teachers.s deleted file mode 100644 index 9f804ea5..00000000 --- a/data/const/npc/teachers.s +++ /dev/null @@ -1,11 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08113910:: @ 08113910 - .incbin "teachers/gUnk_08113910.bin" - -gUnk_08113930:: @ 08113930 - .incbin "teachers/gUnk_08113930.bin" diff --git a/linker.ld b/linker.ld index a1f97104..fdd4f88f 100644 --- a/linker.ld +++ b/linker.ld @@ -1258,45 +1258,45 @@ SECTIONS { src/npc/vaatiReborn.o(.rodata); data/animations/npc/vaatiReborn.o(.rodata); data/animations/npc/moblinLady.o(.rodata); - data/const/npc/librarians.o(.rodata); + src/npc/librarians.o(.rodata); data/animations/npc/librarians.o(.rodata); - data/const/npc/farmers.o(.rodata); + src/npc/farmers.o(.rodata); data/animations/npc/farmers.o(.rodata); data/animations/npc/carlov.o(.rodata); - data/const/npc/dampe.o(.rodata); + src/npc/dampe.o(.rodata); data/animations/npc/dampe.o(.rodata); - data/const/npc/drLeft.o(.rodata); + src/npc/drLeft.o(.rodata); data/animations/npc/drLeft.o(.rodata); data/animations/npc/kingGustaf.o(.rodata); data/animations/npc/gina.o(.rodata); data/animations/npc/simon.o(.rodata); data/animations/npc/anju.o(.rodata); - data/const/npc/mama.o(.rodata); + src/npc/mama.o(.rodata); data/animations/npc/mama.o(.rodata); data/animations/npc/emma.o(.rodata); - data/const/npc/teachers.o(.rodata); + src/npc/teachers.o(.rodata); data/animations/npc/teachers.o(.rodata); data/const/npc/windTribespeople.o(.rodata); data/animations/npc/windTribespeople.o(.rodata); - data/const/npc/gregal.o(.rodata); + src/npc/gregal.o(.rodata); data/animations/npc/gregal.o(.rodata); - data/const/npc/mayorHagen.o(.rodata); + src/npc/mayorHagen.o(.rodata); data/animations/npc/mayorHagen.o(.rodata); - data/const/npc/bigGoron.o(.rodata); + src/npc/bigGoron.o(.rodata); src/npc/ezlo.o(.rodata); src/npc/npc4E.o(.rodata); src/npc/npc4F.o(.rodata); data/animations/npc/npc4F.o(.rodata); - data/const/npc/clothesRack.o(.rodata); + 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); + src/npc/hurdyGurdyMan.o(.rodata); data/animations/npc/hurdyGurdyMan.o(.rodata); src/npc/cucco.o(.rodata); src/npc/cuccoChick.o(.rodata); - data/const/npc/phonograph.o(.rodata); + src/npc/phonograph.o(.rodata); data/const/npc/npc58.o(.rodata); src/npcDefinitions.o(.rodata); data/data_081146D0.o(.rodata); diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 7f75c55b..d121a62a 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -4,12 +4,28 @@ #include "hitbox.h" #include "item.h" -extern void (*gUnk_081140D4[])(Entity*); -extern u16 gUnk_081140CC[]; +static const u16 goronSounds[] = { + SFX_VO_GORON1, + SFX_VO_GORON2, + SFX_VO_GORON3, + SFX_VO_GORON4, +}; + extern u8 gMapDataTopSpecial[]; void sub_0806D520(Entity*, u32); -void sub_0806D41C(Entity* this); +void sub_0806D41C(Entity*); +void sub_0806CF30(Entity*); +void sub_0806D1D0(Entity*); +void sub_0806D274(Entity*); +void sub_0806D348(Entity*); +void sub_0806D3C0(Entity*); +void sub_0806D41C(Entity*); +void sub_0806D4F0(Entity*); +void sub_0806D4FC(Entity*); +void sub_0806D508(Entity*); +void sub_0806D514(Entity*); +void sub_0806D40C(Entity*); static void sub_0806D02C(Entity* this); @@ -33,8 +49,6 @@ Entity* sub_0806D00C(Entity* this); void sub_0806D4C0(Entity*, u32); -extern const u8 gUnk_08114100[]; - typedef struct { s8 type; s8 x; @@ -42,10 +56,12 @@ typedef struct { u8 direction; } struct_08114104; -extern const struct_08114104 gUnk_08114104[]; - void BigGoron(Entity* this) { - gUnk_081140D4[this->type](this); + static void (*const typeFunctions[])(Entity*) = { + sub_0806CF30, sub_0806D1D0, sub_0806D274, sub_0806D348, sub_0806D3C0, sub_0806D41C, + sub_0806D4F0, sub_0806D4FC, sub_0806D508, sub_0806D514, sub_0806D40C, + }; + typeFunctions[this->type](this); } void sub_0806CF30(Entity* this) { @@ -76,7 +92,7 @@ void sub_0806CF30(Entity* this) { case 2: if (--this->timer == 0) { u32 uVar2 = Random(); - SoundReq(gUnk_081140CC[uVar2 % 4]); + SoundReq(goronSounds[uVar2 % 4]); this->timer = ((u8)uVar2 & 7) * 16; this->timer += 128; } @@ -341,6 +357,12 @@ void sub_0806D514(Entity* this) { } void sub_0806D520(Entity* this, u32 param_2) { + static const u8 gUnk_08114100[] = { + 10, + 7, + 4, + 1, + }; if (this->action == 0) { this->action = 1; this->subtimer = gUnk_08114100[param_2] + 6; @@ -420,6 +442,14 @@ void sub_0806D66C(Entity* this) { } void sub_0806D67C(Entity* this) { + static const struct_08114104 gUnk_08114104[] = { + { FX_WHITE_PUFF, 0x30, 0x20, 0xa }, { FX_WHITE_PUFF, 0x2c, 0x24, 0xb }, + { FX_WHITE_PUFF, 0x28, 0x28, 0xc }, { FX_WHITE_PUFF, 0x20, 0x28, 0x10 }, + { FX_WHITE_PUFF, 0x10, 0x28, 0x10 }, { FX_WHITE_PUFF, 0x0, 0x28, 0x10 }, + { FX_WHITE_PUFF, -0x10, 0x28, 0x10 }, { FX_WHITE_PUFF, -0x20, 0x28, 0x10 }, + { FX_WHITE_PUFF, -0x28, 0x28, 0x14 }, { FX_WHITE_PUFF, -0x2C, 0x24, 0x15 }, + { FX_WHITE_PUFF, -0x30, 0x20, 0x16 }, { -1, 0, 0, 0 }, + }; const struct_08114104* ptr = gUnk_08114104; while (ptr->type != -1) { Entity* effect = CreateFx(this, ptr->type, 0x40); diff --git a/src/npc/clothesRack.c b/src/npc/clothesRack.c index 5c6c0831..883999f8 100644 --- a/src/npc/clothesRack.c +++ b/src/npc/clothesRack.c @@ -1,9 +1,14 @@ #include "npc.h" -extern void (*gUnk_0811423C[])(Entity*); +void sub_0806DD90(Entity*); +void sub_0806DEC8(Entity*); void ClothesRack(Entity* this) { - gUnk_0811423C[this->action](this); + static void (*const actionFuncs[])(Entity*) = { + sub_0806DD90, + sub_0806DEC8, + }; + actionFuncs[this->action](this); } void sub_0806DD90(Entity* this) { diff --git a/src/npc/dampe.c b/src/npc/dampe.c index cd6ee87c..a058d42d 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -7,9 +7,6 @@ #include "npc.h" #include "item.h" -extern u16 gUnk_08113344[]; -extern u16 gUnk_0811334A[]; - void Dampe(Entity* this) { switch (this->action) { case 0: @@ -52,6 +49,11 @@ void Dampe_Fusion(Entity* this) { } void sub_0806BE84(Entity* this, ScriptExecutionContext* context) { + static const u16 messageIndices[] = { + 0x2801, + 0x2808, + 0x2804, + }; u32 msgIndex; context->condition = 0; @@ -65,10 +67,15 @@ void sub_0806BE84(Entity* this, ScriptExecutionContext* context) { if (GetInventoryValue(ITEM_QST_GRAVEYARD_KEY) >= 2) { msgIndex = 2; } - MessageNoOverlap(gUnk_08113344[msgIndex], this); + MessageNoOverlap(messageIndices[msgIndex], this); } void sub_0806BEC8(Entity* this, ScriptExecutionContext* context) { + static const u16 messageIndices[] = { + 0x2802, + 0x2803, + 0x2804, + }; u32 hasGraveyardKey; u32 msgIndex; @@ -82,7 +89,7 @@ void sub_0806BEC8(Entity* this, ScriptExecutionContext* context) { msgIndex = 2; } - MessageNoOverlap(gUnk_0811334A[msgIndex], this); + MessageNoOverlap(messageIndices[msgIndex], this); } void sub_0806BEFC(void) { diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index ba3005a6..28ae056d 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -2,12 +2,8 @@ #include "functions.h" #include "item.h" -extern u32 gUnk_081133B4; - void sub_0806BFD8(Entity* this); -extern u16 gUnk_081133A4[]; - void DrLeft(Entity* this) { if (this->type == 0) { if (this->action == 0) { @@ -52,6 +48,9 @@ void sub_0806C028(Entity* this, ScriptExecutionContext* context) { } void sub_0806C038(Entity* this) { + static const u16 messageIndices[] = { + 0x4d07, 0x4d08, 0x4d09, 0x4d0a, 0x4d0a, 0x4d05, 0x4d06, 0x4d0f, + }; s32 index; index = gSave.global_progress - 5; @@ -72,9 +71,15 @@ void sub_0806C038(Entity* this) { } } } - MessageNoOverlap(gUnk_081133A4[index], this); + MessageNoOverlap(messageIndices[index], this); } void sub_0806C09C(Entity* this) { + static const u8 gUnk_081133B4[] = { + 0, + 6, + 8, + 12, + }; sub_08078850(this, 1, 0, &gUnk_081133B4); } diff --git a/src/npc/farmers.c b/src/npc/farmers.c index 1066168b..7b1c4def 100644 --- a/src/npc/farmers.c +++ b/src/npc/farmers.c @@ -3,9 +3,10 @@ #include "functions.h" #include "npc.h" -extern Dialog gUnk_08113158[]; +static const SpriteLoadData gUnk_08113140[] = { + { 0xf7, 0x48, 0x4 }, { 0x40f7, 0x48, 0x4 }, { 0, 0, 0 }, { 0xf8, 0x49, 0x4 }, { 0x40f8, 0x49, 0x4 }, { 0, 0, 0 }, +}; -extern SpriteLoadData gUnk_08113140[]; void sub_0806BC58(Entity* this); void Farmers(Entity* this) { @@ -63,6 +64,10 @@ void sub_0806BCD4(Entity* this) { } void sub_0806BCE8(Entity* this) { + static const Dialog gUnk_08113158[] = { + { 0x29, 3, 4, 1, { 0x1a07, 0x1a02 } }, + { 0x29, 3, 4, 1, { 0x1a11, 0x1a0d } }, + }; ShowNPCDialogue(this, &gUnk_08113158[this->type]); } diff --git a/src/npc/gregal.c b/src/npc/gregal.c index 7dfd3ada..66ca8b4b 100644 --- a/src/npc/gregal.c +++ b/src/npc/gregal.c @@ -3,12 +3,24 @@ #include "functions.h" #include "npc.h" -extern void (*gUnk_08113D8C[])(Entity*); +static const u32 gUnk_08113D84[] = { + 0x100c0200, + 0x4, +}; -extern u32 gUnk_08113D84[]; +void sub_0806CAF4(Entity*); +void sub_0806CB80(Entity*); +void sub_0806CBB4(Entity*); +void sub_0806CC08(Entity*); void Gregal(Entity* this) { - gUnk_08113D8C[this->type](this); + static void (*const actionFuncs[])(Entity*) = { + sub_0806CAF4, + sub_0806CB80, + sub_0806CBB4, + sub_0806CC08, + }; + actionFuncs[this->type](this); } void sub_0806CAF4(Entity* this) { diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c index b36176cb..a9a848bb 100644 --- a/src/npc/hurdyGurdyMan.c +++ b/src/npc/hurdyGurdyMan.c @@ -3,9 +3,7 @@ #include "save.h" #include "npc.h" -extern Dialog gUnk_081144FC[]; - -extern SpriteLoadData gUnk_081144F0; +static const SpriteLoadData gUnk_081144F0[] = { { 0x163, 0x59, 0x4 }, { 0x4163, 0x59, 0x4 }, { 0, 0, 0 } }; extern u16* gUnk_08001A7C[]; @@ -15,7 +13,7 @@ void HurdyGurdyMan(Entity* this) { switch (this->action) { case 0: - if (LoadExtraSpriteData(this, &gUnk_081144F0) != 0) { + if (LoadExtraSpriteData(this, gUnk_081144F0) != 0) { this->action = 1; this->field_0x68.HALF.HI = 0; SetDefaultPriority(this, PRIO_MESSAGE); @@ -33,7 +31,7 @@ void HurdyGurdyMan(Entity* this) { if (this->field_0x68.HALF.LO == 0x32) { pointerToArray = pointerToArray + 3; } - sub_0801DFB4(this, (u32)*pointerToArray, (u32)pointerToArray[1], (u32)pointerToArray[2]); + sub_0801DFB4(this, *pointerToArray, pointerToArray[1], (u32)pointerToArray[2]); gPlayerState.controlMode = CONTROL_DISABLED; } else { sub_0807DD94(this, NULL); @@ -50,18 +48,24 @@ void HurdyGurdyMan(Entity* this) { } void HurdyGurdyMan_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, (this->frame & 0xffffff7f) + 8); + SetExtraSpriteFrame(this, 0, (this->frame & ~ANIM_DONE) + 8); SetExtraSpriteFrame(this, 1, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); } void sub_0806E418(Entity* this) { + static const Dialog dialogs[] = { + { 0x59, 0x1, 3, 1, { 0x4f52, 0x4f51 } }, { 0x59, 0x1, 3, 1, { 0x4f52, 0x4f51 } }, + { 0x59, 0x1, 3, 1, { 0x4f54, 0x4f53 } }, { 0x59, 0x1, 3, 1, { 0x4f56, 0x4f55 } }, + { 0x59, 0x1, 3, 1, { 0x4f58, 0x4f57 } }, { 0x59, 0x1, 3, 1, { 0x4f5a, 0x4f59 } }, + { 0x59, 0x1, 3, 1, { 0x4f5c, 0x4f5b } }, { 0x59, 0x1, 3, 1, { 0x4f5e, 0x4f5d } } + }; s32 tmp = gSave.global_progress - 2; if (tmp < 0) { tmp = 0; } - ShowNPCDialogue(this, &gUnk_081144FC[tmp]); + ShowNPCDialogue(this, &dialogs[tmp]); } void sub_0806E440(Entity* this) { @@ -73,7 +77,7 @@ void HurdyGurdyMan_Fusion(Entity* this) { u32 uVar1; if (this->action == 0) { - uVar1 = LoadExtraSpriteData(this, &gUnk_081144F0); + uVar1 = LoadExtraSpriteData(this, gUnk_081144F0); if (uVar1 != 0) { this->action += 1; this->spriteSettings.draw = 1; diff --git a/src/npc/librarians.c b/src/npc/librarians.c index c2e3ddc9..90b8631a 100644 --- a/src/npc/librarians.c +++ b/src/npc/librarians.c @@ -6,8 +6,6 @@ #include "sound.h" #include "item.h" -extern u16 gUnk_08113078[]; - extern void sub_08095BE0(Entity*, u32); extern const u8 gUnk_08114F30[]; @@ -106,6 +104,11 @@ void sub_0806BB7C(Entity* this, ScriptExecutionContext* context) { } void sub_0806BBB0(Entity* this) { + static const u16 messageIndices[] = { + 0x490f, + 0x4910, + 0x4912, + }; u32 tmp; if (GetInventoryValue(ITEM_FLIPPERS) == 0) { @@ -117,5 +120,5 @@ void sub_0806BBB0(Entity* this) { } else { tmp = 2; } - MessageNoOverlap(gUnk_08113078[tmp], this); + MessageNoOverlap(messageIndices[tmp], this); } diff --git a/src/npc/mama.c b/src/npc/mama.c index 974aa58f..11f291d2 100644 --- a/src/npc/mama.c +++ b/src/npc/mama.c @@ -3,9 +3,11 @@ #include "save.h" #include "npc.h" -extern Dialog gUnk_08113760[]; - -extern SpriteLoadData gUnk_08113754; +static const SpriteLoadData gUnk_08113754[] = { + { 0x101, 0x4e, 0x4 }, + { 0x2101, 0x4e, 0x4 }, + { 0, 0, 0 }, +}; bool32 sub_0806C454(Entity* this); @@ -44,7 +46,7 @@ void Mama(Entity* this) { } bool32 sub_0806C454(Entity* this) { - if (LoadExtraSpriteData(this, &gUnk_08113754) == 0) { + if (LoadExtraSpriteData(this, gUnk_08113754) == 0) { return FALSE; } else { SetDefaultPriority(this, PRIO_MESSAGE); @@ -75,7 +77,13 @@ void sub_0806C4A8(Entity* this, ScriptExecutionContext* context) { } void sub_0806C4DC(Entity* this) { - ShowNPCDialogue(this, &gUnk_08113760[gSave.global_progress]); + static const Dialog dialogs[] = { + { 1, 0, 3, 1, { 0x4f03, 0x4f02 } }, { 1, 0, 3, 1, { 0x4f03, 0x4f02 } }, { 1, 0, 3, 1, { 0x4f03, 0x4f02 } }, + { 1, 0, 3, 1, { 0x4f03, 0x4f02 } }, { 1, 0, 3, 1, { 0x4f0d, 0x4f0c } }, { 1, 0, 3, 1, { 0x4f1b, 0x4f1a } }, + { 1, 0, 3, 1, { 0x4f27, 0x4f26 } }, { 1, 0, 3, 1, { 0x4f33, 0x4f32 } }, { 1, 0, 3, 1, { 0x4f3f, 0x4f3e } }, + { 1, 0, 3, 1, { 0x4f49, 0x4f48 } }, + }; + ShowNPCDialogue(this, &dialogs[gSave.global_progress]); } void sub_0806C4F8(Entity* this) { diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index a68d2b72..d0f25712 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -5,9 +5,6 @@ #include "npc.h" #include "item.h" -extern u32 gUnk_08113F44; -extern Dialog gUnk_08113F48[]; - void MayorHagen(Entity* this) { u32 v; switch (this->action) { @@ -41,11 +38,24 @@ void MayorHagen(Entity* this) { } void sub_0806CE5C(Entity* this) { + static const u8 gUnk_08113F44[] = { + 0, + 8, + 8, + 16, + }; sub_08078784(this, sub_0801E99C(this)); - sub_08078850(this, 1, 0, &gUnk_08113F44); + sub_08078850(this, 1, 0, gUnk_08113F44); } void sub_0806CE80(Entity* this) { + static const Dialog dialogs[] = { + { 0x89, 1, 2, 1, 0x4c0d, 0x4c01 }, { 0x89, 1, 2, 1, 0x4c0d, 0x4c01 }, { 0x89, 1, 2, 1, 0x4c0d, 0x4c01 }, + { 0x89, 1, 2, 1, 0x4c0d, 0x4c01 }, { 0, 0, 1, 1, 0, 0x4c0e }, { 0, 0, 1, 1, 0, 0x4c0e }, + { 0, 0, 1, 1, 0, 0x4c0f }, { 0, 0, 1, 1, 0, 0x4c10 }, { 0, 0, 1, 1, 0, 0x4c11 }, + { 0, 0, 1, 1, 0, 0x4c12 }, { 0, 0, 1, 1, 0, 0x4c14 }, { 0, 0, 1, 1, 0, 0x4c02 }, + { 0, 0, 1, 1, 0, 0x4c0c }, { 0, 0, 1, 1, 0, 0x4c03 }, { 0, 0, 1, 1, 0, 0x4c04 }, + }; u32 v; u32 v2; v = gSave.global_progress; @@ -72,7 +82,7 @@ void sub_0806CE80(Entity* this) { } } } - ShowNPCDialogue(this, &gUnk_08113F48[v]); + ShowNPCDialogue(this, &dialogs[v]); } void MayorHagen_Fusion(Entity* this) { diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index 44be7575..a5de78b2 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -14,7 +14,6 @@ void sub_0806EABC(Entity* this, u32 param); #endif extern Font gUnk_081146B8; -extern s8 gUnk_081145E4[]; void Phonograph(Entity* this) { if (this->action == 0) { @@ -29,6 +28,15 @@ void Phonograph(Entity* this) { HandleEntity0x82Actions(this); } +static const s16 gUnk_081145E4[] = { + 0x0, -0x1, 0x3, 0x1c8, 0x4, 0x171, 0x5, 0x236, 0x6, -0x1, 0xa, -0x1, 0xc, 0x23a, 0xd, -0x1, 0xe, -0x1, + 0xf, -0x1, 0x13, -0x1, 0x14, -0x1, 0x15, -0x1, 0x16, -0x1, 0x17, -0x1, 0x18, -0x1, 0x19, -0x1, 0x1a, -0x1, + 0x1c, -0x1, 0x1d, -0x1, 0x20, -0x1, 0x2d, -0x1, 0x2e, -0x1, 0x2f, -0x1, 0x33, -0x1, 0x35, -0x1, 0x37, -0x1, + 0x38, -0x1, 0x3a, -0x1, 0x1, -0x1, 0x9, 0x320e, 0xb, -0x1, 0x11, -0x1, 0x1e, -0x1, 0x1f, -0x1, 0x21, -0x1, + 0x22, -0x1, 0x23, -0x1, 0x24, -0x1, 0x25, -0x1, 0x26, -0x1, 0x27, -0x1, 0x28, -0x1, 0x29, -0x1, 0x2a, -0x1, + 0x2b, -0x1, 0x2c, -0x1, 0x30, -0x1, 0x31, -0x1, 0x32, -0x1, 0x34, -0x1, 0x36, -0x1, 0x3b, -0x1 +}; + #ifdef EU void sub_0806E964(Entity* this, ScriptExecutionContext* context) { if (gInput.newKeys & B_BUTTON) { @@ -73,13 +81,13 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { if (gInput.newKeys & A_BUTTON) { if ((s16)this->field_0x68.HWORD != (s16)this->field_0x6a.HWORD || (s16)this->field_0x6c.HWORD == 0) { - s8* ptr2 = gUnk_081145E4; + const s16* ptr2 = gUnk_081145E4; s32 field_0x68; - SoundReq(*(s16*)(ptr2 + (s16)this->field_0x68.HWORD * 4)); + SoundReq(*(ptr2 + (s16)this->field_0x68.HWORD * 2)); this->field_0x6a.HWORD = this->field_0x68.HWORD; field_0x68 = (s16)this->field_0x68.HWORD * 4; - ptr2 += 2; - this->field_0x6c.HWORD = *(s16*)(((ptr2 + field_0x68))); + ptr2++; + this->field_0x6c.HWORD = *(s16*)((((int)ptr2 + field_0x68))); } else { SoundReq(SONG_STOP_ALL); this->field_0x6a.HWORD = 0; @@ -155,13 +163,13 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { if (gInput.newKeys & A_BUTTON) { if ((s16)this->field_0x68.HWORD != (s16)this->field_0x6a.HWORD || (s16)this->field_0x6c.HWORD == 0) { - s8* ptr2 = gUnk_081145E4; + const s16* ptr2 = gUnk_081145E4; s32 field_0x68; - SoundReq(*(s16*)(ptr2 + (s16)this->field_0x68.HWORD * 4)); + SoundReq(*(ptr2 + (s16)this->field_0x68.HWORD * 2)); this->field_0x6a.HWORD = this->field_0x68.HWORD; field_0x68 = (s16)this->field_0x68.HWORD * 4; - ptr2 += 2; - this->field_0x6c.HWORD = *(s16*)(((ptr2 + field_0x68))); + ptr2++; + this->field_0x6c.HWORD = *(s16*)((((int)ptr2 + field_0x68))); } else { SoundReq(SONG_STOP_ALL); this->field_0x6a.HWORD = 0; 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]); } diff --git a/src/npc/teachers.c b/src/npc/teachers.c index 8f0c277e..8515a05c 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -5,9 +5,10 @@ #include "script.h" #include "npc.h" -extern SpriteLoadData gUnk_08113910[]; - -extern Dialog gUnk_08113930[]; +static const SpriteLoadData gUnk_08113910[] = { + { 0x103, 0x4f, 0x4 }, { 0x2103, 0x4f, 0x4 }, { 0, 0, 0 }, { 0, 0, 0 }, + { 0, 0x50, 0x4 }, { 0x2002, 0x50, 0x4 }, { 0x4000, 0x50, 0x4 }, { 0, 0, 0 }, +}; void Teachers(Entity* this) { switch (this->action) { @@ -70,13 +71,31 @@ void Teachers_Head(Entity* this) { } void sub_0806C70C(Entity* this) { + static const Dialog gUnk_08113930[][8] = { + { { 0, 0, 1, 1, { 0, 0x3e01 } }, + { 0, 0, 1, 1, { 0, 0x3e01 } }, + { 0, 0, 1, 1, { 0, 0x3e01 } }, + { 0, 0, 1, 1, { 0, 0x3e01 } }, + { 0, 0, 1, 1, { 0, 0x3e01 } }, + { 0, 0, 1, 1, { 0, 0x3e01 } }, + { 0, 0, 1, 1, { 0, 0x3e09 } }, + { 0, 0, 1, 1, { 0, 0x3e09 } } }, + { { 0xa, 0, 3, 1, { 0x3435, 0x3434 } }, + { 0xa, 0, 3, 1, { 0x3435, 0x3434 } }, + { 0xa, 0, 3, 1, { 0x3528, 0x3527 } }, + { 0xa, 0, 3, 1, { 0x3625, 0x3624 } }, + { 0, 0, 3, 1, { 0x3e03, 0x3e02 } }, + { 0, 0, 1, 1, { 0, 0x3e06 } }, + { 0, 0, 1, 1, { 0, 0x3e0a } }, + { 0, 0, 1, 1, { 0, 0x3e0a } } }, + }; int offset; offset = gSave.global_progress - 2; if (offset < 0) offset = 0; - ShowNPCDialogue(this, gUnk_08113930 + this->type * 8 + offset); + ShowNPCDialogue(this, &gUnk_08113930[this->type][offset]); } void Teachers_Fusion(Entity* this) {