From 982b9c16c0514b0050094dfbbfdd4933e90074fe Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 22:06:20 +0200 Subject: [PATCH 01/11] Add static DrawSmoke method to common menu --- profiles/cclcc/hud/systemmenu.lua | 24 ++++++++++++++++++- src/games/cclcc/commonmenu.cpp | 32 ++++++++++++++++++++++++++ src/games/cclcc/commonmenu.h | 12 ++++++++-- src/games/cclcc/systemmenu.cpp | 3 +++ src/profile/games/cclcc/systemmenu.cpp | 6 +++++ src/profile/games/cclcc/systemmenu.h | 11 +++++++++ 6 files changed, 85 insertions(+), 3 deletions(-) diff --git a/profiles/cclcc/hud/systemmenu.lua b/profiles/cclcc/hud/systemmenu.lua index c8e1bebd3..9fa219f8b 100644 --- a/profiles/cclcc/hud/systemmenu.lua +++ b/profiles/cclcc/hud/systemmenu.lua @@ -65,6 +65,18 @@ root.SystemMenu = { BGRandPosRange = {X=4095,Y=4095}, BGTranslationOffset = {X=1452,Y=395}, + + SmokePosition = { X = 0, Y = 582 }, + SmokeOpacityNormal = 0.25, + SmokeOpacitySystemMenu = 96 / 256, + SmokeAnimationDurations = { + 1920 / 60, + 1920 / 60 / 2, + }, + SmokeSprites = { + "TitleMenuSmoke1", + "TitleMenuSmoke2" + }, }; root.Sprites["SystemMenuBG"] = { @@ -153,4 +165,14 @@ root.Sprites["SystemMenuFrame"] = { root.Sprites["SystemMenuMask"] = { Sheet = "MenuChip", Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, -}; \ No newline at end of file +}; + +root.Sprites["TitleMenuSmoke1"] = { + Sheet = "MenuChip", + Bounds = { X = 0, Y = 1548, Width = 1920, Height = 498 }, +}; + +root.Sprites["TitleMenuSmoke2"] = { + Sheet = "MenuChip", + Bounds = { X = 2002, Y = 1548, Width = 1920, Height = 498 }, +}; diff --git a/src/games/cclcc/commonmenu.cpp b/src/games/cclcc/commonmenu.cpp index 09d6fa169..8e47edc6b 100644 --- a/src/games/cclcc/commonmenu.cpp +++ b/src/games/cclcc/commonmenu.cpp @@ -3,6 +3,7 @@ #include "../../profile/game.h" #include "../../profile/scriptvars.h" #include "../../profile/games/cclcc/systemmenu.h" +#include "../../profile/games/cclcc/titlemenu.h" namespace Impacto { namespace UI { @@ -10,6 +11,7 @@ namespace CCLCC { using namespace Impacto::Profile::ScriptVars; using namespace Impacto::Profile::CCLCC::SystemMenu; +using namespace Impacto::Profile::CCLCC::TitleMenu; CommonMenu::CommonMenu(Animation& fadeAnimation) { fadeAnimation.Direction = AnimationDirection::In; @@ -28,6 +30,36 @@ void CommonMenu::OnShow(float fadeInDuration, float fadeOutDuration, } } +void CommonMenu::Init() { + for (size_t layer = 0; layer < SmokeLayerCount; layer++) { + Animation& animation = SmokeAnimations[layer]; + animation.SetDuration(SmokeAnimationDurations[layer]); + animation.LoopMode = AnimationLoopMode::Loop; + animation.StartIn(); + } +} + +void CommonMenu::Update(const float dt) { + for (Animation& animation : SmokeAnimations) { + animation.Update(dt); + } +} + +void CommonMenu::DrawSmoke(const float alpha) { + const glm::vec4 col = {1.0f, 1.0f, 1.0f, alpha}; + + for (size_t layer = 0; layer < SmokeLayerCount; layer++) { + const glm::vec2 pos = + SmokePosition + glm::vec2(SmokeSprites[layer].ScaledWidth() * + SmokeAnimations[layer].Progress, + 0.0f); + Renderer->DrawSprite(SmokeSprites[layer], pos, col); + Renderer->DrawSprite( + SmokeSprites[layer], + pos - glm::vec2(SmokeSprites[layer].ScaledWidth(), 0.0f), col); + } +} + static auto GenerateMatrix(CornersQuad const& corners) { auto get2DIndex = [](int x, int y) { return x + (GridColCount + 1) * y; }; constexpr int xVerticesCount = GridColCount + 1; diff --git a/src/games/cclcc/commonmenu.h b/src/games/cclcc/commonmenu.h index 8079396f7..7cc5ba257 100644 --- a/src/games/cclcc/commonmenu.h +++ b/src/games/cclcc/commonmenu.h @@ -5,15 +5,19 @@ #include "../../renderer/renderer.h" #include "../../ui/menu.h" -#include "../../profile/games/cclcc/systemmenu.h" - namespace Impacto { namespace UI { namespace CCLCC { constexpr inline int GridRowCount = 10; constexpr inline int GridColCount = 20; +constexpr inline size_t SmokeLayerCount = 2; + class CommonMenu { + public: + static void Init(); + static void DrawSmoke(float alpha); + protected: using GridVertices = std::array; @@ -26,6 +30,8 @@ class CommonMenu { void OnShow(float fadeInDuration, float fadeOutDuration, Animation& fadeAnimation); + static void Update(float dt); + template void DrawBgSprite(MenuState state, const Animation& fadeAnimation, std::optional ScreenCap = std::nullopt); @@ -44,6 +50,8 @@ class CommonMenu { static inline GridVertices Vertices; static inline int PrevSysMenuCt; static inline int PrevSubMenuCt; + + static inline std::array SmokeAnimations; }; } // namespace CCLCC diff --git a/src/games/cclcc/systemmenu.cpp b/src/games/cclcc/systemmenu.cpp index 40dc727fb..fd40f1a77 100644 --- a/src/games/cclcc/systemmenu.cpp +++ b/src/games/cclcc/systemmenu.cpp @@ -55,6 +55,8 @@ void SystemMenu::UpdateInput(float dt) { } SystemMenu::SystemMenu() : CommonMenu(FadeAnimation) { + CommonMenu::Init(); + MenuTransition.Direction = AnimationDirection::In; MenuTransition.LoopMode = AnimationLoopMode::Stop; MenuTransition.DurationIn = MoveInDuration; @@ -143,6 +145,7 @@ void SystemMenu::Hide() { } void SystemMenu::Update(float dt) { + CommonMenu::Update(dt); UpdateInput(dt); if (State == Shown && diff --git a/src/profile/games/cclcc/systemmenu.cpp b/src/profile/games/cclcc/systemmenu.cpp index e6bb3e560..6595c1838 100644 --- a/src/profile/games/cclcc/systemmenu.cpp +++ b/src/profile/games/cclcc/systemmenu.cpp @@ -32,6 +32,12 @@ void Configure() { MenuButtonGuide = EnsureGetMember("MenuButtonGuide"); SystemMenuMask = EnsureGetMember("SystemMenuMask"); + SmokeOpacityNormal = EnsureGetMember("SmokeOpacityNormal"); + SmokeOpacitySystemMenu = EnsureGetMember("SmokeOpacitySystemMenu"); + SmokePosition = EnsureGetMember("SmokePosition"); + GetMemberArray(SmokeSprites, "SmokeSprites"); + GetMemberArray(SmokeAnimationDurations, "SmokeAnimationDurations"); + BGDispOffsetTopLeft = EnsureGetMember("BGDispOffsetTopLeft"); BGDispOffsetBottomLeft = EnsureGetMember("BGDispOffsetBottomLeft"); BGDispOffsetTopRight = EnsureGetMember("BGDispOffsetTopRight"); diff --git a/src/profile/games/cclcc/systemmenu.h b/src/profile/games/cclcc/systemmenu.h index 6b2a4dc18..00f5f570f 100644 --- a/src/profile/games/cclcc/systemmenu.h +++ b/src/profile/games/cclcc/systemmenu.h @@ -1,11 +1,15 @@ #pragma once #include "../../../spritesheet.h" +#include "../../../games/cclcc/commonmenu.h" namespace Impacto { namespace Profile { namespace CCLCC { namespace SystemMenu { + +using namespace Impacto::UI::CCLCC; + constexpr inline int MenuEntriesNumMax = 16; inline Sprite SystemMenuBG; @@ -36,6 +40,13 @@ inline glm::vec3 AngleMultiplier; inline glm::vec2 BGRandPosRange; inline glm::vec2 BGTranslationOffset; + +inline float SmokeOpacityNormal; +inline float SmokeOpacitySystemMenu; +inline glm::vec2 SmokePosition; +inline std::array SmokeSprites; +inline std::array SmokeAnimationDurations; + void Configure(); } // namespace SystemMenu From 5188292d908bdd3db789867c0e51aa5f283b4829 Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 22:07:23 +0200 Subject: [PATCH 02/11] Add static DrawOverlay method to common menu --- profiles/cclcc/hud/systemmenu.lua | 6 ++-- src/games/cclcc/commonmenu.cpp | 46 +++++++++++++++++++++++++++++++ src/games/cclcc/commonmenu.h | 3 ++ src/renderer/opengl/renderer.cpp | 4 +-- src/renderer/opengl/window.cpp | 6 +--- 5 files changed, 55 insertions(+), 10 deletions(-) diff --git a/profiles/cclcc/hud/systemmenu.lua b/profiles/cclcc/hud/systemmenu.lua index 9fa219f8b..4e8e5619d 100644 --- a/profiles/cclcc/hud/systemmenu.lua +++ b/profiles/cclcc/hud/systemmenu.lua @@ -49,7 +49,7 @@ root.SystemMenu = { MenuButtonGuide = "SystemMenuButtonGuide", SystemMenuBG = "SystemMenuBG", SystemMenuFrame = "SystemMenuFrame", - SystemMenuMask = "SystemMenuMask", + OverlaySprite = "OverlaySprite", BGDispOffsetTopLeft = {X=-1200, Y= -330}, BGDispOffsetBottomLeft = {X=-1200, Y= 2080}, @@ -162,9 +162,9 @@ root.Sprites["SystemMenuFrame"] = { Bounds = {X = 0, Y = 0, Width = 2252, Height = 1383} }; -root.Sprites["SystemMenuMask"] = { +root.Sprites["OverlaySprite"] = { Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, + Bounds = { X = 155, Y = 142, Width = 1898, Height = 1058 }, }; root.Sprites["TitleMenuSmoke1"] = { diff --git a/src/games/cclcc/commonmenu.cpp b/src/games/cclcc/commonmenu.cpp index 8e47edc6b..bcc08a32e 100644 --- a/src/games/cclcc/commonmenu.cpp +++ b/src/games/cclcc/commonmenu.cpp @@ -37,6 +37,14 @@ void CommonMenu::Init() { animation.LoopMode = AnimationLoopMode::Loop; animation.StartIn(); } + + const RectF viewport = Window->GetViewport(); + Texture captureTexture; + captureTexture.LoadSolidColor(static_cast(viewport.Width), + static_cast(viewport.Height), 0x00000000); + CaptureSprite.Sheet.Texture = captureTexture.Submit(); + CaptureSprite.Sheet.DesignWidth = viewport.Width; + CaptureSprite.Sheet.DesignHeight = viewport.Height; } void CommonMenu::Update(const float dt) { @@ -60,6 +68,44 @@ void CommonMenu::DrawSmoke(const float alpha) { } } +void CommonMenu::DrawOverlay(const float alpha) { + const glm::vec4 tint = {1.0f, 1.0f, 1.0f, alpha}; + + const RectF maskUvBounds = OverlaySprite.NormalizedBounds(); + std::array vertices{ + VertexBufferSprites{ + .Position = {0.0f, 0.0f}, + .UV = {0.0f, 0.0f}, + .Tint = tint, + .MaskUV = {maskUvBounds.Left(), 1.0f - maskUvBounds.Top()}, + }, + VertexBufferSprites{ + .Position = {Profile::DesignWidth, 0.0f}, + .UV = {1.0f, 0.0f}, + .Tint = tint, + .MaskUV = {maskUvBounds.Right(), 1.0f - maskUvBounds.Top()}, + }, + VertexBufferSprites{ + .Position = {0.0f, Profile::DesignHeight}, + .UV = {0.0f, 1.0f}, + .Tint = tint, + .MaskUV = {maskUvBounds.Left(), 1.0f - maskUvBounds.Bottom()}, + }, + VertexBufferSprites{ + .Position = {Profile::DesignWidth, Profile::DesignHeight}, + .UV = {1.0f, 1.0f}, + .Tint = tint, + .MaskUV = {maskUvBounds.Right(), 1.0f - maskUvBounds.Bottom()}, + }, + }; + constexpr static std::array indices{0, 1, 2, 1, 2, 3}; + + Renderer->CaptureScreencap(CaptureSprite); + Renderer->DrawPrimitives(CaptureSprite.Sheet, &OverlaySprite.Sheet, + ShaderProgramType::HardLightMaskedSprite, vertices, + indices, {0.0f, 0.0f}); +} + static auto GenerateMatrix(CornersQuad const& corners) { auto get2DIndex = [](int x, int y) { return x + (GridColCount + 1) * y; }; constexpr int xVerticesCount = GridColCount + 1; diff --git a/src/games/cclcc/commonmenu.h b/src/games/cclcc/commonmenu.h index 7cc5ba257..21ac8b86a 100644 --- a/src/games/cclcc/commonmenu.h +++ b/src/games/cclcc/commonmenu.h @@ -17,6 +17,7 @@ class CommonMenu { public: static void Init(); static void DrawSmoke(float alpha); + static void DrawOverlay(float alpha = 1.0f); protected: using GridVertices = @@ -52,6 +53,8 @@ class CommonMenu { static inline int PrevSubMenuCt; static inline std::array SmokeAnimations; + + static inline Sprite CaptureSprite; }; } // namespace CCLCC diff --git a/src/renderer/opengl/renderer.cpp b/src/renderer/opengl/renderer.cpp index 69032ce83..0aae2767b 100644 --- a/src/renderer/opengl/renderer.cpp +++ b/src/renderer/opengl/renderer.cpp @@ -1279,10 +1279,10 @@ void Renderer::SetBlendMode(RendererBlendMode blendMode) { switch (blendMode) { case RendererBlendMode::Normal: - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE); return; case RendererBlendMode::Additive: - glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE); return; case RendererBlendMode::Premultiplied: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/renderer/opengl/window.cpp b/src/renderer/opengl/window.cpp index 5e1844dc1..26dfc45f2 100644 --- a/src/renderer/opengl/window.cpp +++ b/src/renderer/opengl/window.cpp @@ -352,11 +352,7 @@ void GLWindow::Update() { glEnable(GL_BLEND); - if (Profile::Vm::GameInstructionSet == Vm::InstructionSet::CHLCC) { - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE); - } else { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE); } void GLWindow::Draw() { From ad1223eaf93cc72e42275916d471110d13411d17 Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 22:36:22 +0200 Subject: [PATCH 03/11] Add smoke and overlay rendering to cclcc menus --- profiles/cc/hud/backlogmenu.lua | 6 - profiles/cclcc/hud/backlogmenu.lua | 6 - profiles/cclcc/hud/extramenus.lua | 8 - profiles/cclcc/hud/helpmenu.lua | 6 - profiles/cclcc/hud/optionsmenu.lua | 7 - profiles/cclcc/hud/savemenu.lua | 6 - profiles/cclcc/hud/tipsmenu.lua | 6 - profiles/cclcc/hud/titlemenu.lua | 23 -- src/games/cc/backlogmenu.cpp | 10 +- src/games/cclcc/clearlistmenu.cpp | 16 +- src/games/cclcc/commonmenu.cpp | 3 + src/games/cclcc/helpmenu.cpp | 13 +- src/games/cclcc/librarymenu.cpp | 131 ++++++----- src/games/cclcc/optionsmenu.cpp | 12 +- src/games/cclcc/savemenu.cpp | 13 +- src/games/cclcc/systemmenu.cpp | 33 ++- src/games/cclcc/tipsmenu.cpp | 11 +- src/games/cclcc/titlemenu.cpp | 272 ++++++++++++---------- src/games/cclcc/titlemenu.h | 4 - src/profile/games/cc/backlogmenu.cpp | 1 - src/profile/games/cc/backlogmenu.h | 1 - src/profile/games/cclcc/clearlistmenu.cpp | 4 +- src/profile/games/cclcc/helpmenu.cpp | 1 - src/profile/games/cclcc/helpmenu.h | 1 - src/profile/games/cclcc/librarymenu.cpp | 2 - src/profile/games/cclcc/librarymenu.h | 2 - src/profile/games/cclcc/optionsmenu.cpp | 2 - src/profile/games/cclcc/optionsmenu.h | 2 - src/profile/games/cclcc/savemenu.cpp | 1 - src/profile/games/cclcc/savemenu.h | 1 - src/profile/games/cclcc/systemmenu.cpp | 3 +- src/profile/games/cclcc/systemmenu.h | 3 +- src/profile/games/cclcc/tipsmenu.cpp | 1 - src/profile/games/cclcc/tipsmenu.h | 1 - src/profile/games/cclcc/titlemenu.cpp | 19 -- src/profile/games/cclcc/titlemenu.h | 13 -- 36 files changed, 299 insertions(+), 345 deletions(-) diff --git a/profiles/cc/hud/backlogmenu.lua b/profiles/cc/hud/backlogmenu.lua index 2de63141c..0a085d3f9 100644 --- a/profiles/cc/hud/backlogmenu.lua +++ b/profiles/cc/hud/backlogmenu.lua @@ -36,7 +36,6 @@ root.BacklogMenu = { ScrollingSpeed = 900, PageUpDownHeight = 765, - MenuMask = "MenuMask", BacklogMask = "BacklogMask", HoverBounds = { X = 380, Y = 145, Width = 1230, Height = 820 } }; @@ -62,11 +61,6 @@ root.Sprites["BacklogControls"] = { Bounds = { X = 0, Y = 1153, Width = 1920, Height = 57 }, }; -root.Sprites["MenuMask"] = { - Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, -}; - root.Sprites["VoiceIcon"] = { Sheet = "Backlog", Bounds = { X = 1519, Y = 1216, Width = 43, Height = 43 }, diff --git a/profiles/cclcc/hud/backlogmenu.lua b/profiles/cclcc/hud/backlogmenu.lua index e920f20c6..715e93be8 100644 --- a/profiles/cclcc/hud/backlogmenu.lua +++ b/profiles/cclcc/hud/backlogmenu.lua @@ -36,7 +36,6 @@ root.BacklogMenu = { ScrollingSpeed = 900, PageUpDownHeight = 765, - MenuMask = "MenuMask", BacklogMask = "BacklogMask", HoverBounds = { X = 380, Y = 145, Width = 1230, Height = 820 } }; @@ -62,11 +61,6 @@ root.Sprites["BacklogControls"] = { Bounds = { X = 0, Y = 1151, Width = 1920, Height = 59 }, } -root.Sprites["MenuMask"] = { - Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, -}; - root.Sprites["VoiceIcon"] = { Sheet = "Backlog", Bounds = { X = 1521, Y = 1218, Width = 38, Height = 38 }, diff --git a/profiles/cclcc/hud/extramenus.lua b/profiles/cclcc/hud/extramenus.lua index 671c89e73..aeb630662 100644 --- a/profiles/cclcc/hud/extramenus.lua +++ b/profiles/cclcc/hud/extramenus.lua @@ -97,8 +97,6 @@ root.ExtraMenus = { LibraryIndexSprite = "LibraryIndex", LibraryIndexPosition = { X = 0, Y = 31 }, LibraryButtonGuidePosition = { X = 0, Y = 989 }, - LibraryMaskSprite = "LibraryMask", - LibraryMaskAlpha = 0.8, SnapPhotoSpriteHover = "SnapPhotoHover", SnapPhotoSpriteSelect = "SnapPhotoSelect", @@ -235,12 +233,6 @@ root.ExtraMenus = { } }; --- Common -root.Sprites["LibraryMask"] = { - Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, -}; - -- ClearList root.Sprites["ClearListBookLayer"] = { Sheet = "ClearList", diff --git a/profiles/cclcc/hud/helpmenu.lua b/profiles/cclcc/hud/helpmenu.lua index e984347bf..87ee43306 100644 --- a/profiles/cclcc/hud/helpmenu.lua +++ b/profiles/cclcc/hud/helpmenu.lua @@ -6,7 +6,6 @@ root.HelpMenu = { NextPageInDuration = 0.4, NextPageOutDuration = 0.4, ManualPages = {}, - HelpMaskSprite = "HelpMask", } local numberOfPages = root.Language == "Japanese" and 16 or 1 @@ -18,8 +17,3 @@ for i = 0, numberOfPages do }; root.HelpMenu.ManualPages[#root.HelpMenu.ManualPages + 1] = "ManualPage" .. i; end - -root.Sprites["HelpMask"] = { - Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, -}; \ No newline at end of file diff --git a/profiles/cclcc/hud/optionsmenu.lua b/profiles/cclcc/hud/optionsmenu.lua index b5be7487b..30205e8bb 100644 --- a/profiles/cclcc/hud/optionsmenu.lua +++ b/profiles/cclcc/hud/optionsmenu.lua @@ -72,8 +72,6 @@ root.OptionsMenu = { PortraitSprites = {}, PortraitOffset = { X = 3, Y = 2 }, VoicePosition = { X = 454, Y = 310 }, - - MenuMask = "MenuMask", }; root.Sprites["OptionsBackground"] = { @@ -151,11 +149,6 @@ root.Sprites["OptionsVoiceGuide"] = { Bounds = { X = 0, Y = 2416, Width = 1926, Height = 57 } }; -root.Sprites["MenuMask"] = { - Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, -}; - for i = 0, 3 do height = 80; diff --git a/profiles/cclcc/hud/savemenu.lua b/profiles/cclcc/hud/savemenu.lua index 1239c74c0..abe1500e2 100644 --- a/profiles/cclcc/hud/savemenu.lua +++ b/profiles/cclcc/hud/savemenu.lua @@ -10,7 +10,6 @@ root.SaveMenu = { FadeInDuration = 28 / 60, FadeOutDuration = 28 / 60, PageSwapDuration = 28 / 60, - SaveMenuMaskSprite = "SaveMenuMask", SaveEntryPrimaryColor = 0xF07390, LoadEntryPrimaryColor = 0x00A1E6, SaveEntrySecondaryColor = 0x5E357C, @@ -27,11 +26,6 @@ root.Sprites["EmptyThumbnail"] = { Bounds = { X = 0, Y = 0, Width = 0, Height = 0 } }; -root.Sprites["SaveMenuMask"] = { - Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, -}; - local menuTypes = { "QuickLoad", "Save", "Load" } for i = 1,3 do diff --git a/profiles/cclcc/hud/tipsmenu.lua b/profiles/cclcc/hud/tipsmenu.lua index 541dd4757..0df384810 100644 --- a/profiles/cclcc/hud/tipsmenu.lua +++ b/profiles/cclcc/hud/tipsmenu.lua @@ -9,7 +9,6 @@ root.TipsMenu = { TipsGuideSprite = "TipsGuide", TipsGuideX = 0, TipsGuideY = 990, - TipsMaskSprite = "TipsMask", TipsNewSprite = "TipsNewSprite", TipsHighlightedSprite = "TipsHighlightedSprite", @@ -63,11 +62,6 @@ root.Sprites["TipsGuide"] = { Bounds = { X = 0, Y = 1152, Width = 1925, Height = 55 } }; -root.Sprites["TipsMask"] = { - Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, -}; - -- Start of Tips Tab Name Sprites root.Sprites["TipsHighlightedTabSprite"] = { Sheet = "Tips", diff --git a/profiles/cclcc/hud/titlemenu.lua b/profiles/cclcc/hud/titlemenu.lua index c83bace49..db14e7c91 100644 --- a/profiles/cclcc/hud/titlemenu.lua +++ b/profiles/cclcc/hud/titlemenu.lua @@ -17,19 +17,6 @@ root.TitleMenu = { CopyrightTextSprite = "CopyrightText", CopyrightTextX = 566, CopyrightTextY = 955, - SmokeX = 0, - SmokeY = 580, - SmokeBoundsX = 20, - SmokeBoundsY = 1550, - SmokeBoundsWidth = 1920, - SmokeBoundsHeight = 500, - SmokeAnimationBoundsXOffset = 20, - SmokeAnimationBoundsXMax = 1919, - SmokeOpacityNormal = 0.15, - SmokeAnimationDurationIn = 32, - SmokeAnimationDurationOut = 32, - SmokeSprite = "TitleMenuSmoke", - OverlaySprite = "TitleMenuOverlay", MenuSprite = "TitleMenuMenu", MenuX = 27, MenuY = 26, @@ -179,16 +166,6 @@ root.Sprites["TitleMenuMenu"] = { Bounds = { X = 0, Y = 0, Width = 544, Height = 248 }, }; -root.Sprites["TitleMenuOverlay"] = { - Sheet = "MenuChip", - Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 }, -}; - -root.Sprites["TitleMenuSmoke"] = { - Sheet = "MenuChip", - Bounds = { X = 0, Y = 1638, Width = 2000, Height = 410 }, -}; - root.Sprites["ExitSprite"] = { Sheet = "TitleChip", Bounds = { X = 33, Y = 568, Width = 223, Height = 37 }, diff --git a/src/games/cc/backlogmenu.cpp b/src/games/cc/backlogmenu.cpp index 1ca56117d..48c104758 100644 --- a/src/games/cc/backlogmenu.cpp +++ b/src/games/cc/backlogmenu.cpp @@ -97,9 +97,13 @@ void BacklogMenu::Render() { MainItems->Render(); MainScrollbar->Render(); - Renderer->DrawSprite( - MenuMaskSprite, - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), maskTint); + if (ScrWork[SW_SYSSUBMENUNO] == 1) { + CommonMenu::DrawOverlay(); + if (GetFlag(SF_TITLEMODE)) { + CommonMenu::DrawSmoke(Profile::CCLCC::SystemMenu::SmokeOpacityNormal * + (1.0f - FadeAnimation.Progress)); + } + } Renderer->DrawSprite(BacklogControlsSprite, BacklogControlsPosition, transition); diff --git a/src/games/cclcc/clearlistmenu.cpp b/src/games/cclcc/clearlistmenu.cpp index bf2bd1ad6..daaafd193 100644 --- a/src/games/cclcc/clearlistmenu.cpp +++ b/src/games/cclcc/clearlistmenu.cpp @@ -1,5 +1,7 @@ #include "clearlistmenu.h" +#include "commonmenu.h" +#include "../../profile/games/cclcc/systemmenu.h" #include "../../profile/games/cclcc/clearlistmenu.h" #include "../../profile/ui/backlogmenu.h" #include "../../profile/dialogue.h" @@ -85,14 +87,18 @@ void ClearListMenu::Render() { if (State == Hidden) return; glm::vec4 transition(1.0f, 1.0f, 1.0f, FadeAnimation.Progress); - glm::vec4 maskTint = glm::vec4(1.0f); - maskTint.a = 0.85f; Renderer->DrawSprite(ClearListBookLayerSprite, glm::vec2(0.0f, MenuOffsetY), transition); DrawEndingSprites(transition); - Renderer->DrawSprite( - ClearListMaskSprite, - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), maskTint); + + if (ScrWork[SW_SYSSUBMENUNO] == 7) { + CommonMenu::DrawOverlay(); + if (GetFlag(SF_TITLEMODE)) { + CommonMenu::DrawSmoke(Profile::CCLCC::SystemMenu::SmokeOpacityNormal * + (1.0f - FadeAnimation.Progress)); + } + } + Renderer->DrawSprite(ClearListGuideSprite, ClearListGuidePosition, transition); } diff --git a/src/games/cclcc/commonmenu.cpp b/src/games/cclcc/commonmenu.cpp index bcc08a32e..c8b9631ed 100644 --- a/src/games/cclcc/commonmenu.cpp +++ b/src/games/cclcc/commonmenu.cpp @@ -282,6 +282,9 @@ void CommonMenu::DrawBgSprite(MenuState state, const Animation& fadeAnimation, glm::vec3(0.0f), false, true); } } + + DrawSmoke(SmokeOpacitySystemMenu * + std::max(0.0f, (fadeAnimation.Progress - 0.5f) / 0.5f)); } template void CommonMenu::DrawBgSprite(MenuState, const Animation&, std::optional); diff --git a/src/games/cclcc/helpmenu.cpp b/src/games/cclcc/helpmenu.cpp index afb7b264f..586f58888 100644 --- a/src/games/cclcc/helpmenu.cpp +++ b/src/games/cclcc/helpmenu.cpp @@ -143,14 +143,13 @@ void HelpMenu::Render() { glm::vec4{glm::vec3{1.0f}, transition}); } - float maskAlpha = 0.85f; - if (State != Shown) { - maskAlpha *= glm::smoothstep(0.0f, 1.0f, FadeAnimation.Progress); + if (ScrWork[SW_SYSSUBMENUNO] == 11) { + CommonMenu::DrawOverlay(); + if (GetFlag(SF_TITLEMODE) && State != Shown) { + CommonMenu::DrawSmoke(Profile::CCLCC::SystemMenu::SmokeOpacityNormal * + (1.0f - FadeAnimation.Progress)); + } } - Renderer->DrawSprite( - HelpMaskSprite, - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), - glm::vec4(glm::vec3{1.0f}, maskAlpha)); } } // namespace CCLCC diff --git a/src/games/cclcc/librarymenu.cpp b/src/games/cclcc/librarymenu.cpp index b8ce9d022..dd2a250f3 100644 --- a/src/games/cclcc/librarymenu.cpp +++ b/src/games/cclcc/librarymenu.cpp @@ -1,7 +1,9 @@ #include "librarymenu.h" #include "clearlistmenu.h" +#include "commonmenu.h" +#include "../../profile/games/cclcc/systemmenu.h" #include "../../profile/games/cclcc/librarymenu.h" #include "../../profile/ui/backlogmenu.h" #include "../../profile/dialogue.h" @@ -236,75 +238,76 @@ void LibraryMenu::Update(float dt) { } void LibraryMenu::Render() { - if (State != Hidden && ScrWork[SW_SYSSUBMENUCT] > 0 && - ScrWork[SW_SYSSUBMENUNO] == 8) { - const glm::vec4 col(1.0f, 1.0f, 1.0f, FadeAnimation.Progress); - - const glm::vec2 leftSpritesOffset{ - (1.0f - FadeAnimation.Progress) * -LibraryTransitionPositionOffset, - 0.0f}; - - const glm::vec2 rightSpritesOffset{ - (1.0f - FadeAnimation.Progress) * LibraryTransitionPositionOffset, - 0.0f}; - - const float submenuFadeProgress = - GetMenuFromType(CurrentLibraryMenu).FadeAnimation.Progress; - const glm::vec4 libBgCol = - (CurrentLibraryMenu == LibraryMenuPageType::Sound) - ? col * glm::vec4{glm::vec3(1.0f), 1 - submenuFadeProgress} - : col; - Renderer->DrawSprite(LibraryBackgroundSprite, - LibraryBackgroundPosition + rightSpritesOffset, - libBgCol); - GetMenuFromType(LibraryMenuPageType::Album).Render(); - GetMenuFromType(LibraryMenuPageType::Sound).Render(); - GetMenuFromType(LibraryMenuPageType::Movie).Render(); - auto* albumMenuPtr = static_cast(UI::AlbumMenuPtr); - const bool cgViewerActive = - CurrentLibraryMenu == LibraryMenuPageType::Album && - albumMenuPtr->CGViewer; - Renderer->DrawSprite(LibraryIndexSprite, - LibraryIndexPosition + leftSpritesOffset, col); - MainItems.Render(); - Renderer->DrawSprite( - LibraryMaskSprite, - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), - glm::vec4(1.0f, 1.0f, 1.0f, FadeAnimation.Progress * LibraryMaskAlpha)); - - const auto* const submenuGuideSprite = [&]() -> Sprite* { - switch (CurrentLibraryMenu) { - case LibraryMenuPageType::Album: - if (cgViewerActive) { - if (albumMenuPtr->CGViewer->EnableGuide) - return &AlbumMenuCGViewerGuideSprite; - break; - } else - return &AlbumMenuGuideSprite; - case LibraryMenuPageType::Sound: - return &MusicMenuGuideSprite; - case LibraryMenuPageType::Movie: - return &MovieMenuGuideSprite; - } - return nullptr; - }(); - if (cgViewerActive) { - albumMenuPtr->RenderCGViewer(); - } + if (State == Hidden) return; + + const glm::vec4 col(1.0f, 1.0f, 1.0f, FadeAnimation.Progress); - if (submenuGuideSprite) { - Renderer->DrawSprite( - *submenuGuideSprite, LibraryButtonGuidePosition + leftSpritesOffset, - col * glm::vec4{glm::vec3(1.0f), submenuFadeProgress}); + const glm::vec2 leftSpritesOffset{ + (1.0f - FadeAnimation.Progress) * -LibraryTransitionPositionOffset, 0.0f}; + + const glm::vec2 rightSpritesOffset{ + (1.0f - FadeAnimation.Progress) * LibraryTransitionPositionOffset, 0.0f}; + + const float submenuFadeProgress = + GetMenuFromType(CurrentLibraryMenu).FadeAnimation.Progress; + const glm::vec4 libBgCol = + (CurrentLibraryMenu == LibraryMenuPageType::Sound) + ? col * glm::vec4{glm::vec3(1.0f), 1 - submenuFadeProgress} + : col; + Renderer->DrawSprite(LibraryBackgroundSprite, + LibraryBackgroundPosition + rightSpritesOffset, + libBgCol); + GetMenuFromType(LibraryMenuPageType::Album).Render(); + GetMenuFromType(LibraryMenuPageType::Sound).Render(); + GetMenuFromType(LibraryMenuPageType::Movie).Render(); + auto* albumMenuPtr = static_cast(UI::AlbumMenuPtr); + const bool cgViewerActive = + CurrentLibraryMenu == LibraryMenuPageType::Album && + albumMenuPtr->CGViewer; + Renderer->DrawSprite(LibraryIndexSprite, + LibraryIndexPosition + leftSpritesOffset, col); + MainItems.Render(); + + const auto* const submenuGuideSprite = [&]() -> Sprite* { + switch (CurrentLibraryMenu) { + case LibraryMenuPageType::Album: + if (cgViewerActive) { + if (albumMenuPtr->CGViewer->EnableGuide) + return &AlbumMenuCGViewerGuideSprite; + break; + } else + return &AlbumMenuGuideSprite; + case LibraryMenuPageType::Sound: + return &MusicMenuGuideSprite; + case LibraryMenuPageType::Movie: + return &MovieMenuGuideSprite; } + return nullptr; + }(); + if (cgViewerActive) { + albumMenuPtr->RenderCGViewer(); + } - // This is technically a double render but menus always render after videos - // so what can you do. - if (CurrentLibraryMenu == LibraryMenuPageType::Movie && - Video::Players[0]->IsPlaying) { - Video::VideoRender(1); + if (ScrWork[SW_SYSSUBMENUNO] == 8) { + CommonMenu::DrawOverlay(); + if (GetFlag(SF_TITLEMODE)) { + CommonMenu::DrawSmoke(Profile::CCLCC::SystemMenu::SmokeOpacityNormal * + (1.0f - FadeAnimation.Progress)); } } + + if (submenuGuideSprite) { + Renderer->DrawSprite(*submenuGuideSprite, + LibraryButtonGuidePosition + leftSpritesOffset, + col * glm::vec4{glm::vec3(1.0f), submenuFadeProgress}); + } + + // This is technically a double render but menus always render after videos + // so what can you do. + if (CurrentLibraryMenu == LibraryMenuPageType::Movie && + Video::Players[0]->IsPlaying) { + Video::VideoRender(1); + } } } // namespace CCLCC diff --git a/src/games/cclcc/optionsmenu.cpp b/src/games/cclcc/optionsmenu.cpp index 6164bfe01..2a4784e50 100644 --- a/src/games/cclcc/optionsmenu.cpp +++ b/src/games/cclcc/optionsmenu.cpp @@ -340,8 +340,6 @@ void OptionsMenu::Render() { const glm::vec4 col(1.0f, 1.0f, 1.0f, glm::smoothstep(0.0f, 1.0f, FadeAnimation.Progress)); - const glm::vec4 maskTint = - col * glm::vec4{glm::vec3{1.0f}, (float)0xa0 / 0x100}; const glm::vec2 backgroundAnimationOffset = glm::vec2( 0.0f, transitionProgress * BackgroundPosition.y + @@ -372,9 +370,13 @@ void OptionsMenu::Render() { col); } - Renderer->DrawSprite( - MenuMaskSprite, - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), maskTint); + if (ScrWork[SW_SYSSUBMENUNO] == 5) { + CommonMenu::DrawOverlay(); + if (GetFlag(SF_TITLEMODE)) { + CommonMenu::DrawSmoke(Profile::CCLCC::SystemMenu::SmokeOpacityNormal * + (1.0f - FadeAnimation.Progress)); + } + } const Sprite& guideSprite = CurrentPage == +PageType::Voice ? VoiceGuideSprite : GuideSprite; diff --git a/src/games/cclcc/savemenu.cpp b/src/games/cclcc/savemenu.cpp index 0d5259672..6d34d6ee4 100644 --- a/src/games/cclcc/savemenu.cpp +++ b/src/games/cclcc/savemenu.cpp @@ -319,7 +319,6 @@ void SaveMenu::Render() { OpenedAsDirect ? 1.0f : FadeAnimation.Progress; const glm::vec2 transitionOffset = { transitionProgress * 32 * 200 * 0.0625 - 400, 0}; - const glm::vec4 maskTint = glm::vec4(1.0f); if (OpenedAsDirect) CommonMenu::DrawBgSprite(State, FadeAnimation); @@ -364,9 +363,15 @@ void SaveMenu::Render() { PageNumberPosition + transitionOffset, col); } - Renderer->DrawSprite( - SaveMenuMaskSprite, - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), maskTint); + if (ScrWork[SW_SYSSUBMENUNO] == 0 || ScrWork[SW_SYSSUBMENUNO] == 3 || + ScrWork[SW_SYSSUBMENUNO] == 4) { + CommonMenu::DrawOverlay(); + if (GetFlag(SF_TITLEMODE)) { + CommonMenu::DrawSmoke(Profile::CCLCC::SystemMenu::SmokeOpacityNormal * + (1.0f - FadeAnimation.Progress)); + } + } + Renderer->DrawSprite(ButtonGuideSprite[*ActiveMenuType], {0, 989}, col); } diff --git a/src/games/cclcc/systemmenu.cpp b/src/games/cclcc/systemmenu.cpp index fd40f1a77..820d1c7d6 100644 --- a/src/games/cclcc/systemmenu.cpp +++ b/src/games/cclcc/systemmenu.cpp @@ -229,17 +229,34 @@ void SystemMenu::Update(float dt) { void SystemMenu::Render() { if (State != Hidden && !GetFlag(SF_TITLEMODE)) { - if (MenuTransition.IsIn()) { - } glm::vec3 tint = {1.0f, 1.0f, 1.0f}; - // Alpha goes from 0 to 1 in half the time - float alpha = glm::smoothstep(0.0f, 1.0f, FadeAnimation.Progress); if (!OpenedAsDirect) { CommonMenu::DrawBgSprite(State, FadeAnimation, ScreenCap); - Renderer->DrawSprite( - SystemMenuMask, - RectF{0, 0, Profile::DesignWidth, Profile::DesignHeight}, - glm::vec4{tint, alpha}); + + const static std::array submenuPtrs{ + SaveMenuPtr, // 0 + BacklogMenuPtr, // 1 + TipsMenuPtr, // 2 + SaveMenuPtr, // 3 + SaveMenuPtr, // 4 + OptionsMenuPtr, // 5 + nullptr, // 6 + ClearListMenuPtr, // 7 + LibraryMenuPtr, // 8 + nullptr, // 9 + nullptr, // 10 + HelpMenuPtr, // 11 + }; + const int submenuNo = ScrWork[SW_SYSSUBMENUNO]; + const Menu* const currentActiveMenu = + (0 <= submenuNo && submenuNo < std::ssize(submenuPtrs)) + ? submenuPtrs[submenuNo] + : nullptr; + if (currentActiveMenu == nullptr || currentActiveMenu->State == Hidden) { + const float overlayAlpha = + std::min(ScrWork[SW_SYSMENUCT] / 32.0f, 1.0f); + CommonMenu::DrawOverlay(overlayAlpha); + } } MainItems->Tint = diff --git a/src/games/cclcc/tipsmenu.cpp b/src/games/cclcc/tipsmenu.cpp index 2fdf7ab68..6b3ae32da 100644 --- a/src/games/cclcc/tipsmenu.cpp +++ b/src/games/cclcc/tipsmenu.cpp @@ -284,9 +284,14 @@ void TipsMenu::Render() { TipsScrollbar->Render(); } - Renderer->DrawSprite( - TipsMaskSprite, - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), maskTint); + if (ScrWork[SW_SYSSUBMENUNO] == 2) { + CommonMenu::DrawOverlay(); + if (GetFlag(SF_TITLEMODE)) { + CommonMenu::DrawSmoke(Profile::CCLCC::SystemMenu::SmokeOpacityNormal * + (1.0f - FadeAnimation.Progress)); + } + } + Renderer->DrawSprite( TipsGuideSprite, glm::vec2(TipsGuideX, TipsGuideY + Profile::DesignHeight / 2 - LastYPos), diff --git a/src/games/cclcc/titlemenu.cpp b/src/games/cclcc/titlemenu.cpp index f1ecc4c17..e7eebe066 100644 --- a/src/games/cclcc/titlemenu.cpp +++ b/src/games/cclcc/titlemenu.cpp @@ -1,13 +1,14 @@ #include "titlemenu.h" +#include "commonmenu.h" #include "../../spritesheet.h" - #include "../../renderer/renderer.h" #include "../../mem.h" #include "../../inputsystem.h" #include "../../ui/widgets/label.h" #include "../../profile/ui/titlemenu.h" #include "../../profile/games/cclcc/titlemenu.h" +#include "../../profile/games/cclcc/systemmenu.h" #include "../../profile/scriptvars.h" #include "../../profile/game.h" #include "../../vm/interface/input.h" @@ -20,6 +21,7 @@ namespace CCLCC { using namespace Impacto::Profile::TitleMenu; using namespace Impacto::Profile::CCLCC::TitleMenu; +using namespace Impacto::Profile::CCLCC::SystemMenu; using namespace Impacto::Profile::ScriptVars; using namespace Impacto::Profile; @@ -199,8 +201,6 @@ TitleMenu::TitleMenu() { PrimaryFadeAnimation.DurationOut = PrimaryFadeOutDuration; SecondaryFadeAnimation.DurationIn = SecondaryFadeInDuration; SecondaryFadeAnimation.DurationOut = SecondaryFadeOutDuration; - SmokeAnimation.DurationIn = SmokeAnimationDurationIn; - SmokeAnimation.DurationOut = SmokeAnimationDurationOut; SlideItemsAnimation.DurationIn = SlideItemsAnimationDurationIn; SlideItemsAnimation.DurationOut = SlideItemsAnimationDurationOut; } @@ -217,7 +217,6 @@ void TitleMenu::Show() { AllowsScriptInput = true; if (PressToStartAnimation.State == AnimationState::Stopped) { PressToStartAnimation.StartIn(true); - SmokeAnimation.StartIn(); } } } @@ -348,7 +347,6 @@ void TitleMenu::Update(float dt) { PressToStartAnimation.Update(dt); PrimaryFadeAnimation.Update(dt); SecondaryFadeAnimation.Update(dt); - SmokeAnimation.Update(dt); TitleAnimation.Update(dt); TitleAnimationSprite.Position = {0.0f, 0.0f}; SlideItemsAnimation.Update(dt); @@ -562,130 +560,160 @@ void TitleMenu::SubMenuUpdate() { } void TitleMenu::Render() { - if (State != Hidden && GetFlag(SF_TITLEMODE)) { - switch (ScrWork[SW_TITLEMODE]) { - case 1: { // Press to start - DrawDISwordBackground(); - DrawStartButton(); - DrawSmoke(SmokeOpacityNormal); - Renderer->DrawSprite(CopyrightTextSprite, - glm::vec2(CopyrightTextX, CopyrightTextY)); - Renderer->DrawQuad( - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), - glm::vec4(1.0f, 1.0f, 1.0f, - 1.0f - ScrWork[SW_TITLEDISPCT] / 60.0f)); - } break; - case 2: { // Transition between Press to start and menus - if (IsExploding || EverExploded) { - DrawMainMenuBackGraphics(); - } else { - DrawDISwordBackground(); - } - DrawStartButton(); - TitleAnimationSprite.Render(-1); - DrawSmoke(SmokeOpacityNormal); - } break; - case 3: { // MenuItems Fade In - DrawMainMenuBackGraphics(); - DrawSmoke(SmokeOpacityNormal); - Extra->Tint = (GetFlag(SF_CLR_FLAG)) ? MainItems->Tint - : RgbIntToFloat(ExtraDisabledTint); - - MenuLabel->Render(); - MainItems->Render(); - ContinueItems->Render(); - ExtraItems->Render(); - } break; - case 4: { - DrawMainMenuBackGraphics(); - DrawSmoke(SmokeOpacityNormal); - Extra->Tint = (GetFlag(SF_CLR_FLAG)) ? MainItems->Tint - : RgbIntToFloat(ExtraDisabledTint); - MenuLabel->Render(); - MainItems->Render(); - ContinueItems->Render(); - ExtraItems->Render(); - Renderer->DrawQuad( - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), - {0.0f, 0.0f, 0.0f, ScrWork[SW_TITLEDISPCT] / 32.0f}); - } break; - // TODO check if that's true - case 5: - case 13: { - DrawMainMenuBackGraphics(); - DrawSmoke(SmokeOpacityNormal); - MenuLabel->Render(); - MainItems->Render(); - ContinueItems->Render(); - ExtraItems->Render(); - } break; - case 10: { - ImpLogSlow(LogLevel::Warning, LogChannel::VMStub, - "TitleMenu::Render: Unimplemented title mode {:d}\n", - ScrWork[SW_TITLEMODE]); - } break; - case 11: { // Initial Fade In - DrawDISwordBackground(ScrWork[SW_TITLEDISPCT] / 32.0f); - DrawSmoke(ScrWork[SW_TITLEDISPCT] / 128.0f); - Renderer->DrawSprite(CopyrightTextSprite, - glm::vec2(CopyrightTextX, CopyrightTextY)); - } break; - } + if (State == Hidden || !GetFlag(SF_TITLEMODE)) return; + + /* + We have to make sure that the drawing of the smoke and the overlay is passed + along between the title/system menu and the sub menu frame-perfectly. + + Relying on ScrWork[SW_SYSSUBMENUCT] does not work for this end because the + menus are updated before the VM is updated, but are only rendered after the + VM is updated. As such, there would always be a single frame where the sub + menu is either Hidden too late or Showing too soon, rendering the overlay + either twice or not at all. + + Relying on IsFocused or UI::FocusedMenu is similarly faulty because the + title menu is set to focused when the sub menu is still hiding (during which + the sub menu should still render the overlay). + + I have landed on this method, which uses ScrWork[SW_SYSSUBMENUNO] to query + the current menu's state, and render the overlay on the title menu iff there + is not a sub menu active or it is not hidden. Similarly, each sub menu + renders the overlay iff ScrWork[SW_SYSSUBMENUNO] is its respective index. + + TODO: See if ScrWork[SW_SYSSUBMENUCT] would just kinda work if the menu + update calls are moved to the VM instructions. + */ + const static std::array submenuPtrs{ + SaveMenuPtr, // 0 + BacklogMenuPtr, // 1 + TipsMenuPtr, // 2 + SaveMenuPtr, // 3 + SaveMenuPtr, // 4 + OptionsMenuPtr, // 5 + nullptr, // 6 + ClearListMenuPtr, // 7 + LibraryMenuPtr, // 8 + nullptr, // 9 + nullptr, // 10 + HelpMenuPtr, // 11 + }; + const int submenuNo = ScrWork[SW_SYSSUBMENUNO]; + const Menu* const currentActiveMenu = + (0 <= submenuNo && submenuNo < std::ssize(submenuPtrs)) + ? submenuPtrs[submenuNo] + : nullptr; + const bool renderOverlay = + currentActiveMenu == nullptr || currentActiveMenu->State == Hidden; + + switch (ScrWork[SW_TITLEMODE]) { + case 1: { // Press to start + Renderer->DrawSprite(BackgroundSprite, glm::vec2(0.0f)); + + if (renderOverlay) { + CommonMenu::DrawOverlay(); + CommonMenu::DrawSmoke(SmokeOpacityNormal); + } - int maskAlpha = ScrWork[SW_TITLEMASKALPHA]; - glm::vec4 col = ScrWorkGetColor(SW_TITLEMASKCOLOR); - col.a = glm::min(maskAlpha / 255.0f, 1.0f); - Renderer->DrawQuad( - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), col); - } -} + DrawStartButton(); + Renderer->DrawSprite(CopyrightTextSprite, + glm::vec2(CopyrightTextX, CopyrightTextY)); + Renderer->DrawQuad( + RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), + glm::vec4(1.0f, 1.0f, 1.0f, 1.0f - ScrWork[SW_TITLEDISPCT] / 60.0f)); + } break; + + case 2: { // Transition between Press to start and menus + if (IsExploding || EverExploded) { + Renderer->DrawSprite(MainBackgroundSprite, {0.0f, 0.0f}); + } else { + Renderer->DrawSprite(BackgroundSprite, {0.0f, 0.0f}); + } + DrawStartButton(); + TitleAnimationSprite.Render(-1); -void TitleMenu::DrawDISwordBackground(float opacity) { - Renderer->DrawSprite(BackgroundSprite, glm::vec2(0.0f)); - Renderer->DrawSprite( - OverlaySprite, - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), - glm::vec4(1.0f)); -} + if (renderOverlay) { + CommonMenu::DrawOverlay(); + CommonMenu::DrawSmoke(SmokeOpacityNormal); + } + } break; -void TitleMenu::DrawStartButton() { - glm::vec4 col = glm::vec4(1.0f); - col.a = glm::smoothstep(0.0f, 1.0f, PressToStartAnimation.Progress); - Renderer->DrawSprite(PressToStartSprite, - glm::vec2(PressToStartX, PressToStartY), col); -} + case 3: { // MenuItems Fade In + Renderer->DrawSprite(MainBackgroundSprite, {0.0f, 0.0f}); -void TitleMenu::DrawMainMenuBackGraphics() { - Renderer->DrawSprite(MainBackgroundSprite, glm::vec2(0.0f)); - Renderer->DrawSprite( - OverlaySprite, - RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), - glm::vec4(1.0f)); -} + Extra->Tint = (GetFlag(SF_CLR_FLAG)) ? MainItems->Tint + : RgbIntToFloat(ExtraDisabledTint); + MenuLabel->Render(); + MainItems->Render(); + ContinueItems->Render(); + ExtraItems->Render(); + + if (renderOverlay) { + CommonMenu::DrawOverlay(); + CommonMenu::DrawSmoke(SmokeOpacityNormal); + } + } break; + + case 4: { + Renderer->DrawSprite(MainBackgroundSprite, {0.0f, 0.0f}); + + Extra->Tint = (GetFlag(SF_CLR_FLAG)) ? MainItems->Tint + : RgbIntToFloat(ExtraDisabledTint); + MenuLabel->Render(); + MainItems->Render(); + ContinueItems->Render(); + ExtraItems->Render(); + + if (renderOverlay) { + CommonMenu::DrawOverlay(); + CommonMenu::DrawSmoke(SmokeOpacityNormal * + (1.0f - ScrWork[SW_TITLEDISPCT] / 32.0f)); + } + + Renderer->DrawQuad( + RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), + {0.0f, 0.0f, 0.0f, ScrWork[SW_TITLEDISPCT] / 32.0f}); + } break; + + // TODO check if that's true + case 5: + case 13: { + Renderer->DrawSprite(MainBackgroundSprite, {0.0f, 0.0f}); + + MenuLabel->Render(); + MainItems->Render(); + ContinueItems->Render(); + ExtraItems->Render(); + + if (renderOverlay) { + CommonMenu::DrawOverlay(); + CommonMenu::DrawSmoke(SmokeOpacityNormal * + SlideItemsAnimation.Progress); + } + } break; + + case 11: { // Initial Fade In + Renderer->DrawSprite(BackgroundSprite, {0.0f, 0.0f}); -void TitleMenu::DrawSmoke(float opacity) { - glm::vec4 col = glm::vec4(1.0f); - col.a = opacity; - SmokeSprite.Bounds = RectF( - SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) + - SmokeAnimationBoundsXOffset, - SmokeBoundsY, - SmokeBoundsWidth - - (SmokeAnimationBoundsXMax * (1.0f - SmokeAnimation.Progress)), - SmokeBoundsHeight); - Renderer->DrawSprite(SmokeSprite, glm::vec2(SmokeX, SmokeY), col); - SmokeSprite.Bounds = RectF( - SmokeBoundsX, SmokeBoundsY, - SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress), - SmokeBoundsHeight); - Renderer->DrawSprite( - SmokeSprite, - glm::vec2(SmokeBoundsWidth - (SmokeAnimationBoundsXMax * - (1.0f - SmokeAnimation.Progress)), - SmokeY), - col); + if (renderOverlay) { + CommonMenu::DrawOverlay(); + CommonMenu::DrawSmoke(SmokeOpacityNormal * + (ScrWork[SW_TITLEDISPCT] / 32.0f)); + } + + Renderer->DrawSprite(CopyrightTextSprite, + glm::vec2(CopyrightTextX, CopyrightTextY)); + } break; + } + + int maskAlpha = ScrWork[SW_TITLEMASKALPHA]; + glm::vec4 col = ScrWorkGetColor(SW_TITLEMASKCOLOR); + col.a = glm::min(maskAlpha / 255.0f, 1.0f); + Renderer->DrawQuad( + RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), col); } + void TitleMenu::ShowContinueItems() { ContinueItems->Show(); ContinueItems->Tint.a = 0.0f; diff --git a/src/games/cclcc/titlemenu.h b/src/games/cclcc/titlemenu.h index cfd8264fc..c6802a4d1 100644 --- a/src/games/cclcc/titlemenu.h +++ b/src/games/cclcc/titlemenu.h @@ -25,7 +25,6 @@ class TitleMenu : public Menu { Animation PressToStartAnimation; Animation PrimaryFadeAnimation; Animation SecondaryFadeAnimation; - Animation SmokeAnimation; Animation TitleAnimation; Animation SlideItemsAnimation; Character2D TitleAnimationSprite; @@ -61,10 +60,7 @@ class TitleMenu : public Menu { void ShowExtraItems(); void HideExtraItems(); - void DrawDISwordBackground(float opacity = 1.0f); void DrawStartButton(); - void DrawMainMenuBackGraphics(); - void DrawSmoke(float opacity); void MainMenuUpdate(); void SubMenuUpdate(); diff --git a/src/profile/games/cc/backlogmenu.cpp b/src/profile/games/cc/backlogmenu.cpp index be2703fba..8bc0056b7 100644 --- a/src/profile/games/cc/backlogmenu.cpp +++ b/src/profile/games/cc/backlogmenu.cpp @@ -19,7 +19,6 @@ void Configure() { BacklogControlsPosition = EnsureGetMember("BacklogControlsPosition"); - MenuMaskSprite = EnsureGetMember("MenuMask"); BacklogMaskSheet = EnsureGetMember("BacklogMask"); FadeInDirectDuration = EnsureGetMember("FadeInDirectDuration"); diff --git a/src/profile/games/cc/backlogmenu.h b/src/profile/games/cc/backlogmenu.h index 84a6b6d08..5bfa06c22 100644 --- a/src/profile/games/cc/backlogmenu.h +++ b/src/profile/games/cc/backlogmenu.h @@ -17,7 +17,6 @@ inline glm::vec2 BacklogHeaderPosition; inline Sprite BacklogControlsSprite; inline glm::vec2 BacklogControlsPosition; -inline Sprite MenuMaskSprite; inline SpriteSheet BacklogMaskSheet; inline float FadeInDirectDuration; diff --git a/src/profile/games/cclcc/clearlistmenu.cpp b/src/profile/games/cclcc/clearlistmenu.cpp index 587a63170..261eb246a 100644 --- a/src/profile/games/cclcc/clearlistmenu.cpp +++ b/src/profile/games/cclcc/clearlistmenu.cpp @@ -26,8 +26,8 @@ void Configure() { auto drawType = EnsureGetMember("DrawType"); - auto clearList = new UI::CCLCC::ClearListMenu(); - UI::Menus[drawType].push_back(clearList); + UI::ClearListMenuPtr = new UI::CCLCC::ClearListMenu(); + UI::Menus[drawType].push_back(UI::ClearListMenuPtr); } } // namespace ClearListMenu diff --git a/src/profile/games/cclcc/helpmenu.cpp b/src/profile/games/cclcc/helpmenu.cpp index b1257edf1..2ef82d271 100644 --- a/src/profile/games/cclcc/helpmenu.cpp +++ b/src/profile/games/cclcc/helpmenu.cpp @@ -16,7 +16,6 @@ void Configure() { NextPageOutDuration = EnsureGetMember("NextPageOutDuration"); ManualPages = EnsureGetMember>("ManualPages"); - HelpMaskSprite = EnsureGetMember("HelpMaskSprite"); auto drawType = EnsureGetMember("DrawType"); diff --git a/src/profile/games/cclcc/helpmenu.h b/src/profile/games/cclcc/helpmenu.h index 858d1a391..a80bcb05c 100644 --- a/src/profile/games/cclcc/helpmenu.h +++ b/src/profile/games/cclcc/helpmenu.h @@ -8,7 +8,6 @@ namespace CCLCC { namespace HelpMenu { inline std::vector ManualPages; -inline Sprite HelpMaskSprite; inline float FadeInDuration; inline float FadeOutDuration; diff --git a/src/profile/games/cclcc/librarymenu.cpp b/src/profile/games/cclcc/librarymenu.cpp index 27640a295..b7d26358a 100644 --- a/src/profile/games/cclcc/librarymenu.cpp +++ b/src/profile/games/cclcc/librarymenu.cpp @@ -71,8 +71,6 @@ void Configure() { LibraryIndexPosition = EnsureGetMember("LibraryIndexPosition"); LibraryButtonGuidePosition = EnsureGetMember("LibraryButtonGuidePosition"); - LibraryMaskSprite = EnsureGetMember("LibraryMaskSprite"); - LibraryMaskAlpha = EnsureGetMember("LibraryMaskAlpha"); auto drawType = EnsureGetMember("DrawType"); diff --git a/src/profile/games/cclcc/librarymenu.h b/src/profile/games/cclcc/librarymenu.h index 3d616b1fa..c1a658182 100644 --- a/src/profile/games/cclcc/librarymenu.h +++ b/src/profile/games/cclcc/librarymenu.h @@ -39,9 +39,7 @@ inline glm::vec2 LibraryBackgroundPosition; inline Sprite LibraryIndexSprite; inline glm::vec2 LibraryIndexPosition; inline glm::vec2 LibraryButtonGuidePosition; -inline Sprite LibraryMaskSprite; inline float LibraryTransitionPositionOffset; -inline float LibraryMaskAlpha; inline Sprite SnapPhotoSpriteHover; inline Sprite SnapPhotoSpriteSelect; diff --git a/src/profile/games/cclcc/optionsmenu.cpp b/src/profile/games/cclcc/optionsmenu.cpp index 739cc6246..a4086f222 100644 --- a/src/profile/games/cclcc/optionsmenu.cpp +++ b/src/profile/games/cclcc/optionsmenu.cpp @@ -81,8 +81,6 @@ void Configure() { PortraitOffset = EnsureGetMember("PortraitOffset"); VoicePosition = EnsureGetMember("VoicePosition"); - MenuMaskSprite = EnsureGetMember("MenuMask"); - auto drawType = EnsureGetMember("DrawType"); UI::OptionsMenuPtr = new UI::CCLCC::OptionsMenu(); diff --git a/src/profile/games/cclcc/optionsmenu.h b/src/profile/games/cclcc/optionsmenu.h index af2cb9d30..e3bc1d4f9 100644 --- a/src/profile/games/cclcc/optionsmenu.h +++ b/src/profile/games/cclcc/optionsmenu.h @@ -72,8 +72,6 @@ inline Sprite PortraitSprites[PortraitCount]; inline glm::vec2 PortraitOffset; inline glm::vec2 VoicePosition; -inline Sprite MenuMaskSprite; - void Configure(); } // namespace OptionsMenu diff --git a/src/profile/games/cclcc/savemenu.cpp b/src/profile/games/cclcc/savemenu.cpp index c97a66cd1..2f711a93d 100644 --- a/src/profile/games/cclcc/savemenu.cpp +++ b/src/profile/games/cclcc/savemenu.cpp @@ -31,7 +31,6 @@ void Configure() { EnsureGetMember("SlotLockedSpritePosition"); NoDataSpritePosition = EnsureGetMember("NoDataSpritePosition"); - SaveMenuMaskSprite = EnsureGetMember("SaveMenuMaskSprite"); SaveEntryPrimaryColor = EnsureGetMember("SaveEntryPrimaryColor"); LoadEntryPrimaryColor = EnsureGetMember("LoadEntryPrimaryColor"); SaveEntrySecondaryColor = diff --git a/src/profile/games/cclcc/savemenu.h b/src/profile/games/cclcc/savemenu.h index 83f52dc7f..0886c3e8c 100644 --- a/src/profile/games/cclcc/savemenu.h +++ b/src/profile/games/cclcc/savemenu.h @@ -27,7 +27,6 @@ inline glm::vec2 NoDataSpritePosition; int constexpr EntriesPerRow = 2; int constexpr RowsPerPage = 4; -inline Sprite SaveMenuMaskSprite; inline uint32_t SaveEntryPrimaryColor; inline uint32_t LoadEntryPrimaryColor; inline uint32_t SaveEntrySecondaryColor; diff --git a/src/profile/games/cclcc/systemmenu.cpp b/src/profile/games/cclcc/systemmenu.cpp index 6595c1838..fd29d5281 100644 --- a/src/profile/games/cclcc/systemmenu.cpp +++ b/src/profile/games/cclcc/systemmenu.cpp @@ -30,7 +30,8 @@ void Configure() { SystemMenuBG = EnsureGetMember("SystemMenuBG"); SystemMenuFrame = EnsureGetMember("SystemMenuFrame"); MenuButtonGuide = EnsureGetMember("MenuButtonGuide"); - SystemMenuMask = EnsureGetMember("SystemMenuMask"); + + OverlaySprite = EnsureGetMember("OverlaySprite"); SmokeOpacityNormal = EnsureGetMember("SmokeOpacityNormal"); SmokeOpacitySystemMenu = EnsureGetMember("SmokeOpacitySystemMenu"); diff --git a/src/profile/games/cclcc/systemmenu.h b/src/profile/games/cclcc/systemmenu.h index 00f5f570f..a84547233 100644 --- a/src/profile/games/cclcc/systemmenu.h +++ b/src/profile/games/cclcc/systemmenu.h @@ -15,7 +15,6 @@ constexpr inline int MenuEntriesNumMax = 16; inline Sprite SystemMenuBG; inline Sprite MenuButtonGuide; inline Sprite SystemMenuFrame; -inline Sprite SystemMenuMask; inline float MoveInDuration; inline float MoveOutDuration; inline float ItemsFadeInDuration; @@ -23,6 +22,8 @@ inline float ItemsFadeOutDuration; inline float FadeInDirectDuration; inline float FadeOutDirectDuration; +inline Sprite OverlaySprite; + inline glm::vec2 MenuEntriesPositions[MenuEntriesNumMax]; inline RectF MenuEntriesButtonBounds[MenuEntriesNumMax]; diff --git a/src/profile/games/cclcc/tipsmenu.cpp b/src/profile/games/cclcc/tipsmenu.cpp index b6cba7359..1e9b585b2 100644 --- a/src/profile/games/cclcc/tipsmenu.cpp +++ b/src/profile/games/cclcc/tipsmenu.cpp @@ -15,7 +15,6 @@ namespace TipsMenu { void Configure() { TipsGuideSprite = EnsureGetMember("TipsGuideSprite"); - TipsMaskSprite = EnsureGetMember("TipsMaskSprite"); TipsHighlightedSprite = EnsureGetMember("TipsHighlightedSprite"); TipsHighlightedTabSprite = EnsureGetMember("TipsHighlightedTabSprite"); diff --git a/src/profile/games/cclcc/tipsmenu.h b/src/profile/games/cclcc/tipsmenu.h index 316b96263..c4f24c608 100644 --- a/src/profile/games/cclcc/tipsmenu.h +++ b/src/profile/games/cclcc/tipsmenu.h @@ -8,7 +8,6 @@ namespace CCLCC { namespace TipsMenu { inline Sprite TipsGuideSprite; -inline Sprite TipsMaskSprite; inline Sprite TipsHighlightedSprite; inline Sprite TipsNewSprite; diff --git a/src/profile/games/cclcc/titlemenu.cpp b/src/profile/games/cclcc/titlemenu.cpp index ea528ff80..4cd1a07da 100644 --- a/src/profile/games/cclcc/titlemenu.cpp +++ b/src/profile/games/cclcc/titlemenu.cpp @@ -16,8 +16,6 @@ void Configure() { BackgroundSprite = EnsureGetMember("BackgroundSprite"); MainBackgroundSprite = EnsureGetMember("MainBackgroundSprite"); CopyrightTextSprite = EnsureGetMember("CopyrightTextSprite"); - OverlaySprite = EnsureGetMember("OverlaySprite"); - SmokeSprite = EnsureGetMember("SmokeSprite"); MenuSprite = EnsureGetMember("MenuSprite"); ItemHighlightSprite = EnsureGetMember("ItemHighlightSprite"); LoadSprite = EnsureGetMember("LoadSprite"); @@ -42,19 +40,6 @@ void Configure() { SecondaryFadeOutDuration = EnsureGetMember("SecondaryFadeOutDuration"); 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"); - SmokeAnimationBoundsXOffset = - EnsureGetMember("SmokeAnimationBoundsXOffset"); - SmokeAnimationBoundsXMax = EnsureGetMember("SmokeAnimationBoundsXMax"); - SmokeAnimationDurationIn = EnsureGetMember("SmokeAnimationDurationIn"); - SmokeAnimationDurationOut = - EnsureGetMember("SmokeAnimationDurationOut"); MenuX = EnsureGetMember("MenuX"); MenuY = EnsureGetMember("MenuY"); ItemHighlightOffsetX = EnsureGetMember("ItemHighlightOffsetX"); @@ -102,10 +87,6 @@ void Configure() { menu->SecondaryFadeAnimation.DurationIn = SecondaryFadeInDuration; menu->SecondaryFadeAnimation.DurationOut = SecondaryFadeOutDuration; - menu->SmokeAnimation.LoopMode = AnimationLoopMode::Loop; - menu->SmokeAnimation.DurationIn = SmokeAnimationDurationIn; - menu->SmokeAnimation.DurationOut = SmokeAnimationDurationOut; - menu->TitleAnimation.DurationIn = TitleAnimationDurationIn; menu->TitleAnimation.DurationOut = TitleAnimationDurationOut; diff --git a/src/profile/games/cclcc/titlemenu.h b/src/profile/games/cclcc/titlemenu.h index 1056b264a..e0c6de938 100644 --- a/src/profile/games/cclcc/titlemenu.h +++ b/src/profile/games/cclcc/titlemenu.h @@ -11,8 +11,6 @@ namespace TitleMenu { inline Sprite BackgroundSprite; inline Sprite MainBackgroundSprite; inline Sprite CopyrightTextSprite; -inline Sprite OverlaySprite; -inline Sprite SmokeSprite; inline Sprite MenuSprite; inline Sprite ItemHighlightSprite; inline Sprite ItemHighlightPointerSprite; @@ -34,17 +32,6 @@ inline float SecondaryFadeInDuration; 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 float SmokeAnimationBoundsXOffset; -inline float SmokeAnimationBoundsXMax; -inline float SmokeAnimationDurationIn; -inline float SmokeAnimationDurationOut; inline float MenuX; inline float MenuY; inline float ItemHighlightOffsetX; From c21425515d91dbd0d1f79d44950a4f433d7bd04d Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 22:41:46 +0200 Subject: [PATCH 04/11] Move several separate X and Y profile variables into a single glm::vec2 --- profiles/cc/hud/titlemenu.lua | 3 +-- profiles/cclcc/hud/titlemenu.lua | 12 ++++-------- profiles/chlcc/hud/titlemenu.lua | 3 +-- profiles/chn/hud/titlemenu.lua | 3 +-- profiles/darling/hud/titlemenu.lua | 3 +-- profiles/dash/hud/titlemenu.lua | 3 +-- profiles/mo6tw/hud/titlemenu.lua | 3 +-- profiles/mo8/hud/titlemenu.lua | 3 +-- profiles/rne/hud/titlemenu.lua | 3 +-- profiles/sgps3/hud/titlemenu.lua | 3 +-- src/games/cc/titlemenu.cpp | 3 +-- src/games/cclcc/titlemenu.cpp | 20 +++++++++----------- src/games/chlcc/titlemenu.cpp | 3 +-- src/games/dash/titlemenu.cpp | 3 +-- src/games/mo6tw/titlemenu.cpp | 3 +-- src/games/mo8/titlemenu.cpp | 6 ++---- src/games/rne/titlemenu.cpp | 3 +-- src/profile/games/cclcc/titlemenu.cpp | 9 +++------ src/profile/games/cclcc/titlemenu.h | 9 +++------ src/profile/ui/titlemenu.cpp | 3 +-- src/profile/ui/titlemenu.h | 3 +-- src/ui/widgets/cclcc/titlebutton.cpp | 4 +--- 22 files changed, 38 insertions(+), 70 deletions(-) diff --git a/profiles/cc/hud/titlemenu.lua b/profiles/cc/hud/titlemenu.lua index c2fe19a6f..231587efd 100644 --- a/profiles/cc/hud/titlemenu.lua +++ b/profiles/cc/hud/titlemenu.lua @@ -1,8 +1,7 @@ root.TitleMenu = { Type = TitleMenuType.CC, DrawType = DrawComponentType.SystemMenu, - PressToStartX = 816, - PressToStartY = 738, + PressToStartPos = { X = 816, Y = 738 }, PressToStartAnimDurationIn = 0.7, PressToStartAnimDurationOut = 0.7, PressToStartAnimFastDurationIn = 0.1, diff --git a/profiles/cclcc/hud/titlemenu.lua b/profiles/cclcc/hud/titlemenu.lua index db14e7c91..d43cf32bc 100644 --- a/profiles/cclcc/hud/titlemenu.lua +++ b/profiles/cclcc/hud/titlemenu.lua @@ -1,8 +1,7 @@ root.TitleMenu = { Type = TitleMenuType.CCLCC, DrawType = DrawComponentType.SystemMenu, - PressToStartX = 823, - PressToStartY = 749, + PressToStartPos = { X = 823, Y = 749 }, PressToStartAnimDurationIn = 0.6, PressToStartAnimDurationOut = 0.6, PrimaryFadeInDuration = 0.7, @@ -15,14 +14,11 @@ root.TitleMenu = { BackgroundSprite = "TitleMenuBackground", MainBackgroundSprite = "MainMenuBackground", CopyrightTextSprite = "CopyrightText", - CopyrightTextX = 566, - CopyrightTextY = 955, + CopyrightTextPos = { X = 566, Y = 955 }, MenuSprite = "TitleMenuMenu", - MenuX = 27, - MenuY = 26, + MenuPos = { X = 27, Y = 26 }, ItemHighlightSprite = "TitleMenuItemHighlight", - ItemHighlightOffsetX = 174, - ItemHighlightOffsetY = 7, + ItemHighlightOffset = { X = 174, Y = 7 }, ItemHighlightPointerSprite = "TitleMenuPointerItemHighlight", ItemHighlightPointerY = 89, ItemPadding = 56, diff --git a/profiles/chlcc/hud/titlemenu.lua b/profiles/chlcc/hud/titlemenu.lua index 305ca2b9e..7dba33c0e 100644 --- a/profiles/chlcc/hud/titlemenu.lua +++ b/profiles/chlcc/hud/titlemenu.lua @@ -3,8 +3,7 @@ if root.Language == "Japanese" then languageSuffix = "" end root.TitleMenu = { Type = TitleMenuType.CHLCC, - PressToStartX = 72, - PressToStartY = 595, + PressToStartPos = { X = 72, Y = 595 }, PressToStartAnimDurationIn = 0.5, PressToStartAnimDurationOut = 0.5, PressToStartSprite = "TitleMenuPressToStart", diff --git a/profiles/chn/hud/titlemenu.lua b/profiles/chn/hud/titlemenu.lua index c2fe19a6f..231587efd 100644 --- a/profiles/chn/hud/titlemenu.lua +++ b/profiles/chn/hud/titlemenu.lua @@ -1,8 +1,7 @@ root.TitleMenu = { Type = TitleMenuType.CC, DrawType = DrawComponentType.SystemMenu, - PressToStartX = 816, - PressToStartY = 738, + PressToStartPos = { X = 816, Y = 738 }, PressToStartAnimDurationIn = 0.7, PressToStartAnimDurationOut = 0.7, PressToStartAnimFastDurationIn = 0.1, diff --git a/profiles/darling/hud/titlemenu.lua b/profiles/darling/hud/titlemenu.lua index bd95d403f..d66045481 100644 --- a/profiles/darling/hud/titlemenu.lua +++ b/profiles/darling/hud/titlemenu.lua @@ -1,8 +1,7 @@ root.TitleMenu = { Type = TitleMenuType.CHLCC, DrawType = DrawComponentType.SystemMenu, - PressToStartX = 72, - PressToStartY = 595, + PressToStartPos = { X = 72, Y = 595 }, PressToStartAnimDurationIn = 0.5, PressToStartAnimDurationOut = 0.5, PressToStartSprite = "TitleMenuPressToStart", diff --git a/profiles/dash/hud/titlemenu.lua b/profiles/dash/hud/titlemenu.lua index aa1774858..8e2a0e414 100644 --- a/profiles/dash/hud/titlemenu.lua +++ b/profiles/dash/hud/titlemenu.lua @@ -1,8 +1,7 @@ root.TitleMenu = { Type = TitleMenuType.Dash, DrawType = DrawComponentType.SystemMenu, - PressToStartX = 777, - PressToStartY = 611, + PressToStartPos = { X = 777, Y = 611 }, PressToStartAnimDurationIn = 0.7, PressToStartAnimDurationOut = 0.7, PressToStartSprite = "TitleMenuPressToStart", diff --git a/profiles/mo6tw/hud/titlemenu.lua b/profiles/mo6tw/hud/titlemenu.lua index f94b1b66f..d3b75ccf5 100644 --- a/profiles/mo6tw/hud/titlemenu.lua +++ b/profiles/mo6tw/hud/titlemenu.lua @@ -1,8 +1,7 @@ root.TitleMenu = { Type = TitleMenuType.MO6TW, DrawType = DrawComponentType.TitleMenu, - PressToStartX = 497, - PressToStartY = 402, + PressToStartPos = { X = 497, Y = 402 }, PressToStartAnimDurationIn = 0.5, PressToStartAnimDurationOut = 0.5, PressToStartSprite = "TitleMenuPressToStart", diff --git a/profiles/mo8/hud/titlemenu.lua b/profiles/mo8/hud/titlemenu.lua index 9c40f04aa..5e9fa0835 100644 --- a/profiles/mo8/hud/titlemenu.lua +++ b/profiles/mo8/hud/titlemenu.lua @@ -1,8 +1,7 @@ root.TitleMenu = { Type = TitleMenuType.MO8, DrawType = DrawComponentType.SystemMenu, - PressToStartX = 745, - PressToStartY = 586, + PressToStartPos = { X = 745, Y = 586 }, LogoX = 560, LogoY = 24, MenuEntriesNum = 13, diff --git a/profiles/rne/hud/titlemenu.lua b/profiles/rne/hud/titlemenu.lua index c2328a531..cff8ed7d8 100644 --- a/profiles/rne/hud/titlemenu.lua +++ b/profiles/rne/hud/titlemenu.lua @@ -26,8 +26,7 @@ root.TitleMenu = { CopyrightWidth = 370, LogoWidth = 524, EliteHeight = 60, - PressToStartX = 329 * (1280 / 960), - PressToStartY = 394 * (720 / 544), + PressToStartPos = { X = 329 * (1280 / 960), Y = 394 * (720 / 544) }, LineX = 0, LineY = 272 * (720 / 544), CopyrightX = 299 * (1280 / 960), diff --git a/profiles/sgps3/hud/titlemenu.lua b/profiles/sgps3/hud/titlemenu.lua index bd95d403f..d66045481 100644 --- a/profiles/sgps3/hud/titlemenu.lua +++ b/profiles/sgps3/hud/titlemenu.lua @@ -1,8 +1,7 @@ root.TitleMenu = { Type = TitleMenuType.CHLCC, DrawType = DrawComponentType.SystemMenu, - PressToStartX = 72, - PressToStartY = 595, + PressToStartPos = { X = 72, Y = 595 }, PressToStartAnimDurationIn = 0.5, PressToStartAnimDurationOut = 0.5, PressToStartSprite = "TitleMenuPressToStart", diff --git a/src/games/cc/titlemenu.cpp b/src/games/cc/titlemenu.cpp index 4c6e236da..a9eb39c19 100644 --- a/src/games/cc/titlemenu.cpp +++ b/src/games/cc/titlemenu.cpp @@ -333,8 +333,7 @@ void TitleMenu::DrawMainBackground(float opacity) { void TitleMenu::DrawStartButton() { glm::vec4 col = glm::vec4(1.0f); col.a = glm::smoothstep(0.0f, 1.0f, PressToStartAnimation.Progress); - Renderer->DrawSprite(PressToStartSprite, - glm::vec2(PressToStartX, PressToStartY), col); + Renderer->DrawSprite(PressToStartSprite, PressToStartPos, col); } void TitleMenu::DrawSmoke(float opacity) { diff --git a/src/games/cclcc/titlemenu.cpp b/src/games/cclcc/titlemenu.cpp index e7eebe066..75a6202fd 100644 --- a/src/games/cclcc/titlemenu.cpp +++ b/src/games/cclcc/titlemenu.cpp @@ -83,7 +83,7 @@ TitleMenu::TitleMenu() { Sprite nullSprite = Sprite(); nullSprite.Bounds = RectF(0.0f, 0.0f, 0.0f, 0.0f); - MenuLabel = new Widgets::Label(MenuSprite, glm::vec2(MenuX, MenuY)); + MenuLabel = new Widgets::Label(MenuSprite, MenuPos); auto onClick = [this](Widgets::Button* target) { return MenuButtonOnClick(target); @@ -110,14 +110,14 @@ TitleMenu::TitleMenu() { // NewGame menu button NewGame = new TitleButton(0, MenuEntriesSprites[0], MenuEntriesHSprites[0], ItemHighlightSprite, - glm::vec2((-1.0f) + ItemHighlightOffsetX, + glm::vec2((-1.0f) + ItemHighlightOffset.x, (ItemYBase + (0 * ItemPadding)))); setupBtn(NewGame, onClick, MainItems, FDIR_DOWN); // Continue menu button Continue = new TitleButton( 1, MenuEntriesSprites[1], MenuEntriesHSprites[1], ItemHighlightSprite, - glm::vec2(ItemHighlightOffsetX, (ItemYBase + (1 * ItemPadding)))); + glm::vec2(ItemHighlightOffset.x, (ItemYBase + (1 * ItemPadding)))); setupBtn( Continue, [this](Widgets::Button* target) { return ContinueButtonOnClick(target); }, @@ -126,7 +126,7 @@ TitleMenu::TitleMenu() { // Extra menu button Extra = new TitleButton( 2, MenuEntriesSprites[2], MenuEntriesHSprites[2], ItemHighlightSprite, - glm::vec2(ItemHighlightOffsetX, (ItemYBase + (2 * ItemPadding)))); + glm::vec2(ItemHighlightOffset.x, (ItemYBase + (2 * ItemPadding)))); setupBtn( Extra, [this](Widgets::Button* target) { return ExtraButtonOnClick(target); }, @@ -135,20 +135,20 @@ TitleMenu::TitleMenu() { // Config menu button Config = new TitleButton( 30, MenuEntriesSprites[3], MenuEntriesHSprites[3], ItemHighlightSprite, - glm::vec2(ItemHighlightOffsetX, (ItemYBase + (3 * ItemPadding)))); + glm::vec2(ItemHighlightOffset.x, (ItemYBase + (3 * ItemPadding)))); setupBtn(Config, onClick, MainItems, FDIR_DOWN); // Help menu button Help = new TitleButton( 40, MenuEntriesSprites[4], MenuEntriesHSprites[4], ItemHighlightSprite, - glm::vec2(ItemHighlightOffsetX, (ItemYBase + (4 * ItemPadding)))); + glm::vec2(ItemHighlightOffset.x, (ItemYBase + (4 * ItemPadding)))); setupBtn(Help, onClick, MainItems, FDIR_DOWN); if (HasScriptedExitLogic) { // Exit menu button (Configuration/Patch driven) auto* const exitPtr = new TitleButton( 5, ExitSprite, ExitSprite, ItemHighlightSprite, - glm::vec2(ItemHighlightOffsetX, (ItemYBase + (5 * ItemPadding)))); + glm::vec2(ItemHighlightOffset.x, (ItemYBase + (5 * ItemPadding)))); Exit.emplace(*exitPtr); setupBtn( exitPtr, @@ -616,8 +616,7 @@ void TitleMenu::Render() { } DrawStartButton(); - Renderer->DrawSprite(CopyrightTextSprite, - glm::vec2(CopyrightTextX, CopyrightTextY)); + Renderer->DrawSprite(CopyrightTextSprite, CopyrightTextPos); Renderer->DrawQuad( RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), glm::vec4(1.0f, 1.0f, 1.0f, 1.0f - ScrWork[SW_TITLEDISPCT] / 60.0f)); @@ -701,8 +700,7 @@ void TitleMenu::Render() { (ScrWork[SW_TITLEDISPCT] / 32.0f)); } - Renderer->DrawSprite(CopyrightTextSprite, - glm::vec2(CopyrightTextX, CopyrightTextY)); + Renderer->DrawSprite(CopyrightTextSprite, CopyrightTextPos); } break; } diff --git a/src/games/chlcc/titlemenu.cpp b/src/games/chlcc/titlemenu.cpp index 15d1821e1..5948986b9 100644 --- a/src/games/chlcc/titlemenu.cpp +++ b/src/games/chlcc/titlemenu.cpp @@ -490,8 +490,7 @@ void TitleMenu::Render() { DrawTitleMenuBackGraphics(); glm::vec4 col = glm::vec4(1.0f); col.a = glm::smoothstep(0.0f, 1.0f, PressToStartAnimation.Progress); - Renderer->DrawSprite(PressToStartSprite, - glm::vec2(PressToStartX, PressToStartY), col); + Renderer->DrawSprite(PressToStartSprite, PressToStartPos, col); } break; case TitleDispCtState::EmptyBackground: { DrawTitleMenuBackGraphics(); diff --git a/src/games/dash/titlemenu.cpp b/src/games/dash/titlemenu.cpp index 1f4bffae8..c324a7002 100644 --- a/src/games/dash/titlemenu.cpp +++ b/src/games/dash/titlemenu.cpp @@ -65,8 +65,7 @@ void TitleMenu::Render() { glm::vec4 col = glm::vec4(1.0f); col.a = glm::smoothstep(0.0f, 1.0f, PressToStartAnimation.Progress); Renderer->DrawSprite(BackgroundSprite, glm::vec2(0.0f)); - Renderer->DrawSprite(PressToStartSprite, - glm::vec2(PressToStartX, PressToStartY), col); + Renderer->DrawSprite(PressToStartSprite, PressToStartPos, col); } } diff --git a/src/games/mo6tw/titlemenu.cpp b/src/games/mo6tw/titlemenu.cpp index ec7ec2142..31bef35e1 100644 --- a/src/games/mo6tw/titlemenu.cpp +++ b/src/games/mo6tw/titlemenu.cpp @@ -404,8 +404,7 @@ void TitleMenu::Render() { glm::vec2(CopyrightX, CopyrightY)); glm::vec4 col = glm::vec4(1.0f); col.a = glm::smoothstep(0.0f, 1.0f, PressToStartAnimation.Progress); - Renderer->DrawSprite(PressToStartSprite, - glm::vec2(PressToStartX, PressToStartY), col); + Renderer->DrawSprite(PressToStartSprite, PressToStartPos, col); } break; case 2: { Renderer->DrawMaskedSprite( diff --git a/src/games/mo8/titlemenu.cpp b/src/games/mo8/titlemenu.cpp index 0f496e2c0..b50fbb94d 100644 --- a/src/games/mo8/titlemenu.cpp +++ b/src/games/mo8/titlemenu.cpp @@ -289,8 +289,7 @@ void TitleMenu::Render() { if (PressToStartAnimated) { col.a = glm::smoothstep(0.0f, 1.0f, PressToStartAnimation.Progress); } - Renderer->DrawSprite(PressToStartSprite, - glm::vec2(PressToStartX, PressToStartY), col); + Renderer->DrawSprite(PressToStartSprite, PressToStartPos, col); glm::vec4 black = glm::vec4(0.0f); black.a = glm::smoothstep(0.0f, 1.0f, PrimaryFadeAnimation.Progress); Renderer->DrawQuad( @@ -302,8 +301,7 @@ void TitleMenu::Render() { col.a = glm::smoothstep( 0.0f, 1.0f, ScrWork[SW_TITLEDISPCT] > 0 ? PrimaryFadeAnimation.Progress : 1.0f); - Renderer->DrawSprite(PressToStartSprite, - glm::vec2(PressToStartX, PressToStartY), col); + Renderer->DrawSprite(PressToStartSprite, PressToStartPos, col); } break; case 5: case 6: diff --git a/src/games/rne/titlemenu.cpp b/src/games/rne/titlemenu.cpp index a3985dcef..b18f2d35d 100644 --- a/src/games/rne/titlemenu.cpp +++ b/src/games/rne/titlemenu.cpp @@ -82,8 +82,7 @@ void TitleMenu::Render() { if (BackgroundAnimation->IsIn()) { glm::vec4 col = glm::vec4(1.0f); col.a = glm::smoothstep(0.0f, 1.0f, PressToStartAnimation.Progress); - Renderer->DrawSprite(PressToStartSprite, - glm::vec2(PressToStartX, PressToStartY), col); + Renderer->DrawSprite(PressToStartSprite, PressToStartPos, col); Renderer->DrawSprite(LineSprite, glm::vec2(LineX, LineY), glm::vec4(1.0f)); diff --git a/src/profile/games/cclcc/titlemenu.cpp b/src/profile/games/cclcc/titlemenu.cpp index 4cd1a07da..dde73f91d 100644 --- a/src/profile/games/cclcc/titlemenu.cpp +++ b/src/profile/games/cclcc/titlemenu.cpp @@ -38,12 +38,9 @@ void Configure() { PrimaryFadeOutDuration = EnsureGetMember("PrimaryFadeOutDuration"); SecondaryFadeInDuration = EnsureGetMember("SecondaryFadeInDuration"); SecondaryFadeOutDuration = EnsureGetMember("SecondaryFadeOutDuration"); - CopyrightTextX = EnsureGetMember("CopyrightTextX"); - CopyrightTextY = EnsureGetMember("CopyrightTextY"); - MenuX = EnsureGetMember("MenuX"); - MenuY = EnsureGetMember("MenuY"); - ItemHighlightOffsetX = EnsureGetMember("ItemHighlightOffsetX"); - ItemHighlightOffsetY = EnsureGetMember("ItemHighlightOffsetY"); + CopyrightTextPos = EnsureGetMember("CopyrightTextPos"); + MenuPos = EnsureGetMember("MenuPos"); + ItemHighlightOffset = EnsureGetMember("ItemHighlightOffset"); ItemPadding = EnsureGetMember("ItemPadding"); ItemYBase = EnsureGetMember("ItemYBase"); SecondaryFirstItemHighlightOffsetX = diff --git a/src/profile/games/cclcc/titlemenu.h b/src/profile/games/cclcc/titlemenu.h index e0c6de938..df3391550 100644 --- a/src/profile/games/cclcc/titlemenu.h +++ b/src/profile/games/cclcc/titlemenu.h @@ -30,12 +30,9 @@ inline float PrimaryFadeInDuration; inline float PrimaryFadeOutDuration; inline float SecondaryFadeInDuration; inline float SecondaryFadeOutDuration; -inline float CopyrightTextX; -inline float CopyrightTextY; -inline float MenuX; -inline float MenuY; -inline float ItemHighlightOffsetX; -inline float ItemHighlightOffsetY; +inline glm::vec2 CopyrightTextPos; +inline glm::vec2 MenuPos; +inline glm::vec2 ItemHighlightOffset; inline float ItemPadding; inline float ItemYBase; inline float SecondaryFirstItemHighlightOffsetX; diff --git a/src/profile/ui/titlemenu.cpp b/src/profile/ui/titlemenu.cpp index 974147b05..42881313b 100644 --- a/src/profile/ui/titlemenu.cpp +++ b/src/profile/ui/titlemenu.cpp @@ -37,8 +37,7 @@ void Configure() { PressToStartAnimDurationOut = EnsureGetMember("PressToStartAnimDurationOut"); - PressToStartX = EnsureGetMember("PressToStartX"); - PressToStartY = EnsureGetMember("PressToStartY"); + PressToStartPos = EnsureGetMember("PressToStartPos"); if (Type == TitleMenuType::RNE) { RNE::TitleMenu::Configure(); diff --git a/src/profile/ui/titlemenu.h b/src/profile/ui/titlemenu.h index 7ec26c6a2..ff044f758 100644 --- a/src/profile/ui/titlemenu.h +++ b/src/profile/ui/titlemenu.h @@ -20,8 +20,7 @@ inline int MenuEntriesNum; inline float PressToStartAnimDurationIn; inline float PressToStartAnimDurationOut; -inline float PressToStartX; -inline float PressToStartY; +inline glm::vec2 PressToStartPos; void Configure(); diff --git a/src/ui/widgets/cclcc/titlebutton.cpp b/src/ui/widgets/cclcc/titlebutton.cpp index b42621726..c93bd3786 100644 --- a/src/ui/widgets/cclcc/titlebutton.cpp +++ b/src/ui/widgets/cclcc/titlebutton.cpp @@ -97,9 +97,7 @@ void TitleButton::Render() { newHighlightSprite.Bounds.Width *= smoothProgress; Renderer->DrawSprite(newHighlightSprite, - glm::vec2(Bounds.X - ItemHighlightOffsetX, - Bounds.Y - ItemHighlightOffsetY), - BlinkTint); + Bounds.GetPos() - ItemHighlightOffset, BlinkTint); glm::vec4 pointerTint = glm::vec4(1.0f, 1.0f, 1.0f, smoothProgress * blinkAlpha); Renderer->DrawSprite( From 56b15268c47ae908ea41eb450c714008dfcd588a Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 22:44:48 +0200 Subject: [PATCH 05/11] Have some cclcc title menu components gradually fade in --- src/games/cclcc/titlemenu.cpp | 21 +++++++++++++++++---- src/games/cclcc/titlemenu.h | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/games/cclcc/titlemenu.cpp b/src/games/cclcc/titlemenu.cpp index 75a6202fd..fd71c269e 100644 --- a/src/games/cclcc/titlemenu.cpp +++ b/src/games/cclcc/titlemenu.cpp @@ -628,13 +628,17 @@ void TitleMenu::Render() { } else { Renderer->DrawSprite(BackgroundSprite, {0.0f, 0.0f}); } - DrawStartButton(); + TitleAnimationSprite.Render(-1); if (renderOverlay) { CommonMenu::DrawOverlay(); CommonMenu::DrawSmoke(SmokeOpacityNormal); } + + DrawStartButton(1.0f - TitleAnimation.Progress); + Renderer->DrawSprite(CopyrightTextSprite, CopyrightTextPos, + {1.0f, 1.0f, 1.0f, 1.0f - TitleAnimation.Progress}); } break; case 3: { // MenuItems Fade In @@ -692,15 +696,17 @@ void TitleMenu::Render() { } break; case 11: { // Initial Fade In + const float progress = ScrWork[SW_TITLEDISPCT] / 32.0f; + Renderer->DrawSprite(BackgroundSprite, {0.0f, 0.0f}); if (renderOverlay) { CommonMenu::DrawOverlay(); - CommonMenu::DrawSmoke(SmokeOpacityNormal * - (ScrWork[SW_TITLEDISPCT] / 32.0f)); + CommonMenu::DrawSmoke(SmokeOpacityNormal * progress); } - Renderer->DrawSprite(CopyrightTextSprite, CopyrightTextPos); + Renderer->DrawSprite(CopyrightTextSprite, CopyrightTextPos, + {1.0f, 1.0f, 1.0f, progress}); } break; } @@ -711,6 +717,13 @@ void TitleMenu::Render() { RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight), col); } +void TitleMenu::DrawStartButton(const float alpha) { + const float animationAlpha = + glm::smoothstep(0.0f, 1.0f, PressToStartAnimation.Progress); + const float clampedAlpha = std::max(0.0f, animationAlpha - (1.0f - alpha)); + Renderer->DrawSprite(PressToStartSprite, PressToStartPos, + {1.0f, 1.0f, 1.0f, clampedAlpha}); +} void TitleMenu::ShowContinueItems() { ContinueItems->Show(); diff --git a/src/games/cclcc/titlemenu.h b/src/games/cclcc/titlemenu.h index c6802a4d1..d49c8bc13 100644 --- a/src/games/cclcc/titlemenu.h +++ b/src/games/cclcc/titlemenu.h @@ -60,7 +60,7 @@ class TitleMenu : public Menu { void ShowExtraItems(); void HideExtraItems(); - void DrawStartButton(); + void DrawStartButton(float alpha = 1.0f); void MainMenuUpdate(); void SubMenuUpdate(); From 48dd12f0eafc335475a7f3df30c0ab9c25f31c66 Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 22:45:23 +0200 Subject: [PATCH 06/11] Implement title menu background fading during explosion transition --- src/games/cclcc/titlemenu.cpp | 22 +++++++++++++++++++--- src/games/cclcc/titlemenu.h | 6 ++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/games/cclcc/titlemenu.cpp b/src/games/cclcc/titlemenu.cpp index fd71c269e..0a2190eae 100644 --- a/src/games/cclcc/titlemenu.cpp +++ b/src/games/cclcc/titlemenu.cpp @@ -203,6 +203,15 @@ TitleMenu::TitleMenu() { SecondaryFadeAnimation.DurationOut = SecondaryFadeOutDuration; SlideItemsAnimation.DurationIn = SlideItemsAnimationDurationIn; SlideItemsAnimation.DurationOut = SlideItemsAnimationDurationOut; + + const RectF viewport = Window->GetViewport(); + Texture pressToStartTransitionTexture; + pressToStartTransitionTexture.LoadSolidColor( + static_cast(viewport.Width), static_cast(viewport.Height), 0); + PressToStartTransitionCapture.Sheet.Texture = + pressToStartTransitionTexture.Submit(); + PressToStartTransitionCapture.Sheet.DesignWidth = viewport.Width; + PressToStartTransitionCapture.Sheet.DesignHeight = viewport.Height; } void TitleMenu::Show() { @@ -362,6 +371,8 @@ void TitleMenu::Update(float dt) { ContinueItems->Update(dt); ExtraItems->Update(dt); + PressToStartTransitionCaptureSet &= ScrWork[SW_TITLEMODE] == 2; + if (GetFlag(SF_TITLEMODE)) { Show(); } else { @@ -623,14 +634,19 @@ void TitleMenu::Render() { } break; case 2: { // Transition between Press to start and menus - if (IsExploding || EverExploded) { - Renderer->DrawSprite(MainBackgroundSprite, {0.0f, 0.0f}); - } else { + if (!PressToStartTransitionCaptureSet) { Renderer->DrawSprite(BackgroundSprite, {0.0f, 0.0f}); + PressToStartTransitionCaptureSet = true; + } else { + Renderer->DrawSprite(PressToStartTransitionCapture, {0.0f, 0.0f}); } + Renderer->DrawSprite(MainBackgroundSprite, {0.0f, 0.0f}, + {1.0f, 1.0f, 1.0f, TitleAnimation.Progress}); TitleAnimationSprite.Render(-1); + Renderer->CaptureScreencap(PressToStartTransitionCapture); + if (renderOverlay) { CommonMenu::DrawOverlay(); CommonMenu::DrawSmoke(SmokeOpacityNormal); diff --git a/src/games/cclcc/titlemenu.h b/src/games/cclcc/titlemenu.h index d49c8bc13..9464e017b 100644 --- a/src/games/cclcc/titlemenu.h +++ b/src/games/cclcc/titlemenu.h @@ -15,6 +15,9 @@ namespace CCLCC { class TitleMenu : public Menu { public: TitleMenu(); + ~TitleMenu() { + Renderer->FreeTexture(PressToStartTransitionCapture.Sheet.Texture); + } void Show() override; void Hide() override; @@ -71,6 +74,9 @@ class TitleMenu : public Menu { bool IsExploding = false; bool InputLocked = false; bool PrevInputLocked = false; + + Sprite PressToStartTransitionCapture; + bool PressToStartTransitionCaptureSet = false; }; } // namespace CCLCC From e7a1d7b701d4d2ea4c57269d9bb01cb587c7e0fd Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Fri, 10 Jul 2026 20:12:01 +0200 Subject: [PATCH 07/11] Fix CC backlog menu background showing overlap when fading in/out --- profiles/cc/hud/backlogmenu.lua | 4 ++-- profiles/cclcc/hud/backlogmenu.lua | 4 ++-- src/games/cc/backlogmenu.cpp | 22 ++++++++++------------ src/profile/games/cc/backlogmenu.cpp | 3 --- src/profile/games/cc/backlogmenu.h | 2 -- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/profiles/cc/hud/backlogmenu.lua b/profiles/cc/hud/backlogmenu.lua index 0a085d3f9..1c0fc6b35 100644 --- a/profiles/cc/hud/backlogmenu.lua +++ b/profiles/cc/hud/backlogmenu.lua @@ -3,7 +3,6 @@ root.BacklogMenu = { DrawType = DrawComponentType.SystemMenu, BacklogBackgroundSprite = "BacklogBackground", - BacklogBackgroundRepeatHeight = 1080, BacklogHeaderSprite = "BacklogHeader", BacklogHeaderPosition = { X = 0, Y = 0 }, @@ -42,7 +41,8 @@ root.BacklogMenu = { root.Sprites["BacklogBackground"] = { Sheet = "Backlog", - Bounds = { X = 0, Y = 0, Width = 1920, Height = 1100 }, + Bounds = { X = 0, Y = 0, Width = 1920, Height = 1080 }, + -- Height does *not* include the repeat overlap }; root.Sprites["BacklogHeader"] = { diff --git a/profiles/cclcc/hud/backlogmenu.lua b/profiles/cclcc/hud/backlogmenu.lua index 715e93be8..575cda463 100644 --- a/profiles/cclcc/hud/backlogmenu.lua +++ b/profiles/cclcc/hud/backlogmenu.lua @@ -3,7 +3,6 @@ root.BacklogMenu = { DrawType = DrawComponentType.SystemMenu, BacklogBackgroundSprite = "BacklogBackground", - BacklogBackgroundRepeatHeight = 1005, BacklogHeaderSprite = "BacklogHeader", BacklogHeaderPosition = { X = 0, Y = 0 }, @@ -42,7 +41,8 @@ root.BacklogMenu = { root.Sprites["BacklogBackground"] = { Sheet = "Backlog", - Bounds = { X = 0, Y = 0, Width = 1920, Height = 1080 }, + Bounds = { X = 0, Y = 0, Width = 1920, Height = 1005 }, + -- Height does *not* include the repeat overlap }; root.Sprites["BacklogHeader"] = { diff --git a/src/games/cc/backlogmenu.cpp b/src/games/cc/backlogmenu.cpp index 48c104758..94ec6cb23 100644 --- a/src/games/cc/backlogmenu.cpp +++ b/src/games/cc/backlogmenu.cpp @@ -73,24 +73,22 @@ void BacklogMenu::Update(float dt) { void BacklogMenu::Render() { if (State == Hidden) return; - float opacity = glm::smoothstep(0.0f, 1.0f, FadeAnimation.Progress); - glm::vec4 transition(1.0f, 1.0f, 1.0f, opacity); - - glm::vec4 maskTint = transition; - maskTint.a *= (float)0xa0 / 0x100; + const float opacity = glm::smoothstep(0.0f, 1.0f, FadeAnimation.Progress); + const glm::vec4 transition(1.0f, 1.0f, 1.0f, opacity); MainItems->Tint = transition; MainScrollbar->Tint = transition; - int repeatHeight = BacklogBackgroundRepeatHeight; - float backgroundY = - (float)fmod(PageY - EntryYPadding - RenderingBounds.Y, repeatHeight); + const float backgroundY = + static_cast(fmod(PageY - EntryYPadding - RenderingBounds.Y, + BacklogBackground.Bounds.Height)); if (OpenedAsDirect) CommonMenu::DrawBgSprite(State, FadeAnimation); - Renderer->DrawSprite(BacklogBackground, glm::vec2(0.0f, backgroundY), - transition); - Renderer->DrawSprite(BacklogBackground, - glm::vec2(0.0f, backgroundY + repeatHeight), transition); + + for (float yPos = backgroundY; yPos <= Profile::DesignHeight; + yPos += BacklogBackground.Bounds.Height) { + Renderer->DrawSprite(BacklogBackground, {0.0f, yPos}, transition); + } RenderHighlight(); Renderer->DrawSprite(BacklogHeaderSprite, BacklogHeaderPosition, transition); diff --git a/src/profile/games/cc/backlogmenu.cpp b/src/profile/games/cc/backlogmenu.cpp index 8bc0056b7..026513e0f 100644 --- a/src/profile/games/cc/backlogmenu.cpp +++ b/src/profile/games/cc/backlogmenu.cpp @@ -9,9 +9,6 @@ namespace CC { namespace BacklogMenu { void Configure() { - BacklogBackgroundRepeatHeight = - EnsureGetMember("BacklogBackgroundRepeatHeight"); - BacklogHeaderSprite = EnsureGetMember("BacklogHeaderSprite"); BacklogHeaderPosition = EnsureGetMember("BacklogHeaderPosition"); diff --git a/src/profile/games/cc/backlogmenu.h b/src/profile/games/cc/backlogmenu.h index 5bfa06c22..5bb3cf745 100644 --- a/src/profile/games/cc/backlogmenu.h +++ b/src/profile/games/cc/backlogmenu.h @@ -9,8 +9,6 @@ namespace BacklogMenu { void Configure(); -inline int BacklogBackgroundRepeatHeight; - inline Sprite BacklogHeaderSprite; inline glm::vec2 BacklogHeaderPosition; From 43d128b809b9180b3ed157aab79b6a3f734ec14b Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 19:11:51 +0200 Subject: [PATCH 08/11] Add cclcc TitleMenuMode enum --- src/games/cc/titlemenu.cpp | 23 ++++++++---------- src/games/cc/titlemenu.h | 13 ++++++++++ src/games/cclcc/titlemenu.cpp | 46 +++++++++++++++++------------------ src/vm/inst_misc.cpp | 9 ++++--- 4 files changed, 51 insertions(+), 40 deletions(-) diff --git a/src/games/cc/titlemenu.cpp b/src/games/cc/titlemenu.cpp index a9eb39c19..06692417a 100644 --- a/src/games/cc/titlemenu.cpp +++ b/src/games/cc/titlemenu.cpp @@ -220,15 +220,16 @@ void TitleMenu::Update(float dt) { if (State != Hidden && GetFlag(SF_TITLEMODE)) { switch (ScrWork[SW_TITLEMODE]) { - case 1: { + using enum TitleMenuMode::Mode; + case PressToStart: { PressToStartAnimation.DurationIn = PressToStartAnimDurationIn; PressToStartAnimation.DurationOut = PressToStartAnimDurationOut; } break; - case 2: { + case StartTransition: { PressToStartAnimation.DurationIn = PressToStartAnimFastDurationIn; PressToStartAnimation.DurationOut = PressToStartAnimFastDurationOut; } break; - case 3: { + case Main: { MainItems->Update(dt); ContinueItems->Update(dt); ExtraItems->Update(dt); @@ -250,7 +251,8 @@ void TitleMenu::Update(float dt) { void TitleMenu::Render() { if (State != Hidden && GetFlag(SF_TITLEMODE)) { switch (ScrWork[SW_TITLEMODE]) { - case 1: { // Press to start + using enum TitleMenuMode::Mode; + case PressToStart: { DrawMainBackground(true); DrawStartButton(); Renderer->DrawSprite( @@ -262,7 +264,7 @@ void TitleMenu::Render() { glm::vec4(1.0f, 1.0f, 1.0f, 1.0f - ScrWork[SW_TITLEDISPCT] / 60.0f)); } break; - case 2: { // Transition between Press to start and menus + case StartTransition: { DrawMainBackground(true); DrawStartButton(); Renderer->DrawSprite( @@ -270,7 +272,7 @@ void TitleMenu::Render() { RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight)); DrawSmoke(SmokeOpacityNormal); } break; - case 3: { // Main Menu Fade In + case Main: { float backgroundBoundsY = BackgroundBoundsYNormal, fenceBoundsY = FenceBoundsYNormal; if (GetFlag(SF_CLR_TRUE_CC)) { @@ -303,20 +305,15 @@ void TitleMenu::Render() { ContinueItems->Render(); ExtraItems->Render(); } break; - case 4: { + case FadingOut: { } break; - case 7: - case 8: { - } break; - case 11: { // Initial Fade In + case InitialFade: { DrawMainBackground(ScrWork[SW_TITLEDISPCT] / 32.0f); Renderer->DrawSprite( OverlaySprite, RectF(0.0f, 0.0f, Profile::DesignWidth, Profile::DesignHeight)); DrawSmoke(ScrWork[SW_TITLEDISPCT] / 128.0f); } break; - case 12: { - } break; } } } diff --git a/src/games/cc/titlemenu.h b/src/games/cc/titlemenu.h index 0f27fe262..3d88bc80a 100644 --- a/src/games/cc/titlemenu.h +++ b/src/games/cc/titlemenu.h @@ -58,6 +58,19 @@ class TitleMenu : public Menu { void DrawSmoke(float opacity); }; +namespace TitleMenuMode { +enum Mode : uint8_t { + Invisible = 0, + PressToStart = 1, + StartTransition = 2, + Main = 3, + FadingOut = 4, + SubMenu = 5, + InitialFade = 11, + ClearList = 13, +}; +} + } // namespace CC } // namespace UI } // namespace Impacto \ No newline at end of file diff --git a/src/games/cclcc/titlemenu.cpp b/src/games/cclcc/titlemenu.cpp index 0a2190eae..d886cd6ed 100644 --- a/src/games/cclcc/titlemenu.cpp +++ b/src/games/cclcc/titlemenu.cpp @@ -1,6 +1,7 @@ #include "titlemenu.h" #include "commonmenu.h" +#include "../cc/titlemenu.h" #include "../../spritesheet.h" #include "../../renderer/renderer.h" #include "../../mem.h" @@ -269,8 +270,9 @@ void TitleMenu::Hide() { } void TitleMenu::UpdateInput(float dt) { - if (ScrWork[SW_TITLEMODE] == 5 || ScrWork[SW_TITLEMODE] == 13 || - ScrWork[SW_TITLEMODE] == 3) { + if (ScrWork[SW_TITLEMODE] == CC::TitleMenuMode::SubMenu || + ScrWork[SW_TITLEMODE] == CC::TitleMenuMode::ClearList || + ScrWork[SW_TITLEMODE] == CC::TitleMenuMode::Main) { if (!InputLocked && !PrevInputLocked) { if (SlideItemsAnimation.State == AnimationState::Playing || SecondaryFadeAnimation.State == AnimationState::Playing || @@ -371,7 +373,8 @@ void TitleMenu::Update(float dt) { ContinueItems->Update(dt); ExtraItems->Update(dt); - PressToStartTransitionCaptureSet &= ScrWork[SW_TITLEMODE] == 2; + PressToStartTransitionCaptureSet &= + ScrWork[SW_TITLEMODE] == CC::TitleMenuMode::StartTransition; if (GetFlag(SF_TITLEMODE)) { Show(); @@ -381,32 +384,27 @@ void TitleMenu::Update(float dt) { if (State != Hidden && GetFlag(SF_TITLEMODE)) { switch (ScrWork[SW_TITLEMODE]) { - case 1: { + using enum CC::TitleMenuMode::Mode; + case PressToStart: { if (PressToStartAnimation.LoopMode != AnimationLoopMode::ReverseDirection) { PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; PressToStartAnimation.StartOut(); } } break; - case 2: { + case StartTransition: { ExplodeScreenUpdate(); } break; - case 3: { // Main Menu Fade In + case Main: { MainMenuUpdate(); } break; - case 4: { + case FadingOut: { ReturnToMenuUpdate(); } break; - // TODO check if that's true - case 5: - case 13: { + case SubMenu: + case ClearList: { SubMenuUpdate(); } break; - case 10: { - ImpLogSlow(LogLevel::Warning, LogChannel::VMStub, - "TitleMenu::Update: Unimplemented title mode {:d}\n", - ScrWork[SW_TITLEMODE]); - } break; } if (SubMenuState == Hiding && ScrWork[SW_SYSSUBMENUCT] == 0) { SubMenuState = Hidden; @@ -414,7 +412,7 @@ void TitleMenu::Update(float dt) { SubMenuState = Shown; IsFocused = true; } - if (ScrWork[SW_TITLEMODE] != 2) IsExploding = false; + IsExploding &= ScrWork[SW_TITLEMODE] == CC::TitleMenuMode::StartTransition; } } @@ -618,7 +616,8 @@ void TitleMenu::Render() { currentActiveMenu == nullptr || currentActiveMenu->State == Hidden; switch (ScrWork[SW_TITLEMODE]) { - case 1: { // Press to start + using enum CC::TitleMenuMode::Mode; + case PressToStart: { Renderer->DrawSprite(BackgroundSprite, glm::vec2(0.0f)); if (renderOverlay) { @@ -633,7 +632,7 @@ void TitleMenu::Render() { glm::vec4(1.0f, 1.0f, 1.0f, 1.0f - ScrWork[SW_TITLEDISPCT] / 60.0f)); } break; - case 2: { // Transition between Press to start and menus + case StartTransition: { if (!PressToStartTransitionCaptureSet) { Renderer->DrawSprite(BackgroundSprite, {0.0f, 0.0f}); PressToStartTransitionCaptureSet = true; @@ -657,7 +656,7 @@ void TitleMenu::Render() { {1.0f, 1.0f, 1.0f, 1.0f - TitleAnimation.Progress}); } break; - case 3: { // MenuItems Fade In + case Main: { Renderer->DrawSprite(MainBackgroundSprite, {0.0f, 0.0f}); Extra->Tint = (GetFlag(SF_CLR_FLAG)) ? MainItems->Tint @@ -673,7 +672,7 @@ void TitleMenu::Render() { } } break; - case 4: { + case FadingOut: { Renderer->DrawSprite(MainBackgroundSprite, {0.0f, 0.0f}); Extra->Tint = (GetFlag(SF_CLR_FLAG)) ? MainItems->Tint @@ -694,9 +693,8 @@ void TitleMenu::Render() { {0.0f, 0.0f, 0.0f, ScrWork[SW_TITLEDISPCT] / 32.0f}); } break; - // TODO check if that's true - case 5: - case 13: { + case SubMenu: + case ClearList: { Renderer->DrawSprite(MainBackgroundSprite, {0.0f, 0.0f}); MenuLabel->Render(); @@ -711,7 +709,7 @@ void TitleMenu::Render() { } } break; - case 11: { // Initial Fade In + case InitialFade: { const float progress = ScrWork[SW_TITLEDISPCT] / 32.0f; Renderer->DrawSprite(BackgroundSprite, {0.0f, 0.0f}); diff --git a/src/vm/inst_misc.cpp b/src/vm/inst_misc.cpp index 3115307db..e326a2458 100644 --- a/src/vm/inst_misc.cpp +++ b/src/vm/inst_misc.cpp @@ -16,6 +16,7 @@ #include "../text/dialoguepage.h" #include "../profile/vm.h" +#include "../games/cc/titlemenu.h" #include "../games/cclcc/systemmenu.h" #include "../games/cclcc/helpmenu.h" namespace Impacto { @@ -528,12 +529,14 @@ VmInstruction(InstTitleMenuNew) { break; case InstructionSet::CC: case InstructionSet::CHN: { - if (ScrWork[SW_TITLEMODE] == 3) { + using enum UI::CC::TitleMenuMode::Mode; + + if (ScrWork[SW_TITLEMODE] == Main) { if (!UI::TitleMenuPtr->AllowsScriptInput) { ResetInstruction; BlockThread; } - } else if (ScrWork[SW_TITLEMODE] == 1 && + } else if (ScrWork[SW_TITLEMODE] == PressToStart && ScrWork[SW_TITLEDISPCT] == (Profile::Vm::GameInstructionSet == InstructionSet::CC ? 60 @@ -541,7 +544,7 @@ VmInstruction(InstTitleMenuNew) { // Check "PRESS TO START" here if (((Interface::PADinputButtonWentDown & Interface::PAD1A) || (Interface::PADinputMouseWentDown & Interface::PAD1A))) { - ScrWork[SW_TITLEMODE] = 2; + ScrWork[SW_TITLEMODE] = StartTransition; ScrWork[SW_TITLEDISPCT] = 0; ScrWork[SW_TITLEMOVIECT] = 0; SetFlag(SF_TITLEEND, 1); From 6aa913a15688771e4af3e2791fbf087fd4b7783b Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 19:26:56 +0200 Subject: [PATCH 09/11] Add overlay to Yes/No trigger --- profiles/cclcc/yesnotrigger.lua | 5 ----- src/games/cclcc/yesnotrigger.cpp | 6 +++--- src/profile/games/cclcc/yesnotrigger.cpp | 1 - src/profile/games/cclcc/yesnotrigger.h | 1 - 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/profiles/cclcc/yesnotrigger.lua b/profiles/cclcc/yesnotrigger.lua index 7a9425015..12f15335d 100644 --- a/profiles/cclcc/yesnotrigger.lua +++ b/profiles/cclcc/yesnotrigger.lua @@ -71,7 +71,6 @@ root.YesNoTrigger = { YN2ChipNoS = "YN2ChipNoS", ChipStar = "YNChipStar", YNBlurMask = "YNBlurMask", - YNBgOverlay = "YNBgOverlay", YesNoData1 = data1, YesNoData2 = data2, StarRotationPeriod = 164 / 60, @@ -141,10 +140,6 @@ root.Sprites["YNChipStar"] = { Sheet = "YesNoChip", Bounds = { X = 1033.0, Y = 385.0, Width = 380, Height = 380 } }; -root.Sprites["YNBgOverlay"] = { - Sheet = "MenuChip", - Bounds = { X = 154.0, Y = 141.0, Width = 1900, Height = 1060 } -}; root.Sprites["YNBlurMask"] = { Sheet = "YesNoBlurMask", Bounds = { X = 0, Y = 0, Width = 512, Height = 256 } diff --git a/src/games/cclcc/yesnotrigger.cpp b/src/games/cclcc/yesnotrigger.cpp index 6c4b51abb..cef4dfb1d 100644 --- a/src/games/cclcc/yesnotrigger.cpp +++ b/src/games/cclcc/yesnotrigger.cpp @@ -1,4 +1,5 @@ #include "yesnotrigger.h" +#include "commonmenu.h" #include "../../profile/games/cclcc/yesnotrigger.h" #include "../../vm/interface/input.h" #include "../../audio/audiosystem.h" @@ -340,9 +341,8 @@ void YesNoTrigger::Render() { Renderer->DrawSprite(*activeYesChip, yesChipDest, chipTint); Renderer->DrawSprite(*activeNoChip, noChipDest, chipTint); } - constexpr glm::vec4 maskTint = glm::vec4(1.0f, 1.0f, 1.0f, 160 / 256.0f); - Renderer->DrawSprite(YesNoBgOverlay, - RectF(0, 0, bgSize.x * 0.5f, bgSize.y * 0.5f), maskTint); + + CommonMenu::DrawOverlay(); } void YesNoTrigger::Start(int type, int bgBufId, int chipsBufId) { diff --git a/src/profile/games/cclcc/yesnotrigger.cpp b/src/profile/games/cclcc/yesnotrigger.cpp index 7a2dc26cb..f69891c7d 100644 --- a/src/profile/games/cclcc/yesnotrigger.cpp +++ b/src/profile/games/cclcc/yesnotrigger.cpp @@ -30,7 +30,6 @@ bool Configure() { StarChip = EnsureGetMember("ChipStar"); YesNoBlurMask = EnsureGetMember("YNBlurMask"); - YesNoBgOverlay = EnsureGetMember("YNBgOverlay"); StarRotationPeriod = EnsureGetMember("StarRotationPeriod"); { diff --git a/src/profile/games/cclcc/yesnotrigger.h b/src/profile/games/cclcc/yesnotrigger.h index 583c44854..d6acadb65 100644 --- a/src/profile/games/cclcc/yesnotrigger.h +++ b/src/profile/games/cclcc/yesnotrigger.h @@ -29,7 +29,6 @@ inline Sprite YN2NoChipSmall; inline Sprite YN2NoChipLarge; inline Sprite StarChip; inline Sprite YesNoBlurMask; -inline Sprite YesNoBgOverlay; inline float StarRotationPeriod; inline glm::vec2 BackgroundPositions[BackgroundPositionsNum]; From 7997a45c540628b9bbb307f9d00b45abf6a864fa Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 23:01:25 +0200 Subject: [PATCH 10/11] Move cclcc title menu initialization logic into constructor --- src/games/cclcc/titlemenu.cpp | 15 +++++++++++++++ src/profile/games/cclcc/titlemenu.cpp | 22 +--------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/games/cclcc/titlemenu.cpp b/src/games/cclcc/titlemenu.cpp index d886cd6ed..4d630e668 100644 --- a/src/games/cclcc/titlemenu.cpp +++ b/src/games/cclcc/titlemenu.cpp @@ -75,6 +75,21 @@ void TitleMenu::ExitButtonOnClick(Widgets::Button* target) { } TitleMenu::TitleMenu() { + PressToStartAnimation.DurationIn = PressToStartAnimDurationIn; + PressToStartAnimation.DurationOut = PressToStartAnimDurationOut; + PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; + + PrimaryFadeAnimation.DurationIn = PrimaryFadeInDuration; + PrimaryFadeAnimation.DurationOut = PrimaryFadeOutDuration; + SecondaryFadeAnimation.DurationIn = SecondaryFadeInDuration; + SecondaryFadeAnimation.DurationOut = SecondaryFadeOutDuration; + + TitleAnimation.DurationIn = TitleAnimationDurationIn; + TitleAnimation.DurationOut = TitleAnimationDurationOut; + + TitleAnimationSprite.MountPoint = "system"; + TitleAnimationSprite.LoadAsync(TitleAnimationFileId); + MainItems = new Widgets::Group(this); ContinueItems = new Widgets::Group(this); ContinueItems->WrapFocus = false; diff --git a/src/profile/games/cclcc/titlemenu.cpp b/src/profile/games/cclcc/titlemenu.cpp index dde73f91d..01714c735 100644 --- a/src/profile/games/cclcc/titlemenu.cpp +++ b/src/profile/games/cclcc/titlemenu.cpp @@ -72,28 +72,8 @@ void Configure() { EnsureGetMember("HighlightAnimationDurationOut"); ExtraDisabledTint = EnsureGetMember("ExtraDisabledTint"); - UI::CCLCC::TitleMenu* menu = new UI::CCLCC::TitleMenu(); - menu->PressToStartAnimation.DurationIn = - Profile::TitleMenu::PressToStartAnimDurationIn; - menu->PressToStartAnimation.DurationOut = - Profile::TitleMenu::PressToStartAnimDurationOut; - menu->PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; - - menu->PrimaryFadeAnimation.DurationIn = PrimaryFadeInDuration; - menu->PrimaryFadeAnimation.DurationOut = PrimaryFadeOutDuration; - menu->SecondaryFadeAnimation.DurationIn = SecondaryFadeInDuration; - menu->SecondaryFadeAnimation.DurationOut = SecondaryFadeOutDuration; - - menu->TitleAnimation.DurationIn = TitleAnimationDurationIn; - menu->TitleAnimation.DurationOut = TitleAnimationDurationOut; - - menu->TitleAnimationSprite.MountPoint = "system"; - menu->TitleAnimationSprite.LoadAsync(TitleAnimationFileId); - - UI::TitleMenuPtr = menu; - + UI::TitleMenuPtr = new UI::CCLCC::TitleMenu(); auto drawType = EnsureGetMember("DrawType"); - UI::Menus[drawType].push_back(UI::TitleMenuPtr); } From b250b086f859df463ab0ffb7f547276c4c34187e Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Sun, 12 Jul 2026 23:13:29 +0200 Subject: [PATCH 11/11] Randomize smoke position in InstSystemMenu --- src/games/cclcc/commonmenu.cpp | 7 +++++++ src/games/cclcc/commonmenu.h | 3 +++ src/games/cclcc/systemmenu.cpp | 2 ++ 3 files changed, 12 insertions(+) diff --git a/src/games/cclcc/commonmenu.cpp b/src/games/cclcc/commonmenu.cpp index c8b9631ed..41f73b64b 100644 --- a/src/games/cclcc/commonmenu.cpp +++ b/src/games/cclcc/commonmenu.cpp @@ -47,6 +47,13 @@ void CommonMenu::Init() { CaptureSprite.Sheet.DesignHeight = viewport.Height; } +void CommonMenu::InitSmokePos() { + for (Animation& animation : SmokeAnimations) { + animation.Progress = + CALCrnd(static_cast(Profile::DesignWidth)) / Profile::DesignWidth; + } +} + void CommonMenu::Update(const float dt) { for (Animation& animation : SmokeAnimations) { animation.Update(dt); diff --git a/src/games/cclcc/commonmenu.h b/src/games/cclcc/commonmenu.h index 21ac8b86a..fa1f155e4 100644 --- a/src/games/cclcc/commonmenu.h +++ b/src/games/cclcc/commonmenu.h @@ -16,7 +16,10 @@ constexpr inline size_t SmokeLayerCount = 2; class CommonMenu { public: static void Init(); + + static void InitSmokePos(); static void DrawSmoke(float alpha); + static void DrawOverlay(float alpha = 1.0f); protected: diff --git a/src/games/cclcc/systemmenu.cpp b/src/games/cclcc/systemmenu.cpp index 820d1c7d6..72b8f175e 100644 --- a/src/games/cclcc/systemmenu.cpp +++ b/src/games/cclcc/systemmenu.cpp @@ -269,6 +269,8 @@ void SystemMenu::Init() { BGPosition = {CALCrnd((int)BGRandPosRange.x), CALCrnd((int)BGRandPosRange.y)}; SetFlag(SF_SYSTEMMENUCAPTURE, true); + CommonMenu::InitSmokePos(); + bool backlogLockState = GetFlag(SF_BACKLOG_NOLOG) || GetFlag(SF_MESREVDISABLE); static_cast(