2019-09-29 00:30:53 +00:00
|
|
|
#include "Runtime/GuiSys/CSplashScreen.hpp"
|
|
|
|
|
2022-02-25 07:45:25 +00:00
|
|
|
#include "CArchitectureMessage.hpp"
|
|
|
|
#include "CArchitectureQueue.hpp"
|
|
|
|
#include "CSimplePool.hpp"
|
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "Graphics/CCubeRenderer.hpp"
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2020-04-12 15:30:04 +00:00
|
|
|
constexpr std::array SplashTextures{"TXTR_NintendoLogo"sv, "TXTR_RetroLogo"sv, "TXTR_DolbyLogo"sv};
|
2016-09-13 05:36:21 +00:00
|
|
|
|
|
|
|
CSplashScreen::CSplashScreen(ESplashScreen which)
|
2022-02-25 07:45:25 +00:00
|
|
|
: CIOWin("SplashScreen"), x14_which(which), x28_texture(g_SimplePool->GetObj(SplashTextures[size_t(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) {
|
2022-02-25 07:45:25 +00:00
|
|
|
if (!x28_texture.IsLoaded())
|
2018-12-08 05:30:43 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2020-03-30 01:55:58 +00:00
|
|
|
void CSplashScreen::Draw() {
|
|
|
|
if (!x25_textureLoaded) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return;
|
2020-03-30 01:55:58 +00:00
|
|
|
}
|
2019-07-21 08:42:52 +00:00
|
|
|
SCOPED_GRAPHICS_DEBUG_GROUP("CSplashScreen::Draw", zeus::skGreen);
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2022-02-25 07:45:25 +00:00
|
|
|
zeus::CColor color = zeus::skWhite;
|
2020-03-30 01:55:58 +00:00
|
|
|
if (x14_which == ESplashScreen::Nintendo) {
|
2018-12-08 05:30:43 +00:00
|
|
|
color = zeus::CColor{0.86f, 0.f, 0.f, 1.f};
|
2020-03-30 01:55:58 +00:00
|
|
|
}
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2020-03-30 01:55:58 +00:00
|
|
|
if (x18_splashTimeout > 1.5f) {
|
2018-12-08 05:30:43 +00:00
|
|
|
color.a() = 1.f - (x18_splashTimeout - 1.5f) * 2.f;
|
2020-03-30 01:55:58 +00:00
|
|
|
} else if (x18_splashTimeout < 0.5f) {
|
2018-12-08 05:30:43 +00:00
|
|
|
color.a() = x18_splashTimeout * 2.f;
|
2020-03-30 01:55:58 +00:00
|
|
|
}
|
2016-09-13 05:36:21 +00:00
|
|
|
|
2022-02-25 07:45:25 +00:00
|
|
|
CGraphics::SetAlphaCompare(ERglAlphaFunc::Always, 0, ERglAlphaOp::And, ERglAlphaFunc::Always, 0);
|
|
|
|
g_Renderer->SetModelMatrix({});
|
|
|
|
CGraphics::SetViewPointMatrix({});
|
2022-03-04 07:47:21 +00:00
|
|
|
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
|
|
|
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
2022-02-25 07:45:25 +00:00
|
|
|
g_Renderer->SetBlendMode_AlphaBlended();
|
2022-03-04 07:47:21 +00:00
|
|
|
auto& tex = *x28_texture.GetObj();
|
2022-02-25 07:45:25 +00:00
|
|
|
const auto width = tex.GetWidth();
|
|
|
|
const auto height = tex.GetHeight();
|
2022-03-04 07:47:21 +00:00
|
|
|
tex.Load(GX::TEXMAP0, EClampMode::Clamp);
|
2022-02-25 07:45:25 +00:00
|
|
|
if (x14_which == ESplashScreen::Nintendo || x14_which == ESplashScreen::Retro) {
|
2022-03-04 07:47:21 +00:00
|
|
|
const auto x = static_cast<float>(133 - (width - 376) / 2);
|
|
|
|
const auto y = static_cast<float>(170 - (height - 104) / 2);
|
2022-02-25 07:45:25 +00:00
|
|
|
CGraphics::SetOrtho(-10.f, 650.f, -5.5f, 484.5f, -1.f, 1.f);
|
|
|
|
CGraphics::SetCullMode(ERglCullMode::None);
|
2022-03-04 07:47:21 +00:00
|
|
|
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
|
|
|
CGraphics::StreamColor(color);
|
|
|
|
CGraphics::StreamTexcoord(0.f, 0.f);
|
|
|
|
CGraphics::StreamVertex({x, 0.f, y + static_cast<float>(height)});
|
|
|
|
CGraphics::StreamTexcoord(0.f, 1.f);
|
|
|
|
CGraphics::StreamVertex({x, 0.f, y});
|
|
|
|
CGraphics::StreamTexcoord(1.f, 0.f);
|
|
|
|
CGraphics::StreamVertex({x + static_cast<float>(width), 0.f, y + static_cast<float>(height)});
|
|
|
|
CGraphics::StreamTexcoord(1.f, 1.f);
|
|
|
|
CGraphics::StreamVertex({x + static_cast<float>(width), 0.f, y});
|
|
|
|
CGraphics::StreamEnd();
|
2022-02-25 07:45:25 +00:00
|
|
|
CGraphics::SetCullMode(ERglCullMode::Front);
|
|
|
|
} else {
|
|
|
|
// TODO
|
|
|
|
// CGraphics::Render2D();
|
|
|
|
}
|
|
|
|
|
2022-03-04 07:47:21 +00:00
|
|
|
// zeus::CRectangle rect;
|
|
|
|
// rect.size.x() = width / (480.f * CGraphics::GetViewportAspect());
|
|
|
|
// rect.size.y() = height / 480.f;
|
|
|
|
// rect.position.x() = 0.5f - rect.size.x() / 2.f;
|
|
|
|
// rect.position.y() = 0.5f - rect.size.y() / 2.f;
|
|
|
|
// aurora::gfx::queue_textured_quad(aurora::gfx::CameraFilterType::Blend, tex.GetTexture(),
|
|
|
|
// aurora::gfx::ZComp::Always, false, color, 1.f, rect, 0.f);
|
2016-09-14 05:54:09 +00:00
|
|
|
|
2022-02-25 07:45:25 +00:00
|
|
|
// Progressive scan options omitted
|
2016-09-13 05:36:21 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|