From f81dc4f82e50f48b4c8d8d7f7a5db2df03501839 Mon Sep 17 00:00:00 2001 From: Archez Date: Sun, 28 Apr 2024 20:52:41 -0400 Subject: [PATCH] widescreen particles and effects (#241) --- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 22 +++++++++++++++++-- .../ovl_Object_Kankyo/z_object_kankyo.c | 21 ++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/mm/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/mm/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 98170cf72..1623a6f9a 100644 --- a/mm/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/mm/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -522,8 +522,17 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) { Play_GetScreenPos(play, &worldPos, &screenPos); + // #region 2S2H [Cosmetic] Increase particle render area for widescreen + f32 xMin = 0.0f; + f32 xMax = SCREEN_WIDTH; + if (OTRGetAspectRatio() > 4.0f / 3.0f) { + xMin = OTRGetDimensionFromLeftEdge(xMin); + xMax = OTRGetDimensionFromRightEdge(xMax); + } + // #pragma endregion + // checking if particle is on screen - if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + if ((screenPos.x >= xMin) && (screenPos.x < xMax) && (screenPos.y >= 0.0f) && (screenPos.y < SCREEN_HEIGHT)) { Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); scaleAlpha = this->effects[i].alpha / 50.0f; @@ -614,8 +623,17 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) { Play_GetScreenPos(play, &worldPos, &screenPos); + // #region 2S2H [Cosmetic] Increase effect render area for widescreen + f32 xMin = 0.0f; + f32 xMax = SCREEN_WIDTH; + if (OTRGetAspectRatio() > 4.0f / 3.0f) { + xMin = OTRGetDimensionFromLeftEdge(xMin); + xMax = OTRGetDimensionFromRightEdge(xMax); + } + // #pragma endregion + // checking if effect is on screen - if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + if ((screenPos.x >= xMin) && (screenPos.x < xMax) && (screenPos.y >= 0.0f) && (screenPos.y < SCREEN_HEIGHT)) { Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); alphaScale = this->effects[i].alpha / 50.0f; diff --git a/mm/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/mm/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 9818a3f09..cb9a158d2 100644 --- a/mm/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/mm/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -543,8 +543,16 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { FrameInterpolation_RecordOpenChild(this, i); Play_GetScreenPos(play, &worldPos, &screenPos); + // #region 2S2H [Cosmetic] Increase snow render area for widescreen + f32 xMin = 0.0f; + f32 xMax = SCREEN_WIDTH; + if (OTRGetAspectRatio() > 4.0f / 3.0f) { + xMin = OTRGetDimensionFromLeftEdge(xMin); + xMax = OTRGetDimensionFromRightEdge(xMax); + } + // #pragma endregion - if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + if ((screenPos.x >= xMin) && (screenPos.x < xMax) && (screenPos.y >= 0.0f) && (screenPos.y < SCREEN_HEIGHT)) { if (!spB4) { spB4 = true; @@ -619,7 +627,16 @@ void func_808DD970(Actor* thisx, PlayState* play2) { FrameInterpolation_RecordOpenChild(this, i); Play_GetScreenPos(play, &worldPos, &screenPos); - if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + // #region 2S2H [Cosmetic] Increase deep underwater dust render area for widescreen + f32 xMin = 0.0f; + f32 xMax = SCREEN_WIDTH; + if (OTRGetAspectRatio() > 4.0f / 3.0f) { + xMin = OTRGetDimensionFromLeftEdge(xMin); + xMax = OTRGetDimensionFromRightEdge(xMax); + } + // #pragma endregion + + if ((screenPos.x >= xMin) && (screenPos.x < xMax) && (screenPos.y >= 0.0f) && (screenPos.y < SCREEN_HEIGHT)) { Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY);