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

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

View File

@ -10,6 +10,7 @@
#include "CSimplePool.hpp" #include "CSimplePool.hpp"
#include "Graphics/CModel.hpp" #include "Graphics/CModel.hpp"
#include "CGuiWidgetDrawParms.hpp" #include "CGuiWidgetDrawParms.hpp"
#include "CGuiTableGroup.hpp"
namespace urde { namespace urde {
@ -204,8 +205,21 @@ bool CGuiFrame::ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDraw
} }
if (m_mouseOverChangeCb) if (m_mouseOverChangeCb)
m_mouseOverChangeCb(m_lastMouseOverWidget, hit); m_mouseOverChangeCb(m_lastMouseOverWidget, hit);
if (hit)
hit->m_lastScroll.emplace(kbm->m_accumScroll);
m_lastMouseOverWidget = hit; m_lastMouseOverWidget = hit;
} }
if (hit && hit->m_lastScroll) {
boo::SScrollDelta delta = kbm->m_accumScroll - *hit->m_lastScroll;
hit->m_lastScroll.emplace(kbm->m_accumScroll);
if (!delta.isZero()) {
hit->m_integerScroll += delta;
if (m_mouseScrollCb)
m_mouseScrollCb(hit, delta, int(hit->m_integerScroll.delta[0]), int(hit->m_integerScroll.delta[1]));
hit->m_integerScroll.delta[0] -= std::trunc(hit->m_integerScroll.delta[0]);
hit->m_integerScroll.delta[1] -= std::trunc(hit->m_integerScroll.delta[1]);
}
}
if (!m_inMouseDown && kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) { if (!m_inMouseDown && kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
m_inMouseDown = true; m_inMouseDown = true;
m_inCancel = false; m_inCancel = false;
@ -217,8 +231,19 @@ bool CGuiFrame::ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDraw
} else if (m_inMouseDown && !kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) { } else if (m_inMouseDown && !kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
m_inMouseDown = false; m_inMouseDown = false;
m_inCancel = false; m_inCancel = false;
if (m_mouseUpCb && m_mouseDownWidget == m_lastMouseOverWidget) if (m_mouseDownWidget == m_lastMouseOverWidget) {
if (m_mouseUpCb)
m_mouseUpCb(m_mouseDownWidget, false); m_mouseUpCb(m_mouseDownWidget, false);
if (m_mouseDownWidget) {
if (CGuiTableGroup* p = static_cast<CGuiTableGroup*>(m_mouseDownWidget->GetParent())) {
if (p->GetWidgetTypeID() == FOURCC('TBGP')) {
s16 workerIdx = m_mouseDownWidget->GetWorkerId();
if (workerIdx >= 0)
p->DoSelectWorker(workerIdx);
}
}
}
}
} }
} }
return false; return false;

View File

@ -4,6 +4,7 @@
#include "CGuiHeadWidget.hpp" #include "CGuiHeadWidget.hpp"
#include "CGuiWidgetIdDB.hpp" #include "CGuiWidgetIdDB.hpp"
#include "IObj.hpp" #include "IObj.hpp"
#include "boo/IWindow.hpp"
#include <array> #include <array>
namespace urde { namespace urde {
@ -48,6 +49,7 @@ private:
std::function<void(CGuiWidget*, CGuiWidget*)> m_mouseOverChangeCb; std::function<void(CGuiWidget*, CGuiWidget*)> m_mouseOverChangeCb;
std::function<void(CGuiWidget*, bool)> m_mouseDownCb; std::function<void(CGuiWidget*, bool)> m_mouseDownCb;
std::function<void(CGuiWidget*, bool)> m_mouseUpCb; std::function<void(CGuiWidget*, bool)> m_mouseUpCb;
std::function<void(CGuiWidget*, const boo::SScrollDelta&, int, int)> m_mouseScrollCb;
public: public:
CGuiFrame(CAssetId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp); CGuiFrame(CAssetId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp);
@ -83,6 +85,9 @@ public:
void SetMouseUpCallback(std::function<void(CGuiWidget*, bool)>&& cb) { void SetMouseUpCallback(std::function<void(CGuiWidget*, bool)>&& cb) {
m_mouseUpCb = std::move(cb); m_mouseUpCb = std::move(cb);
} }
void SetMouseScrollCallback(std::function<void(CGuiWidget*, const boo::SScrollDelta&, int, int)>&& cb) {
m_mouseScrollCb = std::move(cb);
}
void Update(float dt); void Update(float dt);
void Draw(const CGuiWidgetDrawParms& parms) const; void Draw(const CGuiWidgetDrawParms& parms) const;

View File

@ -15,8 +15,6 @@ CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId mod
xb8_model = sp->GetObj({SBIG('CMDL'), modelId}); xb8_model = sp->GetObj({SBIG('CMDL'), modelId});
} }
std::vector<CAssetId> CGuiModel::GetModelAssets() const { return {xc8_modelId}; }
bool CGuiModel::GetIsFinishedLoadingWidgetSpecific() const { bool CGuiModel::GetIsFinishedLoadingWidgetSpecific() const {
if (!xb8_model) if (!xb8_model)
return true; return true;

View File

@ -16,7 +16,8 @@ public:
CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag); CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag);
FourCC GetWidgetTypeID() const { return FOURCC('MODL'); } FourCC GetWidgetTypeID() const { return FOURCC('MODL'); }
std::vector<CAssetId> GetModelAssets() const; std::vector<CAssetId> GetModelAssets() const { return {xc8_modelId}; }
const TLockedToken<CModel>& GetModel() const { return xb8_model; }
bool GetIsFinishedLoadingWidgetSpecific() const; bool GetIsFinishedLoadingWidgetSpecific() const;
void Touch() const; void Touch() const;
void Draw(const CGuiWidgetDrawParms& parms) const; void Draw(const CGuiWidgetDrawParms& parms) const;

View File

@ -21,10 +21,9 @@ void CGuiObject::Draw(const CGuiWidgetDrawParms& parms) const {
} }
void CGuiObject::MoveInWorld(const zeus::CVector3f& vec) { void CGuiObject::MoveInWorld(const zeus::CVector3f& vec) {
if (x64_parent) //if (x64_parent)
x64_parent->RotateW2O(vec); // x64_parent->RotateW2O(vec);
x4_localXF.origin += vec; x4_localXF.origin += vec;
Reorthogonalize();
RecalculateTransforms(); RecalculateTransforms();
} }
@ -32,7 +31,6 @@ void CGuiObject::SetLocalPosition(const zeus::CVector3f& pos) { MoveInWorld(pos
void CGuiObject::RotateReset() { void CGuiObject::RotateReset() {
x4_localXF.basis = zeus::CMatrix3f::skIdentityMatrix3f; x4_localXF.basis = zeus::CMatrix3f::skIdentityMatrix3f;
Reorthogonalize();
RecalculateTransforms(); RecalculateTransforms();
} }
@ -46,7 +44,6 @@ zeus::CVector3f CGuiObject::RotateTranslateW2O(const zeus::CVector3f& vec) const
void CGuiObject::MultiplyO2P(const zeus::CTransform& xf) { void CGuiObject::MultiplyO2P(const zeus::CTransform& xf) {
x4_localXF = xf * x4_localXF; x4_localXF = xf * x4_localXF;
Reorthogonalize();
RecalculateTransforms(); RecalculateTransforms();
} }
@ -112,14 +109,6 @@ void CGuiObject::RecalculateTransforms() {
x68_child->RecalculateTransforms(); x68_child->RecalculateTransforms();
} }
void CGuiObject::Reorthogonalize() {
static bool Global = false;
if (Global) {
x4_localXF.orthonormalize();
RecalculateTransforms();
}
}
void CGuiObject::SetO2WTransform(const zeus::CTransform& xf) { void CGuiObject::SetO2WTransform(const zeus::CTransform& xf) {
x4_localXF = GetParent()->x34_worldXF.inverse() * xf; x4_localXF = GetParent()->x34_worldXF.inverse() * xf;
RecalculateTransforms(); RecalculateTransforms();

View File

@ -40,7 +40,6 @@ public:
CGuiObject* GetChildObject() const { return x68_child; } CGuiObject* GetChildObject() const { return x68_child; }
CGuiObject* GetNextSibling() const { return x6c_nextSibling; } CGuiObject* GetNextSibling() const { return x6c_nextSibling; }
void RecalculateTransforms(); void RecalculateTransforms();
void Reorthogonalize();
void SetO2WTransform(const zeus::CTransform& xf); void SetO2WTransform(const zeus::CTransform& xf);
void SetLocalTransform(const zeus::CTransform& xf); void SetLocalTransform(const zeus::CTransform& xf);
}; };

View File

@ -1,5 +1,6 @@
#include "CGuiSliderGroup.hpp" #include "CGuiSliderGroup.hpp"
#include "Input/CFinalInput.hpp" #include "Input/CFinalInput.hpp"
#include "CGuiModel.hpp"
namespace urde { namespace urde {
@ -30,7 +31,42 @@ void CGuiSliderGroup::StartIncreasing() {
xf4_24_inputPending = true; xf4_24_inputPending = true;
} }
bool CGuiSliderGroup::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& point) const {
if (xcc_sliderRangeWidgets[0]->GetWidgetTypeID() != FOURCC('MODL'))
return false;
CGuiModel* bar = static_cast<CGuiModel*>(xcc_sliderRangeWidgets[0]);
auto& modelTok = bar->GetModel();
if (!modelTok || !modelTok.IsLoaded())
return false;
const zeus::CVector3f& s0 = xcc_sliderRangeWidgets[0]->GetIdlePosition();
const zeus::CVector3f& s1 = xcc_sliderRangeWidgets[1]->GetIdlePosition();
zeus::CVector3f backupPos = bar->GetLocalPosition();
bar->SetLocalPosition(s0);
zeus::CVector2f p0 = vp.multiplyOneOverW(bar->GetWorldPosition()).toVec2f();
auto aabb = modelTok->GetAABB().getTransformedAABox(bar->GetWorldTransform());
bar->SetLocalPosition(s1);
zeus::CVector2f p1 = vp.multiplyOneOverW(bar->GetWorldPosition()).toVec2f();
aabb.accumulateBounds(modelTok->GetAABB().getTransformedAABox(bar->GetWorldTransform()));
bar->SetLocalPosition(backupPos);
zeus::CVector2f pDelta = p1 - p0;
float magSq = pDelta.magSquared();
float t = 0.f;
if (magSq > 0.00001f)
t = pDelta.dot(point - p0) / magSq;
m_mouseT = zeus::clamp(0.f, t, 1.f);
m_mouseInside = aabb.projectedPointTest(vp, point);
return m_mouseInside;
}
void CGuiSliderGroup::ProcessUserInput(const CFinalInput& input) { void CGuiSliderGroup::ProcessUserInput(const CFinalInput& input) {
if (input.DMouseButton(boo::EMouseButton::Primary) && m_mouseInside)
m_mouseDown = true;
else if (!input.DMouseButton(boo::EMouseButton::Primary))
m_mouseDown = false;
if (input.DLALeft()) { if (input.DLALeft()) {
StartDecreasing(); StartDecreasing();
return; return;
@ -72,6 +108,11 @@ void CGuiSliderGroup::Update(float dt) {
xc4_curVal = std::min(oldCurVal + t1, upperIncVal); xc4_curVal = std::min(oldCurVal + t1, upperIncVal);
} }
if (m_mouseDown) {
xc4_curVal = m_mouseT * fullRange + xb8_minVal;
xf0_state = EState::MouseMove;
}
if (xc4_curVal == oldCurVal) if (xc4_curVal == oldCurVal)
xf0_state = EState::None; xf0_state = EState::None;

View File

@ -8,7 +8,7 @@ class CSimplePool;
class CGuiSliderGroup : public CGuiCompoundWidget { class CGuiSliderGroup : public CGuiCompoundWidget {
public: public:
enum class EState { None, Decreasing, Increasing }; enum class EState { None, Decreasing, Increasing, MouseMove };
private: private:
float xb8_minVal; float xb8_minVal;
@ -22,10 +22,14 @@ private:
union { union {
struct { struct {
bool xf4_24_inputPending : 1; bool xf4_24_inputPending : 1;
mutable bool m_mouseInside : 1;
bool m_mouseDown : 1;
}; };
u8 _dummy = 0; u32 _dummy = 0;
}; };
mutable float m_mouseT = 0.f;
void StartDecreasing(); void StartDecreasing();
void StartIncreasing(); void StartIncreasing();
@ -47,6 +51,8 @@ public:
void SetCurVal(float cur); void SetCurVal(float cur);
float GetGurVal() const { return xc0_roundedCurVal; } float GetGurVal() const { return xc0_roundedCurVal; }
bool TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& point) const;
void ProcessUserInput(const CFinalInput& input); void ProcessUserInput(const CFinalInput& input);
void Update(float dt); void Update(float dt);

View File

@ -78,6 +78,26 @@ void CGuiTableGroup::SelectWorker(int idx) {
} }
} }
void CGuiTableGroup::DoSelectWorker(int worker) {
if (worker == xc4_userSelection)
return;
if (IsWorkerSelectable(worker)) {
int oldSel = xc4_userSelection;
SelectWorker(worker);
if (x104_doMenuSelChange)
x104_doMenuSelChange(this, oldSel);
}
}
void CGuiTableGroup::SetWorkersMouseActive(bool active) {
CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
while (child) {
if (child->GetWorkerId() != -1)
child->SetMouseActive(active);
child = static_cast<CGuiWidget*>(child->GetNextSibling());
}
}
void CGuiTableGroup::DeactivateWorker(CGuiWidget* widget) { widget->SetIsActive(false); } void CGuiTableGroup::DeactivateWorker(CGuiWidget* widget) { widget->SetIsActive(false); }
void CGuiTableGroup::ActivateWorker(CGuiWidget* widget) { widget->SetIsActive(true); } void CGuiTableGroup::ActivateWorker(CGuiWidget* widget) { widget->SetIsActive(true); }

View File

@ -80,6 +80,10 @@ public:
void SelectWorker(int); void SelectWorker(int);
void DoSelectWorker(int);
void SetWorkersMouseActive(bool);
void ProcessUserInput(const CFinalInput& input); void ProcessUserInput(const CFinalInput& input);
bool AddWorkerWidget(CGuiWidget* worker) { return true; } bool AddWorkerWidget(CGuiWidget* worker) { return true; }

View File

@ -3,6 +3,7 @@
#include "IOStreams.hpp" #include "IOStreams.hpp"
#include "CGuiObject.hpp" #include "CGuiObject.hpp"
#include "zeus/CColor.hpp" #include "zeus/CColor.hpp"
#include "boo/IWindow.hpp"
namespace urde { namespace urde {
class CGuiFrame; class CGuiFrame;
@ -70,6 +71,9 @@ protected:
bool xb7_25_ : 1; bool xb7_25_ : 1;
bool m_mouseActive : 1; bool m_mouseActive : 1;
std::experimental::optional<boo::SScrollDelta> m_lastScroll;
boo::SScrollDelta m_integerScroll;
public: public:
CGuiWidget(const CGuiWidgetParms& parms); CGuiWidget(const CGuiWidgetParms& parms);

View File

@ -122,7 +122,7 @@ CFinalInput::CFinalInput(int cIdx, float dt, const CKeyboardMouseControllerData&
, x2d_b24_DPRight(data.m_specialKeys[int(boo::ESpecialKey::Right)]) , x2d_b24_DPRight(data.m_specialKeys[int(boo::ESpecialKey::Right)])
, x2d_b25_DPDown(data.m_specialKeys[int(boo::ESpecialKey::Down)]) , x2d_b25_DPDown(data.m_specialKeys[int(boo::ESpecialKey::Down)])
, x2d_b26_DPLeft(data.m_specialKeys[int(boo::ESpecialKey::Left)]) , x2d_b26_DPLeft(data.m_specialKeys[int(boo::ESpecialKey::Left)])
, x2d_b27_Start(data.m_specialKeys[int(boo::ESpecialKey::Esc)]) , x2d_b27_Start(false)
, x2d_b28_PA(DA() && !prevInput.DA()) , x2d_b28_PA(DA() && !prevInput.DA())
, x2d_b29_PB(DB() && !prevInput.DB()) , x2d_b29_PB(DB() && !prevInput.DB())
, x2d_b30_PX(DX() && !prevInput.DX()) , x2d_b30_PX(DX() && !prevInput.DX())

View File

@ -120,7 +120,7 @@ CIOWin::EMessageReturn CMFGame::OnMessage(const CArchitectureMessage& msg, CArch
if (input.ControllerIdx() == 0) { if (input.ControllerIdx() == 0) {
const CEntity* cam = x14_stateManager->GetCameraManager()->GetCurrentCamera(*x14_stateManager); const CEntity* cam = x14_stateManager->GetCameraManager()->GetCurrentCamera(*x14_stateManager);
TCastToConstPtr<CCinematicCamera> cineCam = cam; 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) { if (cineCam && x14_stateManager->GetSkipCinematicSpecialFunction() != kInvalidUniqueId) {
CMidiManager::StopAll(); CMidiManager::StopAll();
x28_skippedCineCam = cineCam->GetUniqueId(); x28_skippedCineCam = cineCam->GetUniqueId();

View File

@ -38,6 +38,7 @@ void COptionsScreen::UpdateOptionView() {
x190_tablegroup_double->SetUserSelection(CGameOptions::GetOption(opt.option)); x190_tablegroup_double->SetUserSelection(CGameOptions::GetOption(opt.option));
x190_tablegroup_double->SetIsVisible(true); x190_tablegroup_double->SetIsVisible(true);
x190_tablegroup_double->SetIsActive(true); x190_tablegroup_double->SetIsActive(true);
x190_tablegroup_double->SetWorkersMouseActive(true);
UpdateSideTable(x190_tablegroup_double); UpdateSideTable(x190_tablegroup_double);
x190_tablegroup_double->SetLocalPosition(x48_tableDoubleStart + zeus::CVector3f(0.f, 0.f, zOff)); x190_tablegroup_double->SetLocalPosition(x48_tableDoubleStart + zeus::CVector3f(0.f, 0.f, zOff));
break; break;
@ -45,12 +46,15 @@ void COptionsScreen::UpdateOptionView() {
x194_tablegroup_triple->SetUserSelection(CGameOptions::GetOption(opt.option)); x194_tablegroup_triple->SetUserSelection(CGameOptions::GetOption(opt.option));
x194_tablegroup_triple->SetIsVisible(true); x194_tablegroup_triple->SetIsVisible(true);
x194_tablegroup_triple->SetIsActive(true); x194_tablegroup_triple->SetIsActive(true);
x194_tablegroup_triple->SetWorkersMouseActive(true);
UpdateSideTable(x194_tablegroup_triple); UpdateSideTable(x194_tablegroup_triple);
x194_tablegroup_triple->SetLocalPosition(x54_tableTripleStart + zeus::CVector3f(0.f, 0.f, zOff)); x194_tablegroup_triple->SetLocalPosition(x54_tableTripleStart + zeus::CVector3f(0.f, 0.f, zOff));
break; break;
default: default:
break; break;
} }
x174_textpane_body->SetMouseActive(false);
} }
void COptionsScreen::ResetOptionWidgetVisibility() { void COptionsScreen::ResetOptionWidgetVisibility() {
@ -58,8 +62,11 @@ void COptionsScreen::ResetOptionWidgetVisibility() {
x18c_slidergroup_slider->SetVisibility(false, ETraversalMode::Children); x18c_slidergroup_slider->SetVisibility(false, ETraversalMode::Children);
x190_tablegroup_double->SetIsVisible(false); x190_tablegroup_double->SetIsVisible(false);
x190_tablegroup_double->SetIsActive(false); x190_tablegroup_double->SetIsActive(false);
x190_tablegroup_double->SetWorkersMouseActive(false);
x194_tablegroup_triple->SetIsActive(false); x194_tablegroup_triple->SetIsActive(false);
x194_tablegroup_triple->SetIsVisible(false); x194_tablegroup_triple->SetIsVisible(false);
x194_tablegroup_triple->SetWorkersMouseActive(false);
x174_textpane_body->SetMouseActive(true);
} }
void COptionsScreen::OnSliderChanged(CGuiSliderGroup* caller, float val) { 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_lClicked = false;
m_rClicked = false; m_rClicked = false;
CFinalInput useInput = input;
bool bExits = false; bool bExits = false;
if (std::unique_ptr<CPauseScreenBase>& curScreen = x7c_screens[x78_activeIdx]) { if (std::unique_ptr<CPauseScreenBase>& curScreen = x7c_screens[x78_activeIdx]) {
float yOff = 0.f; float yOff = 0.f;
if (curScreen->CanDraw()) if (curScreen->CanDraw())
yOff = curScreen->GetCameraYBias(); yOff = curScreen->GetCameraYBias();
CGuiWidgetDrawParms parms(1.f, zeus::CVector3f{0.f, 15.f * yOff, 0.f}); 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) if (curScreen->GetMode() == CPauseScreenBase::EMode::LeftTable)
bExits = true; bExits = true;
curScreen->ProcessControllerInput(input); curScreen->ProcessControllerInput(useInput);
} }
if (InputEnabled()) { if (InputEnabled()) {
bool invalid = x8_curSubscreen == ESubScreen::ToGame; bool invalid = x8_curSubscreen == ESubScreen::ToGame;
if (input.PStart() || m_returnClicked || if (useInput.PStart() ||
((input.PB() || m_backClicked || input.PSpecialKey(boo::ESpecialKey::Esc)) && bExits) || ((useInput.PB() || useInput.PSpecialKey(boo::ESpecialKey::Esc)) && bExits) ||
(x7c_screens[x78_activeIdx] && x7c_screens[x78_activeIdx]->ShouldExitPauseScreen())) { (x7c_screens[x78_activeIdx] && x7c_screens[x78_activeIdx]->ShouldExitPauseScreen())) {
CSfxManager::SfxStart(SFXui_pause_screen_exit, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(SFXui_pause_screen_exit, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
StartTransition(0.5f, mgr, ESubScreen::ToGame, 2); StartTransition(0.5f, mgr, ESubScreen::ToGame, 2);
} else { } 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); CSfxManager::SfxStart(SFXui_pause_screen_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
StartTransition(0.5f, mgr, GetPreviousSubscreen(x8_curSubscreen), invalid ? 2 : 0); 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); CSfxManager::SfxStart(SFXui_pause_screen_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
StartTransition(0.5f, mgr, GetNextSubscreen(x8_curSubscreen), invalid ? 2 : 1); 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( 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( 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( 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( 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( 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() { void CPauseScreen::TransitionComplete() {

View File

@ -17,6 +17,7 @@ CPauseScreenBase::CPauseScreenBase(const CStateManager& mgr, CGuiFrame& frame, c
bool isLogBook) bool isLogBook)
: x4_mgr(mgr), x8_frame(frame), xc_pauseStrg(pauseStrg) { : x4_mgr(mgr), x8_frame(frame), xc_pauseStrg(pauseStrg) {
m_isLogBook = isLogBook; m_isLogBook = isLogBook;
m_playRightTableSfx = true;
InitializeFrameGlue(); InitializeFrameGlue();
} }
@ -42,7 +43,9 @@ void CPauseScreenBase::InitializeFrameGlue() {
x98_model_scrollleftup = static_cast<CGuiModel*>(x8_frame.FindWidget("model_scrollleftup")); x98_model_scrollleftup = static_cast<CGuiModel*>(x8_frame.FindWidget("model_scrollleftup"));
x9c_model_scrollleftdown = static_cast<CGuiModel*>(x8_frame.FindWidget("model_scrollleftdown")); 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 = 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 = 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 = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_title"));
x178_textpane_title->TextSupport().SetFontColor(g_tweakGuiColors->GetPauseItemAmberColor()); x178_textpane_title->TextSupport().SetFontColor(g_tweakGuiColors->GetPauseItemAmberColor());
x174_textpane_body = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_body")); 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->TextSupport().SetText(xc_pauseStrg.GetString(99));
x188_textpane_ytext->SetColor(g_tweakGuiColors->GetPauseItemAmberColor()); x188_textpane_ytext->SetColor(g_tweakGuiColors->GetPauseItemAmberColor());
x18c_slidergroup_slider = static_cast<CGuiSliderGroup*>(x8_frame.FindWidget("slidergroup_slider")); 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")); x190_tablegroup_double = static_cast<CGuiTableGroup*>(x8_frame.FindWidget("tablegroup_double"));
x194_tablegroup_triple = static_cast<CGuiTableGroup*>(x8_frame.FindWidget("tablegroup_triple")); x194_tablegroup_triple = static_cast<CGuiTableGroup*>(x8_frame.FindWidget("tablegroup_triple"));
@ -145,6 +149,8 @@ void CPauseScreenBase::InitializeFrameGlue() {
x194_tablegroup_triple->SetIsVisible(false); x194_tablegroup_triple->SetIsVisible(false);
x190_tablegroup_double->SetVertical(false); x190_tablegroup_double->SetVertical(false);
x194_tablegroup_triple->SetVertical(false); x194_tablegroup_triple->SetVertical(false);
x190_tablegroup_double->SetWorkersMouseActive(false);
x194_tablegroup_triple->SetWorkersMouseActive(false);
x70_tablegroup_leftlog->SetMenuAdvanceCallback( x70_tablegroup_leftlog->SetMenuAdvanceCallback(
std::bind(&CPauseScreenBase::OnLeftTableAdvance, this, std::placeholders::_1)); std::bind(&CPauseScreenBase::OnLeftTableAdvance, this, std::placeholders::_1));
@ -162,6 +168,9 @@ void CPauseScreenBase::InitializeFrameGlue() {
x8_frame.SetMouseUpCallback(std::bind(&CPauseScreenBase::OnWidgetMouseUp, this, x8_frame.SetMouseUpCallback(std::bind(&CPauseScreenBase::OnWidgetMouseUp, this,
std::placeholders::_1, std::placeholders::_2)); 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() { bool CPauseScreenBase::IsReady() {
@ -345,7 +354,7 @@ void CPauseScreenBase::UpdateRightTable() {
void CPauseScreenBase::SetRightTableSelection(int oldSel, int newSel) { void CPauseScreenBase::SetRightTableSelection(int oldSel, int newSel) {
int oldRightSel = x1c_rightSel; int oldRightSel = x1c_rightSel;
x1c_rightSel = zeus::clamp(0, x1c_rightSel + (newSel - oldSel), int(GetRightTableCount()) - 1); 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); CSfxManager::SfxStart(SFXui_table_selection_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
if (x1c_rightSel < x18_firstViewRightSel) if (x1c_rightSel < x18_firstViewRightSel)
@ -425,10 +434,11 @@ void CPauseScreenBase::OnWidgetMouseUp(CGuiWidget* widget, bool cancel) {
/* Simulate selection change */ /* Simulate selection change */
int oldSel = x84_tablegroup_rightlog->GetUserSelection(); int oldSel = x84_tablegroup_rightlog->GetUserSelection();
x84_tablegroup_rightlog->SelectWorker(idx); x84_tablegroup_rightlog->SelectWorker(idx);
m_playRightTableSfx = !ShouldRightTableAdvance();
OnTableSelectionChange(x84_tablegroup_rightlog, oldSel); OnTableSelectionChange(x84_tablegroup_rightlog, oldSel);
m_playRightTableSfx = true;
/* Simulate change to text scroll if able */ /* Simulate change to text scroll if able */
if (ShouldRightTableAdvance()) OnRightTableAdvance(nullptr);
ChangeMode(EMode::TextScroll, false);
} }
} else if (widget == x174_textpane_body) { } else if (widget == x174_textpane_body) {
m_bodyClicked = true; m_bodyClicked = true;
@ -436,6 +446,66 @@ void CPauseScreenBase::OnWidgetMouseUp(CGuiWidget* widget, bool cancel) {
m_bodyUpClicked = true; m_bodyUpClicked = true;
} else if (widget == x94_model_textarrowbottom) { } else if (widget == x94_model_textarrowbottom) {
m_bodyDownClicked = true; 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_bodyUpClicked : 1;
bool m_bodyDownClicked : 1; bool m_bodyDownClicked : 1;
bool m_bodyClicked : 1; bool m_bodyClicked : 1;
bool m_playRightTableSfx : 1;
}; };
u32 _dummy = 0; u32 _dummy = 0;
}; };
@ -96,6 +97,7 @@ protected:
void OnRightTableCancel(CGuiTableGroup* caller); void OnRightTableCancel(CGuiTableGroup* caller);
void OnWidgetMouseUp(CGuiWidget* widget, bool cancel); void OnWidgetMouseUp(CGuiWidget* widget, bool cancel);
void OnWidgetScroll(CGuiWidget* widget, const boo::SScrollDelta& delta, int accumX, int accumY);
public: public:
static std::string GetImagePaneName(u32 i); static std::string GetImagePaneName(u32 i);

2
hecl

@ -1 +1 @@
Subproject commit 296d8733c21e7e9276af44cdafdd63f44856975b Subproject commit bd8021e1042944581a77ae5698784f5960880960