dm_sa OK (#88)

* initial dm_sa work

* more dmsa work

* dm_sa OK

* Changed char arrays in header to be UNK_TYPE1

* Made all of roz's suggested changes

* merge
This commit is contained in:
kyleburnette
2021-04-07 15:08:19 -07:00
committed by GitHub
parent d2c181a0a9
commit 50d0bbe087
8 changed files with 165 additions and 62 deletions
+89 -14
View File
@@ -9,7 +9,8 @@ void DmSa_Destroy(Actor* thisx, GlobalContext* globalCtx);
void DmSa_Update(Actor* thisx, GlobalContext* globalCtx);
void DmSa_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void DmSa_DoNothing(DmSa* this, GlobalContext* globalCtx);
const ActorInit Dm_Sa_InitVars = {
ACTOR_DM_SA,
ACTORCAT_ITEMACTION,
@@ -19,28 +20,102 @@ const ActorInit Dm_Sa_InitVars = {
(ActorFunc)DmSa_Init,
(ActorFunc)DmSa_Destroy,
(ActorFunc)DmSa_Update,
(ActorFunc)DmSa_Draw
(ActorFunc)DmSa_Draw,
};
*/
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2E960.asm")
extern SkeletonHeader D_06013328;
extern AnimationHeader D_0600CC94;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/DmSa_Init.asm")
static ActorAnimationEntry D_80A2ED00[] = { { &D_0600CC94, 1.0f, 0, -1.0f, 0, 0 } };
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/DmSa_Destroy.asm")
void func_80A2E960(SkelAnime* arg0, ActorAnimationEntry* animations, u16 index) {
f32 frameCount;
animations += index;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EABC.asm")
if (animations->frameCount < 0.0f) {
frameCount = SkelAnime_GetFrameCount(animations->animation);
} else {
frameCount = animations->frameCount;
}
SkelAnime_ChangeAnim(arg0, animations->animation, animations->playSpeed, animations->startFrame, frameCount,
animations->mode, animations->morphFrames);
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/DmSa_Update.asm")
void DmSa_Init(Actor* thisx, GlobalContext* globalCtx) {
DmSa* this = THIS;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EB10.asm")
this->unk2E0 = 0;
this->alpha = 0xFF;
this->actor.targetArrowOffset = 3000.0f;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 24.0f);
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013328, NULL, 0, 0, 0);
func_80A2E960(&this->skelAnime, &D_80A2ED00, 0);
Actor_SetScale(&this->actor, 0.01f);
this->actionFunc = DmSa_DoNothing;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EB2C.asm")
void DmSa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EB44.asm")
void DmSa_DoNothing(DmSa* this, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EB58.asm")
void DmSa_Update(Actor* thisx, GlobalContext* globalCtx) {
DmSa* this = THIS;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EBB0.asm")
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
this->alpha += 0;
this->actionFunc(this, globalCtx);
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/DmSa_Draw.asm")
s32 func_80A2EB10(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
return 0;
}
void func_80A2EB2C(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
}
void func_80A2EB44(s32 arg0, s32 arg1, s32 arg2) {
}
Gfx* func_80A2EB58(GraphicsContext* gfxCtx, u32 alpha) {
Gfx* dList;
Gfx* dListHead;
dList = dListHead = GRAPH_ALLOC(gfxCtx, sizeof(Gfx) * 2); //! @bug this does not allocate enough for 3 Gfx commands
gDPSetRenderMode(dListHead++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2);
gDPSetEnvColor(dListHead++, 0, 0, 0, alpha);
gSPEndDisplayList(dListHead++);
return dList;
}
Gfx* func_80A2EBB0(GraphicsContext* gfxCtx, u32 alpha) {
Gfx* dList;
Gfx* dListHead;
dList = dListHead = GRAPH_ALLOC(gfxCtx, sizeof(Gfx) * 2);
gDPSetEnvColor(dListHead++, 0, 0, 0, alpha);
gSPEndDisplayList(dListHead++);
return dList;
}
void DmSa_Draw(Actor* thisx, GlobalContext* globalCtx) {
DmSa* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
if (this->alpha < 0xFF) {
gSPSegment(POLY_OPA_DISP++, 0x0C, func_80A2EB58(globalCtx->state.gfxCtx, this->alpha));
} else {
gSPSegment(POLY_OPA_DISP++, 0x0C, func_80A2EBB0(globalCtx->state.gfxCtx, this->alpha));
}
func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
func_80A2EB10, func_80A2EB2C, func_80A2EB44, this);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
+11 -1
View File
@@ -5,9 +5,19 @@
struct DmSa;
typedef void (*DmSaActionFunc)(struct DmSa*, GlobalContext*);
typedef struct DmSa {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x1B0];
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ UNK_TYPE1 unk194[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];
/* 0x2F0 */ u32 alpha;
} DmSa; // size = 0x2F4
extern const ActorInit Dm_Sa_InitVars;
+2 -11
View File
@@ -11,15 +11,6 @@ void EnRsn_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_80C25D84(EnRsn* this, GlobalContext* globalCtx);
typedef struct {
/* 0x00 */ AnimationHeader* animation;
/* 0x04 */ f32 playbackSpeed;
/* 0x08 */ f32 unk_08;
/* 0x0C */ f32 frameCount;
/* 0x10 */ u8 unk_10;
/* 0x14 */ f32 transitionRate;
} EnRsn_AnimationStruct; // size = 0x18
const ActorInit En_Rsn_InitVars = {
ACTOR_EN_RSN,
ACTORCAT_NPC,
@@ -37,10 +28,10 @@ extern AnimationHeader D_06009120;
extern AnimationHeader D_0600788C;
extern Gfx D_06005458[];
static EnRsn_AnimationStruct animation = { &D_0600788C, 1.0f, 0.0f, 0.0f, 0x00, 0.0f };
static ActorAnimationEntry animations[] = {{ &D_0600788C, 1.0f, 0.0f, 0.0f, 0x00, 0.0f }};
void func_80C25D40(EnRsn* this) {
func_800BDC5C(&this->skelAnime, &animation, 0);
func_800BDC5C(&this->skelAnime, &animations, 0);
this->actionFunc = func_80C25D84;
}