Ovl_Dm_Hina decompiled (#1380)

* data

* all functions without func_80A1F75C

* func_80A1F75C

* improvements

* usage update

* fix

* x->y->z orders

* improvements

* != 0
This commit is contained in:
Nuss 2023-09-25 10:16:58 +02:00 committed by GitHub
parent b96732818a
commit 4e9e6c007c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 168 additions and 21 deletions

3
spec
View File

@ -2440,8 +2440,7 @@ beginseg
name "ovl_Dm_Hina" name "ovl_Dm_Hina"
compress compress
include "build/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.o" include "build/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.o"
include "build/data/ovl_Dm_Hina/ovl_Dm_Hina.data.o" include "build/src/overlays/actors/ovl_Dm_Hina/ovl_Dm_Hina_reloc.o"
include "build/data/ovl_Dm_Hina/ovl_Dm_Hina.reloc.o"
endseg endseg
beginseg beginseg

View File

@ -5,6 +5,7 @@
*/ */
#include "z_dm_hina.h" #include "z_dm_hina.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -20,7 +21,6 @@ void func_80A1F56C(DmHina* this, PlayState* play);
void func_80A1F5AC(DmHina* this, PlayState* play); void func_80A1F5AC(DmHina* this, PlayState* play);
void func_80A1F63C(DmHina* this, PlayState* play); void func_80A1F63C(DmHina* this, PlayState* play);
#if 0
ActorInit Dm_Hina_InitVars = { ActorInit Dm_Hina_InitVars = {
ACTOR_DM_HINA, ACTOR_DM_HINA,
ACTORCAT_ITEMACTION, ACTORCAT_ITEMACTION,
@ -33,24 +33,162 @@ ActorInit Dm_Hina_InitVars = {
(ActorFunc)DmHina_Draw, (ActorFunc)DmHina_Draw,
}; };
#endif void DmHina_Init(Actor* thisx, PlayState* play) {
DmHina* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/DmHina_Init.s") this->isDrawn = true;
this->actionFunc = func_80A1F470;
this->unk158 = this->actor.world.pos.y;
this->unk148 = 0.0f;
this->unk15C = 1.0f;
this->actor.focus.pos.x = this->actor.world.pos.x;
this->actor.focus.pos.y = this->actor.world.pos.y;
this->actor.focus.pos.z = this->actor.world.pos.z;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/DmHina_Destroy.s") void DmHina_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/func_80A1F470.s") void func_80A1F470(DmHina* this, PlayState* play) {
Player* player = GET_PLAYER(play);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/func_80A1F56C.s") Math_SmoothStepToF(&this->unk148, 0.6f, 0.5f, 0.05f, 0.001f);
this->unk154 = Math_SinS(play->gameplayFrames * 0x708) * 8.0f;
if ((player->stateFlags1 & PLAYER_STATE1_400) && (this->actor.xzDistToPlayer < 80.0f)) {
this->isDrawn = false;
this->unk154 = 0.0f;
this->actor.world.pos.y += 40.0f;
this->actionFunc = func_80A1F56C;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/func_80A1F5AC.s") void func_80A1F56C(DmHina* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
this->unk17C = 2;
this->actionFunc = func_80A1F5AC;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/func_80A1F63C.s") void func_80A1F5AC(DmHina* this, PlayState* play) {
this->unk17C--;
if (this->unk17C == 0) {
this->isDrawn = true;
Cutscene_StartManual(play, &play->csCtx);
this->subCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT);
Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE);
this->actionFunc = func_80A1F63C;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/func_80A1F75C.s") void func_80A1F63C(DmHina* this, PlayState* play) {
this->subCamEye.x = this->actor.world.pos.x + 100.0f;
this->subCamEye.y = this->unk158 + 260.0f;
this->subCamEye.z = this->actor.world.pos.z + 100.0f;
this->subCamAt.x = this->actor.world.pos.x;
this->subCamAt.y = this->actor.world.pos.y + this->unk154 * this->unk15C + 40.0f * this->unk15C;
this->subCamAt.z = this->actor.world.pos.z;
Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye);
Math_SmoothStepToF(&this->actor.world.pos.y, this->unk158 + 300.0f, 0.5f, 2.0f, 0.1f);
if (((this->unk158 + 240.0f) < this->actor.world.pos.y) && (this->unk17E != 1)) {
this->unk17E = 1;
Actor_PlaySfx(&this->actor, NA_SE_OC_WHITE_OUT_INTO_KYOJIN);
}
Actor_PlaySfx(&this->actor, NA_SE_EV_MASK_RISING - SFX_FLAG);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/DmHina_Update.s") void func_80A1F75C(DmHina* this, PlayState* play) {
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/func_80A1F9AC.s") switch (this->unk17E) {
case 0:
this->unk17F = 0;
this->unk14C = 0.0f;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Hina/DmHina_Draw.s") case 1:
Math_SmoothStepToF(&this->unk14C, 1.0f, 0.4f, 0.05f, 0.001f);
this->unk17F = this->unk14C * 255.0f;
this->unk150 = Math_SinS(play->state.frames * 0x1F40);
for (i = 0; i < 3; i++) {
play->envCtx.lightSettings.ambientColor[i] = play->envCtx.lightSettings.fogColor[i] =
play->envCtx.lightSettings.diffuseColor1[i] = -255.0f * this->unk14C;
}
play->envCtx.lightSettings.fogNear = -500.0f * this->unk14C;
if (play->envCtx.lightSettings.fogNear < -300) {
play->roomCtx.curRoom.segment = NULL;
}
break;
default:
break;
}
}
void DmHina_Update(Actor* thisx, PlayState* play) {
DmHina* this = THIS;
this->actionFunc(this, play);
func_80A1F75C(this, play);
}
void func_80A1F9AC(DmHina* this, PlayState* play) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
if (this->unk17E != 0) {
OPEN_DISPS(gfxCtx);
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, (u8)(this->unk14C * 100.0f) + 155, this->unk17F);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, (u8)(this->unk150 * 100.0f) + 50, 0);
gSPDisplayList(POLY_XLU_DISP++, gLightOrbMaterial1DL);
Matrix_Translate(this->actor.world.pos.x,
this->actor.world.pos.y + (this->unk154 * this->unk15C) + (40.0f * this->unk15C),
this->actor.world.pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(this->unk14C * 20.0f, this->unk14C * 20.0f, this->unk14C * 20.0f, MTXMODE_APPLY);
Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gLightOrbModelDL);
CLOSE_DISPS(gfxCtx);
}
}
void DmHina_Draw(Actor* thisx, PlayState* play) {
DmHina* this = THIS;
f32 scale;
if (this->isDrawn) {
Matrix_Translate(this->actor.world.pos.x,
this->actor.world.pos.y + (this->unk154 * this->unk15C) + (40.0f * this->unk15C),
this->actor.world.pos.z, MTXMODE_NEW);
Matrix_RotateZYX(0, play->gameplayFrames * 0x3E8, 0, MTXMODE_APPLY);
scale = this->unk148 * (1.0f - this->unk14C) * this->unk15C;
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
switch (this->actor.params) {
case 0:
GetItem_Draw(play, GID_REMAINS_ODOLWA);
break;
case 1:
GetItem_Draw(play, GID_REMAINS_GOHT);
break;
case 2:
GetItem_Draw(play, GID_REMAINS_GYORG);
break;
case 3:
GetItem_Draw(play, GID_REMAINS_TWINMOLD);
break;
default:
break;
}
func_80A1F9AC(this, play);
}
}

View File

@ -10,10 +10,20 @@ typedef void (*DmHinaActionFunc)(struct DmHina*, PlayState*);
typedef struct DmHina { typedef struct DmHina {
/* 0x000 */ Actor actor; /* 0x000 */ Actor actor;
/* 0x144 */ DmHinaActionFunc actionFunc; /* 0x144 */ DmHinaActionFunc actionFunc;
/* 0x148 */ char unk_148[0x10]; /* 0x148 */ f32 unk148;
/* 0x158 */ f32 unk_158; /* 0x14C */ f32 unk14C;
/* 0x15C */ f32 unk_15C; /* 0x150 */ f32 unk150;
/* 0x160 */ char unk_160[0x24]; /* 0x154 */ f32 unk154;
/* 0x158 */ f32 unk158;
/* 0x15C */ f32 unk15C;
/* 0x160 */ Vec3f subCamEye;
/* 0x16C */ Vec3f subCamAt;
/* 0x178 */ UNK_TYPE1 pad178[2];
/* 0x17A */ s16 subCamId;
/* 0x17C */ s16 unk17C;
/* 0x17E */ u8 unk17E;
/* 0x17F */ u8 unk17F;
/* 0x180 */ u8 isDrawn;
} DmHina; // size = 0x184 } DmHina; // size = 0x184
#endif // Z_DM_HINA_H #endif // Z_DM_HINA_H

View File

@ -919,10 +919,10 @@ void DoorWarp1_Update(Actor* thisx, PlayState* play) {
this->unk_204 = 1.0f; this->unk_204 = 1.0f;
} }
if ((this->unk_1A0 != NULL) && (this->unk_1A0->unk_15C != this->unk_204)) { if ((this->unk_1A0 != NULL) && (this->unk_1A0->unk15C != this->unk_204)) {
this->unk_1A0->actor.world.pos.y = this->dyna.actor.world.pos.y; this->unk_1A0->actor.world.pos.y = this->dyna.actor.world.pos.y;
this->unk_1A0->unk_158 = this->dyna.actor.world.pos.y; this->unk_1A0->unk158 = this->dyna.actor.world.pos.y;
this->unk_1A0->unk_15C = this->unk_204; this->unk_1A0->unk15C = this->unk_204;
} }
this->actionFunc(this, play); this->actionFunc(this, play);