diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp b/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp index 8719f28ce..edc86b660 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp @@ -17,7 +17,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type, bo } CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type, - TLockedToken& tex) + TLockedToken tex) : CTexturedQuadFilter(type, tex->GetBooTexture()) { m_tex = tex; diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp b/Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp index 53d232d89..5e14bce71 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp @@ -37,9 +37,10 @@ class CTexturedQuadFilter Uniform m_uniform; public: - CTexturedQuadFilter(CCameraFilterPass::EFilterType type, TLockedToken& tex); + CTexturedQuadFilter(CCameraFilterPass::EFilterType type, TLockedToken tex); CTexturedQuadFilter(CCameraFilterPass::EFilterType type, boo::ITexture* tex); void draw(const zeus::CColor& color, float uvScale); + const TLockedToken& GetTex() const { return m_tex; } using _CLS = CTexturedQuadFilter; #include "TMultiBlendShaderDecl.hpp" diff --git a/Runtime/GuiSys/CSplashScreen.cpp b/Runtime/GuiSys/CSplashScreen.cpp index e69de29bb..3b2b818d3 100644 --- a/Runtime/GuiSys/CSplashScreen.cpp +++ b/Runtime/GuiSys/CSplashScreen.cpp @@ -0,0 +1,71 @@ +#include "CSplashScreen.hpp" +#include "CArchitectureMessage.hpp" +#include "CArchitectureQueue.hpp" +#include "CSimplePool.hpp" +#include "GameGlobalObjects.hpp" + +namespace urde +{ + +static const char* SplashTextures[] +{ + "MP1/NoARAM/TXTR_NintendoLogo.png", + "MP1/NoARAM/TXTR_RetroLogo.png", + "MP1/NoARAM/TXTR_DolbyLogo.png" +}; + +CSplashScreen::CSplashScreen(ESplashScreen which) +: CIOWin("SplashScreen"), x14_which(which), + m_quad(CCameraFilterPass::EFilterType::Blend, + g_SimplePool->GetObj(SplashTextures[int(which)])) +{ +} + +CIOWin::EMessageReturn CSplashScreen::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) +{ + switch (msg.GetType()) + { + case EArchMsgType::TimerTick: + { + if (!x25_textureLoaded) + { + if (!m_quad.GetTex().IsLoaded()) + return EMessageReturn::Exit; + x25_textureLoaded = true; + } + + float dt = MakeMsg::GetParmTimerTick(msg).x4_parm; + x18_splashTimeout -= dt; + + if (x18_splashTimeout <= 0.f) + { + if (x14_which != ESplashScreen::Dolby) + queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 9999, 9999, + new CSplashScreen(ESplashScreen(int(x14_which) + 1)))); + return EMessageReturn::RemoveIOWinAndExit; + } + break; + } + default: break; + } + return EMessageReturn::Exit; +} + +void CSplashScreen::Draw() const +{ + if (!x25_textureLoaded) + return; + + zeus::CColor color; + if (x14_which == ESplashScreen::Nintendo) + color = zeus::CColor{0.86f, 0.f, 0.f, 1.f}; + + if (x18_splashTimeout > 1.5f) + color.a = 1.f - (x18_splashTimeout - 1.5f) * 2.f; + else if (x18_splashTimeout < 0.5f) + color.a = x18_splashTimeout * 2.f; + + const_cast(m_quad).draw(color, 1.f); +} + +} diff --git a/Runtime/GuiSys/CSplashScreen.hpp b/Runtime/GuiSys/CSplashScreen.hpp index 3cb122d82..87e1a5319 100644 --- a/Runtime/GuiSys/CSplashScreen.hpp +++ b/Runtime/GuiSys/CSplashScreen.hpp @@ -1,11 +1,41 @@ #ifndef __URDE_CSPLASHSCREEN_HPP__ #define __URDE_CSPLASHSCREEN_HPP__ +#include "CIOWin.hpp" +#include "CToken.hpp" +#include "Graphics/CTexture.hpp" +#include "Graphics/Shaders/CTexturedQuadFilter.hpp" + namespace urde { -class CSplashScreen +class CSplashScreen : public CIOWin { +public: + enum class ESplashScreen + { + Nintendo, + Retro, + Dolby + }; + enum class EProgressivePhase + { + Before, + During, + After + }; +private: + ESplashScreen x14_which; + float x18_splashTimeout = 2.f; + //float x1c_progSelectionTimeout = 0.f; + //EProgressivePhase x20_progressivePhase = EProgressivePhase::Before; + //bool x24_progressiveSelection = true; + bool x25_textureLoaded = false; + CTexturedQuadFilter m_quad; +public: + CSplashScreen(ESplashScreen); + EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&); + void Draw() const; }; } diff --git a/Runtime/MP1/MP1.hpp b/Runtime/MP1/MP1.hpp index 4904493af..b4a5eff83 100644 --- a/Runtime/MP1/MP1.hpp +++ b/Runtime/MP1/MP1.hpp @@ -111,7 +111,7 @@ class CGameArchitectureSupport CInputGenerator m_inputGenerator; CGuiSys m_guiSys; CIOWinManager m_ioWinManager; - CSplashScreen m_splashScreen; + //CSplashScreen m_splashScreen; CMainFlow m_mainFlow; CConsoleOutputWindow m_consoleWindow; CAudioStateWin m_audioStateWin;