ovl_Demo_Moonend ok (#1249)

* Progress

* one more

* OK

* update

* finished z_demo_moonend

* update reloc

* actually updated reloc

* fix symbols

* made suggested changes

* reformat

* Made suggested changes

* forgot to run format.py

* made suggested changes

* made suggested changes

* moved cueid to be in scope
This commit is contained in:
Lucas Shaw 2023-05-30 21:01:08 -04:00 committed by GitHub
parent f8ac9d2e9a
commit 72c4f378cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 191 additions and 30 deletions

View File

@ -1,6 +1,7 @@
<Root>
<File Name="object_moonend" Segment="6">
<!-- <Blob Name="object_moonend_Blob_000000" Size="0x1230" Offset="0x0" /> -->
<!-- <Blob Name="object_moonend_Blob_000000" Size="0x1214" Offset="0x0" /> -->
<Blob Name="object_moonend_Blob_001214" Size="0x43DC" Offset="0x1214" />
<DList Name="object_moonend_DL_0055F0" Offset="0x55F0" />
<DList Name="object_moonend_DL_0061F8" Offset="0x61F8" />
<DList Name="object_moonend_DL_006460" Offset="0x6460" />
@ -19,7 +20,8 @@
<Texture Name="object_moonend_Tex_009530" OutName="tex_009530" Format="i8" Width="64" Height="64" Offset="0x9530" />
<Texture Name="object_moonend_Tex_00A530" OutName="tex_00A530" Format="i8" Width="64" Height="64" Offset="0xA530" />
<TextureAnimation Name="object_moonend_Matanimheader_00B540" Offset="0xB540" />
<!-- <Blob Name="object_moonend_Blob_00B550" Size="0x1C0" Offset="0xB550" /> -->
<!-- <Blob Name="object_moonend_Blob_00B550" Size="0x50" Offset="0xB550" /> -->
<Blob Name="object_moonend_Blob_00B5A0" Size="0x1750" Offset="0xB5A0" />
<DList Name="object_moonend_DL_00CCF0" Offset="0xCCF0" />
<DList Name="object_moonend_DL_00CF58" Offset="0xCF58" />
<DList Name="object_moonend_DL_00D080" Offset="0xD080" />

View File

@ -304,7 +304,7 @@ typedef struct SkeletonInfo {
typedef s32 (*OverrideKeyframeDrawScaled)(struct PlayState* play, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList,
u8* flags, struct Actor* actor, Vec3f* scale, Vec3s* rot, Vec3f* pos);
typedef void (*PostKeyframeDrawScaled)(struct PlayState* play, SkeletonInfo* skeleton, s32 limbIndex, Gfx** dList,
typedef s32 (*PostKeyframeDrawScaled)(struct PlayState* play, SkeletonInfo* skeleton, s32 limbIndex, Gfx** dList,
u8* flags, struct Actor* actor, Vec3f* scale, Vec3s* rot, Vec3f* pos);
void SkelAnime_DrawLod(struct PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, struct Actor* actor, s32 lod);

3
spec
View File

@ -4852,8 +4852,7 @@ beginseg
name "ovl_Demo_Moonend"
compress
include "build/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.o"
include "build/data/ovl_Demo_Moonend/ovl_Demo_Moonend.data.o"
include "build/data/ovl_Demo_Moonend/ovl_Demo_Moonend.reloc.o"
include "build/src/overlays/actors/ovl_Demo_Moonend/ovl_Demo_Moonend_reloc.o"
endseg
beginseg

View File

@ -15,8 +15,12 @@ void DemoMoonend_Destroy(Actor* thisx, PlayState* play);
void DemoMoonend_Update(Actor* thisx, PlayState* play);
void DemoMoonend_Draw(Actor* thisx, PlayState* play);
#if 0
ActorInit Demo_Moonend_InitVars = {
void DemoMoonend_DoNothing(DemoMoonend* this, PlayState* play);
void func_80C17B60(DemoMoonend* this, PlayState* play);
void func_80C17C48(DemoMoonend* this, PlayState* play);
void func_80C17FCC(Actor* thisx, PlayState* play);
const ActorInit Demo_Moonend_InitVars = {
ACTOR_DEMO_MOONEND,
ACTORCAT_ITEMACTION,
FLAGS,
@ -28,28 +32,185 @@ ActorInit Demo_Moonend_InitVars = {
(ActorFunc)DemoMoonend_Draw,
};
#endif
void DemoMoonend_Init(Actor* thisx, PlayState* play) {
DemoMoonend* this = THIS;
extern UNK_TYPE D_06001214;
extern UNK_TYPE D_0600B540;
extern UNK_TYPE D_060129F0;
Actor_SetScale(&this->actor, 0.1f);
this->actionFunc = DemoMoonend_DoNothing;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/DemoMoonend_Init.s")
if (DEMOMOONEND_GET_PARAMS_F(thisx) == 1) {
Actor_SetScale(&this->actor, 0.05f);
Actor_SetScale(&this->actor, 6.0f);
this->actor.draw = NULL;
this->cueType = CS_CMD_ACTOR_CUE_558;
this->actionFunc = func_80C17B60;
} else {
Actor_SetScale(&this->actor, 0.095f);
func_80183430(&this->skeletonInfo, &object_moonend_Blob_00B5A0, &object_moonend_Blob_001214, this->jointTable,
this->morphTable, NULL);
func_801834A8(&this->skeletonInfo, &object_moonend_Blob_001214);
this->cueType = CS_CMD_ACTOR_CUE_560;
this->actionFunc = func_80C17C48;
this->actor.home.rot.z = 0;
this->actor.draw = NULL;
this->skeletonInfo.frameCtrl.unk_C = 2.0f / 3.0f;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/DemoMoonend_Destroy.s")
void DemoMoonend_Destroy(Actor* thisx, PlayState* play) {
DemoMoonend* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/func_80C17B50.s")
if (DEMOMOONEND_GET_PARAMS_F(thisx) != 1) {
func_8018349C(&this->skeletonInfo);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/func_80C17B60.s")
void DemoMoonend_DoNothing(DemoMoonend* this, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/func_80C17C48.s")
void func_80C17B60(DemoMoonend* this, PlayState* play) {
if (Cutscene_IsCueInChannel(play, this->cueType)) {
u16 cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/DemoMoonend_Update.s")
Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType));
if (this->cueId != cueId) {
this->cueId = cueId;
switch (this->cueId) {
case 1:
this->actor.draw = NULL;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/func_80C17E70.s")
case 2:
this->actor.draw = func_80C17FCC;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/func_80C17EE0.s")
default:
break;
}
}
if (this->cueId == 2) {
func_800B9010(&this->actor, NA_SE_EV_RAINBOW - SFX_FLAG);
}
} else {
this->actor.draw = NULL;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/DemoMoonend_Draw.s")
void func_80C17C48(DemoMoonend* this, PlayState* play) {
if (func_80183DE0(&this->skeletonInfo)) {
this->actor.home.rot.z = 0;
}
if (Cutscene_IsCueInChannel(play, this->cueType)) {
u16 cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Moonend/func_80C17FCC.s")
Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType));
if (this->cueId != cueId) {
this->cueId = cueId;
switch (this->cueId) {
case 1:
this->actor.draw = DemoMoonend_Draw;
func_801834A8(&this->skeletonInfo, &object_moonend_Blob_001214);
this->skeletonInfo.frameCtrl.unk_C = 0.0f;
break;
case 2:
this->actor.draw = DemoMoonend_Draw;
func_801834A8(&this->skeletonInfo, &object_moonend_Blob_001214);
this->skeletonInfo.frameCtrl.unk_C = 2.0f / 3.0f;
Actor_PlaySfx(&this->actor, NA_SE_EV_MOON_EXPLOSION);
this->actor.home.rot.z = 1;
break;
default:
break;
}
}
if (this->actor.home.rot.z != 0) {
func_800B9010(&this->actor, NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG);
}
} else {
this->actor.draw = NULL;
}
if ((play->csCtx.state != CS_STATE_IDLE) && (gSaveContext.sceneLayer == 8) && (play->csCtx.scriptIndex == 0)) {
switch (play->csCtx.curFrame) {
case 5:
Actor_PlaySfx(&this->actor, NA_SE_EN_MOON_SCREAM1);
break;
case 50:
Actor_PlaySfx(&this->actor, NA_SE_EN_MOON_SCREAM2);
break;
case 100:
Actor_PlaySfx(&this->actor, NA_SE_EN_MOON_SCREAM3);
break;
case 150:
Actor_PlaySfx(&this->actor, NA_SE_EN_MOON_SCREAM2);
break;
case 200:
Actor_PlaySfx(&this->actor, NA_SE_EN_MOON_SCREAM4);
break;
default:
break;
}
}
}
void DemoMoonend_Update(Actor* thisx, PlayState* play) {
DemoMoonend* this = THIS;
this->actionFunc(this, play);
}
s32 func_80C17E70(PlayState* play, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList, u8* flags, Actor* thisx,
Vec3f* scale, Vec3s* rot, Vec3f* pos) {
DemoMoonend* this = THIS;
if (limbIndex == 2) {
Matrix_Push();
Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, MTXMODE_APPLY);
}
return true;
}
s32 func_80C17EE0(PlayState* play, SkeletonInfo* skeleton, s32 limbIndex, Gfx** dList, u8* flags, Actor* thisx,
Vec3f* scale, Vec3s* rot, Vec3f* pos) {
DemoMoonend* this = THIS;
if (limbIndex == 8) {
Matrix_Pop();
}
return true;
}
void DemoMoonend_Draw(Actor* thisx, PlayState* play) {
DemoMoonend* this = THIS;
Mtx* mtx;
AnimatedMat_Draw(play, (AnimatedMaterial*)Lib_SegmentedToVirtual(object_moonend_Matanimheader_00B540));
mtx = GRAPH_ALLOC(play->state.gfxCtx, this->skeletonInfo.unk_18->unk_1 * sizeof(Mtx));
if (mtx != NULL) {
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
Gfx_SetupDL25_Opa(play->state.gfxCtx);
func_8018450C(play, &this->skeletonInfo, mtx, func_80C17E70, func_80C17EE0, &this->actor);
}
}
void func_80C17FCC(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
AnimatedMat_DrawXlu(play, Lib_SegmentedToVirtual(object_moonend_Matanimheader_0129F0));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, object_moonend_DL_010C40);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -2,14 +2,21 @@
#define Z_DEMO_MOONEND_H
#include "global.h"
#include "objects/object_moonend/object_moonend.h"
struct DemoMoonend;
typedef void (*DemoMoonendActionFunc)(struct DemoMoonend*, PlayState*);
#define DEMOMOONEND_GET_PARAMS_F(thisx) (((thisx)->params) & 0xF)
typedef struct DemoMoonend {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x19C];
/* 0x144 */ SkeletonInfo skeletonInfo;
/* 0x174 */ Vec3s jointTable[30];
/* 0x228 */ Vec3s morphTable[30];
/* 0x2DC */ u16 cueType;
/* 0x2DE */ u16 cueId;
/* 0x2E0 */ DemoMoonendActionFunc actionFunc;
} DemoMoonend; // size = 0x2E4

View File

@ -725,14 +725,6 @@ D_060134D0 = 0x060134D0;
D_06013828 = 0x06013828;
D_06014040 = 0x06014040;
// ovl_Demo_Moonend
D_06001214 = 0x06001214;
D_0600B540 = 0x0600B540;
D_0600B5A0 = 0x0600B5A0;
D_06010C40 = 0x06010C40;
D_060129F0 = 0x060129F0;
// ovl_Dm_Tsg
D_06002D30 = 0x06002D30;