2016-09-16 20:18:03 +00:00
|
|
|
#include "CSlideShow.hpp"
|
2016-09-16 23:43:33 +00:00
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "Editor/ProjectManager.hpp"
|
2016-09-16 20:18:03 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
CSlideShow::CSlideShow()
|
2016-09-16 23:43:33 +00:00
|
|
|
: CIOWin("SlideShow"), x5c_slideA(*this), x90_slideB(*this)
|
2016-09-16 20:18:03 +00:00
|
|
|
{
|
2016-09-16 23:43:33 +00:00
|
|
|
x130_ = g_tweakSlideShow->GetX54();
|
|
|
|
x134_24_ = true;
|
|
|
|
x134_30_ = true;
|
|
|
|
x135_24_ = true;
|
|
|
|
|
2016-09-17 21:33:32 +00:00
|
|
|
const SObjectTag* font = g_ResFactory->GetResourceIdByName(g_tweakSlideShow->GetFont().c_str());
|
|
|
|
if (font)
|
|
|
|
{
|
|
|
|
CGuiTextProperties propsA(false, true, EJustification::Center, EVerticalJustification::Bottom);
|
|
|
|
xc4_textA = std::make_unique<CGuiTextSupport>(font->id, propsA,
|
|
|
|
g_tweakSlideShow->GetFontColor(),
|
|
|
|
g_tweakSlideShow->GetOutlineColor(),
|
|
|
|
zeus::CColor::skWhite, 640, 480, g_SimplePool);
|
|
|
|
|
|
|
|
CGuiTextProperties propsB(false, true, EJustification::Right, EVerticalJustification::Bottom);
|
|
|
|
xc8_textB = std::make_unique<CGuiTextSupport>(font->id, propsB,
|
|
|
|
g_tweakSlideShow->GetFontColor(),
|
|
|
|
g_tweakSlideShow->GetOutlineColor(),
|
|
|
|
zeus::CColor::skWhite, 640, 480, g_SimplePool);
|
|
|
|
}
|
2016-09-16 23:43:33 +00:00
|
|
|
|
2016-09-25 01:58:20 +00:00
|
|
|
xf8_stickTextures.reserve(18);
|
|
|
|
x108_buttonTextures.reserve(8);
|
|
|
|
SObjectTag txtrTag(FOURCC('TXTR'), 0);
|
|
|
|
for (int i=0 ; i<9 ; ++i)
|
|
|
|
{
|
|
|
|
txtrTag.id = g_tweakPlayerRes->x24_lStick[i];
|
|
|
|
xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
|
|
|
|
}
|
|
|
|
for (int i=0 ; i<9 ; ++i)
|
|
|
|
{
|
|
|
|
txtrTag.id = g_tweakPlayerRes->x4c_cStick[i];
|
|
|
|
xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
|
|
|
|
}
|
|
|
|
for (int i=0 ; i<2 ; ++i)
|
|
|
|
{
|
|
|
|
txtrTag.id = g_tweakPlayerRes->x74_lTrigger[i];
|
|
|
|
xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
|
|
|
|
}
|
|
|
|
for (int i=0 ; i<2 ; ++i)
|
|
|
|
{
|
|
|
|
txtrTag.id = g_tweakPlayerRes->x80_rTrigger[i];
|
|
|
|
xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
|
|
|
|
}
|
|
|
|
for (int i=0 ; i<2 ; ++i)
|
|
|
|
{
|
|
|
|
txtrTag.id = g_tweakPlayerRes->xa4_bButton[i];
|
|
|
|
xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
|
|
|
|
}
|
|
|
|
for (int i=0 ; i<2 ; ++i)
|
|
|
|
{
|
|
|
|
txtrTag.id = g_tweakPlayerRes->xbc_yButton[i];
|
|
|
|
xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSlideShow::LoadTXTRDep(const std::string& name)
|
|
|
|
{
|
|
|
|
const SObjectTag* dgrpTag = g_ResFactory->GetResourceIdByName(name.c_str());
|
|
|
|
if (dgrpTag && dgrpTag->type == FOURCC('DGRP'))
|
|
|
|
{
|
|
|
|
x18_galleryTXTRDeps.push_back(g_SimplePool->GetObj(*dgrpTag));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSlideShow::AreAllDepsLoaded(const std::vector<TLockedToken<CDependencyGroup>>& deps)
|
|
|
|
{
|
|
|
|
for (const TLockedToken<CDependencyGroup>& token : deps)
|
|
|
|
{
|
|
|
|
if (!token.IsLoaded())
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
2016-09-16 20:18:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CIOWin::EMessageReturn CSlideShow::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
|
|
|
{
|
2016-09-25 01:58:20 +00:00
|
|
|
switch (msg.GetType())
|
|
|
|
{
|
|
|
|
case EArchMsgType::TimerTick:
|
|
|
|
{
|
|
|
|
if (x134_29_)
|
|
|
|
return EMessageReturn::RemoveIOWinAndExit;
|
|
|
|
|
|
|
|
float dt = MakeMsg::GetParmTimerTick(msg).x4_parm;
|
|
|
|
|
|
|
|
switch (x14_phase)
|
|
|
|
{
|
|
|
|
case Phase::Zero:
|
|
|
|
{
|
|
|
|
//if (!g_resLoader->AreAllPaksLoaded())
|
|
|
|
//{
|
|
|
|
// g_resLoader->AsyncIdlePakLoading();
|
|
|
|
// return EMessageReturn::Exit;
|
|
|
|
//}
|
|
|
|
x14_phase = Phase::One;
|
|
|
|
}
|
|
|
|
case Phase::One:
|
|
|
|
{
|
|
|
|
if (x18_galleryTXTRDeps.empty())
|
|
|
|
{
|
|
|
|
x18_galleryTXTRDeps.reserve(5);
|
|
|
|
for (int i=1 ; true ; ++i)
|
|
|
|
{
|
|
|
|
std::string depResName = hecl::Format("Gallery%02d_DGRP", i);
|
|
|
|
if (!LoadTXTRDep(depResName))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
LoadTXTRDep("GalleryAssets_DGRP");
|
|
|
|
}
|
|
|
|
if (!AreAllDepsLoaded(x18_galleryTXTRDeps))
|
|
|
|
return EMessageReturn::Exit;
|
|
|
|
|
|
|
|
x14_phase = Phase::Three;
|
|
|
|
}
|
|
|
|
case Phase::Two:
|
|
|
|
case Phase::Three:
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
case Phase::Four:
|
|
|
|
case Phase::Five:
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EArchMsgType::UserInput:
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
2016-09-16 20:18:03 +00:00
|
|
|
return EMessageReturn::Exit;
|
|
|
|
}
|
|
|
|
|
2016-09-16 23:43:33 +00:00
|
|
|
void CSlideShow::SSlideData::Draw() const
|
|
|
|
{
|
|
|
|
if (!IsLoaded())
|
|
|
|
return;
|
|
|
|
|
|
|
|
zeus::CRectangle rect;
|
|
|
|
const_cast<CTexturedQuadFilterAlpha&>(*m_texQuad).draw(x30_mulColor, 1.f, rect);
|
|
|
|
|
|
|
|
zeus::CVector2f centeredOffset((x28_canvasSize.x - m_texQuad->GetTex()->GetWidth()) * 0.5f,
|
|
|
|
(x28_canvasSize.y - m_texQuad->GetTex()->GetHeight()) * 0.5f);
|
|
|
|
}
|
|
|
|
|
2016-09-16 20:18:03 +00:00
|
|
|
void CSlideShow::Draw() const
|
|
|
|
{
|
2016-09-16 23:43:33 +00:00
|
|
|
if (x14_phase == Phase::Five)
|
|
|
|
{
|
|
|
|
x5c_slideA.Draw();
|
|
|
|
x90_slideB.Draw();
|
|
|
|
}
|
2016-09-16 20:18:03 +00:00
|
|
|
}
|
|
|
|
|
2016-12-16 23:05:29 +00:00
|
|
|
u32 CSlideShow::SlideShowGalleryFlags()
|
|
|
|
{
|
|
|
|
u32 ret = 0;
|
|
|
|
if (!g_GameState)
|
|
|
|
return ret;
|
|
|
|
if (g_GameState->SystemOptions().GetLogScanCount() >= 50)
|
|
|
|
ret |= 1;
|
|
|
|
if (g_GameState->SystemOptions().GetLogScanCount() == 100)
|
|
|
|
ret |= 2;
|
2016-12-20 21:51:50 +00:00
|
|
|
if (g_GameState->SystemOptions().GetPlayerBeatHardMode())
|
2016-12-16 23:05:29 +00:00
|
|
|
ret |= 4;
|
2016-12-20 21:51:50 +00:00
|
|
|
if (g_GameState->SystemOptions().GetAllItemsCollected())
|
2016-12-16 23:05:29 +00:00
|
|
|
ret |= 8;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-09-16 20:18:03 +00:00
|
|
|
}
|