2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 16:24:55 +00:00

Initial mouse events for pause screen

This commit is contained in:
Jack Andersen
2019-01-20 18:10:34 -10:00
parent 47c6b5cba8
commit f3f9924309
25 changed files with 620 additions and 176 deletions

View File

@@ -746,10 +746,14 @@ CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EAction CFrontEndUI::SFusionBonus
case EUIType::LinkFailed:
case EUIType::LinkCompleteOrLinking:
case EUIType::TurnOffGBA:
if (input.PA() || tbAction == CFrontEndUITouchBar::EAction::Confirm) {
if (input.PA() ||
input.PSpecialKey(boo::ESpecialKey::Enter) ||
input.PMouseButton(boo::EMouseButton::Primary) ||
tbAction == CFrontEndUITouchBar::EAction::Confirm) {
PlayAdvanceSfx();
SetUIText(NextLinkUI[int(x0_uiType)]);
} else if (input.PB() || tbAction == CFrontEndUITouchBar::EAction::Back) {
} else if (input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
tbAction == CFrontEndUITouchBar::EAction::Back) {
EUIType prevUi = PrevLinkUI[int(x0_uiType)];
if (prevUi == EUIType::Empty)
break;
@@ -938,7 +942,7 @@ CFrontEndUI::SFusionBonusFrame::EAction CFrontEndUI::SFusionBonusFrame::ProcessU
}
} else if (x24_loadedFrame) {
CFinalInput useInput = input;
if (input.PZ()) {
if (input.PZ() || input.PKey('\t')) {
useInput.x2d_b28_PA = true;
m_gbaOverride = true;
}
@@ -1251,7 +1255,7 @@ void CFrontEndUI::SNesEmulatorFrame::ProcessUserInput(const CFinalInput& input,
switch (x0_mode) {
case EMode::Emulator:
x4_nesEmu->ProcessUserInput(input, 4);
if (input.ControllerIdx() == 0 && input.PL())
if ((input.ControllerIdx() == 0 && input.PL()) || input.PSpecialKey(boo::ESpecialKey::Esc))
SetMode(EMode::QuitNESMetroid);
break;
case EMode::SaveProgress:
@@ -1592,7 +1596,7 @@ bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& inp
if (sui)
sui->ProcessUserInput(input);
if (x1c_loadedFrame && x134_24_visible) {
if (input.PB() && x24_tablegroup_leftmenu->GetIsActive()) {
if ((input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc)) && x24_tablegroup_leftmenu->GetIsActive()) {
x134_25_exitOptions = true;
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
} else {
@@ -2034,14 +2038,22 @@ void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue&
if (x50_curScreen != x54_nextScreen) {
if (x54_nextScreen == EScreen::AttractMovie &&
(input.PStart() || input.PA() || touchBarAction == CFrontEndUITouchBar::EAction::Start)) {
(input.PStart() || input.PA() ||
input.PSpecialKey(boo::ESpecialKey::Esc) ||
input.PSpecialKey(boo::ESpecialKey::Enter) ||
input.PMouseButton(boo::EMouseButton::Primary) ||
touchBarAction == CFrontEndUITouchBar::EAction::Start)) {
/* Player wants to return to opening credits from attract movie */
SetFadeBlackTimer(std::min(1.f, x58_fadeBlackTimer));
PlayAdvanceSfx();
return;
}
if (input.PA() || input.PStart() || touchBarAction == CFrontEndUITouchBar::EAction::Start) {
if (input.PA() || input.PStart() ||
input.PSpecialKey(boo::ESpecialKey::Esc) ||
input.PSpecialKey(boo::ESpecialKey::Enter) ||
input.PMouseButton(boo::EMouseButton::Primary) ||
touchBarAction == CFrontEndUITouchBar::EAction::Start) {
if (x50_curScreen == EScreen::OpenCredits && x54_nextScreen == EScreen::Title && x58_fadeBlackTimer > 1.f) {
/* Player is too impatient to view opening credits */
xd0_playerSkipToTitle = true;
@@ -2051,7 +2063,11 @@ void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue&
}
} else {
if (x50_curScreen == EScreen::Title) {
if (input.PStart() || input.PA() || touchBarAction == CFrontEndUITouchBar::EAction::Start) {
if (input.PStart() || input.PA() ||
input.PSpecialKey(boo::ESpecialKey::Esc) ||
input.PSpecialKey(boo::ESpecialKey::Enter) ||
input.PMouseButton(boo::EMouseButton::Primary) ||
touchBarAction == CFrontEndUITouchBar::EAction::Start) {
if (x58_fadeBlackTimer < 30.f - g_tweakGame->GetPressStartDelay()) {
/* Proceed to file select UI */
CSfxManager::SfxStart(FETransitionBackSFX[x18_rndA][0], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);

View File

@@ -91,11 +91,13 @@ void CInventoryScreen::Update(float dt, CRandom16& rand, CArchitectureQueue& arc
x1a4_textBodyAlpha = std::min(4.f * dt + x1a4_textBodyAlpha, 1.f);
else
x1a4_textBodyAlpha = std::max(0.f, x1a4_textBodyAlpha - 4.f * dt);
x174_textpane_body->SetColor(zeus::CColor(1.f, x1a4_textBodyAlpha));
x180_basewidget_yicon->SetColor(zeus::CColor(1.f, 1.f - x1a4_textBodyAlpha));
if (x1a4_textBodyAlpha == 0.f && x1a8_state == EState::Active)
ChangeMode(EMode::RightTable);
} else {
x1a4_textBodyAlpha = std::max(0.f, x1a4_textBodyAlpha - 4.f * dt);
}
x174_textpane_body->SetColor(zeus::CColor(1.f, x1a4_textBodyAlpha));
x180_basewidget_yicon->SetColor(zeus::CColor(1.f, 1.f - x1a4_textBodyAlpha));
x19c_samusDoll->SetInMorphball(x70_tablegroup_leftlog->GetUserSelection() == 1 && x10_mode != EMode::LeftTable);
UpdateSamusDollPulses();
@@ -121,7 +123,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
if (input.PStart()) {
x19c_samusDoll->BeginViewInterpolate(false);
x198_26_exitPauseScreen = true;
} else if (input.PB()) {
} else if (input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc)) {
x19c_samusDoll->BeginViewInterpolate(false);
}
}
@@ -152,9 +154,10 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
int totalCount = x174_textpane_body->TextSupport().GetTotalPageCount();
bool lastPage = totalCount - 1 == oldPage;
if (totalCount != -1) {
if (input.PLAUp())
if (input.PLAUp() || m_bodyUpClicked)
newPage = std::max(oldPage - 1, 0);
else if (input.PLADown() || (input.PA() && !lastPage))
else if (input.PLADown() || m_bodyDownClicked ||
((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && !lastPage))
newPage = std::min(oldPage + 1, totalCount - 1);
x174_textpane_body->TextSupport().SetPage(newPage);
if (oldPage != newPage)
@@ -166,7 +169,8 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
x198_28_pulseTextArrowTop = false;
}
if (!x1ac_textLeaveRequested)
x1ac_textLeaveRequested = input.PB() || (input.PA() && lastPage);
x1ac_textLeaveRequested = input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
((input.PA() || m_bodyClicked || input.PSpecialKey(boo::ESpecialKey::Enter)) && lastPage);
x1ad_textViewing = !x1ac_textLeaveRequested;
} else {
x198_29_pulseTextArrowBottom = false;
@@ -176,6 +180,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
if (x1a8_state != EState::Active)
x1ad_textViewing = false;
CPauseScreenBase::ProcessMouseInput(input, absViewInterp);
CPauseScreenBase::ProcessControllerInput(input);
}
}

View File

@@ -8,7 +8,7 @@
namespace urde::MP1 {
CLogBookScreen::CLogBookScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg)
: CPauseScreenBase(mgr, frame, pauseStrg) {
: CPauseScreenBase(mgr, frame, pauseStrg, true) {
x19c_scanCompletes.resize(5);
x200_viewScans.resize(5);
x258_artifactDoll = std::make_unique<CArtifactDoll>();
@@ -256,23 +256,25 @@ void CLogBookScreen::Update(float dt, CRandom16& rand, CArchitectureQueue& archQ
else
x254_viewInterp = std::max(0.f, x254_viewInterp - 4.f * dt);
zeus::CColor color(1.f, x254_viewInterp);
x74_basewidget_leftguages->SetColor(color);
x88_basewidget_rightguages->SetColor(color);
zeus::CColor invColor(1.f, 1.f - x254_viewInterp);
x70_tablegroup_leftlog->SetColor(invColor);
x84_tablegroup_rightlog->SetColor(invColor);
x17c_model_textalpha->SetColor(invColor);
x174_textpane_body->SetColor(color);
for (CAuiImagePane* pane : xf0_imagePanes)
pane->SetDeResFactor(1.f - x254_viewInterp);
if (x254_viewInterp == 0.f && x25c_leavePauseState == ELeavePauseState::InPause)
ChangeMode(EMode::RightTable);
} else {
x254_viewInterp = std::max(0.f, x254_viewInterp - 4.f * dt);
}
zeus::CColor color(1.f, x254_viewInterp);
x74_basewidget_leftguages->SetColor(color);
x88_basewidget_rightguages->SetColor(color);
zeus::CColor invColor(1.f, 1.f - x254_viewInterp);
x70_tablegroup_leftlog->SetColor(invColor);
x84_tablegroup_rightlog->SetColor(invColor);
x17c_model_textalpha->SetColor(invColor);
x174_textpane_body->SetColor(color);
for (CAuiImagePane* pane : xf0_imagePanes)
pane->SetDeResFactor(1.f - x254_viewInterp);
if (x25c_leavePauseState == ELeavePauseState::LeavingPause && x254_viewInterp == 0.f)
x25c_leavePauseState = ELeavePauseState::LeftPause;
}
@@ -293,9 +295,10 @@ void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) {
int pageCount = x174_textpane_body->TextSupport().GetTotalPageCount();
bool lastPage = (pageCount - 1) == oldPage;
if (pageCount != -1) {
if (input.PLAUp())
if (input.PLAUp() || m_bodyUpClicked)
newPage = std::max(oldPage - 1, 0);
else if (input.PLADown() || (input.PA() && !lastPage))
else if (input.PLADown() || m_bodyDownClicked ||
((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && !lastPage))
newPage = std::min(oldPage + 1, pageCount - 1);
x174_textpane_body->TextSupport().SetPage(newPage);
if (oldPage != newPage)
@@ -308,7 +311,8 @@ void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) {
}
if (!x260_26_exitTextScroll)
x260_26_exitTextScroll = input.PB() || (input.PA() && lastPage);
x260_26_exitTextScroll = input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && lastPage);
if (g_tweakGui->GetLatchArticleText())
x260_25_inTextScroll = !x260_26_exitTextScroll;
@@ -322,6 +326,7 @@ void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) {
if (x25c_leavePauseState == ELeavePauseState::LeavingPause)
x260_25_inTextScroll = false;
CPauseScreenBase::ProcessMouseInput(input, 0.f);
CPauseScreenBase::ProcessControllerInput(input);
}

View File

@@ -120,7 +120,7 @@ CIOWin::EMessageReturn CMFGame::OnMessage(const CArchitectureMessage& msg, CArch
if (input.ControllerIdx() == 0) {
const CEntity* cam = x14_stateManager->GetCameraManager()->GetCurrentCamera(*x14_stateManager);
TCastToConstPtr<CCinematicCamera> cineCam = cam;
if (input.PStart()) {
if (input.PStart() && input.PSpecialKey(boo::ESpecialKey::Esc)) {
if (cineCam && x14_stateManager->GetSkipCinematicSpecialFunction() != kInvalidUniqueId) {
CMidiManager::StopAll();
x28_skippedCineCam = cineCam->GetUniqueId();
@@ -129,7 +129,7 @@ CIOWin::EMessageReturn CMFGame::OnMessage(const CArchitectureMessage& msg, CArch
} else if (!cineCam) {
x14_stateManager->DeferStateTransition(EStateManagerTransition::PauseGame);
}
} else if (input.PZ() && !cineCam && x14_stateManager->CanShowMapScreen()) {
} else if ((input.PZ() || input.PKey('\t')) && !cineCam && x14_stateManager->CanShowMapScreen()) {
x14_stateManager->DeferStateTransition(EStateManagerTransition::MapScreen);
}
}

View File

@@ -17,7 +17,9 @@ CMessageScreen::CMessageScreen(CAssetId msg, float delayTime) : x74_delayTime(de
}
void CMessageScreen::ProcessControllerInput(const CFinalInput& input) {
if (!x18_loadedMsgScreen || x74_delayTime > 0.f || !input.PA())
if (!x18_loadedMsgScreen || x74_delayTime > 0.f || !(input.PA() ||
input.PSpecialKey(boo::ESpecialKey::Enter) ||
input.PMouseButton(boo::EMouseButton::Primary)))
return;
if (x1c_textpane_message->TextSupport().GetCurTime() < x1c_textpane_message->TextSupport().GetTotalAnimationTime()) {

View File

@@ -140,9 +140,11 @@ void COptionsScreen::Touch() {
void COptionsScreen::ProcessControllerInput(const CFinalInput& input) {
if (!x19c_quitGame) {
CPauseScreenBase::ProcessMouseInput(input, 0.f);
CPauseScreenBase::ProcessControllerInput(input);
CGameOptions::TryRestoreDefaults(input, x70_tablegroup_leftlog->GetUserSelection(), x1c_rightSel, false, false);
if (x70_tablegroup_leftlog->GetUserSelection() == 4 && input.PA())
if (x70_tablegroup_leftlog->GetUserSelection() == 4 && (input.PA() ||
input.PSpecialKey(boo::ESpecialKey::Enter)))
x19c_quitGame = std::make_unique<CQuitGameScreen>(EQuitType::QuitGame);
} else {
x19c_quitGame->ProcessUserInput(input);

View File

@@ -24,6 +24,11 @@ CPauseScreen::CPauseScreen(ESubScreen subscreen, const CDependencyGroup& suitDgr
x60_loadTok = g_ResFactory->LoadResourceAsync(frmeTag, x5c_frmePauseScreenBuf.get());
CSfxManager::SfxStart(SFXui_pause_screen_enter, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
x7c_screens.resize(2);
m_returnDown = false;
m_nextDown = false;
m_backDown = false;
m_lDown = false;
m_rDown = false;
}
CPauseScreen::~CPauseScreen() {
@@ -47,12 +52,19 @@ std::unique_ptr<CPauseScreenBase> CPauseScreen::BuildPauseSubScreen(ESubScreen s
void CPauseScreen::InitializeFrameGlue() {
x38_textpane_l1 = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_l1"));
x38_textpane_l1->SetMouseActive(true);
x3c_textpane_r = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_r"));
x3c_textpane_r->SetMouseActive(true);
x40_textpane_a = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_a"));
x40_textpane_a->SetMouseActive(true);
x44_textpane_b = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_b"));
x44_textpane_b->SetMouseActive(true);
x48_textpane_return = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_return"));
x48_textpane_return->SetMouseActive(true);
x4c_textpane_next = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_next"));
x4c_textpane_next->SetMouseActive(true);
x50_textpane_back = static_cast<CGuiTextPane*>(x34_loadedPauseScreenInstructions->FindWidget("textpane_back"));
x50_textpane_back->SetMouseActive(true);
x40_textpane_a->TextSupport().SetText(x14_strgPauseScreen->GetString(7)); // OPTIONS
x40_textpane_a->TextSupport().SetFontColor(g_tweakGuiColors->GetPauseItemAmberColor());
@@ -66,6 +78,11 @@ void CPauseScreen::InitializeFrameGlue() {
color.a() *= 0.75f;
deco->SetColor(color);
}
x34_loadedPauseScreenInstructions->SetMouseDownCallback(std::bind(&CPauseScreen::OnWidgetMouseDown, this,
std::placeholders::_1, std::placeholders::_2));
x34_loadedPauseScreenInstructions->SetMouseUpCallback(std::bind(&CPauseScreen::OnWidgetMouseUp, this,
std::placeholders::_1, std::placeholders::_2));
}
bool CPauseScreen::CheckLoadComplete(const CStateManager& mgr) {
@@ -163,8 +180,20 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal
if (x8_curSubscreen == ESubScreen::ToGame)
return;
m_returnClicked = false;
m_nextClicked = false;
m_backClicked = false;
m_lClicked = false;
m_rClicked = false;
bool bExits = false;
if (std::unique_ptr<CPauseScreenBase>& curScreen = x7c_screens[x78_activeIdx]) {
float yOff = 0.f;
if (curScreen->CanDraw())
yOff = curScreen->GetCameraYBias();
CGuiWidgetDrawParms parms(1.f, zeus::CVector3f{0.f, 15.f * yOff, 0.f});
x34_loadedPauseScreenInstructions->ProcessMouseInput(input, parms);
if (curScreen->GetMode() == CPauseScreenBase::EMode::LeftTable)
bExits = true;
curScreen->ProcessControllerInput(input);
@@ -172,15 +201,16 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal
if (InputEnabled()) {
bool invalid = x8_curSubscreen == ESubScreen::ToGame;
if (input.PStart() || (input.PB() && bExits) ||
if (input.PStart() || m_returnClicked ||
((input.PB() || m_backClicked || input.PSpecialKey(boo::ESpecialKey::Esc)) && bExits) ||
(x7c_screens[x78_activeIdx] && x7c_screens[x78_activeIdx]->ShouldExitPauseScreen())) {
CSfxManager::SfxStart(SFXui_pause_screen_exit, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
StartTransition(0.5f, mgr, ESubScreen::ToGame, 2);
} else {
if (ControlMapper::GetPressInput(ControlMapper::ECommands::PreviousPauseScreen, input)) {
if (ControlMapper::GetPressInput(ControlMapper::ECommands::PreviousPauseScreen, input) || m_lClicked) {
CSfxManager::SfxStart(SFXui_pause_screen_change, 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)) {
} else if (ControlMapper::GetPressInput(ControlMapper::ECommands::NextPauseScreen, input) || m_rClicked) {
CSfxManager::SfxStart(SFXui_pause_screen_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
StartTransition(0.5f, mgr, GetNextSubscreen(x8_curSubscreen), invalid ? 2 : 1);
}
@@ -188,15 +218,15 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal
}
x38_textpane_l1->TextSupport().SetText(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[input.DLTrigger()].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[input.DLTrigger() || m_lDown].Value())));
x3c_textpane_r->TextSupport().SetText(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[input.DRTrigger()].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[input.DRTrigger() || m_rDown].Value())));
x48_textpane_return->TextSupport().SetText(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x8c_startButton[input.DStart()].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x8c_startButton[input.DStart() || m_returnDown].Value())));
x50_textpane_back->TextSupport().SetText(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x98_aButton[input.DA()].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x98_aButton[input.DA() || m_backDown].Value())));
x4c_textpane_next->TextSupport().SetText(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->xa4_bButton[input.DB()].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->xa4_bButton[input.DB() || m_nextDown].Value())));
}
void CPauseScreen::TransitionComplete() {
@@ -208,6 +238,44 @@ void CPauseScreen::TransitionComplete() {
x44_textpane_b->TextSupport().SetText(x14_strgPauseScreen->GetString(int(GetNextSubscreen(x8_curSubscreen)) + 6));
}
void CPauseScreen::OnWidgetMouseDown(CGuiWidget* widget, bool resume) {
if (widget == x48_textpane_return)
m_returnDown = true;
else if (widget == x4c_textpane_next)
m_backDown = true;
else if (widget == x50_textpane_back)
m_nextDown = true;
else if (widget == x38_textpane_l1 || widget == x40_textpane_a)
m_lDown = true;
else if (widget == x3c_textpane_r || widget == x44_textpane_b)
m_rDown = true;
}
void CPauseScreen::OnWidgetMouseUp(CGuiWidget* widget, bool cancel) {
if (widget == x48_textpane_return)
m_returnDown = false;
else if (widget == x4c_textpane_next)
m_backDown = false;
else if (widget == x50_textpane_back)
m_nextDown = false;
else if (widget == x38_textpane_l1 || widget == x40_textpane_a)
m_lDown = false;
else if (widget == x3c_textpane_r || widget == x44_textpane_b)
m_rDown = false;
if (cancel)
return;
if (widget == x48_textpane_return)
m_returnClicked = true;
else if (widget == x4c_textpane_next)
m_backClicked = true;
else if (widget == x50_textpane_back)
m_nextClicked = true;
else if (widget == x38_textpane_l1 || widget == x40_textpane_a)
m_lClicked = true;
else if (widget == x3c_textpane_r || widget == x44_textpane_b)
m_rClicked = true;
}
void CPauseScreen::Update(float dt, const CStateManager& mgr, CRandom16& rand, CArchitectureQueue& archQueue) {
if (!CheckLoadComplete(mgr))
return;

View File

@@ -41,6 +41,17 @@ private:
bool x90_resourcesLoaded = false;
bool x91_initialTransition = true;
bool m_returnClicked : 1;
bool m_nextClicked : 1;
bool m_backClicked : 1;
bool m_lClicked : 1;
bool m_rClicked : 1;
bool m_returnDown : 1;
bool m_nextDown : 1;
bool m_backDown : 1;
bool m_lDown : 1;
bool m_rDown : 1;
std::unique_ptr<CPauseScreenBase> BuildPauseSubScreen(ESubScreen subscreen, const CStateManager& mgr,
CGuiFrame& frame) const;
void StartTransition(float time, const CStateManager& mgr, ESubScreen subscreen, int);
@@ -51,6 +62,9 @@ private:
static ESubScreen GetNextSubscreen(ESubScreen screen);
void TransitionComplete();
void OnWidgetMouseDown(CGuiWidget* widget, bool resume);
void OnWidgetMouseUp(CGuiWidget* widget, bool cancel);
public:
CPauseScreen(ESubScreen subscreen, const CDependencyGroup& suitDgrp, const CDependencyGroup& ballDgrp);
~CPauseScreen();

View File

@@ -13,8 +13,10 @@
namespace urde::MP1 {
CPauseScreenBase::CPauseScreenBase(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg)
CPauseScreenBase::CPauseScreenBase(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg,
bool isLogBook)
: x4_mgr(mgr), x8_frame(frame), xc_pauseStrg(pauseStrg) {
m_isLogBook = isLogBook;
InitializeFrameGlue();
}
@@ -34,12 +36,13 @@ void CPauseScreenBase::InitializeFrameGlue() {
x88_basewidget_rightguages->SetColor(zeus::CColor(1.f, 0.f));
x8c_model_righthighlight = static_cast<CGuiModel*>(x8_frame.FindWidget("model_righthighlight"));
x90_model_textarrowtop = static_cast<CGuiModel*>(x8_frame.FindWidget("model_textarrowtop"));
x90_model_textarrowtop->SetMouseActive(true);
x94_model_textarrowbottom = static_cast<CGuiModel*>(x8_frame.FindWidget("model_textarrowbottom"));
x94_model_textarrowbottom->SetMouseActive(true);
x98_model_scrollleftup = static_cast<CGuiModel*>(x8_frame.FindWidget("model_scrollleftup"));
x9c_model_scrollleftdown = static_cast<CGuiModel*>(x8_frame.FindWidget("model_scrollleftdown"));
xa0_model_scrollrightup = static_cast<CGuiModel*>(x8_frame.FindWidget("model_scrollrightup"));
xa4_model_scrollrightdown = static_cast<CGuiModel*>(x8_frame.FindWidget("model_scrollrightdown"));
x94_model_textarrowbottom = static_cast<CGuiModel*>(x8_frame.FindWidget("model_textarrowbottom"));
x178_textpane_title = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_title"));
x178_textpane_title->TextSupport().SetFontColor(g_tweakGuiColors->GetPauseItemAmberColor());
x174_textpane_body = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_body"));
@@ -51,6 +54,7 @@ void CPauseScreenBase::InitializeFrameGlue() {
x174_textpane_body->TextSupport().SetJustification(EJustification::Left);
x174_textpane_body->TextSupport().SetVerticalJustification(EVerticalJustification::Top);
x174_textpane_body->TextSupport().SetControlTXTRMap(&g_GameState->GameOptions().GetControlTXTRMap());
x174_textpane_body->SetMouseActive(true);
x180_basewidget_yicon = x8_frame.FindWidget("basewidget_yicon");
x180_basewidget_yicon->SetVisibility(false, ETraversalMode::Children);
x17c_model_textalpha = static_cast<CGuiModel*>(x8_frame.FindWidget("model_textalpha"));
@@ -85,6 +89,9 @@ void CPauseScreenBase::InitializeFrameGlue() {
static_cast<CGuiTextPane*>(x8_frame.FindWidget(hecl::Format("textpane_title%d", i + 1))));
xd8_textpane_titles.back()->TextSupport().SetText(u"");
x144_model_titles.push_back(static_cast<CGuiModel*>(x8_frame.FindWidget(hecl::Format("model_title%d", i + 1))));
m_model_lefttitledecos.push_back(
static_cast<CGuiModel*>(x8_frame.FindWidget(hecl::Format("model_lefttitledeco%d", i))));
m_model_lefttitledecos.back()->SetMouseActive(true);
x15c_model_righttitledecos.push_back(
static_cast<CGuiModel*>(x8_frame.FindWidget(hecl::Format("model_righttitledeco%d", i + 1))));
x15c_model_righttitledecos.back()->SetMouseActive(true);
@@ -152,6 +159,9 @@ void CPauseScreenBase::InitializeFrameGlue() {
x18c_slidergroup_slider->SetSelectionChangedCallback({});
x190_tablegroup_double->SetMenuSelectionChangeCallback({});
x194_tablegroup_triple->SetMenuSelectionChangeCallback({});
x8_frame.SetMouseUpCallback(std::bind(&CPauseScreenBase::OnWidgetMouseUp, this,
std::placeholders::_1, std::placeholders::_2));
}
bool CPauseScreenBase::IsReady() {
@@ -168,7 +178,7 @@ bool CPauseScreenBase::IsReady() {
return false;
}
void CPauseScreenBase::ChangeMode(EMode mode) {
void CPauseScreenBase::ChangeMode(EMode mode, bool playSfx) {
if (x10_mode == mode)
return;
@@ -191,7 +201,8 @@ void CPauseScreenBase::ChangeMode(EMode mode) {
x84_tablegroup_rightlog->SetIsActive(false);
break;
case EMode::TextScroll:
CSfxManager::SfxStart(SFXui_table_change_mode, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
if (playSfx)
CSfxManager::SfxStart(SFXui_table_change_mode, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
break;
default:
break;
@@ -201,7 +212,7 @@ void CPauseScreenBase::ChangeMode(EMode mode) {
switch (x10_mode) {
case EMode::LeftTable:
if (oldMode == EMode::RightTable)
if (playSfx && oldMode == EMode::RightTable)
CSfxManager::SfxStart(SFXui_table_change_mode, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
x6c_basewidget_leftlog->SetColor(color);
x70_tablegroup_leftlog->SetIsActive(true);
@@ -305,6 +316,14 @@ void CPauseScreenBase::ProcessControllerInput(const CFinalInput& input) {
x8_frame.ProcessUserInput(input);
}
bool CPauseScreenBase::ProcessMouseInput(const CFinalInput& input, float yOff) {
m_bodyUpClicked = false;
m_bodyDownClicked = false;
m_bodyClicked = false;
CGuiWidgetDrawParms parms(1.f, zeus::CVector3f{0.f, 15.f * yOff, 0.f});
return x8_frame.ProcessMouseInput(input, parms);
}
void CPauseScreenBase::Draw(float mainAlpha, float frameAlpha, float yOff) {
zeus::CColor color = zeus::CColor::skWhite;
color.a() = mainAlpha * x14_alpha;
@@ -366,6 +385,60 @@ void CPauseScreenBase::OnTableSelectionChange(CGuiTableGroup* caller, int oldSel
void CPauseScreenBase::OnRightTableCancel(CGuiTableGroup* caller) { ChangeMode(EMode::LeftTable); }
void CPauseScreenBase::OnWidgetMouseUp(CGuiWidget* widget, bool cancel) {
if (cancel || !widget)
return;
if (widget->GetParent() == x70_tablegroup_leftlog) {
if (m_isLogBook && x10_mode == EMode::TextScroll)
return;
int idx = int(std::find(m_model_lefttitledecos.begin(), m_model_lefttitledecos.end(), widget) -
m_model_lefttitledecos.begin());
if (x70_tablegroup_leftlog->IsWorkerSelectable(idx)) {
/* Simulate change to left table */
if (x10_mode == EMode::TextScroll)
ChangeMode(EMode::RightTable, false);
if (x10_mode == EMode::RightTable)
ChangeMode(EMode::LeftTable, false);
/* Simulate selection change */
int oldSel = x70_tablegroup_leftlog->GetUserSelection();
x70_tablegroup_leftlog->SelectWorker(idx);
OnTableSelectionChange(x70_tablegroup_leftlog, oldSel);
/* Simulate change to right table if able */
if (ShouldLeftTableAdvance())
ChangeMode(EMode::RightTable, false);
}
} else if (widget->GetParent() == x84_tablegroup_rightlog) {
if (m_isLogBook && x10_mode == EMode::TextScroll)
return;
int idx = int(std::find(x15c_model_righttitledecos.begin(), x15c_model_righttitledecos.end(), widget) -
x15c_model_righttitledecos.begin()) + 1;
if (x10_mode == EMode::LeftTable) {
if (ShouldLeftTableAdvance())
ChangeMode(EMode::RightTable, false);
else
return;
}
if (x84_tablegroup_rightlog->IsWorkerSelectable(idx)) {
/* Simulate change to right table */
if (x10_mode == EMode::TextScroll)
ChangeMode(EMode::RightTable, false);
/* Simulate selection change */
int oldSel = x84_tablegroup_rightlog->GetUserSelection();
x84_tablegroup_rightlog->SelectWorker(idx);
OnTableSelectionChange(x84_tablegroup_rightlog, oldSel);
/* Simulate change to text scroll if able */
if (ShouldRightTableAdvance())
ChangeMode(EMode::TextScroll, false);
}
} else if (widget == x174_textpane_body) {
m_bodyClicked = true;
} else if (widget == x90_model_textarrowtop) {
m_bodyUpClicked = true;
} else if (widget == x94_model_textarrowbottom) {
m_bodyDownClicked = true;
}
}
static const char* PaneSuffixes[] = {"0", "1", "2", "3", "01", "12", "23", "012", "123", "0123",
"4", "5", "6", "7", "45", "56", "67", "456", "567", "4567"};

View File

@@ -59,6 +59,7 @@ protected:
rstl::reserved_vector<CGuiTextPane*, 5> xd8_textpane_titles;
rstl::reserved_vector<CAuiImagePane*, 20> xf0_imagePanes;
rstl::reserved_vector<CGuiModel*, 5> x144_model_titles;
rstl::reserved_vector<CGuiModel*, 5> m_model_lefttitledecos;
rstl::reserved_vector<CGuiModel*, 5> x15c_model_righttitledecos;
CGuiTextPane* x174_textpane_body = nullptr;
CGuiTextPane* x178_textpane_title = nullptr;
@@ -77,11 +78,15 @@ protected:
bool x198_27_canDraw : 1;
bool x198_28_pulseTextArrowTop : 1;
bool x198_29_pulseTextArrowBottom : 1;
bool m_isLogBook : 1;
bool m_bodyUpClicked : 1;
bool m_bodyDownClicked : 1;
bool m_bodyClicked : 1;
};
u32 _dummy = 0;
};
void InitializeFrameGlue();
void ChangeMode(EMode mode);
void ChangeMode(EMode mode, bool playSfx = true);
void UpdateSideTable(CGuiTableGroup* table);
void SetRightTableSelection(int oldSel, int newSel);
@@ -90,10 +95,12 @@ protected:
void OnTableSelectionChange(CGuiTableGroup* caller, int oldSel);
void OnRightTableCancel(CGuiTableGroup* caller);
void OnWidgetMouseUp(CGuiWidget* widget, bool cancel);
public:
static std::string GetImagePaneName(u32 i);
CPauseScreenBase(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg);
CPauseScreenBase(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg, bool isLogBook = false);
bool ShouldExitPauseScreen() const { return x198_26_exitPauseScreen; }
bool IsReady();
@@ -107,6 +114,7 @@ public:
virtual void Update(float dt, CRandom16& rand, CArchitectureQueue& archQueue);
virtual void Touch() {}
virtual void ProcessControllerInput(const CFinalInput& input);
bool ProcessMouseInput(const CFinalInput& input, float yOff);
virtual void Draw(float transInterp, float totalAlpha, float yOff);
virtual float GetCameraYBias() const { return 0.f; }
virtual bool VReady() const = 0;

View File

@@ -84,7 +84,7 @@ void CQuitGameScreen::ProcessUserInput(const CFinalInput& input) {
if (!x10_loadedFrame)
return;
x10_loadedFrame->ProcessUserInput(input);
if (input.PB() && x0_type != EQuitType::ContinueFromLastSave)
if ((input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc)) && x0_type != EQuitType::ContinueFromLastSave)
x18_action = EQuitAction::No;
}