diff --git a/profiles/cc/hud/titlemenu.lua b/profiles/cc/hud/titlemenu.lua index c2fe19a6f..54608226c 100644 --- a/profiles/cc/hud/titlemenu.lua +++ b/profiles/cc/hud/titlemenu.lua @@ -24,12 +24,8 @@ root.TitleMenu = { CopyrightX = 640, CopyrightY = 947, CopyrightXMoveOffset = 1536, - SmokeX = 0, - SmokeY = 580, - SmokeBoundsX = 20, - SmokeBoundsY = 1800, - SmokeBoundsWidth = 1920, - SmokeBoundsHeight = 500, + SmokePosition = {X = 0, Y = 580}, + SmokeBounds = {X = 20, Y = 1800, Width = 1920, Height = 500}, SmokeAnimationBoundsXOffset = 20, SmokeAnimationBoundsXMax = 1919, SmokeOpacityNormal = 0.25, diff --git a/profiles/cclcc/hud/systemmenu.lua b/profiles/cclcc/hud/systemmenu.lua index a81298375..cf98f45ba 100644 --- a/profiles/cclcc/hud/systemmenu.lua +++ b/profiles/cclcc/hud/systemmenu.lua @@ -47,6 +47,15 @@ root.SystemMenu = { SystemMenuFrame = "SystemMenuFrame", SystemMenuMask = "SystemMenuMask", + SmokePosition = {X = 0, Y = 580}, + SmokeBounds = {X = 20, Y = 1550, Width = 1920, Height = 500}, + SmokeAnimationBoundsXOffset = 20, + SmokeAnimationBoundsXMax = 1919, + SmokeOpacityNormal = 0.15, + SmokeAnimationDurationIn = 32, + SmokeAnimationDurationOut = 32, + SmokeSprite = "SystemMenuSmoke", + BGDispOffsetTopLeft = {X=-1200, Y= -330}, BGDispOffsetBottomLeft = {X=-1200, Y= 2080}, BGDispOffsetTopRight = {X=2520, Y= -330}, @@ -148,5 +157,10 @@ root.Sprites["SystemMenuFrame"] = { root.Sprites["SystemMenuMask"] = { Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, + Bounds = { X = 154, Y = 141, Width = 1900, Height = 1060 }, +}; + +root.Sprites["SystemMenuSmoke"] = { + Sheet = "MenuChip", + Bounds = { X = 0, Y = 1638, Width = 2000, Height = 410 }, }; \ No newline at end of file diff --git a/profiles/cclcc/hud/titlemenu.lua b/profiles/cclcc/hud/titlemenu.lua index c83bace49..163c2ead4 100644 --- a/profiles/cclcc/hud/titlemenu.lua +++ b/profiles/cclcc/hud/titlemenu.lua @@ -17,12 +17,8 @@ root.TitleMenu = { CopyrightTextSprite = "CopyrightText", CopyrightTextX = 566, CopyrightTextY = 955, - SmokeX = 0, - SmokeY = 580, - SmokeBoundsX = 20, - SmokeBoundsY = 1550, - SmokeBoundsWidth = 1920, - SmokeBoundsHeight = 500, + SmokePosition = {X = 0, Y = 580}, + SmokeBounds = {X = 20, Y = 1550, Width = 1920, Height = 500}, SmokeAnimationBoundsXOffset = 20, SmokeAnimationBoundsXMax = 1919, SmokeOpacityNormal = 0.15, @@ -181,7 +177,7 @@ root.Sprites["TitleMenuMenu"] = { root.Sprites["TitleMenuOverlay"] = { Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, + Bounds = { X = 154, Y = 141, Width = 1900, Height = 1060 }, }; root.Sprites["TitleMenuSmoke"] = { diff --git a/profiles/chn/hud/titlemenu.lua b/profiles/chn/hud/titlemenu.lua index c2fe19a6f..54608226c 100644 --- a/profiles/chn/hud/titlemenu.lua +++ b/profiles/chn/hud/titlemenu.lua @@ -24,12 +24,8 @@ root.TitleMenu = { CopyrightX = 640, CopyrightY = 947, CopyrightXMoveOffset = 1536, - SmokeX = 0, - SmokeY = 580, - SmokeBoundsX = 20, - SmokeBoundsY = 1800, - SmokeBoundsWidth = 1920, - SmokeBoundsHeight = 500, + SmokePosition = {X = 0, Y = 580}, + SmokeBounds = {X = 20, Y = 1800, Width = 1920, Height = 500}, SmokeAnimationBoundsXOffset = 20, SmokeAnimationBoundsXMax = 1919, SmokeOpacityNormal = 0.25, diff --git a/src/games/cc/titlemenu.cpp b/src/games/cc/titlemenu.cpp index 4c6e236da..6191e257f 100644 --- a/src/games/cc/titlemenu.cpp +++ b/src/games/cc/titlemenu.cpp @@ -340,23 +340,25 @@ void TitleMenu::DrawStartButton() { void TitleMenu::DrawSmoke(float opacity) { glm::vec4 col = glm::vec4(1.0f); col.a = opacity; - SmokeSprite.Bounds = RectF( - SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) + + Sprite smokeSpriteCopy = Sprite(SmokeSprite); + + smokeSpriteCopy.Bounds = RectF( + SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) + SmokeAnimationBoundsXOffset, - SmokeBoundsY, - SmokeBoundsWidth - + SmokeBounds.Y, + SmokeBounds.Width - (SmokeAnimationBoundsXMax * (1.0f - SmokeAnimation.Progress)), - SmokeBoundsHeight); - Renderer->DrawSprite(SmokeSprite, glm::vec2(SmokeX, SmokeY), col); - SmokeSprite.Bounds = RectF( - SmokeBoundsX, SmokeBoundsY, - SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress), - SmokeBoundsHeight); + SmokeBounds.Height); + Renderer->DrawSprite(smokeSpriteCopy, SmokePosition, col); + smokeSpriteCopy.Bounds = RectF( + SmokeBounds.X, SmokeBounds.Y, + SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress), + SmokeBounds.Height); Renderer->DrawSprite( - SmokeSprite, - glm::vec2(SmokeBoundsWidth - (SmokeAnimationBoundsXMax * - (1.0f - SmokeAnimation.Progress)), - SmokeY), + smokeSpriteCopy, + glm::vec2(SmokeBounds.Width - (SmokeAnimationBoundsXMax * + (1.0f - SmokeAnimation.Progress)), + SmokePosition.y), col); } diff --git a/src/games/cclcc/systemmenu.cpp b/src/games/cclcc/systemmenu.cpp index 6b0223132..97b80b7fc 100644 --- a/src/games/cclcc/systemmenu.cpp +++ b/src/games/cclcc/systemmenu.cpp @@ -70,6 +70,11 @@ SystemMenu::SystemMenu() { ItemsFade.DurationIn = ItemsFadeInDuration; ItemsFade.DurationOut = ItemsFadeOutDuration; + SmokeAnimation.Direction = AnimationDirection::In; + SmokeAnimation.LoopMode = AnimationLoopMode::Loop; + SmokeAnimation.DurationIn = SmokeAnimationDurationIn; + SmokeAnimation.DurationOut = SmokeAnimationDurationOut; + auto onClick = [this](auto* btn) { return MenuButtonOnClick(btn); }; MainItems = new Widgets::Group(this); @@ -100,6 +105,7 @@ void SystemMenu::Show() { State = Showing; MenuTransition.StartIn(); MenuFade.StartIn(); + SmokeAnimation.StartIn(); // If the function was called due to a submenu opening directly, // then don't take over focus if (!((ScrWork[SW_SYSMENUCT] == 32 && ScrWork[SW_SYSSUBMENUCT]) || @@ -146,6 +152,7 @@ void SystemMenu::Hide() { void SystemMenu::Update(float dt) { UpdateInput(dt); + SmokeAnimation.Update(dt); if (State == Shown && ((GetFlag(SF_TITLEMODE) || ScrWork[SW_SYSMENUCT] < 32) || @@ -294,12 +301,41 @@ void SystemMenu::Render() { RectF{0, 0, Profile::DesignWidth, Profile::DesignHeight}, glm::vec4{tint, alpha}); + DrawSmoke(ScrWork[SW_SYSMENUCT] / 128.0f); + MainItems->Tint = glm::vec4(tint, glm::smoothstep(0.0f, 1.0f, ItemsFade.Progress)); MainItems->Render(); } } +void SystemMenu::DrawSmoke(float opacity) { + Renderer->SetBlendMode(RendererBlendMode::Additive); + glm::vec4 col = glm::vec4(1.0f); + col.a = opacity; + Sprite smokeSpriteCopy = Sprite(SmokeSprite); + + smokeSpriteCopy.Bounds = RectF( + SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) + + SmokeAnimationBoundsXOffset, + SmokeBounds.Y, + SmokeBounds.Width - + (SmokeAnimationBoundsXMax * (1.0f - SmokeAnimation.Progress)), + SmokeBounds.Height); + Renderer->DrawSprite(smokeSpriteCopy, SmokePosition, col); + smokeSpriteCopy.Bounds = RectF( + SmokeBounds.X, SmokeBounds.Y, + SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress), + SmokeBounds.Height); + Renderer->DrawSprite( + smokeSpriteCopy, + glm::vec2(SmokeBounds.Width - (SmokeAnimationBoundsXMax * + (1.0f - SmokeAnimation.Progress)), + SmokePosition.y), + col); + Renderer->SetBlendMode(RendererBlendMode::Normal); +} + void SystemMenu::Init() { BGPosition = {CALCrnd((int)BGRandPosRange.x), CALCrnd((int)BGRandPosRange.y)}; SetFlag(SF_SYSTEMMENUCAPTURE, true); diff --git a/src/games/cclcc/systemmenu.h b/src/games/cclcc/systemmenu.h index 2ebf03ce5..59c6c1fb3 100644 --- a/src/games/cclcc/systemmenu.h +++ b/src/games/cclcc/systemmenu.h @@ -26,6 +26,9 @@ class SystemMenu : public Menu { void UpdateInput(float dt) override; void Update(float dt) override; void Render() override; + void DrawSmoke(float opacity); + + Animation SmokeAnimation; void MenuButtonOnClick(Widgets::Button* target); Sprite ScreenCap; diff --git a/src/games/cclcc/titlemenu.cpp b/src/games/cclcc/titlemenu.cpp index 913e8b926..b59b27e2f 100644 --- a/src/games/cclcc/titlemenu.cpp +++ b/src/games/cclcc/titlemenu.cpp @@ -661,26 +661,30 @@ void TitleMenu::DrawMainMenuBackGraphics() { } void TitleMenu::DrawSmoke(float opacity) { + Renderer->SetBlendMode(RendererBlendMode::Additive); glm::vec4 col = glm::vec4(1.0f); col.a = opacity; - SmokeSprite.Bounds = RectF( - SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) + + Sprite smokeSpriteCopy = Sprite(SmokeSprite); + + smokeSpriteCopy.Bounds = RectF( + SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) + SmokeAnimationBoundsXOffset, - SmokeBoundsY, - SmokeBoundsWidth - + SmokeBounds.Y, + SmokeBounds.Width - (SmokeAnimationBoundsXMax * (1.0f - SmokeAnimation.Progress)), - SmokeBoundsHeight); - Renderer->DrawSprite(SmokeSprite, glm::vec2(SmokeX, SmokeY), col); - SmokeSprite.Bounds = RectF( - SmokeBoundsX, SmokeBoundsY, - SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress), - SmokeBoundsHeight); + SmokeBounds.Height); + Renderer->DrawSprite(smokeSpriteCopy, SmokePosition, col); + smokeSpriteCopy.Bounds = RectF( + SmokeBounds.X, SmokeBounds.Y, + SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress), + SmokeBounds.Height); Renderer->DrawSprite( - SmokeSprite, - glm::vec2(SmokeBoundsWidth - (SmokeAnimationBoundsXMax * - (1.0f - SmokeAnimation.Progress)), - SmokeY), + smokeSpriteCopy, + glm::vec2(SmokeBounds.Width - (SmokeAnimationBoundsXMax * + (1.0f - SmokeAnimation.Progress)), + SmokePosition.y), col); + Renderer->SetBlendMode(RendererBlendMode::Normal); } void TitleMenu::ShowContinueItems() { diff --git a/src/profile/games/cc/titlemenu.cpp b/src/profile/games/cc/titlemenu.cpp index 80b8ff4c9..9f0980bb8 100644 --- a/src/profile/games/cc/titlemenu.cpp +++ b/src/profile/games/cc/titlemenu.cpp @@ -55,12 +55,8 @@ void Configure() { CopyrightY = EnsureGetMember("CopyrightY"); CopyrightXMoveOffset = EnsureGetMember("CopyrightXMoveOffset"); SmokeOpacityNormal = EnsureGetMember("SmokeOpacityNormal"); - SmokeX = EnsureGetMember("SmokeX"); - SmokeY = EnsureGetMember("SmokeY"); - SmokeBoundsX = EnsureGetMember("SmokeBoundsX"); - SmokeBoundsY = EnsureGetMember("SmokeBoundsY"); - SmokeBoundsWidth = EnsureGetMember("SmokeBoundsWidth"); - SmokeBoundsHeight = EnsureGetMember("SmokeBoundsHeight"); + SmokePosition = EnsureGetMember("SmokePosition"); + SmokeBounds = EnsureGetMember("SmokeBounds"); SmokeAnimationBoundsXOffset = EnsureGetMember("SmokeAnimationBoundsXOffset"); SmokeAnimationBoundsXMax = EnsureGetMember("SmokeAnimationBoundsXMax"); diff --git a/src/profile/games/cc/titlemenu.h b/src/profile/games/cc/titlemenu.h index a9c4ccc11..f1fa03f32 100644 --- a/src/profile/games/cc/titlemenu.h +++ b/src/profile/games/cc/titlemenu.h @@ -48,12 +48,8 @@ inline float CopyrightX; inline float CopyrightY; inline float CopyrightXMoveOffset; inline float SmokeOpacityNormal; -inline float SmokeX; -inline float SmokeY; -inline float SmokeBoundsX; -inline float SmokeBoundsY; -inline float SmokeBoundsWidth; -inline float SmokeBoundsHeight; +inline glm::vec2 SmokePosition; +inline RectF SmokeBounds; inline float SmokeAnimationBoundsXOffset; inline float SmokeAnimationBoundsXMax; inline float SmokeAnimationDurationIn; diff --git a/src/profile/games/cclcc/systemmenu.cpp b/src/profile/games/cclcc/systemmenu.cpp index c852d8668..b7a4e5c7e 100644 --- a/src/profile/games/cclcc/systemmenu.cpp +++ b/src/profile/games/cclcc/systemmenu.cpp @@ -17,6 +17,16 @@ void Configure() { ItemsFadeInDuration = EnsureGetMember("ItemsFadeInDuration"); ItemsFadeOutDuration = EnsureGetMember("ItemsFadeOutDuration"); + SmokeOpacityNormal = EnsureGetMember("SmokeOpacityNormal"); + SmokePosition = EnsureGetMember("SmokePosition"); + SmokeBounds = EnsureGetMember("SmokeBounds"); + SmokeAnimationBoundsXOffset = + EnsureGetMember("SmokeAnimationBoundsXOffset"); + SmokeAnimationBoundsXMax = EnsureGetMember("SmokeAnimationBoundsXMax"); + SmokeAnimationDurationIn = EnsureGetMember("SmokeAnimationDurationIn"); + SmokeAnimationDurationOut = + EnsureGetMember("SmokeAnimationDurationOut"); + GetMemberArray( std::span(MenuEntriesPositions, Profile::SystemMenu::MenuEntriesNum), "MenuEntriesPositions"); @@ -29,6 +39,7 @@ void Configure() { SystemMenuFrame = EnsureGetMember("SystemMenuFrame"); MenuButtonGuide = EnsureGetMember("MenuButtonGuide"); SystemMenuMask = EnsureGetMember("SystemMenuMask"); + SmokeSprite = EnsureGetMember("SmokeSprite"); BGDispOffsetTopLeft = EnsureGetMember("BGDispOffsetTopLeft"); BGDispOffsetBottomLeft = EnsureGetMember("BGDispOffsetBottomLeft"); diff --git a/src/profile/games/cclcc/systemmenu.h b/src/profile/games/cclcc/systemmenu.h index 5f42a602d..2a776b39b 100644 --- a/src/profile/games/cclcc/systemmenu.h +++ b/src/profile/games/cclcc/systemmenu.h @@ -14,6 +14,7 @@ inline Sprite SystemMenuBG; inline Sprite MenuButtonGuide; inline Sprite SystemMenuFrame; inline Sprite SystemMenuMask; +inline Sprite SmokeSprite; inline float MoveInDuration; inline float MoveOutDuration; inline float ItemsFadeInDuration; @@ -21,6 +22,14 @@ inline float ItemsFadeOutDuration; inline glm::vec2 MenuEntriesPositions[MenuEntriesNumMax]; inline RectF MenuEntriesButtonBounds[MenuEntriesNumMax]; +inline float SmokeOpacityNormal; +inline glm::vec2 SmokePosition; +inline RectF SmokeBounds; +inline float SmokeAnimationBoundsXOffset; +inline float SmokeAnimationBoundsXMax; +inline float SmokeAnimationDurationIn; +inline float SmokeAnimationDurationOut; + inline glm::vec2 BGDispOffsetTopLeft; inline glm::vec2 BGDispOffsetBottomLeft; inline glm::vec2 BGDispOffsetTopRight; diff --git a/src/profile/games/cclcc/titlemenu.cpp b/src/profile/games/cclcc/titlemenu.cpp index ea528ff80..c3065a7c0 100644 --- a/src/profile/games/cclcc/titlemenu.cpp +++ b/src/profile/games/cclcc/titlemenu.cpp @@ -43,12 +43,8 @@ void Configure() { CopyrightTextX = EnsureGetMember("CopyrightTextX"); CopyrightTextY = EnsureGetMember("CopyrightTextY"); SmokeOpacityNormal = EnsureGetMember("SmokeOpacityNormal"); - SmokeX = EnsureGetMember("SmokeX"); - SmokeY = EnsureGetMember("SmokeY"); - SmokeBoundsX = EnsureGetMember("SmokeBoundsX"); - SmokeBoundsY = EnsureGetMember("SmokeBoundsY"); - SmokeBoundsWidth = EnsureGetMember("SmokeBoundsWidth"); - SmokeBoundsHeight = EnsureGetMember("SmokeBoundsHeight"); + SmokePosition = EnsureGetMember("SmokePosition"); + SmokeBounds = EnsureGetMember("SmokeBounds"); SmokeAnimationBoundsXOffset = EnsureGetMember("SmokeAnimationBoundsXOffset"); SmokeAnimationBoundsXMax = EnsureGetMember("SmokeAnimationBoundsXMax"); diff --git a/src/profile/games/cclcc/titlemenu.h b/src/profile/games/cclcc/titlemenu.h index 1056b264a..5e7dcb585 100644 --- a/src/profile/games/cclcc/titlemenu.h +++ b/src/profile/games/cclcc/titlemenu.h @@ -35,12 +35,8 @@ inline float SecondaryFadeOutDuration; inline float CopyrightTextX; inline float CopyrightTextY; inline float SmokeOpacityNormal; -inline float SmokeX; -inline float SmokeY; -inline float SmokeBoundsX; -inline float SmokeBoundsY; -inline float SmokeBoundsWidth; -inline float SmokeBoundsHeight; +inline glm::vec2 SmokePosition; +inline RectF SmokeBounds; inline float SmokeAnimationBoundsXOffset; inline float SmokeAnimationBoundsXMax; inline float SmokeAnimationDurationIn;