From 1be5a7d2c7e63880faaf10d359c15ada7673f386 Mon Sep 17 00:00:00 2001 From: SonicDcer <96613413+sonicdcer@users.noreply.github.com> Date: Fri, 30 Sep 2022 12:37:01 -0300 Subject: [PATCH] ovl_Oceff_Wipe5 OK (#1011) * progress * progress * ovl_Oceff_Wipe5 OK * Co-authored-by: Derek-Hensley hensley.derek58@gmail.com * Co-authored-by: Synray synray@users.noreply.github.com * Co-authored-by: darkeye darkeye@users.noreply.github.com * pr review * pr review * Magic_Reset * fixes --- assets/xml/overlays/ovl_Oceff_Wipe5.xml | 9 ++ spec | 4 +- .../actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c | 103 +++++++++++++++++- .../actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h | 4 +- 4 files changed, 110 insertions(+), 10 deletions(-) create mode 100644 assets/xml/overlays/ovl_Oceff_Wipe5.xml diff --git a/assets/xml/overlays/ovl_Oceff_Wipe5.xml b/assets/xml/overlays/ovl_Oceff_Wipe5.xml new file mode 100644 index 0000000000..52f197428b --- /dev/null +++ b/assets/xml/overlays/ovl_Oceff_Wipe5.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/spec b/spec index 6b4395bb1b..b4a8a61082 100644 --- a/spec +++ b/spec @@ -4363,9 +4363,7 @@ beginseg name "ovl_Oceff_Wipe5" compress include "build/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.o" - include "build/data/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5.data.o" - include "build/data/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5.bss.o" - include "build/data/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5.reloc.o" + include "build/src/overlays/actors/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c index 1bef04db8b..951ba1c39a 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c +++ b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c @@ -15,7 +15,6 @@ void OceffWipe5_Destroy(Actor* thisx, PlayState* play); void OceffWipe5_Update(Actor* thisx, PlayState* play); void OceffWipe5_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit Oceff_Wipe5_InitVars = { ACTOR_OCEFF_WIPE5, ACTORCAT_ITEMACTION, @@ -28,12 +27,104 @@ const ActorInit Oceff_Wipe5_InitVars = { (ActorFunc)OceffWipe5_Draw, }; -#endif +UNK_TYPE4 D_80BC9260; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe5/OceffWipe5_Init.s") +void OceffWipe5_Init(Actor* thisx, PlayState* play) { + OceffWipe5* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe5/OceffWipe5_Destroy.s") + Actor_SetScale(&this->actor, 1.0f); + this->counter = 0; + this->actor.world.pos = play->cameraPtrs[play->activeCamId]->eye; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe5/OceffWipe5_Update.s") +void OceffWipe5_Destroy(Actor* thisx, PlayState* play) { + OceffWipe5* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe5/OceffWipe5_Draw.s") + Magic_Reset(play); + play->msgCtx.unk120B0 = 0; +} + +void OceffWipe5_Update(Actor* thisx, PlayState* play) { + OceffWipe5* this = THIS; + + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; + if (this->counter < 100) { + this->counter++; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +#include "assets/overlays/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5.c" + +static u8 sPrimColors[] = { + 255, 255, 200, 255, 255, 200, 200, 255, 255, 255, 255, 200, 255, 200, 255, +}; + +static u8 sEnvColors[] = { + 50, 200, 0, 255, 50, 0, 0, 100, 255, 255, 150, 0, 255, 0, 200, +}; + +void OceffWipe5_Draw(Actor* thisx, PlayState* play) { + OceffWipe5* this = THIS; + f32 z; + s32 pad; + s32 i; + s32 pad2; + Vec3f activeCamEye = GET_ACTIVE_CAM(play)->eye; + Camera* cam = GET_ACTIVE_CAM(play); + Vec3f quakeOffset; + u8 alpha; + s32 colorIndex = OCEFF_WIPE5_GET_SONG_TYPE(thisx) * 3; + f32 phi_fv1 = 1220.0f; + + if ((((OCEFF_WIPE5_GET_SONG_TYPE(thisx) == 2) && (play->sceneId == SCENE_LABO)) && + ((play->csCtx.currentCsIndex == 0) || (play->csCtx.currentCsIndex == 1))) && + (play->csCtx.state != 0)) { + phi_fv1 = 1150.0f; + } + + if (colorIndex >= 13) { + colorIndex = 0; + } + + Camera_GetQuakeOffset(&quakeOffset, cam); + + if (this->counter < 32) { + z = Math_SinS(this->counter << 9) * phi_fv1; + } else { + z = phi_fv1; + } + + if (this->counter >= 80) { + alpha = 12 * (100 - this->counter); + } else { + alpha = 255; + } + for (i = 1; i < ARRAY_COUNT(gOceff5Vtx); i += 2) { + gOceff5Vtx[i].v.cn[3] = alpha; + } + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + + Matrix_Translate(activeCamEye.x + quakeOffset.x, activeCamEye.y + quakeOffset.y, activeCamEye.z + quakeOffset.z, + MTXMODE_NEW); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_RotateXS(0x708, MTXMODE_APPLY); + Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, sPrimColors[colorIndex], sPrimColors[colorIndex + 1], + sPrimColors[colorIndex + 2], 255); + gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[colorIndex], sEnvColors[colorIndex + 1], sEnvColors[colorIndex + 2], + 255); + + AnimatedMat_Draw(play, gOceff5TexAnim); + + gSPDisplayList(POLY_XLU_DISP++, &gOceff5DL); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h index 063d0386b8..05424ea1ef 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h +++ b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h @@ -3,11 +3,13 @@ #include "global.h" +#define OCEFF_WIPE5_GET_SONG_TYPE(thisx) ((thisx)->params & 0xF) + struct OceffWipe5; typedef struct OceffWipe5 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ s16 counter; } OceffWipe5; // size = 0x148 extern const ActorInit Oceff_Wipe5_InitVars;