diff --git a/assets/xml/objects/object_dmask.xml b/assets/xml/objects/object_dmask.xml index f2411c147c..a7b3874ec7 100644 --- a/assets/xml/objects/object_dmask.xml +++ b/assets/xml/objects/object_dmask.xml @@ -2,15 +2,18 @@ - + + - + + - + + @@ -19,6 +22,7 @@ - + + diff --git a/include/z64item.h b/include/z64item.h index 6c9672c54a..ab0a236fae 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -349,7 +349,11 @@ typedef enum { typedef enum { /* 0x00 */ GID_BOTTLE, + /* 0x02 */ GID_02 = 0x02, + /* 0x03 */ GID_03, /* 0x0A */ GID_COMPASS = 0x0A, + /* 0x0E */ GID_0E = 0x0E, + /* 0x0F */ GID_0F, /* 0x10 */ GID_MASK_ALL_NIGHT = 0x10, /* 0x11 */ GID_NUTS, /* 0x17 */ GID_BOMB_BAG_20 = 0x17, @@ -367,11 +371,19 @@ typedef enum { /* 0x31 */ GID_POTION_RED, /* 0x32 */ GID_POTION_BLUE, /* 0x33 */ GID_SHIELD_MIRROR, - /* 0x3B */ GID_FAIRY = 0x3B, + /* 0x3A */ GID_3A = 0x3A, + /* 0x3B */ GID_FAIRY, + /* 0x3E */ GID_3E = 0x3E, + /* 0x44 */ GID_44 = 0x44, + /* 0x45 */ GID_45, /* 0x55 */ GID_SWORD_KOKIRI = 0x55, /* 0x66 */ GID_SWORD_RAZOR = 0x66, /* 0x67 */ GID_SWORD_GILDED, - /* 0x68 */ GID_SWORD_GREAT_FAIRY + /* 0x68 */ GID_SWORD_GREAT_FAIRY, + /* 0x6A */ GID_6A = 0x6A, + /* 0x6B */ GID_6B, + /* 0x70 */ GID_70 = 0x70, + /* 0x71 */ GID_71, } GetItemDrawID; // TODO: fill diff --git a/spec b/spec index b5d6949348..bfc1e0ef5c 100644 --- a/spec +++ b/spec @@ -3305,8 +3305,7 @@ beginseg name "ovl_Dm_Char05" compress include "build/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.o" - include "build/data/ovl_Dm_Char05/ovl_Dm_Char05.data.o" - include "build/data/ovl_Dm_Char05/ovl_Dm_Char05.reloc.o" + include "build/src/overlays/actors/ovl_Dm_Char05/ovl_Dm_Char05_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c index 1f61d302fe..b30a63fe2f 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c @@ -5,6 +5,7 @@ */ #include "z_dm_char05.h" +#include "objects/object_dmask/object_dmask.h" #define FLAGS 0x00000030 @@ -28,8 +29,12 @@ void func_80AACD1C(DmChar05* this, GlobalContext* globalCtx); void func_80AACD68(DmChar05* this, GlobalContext* globalCtx); void func_80AACE10(DmChar05* this, GlobalContext* globalCtx); void func_80AACE5C(DmChar05* this, GlobalContext* globalCtx); +void func_80AADD9C(GlobalContext* globalCtx, DmChar05* this); +void func_80AADE78(GlobalContext* globalCtx, DmChar05* this); +void func_80AADF54(GlobalContext* globalCtx, DmChar05* this); +void func_80AAE030(GlobalContext* globalCtx, DmChar05* this); +void func_80AAE114(GlobalContext* globalCtx, DmChar05* this); -#if 0 const ActorInit Dm_Char05_InitVars = { ACTOR_DM_CHAR05, ACTORCAT_ITEMACTION, @@ -42,86 +47,746 @@ const ActorInit Dm_Char05_InitVars = { (ActorFunc)DmChar05_Draw, }; -#endif +static ActorAnimationEntry sAnimations[] = { + { &object_dmask_Anim_001090, 1.0f, 0.0f, -1.0f, 2, 0.0f }, + { &object_dmask_Anim_004288, 1.0f, 0.0f, -1.0f, 2, 0.0f }, + { &object_dmask_Anim_0001A8, 1.0f, 0.0f, -1.0f, 2, 0.0f }, + { &object_dmask_Anim_00017C, 1.0f, 0.0f, -1.0f, 2, 0.0f }, + { &object_dmask_Anim_0011A0, 1.0f, 0.0f, -1.0f, 2, 0.0f }, + { &object_dmask_Anim_0013A4, 1.0f, 0.0f, -1.0f, 0, 0.0f }, +}; -extern UNK_TYPE D_060001D0; -extern UNK_TYPE D_060010B0; -extern UNK_TYPE D_060013D0; -extern UNK_TYPE D_06001E70; -extern UNK_TYPE D_060042B0; +void func_80AAC5A0(SkelAnime* skelAnime, ActorAnimationEntry* animation, u16 arg2) { + f32 phi_f2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAC5A0.s") + animation += arg2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAC63C.s") + if (animation->frameCount < 0.0f) { + phi_f2 = Animation_GetLastFrame(animation->animation); + } else { + phi_f2 = animation->frameCount; + } + Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, phi_f2, + animation->mode, animation->morphFrames); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAC6E4.s") +void func_80AAC63C(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAC770.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); + SkelAnime_Init(globalCtx, &this->skelAnime, &object_dmask_Skel_010B0, NULL, NULL, NULL, 0); + if (DMCHAR05_GET(&this->actor) == DMCHAR05_0) { + func_80AAC5A0(&this->skelAnime, &sAnimations[0], 0); + } else { + func_80AAC5A0(&this->skelAnime, &sAnimations[1], 0); + } + this->actionFunc = func_80AACC48; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAC7FC.s") +void func_80AAC6E4(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAC888.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); + SkelAnime_Init(globalCtx, &this->skelAnime, &object_dmask_Skel_042B0, NULL, NULL, NULL, 0); + func_80AAC5A0(&this->skelAnime, &sAnimations[1], 0); + this->actionFunc = func_80AACC48; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/DmChar05_Init.s") +void func_80AAC770(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/DmChar05_Destroy.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dmask_Skel_001D0, NULL, NULL, NULL, 0); + func_80AAC5A0(&this->skelAnime, &sAnimations[3], 0); + this->actionFunc = func_80AACC48; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAC990.s") +void func_80AAC7FC(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAC9DC.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); + SkelAnime_Init(globalCtx, &this->skelAnime, &object_dmask_Skel_013D0, NULL, NULL, NULL, 0); + func_80AAC5A0(&this->skelAnime, &sAnimations[4], 0); + this->actionFunc = func_80AACC48; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACA98.s") +void func_80AAC888(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACAE4.s") + this->actionFunc = func_80AACA98; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACBE4.s") +void DmChar05_Init(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACC48.s") + this->unk_18C = 0; + this->unk_18E = 0; + this->unk_19C = 0; + this->unk_1A0 = 0; + this->unk_1A4 = 0; + this->unk_1A8 = 0; + this->unk_1AC = 100; + this->unk_1B0 = 1000; + this->unk_1B4 = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACC6C.s") + switch (DMCHAR05_GET(&this->actor)) { + case DMCHAR05_0: + func_80AAC63C(thisx, globalCtx); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACCD4.s") + case DMCHAR05_1: + func_80AAC6E4(thisx, globalCtx); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACD0C.s") + case DMCHAR05_2: + func_80AAC770(thisx, globalCtx); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACD1C.s") + case DMCHAR05_3: + func_80AAC7FC(thisx, globalCtx); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACD68.s") + case DMCHAR05_4: + func_80AAC888(thisx, globalCtx); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACE10.s") + case DMCHAR05_5: + case DMCHAR05_6: + case DMCHAR05_7: + case DMCHAR05_8: + case DMCHAR05_9: + case DMCHAR05_10: + case DMCHAR05_11: + case DMCHAR05_12: + this->actionFunc = func_80AACBE4; + break; + } + Actor_SetScale(&this->actor, 0.01f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACE5C.s") +void DmChar05_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AACF04.s") +void func_80AAC990(DmChar05* this, GlobalContext* globalCtx) { + s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_GOLONMASK); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAD3F8.s") + if (objectIdx >= 0) { + this->unk_18F = objectIdx; + this->actionFunc = func_80AAC9DC; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAD450.s") +void func_80AAC9DC(DmChar05* this, GlobalContext* globalCtx) { + u32 temp_v0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAD4A8.s") + if (func_800EE29C(globalCtx, 0x6D) != 0) { + temp_v0 = func_800EE200(globalCtx, 0x6D); + if (globalCtx->csCtx.npcActions[temp_v0]->unk0 == 4) { + this->unk_18E = 1; + this->unk_190.x = globalCtx->csCtx.npcActions[temp_v0]->unk0C.x; + this->unk_190.y = globalCtx->csCtx.npcActions[temp_v0]->unk0C.y; + this->unk_190.z = globalCtx->csCtx.npcActions[temp_v0]->unk0C.z; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/DmChar05_Update.s") +void func_80AACA98(DmChar05* this, GlobalContext* globalCtx) { + s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_MASK13); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAD964.s") + if (objectIdx >= 0) { + this->unk_18F = objectIdx; + this->actionFunc = func_80AACAE4; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAD980.s") +void func_80AACAE4(DmChar05* this, GlobalContext* globalCtx) { + u32 sp24; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAD998.s") + if (func_800EE29C(globalCtx, 0x234)) { + sp24 = func_800EE200(globalCtx, 0x234); + if (globalCtx->csCtx.npcActions[sp24]->unk0 == 2) { + if (globalCtx->csCtx.frames == globalCtx->csCtx.npcActions[sp24]->startFrame) { + Item_Give(globalCtx, ITEM_MASK_COUPLE); + } + this->unk_18E = 1; + this->unk_190.x = globalCtx->csCtx.npcActions[sp24]->unk0C.x; + this->unk_190.y = globalCtx->csCtx.npcActions[sp24]->unk0C.y; + this->unk_190.z = globalCtx->csCtx.npcActions[sp24]->unk0C.z; + } else { + this->unk_18E = 0; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AADA90.s") +void func_80AACBE4(DmChar05* this, GlobalContext* globalCtx) { + static s16 D_80AAE2F0[] = { + OBJECT_GI_MASK17, OBJECT_GI_MASK14, OBJECT_GI_MASK10, OBJECT_GI_MASK21, + OBJECT_GI_MASK11, OBJECT_GI_MASK20, OBJECT_GI_RABIT_MASK, OBJECT_GI_MASK12, + }; + s32 params = DMCHAR05_GET(&this->actor) - DMCHAR05_5; + s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, D_80AAE2F0[params]); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AADB4C.s") + if (objectIdx >= 0) { + this->unk_18F = objectIdx; + this->actionFunc = func_80AACD0C; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AADC00.s") +void func_80AACC48(DmChar05* this, GlobalContext* globalCtx) { + if (this->unk_1B4 != 0) { + this->actionFunc = func_80AACC6C; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/DmChar05_Draw.s") +void func_80AACC6C(DmChar05* this, GlobalContext* globalCtx) { + if (this->unk_19C < 247) { + this->unk_19C += 8; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AADD9C.s") + if (this->unk_1A0 < 247) { + this->unk_1A0 += 8; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AADE78.s") + if (this->unk_1A4 < 247) { + this->unk_1A4 += 8; + } else { + this->unk_19C = 255; + this->unk_1A0 = 255; + this->unk_1A4 = 255; + this->actionFunc = func_80AACCD4; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AADF54.s") +void func_80AACCD4(DmChar05* this, GlobalContext* globalCtx) { + if (this->unk_1AC < 975) { + this->unk_1AC += 25; + } else { + this->unk_1AC = 996; + this->actionFunc = func_80AACD0C; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAE030.s") +void func_80AACD0C(DmChar05* this, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char05/func_80AAE114.s") +void func_80AACD1C(DmChar05* this, GlobalContext* globalCtx) { + s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_ZORAMASK); + + if (objectIdx >= 0) { + this->unk_18F = objectIdx; + this->actionFunc = func_80AACD68; + } +} + +void func_80AACD68(DmChar05* this, GlobalContext* globalCtx) { + u32 temp_v0; + + if (func_800EE29C(globalCtx, 0x1D9)) { + temp_v0 = func_800EE200(globalCtx, 0x1D9); + this->unk_18E = 1; + this->unk_190.x = globalCtx->csCtx.npcActions[temp_v0]->unk0C.x; + this->unk_190.y = globalCtx->csCtx.npcActions[temp_v0]->unk0C.y; + this->unk_190.z = globalCtx->csCtx.npcActions[temp_v0]->unk0C.z; + } +} + +void func_80AACE10(DmChar05* this, GlobalContext* globalCtx) { + s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_MASK15); + + if (objectIdx >= 0) { + this->unk_18F = objectIdx; + this->actionFunc = func_80AACE5C; + } +} + +void func_80AACE5C(DmChar05* this, GlobalContext* globalCtx) { + u32 temp_v0; + + if (func_800EE29C(globalCtx, 0x206)) { + temp_v0 = func_800EE200(globalCtx, 0x206); + this->unk_18E = 1; + this->unk_190.x = globalCtx->csCtx.npcActions[temp_v0]->unk0C.x; + this->unk_190.y = globalCtx->csCtx.npcActions[temp_v0]->unk0C.y; + this->unk_190.z = globalCtx->csCtx.npcActions[temp_v0]->unk0C.z; + } +} + +void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { + u8 sp2F = true; + u32 temp_v0; + + switch (DMCHAR05_GET(&this->actor)) { + case DMCHAR05_0: + if (func_800EE29C(globalCtx, 0x6D)) { + temp_v0 = func_800EE200(globalCtx, 0x6D); + + if (globalCtx->csCtx.frames == globalCtx->csCtx.npcActions[temp_v0]->startFrame) { + switch (globalCtx->csCtx.npcActions[temp_v0]->unk0) { + case 1: + sp2F = false; + break; + + case 2: + this->unk_1B4 = 1; + break; + + case 3: + this->unk_18C = 0; + break; + + case 4: + Item_Give(globalCtx, ITEM_MASK_GORON); + sp2F = false; + this->actionFunc = func_80AAC990; + break; + + case 5: + sp2F = false; + Actor_MarkForDeath(&this->actor); + break; + + default: + sp2F = false; + break; + } + + if (sp2F) { + func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + } + } + + func_800EDF24(&this->actor, globalCtx, temp_v0); + } + break; + + case DMCHAR05_1: + if (func_800EE29C(globalCtx, 0x1D9)) { + temp_v0 = func_800EE200(globalCtx, 0x1D9); + + if (globalCtx->csCtx.frames == globalCtx->csCtx.npcActions[temp_v0]->startFrame) { + switch (globalCtx->csCtx.npcActions[temp_v0]->unk0) { + case 1: + sp2F = false; + break; + + case 2: + this->unk_18C = 1; + this->unk_1B4 = 1; + break; + + case 3: + this->unk_18C = 1; + break; + + case 4: + Item_Give(globalCtx, ITEM_MASK_ZORA); + sp2F = false; + this->actionFunc = func_80AACD1C; + break; + + case 5: + sp2F = false; + Actor_MarkForDeath(&this->actor); + break; + + default: + sp2F = false; + break; + } + + if (sp2F) { + func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + } + } + + func_800EDF24(&this->actor, globalCtx, temp_v0); + } + break; + + case DMCHAR05_2: + if (func_800EE29C(globalCtx, 0x206)) { + temp_v0 = func_800EE200(globalCtx, 0x206); + + if (globalCtx->csCtx.frames == globalCtx->csCtx.npcActions[temp_v0]->startFrame) { + switch (globalCtx->csCtx.npcActions[temp_v0]->unk0) { + case 1: + sp2F = false; + break; + + case 2: + this->unk_18C = 3; + break; + + case 3: + this->unk_18C = 2; + break; + + case 4: + Item_Give(globalCtx, ITEM_MASK_GIBDO); + sp2F = false; + this->actionFunc = func_80AACE10; + break; + + case 5: + sp2F = false; + Actor_MarkForDeath(&this->actor); + break; + + default: + sp2F = false; + break; + } + + if (sp2F) { + func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + } + } + + func_800EDF24(&this->actor, globalCtx, temp_v0); + } + break; + + case DMCHAR05_3: + if (func_800EE29C(globalCtx, 0x22F)) { + temp_v0 = func_800EE200(globalCtx, 0x22F); + + if (globalCtx->csCtx.frames == globalCtx->csCtx.npcActions[temp_v0]->startFrame) { + switch (globalCtx->csCtx.npcActions[temp_v0]->unk0) { + default: + sp2F = false; + break; + + case 1: + sp2F = false; + break; + + case 2: + this->unk_18C = 4; + break; + + case 3: + this->unk_18C = 5; + break; + + case 4: + this->unk_18C = 5; + break; + } + + if (sp2F) { + func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + } + } + + if (globalCtx->csCtx.npcActions[temp_v0]->unk0 != 4) { + func_800EDF24(&this->actor, globalCtx, temp_v0); + } else { + func_800EDE34(&this->actor, globalCtx, temp_v0); + } + } + + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + if (this->unk_18C == 4) { + this->unk_18C++; + func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + } + } + break; + } +} + +void func_80AAD3F8(DmChar05* this, GlobalContext* globalCtx) { + if (globalCtx->csCtx.frames == 490) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); + } + + if (globalCtx->csCtx.frames > 550) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); + } +} + +void func_80AAD450(DmChar05* this, GlobalContext* globalCtx) { + if (globalCtx->csCtx.frames == 262) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); + } + + if (globalCtx->csCtx.frames > 318) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); + } +} + +void func_80AAD4A8(DmChar05* this, GlobalContext* globalCtx) { + if (DMCHAR05_GET(&this->actor) == DMCHAR05_0) { + if (func_800EE29C(globalCtx, 0x6D) && + (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x6D)]->unk0 == 3)) { + if (Animation_OnFrame(&this->skelAnime, 14.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_0); + } else if (Animation_OnFrame(&this->skelAnime, 19.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_1); + } + } + } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_1) { + if (func_800EE29C(globalCtx, 0x1D9)) { + if ((globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x1D9)]->unk0 == 3) && + Animation_OnFrame(&this->skelAnime, 5.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_SAND); + } + } + } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_2) { + if (func_800EE29C(globalCtx, 0x206) && + (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x206)]->unk0 == 2)) { + if (Animation_OnFrame(&this->skelAnime, 7.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_0); + } + + if (Animation_OnFrame(&this->skelAnime, 14.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_1); + } + + if (Animation_OnFrame(&this->skelAnime, 18.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_1); + } + } + } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_3) { + if (globalCtx->sceneNum == SCENE_OKUJOU) { + if (gSaveContext.sceneSetupIndex == 2) { + if (globalCtx->csCtx.unk_12 == 0) { + func_80AAD3F8(this, globalCtx); + } else if (globalCtx->csCtx.unk_12 == 1) { + func_80AAD450(this, globalCtx); + } + } + } else if (globalCtx->sceneNum == SCENE_SPOT00) { + if (gSaveContext.sceneSetupIndex == 9) { + if ((globalCtx->csCtx.unk_12 == 0) && (globalCtx->csCtx.frames == 255)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); + } + } else if ((gSaveContext.sceneSetupIndex == 0xB) && (globalCtx->csCtx.frames == 115)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER_PREDEMO); + } + } + } +} + +void DmChar05_Update(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; + + func_80AACF04(this, globalCtx); + if (func_800EE29C(globalCtx, 0x6D)) { + if (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x6D)]->unk0 == 3) { + SkelAnime_Update(&this->skelAnime); + } + } else if (func_800EE29C(globalCtx, 0x1D9)) { + if (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x1D9)]->unk0 == 3) { + SkelAnime_Update(&this->skelAnime); + } + } else if (func_800EE29C(globalCtx, 0x206)) { + if (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x206)]->unk0 == 2) { + SkelAnime_Update(&this->skelAnime); + } + } else if (func_800EE29C(globalCtx, 0x22F)) { + if ((globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x22F)]->unk0 == 2) || + (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x22F)]->unk0 == 3)) { + SkelAnime_Update(&this->skelAnime); + } + + if (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x22F)]->unk0 == 4) { + this->actor.world.rot.y += 0x258; + this->actor.shape.rot.y += 0x258; + } + } + this->actionFunc(this, globalCtx); + func_80AAD4A8(this, globalCtx); +} + +s32 DmChar05_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + return false; +} + +void DmChar05_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +} + +void func_80AAD998(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; + s32 pad[2]; + + if (this->unk_18E == 0) { + if (func_800EE29C(globalCtx, 0x6D) && + (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x6D)]->unk0 != 1)) { + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, this->unk_19C, this->unk_1A0, this->unk_1A4, this->unk_1A8, + this->unk_1AC, this->unk_1B0); + SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + DmChar05_OverrideLimbDraw, DmChar05_PostLimbDraw, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); + } + } else if (this->unk_18E == 1) { + func_80AADD9C(globalCtx, this); + } +} + +void func_80AADA90(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; + + if (this->unk_18E == 0) { + if (func_800EE29C(globalCtx, 0x1D9) && + (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x1D9)]->unk0 != 1)) { + func_8012C28C(globalCtx->state.gfxCtx); + SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + DmChar05_OverrideLimbDraw, DmChar05_PostLimbDraw, &this->actor); + } + } else if (this->unk_18E == 1) { + func_80AADE78(globalCtx, this); + } +} + +void func_80AADB4C(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; + + if (this->unk_18E == 0) { + if (func_800EE29C(globalCtx, 0x206) && + (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x206)]->unk0 != 1)) { + func_8012C28C(globalCtx->state.gfxCtx); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, NULL, NULL, &this->actor); + } + } else if (this->unk_18E == 1) { + func_80AADF54(globalCtx, this); + } +} + +void func_80AADC00(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + DmChar05* this = THIS; + u32 temp_v0; + + if (func_800EE29C(globalCtx, 0x22F)) { + temp_v0 = func_800EE200(globalCtx, 0x22F); + + if ((globalCtx->csCtx.npcActions[temp_v0]->unk0 != 1) && (globalCtx->csCtx.npcActions[temp_v0]->unk0 != 4)) { + func_8012C28C(globalCtx->state.gfxCtx); + SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + DmChar05_OverrideLimbDraw, DmChar05_PostLimbDraw, &this->actor); + } + + if (globalCtx->csCtx.npcActions[temp_v0]->unk0 == 4) { + Matrix_InsertTranslation(-600.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Gfx_DrawDListOpa(globalCtx, object_dmask_DL_001E70); + } + } +} + +void DmChar05_Draw(Actor* thisx, GlobalContext* globalCtx) { + DmChar05* this = THIS; + + switch (DMCHAR05_GET(&this->actor)) { + case DMCHAR05_0: + func_80AAD998(thisx, globalCtx); + break; + + case DMCHAR05_1: + func_80AADA90(thisx, globalCtx); + break; + + case DMCHAR05_2: + func_80AADB4C(thisx, globalCtx); + break; + + case DMCHAR05_3: + func_80AADC00(thisx, globalCtx); + break; + + case DMCHAR05_4: + func_80AAE030(globalCtx, this); + break; + + case DMCHAR05_5: + case DMCHAR05_6: + case DMCHAR05_7: + case DMCHAR05_8: + case DMCHAR05_9: + case DMCHAR05_10: + case DMCHAR05_11: + case DMCHAR05_12: + func_80AAE114(globalCtx, this); + break; + } +} + +void func_80AADD9C(GlobalContext* globalCtx, DmChar05* this) { + if (this->actor.objBankIndex == this->unk_18F) { + Matrix_InsertTranslation(this->unk_190.x, this->unk_190.y, this->unk_190.z, MTXMODE_NEW); + Matrix_InsertRotation(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); + GetItem_Draw(globalCtx, GID_44); + } + + if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + this->actor.objBankIndex = this->unk_18F; + } +} + +void func_80AADE78(GlobalContext* globalCtx, DmChar05* this) { + if (this->actor.objBankIndex == this->unk_18F) { + Matrix_InsertTranslation(this->unk_190.x, this->unk_190.y, this->unk_190.z, MTXMODE_NEW); + Matrix_InsertRotation(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); + GetItem_Draw(globalCtx, GID_45); + } + + if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + this->actor.objBankIndex = this->unk_18F; + } +} + +void func_80AADF54(GlobalContext* globalCtx, DmChar05* this) { + if (this->actor.objBankIndex == this->unk_18F) { + Matrix_InsertTranslation(this->unk_190.x, this->unk_190.y, this->unk_190.z, MTXMODE_NEW); + Matrix_InsertRotation(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); + GetItem_Draw(globalCtx, GID_6B); + } + + if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + this->actor.objBankIndex = this->unk_18F; + } +} + +void func_80AAE030(GlobalContext* globalCtx, DmChar05* this) { + if (this->unk_18E != 0) { + if (this->actor.objBankIndex == this->unk_18F) { + Matrix_InsertTranslation(this->unk_190.x, this->unk_190.y, this->unk_190.z, MTXMODE_NEW); + Matrix_InsertRotation(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); + GetItem_Draw(globalCtx, GID_03); + } + + if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + this->actor.objBankIndex = this->unk_18F; + } + } +} + +void func_80AAE114(GlobalContext* globalCtx, DmChar05* this) { + s32 sp34; + s16 sp24[] = { + GID_02, GID_6A, GID_70, GID_3A, GID_0E, GID_0F, GID_3E, GID_71, + }; + + sp34 = DMCHAR05_GET(&this->actor) - DMCHAR05_5; + if (this->actor.objBankIndex == this->unk_18F) { + Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + MTXMODE_NEW); + Matrix_InsertRotation(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); + GetItem_Draw(globalCtx, sp24[sp34]); + } + + if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + this->actor.objBankIndex = this->unk_18F; + } +} diff --git a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.h b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.h index a2e1a6208d..83bb679486 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.h +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.h @@ -7,11 +7,39 @@ struct DmChar05; typedef void (*DmChar05ActionFunc)(struct DmChar05*, GlobalContext*); +#define DMCHAR05_GET(thisx) ((thisx)->params) + +enum { + /* 0 */ DMCHAR05_0, + /* 1 */ DMCHAR05_1, + /* 2 */ DMCHAR05_2, + /* 3 */ DMCHAR05_3, + /* 4 */ DMCHAR05_4, + /* 5 */ DMCHAR05_5, + /* 6 */ DMCHAR05_6, + /* 7 */ DMCHAR05_7, + /* 8 */ DMCHAR05_8, + /* 9 */ DMCHAR05_9, + /* 10 */ DMCHAR05_10, + /* 11 */ DMCHAR05_11, + /* 12 */ DMCHAR05_12, +}; + typedef struct DmChar05 { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x44]; + /* 0x0144 */ SkelAnime skelAnime; /* 0x0188 */ DmChar05ActionFunc actionFunc; - /* 0x018C */ char unk_18C[0x2C]; + /* 0x018C */ s16 unk_18C; + /* 0x018E */ u8 unk_18E; + /* 0x018F */ u8 unk_18F; + /* 0x0190 */ Vec3f unk_190; + /* 0x019C */ u32 unk_19C; + /* 0x01A0 */ u32 unk_1A0; + /* 0x01A4 */ u32 unk_1A4; + /* 0x01A8 */ s32 unk_1A8; + /* 0x01AC */ s32 unk_1AC; + /* 0x01B0 */ s32 unk_1B0; + /* 0x01B4 */ u8 unk_1B4; } DmChar05; // size = 0x1B8 extern const ActorInit Dm_Char05_InitVars; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 2933a97bf1..6a9fb85554 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -11605,8 +11605,8 @@ 0x80AAD450:("func_80AAD450",), 0x80AAD4A8:("func_80AAD4A8",), 0x80AAD78C:("DmChar05_Update",), - 0x80AAD964:("func_80AAD964",), - 0x80AAD980:("func_80AAD980",), + 0x80AAD964:("DmChar05_OverrideLimbDraw",), + 0x80AAD980:("DmChar05_PostLimbDraw",), 0x80AAD998:("func_80AAD998",), 0x80AADA90:("func_80AADA90",), 0x80AADB4C:("func_80AADB4C",), diff --git a/undefined_syms.txt b/undefined_syms.txt index 44de5a3291..d58ac55d75 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1034,14 +1034,6 @@ D_0600AD68 = 0x0600AD68; D_06020550 = 0x06020550; -// ovl_Dm_Char05 - -D_060001D0 = 0x060001D0; -D_060010B0 = 0x060010B0; -D_060013D0 = 0x060013D0; -D_06001E70 = 0x06001E70; -D_060042B0 = 0x060042B0; - // ovl_Dm_Char06 D_060013A8 = 0x060013A8;