diff options
| author | Chloe <47910150+ChloeBangBang@users.noreply.github.com> | 2022-07-23 13:05:04 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-23 15:05:04 -0400 |
| commit | cde8874bb1120fca7d134f8151b8e04e5d8dff16 (patch) | |
| tree | 19b4ffab010be6b24180a96eb2f83568d8924eb5 /src | |
| parent | 260be2c36b2c0edd6459ed75173202bf722a89cb (diff) | |
ovl_Dm_Char03 OK (#963)
* Decompile ovl_Dm_Char03
* review fixes
* more review fixes
* remove leading zeroes
Diffstat (limited to 'src')
| -rw-r--r-- | src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c | 191 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h | 7 |
2 files changed, 162 insertions, 36 deletions
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 0684dbdec..6c44fb5e6 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 - -extern UNK_TYPE D_06020550; - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB4A0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Init.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Destroy.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB5F8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB644.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB700.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB710.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB838.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Update.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB974.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB990.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB9A8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Draw.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AABA84.s") +AnimationInfo sAnimations[] = { { &object_osn_Anim_020530, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f } }; + +void DmChar03_ChangeAnimation(SkelAnime* skelAnime, AnimationInfo* animInfo, u16 index) { + f32 frame; + + animInfo += index; + + 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); +} + +void DmChar03_Init(Actor* thisx, PlayState* play) { + DmChar03* this = THIS; + + 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; +} + +void DmChar03_Destroy(Actor* thisx, PlayState* play) { +} + +void func_80AAB5F8(DmChar03* this, PlayState* play) { + s32 index = Object_GetIndex(&play->objectCtx, OBJECT_GI_NUTSMASK); + + if (index >= 0) { + this->objectIndex = index; + this->actionFunc = func_80AAB644; + } +} + +void func_80AAB644(DmChar03* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x88)) { + s32 index = Cutscene_GetActorActionIndex(play, 0x88); + + 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; + } + } +} + +void DmChar03_DoNothing(DmChar03* this, PlayState* play) { +} + +void func_80AAB710(DmChar03* this, PlayState* play) { + u8 shouldChangeAnim = true; + + if (Cutscene_CheckActorAction(play, 0x88)) { + s32 index = Cutscene_GetActorActionIndex(play, 0x88); + + 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; + } + + 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 8d2905ad8..f736220c8 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; |
