summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkyleburnette <kyle@kyleburnette.com>2021-04-07 15:08:19 -0700
committerGitHub <noreply@github.com>2021-04-07 18:08:19 -0400
commit50d0bbe0876f213dd6ad3441230b988a6c145c25 (patch)
treebe69360935faf227803f10e8f2f774c534e64051 /src
parentd2c181a0a99430cd9893b022bd179cffc11dbbba (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c103
-rw-r--r--src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h12
-rw-r--r--src/overlays/actors/ovl_En_Rsn/z_en_rsn.c13
3 files changed, 102 insertions, 26 deletions
diff --git a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c
index ac53f53c5..e659b0bab 100644
--- a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c
+++ b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c
@@ -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;
+
+static ActorAnimationEntry D_80A2ED00[] = { { &D_0600CC94, 1.0f, 0, -1.0f, 0, 0 } };
+
+void func_80A2E960(SkelAnime* arg0, ActorAnimationEntry* animations, u16 index) {
+ f32 frameCount;
+ animations += index;
+
+ 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);
+}
+
+void DmSa_Init(Actor* thisx, GlobalContext* globalCtx) {
+ DmSa* this = THIS;
+
+ 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;
+}
+
+void DmSa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+}
+
+void DmSa_DoNothing(DmSa* this, GlobalContext* globalCtx) {
+}
+
+void DmSa_Update(Actor* thisx, GlobalContext* globalCtx) {
+ DmSa* this = THIS;
+
+ SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ this->alpha += 0;
+ this->actionFunc(this, globalCtx);
+}
+
+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++);
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/DmSa_Init.asm")
+ return dList;
+}
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/DmSa_Destroy.asm")
+Gfx* func_80A2EBB0(GraphicsContext* gfxCtx, u32 alpha) {
+ Gfx* dList;
+ Gfx* dListHead;
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EABC.asm")
+ dList = dListHead = GRAPH_ALLOC(gfxCtx, sizeof(Gfx) * 2);
+ gDPSetEnvColor(dListHead++, 0, 0, 0, alpha);
+ gSPEndDisplayList(dListHead++);
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/DmSa_Update.asm")
+ return dList;
+}
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EB10.asm")
+void DmSa_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ DmSa* this = THIS;
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EB2C.asm")
+ OPEN_DISPS(globalCtx->state.gfxCtx);
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EB44.asm")
+ func_8012C28C(globalCtx->state.gfxCtx);
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EB58.asm")
+ 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));
+ }
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/func_80A2EBB0.asm")
+ func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_80A2EB10, func_80A2EB2C, func_80A2EB44, this);
-#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Sa_0x80A2E960/DmSa_Draw.asm")
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h
index c8f020c9a..2b543deb6 100644
--- a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h
+++ b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h
@@ -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;
diff --git a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c
index 3c1c82589..6707b30ba 100644
--- a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c
+++ b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c
@@ -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;
}