z_en_zl4 OK (#1663)

* match zl4

* cleanup
This commit is contained in:
engineer124 2024-07-29 02:48:10 +10:00 committed by GitHub
parent bd776e6bf5
commit d0cf4fbcea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 116 additions and 40 deletions

View File

@ -230,10 +230,6 @@ D_06004894 = 0x06004894;
D_060086BC = 0x060086BC;
D_0600C3E0 = 0x0600C3E0;
// ovl_En_Zl4
D_06013328 = 0x06013328;
// segment 0x07
// segment 0x08

3
spec
View File

@ -2074,8 +2074,7 @@ beginseg
name "ovl_En_Zl4"
compress
include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Zl4/z_en_zl4.o"
include "$(BUILD_DIR)/data/ovl_En_Zl4/ovl_En_Zl4.data.o"
include "$(BUILD_DIR)/data/ovl_En_Zl4/ovl_En_Zl4.reloc.o"
include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Zl4/ovl_En_Zl4_reloc.o"
endseg
beginseg

View File

@ -30,7 +30,7 @@ ActorInit Dm_Char04_InitVars = {
/**/ DmChar04_Draw,
};
typedef enum {
typedef enum DmChar04Animation {
/* 0 */ DMCHAR04_ANIM_0,
/* 1 */ DMCHAR04_ANIM_1,
/* 2 */ DMCHAR04_ANIM_MAX

View File

@ -30,7 +30,7 @@ ActorInit Dm_Sa_InitVars = {
/**/ DmSa_Draw,
};
typedef enum {
typedef enum DmSaAnimation {
/* -1 */ DMSA_ANIM_NONE = -1,
/* 0 */ DMSA_ANIM_T_POSE,
/* 1 */ DMSA_ANIM_MAX
@ -58,8 +58,8 @@ void DmSa_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animInfo, u16 animInde
void DmSa_Init(Actor* thisx, PlayState* play) {
DmSa* this = THIS;
this->unk2E0 = 0;
this->alpha = 0xFF;
this->unk_2E0 = 0;
this->alpha = 255;
this->actor.targetArrowOffset = 3000.0f;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &gSkullKidSkel, NULL, NULL, NULL, 0);
@ -120,7 +120,7 @@ void DmSa_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL25_Opa(play->state.gfxCtx);
if (this->alpha < 0xFF) {
if (this->alpha < 255) {
gSPSegment(POLY_OPA_DISP++, 0x0C, func_80A2EB58(play->state.gfxCtx, this->alpha));
} else {
gSPSegment(POLY_OPA_DISP++, 0x0C, func_80A2EBB0(play->state.gfxCtx, this->alpha));

View File

@ -10,13 +10,11 @@ typedef void (*DmSaActionFunc)(struct DmSa*, PlayState*);
typedef struct DmSa {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ UNK_TYPE1 unk194[0x108];
/* 0x188 */ UNK_TYPE1 unk_188[0x108];
/* 0x290 */ DmSaActionFunc actionFunc;
/* 0x294 */ UNK_TYPE1 unk294[0x20];
/* 0x2B4 */ s32 unk2B4;
/* 0x2B8 */ UNK_TYPE1 unk2B8[0x28];
/* 0x2E0 */ u16 unk2E0;
/* 0x2E2 */ UNK_TYPE1 unk2E2[0xE];
/* 0x294 */ UNK_TYPE1 unk_294[0x4C];
/* 0x2E0 */ u16 unk_2E0;
/* 0x2E2 */ UNK_TYPE1 unk_2E2[0xE];
/* 0x2F0 */ u32 alpha;
} DmSa; // size = 0x2F4

View File

@ -5,6 +5,7 @@
*/
#include "z_en_zl4.h"
#include "objects/object_stk/object_stk.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -15,9 +16,8 @@ void EnZl4_Destroy(Actor* thisx, PlayState* play);
void EnZl4_Update(Actor* thisx, PlayState* play);
void EnZl4_Draw(Actor* thisx, PlayState* play);
void func_809A1D0C(EnZl4* this, PlayState* play);
void EnZl4_DoNothing(EnZl4* this, PlayState* play);
#if 0
ActorInit En_Zl4_InitVars = {
/**/ ACTOR_EN_ZL4,
/**/ ACTORCAT_ITEMACTION,
@ -30,28 +30,107 @@ ActorInit En_Zl4_InitVars = {
/**/ EnZl4_Draw,
};
#endif
typedef enum EnZl4Animation {
/* -1 */ ENZL4_ANIM_NONE = -1,
/* 0 */ ENZL4_ANIM_T_POSE,
/* 1 */ ENZL4_ANIM_MAX
} EnZl4Animation;
extern UNK_TYPE D_06013328;
static AnimationInfo sAnimationInfo[ENZL4_ANIM_MAX] = {
{ &gSkullKidTPoseAnim, 1.0f, 0, -1.0f, ANIMMODE_LOOP, 0 }, // ENZL4_ANIM_T_POSE
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/func_809A1BB0.s")
void EnZl4_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animInfo, u16 animIndex) {
f32 endFrame;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/EnZl4_Init.s")
animInfo += animIndex;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/EnZl4_Destroy.s")
if (animInfo->frameCount < 0.0f) {
endFrame = Animation_GetLastFrame(animInfo->animation);
} else {
endFrame = animInfo->frameCount;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/func_809A1D0C.s")
Animation_Change(skelAnime, animInfo->animation, animInfo->playSpeed, animInfo->startFrame, endFrame,
animInfo->mode, animInfo->morphFrames);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/EnZl4_Update.s")
void EnZl4_Init(Actor* thisx, PlayState* play) {
EnZl4* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/func_809A1D60.s")
this->unk_2E0 = 0;
this->alpha = 255;
this->actor.targetArrowOffset = 3000.0f;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &gSkullKidSkel, NULL, NULL, NULL, 0);
EnZl4_ChangeAnim(&this->skelAnime, &sAnimationInfo[ENZL4_ANIM_T_POSE], 0);
Actor_SetScale(&this->actor, 0.01f);
this->actionFunc = EnZl4_DoNothing;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/func_809A1DA4.s")
void EnZl4_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/func_809A1DBC.s")
void EnZl4_DoNothing(EnZl4* this, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/func_809A1DD0.s")
void EnZl4_Update(Actor* thisx, PlayState* play) {
EnZl4* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/func_809A1E28.s")
SkelAnime_Update(&this->skelAnime);
this->alpha += 0;
this->actionFunc(this, play);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zl4/EnZl4_Draw.s")
s32 EnZl4_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
Vec3f D_809A1F98 = { 0.0f, 0.0f, 0.0f };
return false;
}
void EnZl4_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
}
void EnZl4_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
}
Gfx* func_809A1DD0(GraphicsContext* gfxCtx, u32 alpha) {
Gfx* gfxHead = GRAPH_ALLOC(gfxCtx, 2 * sizeof(Gfx)); //! @bug this does not allocate enough for 3 Gfx commands;
Gfx* gfx = gfxHead;
gDPSetRenderMode(gfx++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2);
gDPSetEnvColor(gfx++, 0, 0, 0, alpha);
gSPEndDisplayList(gfx++);
return gfxHead;
}
Gfx* func_809A1E28(GraphicsContext* gfxCtx, u32 alpha) {
Gfx* gfxHead = GRAPH_ALLOC(gfxCtx, 2 * sizeof(Gfx));
Gfx* gfx = gfxHead;
gDPSetEnvColor(gfx++, 0, 0, 0, alpha);
gSPEndDisplayList(gfx++);
return gfxHead;
}
void EnZl4_Draw(Actor* thisx, PlayState* play) {
EnZl4* this = THIS;
OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL25_Opa(play->state.gfxCtx);
if (this->alpha < 255) {
gSPSegment(POLY_OPA_DISP++, 0x0C, func_809A1DD0(play->state.gfxCtx, this->alpha));
} else {
gSPSegment(POLY_OPA_DISP++, 0x0C, func_809A1E28(play->state.gfxCtx, this->alpha));
}
SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, EnZl4_OverrideLimbDraw, EnZl4_PostLimbDraw,
EnZl4_TransformLimbDraw, &this->actor);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -9,9 +9,13 @@ typedef void (*EnZl4ActionFunc)(struct EnZl4*, PlayState*);
typedef struct EnZl4 {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x14C];
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ UNK_TYPE1 unk_188[0x108];
/* 0x290 */ EnZl4ActionFunc actionFunc;
/* 0x294 */ char unk_294[0x60];
/* 0x294 */ UNK_TYPE1 unk_294[0x4C];
/* 0x2E0 */ u16 unk_2E0;
/* 0x2E2 */ UNK_TYPE1 unk_2E2[0xE];
/* 0x2F0 */ u32 alpha;
} EnZl4; // size = 0x2F4
#endif // Z_EN_ZL4_H

View File

@ -8665,14 +8665,14 @@
0x809A15A0:("ObjHamishi_Destroy",),
0x809A15CC:("ObjHamishi_Update",),
0x809A17BC:("ObjHamishi_Draw",),
0x809A1BB0:("func_809A1BB0",),
0x809A1BB0:("EnZl4_ChangeAnim",),
0x809A1C4C:("EnZl4_Init",),
0x809A1CFC:("EnZl4_Destroy",),
0x809A1D0C:("func_809A1D0C",),
0x809A1D0C:("EnZl4_DoNothing",),
0x809A1D1C:("EnZl4_Update",),
0x809A1D60:("func_809A1D60",),
0x809A1DA4:("func_809A1DA4",),
0x809A1DBC:("func_809A1DBC",),
0x809A1D60:("EnZl4_OverrideLimbDraw",),
0x809A1DA4:("EnZl4_PostLimbDraw",),
0x809A1DBC:("EnZl4_TransformLimbDraw",),
0x809A1DD0:("func_809A1DD0",),
0x809A1E28:("func_809A1E28",),
0x809A1E60:("EnZl4_Draw",),

View File

@ -9239,7 +9239,7 @@
0x809A1B0C:("D_809A1B0C","f32","",0x4),
0x809A1B10:("D_809A1B10","f32","",0x4),
0x809A1F60:("En_Zl4_InitVars","UNK_TYPE1","",0x1),
0x809A1F80:("D_809A1F80","UNK_TYPE1","",0x1),
0x809A1F80:("sAnimationInfo","UNK_TYPE1","",0x1),
0x809A1F98:("D_809A1F98","UNK_TYPE4","",0x4),
0x809A1FB0:("D_809A1FB0","f32","",0x4),
0x809A2250:("En_Mm2_InitVars","UNK_TYPE1","",0x1),