From aa6841a33b0ec0fe185c4cea0a4f2463868b89ca Mon Sep 17 00:00:00 2001 From: Alejandro Asenjo <96613413+sonicdcer@users.noreply.github.com> Date: Wed, 14 Sep 2022 13:21:02 -0300 Subject: [PATCH] ovl_Oceff_Wipe2 OK (#1006) * ovl_Oceff_Wipe2 Decompiled * pr review * renamings * renamings --- assets/xml/overlays/ovl_Oceff_Wipe2.xml | 11 +++ spec | 4 +- .../actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c | 82 +++++++++++++++++-- .../actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h | 2 +- 4 files changed, 89 insertions(+), 10 deletions(-) create mode 100644 assets/xml/overlays/ovl_Oceff_Wipe2.xml diff --git a/assets/xml/overlays/ovl_Oceff_Wipe2.xml b/assets/xml/overlays/ovl_Oceff_Wipe2.xml new file mode 100644 index 0000000000..c43ced3c03 --- /dev/null +++ b/assets/xml/overlays/ovl_Oceff_Wipe2.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/spec b/spec index 95d8074c97..cc7babd858 100644 --- a/spec +++ b/spec @@ -1977,9 +1977,7 @@ beginseg name "ovl_Oceff_Wipe2" compress include "build/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.o" - include "build/data/ovl_Oceff_Wipe2/ovl_Oceff_Wipe2.data.o" - include "build/data/ovl_Oceff_Wipe2/ovl_Oceff_Wipe2.bss.o" - include "build/data/ovl_Oceff_Wipe2/ovl_Oceff_Wipe2.reloc.o" + include "build/src/overlays/actors/ovl_Oceff_Wipe2/ovl_Oceff_Wipe2_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index ca7ff8de2e..a26636e150 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -15,7 +15,6 @@ void OceffWipe2_Destroy(Actor* thisx, PlayState* play); void OceffWipe2_Update(Actor* thisx, PlayState* play); void OceffWipe2_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit Oceff_Wipe2_InitVars = { ACTOR_OCEFF_WIPE2, ACTORCAT_ITEMACTION, @@ -28,12 +27,83 @@ const ActorInit Oceff_Wipe2_InitVars = { (ActorFunc)OceffWipe2_Draw, }; -#endif +#include "assets/overlays/ovl_Oceff_Wipe2/ovl_Oceff_Wipe2.c" -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe2/OceffWipe2_Init.s") +s32 D_809879D0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe2/OceffWipe2_Destroy.s") +void OceffWipe2_Init(Actor* thisx, PlayState* play) { + OceffWipe2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe2/OceffWipe2_Update.s") + Actor_SetScale(&this->actor, 0.1f); + this->timer = 0; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe2/OceffWipe2_Draw.s") +void OceffWipe2_Destroy(Actor* thisx, PlayState* play) { + OceffWipe2* this = THIS; + + func_80115D5C(&play->state); + play->msgCtx.unk120B0 = 0; +} + +void OceffWipe2_Update(Actor* thisx, PlayState* play) { + OceffWipe2* this = THIS; + + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; + if (this->timer < 100) { + this->timer++; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +void OceffWipe2_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFF; + OceffWipe2* this = THIS; + f32 z; + u8 alpha; + s32 pad[2]; + Vec3f eye = GET_ACTIVE_CAM(play)->eye; + Vtx* vtxPtr; + Vec3f quakeOffset; + + Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play)); + + vtxPtr = sEponaSongFrustumVtx; + + if (this->timer < 32) { + z = Math_SinS(this->timer << 9) * 1220.0f; + } else { + z = 1220.0f; + } + + if (this->timer >= 80) { + alpha = 12 * (100 - this->timer); + } else { + alpha = 255; + } + + vtxPtr[1].v.cn[3] = vtxPtr[3].v.cn[3] = vtxPtr[5].v.cn[3] = vtxPtr[7].v.cn[3] = vtxPtr[9].v.cn[3] = + vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[16].v.cn[3] = vtxPtr[18].v.cn[3] = + vtxPtr[20].v.cn[3] = alpha; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + + Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.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, 0, 255, 255, 170, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128); + gSPDisplayList(POLY_XLU_DISP++, sEponaSongFrustumMaterialDL); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, scroll * 6, scroll * -6, 64, + 64, 1, scroll * -6, 0, 64, 64)); + gSPDisplayList(POLY_XLU_DISP++, sEponaSongFrustumModelDL); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h index 79d3665253..c213dfe382 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h @@ -7,7 +7,7 @@ struct OceffWipe2; typedef struct OceffWipe2 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ s16 timer; } OceffWipe2; // size = 0x148 extern const ActorInit Oceff_Wipe2_InitVars;