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
6 changed files with 191 additions and 30 deletions
@@ -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);
}
@@ -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