ovl_Dm_Char06 OK (#986)

* `ovl_Dm_Char06` decompiled

* Suggested changes

* Minor changes

* Formatting
This commit is contained in:
Lucas 2022-08-09 20:33:57 -04:00 committed by GitHub
parent b14656c529
commit f3c6e451fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 15 deletions

3
spec
View File

@ -3137,8 +3137,7 @@ beginseg
name "ovl_Dm_Char06"
compress
include "build/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.o"
include "build/data/ovl_Dm_Char06/ovl_Dm_Char06.data.o"
include "build/data/ovl_Dm_Char06/ovl_Dm_Char06.reloc.o"
include "build/src/overlays/actors/ovl_Dm_Char06/ovl_Dm_Char06_reloc.o"
endseg
beginseg

View File

@ -15,11 +15,9 @@ void DmChar06_Destroy(Actor* thisx, PlayState* play);
void DmChar06_Update(Actor* thisx, PlayState* play);
void DmChar06_Draw(Actor* thisx, PlayState* play);
void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc);
void func_80AAE6F0(DmChar06* this, PlayState* play);
void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc);
#if 0
const ActorInit Dm_Char06_InitVars = {
ACTOR_DM_CHAR06,
ACTORCAT_ITEMACTION,
@ -32,18 +30,60 @@ const ActorInit Dm_Char06_InitVars = {
(ActorFunc)DmChar06_Draw,
};
#endif
void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
extern UNK_TYPE D_06006868;
void DmChar06_Init(Actor* thisx, PlayState* play) {
DmChar06* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_SetupAction.s")
gSaveContext.save.weekEventReg[33] |= 0x80;
Actor_SetScale(&this->actor, 1.0f);
this->alpha = 255;
DmChar06_SetupAction(this, func_80AAE6F0);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Init.s")
void DmChar06_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Destroy.s")
void func_80AAE6F0(DmChar06* this, PlayState* play) {
if (Cutscene_CheckActorAction(play, 0x1CF)) {
s32 actionIndex = Cutscene_GetActorActionIndex(play, 0x1CF);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/func_80AAE6F0.s")
if ((play->csCtx.frames >= play->csCtx.actorActions[actionIndex]->startFrame) &&
(play->csCtx.actorActions[actionIndex]->endFrame >= play->csCtx.frames)) {
if (play->csCtx.actorActions[actionIndex]->action == 1) {
this->alpha = 255;
} else if (play->csCtx.actorActions[actionIndex]->action == 2) {
f32 lerp = 1.0f - Environment_LerpWeight(play->csCtx.actorActions[actionIndex]->endFrame,
play->csCtx.actorActions[actionIndex]->startFrame,
play->csCtx.frames);
this->alpha = 255 * lerp;
}
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Update.s")
void DmChar06_Update(Actor* thisx, PlayState* play) {
DmChar06* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Draw.s")
this->actionFunc(this, play);
}
void DmChar06_Draw(Actor* thisx, PlayState* play) {
s32 pad;
DmChar06* this = THIS;
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_yukiyama_Matanimheader_006868));
OPEN_DISPS(play->state.gfxCtx);
func_8012C2DC(play->state.gfxCtx);
Scene_SetRenderModeXlu(play, 1, 2);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, object_yukiyama_DL_0013A8);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -2,6 +2,7 @@
#define Z_DM_CHAR06_H
#include "global.h"
#include "assets/objects/object_yukiyama/object_yukiyama.h"
struct DmChar06;
@ -9,9 +10,10 @@ typedef void (*DmChar06ActionFunc)(struct DmChar06*, PlayState*);
typedef struct DmChar06 {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x14C];
/* 0x144 */ UNK_TYPE1 pad144[0x14C];
/* 0x290 */ DmChar06ActionFunc actionFunc;
/* 0x294 */ char unk_294[0x10];
/* 0x294 */ UNK_TYPE1 pad294[0xC];
/* 0x2A0 */ u8 alpha;
} DmChar06; // size = 0x2A4
extern const ActorInit Dm_Char06_InitVars;