2016-09-13 05:36:21 +00:00
|
|
|
#include "CSplashScreen.hpp"
|
|
|
|
#include "CArchitectureMessage.hpp"
|
|
|
|
#include "CArchitectureQueue.hpp"
|
|
|
|
#include "CSimplePool.hpp"
|
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
static const char* SplashTextures[]{"TXTR_NintendoLogo", "TXTR_RetroLogo", "TXTR_DolbyLogo"};
|
2016-09-13 05:36:21 +00:00
|
|
|
|
|
|
|
CSplashScreen::CSplashScreen(ESplashScreen which)
|
2018-12-08 05:30:43 +00:00
|
|
|
: CIOWin("SplashScreen")
|
|
|
|
, x14_which(which)
|
|
|
|
, m_quad(EFilterType::Blend, g_SimplePool->GetObj(SplashTextures[int(which)])) {}
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
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;
|
|
|
|
}
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
float dt = MakeMsg::GetParmTimerTick(msg).x4_parm;
|
|
|
|
x18_splashTimeout -= dt;
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x18_splashTimeout <= 0.f) {
|
|
|
|
/* HACK: If we're not compiling with Intel's IPP library we want to skip the Dolby Pro Logic II logo
|
|
|
|
* This is purely a URDE addition and does not reflect retro's intentions. - Phil
|
|
|
|
*/
|
2017-11-05 06:29:22 +00:00
|
|
|
#if INTEL_IPP
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x14_which != ESplashScreen::Dolby)
|
2017-11-05 06:29:22 +00:00
|
|
|
#else
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x14_which != ESplashScreen::Retro)
|
2017-11-05 06:29:22 +00:00
|
|
|
#endif
|
2018-12-08 05:30:43 +00:00
|
|
|
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 9999, 9999,
|
|
|
|
std::make_shared<CSplashScreen>(ESplashScreen(int(x14_which) + 1))));
|
|
|
|
return EMessageReturn::RemoveIOWinAndExit;
|
2016-09-13 05:36:21 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return EMessageReturn::Exit;
|
2016-09-13 05:36:21 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CSplashScreen::Draw() const {
|
|
|
|
if (!x25_textureLoaded)
|
|
|
|
return;
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CColor color;
|
|
|
|
if (x14_which == ESplashScreen::Nintendo)
|
|
|
|
color = zeus::CColor{0.86f, 0.f, 0.f, 1.f};
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
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;
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CRectangle rect;
|
2019-01-23 07:52:19 +00:00
|
|
|
rect.size.x() = m_quad.GetTex()->GetWidth() / (480.f * g_Viewport.aspect);
|
2018-12-08 05:30:43 +00:00
|
|
|
rect.size.y() = m_quad.GetTex()->GetHeight() / 480.f;
|
|
|
|
rect.position.x() = 0.5f - rect.size.x() / 2.f;
|
|
|
|
rect.position.y() = 0.5f - rect.size.y() / 2.f;
|
2016-09-14 05:54:09 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
const_cast<CTexturedQuadFilterAlpha&>(m_quad).draw(color, 1.f, rect);
|
2016-09-13 05:36:21 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|