Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions profiles/cc/hud/titlemenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ root.TitleMenu = {
CopyrightX = 640,
CopyrightY = 947,
CopyrightXMoveOffset = 1536,
SmokeX = 0,
SmokeY = 580,
SmokeBoundsX = 20,
SmokeBoundsY = 1800,
SmokeBoundsWidth = 1920,
SmokeBoundsHeight = 500,
SmokePosition = {X = 0, Y = 580},
SmokeBounds = {X = 20, Y = 1800, Width = 1920, Height = 500},
SmokeAnimationBoundsXOffset = 20,
SmokeAnimationBoundsXMax = 1919,
SmokeOpacityNormal = 0.25,
Expand Down
16 changes: 15 additions & 1 deletion profiles/cclcc/hud/systemmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ root.SystemMenu = {
SystemMenuFrame = "SystemMenuFrame",
SystemMenuMask = "SystemMenuMask",

SmokePosition = {X = 0, Y = 580},
SmokeBounds = {X = 20, Y = 1550, Width = 1920, Height = 500},
SmokeAnimationBoundsXOffset = 20,
SmokeAnimationBoundsXMax = 1919,
SmokeOpacityNormal = 0.15,
SmokeAnimationDurationIn = 32,
SmokeAnimationDurationOut = 32,
SmokeSprite = "SystemMenuSmoke",

BGDispOffsetTopLeft = {X=-1200, Y= -330},
BGDispOffsetBottomLeft = {X=-1200, Y= 2080},
BGDispOffsetTopRight = {X=2520, Y= -330},
Expand Down Expand Up @@ -148,5 +157,10 @@ root.Sprites["SystemMenuFrame"] = {

root.Sprites["SystemMenuMask"] = {
Sheet = "MenuChip",
Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 },
Bounds = { X = 154, Y = 141, Width = 1900, Height = 1060 },
};

root.Sprites["SystemMenuSmoke"] = {
Sheet = "MenuChip",
Bounds = { X = 0, Y = 1638, Width = 2000, Height = 410 },
};
10 changes: 3 additions & 7 deletions profiles/cclcc/hud/titlemenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ root.TitleMenu = {
CopyrightTextSprite = "CopyrightText",
CopyrightTextX = 566,
CopyrightTextY = 955,
SmokeX = 0,
SmokeY = 580,
SmokeBoundsX = 20,
SmokeBoundsY = 1550,
SmokeBoundsWidth = 1920,
SmokeBoundsHeight = 500,
SmokePosition = {X = 0, Y = 580},
SmokeBounds = {X = 20, Y = 1550, Width = 1920, Height = 500},
SmokeAnimationBoundsXOffset = 20,
SmokeAnimationBoundsXMax = 1919,
SmokeOpacityNormal = 0.15,
Expand Down Expand Up @@ -181,7 +177,7 @@ root.Sprites["TitleMenuMenu"] = {

root.Sprites["TitleMenuOverlay"] = {
Sheet = "MenuChip",
Bounds = { X = 154, Y = 140, Width = 1900, Height = 1061 },
Bounds = { X = 154, Y = 141, Width = 1900, Height = 1060 },
};

root.Sprites["TitleMenuSmoke"] = {
Expand Down
8 changes: 2 additions & 6 deletions profiles/chn/hud/titlemenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ root.TitleMenu = {
CopyrightX = 640,
CopyrightY = 947,
CopyrightXMoveOffset = 1536,
SmokeX = 0,
SmokeY = 580,
SmokeBoundsX = 20,
SmokeBoundsY = 1800,
SmokeBoundsWidth = 1920,
SmokeBoundsHeight = 500,
SmokePosition = {X = 0, Y = 580},
SmokeBounds = {X = 20, Y = 1800, Width = 1920, Height = 500},
SmokeAnimationBoundsXOffset = 20,
SmokeAnimationBoundsXMax = 1919,
SmokeOpacityNormal = 0.25,
Expand Down
30 changes: 16 additions & 14 deletions src/games/cc/titlemenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,23 +340,25 @@ void TitleMenu::DrawStartButton() {
void TitleMenu::DrawSmoke(float opacity) {
glm::vec4 col = glm::vec4(1.0f);
col.a = opacity;
SmokeSprite.Bounds = RectF(
SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) +
Sprite smokeSpriteCopy = Sprite(SmokeSprite);

smokeSpriteCopy.Bounds = RectF(
SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) +
SmokeAnimationBoundsXOffset,
SmokeBoundsY,
SmokeBoundsWidth -
SmokeBounds.Y,
SmokeBounds.Width -
(SmokeAnimationBoundsXMax * (1.0f - SmokeAnimation.Progress)),
SmokeBoundsHeight);
Renderer->DrawSprite(SmokeSprite, glm::vec2(SmokeX, SmokeY), col);
SmokeSprite.Bounds = RectF(
SmokeBoundsX, SmokeBoundsY,
SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress),
SmokeBoundsHeight);
SmokeBounds.Height);
Renderer->DrawSprite(smokeSpriteCopy, SmokePosition, col);
smokeSpriteCopy.Bounds = RectF(
SmokeBounds.X, SmokeBounds.Y,
SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress),
SmokeBounds.Height);
Renderer->DrawSprite(
SmokeSprite,
glm::vec2(SmokeBoundsWidth - (SmokeAnimationBoundsXMax *
(1.0f - SmokeAnimation.Progress)),
SmokeY),
smokeSpriteCopy,
glm::vec2(SmokeBounds.Width - (SmokeAnimationBoundsXMax *
(1.0f - SmokeAnimation.Progress)),
SmokePosition.y),
col);
}

Expand Down
36 changes: 36 additions & 0 deletions src/games/cclcc/systemmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ SystemMenu::SystemMenu() {
ItemsFade.DurationIn = ItemsFadeInDuration;
ItemsFade.DurationOut = ItemsFadeOutDuration;

SmokeAnimation.Direction = AnimationDirection::In;
SmokeAnimation.LoopMode = AnimationLoopMode::Loop;
SmokeAnimation.DurationIn = SmokeAnimationDurationIn;
SmokeAnimation.DurationOut = SmokeAnimationDurationOut;

auto onClick = [this](auto* btn) { return MenuButtonOnClick(btn); };

MainItems = new Widgets::Group(this);
Expand Down Expand Up @@ -100,6 +105,7 @@ void SystemMenu::Show() {
State = Showing;
MenuTransition.StartIn();
MenuFade.StartIn();
SmokeAnimation.StartIn();
// If the function was called due to a submenu opening directly,
// then don't take over focus
if (!((ScrWork[SW_SYSMENUCT] == 32 && ScrWork[SW_SYSSUBMENUCT]) ||
Expand Down Expand Up @@ -146,6 +152,7 @@ void SystemMenu::Hide() {

void SystemMenu::Update(float dt) {
UpdateInput(dt);
SmokeAnimation.Update(dt);

if (State == Shown &&
((GetFlag(SF_TITLEMODE) || ScrWork[SW_SYSMENUCT] < 32) ||
Expand Down Expand Up @@ -294,12 +301,41 @@ void SystemMenu::Render() {
RectF{0, 0, Profile::DesignWidth, Profile::DesignHeight},
glm::vec4{tint, alpha});

DrawSmoke(ScrWork[SW_SYSMENUCT] / 128.0f);

MainItems->Tint =
glm::vec4(tint, glm::smoothstep(0.0f, 1.0f, ItemsFade.Progress));
MainItems->Render();
}
}

void SystemMenu::DrawSmoke(float opacity) {
Renderer->SetBlendMode(RendererBlendMode::Additive);
glm::vec4 col = glm::vec4(1.0f);
col.a = opacity;
Sprite smokeSpriteCopy = Sprite(SmokeSprite);

smokeSpriteCopy.Bounds = RectF(
SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) +
SmokeAnimationBoundsXOffset,
SmokeBounds.Y,
SmokeBounds.Width -
(SmokeAnimationBoundsXMax * (1.0f - SmokeAnimation.Progress)),
SmokeBounds.Height);
Renderer->DrawSprite(smokeSpriteCopy, SmokePosition, col);
smokeSpriteCopy.Bounds = RectF(
SmokeBounds.X, SmokeBounds.Y,
SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress),
SmokeBounds.Height);
Renderer->DrawSprite(
smokeSpriteCopy,
glm::vec2(SmokeBounds.Width - (SmokeAnimationBoundsXMax *
(1.0f - SmokeAnimation.Progress)),
SmokePosition.y),
col);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the idea of modifying this profile variable's bounds...
I'd make a local copy of the sprite and modify that instead

Renderer->SetBlendMode(RendererBlendMode::Normal);
}

void SystemMenu::Init() {
BGPosition = {CALCrnd((int)BGRandPosRange.x), CALCrnd((int)BGRandPosRange.y)};
SetFlag(SF_SYSTEMMENUCAPTURE, true);
Expand Down
3 changes: 3 additions & 0 deletions src/games/cclcc/systemmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class SystemMenu : public Menu {
void UpdateInput(float dt) override;
void Update(float dt) override;
void Render() override;
void DrawSmoke(float opacity);

Animation SmokeAnimation;

void MenuButtonOnClick(Widgets::Button* target);
Sprite ScreenCap;
Expand Down
32 changes: 18 additions & 14 deletions src/games/cclcc/titlemenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,26 +661,30 @@ void TitleMenu::DrawMainMenuBackGraphics() {
}

void TitleMenu::DrawSmoke(float opacity) {
Renderer->SetBlendMode(RendererBlendMode::Additive);
glm::vec4 col = glm::vec4(1.0f);
col.a = opacity;
SmokeSprite.Bounds = RectF(
SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) +
Sprite smokeSpriteCopy = Sprite(SmokeSprite);

smokeSpriteCopy.Bounds = RectF(
SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress) +
SmokeAnimationBoundsXOffset,
SmokeBoundsY,
SmokeBoundsWidth -
SmokeBounds.Y,
SmokeBounds.Width -
(SmokeAnimationBoundsXMax * (1.0f - SmokeAnimation.Progress)),
SmokeBoundsHeight);
Renderer->DrawSprite(SmokeSprite, glm::vec2(SmokeX, SmokeY), col);
SmokeSprite.Bounds = RectF(
SmokeBoundsX, SmokeBoundsY,
SmokeBoundsWidth - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress),
SmokeBoundsHeight);
SmokeBounds.Height);
Renderer->DrawSprite(smokeSpriteCopy, SmokePosition, col);
smokeSpriteCopy.Bounds = RectF(
SmokeBounds.X, SmokeBounds.Y,
SmokeBounds.Width - (SmokeAnimationBoundsXMax * SmokeAnimation.Progress),
SmokeBounds.Height);
Renderer->DrawSprite(
SmokeSprite,
glm::vec2(SmokeBoundsWidth - (SmokeAnimationBoundsXMax *
(1.0f - SmokeAnimation.Progress)),
SmokeY),
smokeSpriteCopy,
glm::vec2(SmokeBounds.Width - (SmokeAnimationBoundsXMax *
(1.0f - SmokeAnimation.Progress)),
SmokePosition.y),
col);
Renderer->SetBlendMode(RendererBlendMode::Normal);
}

void TitleMenu::ShowContinueItems() {
Expand Down
8 changes: 2 additions & 6 deletions src/profile/games/cc/titlemenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@ void Configure() {
CopyrightY = EnsureGetMember<float>("CopyrightY");
CopyrightXMoveOffset = EnsureGetMember<float>("CopyrightXMoveOffset");
SmokeOpacityNormal = EnsureGetMember<float>("SmokeOpacityNormal");
SmokeX = EnsureGetMember<float>("SmokeX");
SmokeY = EnsureGetMember<float>("SmokeY");
SmokeBoundsX = EnsureGetMember<float>("SmokeBoundsX");
SmokeBoundsY = EnsureGetMember<float>("SmokeBoundsY");
SmokeBoundsWidth = EnsureGetMember<float>("SmokeBoundsWidth");
SmokeBoundsHeight = EnsureGetMember<float>("SmokeBoundsHeight");
SmokePosition = EnsureGetMember<glm::vec2>("SmokePosition");
SmokeBounds = EnsureGetMember<RectF>("SmokeBounds");
SmokeAnimationBoundsXOffset =
EnsureGetMember<float>("SmokeAnimationBoundsXOffset");
SmokeAnimationBoundsXMax = EnsureGetMember<float>("SmokeAnimationBoundsXMax");
Expand Down
8 changes: 2 additions & 6 deletions src/profile/games/cc/titlemenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,8 @@ inline float CopyrightX;
inline float CopyrightY;
inline float CopyrightXMoveOffset;
inline float SmokeOpacityNormal;
inline float SmokeX;
inline float SmokeY;
inline float SmokeBoundsX;
inline float SmokeBoundsY;
inline float SmokeBoundsWidth;
inline float SmokeBoundsHeight;
inline glm::vec2 SmokePosition;
inline RectF SmokeBounds;
inline float SmokeAnimationBoundsXOffset;
inline float SmokeAnimationBoundsXMax;
inline float SmokeAnimationDurationIn;
Expand Down
11 changes: 11 additions & 0 deletions src/profile/games/cclcc/systemmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ void Configure() {
ItemsFadeInDuration = EnsureGetMember<float>("ItemsFadeInDuration");
ItemsFadeOutDuration = EnsureGetMember<float>("ItemsFadeOutDuration");

SmokeOpacityNormal = EnsureGetMember<float>("SmokeOpacityNormal");
SmokePosition = EnsureGetMember<glm::vec2>("SmokePosition");
SmokeBounds = EnsureGetMember<RectF>("SmokeBounds");
SmokeAnimationBoundsXOffset =
EnsureGetMember<float>("SmokeAnimationBoundsXOffset");
SmokeAnimationBoundsXMax = EnsureGetMember<float>("SmokeAnimationBoundsXMax");
SmokeAnimationDurationIn = EnsureGetMember<float>("SmokeAnimationDurationIn");
SmokeAnimationDurationOut =
EnsureGetMember<float>("SmokeAnimationDurationOut");

GetMemberArray<glm::vec2>(
std::span(MenuEntriesPositions, Profile::SystemMenu::MenuEntriesNum),
"MenuEntriesPositions");
Expand All @@ -29,6 +39,7 @@ void Configure() {
SystemMenuFrame = EnsureGetMember<Sprite>("SystemMenuFrame");
MenuButtonGuide = EnsureGetMember<Sprite>("MenuButtonGuide");
SystemMenuMask = EnsureGetMember<Sprite>("SystemMenuMask");
SmokeSprite = EnsureGetMember<Sprite>("SmokeSprite");

BGDispOffsetTopLeft = EnsureGetMember<glm::vec2>("BGDispOffsetTopLeft");
BGDispOffsetBottomLeft = EnsureGetMember<glm::vec2>("BGDispOffsetBottomLeft");
Expand Down
9 changes: 9 additions & 0 deletions src/profile/games/cclcc/systemmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ inline Sprite SystemMenuBG;
inline Sprite MenuButtonGuide;
inline Sprite SystemMenuFrame;
inline Sprite SystemMenuMask;
inline Sprite SmokeSprite;
inline float MoveInDuration;
inline float MoveOutDuration;
inline float ItemsFadeInDuration;
inline float ItemsFadeOutDuration;
inline glm::vec2 MenuEntriesPositions[MenuEntriesNumMax];
inline RectF MenuEntriesButtonBounds[MenuEntriesNumMax];

inline float SmokeOpacityNormal;
inline glm::vec2 SmokePosition;
inline RectF SmokeBounds;
inline float SmokeAnimationBoundsXOffset;
inline float SmokeAnimationBoundsXMax;
inline float SmokeAnimationDurationIn;
inline float SmokeAnimationDurationOut;

inline glm::vec2 BGDispOffsetTopLeft;
inline glm::vec2 BGDispOffsetBottomLeft;
inline glm::vec2 BGDispOffsetTopRight;
Expand Down
8 changes: 2 additions & 6 deletions src/profile/games/cclcc/titlemenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,8 @@ void Configure() {
CopyrightTextX = EnsureGetMember<float>("CopyrightTextX");
CopyrightTextY = EnsureGetMember<float>("CopyrightTextY");
SmokeOpacityNormal = EnsureGetMember<float>("SmokeOpacityNormal");
SmokeX = EnsureGetMember<float>("SmokeX");
SmokeY = EnsureGetMember<float>("SmokeY");
SmokeBoundsX = EnsureGetMember<float>("SmokeBoundsX");
SmokeBoundsY = EnsureGetMember<float>("SmokeBoundsY");
SmokeBoundsWidth = EnsureGetMember<float>("SmokeBoundsWidth");
SmokeBoundsHeight = EnsureGetMember<float>("SmokeBoundsHeight");
SmokePosition = EnsureGetMember<glm::vec2>("SmokePosition");
SmokeBounds = EnsureGetMember<RectF>("SmokeBounds");
SmokeAnimationBoundsXOffset =
EnsureGetMember<float>("SmokeAnimationBoundsXOffset");
SmokeAnimationBoundsXMax = EnsureGetMember<float>("SmokeAnimationBoundsXMax");
Expand Down
8 changes: 2 additions & 6 deletions src/profile/games/cclcc/titlemenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ inline float SecondaryFadeOutDuration;
inline float CopyrightTextX;
inline float CopyrightTextY;
inline float SmokeOpacityNormal;
inline float SmokeX;
inline float SmokeY;
inline float SmokeBoundsX;
inline float SmokeBoundsY;
inline float SmokeBoundsWidth;
inline float SmokeBoundsHeight;
inline glm::vec2 SmokePosition;
inline RectF SmokeBounds;
inline float SmokeAnimationBoundsXOffset;
inline float SmokeAnimationBoundsXMax;
inline float SmokeAnimationDurationIn;
Expand Down
Loading