From 60982e5300ea95564a196fe0ce5a77455ca53902 Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Thu, 18 Apr 2024 03:06:31 +0200 Subject: [PATCH] ADD: Widescreen Ocarina Effects (#219) * ADD: Widescreen Ocarina Effect * TWEAK: remove unecessary reassignment * TWEAK: better assignments * TWEAK: forgot some vanilla value --- .../actors/ovl_Oceff_Wipe/z_oceff_wipe.c | 17 ++++++++++++++--- .../actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c | 13 +++++++++++-- .../actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c | 13 +++++++++++-- .../actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c | 13 +++++++++++-- .../actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c | 17 ++++++++++++++++- .../actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c | 13 +++++++++++-- .../actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c | 13 +++++++++++-- 7 files changed, 85 insertions(+), 14 deletions(-) diff --git a/mm/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/mm/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index bd843f589..c52373242 100644 --- a/mm/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/mm/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -77,10 +77,21 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - if (this->counter < 32) { - z = Math_SinS(this->counter << 9) * 1360.0f; + // #region 2S2H [Widescreen] Ocarina Effects + f32 effectDistance; + s32 x = OTRGetRectDimensionFromLeftEdge(0) << 2; + if (x < 0) { + // Only render if the screen is wider then original + effectDistance = 1360.0f / (OTRGetAspectRatio() * 0.85f); // Widescreen value } else { - z = 1360.0f; + effectDistance = 1360.0f; // Vanilla value + } + // #endregion + + if (this->counter < 32) { + z = Math_SinS(this->counter << 9) * effectDistance; + } else { + z = effectDistance; } if (this->counter >= 80) { diff --git a/mm/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/mm/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 3478ecf35..86eacc6d7 100644 --- a/mm/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/mm/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -71,10 +71,19 @@ void OceffWipe2_Draw(Actor* thisx, PlayState* play) { vtxPtr = ResourceMgr_LoadVtxByName(sEponaSongFrustumVtx); + // #region 2S2H [Widescreen] Ocarina Effects + f32 effectDistance = 1220.0f; // Vanilla value + s32 x = OTRGetRectDimensionFromLeftEdge(0) << 2; + if (x < 0) { + // Only render if the screen is wider then original + effectDistance = 1220.0f / (OTRGetAspectRatio() * 0.85f); // Widescreen value + } + // #endregion + if (this->timer < 32) { - z = Math_SinS(this->timer * 0x200) * 1220.0f; + z = Math_SinS(this->timer * 0x200) * effectDistance; } else { - z = 1220.0f; + z = effectDistance; } if (this->timer >= 80) { diff --git a/mm/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/mm/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index 350620170..61aafc64d 100644 --- a/mm/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/mm/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -72,10 +72,19 @@ void OceffWipe3_Draw(Actor* thisx, PlayState* play) { vtxPtr = ResourceMgr_LoadVtxByName(sSariaSongFrustumVtx); + // #region 2S2H [Widescreen] Ocarina Effects + f32 effectDistance = 1220.0f; // Vanilla value + s32 x = OTRGetRectDimensionFromLeftEdge(0) << 2; + if (x < 0) { + // Only render if the screen is wider then original + effectDistance = 1220.0f / (OTRGetAspectRatio() * 0.85f); // Widescreen value + } + // #endregion + if (this->counter < 32) { - z = Math_SinS(this->counter * 512) * 1220.0f; + z = Math_SinS(this->counter * 512) * effectDistance; } else { - z = 1220.0f; + z = effectDistance; } if (this->counter >= 80) { diff --git a/mm/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/mm/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 49eed5cba..089c078bc 100644 --- a/mm/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/mm/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -69,10 +69,19 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) { quakeOffset = Camera_GetQuakeOffset(GET_ACTIVE_CAM(play)); + // #region 2S2H [Widescreen] Ocarina Effects + f32 effectDistance = 1220.0f; // Vanilla value + s32 x = OTRGetRectDimensionFromLeftEdge(0) << 2; + if (x < 0) { + // Only render if the screen is wider then original + effectDistance = 1220.0f / (OTRGetAspectRatio() * 0.85f); // Widescreen value + } + // #endregion + if (this->counter < 16) { - z = Math_SinS(this->counter * 0x400) * 1220.0f; + z = Math_SinS(this->counter * 0x400) * effectDistance; } else { - z = 1220.0f; + z = effectDistance; } vtxPtr = ResourceMgr_LoadVtxByName(sScarecrowSongFrustumVtx); diff --git a/mm/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c b/mm/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c index 6afa73c1a..e30a6f764 100644 --- a/mm/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c +++ b/mm/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c @@ -82,10 +82,25 @@ void OceffWipe5_Draw(Actor* thisx, PlayState* play) { s32 colorIndex = OCEFF_WIPE5_GET_SONG_TYPE(thisx) * 3; f32 phi_fv1 = 1220.0f; + // #region 2S2H [Widescreen] Ocarina Effects + s32 x = OTRGetRectDimensionFromLeftEdge(0) << 2; + if (x < 0) { + // Only render if the screen is wider then original + phi_fv1 = 1220.0f / (OTRGetAspectRatio() * 0.85f); // Widescreen value + } + // #endregion + if ((((OCEFF_WIPE5_GET_SONG_TYPE(thisx) == 2) && (play->sceneId == SCENE_LABO)) && ((play->csCtx.scriptIndex == 0) || (play->csCtx.scriptIndex == 1))) && (play->csCtx.state != CS_STATE_IDLE)) { - phi_fv1 = 1150.0f; + // #region 2S2H [Widescreen] Ocarina Effects + if (x < 0) { + // Only render if the screen is wider then original + phi_fv1 = 1150.0f / (OTRGetAspectRatio() * 0.85f); // Widescreen value + } else { + phi_fv1 = 1150.0f; // Vanilla value + } + // #endregion } if (colorIndex >= 13) { diff --git a/mm/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c b/mm/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c index 444279b78..555f19367 100644 --- a/mm/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c +++ b/mm/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c @@ -72,11 +72,20 @@ void OceffWipe6_Draw(Actor* thisx, PlayState* play) { activeCamEye = GET_ACTIVE_CAM(play)->eye; quakeOffset = Camera_GetQuakeOffset(GET_ACTIVE_CAM(play)); + // #region 2S2H [Widescreen] Ocarina Effects + f32 effectDistance = 1220.0f; // Vanilla value + s32 x = OTRGetRectDimensionFromLeftEdge(0) << 2; + if (x < 0) { + // Only render if the screen is wider then original + effectDistance = 1220.0f / (OTRGetAspectRatio() * 0.85f); // Widescreen value + } + // #endregion + if (this->counter < 32) { counter = this->counter; - z = Math_SinS(counter * 0x200) * 1220.0f; + z = Math_SinS(counter * 0x200) * effectDistance; } else { - z = 1220.0f; + z = effectDistance; } if (this->counter >= 80) { diff --git a/mm/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c b/mm/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c index e319dce87..ad93e9934 100644 --- a/mm/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c +++ b/mm/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c @@ -74,10 +74,19 @@ void OceffWipe7_Draw(Actor* thisx, PlayState* play) { quakeOffset = Camera_GetQuakeOffset(GET_ACTIVE_CAM(play)); + // #region 2S2H [Widescreen] Ocarina Effects + f32 effectDistance = 1220.0f; // Vanilla value + s32 x = OTRGetRectDimensionFromLeftEdge(0) << 2; + if (x < 0) { + // Only render if the screen is wider then original + effectDistance = 1220.0f / (OTRGetAspectRatio() * 0.85f); // Widescreen value + } + // #endregion + if (this->counter < 32) { - z = Math_SinS(this->counter * 0x200) * 1220.0f; + z = Math_SinS(this->counter * 0x200) * effectDistance; } else { - z = 1220.0f; + z = effectDistance; } if (this->counter >= 80) {