diff --git a/assets/xml/objects/object_osn.xml b/assets/xml/objects/object_osn.xml
index b31660e6ac..2cb8315ea6 100644
--- a/assets/xml/objects/object_osn.xml
+++ b/assets/xml/objects/object_osn.xml
@@ -112,6 +112,6 @@
-
+
diff --git a/include/z64item.h b/include/z64item.h
index cc05b528ed..14ea9fca4d 100644
--- a/include/z64item.h
+++ b/include/z64item.h
@@ -427,6 +427,7 @@ typedef enum {
/* 0x51 */ GID_51,
/* 0x53 */ GID_53 = 0x53,
/* 0x55 */ GID_SWORD_KOKIRI = 0x55,
+ /* 0x5B */ GID_MASK_DEKU = 0x5B,
/* 0x66 */ GID_SWORD_RAZOR = 0x66,
/* 0x67 */ GID_SWORD_GILDED,
/* 0x68 */ GID_SWORD_GREAT_FAIRY,
diff --git a/spec b/spec
index 1e9df7a981..97597b7449 100644
--- a/spec
+++ b/spec
@@ -3133,8 +3133,7 @@ beginseg
name "ovl_Dm_Char03"
compress
include "build/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.o"
- include "build/data/ovl_Dm_Char03/ovl_Dm_Char03.data.o"
- include "build/data/ovl_Dm_Char03/ovl_Dm_Char03.reloc.o"
+ include "build/src/overlays/actors/ovl_Dm_Char03/ovl_Dm_Char03_reloc.o"
endseg
beginseg
diff --git a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c
index 0684dbdec8..6c44fb5e68 100644
--- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c
+++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c
@@ -5,6 +5,7 @@
*/
#include "z_dm_char03.h"
+#include "objects/object_osn/object_osn.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@@ -15,11 +16,10 @@ void DmChar03_Destroy(Actor* thisx, PlayState* play);
void DmChar03_Update(Actor* thisx, PlayState* play);
void DmChar03_Draw(Actor* thisx, PlayState* play);
-void func_80AAB5F8(DmChar03* this, PlayState* play);
void func_80AAB644(DmChar03* this, PlayState* play);
-void func_80AAB700(DmChar03* this, PlayState* play);
+void DmChar03_DoNothing(DmChar03* this, PlayState* play);
+void func_80AABA84(PlayState* play, DmChar03* this);
-#if 0
const ActorInit Dm_Char03_InitVars = {
ACTOR_DM_CHAR03,
ACTORCAT_ITEMACTION,
@@ -32,34 +32,157 @@ const ActorInit Dm_Char03_InitVars = {
(ActorFunc)DmChar03_Draw,
};
-#endif
+AnimationInfo sAnimations[] = { { &object_osn_Anim_020530, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f } };
-extern UNK_TYPE D_06020550;
+void DmChar03_ChangeAnimation(SkelAnime* skelAnime, AnimationInfo* animInfo, u16 index) {
+ f32 frame;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB4A0.s")
+ animInfo += index;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Init.s")
+ if (animInfo->frameCount < 0.0f) {
+ frame = Animation_GetLastFrame(animInfo->animation);
+ } else {
+ frame = animInfo->frameCount;
+ }
+ Animation_Change(skelAnime, animInfo->animation, animInfo->playSpeed, animInfo->startFrame, frame, animInfo->mode,
+ animInfo->morphFrames);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Destroy.s")
+void DmChar03_Init(Actor* thisx, PlayState* play) {
+ DmChar03* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB5F8.s")
+ this->animIndex = 0;
+ this->actor.targetArrowOffset = 3000.0f;
+ this->unk_18E = false;
+ ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gDekuMaskSkel, NULL, NULL, NULL, 0);
+ DmChar03_ChangeAnimation(&this->skelAnime, sAnimations, 0);
+ Actor_SetScale(&this->actor, 0.01f);
+ this->actionFunc = DmChar03_DoNothing;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB644.s")
+void DmChar03_Destroy(Actor* thisx, PlayState* play) {
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB700.s")
+void func_80AAB5F8(DmChar03* this, PlayState* play) {
+ s32 index = Object_GetIndex(&play->objectCtx, OBJECT_GI_NUTSMASK);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB710.s")
+ if (index >= 0) {
+ this->objectIndex = index;
+ this->actionFunc = func_80AAB644;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB838.s")
+void func_80AAB644(DmChar03* this, PlayState* play) {
+ if (Cutscene_CheckActorAction(play, 0x88)) {
+ s32 index = Cutscene_GetActorActionIndex(play, 0x88);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Update.s")
+ if (play->csCtx.actorActions[index]->action == 4) {
+ this->unk_18E = true;
+ this->offset.x = play->csCtx.actorActions[index]->startPos.x;
+ this->offset.y = play->csCtx.actorActions[index]->startPos.y;
+ this->offset.z = play->csCtx.actorActions[index]->startPos.z;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB974.s")
+void DmChar03_DoNothing(DmChar03* this, PlayState* play) {
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB990.s")
+void func_80AAB710(DmChar03* this, PlayState* play) {
+ u8 shouldChangeAnim = true;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB9A8.s")
+ if (Cutscene_CheckActorAction(play, 0x88)) {
+ s32 index = Cutscene_GetActorActionIndex(play, 0x88);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Draw.s")
+ if (play->csCtx.frames == play->csCtx.actorActions[index]->startFrame) {
+ switch (play->csCtx.actorActions[index]->action) {
+ case 1:
+ shouldChangeAnim = false;
+ break;
+ case 2:
+ this->animIndex = 0;
+ break;
+ case 3:
+ this->unk_18E = false;
+ shouldChangeAnim = false;
+ Actor_MarkForDeath(&this->actor);
+ break;
+ case 4:
+ Item_Give(play, ITEM_MASK_DEKU);
+ shouldChangeAnim = false;
+ this->actionFunc = func_80AAB5F8;
+ break;
+ default:
+ shouldChangeAnim = false;
+ break;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AABA84.s")
+ if (shouldChangeAnim) {
+ DmChar03_ChangeAnimation(&this->skelAnime, &sAnimations[this->animIndex], 0);
+ }
+ }
+ Cutscene_ActorTranslateAndYaw(&this->actor, play, index);
+ }
+}
+
+void func_80AAB838(DmChar03* this, PlayState* play) {
+ if (Animation_OnFrame(&this->skelAnime, 5.0f)) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_0);
+ } else if ((Animation_OnFrame(&this->skelAnime, 10.0f)) || (Animation_OnFrame(&this->skelAnime, 18.0f)) ||
+ (Animation_OnFrame(&this->skelAnime, 30.0f)) || (Animation_OnFrame(&this->skelAnime, 38.0f))) {
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_1);
+ }
+}
+
+void DmChar03_Update(Actor* thisx, PlayState* play) {
+ DmChar03* this = THIS;
+
+ if (Cutscene_CheckActorAction(play, 0x88) &&
+ (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x88)]->action == 2)) {
+ SkelAnime_Update(&this->skelAnime);
+ }
+ this->actionFunc(this, play);
+ func_80AAB710(this, play);
+ func_80AAB838(this, play);
+}
+
+s32 DmChar03_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ return false;
+}
+
+void DmChar03_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+}
+
+void DmChar03_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
+}
+
+void DmChar03_Draw(Actor* thisx, PlayState* play) {
+ DmChar03* this = THIS;
+
+ if (!this->unk_18E) {
+ if ((Cutscene_CheckActorAction(play, 0x88)) &&
+ (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x88)]->action != 1)) {
+ func_8012C28C(play->state.gfxCtx);
+ SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, DmChar03_OverrideLimbDraw, DmChar03_PostLimbDraw,
+ DmChar03_TransformLimbDraw, &this->actor);
+ }
+ } else {
+ func_80AABA84(play, this);
+ }
+}
+
+void func_80AABA84(PlayState* play, DmChar03* this) {
+ s32 pad;
+
+ if (this->actor.objBankIndex == this->objectIndex) {
+ Matrix_Translate(this->offset.x, this->offset.y, this->offset.z, MTXMODE_NEW);
+ Matrix_RotateZYX(0, (play->gameplayFrames * 0x3E8), 0, MTXMODE_APPLY);
+ Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
+ GetItem_Draw(play, GID_MASK_DEKU);
+ }
+ if (Object_IsLoaded(&play->objectCtx, this->objectIndex)) {
+ this->actor.objBankIndex = this->objectIndex;
+ }
+}
diff --git a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h
index 8d2905ad8d..f736220c8f 100644
--- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h
+++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h
@@ -9,9 +9,12 @@ typedef void (*DmChar03ActionFunc)(struct DmChar03*, PlayState*);
typedef struct DmChar03 {
/* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x44];
+ /* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ DmChar03ActionFunc actionFunc;
- /* 0x18C */ char unk_18C[0x10];
+ /* 0x18C */ s16 animIndex;
+ /* 0x18E */ u8 unk_18E;
+ /* 0x18F */ u8 objectIndex;
+ /* 0x190 */ Vec3f offset;
} DmChar03; // size = 0x19C
extern const ActorInit Dm_Char03_InitVars;
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index 648a053728..0a75f24ae3 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -11558,18 +11558,18 @@
0x80AAB258:("DmChar02_PostLimbDraw",),
0x80AAB270:("DmChar02_TransformLimbDraw",),
0x80AAB284:("DmChar02_Draw",),
- 0x80AAB4A0:("func_80AAB4A0",),
+ 0x80AAB4A0:("DmChar03_ChangeAnimation",),
0x80AAB53C:("DmChar03_Init",),
0x80AAB5E8:("DmChar03_Destroy",),
0x80AAB5F8:("func_80AAB5F8",),
0x80AAB644:("func_80AAB644",),
- 0x80AAB700:("func_80AAB700",),
+ 0x80AAB700:("DmChar03_DoNothing",),
0x80AAB710:("func_80AAB710",),
0x80AAB838:("func_80AAB838",),
0x80AAB8DC:("DmChar03_Update",),
- 0x80AAB974:("func_80AAB974",),
- 0x80AAB990:("func_80AAB990",),
- 0x80AAB9A8:("func_80AAB9A8",),
+ 0x80AAB974:("DmChar03_OverrideLimbDraw",),
+ 0x80AAB990:("DmChar03_PostLimbDraw",),
+ 0x80AAB9A8:("DmChar03_TransformLimbDraw",),
0x80AAB9BC:("DmChar03_Draw",),
0x80AABA84:("func_80AABA84",),
0x80AABC40:("DmChar04_ChangeAnim",),