metaforce/Runtime/MP1/CSplashScreen.cpp

68 lines
1.9 KiB
C++
Raw Normal View History

2016-03-10 07:13:50 +00:00
#include "CSplashScreen.hpp"
#include "Graphics/CGraphics.hpp"
#include "CSimplePool.hpp"
#include "CArchitectureQueue.hpp"
#include "CArchitectureMessage.hpp"
#include "zeus/CColor.hpp"
2021-04-10 08:42:06 +00:00
namespace metaforce {
2016-03-10 07:13:50 +00:00
extern CSimplePool* g_simplePool;
2018-12-08 05:30:43 +00:00
namespace MP1 {
static const char* SplashTextures[] = {"TXTR_NintendLogo", "TXTR_RetroLogo", "TXTR_DolbyLogo"};
2016-03-10 07:13:50 +00:00
2018-12-08 05:30:43 +00:00
CSplashScreen::CSplashScreen(ESplashScreen splash) : CIOWin("SplashScreen"), x14_splashScreen(splash) {
x28_texture = g_simplePool->GetObj(SplashTextures[(u32)splash]);
2016-03-10 07:13:50 +00:00
}
2018-12-08 05:30:43 +00:00
CIOWin::EMessageReturn CSplashScreen::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) {
if (msg.GetType() == EArchMsgType::UserInput && x25_) {
CFinalInput input = MakeMsg::GetParmUserInput(msg).x4_parm;
if (x20_phase == 1) {
if (input.x8_anaLeftX <= -0.7f || input.x2d_b26_DPLeft) {
x24_progressiveEnabled = true;
x1c_ = 10.f;
} else if (input.x8_anaLeftX >= 0.7f || input.x2d_b24_DPRight) {
x24_progressiveEnabled = false;
x1c_ = 10.f;
} else if (input.x2d_b28_PA || input.x2d_b27_Start) {
// CGraphics::SetProgressiveMode(x24_progressiveEnabled);
x1c_ = 5.f;
x20_phase = 2;
}
} else if (x20_phase == 2) {
if (input.x2d_b28_PA || input.x2e_b31_PStart)
x1c_ = 0.f;
2016-03-10 07:13:50 +00:00
}
2018-12-08 05:30:43 +00:00
} else if (msg.GetType() == EArchMsgType::TimerTick) {
if (!x25_) {
if (x28_texture)
x25_ = true;
} else {
2016-03-10 07:13:50 +00:00
}
2018-12-08 05:30:43 +00:00
}
2016-03-10 07:13:50 +00:00
2018-12-08 05:30:43 +00:00
return EMessageReturn::Exit;
2016-03-10 07:13:50 +00:00
}
2018-12-08 05:30:43 +00:00
void CSplashScreen::Draw() const {
zeus::CColor col;
if (x14_splashScreen == ESplashScreen::Nintendo)
col = zeus::CColor(0.86f, 0.f, 0.f);
2016-03-10 07:13:50 +00:00
2018-12-08 05:30:43 +00:00
float tmp = x18_;
if (tmp <= 1.5f) {
if (x18_ <= 0.5f)
tmp /= 0.5f;
2016-03-10 07:13:50 +00:00
else
2018-12-08 05:30:43 +00:00
tmp = 1.0f;
} else {
tmp -= 1.5f;
tmp = 1.0f - (tmp / 1.5f);
}
2016-03-10 07:13:50 +00:00
2018-12-08 05:30:43 +00:00
CGraphics::SetAlphaCompare(ERglAlphaFunc::Always, 0, ERglAlphaOp::And, ERglAlphaFunc::Always, 0);
2016-03-10 07:13:50 +00:00
}
2018-12-08 05:30:43 +00:00
} // namespace MP1
2021-04-10 08:42:06 +00:00
} // namespace metaforce