mirror of https://github.com/AxioDL/metaforce.git
Work on CPauseScreen
This commit is contained in:
parent
159b83b37a
commit
394cbf36e0
|
@ -68,6 +68,8 @@ public:
|
||||||
VisorDown,
|
VisorDown,
|
||||||
UseSheild=0x3B,
|
UseSheild=0x3B,
|
||||||
ScanItem=0x3C,
|
ScanItem=0x3C,
|
||||||
|
PreviousPauseScreen=0x41,
|
||||||
|
NextPauseScreen=0x42,
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
None,
|
None,
|
||||||
MAX
|
MAX
|
||||||
|
|
|
@ -179,9 +179,10 @@ void CInGameGuiManager::DoStateTransition(CStateManager& stateMgr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int w1 = x1c0_nextState == EInGameGuiState::PauseLogBook ? 0 : 2;
|
CPauseScreen::ESubScreen screen = x1c0_nextState == EInGameGuiState::PauseLogBook ?
|
||||||
|
CPauseScreen::ESubScreen::LogBook : CPauseScreen::ESubScreen::Inventory;
|
||||||
CDependencyGroup* suitGrp = x5c_pauseScreenDGRPs[suitResIdx].GetObj();
|
CDependencyGroup* suitGrp = x5c_pauseScreenDGRPs[suitResIdx].GetObj();
|
||||||
x48_pauseScreen = std::make_unique<CPauseScreen>(w1, *suitGrp, *suitGrp);
|
x48_pauseScreen = std::make_unique<CPauseScreen>(screen, *suitGrp, *suitGrp);
|
||||||
}
|
}
|
||||||
|
|
||||||
case EInGameGuiState::MapScreen:
|
case EInGameGuiState::MapScreen:
|
||||||
|
|
|
@ -1,48 +1,30 @@
|
||||||
#include "CInventoryScreen.hpp"
|
#include "CInventoryScreen.hpp"
|
||||||
#include "GameGlobalObjects.hpp"
|
|
||||||
#include "CSimplePool.hpp"
|
|
||||||
#include "Audio/CSfxManager.hpp"
|
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
namespace MP1
|
namespace MP1
|
||||||
{
|
{
|
||||||
|
|
||||||
CInventoryScreen::CInventoryScreen(const CStateManager& mgr, const CGuiFrame& frame, const CStringTable& pauseStrg,
|
CInventoryScreen::CInventoryScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg,
|
||||||
const CDependencyGroup& suitDgrp, const CDependencyGroup& ballDgrp)
|
const CDependencyGroup& suitDgrp, const CDependencyGroup& ballDgrp)
|
||||||
: CPauseScreenBase(mgr, frame, pauseStrg)
|
: CPauseScreenBase(mgr, frame, pauseStrg)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CPauseScreen::CPauseScreen(u32 w1,
|
bool CInventoryScreen::VReady() const
|
||||||
const CDependencyGroup& suitDgrp,
|
|
||||||
const CDependencyGroup& ballDgrp)
|
|
||||||
: x0_w1(w1), x14_strgPauseScreen(g_SimplePool->GetObj("STRG_PauseScreen")),
|
|
||||||
x20_suitDgrp(suitDgrp), x24_ballDgrp(ballDgrp),
|
|
||||||
x28_pauseScreenInstructions(g_SimplePool->GetObj("FRME_PauseScreenInstructions")),
|
|
||||||
x54_frmePauseScreenId(g_ResFactory->GetResourceIdByName("FRME_PauseScreen")->id)
|
|
||||||
{
|
{
|
||||||
SObjectTag frmeTag(FOURCC('FRME'), x54_frmePauseScreenId);
|
return true;
|
||||||
x58_frmePauseScreenBufSz = g_ResFactory->ResourceSize(frmeTag);
|
|
||||||
ProjectResourceFactoryBase& resFac = static_cast<ProjectResourceFactoryBase&>(*g_ResFactory);
|
|
||||||
x60_loadTok = resFac.LoadResourceAsync(frmeTag, x5c_frmePauseScreenBuf);
|
|
||||||
CSfxManager::SfxStart(1435, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinalInput& input)
|
void CInventoryScreen::VActivate() const
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPauseScreen::Update(float dt, CRandom16& rand, const CStateManager& mgr)
|
u32 CInventoryScreen::GetRightTableCount() const
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
void CPauseScreen::PreDraw()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,12 @@ class CInventoryScreen : public CPauseScreenBase
|
||||||
{
|
{
|
||||||
std::unique_ptr<CSamusDoll> x19c_samusDoll;
|
std::unique_ptr<CSamusDoll> x19c_samusDoll;
|
||||||
public:
|
public:
|
||||||
CInventoryScreen(const CStateManager& mgr, const CGuiFrame& frame, const CStringTable& pauseStrg,
|
CInventoryScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg,
|
||||||
const CDependencyGroup& suitDgrp, const CDependencyGroup& ballDgrp);
|
const CDependencyGroup& suitDgrp, const CDependencyGroup& ballDgrp);
|
||||||
|
|
||||||
|
bool VReady() const;
|
||||||
|
void VActivate() const;
|
||||||
|
u32 GetRightTableCount() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#include "CLogBookScreen.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
namespace MP1
|
||||||
|
{
|
||||||
|
|
||||||
|
CLogBookScreen::CLogBookScreen(const CStateManager& mgr, CGuiFrame& frame,
|
||||||
|
const CStringTable& pauseStrg)
|
||||||
|
: CPauseScreenBase(mgr, frame, pauseStrg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLogBookScreen::VReady() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLogBookScreen::VActivate() const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CLogBookScreen::GetRightTableCount() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef __URDE_CLOGBOOKSCREEN_HPP__
|
||||||
|
#define __URDE_CLOGBOOKSCREEN_HPP__
|
||||||
|
|
||||||
|
#include "CInGameGuiManager.hpp"
|
||||||
|
#include "CPauseScreenBase.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
namespace MP1
|
||||||
|
{
|
||||||
|
|
||||||
|
class CLogBookScreen : public CPauseScreenBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLogBookScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg);
|
||||||
|
|
||||||
|
bool VReady() const;
|
||||||
|
void VActivate() const;
|
||||||
|
u32 GetRightTableCount() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CLOGBOOKSCREEN_HPP__
|
|
@ -0,0 +1,31 @@
|
||||||
|
#include "COptionsScreen.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
namespace MP1
|
||||||
|
{
|
||||||
|
|
||||||
|
COptionsScreen::COptionsScreen(const CStateManager& mgr, CGuiFrame& frame,
|
||||||
|
const CStringTable& pauseStrg)
|
||||||
|
: CPauseScreenBase(mgr, frame, pauseStrg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool COptionsScreen::VReady() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void COptionsScreen::VActivate() const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 COptionsScreen::GetRightTableCount() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef __URDE_COPTIONSSCREEN_HPP__
|
||||||
|
#define __URDE_COPTIONSSCREEN_HPP__
|
||||||
|
|
||||||
|
#include "CInGameGuiManager.hpp"
|
||||||
|
#include "CPauseScreenBase.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
namespace MP1
|
||||||
|
{
|
||||||
|
|
||||||
|
class COptionsScreen : public CPauseScreenBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COptionsScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg);
|
||||||
|
|
||||||
|
bool VReady() const;
|
||||||
|
void VActivate() const;
|
||||||
|
u32 GetRightTableCount() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_COPTIONSSCREEN_HPP__
|
|
@ -1,23 +1,293 @@
|
||||||
#include "CPauseScreenBlur.hpp"
|
#include "CPauseScreen.hpp"
|
||||||
|
#include "GameGlobalObjects.hpp"
|
||||||
|
#include "CSimplePool.hpp"
|
||||||
|
#include "Audio/CSfxManager.hpp"
|
||||||
|
#include "CLogBookScreen.hpp"
|
||||||
|
#include "COptionsScreen.hpp"
|
||||||
|
#include "GuiSys/CGuiSys.hpp"
|
||||||
|
#include "GuiSys/CGuiTextPane.hpp"
|
||||||
|
#include "GuiSys/CGuiWidgetDrawParms.hpp"
|
||||||
|
#include "Input/ControlMapper.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
namespace MP1
|
namespace MP1
|
||||||
{
|
{
|
||||||
|
|
||||||
CPauseScreenBlur::CPauseScreenBlur()
|
CPauseScreen::CPauseScreen(ESubScreen subscreen,
|
||||||
|
const CDependencyGroup& suitDgrp,
|
||||||
|
const CDependencyGroup& ballDgrp)
|
||||||
|
: x0_initialSubScreen(subscreen),
|
||||||
|
x14_strgPauseScreen(g_SimplePool->GetObj("STRG_PauseScreen")),
|
||||||
|
x20_suitDgrp(suitDgrp), x24_ballDgrp(ballDgrp),
|
||||||
|
x28_pauseScreenInstructions(g_SimplePool->GetObj("FRME_PauseScreenInstructions")),
|
||||||
|
x54_frmePauseScreenId(g_ResFactory->GetResourceIdByName("FRME_PauseScreen")->id)
|
||||||
{
|
{
|
||||||
|
SObjectTag frmeTag(FOURCC('FRME'), x54_frmePauseScreenId);
|
||||||
|
x58_frmePauseScreenBufSz = g_ResFactory->ResourceSize(frmeTag);
|
||||||
|
ProjectResourceFactoryBase& resFac = static_cast<ProjectResourceFactoryBase&>(*g_ResFactory);
|
||||||
|
x60_loadTok = resFac.LoadResourceAsync(frmeTag, x5c_frmePauseScreenBuf);
|
||||||
|
CSfxManager::SfxStart(1435, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPauseScreenBlur::CheckLoadComplete()
|
std::unique_ptr<CPauseScreenBase> CPauseScreen::BuildPauseSubScreen(ESubScreen subscreen,
|
||||||
|
const CStateManager& mgr,
|
||||||
|
CGuiFrame& frame) const
|
||||||
{
|
{
|
||||||
return false;
|
switch (subscreen)
|
||||||
|
{
|
||||||
|
case ESubScreen::LogBook:
|
||||||
|
return std::make_unique<CLogBookScreen>(mgr, frame, *x14_strgPauseScreen);
|
||||||
|
case ESubScreen::Options:
|
||||||
|
return std::make_unique<COptionsScreen>(mgr, frame, *x14_strgPauseScreen);
|
||||||
|
case ESubScreen::Inventory:
|
||||||
|
return std::make_unique<CInventoryScreen>(mgr, frame, *x14_strgPauseScreen, x20_suitDgrp, x24_ballDgrp);
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPauseScreenBlur::OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateMgr)
|
void CPauseScreen::InitializeFrameGlue()
|
||||||
{
|
{
|
||||||
|
x38_textpane_l1 = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_l1"));
|
||||||
|
x3c_textpane_r = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_r"));
|
||||||
|
x40_textpane_a = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_a"));
|
||||||
|
x44_textpane_b = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_b"));
|
||||||
|
x48_textpane_return = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_return"));
|
||||||
|
x4c_textpane_next = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_next"));
|
||||||
|
x50_textpane_back = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_back"));
|
||||||
|
|
||||||
|
x40_textpane_a->TextSupport()->SetText(x14_strgPauseScreen->GetString(7)); // OPTIONS
|
||||||
|
x40_textpane_a->TextSupport()->SetFontColor(g_tweakGuiColors->GetPauseItemAmberColor());
|
||||||
|
x44_textpane_b->TextSupport()->SetText(x14_strgPauseScreen->GetString(6)); // LOG BOOK
|
||||||
|
x44_textpane_b->TextSupport()->SetFontColor(g_tweakGuiColors->GetPauseItemAmberColor());
|
||||||
|
x40_textpane_a->SetColor(zeus::CColor::skClear);
|
||||||
|
x44_textpane_b->SetColor(zeus::CColor::skClear);
|
||||||
|
|
||||||
|
if (CGuiWidget* deco = x34_loadedPauseScreenInstructions->FindWidget("basewidget_deco"))
|
||||||
|
{
|
||||||
|
zeus::CColor color = g_tweakGuiColors->GetPauseItemAmberColor();
|
||||||
|
color.a *= 0.75f;
|
||||||
|
deco->SetColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPauseScreen::CheckLoadComplete(const CStateManager& mgr)
|
||||||
|
{
|
||||||
|
if (x90_resourcesLoaded)
|
||||||
|
return true;
|
||||||
|
if (!x14_strgPauseScreen.IsLoaded())
|
||||||
|
return false;
|
||||||
|
if (!x34_loadedPauseScreenInstructions)
|
||||||
|
{
|
||||||
|
if (!x28_pauseScreenInstructions.IsLoaded())
|
||||||
|
return false;
|
||||||
|
if (!x28_pauseScreenInstructions->GetIsFinishedLoading())
|
||||||
|
return false;
|
||||||
|
x34_loadedPauseScreenInstructions = x28_pauseScreenInstructions.GetObj();
|
||||||
|
InitializeFrameGlue();
|
||||||
|
}
|
||||||
|
if (x60_loadTok)
|
||||||
|
{
|
||||||
|
if (!x60_loadTok->m_complete)
|
||||||
|
return false;
|
||||||
|
for (int i=0 ; i<2 ; ++i)
|
||||||
|
{
|
||||||
|
CMemoryInStream s(x5c_frmePauseScreenBuf.get(), x58_frmePauseScreenBufSz);
|
||||||
|
x64_frameInsts.push_back(CGuiFrame::CreateFrame(x54_frmePauseScreenId, *g_GuiSys, s, g_SimplePool));
|
||||||
|
}
|
||||||
|
x5c_frmePauseScreenBuf.reset();
|
||||||
|
x60_loadTok.reset();
|
||||||
|
}
|
||||||
|
if (!x64_frameInsts[0]->GetIsFinishedLoading() || !x64_frameInsts[1]->GetIsFinishedLoading())
|
||||||
|
return false;
|
||||||
|
x90_resourcesLoaded = true;
|
||||||
|
StartTransition(FLT_EPSILON, mgr, x0_initialSubScreen, 2);
|
||||||
|
x91_initialTransition = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreen::StartTransition(float time, const CStateManager& mgr, ESubScreen subscreen, int b)
|
||||||
|
{
|
||||||
|
if (subscreen == xc_nextSubscreen)
|
||||||
|
return;
|
||||||
|
xc_nextSubscreen = subscreen;
|
||||||
|
x4_ = b;
|
||||||
|
std::unique_ptr<CPauseScreenBase>& newScreenSlot = x7c_screens[x78_activeIdx];
|
||||||
|
std::unique_ptr<CGuiFrame>& newScreenInst = x64_frameInsts[x78_activeIdx];
|
||||||
|
newScreenSlot = BuildPauseSubScreen(xc_nextSubscreen, mgr, *newScreenInst);
|
||||||
|
x7c_screens[1 - x78_activeIdx]->TransitioningAway();
|
||||||
|
x91_initialTransition = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPauseScreen::InputEnabled() const
|
||||||
|
{
|
||||||
|
if (xc_nextSubscreen != x8_curSubscreen)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (const std::unique_ptr<CPauseScreenBase>& screenSlot = x7c_screens[x78_activeIdx])
|
||||||
|
if (screenSlot->InputDisabled())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (const std::unique_ptr<CPauseScreenBase>& screenSlot = x7c_screens[1 - x78_activeIdx])
|
||||||
|
if (screenSlot->InputDisabled())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPauseScreen::ESubScreen CPauseScreen::GetPreviousSubscreen(ESubScreen screen)
|
||||||
|
{
|
||||||
|
switch (screen)
|
||||||
|
{
|
||||||
|
case ESubScreen::Inventory:
|
||||||
|
return ESubScreen::Options;
|
||||||
|
case ESubScreen::Options:
|
||||||
|
return ESubScreen::LogBook;
|
||||||
|
case ESubScreen::LogBook:
|
||||||
|
return ESubScreen::Inventory;
|
||||||
|
default:
|
||||||
|
return ESubScreen::Invalid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CPauseScreen::ESubScreen CPauseScreen::GetNextSubscreen(ESubScreen screen)
|
||||||
|
{
|
||||||
|
switch (screen)
|
||||||
|
{
|
||||||
|
case ESubScreen::Inventory:
|
||||||
|
return ESubScreen::LogBook;
|
||||||
|
case ESubScreen::Options:
|
||||||
|
return ESubScreen::Inventory;
|
||||||
|
case ESubScreen::LogBook:
|
||||||
|
return ESubScreen::Options;
|
||||||
|
default:
|
||||||
|
return ESubScreen::Invalid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinalInput& input)
|
||||||
|
{
|
||||||
|
if (!IsLoaded())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (x8_curSubscreen == ESubScreen::Invalid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool bExits = false;
|
||||||
|
if (std::unique_ptr<CPauseScreenBase>& curScreen = x7c_screens[x78_activeIdx])
|
||||||
|
{
|
||||||
|
if (curScreen->GetMode() == CPauseScreenBase::EMode::Zero)
|
||||||
|
bExits = true;
|
||||||
|
curScreen->ProcessControllerInput(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (InputEnabled())
|
||||||
|
{
|
||||||
|
bool invalid = x8_curSubscreen == ESubScreen::Invalid;
|
||||||
|
if (input.PStart() || (input.PB() && bExits) ||
|
||||||
|
(x7c_screens[x78_activeIdx] && x7c_screens[x78_activeIdx]->ShouldExitPauseScreen()))
|
||||||
|
{
|
||||||
|
CSfxManager::SfxStart(1434, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||||
|
StartTransition(0.5f, mgr, ESubScreen::Invalid, 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ControlMapper::GetPressInput(ControlMapper::ECommands::PreviousPauseScreen, input))
|
||||||
|
{
|
||||||
|
CSfxManager::SfxStart(1433, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||||
|
StartTransition(0.5f, mgr, GetPreviousSubscreen(x8_curSubscreen), invalid ? 2 : 0);
|
||||||
|
}
|
||||||
|
else if (ControlMapper::GetPressInput(ControlMapper::ECommands::NextPauseScreen, input))
|
||||||
|
{
|
||||||
|
CSfxManager::SfxStart(1433, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||||
|
StartTransition(0.5f, mgr, GetNextSubscreen(x8_curSubscreen), invalid ? 2 : 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
x38_textpane_l1->TextSupport()->SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[input.DLTrigger()])));
|
||||||
|
x3c_textpane_r->TextSupport()->SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[input.DRTrigger()])));
|
||||||
|
x48_textpane_return->TextSupport()->SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x8c_startButton[input.DStart()])));
|
||||||
|
x50_textpane_back->TextSupport()->SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x98_aButton[input.DA()])));
|
||||||
|
x4c_textpane_next->TextSupport()->SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->xa4_bButton[input.DB()])));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreen::TransitionComplete()
|
||||||
|
{
|
||||||
|
std::unique_ptr<CPauseScreenBase>& curScreen = x7c_screens[x78_activeIdx];
|
||||||
|
curScreen.reset();
|
||||||
|
x78_activeIdx = 1 - x78_activeIdx;
|
||||||
|
x8_curSubscreen = xc_nextSubscreen;
|
||||||
|
x40_textpane_a->TextSupport()->SetText(x14_strgPauseScreen->GetString(int(GetPreviousSubscreen(x8_curSubscreen)) + 6));
|
||||||
|
x44_textpane_b->TextSupport()->SetText(x14_strgPauseScreen->GetString(int(GetNextSubscreen(x8_curSubscreen)) + 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreen::Update(float dt, const CStateManager& mgr, CRandom16& rand, CArchitectureQueue& archQueue)
|
||||||
|
{
|
||||||
|
if (!CheckLoadComplete(mgr))
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::unique_ptr<CPauseScreenBase>& curScreen = x7c_screens[x78_activeIdx];
|
||||||
|
std::unique_ptr<CPauseScreenBase>& otherScreen = x7c_screens[1 - x78_activeIdx];
|
||||||
|
|
||||||
|
if (x8_curSubscreen != xc_nextSubscreen)
|
||||||
|
{
|
||||||
|
x10_interp = std::max(0.f, x10_interp - dt);
|
||||||
|
if (!curScreen || !curScreen->InputDisabled())
|
||||||
|
{
|
||||||
|
if (!otherScreen || otherScreen->IsReady())
|
||||||
|
{
|
||||||
|
if (x10_interp == 0.f)
|
||||||
|
TransitionComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::unique_ptr<CPauseScreenBase>& curScreen = x7c_screens[x78_activeIdx])
|
||||||
|
{
|
||||||
|
curScreen->Update(dt, rand, archQueue);
|
||||||
|
zeus::CColor color = zeus::CColor::skWhite;
|
||||||
|
color.a = std::min(curScreen->GetAlpha(), x8_curSubscreen != xc_nextSubscreen ? x10_interp / 0.5f : 1.f);
|
||||||
|
x40_textpane_a->SetColor(color);
|
||||||
|
x44_textpane_b->SetColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreen::PreDraw()
|
||||||
|
{
|
||||||
|
if (!IsLoaded())
|
||||||
|
return;
|
||||||
|
if (std::unique_ptr<CPauseScreenBase>& curScreen = x7c_screens[x78_activeIdx])
|
||||||
|
if (curScreen->CanDraw())
|
||||||
|
curScreen->Touch();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreen::Draw()
|
||||||
|
{
|
||||||
|
if (!IsLoaded())
|
||||||
|
return;
|
||||||
|
|
||||||
|
float totalAlpha = 0.f;
|
||||||
|
float yOff = 0.f;
|
||||||
|
std::unique_ptr<CPauseScreenBase>& curScreen = x7c_screens[x78_activeIdx];
|
||||||
|
if (curScreen && curScreen->CanDraw())
|
||||||
|
{
|
||||||
|
float useInterp = x10_interp == 0.f ? 1.f : x10_interp / 0.5f;
|
||||||
|
float initInterp = std::min(curScreen->GetAlpha(), useInterp);
|
||||||
|
if (xc_nextSubscreen == ESubScreen::Invalid)
|
||||||
|
totalAlpha = useInterp;
|
||||||
|
else if (x91_initialTransition)
|
||||||
|
totalAlpha = initInterp;
|
||||||
|
else
|
||||||
|
totalAlpha = 1.f;
|
||||||
|
|
||||||
|
curScreen->Draw(x8_curSubscreen != xc_nextSubscreen ? useInterp : 1.f, totalAlpha, 0.f);
|
||||||
|
yOff = curScreen->GetCameraYBias();
|
||||||
|
}
|
||||||
|
|
||||||
|
CGuiWidgetDrawParms parms(totalAlpha, zeus::CVector3f{0.f, 15.f * yOff, 0.f});
|
||||||
|
x34_loadedPauseScreenInstructions->Draw(parms);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 x0_w1;
|
ESubScreen x0_initialSubScreen;
|
||||||
u32 x4_ = 2;
|
u32 x4_ = 2;
|
||||||
ESubScreen x8_ = ESubScreen::Invalid;
|
ESubScreen x8_curSubscreen = ESubScreen::Invalid;
|
||||||
ESubScreen xc_ = ESubScreen::Invalid;
|
ESubScreen xc_nextSubscreen = ESubScreen::Invalid;
|
||||||
float x10_ = 0.f;
|
float x10_interp = 0.f;
|
||||||
TLockedToken<CStringTable> x14_strgPauseScreen;
|
TLockedToken<CStringTable> x14_strgPauseScreen;
|
||||||
const CDependencyGroup& x20_suitDgrp;
|
const CDependencyGroup& x20_suitDgrp;
|
||||||
const CDependencyGroup& x24_ballDgrp;
|
const CDependencyGroup& x24_ballDgrp;
|
||||||
|
@ -37,6 +37,7 @@ private:
|
||||||
CGuiTextPane* x38_textpane_l1 = nullptr;
|
CGuiTextPane* x38_textpane_l1 = nullptr;
|
||||||
CGuiTextPane* x3c_textpane_r = nullptr;
|
CGuiTextPane* x3c_textpane_r = nullptr;
|
||||||
CGuiTextPane* x40_textpane_a = nullptr;
|
CGuiTextPane* x40_textpane_a = nullptr;
|
||||||
|
CGuiTextPane* x44_textpane_b = nullptr;
|
||||||
CGuiTextPane* x48_textpane_return = nullptr;
|
CGuiTextPane* x48_textpane_return = nullptr;
|
||||||
CGuiTextPane* x4c_textpane_next = nullptr;
|
CGuiTextPane* x4c_textpane_next = nullptr;
|
||||||
CGuiTextPane* x50_textpane_back = nullptr;
|
CGuiTextPane* x50_textpane_back = nullptr;
|
||||||
|
@ -44,17 +45,29 @@ private:
|
||||||
u32 x58_frmePauseScreenBufSz;
|
u32 x58_frmePauseScreenBufSz;
|
||||||
std::unique_ptr<u8[]> x5c_frmePauseScreenBuf;
|
std::unique_ptr<u8[]> x5c_frmePauseScreenBuf;
|
||||||
std::shared_ptr<ProjectResourceFactoryBase::AsyncTask> x60_loadTok;
|
std::shared_ptr<ProjectResourceFactoryBase::AsyncTask> x60_loadTok;
|
||||||
rstl::reserved_vector<std::unique_ptr<CGuiFrame>, 2> x64_frames;
|
rstl::reserved_vector<std::unique_ptr<CGuiFrame>, 2> x64_frameInsts;
|
||||||
u32 x78_activeIdx = 0;
|
u32 x78_activeIdx = 0;
|
||||||
rstl::reserved_vector<std::unique_ptr<CPauseScreenBase>, 2> x7c_screens;
|
rstl::reserved_vector<std::unique_ptr<CPauseScreenBase>, 2> x7c_screens;
|
||||||
bool x90_resourcesLoaded = false;
|
bool x90_resourcesLoaded = false;
|
||||||
bool x91_inPauseScreen = true;
|
bool x91_initialTransition = true;
|
||||||
|
|
||||||
|
std::unique_ptr<CPauseScreenBase> BuildPauseSubScreen(ESubScreen subscreen,
|
||||||
|
const CStateManager& mgr,
|
||||||
|
CGuiFrame& frame) const;
|
||||||
|
void StartTransition(float time, const CStateManager& mgr, ESubScreen subscreen, int);
|
||||||
|
bool CheckLoadComplete(const CStateManager& mgr);
|
||||||
|
void InitializeFrameGlue();
|
||||||
|
bool InputEnabled() const;
|
||||||
|
static ESubScreen GetPreviousSubscreen(ESubScreen screen);
|
||||||
|
static ESubScreen GetNextSubscreen(ESubScreen screen);
|
||||||
|
void TransitionComplete();
|
||||||
public:
|
public:
|
||||||
CPauseScreen(u32 w1, const CDependencyGroup& suitDgrp, const CDependencyGroup& ballDgrp);
|
CPauseScreen(ESubScreen subscreen, const CDependencyGroup& suitDgrp, const CDependencyGroup& ballDgrp);
|
||||||
void ProcessControllerInput(const CStateManager& mgr, const CFinalInput& input);
|
void ProcessControllerInput(const CStateManager& mgr, const CFinalInput& input);
|
||||||
void Update(float dt, CRandom16& rand, const CStateManager& mgr);
|
void Update(float dt, const CStateManager& mgr, CRandom16& rand, CArchitectureQueue& archQueue);
|
||||||
void PreDraw();
|
void PreDraw();
|
||||||
|
void Draw();
|
||||||
|
bool IsLoaded() const { return x90_resourcesLoaded; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "GuiSys/CGuiModel.hpp"
|
#include "GuiSys/CGuiModel.hpp"
|
||||||
#include "GuiSys/CGuiTextPane.hpp"
|
#include "GuiSys/CGuiTextPane.hpp"
|
||||||
#include "GuiSys/CAuiImagePane.hpp"
|
#include "GuiSys/CAuiImagePane.hpp"
|
||||||
|
#include "GuiSys/CGuiWidgetDrawParms.hpp"
|
||||||
#include "GameGlobalObjects.hpp"
|
#include "GameGlobalObjects.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
|
@ -12,7 +13,7 @@ namespace urde
|
||||||
namespace MP1
|
namespace MP1
|
||||||
{
|
{
|
||||||
|
|
||||||
CPauseScreenBase::CPauseScreenBase(const CStateManager& mgr, const CGuiFrame& frame, const CStringTable& pauseStrg)
|
CPauseScreenBase::CPauseScreenBase(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg)
|
||||||
: x4_mgr(mgr), x8_frame(frame), xc_pauseStrg(pauseStrg)
|
: x4_mgr(mgr), x8_frame(frame), xc_pauseStrg(pauseStrg)
|
||||||
{
|
{
|
||||||
InitializeFrameGlue();
|
InitializeFrameGlue();
|
||||||
|
@ -69,6 +70,87 @@ void CPauseScreenBase::InitializeFrameGlue()
|
||||||
x6c_basewidget_leftlog->SetColor(g_tweakGuiColors->GetPauseItemAmberColor());
|
x6c_basewidget_leftlog->SetColor(g_tweakGuiColors->GetPauseItemAmberColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CPauseScreenBase::IsReady()
|
||||||
|
{
|
||||||
|
if (x198_24_ready)
|
||||||
|
return true;
|
||||||
|
x198_24_ready = VReady();
|
||||||
|
if (x198_24_ready)
|
||||||
|
{
|
||||||
|
VActivate();
|
||||||
|
Activate(EMode::Zero);
|
||||||
|
UpdateSideTable(x70_tablegroup_leftlog);
|
||||||
|
UpdateRightTable();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreenBase::Activate(EMode mode)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreenBase::UpdateSideTable(CGuiTableGroup* table)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreenBase::Update(float dt, CRandom16& rand, CArchitectureQueue& archQueue)
|
||||||
|
{
|
||||||
|
x198_27_canDraw = true;
|
||||||
|
x8_frame.Update(dt);
|
||||||
|
x14_alpha = std::min(2.f * dt + x14_alpha, 1.f);
|
||||||
|
|
||||||
|
u32 rightCount = GetRightTableCount();
|
||||||
|
bool pulseRightUp = x10_mode == EMode::One && x18_ > 0;
|
||||||
|
bool pulseRightDown = x10_mode == EMode::One && x18_ + 5 < rightCount;
|
||||||
|
float rightUpT = pulseRightUp ? CGraphics::GetSecondsMod900() : 0.f;
|
||||||
|
float rightDownT = pulseRightDown ? CGraphics::GetSecondsMod900() : 0.f;
|
||||||
|
|
||||||
|
zeus::CColor lowC = g_tweakGuiColors->GetPauseItemAmberColor();
|
||||||
|
lowC.a = 0.2f;
|
||||||
|
xa0_model_scrollrightup->SetColor(
|
||||||
|
zeus::CColor::lerp(lowC, g_tweakGuiColors->GetPauseItemAmberColor(),
|
||||||
|
zeus::clamp(0.f, (std::sin(5.f * rightUpT - M_PIF / 2.f) + 1.f) * 0.5f, 1.f)));
|
||||||
|
xa4_model_scrollrightdown->SetColor(
|
||||||
|
zeus::CColor::lerp(lowC, g_tweakGuiColors->GetPauseItemAmberColor(),
|
||||||
|
zeus::clamp(0.f, (std::sin(5.f * rightDownT - M_PIF / 2.f) + 1.f) * 0.5f, 1.f)));
|
||||||
|
|
||||||
|
float textUpT = x198_28_pulseTextArrowTop ? CGraphics::GetSecondsMod900() : 0.f;
|
||||||
|
float textDownT = x198_29_pulseTextArrowBottom ? CGraphics::GetSecondsMod900() : 0.f;
|
||||||
|
|
||||||
|
x90_model_textarrowtop->SetColor(
|
||||||
|
zeus::CColor::lerp(lowC, g_tweakGuiColors->GetPauseItemAmberColor(),
|
||||||
|
zeus::clamp(0.f, (std::sin(5.f * textUpT - M_PIF / 2.f) + 1.f) * 0.5f, 1.f)));
|
||||||
|
x94_model_textarrowbottom->SetColor(
|
||||||
|
zeus::CColor::lerp(lowC, g_tweakGuiColors->GetPauseItemAmberColor(),
|
||||||
|
zeus::clamp(0.f, (std::sin(5.f * textDownT - M_PIF / 2.f) + 1.f) * 0.5f, 1.f)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreenBase::ProcessControllerInput(const CFinalInput& input)
|
||||||
|
{
|
||||||
|
x198_25_handledInput = false;
|
||||||
|
x8_frame.ProcessUserInput(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreenBase::Draw(float mainAlpha, float frameAlpha, float yOff)
|
||||||
|
{
|
||||||
|
zeus::CColor color = zeus::CColor::skWhite;
|
||||||
|
color.a = mainAlpha * x14_alpha;
|
||||||
|
x60_basewidget_pivot->SetColor(color);
|
||||||
|
color.a = frameAlpha;
|
||||||
|
x64_basewidget_bgframe->SetColor(color);
|
||||||
|
|
||||||
|
CGuiWidgetDrawParms parms(1.f, zeus::CVector3f{0.f, 15.f * yOff, 0.f});
|
||||||
|
x8_frame.Draw(parms);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreenBase::UpdateRightTable()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static const char* PaneSuffixes[] =
|
static const char* PaneSuffixes[] =
|
||||||
{
|
{
|
||||||
"0",
|
"0",
|
||||||
|
|
|
@ -15,16 +15,28 @@ class CGuiTextPane;
|
||||||
class CGuiSliderGroup;
|
class CGuiSliderGroup;
|
||||||
class CAuiImagePane;
|
class CAuiImagePane;
|
||||||
class CStringTable;
|
class CStringTable;
|
||||||
|
class CRandom16;
|
||||||
|
class CArchitectureQueue;
|
||||||
|
|
||||||
namespace MP1
|
namespace MP1
|
||||||
{
|
{
|
||||||
|
|
||||||
class CPauseScreenBase
|
class CPauseScreenBase
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
enum class EMode
|
||||||
|
{
|
||||||
|
Invalid = -1,
|
||||||
|
Zero = 0,
|
||||||
|
One = 1,
|
||||||
|
Two = 2
|
||||||
|
};
|
||||||
|
private:
|
||||||
const CStateManager& x4_mgr;
|
const CStateManager& x4_mgr;
|
||||||
const CGuiFrame& x8_frame;
|
CGuiFrame& x8_frame;
|
||||||
const CStringTable& xc_pauseStrg;
|
const CStringTable& xc_pauseStrg;
|
||||||
ResId x10_ = -1;
|
EMode x10_mode = EMode::Invalid;
|
||||||
float x14_ = 0.f;
|
float x14_alpha = 0.f;
|
||||||
u32 x18_ = 0;
|
u32 x18_ = 0;
|
||||||
u32 x1c_ = 0;
|
u32 x1c_ = 0;
|
||||||
zeus::CVector3f x20_;
|
zeus::CVector3f x20_;
|
||||||
|
@ -70,19 +82,41 @@ class CPauseScreenBase
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool x198_24_ : 1;
|
bool x198_24_ready : 1;
|
||||||
bool x198_25_ : 1;
|
bool x198_25_handledInput : 1;
|
||||||
bool x198_26_ : 1;
|
bool x198_26_exitPauseScreen : 1;
|
||||||
bool x198_27_ : 1;
|
bool x198_27_canDraw : 1;
|
||||||
bool x198_28_ : 1;
|
bool x198_28_pulseTextArrowTop : 1;
|
||||||
bool x198_29_ : 1;
|
bool x198_29_pulseTextArrowBottom : 1;
|
||||||
};
|
};
|
||||||
u32 _dummy = 0;
|
u32 _dummy = 0;
|
||||||
};
|
};
|
||||||
void InitializeFrameGlue();
|
void InitializeFrameGlue();
|
||||||
static std::string GetImagePaneName(u32 i);
|
static std::string GetImagePaneName(u32 i);
|
||||||
|
protected:
|
||||||
|
void Activate(EMode mode);
|
||||||
|
void UpdateSideTable(CGuiTableGroup* table);
|
||||||
public:
|
public:
|
||||||
CPauseScreenBase(const CStateManager& mgr, const CGuiFrame& frame, const CStringTable& pauseStrg);
|
CPauseScreenBase(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg);
|
||||||
|
|
||||||
|
bool ShouldExitPauseScreen() const { return x198_26_exitPauseScreen; }
|
||||||
|
bool IsReady();
|
||||||
|
bool CanDraw() const { return x198_27_canDraw; }
|
||||||
|
EMode GetMode() const { return x10_mode; }
|
||||||
|
float GetAlpha() const { return x14_alpha; }
|
||||||
|
|
||||||
|
virtual ~CPauseScreenBase() = default;
|
||||||
|
virtual bool InputDisabled() const { return false; }
|
||||||
|
virtual void TransitioningAway() {}
|
||||||
|
virtual void Update(float dt, CRandom16& rand, CArchitectureQueue& archQueue);
|
||||||
|
virtual void Touch() {}
|
||||||
|
virtual void ProcessControllerInput(const CFinalInput& input);
|
||||||
|
virtual void Draw(float transInterp, float totalAlpha, float yOff);
|
||||||
|
virtual float GetCameraYBias() const { return 0.f; }
|
||||||
|
virtual bool VReady() const=0;
|
||||||
|
virtual void VActivate() const=0;
|
||||||
|
virtual void UpdateRightTable();
|
||||||
|
virtual u32 GetRightTableCount() const=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#include "CPauseScreenBlur.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
namespace MP1
|
||||||
|
{
|
||||||
|
|
||||||
|
CPauseScreenBlur::CPauseScreenBlur()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPauseScreenBlur::CheckLoadComplete()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPauseScreenBlur::OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateMgr)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue