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

Merge branch 'master' of ssh+git://git.axiodl.com:6431/AxioDL/urde

This commit is contained in:
2019-01-22 22:00:59 -08:00
18 changed files with 214 additions and 38 deletions

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() && input.PSpecialKey(boo::ESpecialKey::Esc)) {
if (input.PStart() || input.PSpecialKey(boo::ESpecialKey::Esc)) {
if (cineCam && x14_stateManager->GetSkipCinematicSpecialFunction() != kInvalidUniqueId) {
CMidiManager::StopAll();
x28_skippedCineCam = cineCam->GetUniqueId();

View File

@@ -38,6 +38,7 @@ void COptionsScreen::UpdateOptionView() {
x190_tablegroup_double->SetUserSelection(CGameOptions::GetOption(opt.option));
x190_tablegroup_double->SetIsVisible(true);
x190_tablegroup_double->SetIsActive(true);
x190_tablegroup_double->SetWorkersMouseActive(true);
UpdateSideTable(x190_tablegroup_double);
x190_tablegroup_double->SetLocalPosition(x48_tableDoubleStart + zeus::CVector3f(0.f, 0.f, zOff));
break;
@@ -45,12 +46,15 @@ void COptionsScreen::UpdateOptionView() {
x194_tablegroup_triple->SetUserSelection(CGameOptions::GetOption(opt.option));
x194_tablegroup_triple->SetIsVisible(true);
x194_tablegroup_triple->SetIsActive(true);
x194_tablegroup_triple->SetWorkersMouseActive(true);
UpdateSideTable(x194_tablegroup_triple);
x194_tablegroup_triple->SetLocalPosition(x54_tableTripleStart + zeus::CVector3f(0.f, 0.f, zOff));
break;
default:
break;
}
x174_textpane_body->SetMouseActive(false);
}
void COptionsScreen::ResetOptionWidgetVisibility() {
@@ -58,8 +62,11 @@ void COptionsScreen::ResetOptionWidgetVisibility() {
x18c_slidergroup_slider->SetVisibility(false, ETraversalMode::Children);
x190_tablegroup_double->SetIsVisible(false);
x190_tablegroup_double->SetIsActive(false);
x190_tablegroup_double->SetWorkersMouseActive(false);
x194_tablegroup_triple->SetIsActive(false);
x194_tablegroup_triple->SetIsVisible(false);
x194_tablegroup_triple->SetWorkersMouseActive(false);
x174_textpane_body->SetMouseActive(true);
}
void COptionsScreen::OnSliderChanged(CGuiSliderGroup* caller, float val) {

View File

@@ -186,31 +186,36 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal
m_lClicked = false;
m_rClicked = false;
CFinalInput useInput = input;
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);
x34_loadedPauseScreenInstructions->ProcessMouseInput(useInput, parms);
useInput.x2e_b31_PStart |= m_returnClicked;
useInput.x2d_b28_PA |= m_nextClicked;
useInput.x2d_b29_PB |= m_backClicked;
if (curScreen->GetMode() == CPauseScreenBase::EMode::LeftTable)
bExits = true;
curScreen->ProcessControllerInput(input);
curScreen->ProcessControllerInput(useInput);
}
if (InputEnabled()) {
bool invalid = x8_curSubscreen == ESubScreen::ToGame;
if (input.PStart() || m_returnClicked ||
((input.PB() || m_backClicked || input.PSpecialKey(boo::ESpecialKey::Esc)) && bExits) ||
if (useInput.PStart() ||
((useInput.PB() || useInput.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) || m_lClicked) {
if (ControlMapper::GetPressInput(ControlMapper::ECommands::PreviousPauseScreen, useInput) || 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) || m_rClicked) {
} else if (ControlMapper::GetPressInput(ControlMapper::ECommands::NextPauseScreen, useInput) || 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);
}
@@ -218,15 +223,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() || m_lDown].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[useInput.DLTrigger() || m_lDown].Value())));
x3c_textpane_r->TextSupport().SetText(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[input.DRTrigger() || m_rDown].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[useInput.DRTrigger() || m_rDown].Value())));
x48_textpane_return->TextSupport().SetText(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x8c_startButton[input.DStart() || m_returnDown].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x8c_startButton[useInput.DStart() || m_returnDown].Value())));
x50_textpane_back->TextSupport().SetText(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x98_aButton[input.DA() || m_backDown].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x98_aButton[useInput.DA() || m_backDown].Value())));
x4c_textpane_next->TextSupport().SetText(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->xa4_bButton[input.DB() || m_nextDown].Value())));
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->xa4_bButton[useInput.DB() || m_nextDown].Value())));
}
void CPauseScreen::TransitionComplete() {

View File

@@ -17,6 +17,7 @@ CPauseScreenBase::CPauseScreenBase(const CStateManager& mgr, CGuiFrame& frame, c
bool isLogBook)
: x4_mgr(mgr), x8_frame(frame), xc_pauseStrg(pauseStrg) {
m_isLogBook = isLogBook;
m_playRightTableSfx = true;
InitializeFrameGlue();
}
@@ -42,7 +43,9 @@ void CPauseScreenBase::InitializeFrameGlue() {
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"));
xa0_model_scrollrightup->SetMouseActive(true);
xa4_model_scrollrightdown = static_cast<CGuiModel*>(x8_frame.FindWidget("model_scrollrightdown"));
xa4_model_scrollrightdown->SetMouseActive(true);
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"));
@@ -65,6 +68,7 @@ void CPauseScreenBase::InitializeFrameGlue() {
x188_textpane_ytext->TextSupport().SetText(xc_pauseStrg.GetString(99));
x188_textpane_ytext->SetColor(g_tweakGuiColors->GetPauseItemAmberColor());
x18c_slidergroup_slider = static_cast<CGuiSliderGroup*>(x8_frame.FindWidget("slidergroup_slider"));
x18c_slidergroup_slider->SetMouseActive(true);
x190_tablegroup_double = static_cast<CGuiTableGroup*>(x8_frame.FindWidget("tablegroup_double"));
x194_tablegroup_triple = static_cast<CGuiTableGroup*>(x8_frame.FindWidget("tablegroup_triple"));
@@ -145,6 +149,8 @@ void CPauseScreenBase::InitializeFrameGlue() {
x194_tablegroup_triple->SetIsVisible(false);
x190_tablegroup_double->SetVertical(false);
x194_tablegroup_triple->SetVertical(false);
x190_tablegroup_double->SetWorkersMouseActive(false);
x194_tablegroup_triple->SetWorkersMouseActive(false);
x70_tablegroup_leftlog->SetMenuAdvanceCallback(
std::bind(&CPauseScreenBase::OnLeftTableAdvance, this, std::placeholders::_1));
@@ -162,6 +168,9 @@ void CPauseScreenBase::InitializeFrameGlue() {
x8_frame.SetMouseUpCallback(std::bind(&CPauseScreenBase::OnWidgetMouseUp, this,
std::placeholders::_1, std::placeholders::_2));
x8_frame.SetMouseScrollCallback(std::bind(&CPauseScreenBase::OnWidgetScroll, this,
std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, std::placeholders::_4));
}
bool CPauseScreenBase::IsReady() {
@@ -345,7 +354,7 @@ void CPauseScreenBase::UpdateRightTable() {
void CPauseScreenBase::SetRightTableSelection(int oldSel, int newSel) {
int oldRightSel = x1c_rightSel;
x1c_rightSel = zeus::clamp(0, x1c_rightSel + (newSel - oldSel), int(GetRightTableCount()) - 1);
if (oldRightSel != x1c_rightSel)
if (m_playRightTableSfx && oldRightSel != x1c_rightSel)
CSfxManager::SfxStart(SFXui_table_selection_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
if (x1c_rightSel < x18_firstViewRightSel)
@@ -425,10 +434,11 @@ void CPauseScreenBase::OnWidgetMouseUp(CGuiWidget* widget, bool cancel) {
/* Simulate selection change */
int oldSel = x84_tablegroup_rightlog->GetUserSelection();
x84_tablegroup_rightlog->SelectWorker(idx);
m_playRightTableSfx = !ShouldRightTableAdvance();
OnTableSelectionChange(x84_tablegroup_rightlog, oldSel);
m_playRightTableSfx = true;
/* Simulate change to text scroll if able */
if (ShouldRightTableAdvance())
ChangeMode(EMode::TextScroll, false);
OnRightTableAdvance(nullptr);
}
} else if (widget == x174_textpane_body) {
m_bodyClicked = true;
@@ -436,6 +446,66 @@ void CPauseScreenBase::OnWidgetMouseUp(CGuiWidget* widget, bool cancel) {
m_bodyUpClicked = true;
} else if (widget == x94_model_textarrowbottom) {
m_bodyDownClicked = true;
} else if (widget == xa0_model_scrollrightup) {
if (x10_mode == EMode::LeftTable) {
if (ShouldLeftTableAdvance())
ChangeMode(EMode::RightTable, false);
else
return;
}
if (x10_mode == EMode::RightTable && x18_firstViewRightSel > 0) {
/* Simulate selection change */
int oldSel = x84_tablegroup_rightlog->GetUserSelection();
x84_tablegroup_rightlog->SelectWorker(0);
OnTableSelectionChange(x84_tablegroup_rightlog, oldSel);
}
} else if (widget == xa4_model_scrollrightdown) {
if (x10_mode == EMode::LeftTable) {
if (ShouldLeftTableAdvance())
ChangeMode(EMode::RightTable, false);
else
return;
}
if (x10_mode == EMode::RightTable && x18_firstViewRightSel + 5 < GetRightTableCount()) {
/* Simulate selection change */
int oldSel = x84_tablegroup_rightlog->GetUserSelection();
x84_tablegroup_rightlog->SelectWorker(6);
OnTableSelectionChange(x84_tablegroup_rightlog, oldSel);
}
}
}
void CPauseScreenBase::OnWidgetScroll(CGuiWidget* widget, const boo::SScrollDelta& delta, int accumX, int accumY) {
if (!widget || accumY == 0)
return;
if (widget->GetParent() == x84_tablegroup_rightlog) {
if (x10_mode == EMode::LeftTable) {
if (ShouldLeftTableAdvance())
ChangeMode(EMode::RightTable, false);
else
return;
}
if (accumY < 0) do {
if (x10_mode == EMode::RightTable && x18_firstViewRightSel + 5 < GetRightTableCount()) {
/* Simulate selection change */
int oldSel = x84_tablegroup_rightlog->GetUserSelection();
x84_tablegroup_rightlog->SelectWorker(6);
OnTableSelectionChange(x84_tablegroup_rightlog, oldSel);
}
} while (++accumY < 0);
else if (accumY > 0) do {
if (x10_mode == EMode::RightTable && x18_firstViewRightSel > 0) {
/* Simulate selection change */
int oldSel = x84_tablegroup_rightlog->GetUserSelection();
x84_tablegroup_rightlog->SelectWorker(0);
OnTableSelectionChange(x84_tablegroup_rightlog, oldSel);
}
} while (--accumY > 0);
} else if (widget == x174_textpane_body) {
if (accumY < 0)
m_bodyDownClicked = true;
else if (accumY > 0)
m_bodyUpClicked = true;
}
}

View File

@@ -82,6 +82,7 @@ protected:
bool m_bodyUpClicked : 1;
bool m_bodyDownClicked : 1;
bool m_bodyClicked : 1;
bool m_playRightTableSfx : 1;
};
u32 _dummy = 0;
};
@@ -96,6 +97,7 @@ protected:
void OnRightTableCancel(CGuiTableGroup* caller);
void OnWidgetMouseUp(CGuiWidget* widget, bool cancel);
void OnWidgetScroll(CGuiWidget* widget, const boo::SScrollDelta& delta, int accumX, int accumY);
public:
static std::string GetImagePaneName(u32 i);