summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/assets.json25
-rw-r--r--data/const/npc/smith.s32
-rw-r--r--linker.ld2
-rw-r--r--src/npc/smith.c62
4 files changed, 48 insertions, 73 deletions
diff --git a/assets/assets.json b/assets/assets.json
index 7dd1364d..eaf50413 100644
--- a/assets/assets.json
+++ b/assets/assets.json
@@ -36944,31 +36944,6 @@
"type": "animation"
},
{
- "path": "smith/gUnk_08110354.bin",
- "start": 1114964,
- "size": 12
- },
- {
- "path": "smith/gUnk_08110380.bin",
- "start": 1115008,
- "size": 16
- },
- {
- "path": "smith/gUnk_08110390.bin",
- "start": 1115024,
- "size": 64
- },
- {
- "path": "smith/gUnk_081103D0.bin",
- "start": 1115088,
- "size": 16
- },
- {
- "path": "smith/gUnk_081103E0.bin",
- "start": 1115104,
- "size": 4
- },
- {
"path": "animations/gSpriteAnimations_KingDaltus_0.bin",
"start": 1115392,
"size": 5,
diff --git a/data/const/npc/smith.s b/data/const/npc/smith.s
deleted file mode 100644
index 8a156d82..00000000
--- a/data/const/npc/smith.s
+++ /dev/null
@@ -1,32 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
- .align 2
-
-gUnk_08110354:: @ 08110354
- .incbin "smith/gUnk_08110354.bin"
-
-gUnk_08110360:: @ 08110360
- .4byte sub_080660EC
- .4byte sub_08066118
- .4byte sub_08066170
-
-gUnk_0811036C:: @ 0811036C
- .4byte sub_08066178
- .4byte sub_080661B0
- .4byte sub_080661BC
- .4byte sub_08066200
- .4byte sub_08066218
-
-gUnk_08110380:: @ 08110380
- .incbin "smith/gUnk_08110380.bin"
-
-gUnk_08110390:: @ 08110390
- .incbin "smith/gUnk_08110390.bin"
-
-gUnk_081103D0:: @ 081103D0
- .incbin "smith/gUnk_081103D0.bin"
-
-gUnk_081103E0:: @ 081103E0
- .incbin "smith/gUnk_081103E0.bin"
diff --git a/linker.ld b/linker.ld
index 7ee2924a..11d61238 100644
--- a/linker.ld
+++ b/linker.ld
@@ -1209,7 +1209,7 @@ SECTIONS {
data/animations/npc/milkCart.o(.rodata);
src/npc/ghostBrothers.o(.rodata);
data/animations/npc/ghostBrothers.o(.rodata);
- data/const/npc/smith.o(.rodata);
+ src/npc/smith.o(.rodata);
data/animations/npc/smith.o(.rodata);
src/npc/npc23.o(.rodata);
data/const/npc/kingDaltus.o(.rodata);
diff --git a/src/npc/smith.c b/src/npc/smith.c
index d6d428bb..4ea07d06 100644
--- a/src/npc/smith.c
+++ b/src/npc/smith.c
@@ -1,16 +1,33 @@
#include "npc.h"
#include "functions.h"
-extern void (*const gUnk_08110360[])(Entity*);
-extern void (*const gUnk_0811036C[])(Entity*);
-
-extern u16 gUnk_08110380[];
-extern SpriteLoadData gUnk_08110354;
-extern Dialog gUnk_08110390[];
-extern u16 gUnk_081103D0[];
-extern u32 gUnk_081103E0;
+static const SpriteLoadData gUnk_08110354[] = {
+ { 0x4d, 0x38, 0x4 },
+ { 0x4004, 0x38, 0x4 },
+ { 0, 0, 0 },
+};
+
+void sub_080660EC(Entity*);
+void sub_08066118(Entity*);
+void sub_08066170(Entity*);
+void sub_08066178(Entity*);
+void sub_080661B0(Entity*);
+void sub_080661BC(Entity*);
+void sub_08066200(Entity*);
+void sub_08066218(Entity*);
void Smith(Entity* this) {
+ static void (*const actionFuncs[])(Entity*) = {
+ sub_080660EC,
+ sub_08066118,
+ sub_08066170,
+ };
+ static void (*const scriptedActionFuncs[])(Entity*) = {
+ sub_08066178, sub_080661B0, sub_080661BC, sub_08066200, sub_08066218,
+ };
+ static const u16 gUnk_08110380[] = {
+ 0xdc, 0xdd, 0xde, 0xdc, 0xdd, 0xde, 0xdc, 0xdd,
+ };
u32 index;
if ((this->flags & ENT_SCRIPTED) != 0) {
@@ -22,9 +39,9 @@ void Smith(Entity* this) {
InitAnimationForceUpdate(this, index);
sub_0806F118(this);
}
- gUnk_0811036C[this->action](this);
+ scriptedActionFuncs[this->action](this);
} else {
- gUnk_08110360[this->action](this);
+ actionFuncs[this->action](this);
sub_0806ED78(this);
}
if (this->animIndex == 0xc) {
@@ -54,7 +71,7 @@ void Smith_Head(Entity* this) {
}
void sub_080660EC(Entity* this) {
- if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
+ if (LoadExtraSpriteData(this, gUnk_08110354) != 0) {
this->action = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
InitAnimationForceUpdate(this, 2);
@@ -89,7 +106,7 @@ void sub_08066170(Entity* this) {
}
void sub_08066178(Entity* this) {
- if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
+ if (LoadExtraSpriteData(this, gUnk_08110354) != 0) {
this->action = 1;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
@@ -126,6 +143,12 @@ void sub_08066218(Entity* this) {
}
void sub_0806622C(Entity* this) {
+ static const Dialog dialogs[] = {
+ { 0x15, 2, 4, 1, { 0x3201, 0x100e } }, { 0x15, 2, 4, 1, { 0x3201, 0x100e } },
+ { 0x15, 2, 4, 1, { 0x3202, 0x100e } }, { 0x15, 2, 4, 1, { 0x3203, 0x100e } },
+ { 0x15, 2, 4, 1, { 0x3204, 0x100e } }, { 0x15, 2, 4, 1, { 0x3205, 0x100e } },
+ { 0x15, 2, 4, 1, { 0x3206, 0x100e } }, { 0x15, 2, 4, 1, { 0x3206, 0x100e } },
+ };
u32 index;
if (gSave.global_progress - 2 < 0) {
@@ -133,17 +156,26 @@ void sub_0806622C(Entity* this) {
} else {
index = gSave.global_progress - 2;
}
- ShowNPCDialogue(this, &gUnk_08110390[index]);
+ ShowNPCDialogue(this, &dialogs[index]);
}
void nullsub_501(Entity* this) {
}
void sub_08066258(void) {
- SoundReq(gUnk_081103D0[Random() & 7]);
+ static const u16 hammerSounds[] = {
+ SFX_HAMMER4, SFX_HAMMER5, SFX_HAMMER6, SFX_HAMMER4, SFX_HAMMER5, SFX_HAMMER6, SFX_HAMMER4, SFX_HAMMER5,
+ };
+ SoundReq(hammerSounds[Random() & 7]);
}
void sub_08066274(Entity* this) {
+ static const u8 gUnk_081103E0[] = {
+ 0,
+ 6,
+ 8,
+ 12,
+ };
sub_08078850(this, 1, 0, &gUnk_081103E0);
}
@@ -153,7 +185,7 @@ void sub_08066288(Entity* this) {
void Smith_Fusion(Entity* this) {
if (this->action == 0) {
- if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
+ if (LoadExtraSpriteData(this, gUnk_08110354) != 0) {
this->action++;
this->spriteSettings.draw = 1;
InitAnimationForceUpdate(this, 6);