From a16c1eb84c441f437b270e97e0069d96db8da5a0 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Wed, 15 Jan 2025 00:03:46 +0300 Subject: [PATCH] Support map and contacts hotkeys (#392) General exit from PDA when using kACTIVE_JOBS binding (P key on the keyboard) is now handled in CUIGameSP, like in SOC/CS --- src/xrGame/UIGameCustom.cpp | 11 ++++++----- src/xrGame/UIGameSP.cpp | 18 ++++++++++++++++++ src/xrGame/ui/UIGameTutorialSimpleItem.cpp | 2 +- src/xrGame/ui/UIPdaWnd.cpp | 22 ++++++++++++++++++---- src/xrGame/ui/UIPdaWnd.h | 2 ++ 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/xrGame/UIGameCustom.cpp b/src/xrGame/UIGameCustom.cpp index 6b3106cdba3..d6ae2255db6 100644 --- a/src/xrGame/UIGameCustom.cpp +++ b/src/xrGame/UIGameCustom.cpp @@ -226,13 +226,14 @@ void CUIGameCustom::ShowMessagesWindow() bool CUIGameCustom::ShowPdaMenu() { - HideActorMenu(); - if (!PdaMenu->IsShown()) + if (PdaMenu->IsShown()) { - PdaMenu->ShowDialog(true); - return true; + PdaMenu->HideDialog(); + return false; } - return false; + HideActorMenu(); + PdaMenu->ShowDialog(true); + return true; } void CUIGameCustom::HidePdaMenu() diff --git a/src/xrGame/UIGameSP.cpp b/src/xrGame/UIGameSP.cpp index 7399921e8b2..1563a41e5cd 100644 --- a/src/xrGame/UIGameSP.cpp +++ b/src/xrGame/UIGameSP.cpp @@ -125,6 +125,24 @@ bool CUIGameSP::IR_UIOnKeyboardPress(int dik) ShowPdaMenu(); break; } + case kMAP: + { + if (!pActor->inventory_disabled()) + { + PdaMenu->Show_MapWnd(true); + ShowPdaMenu(); + } + break; + } + case kCONTACTS: + { + if (!pActor->inventory_disabled()) + { + PdaMenu->Show_ContactsWnd(true); + ShowPdaMenu(); + } + break; + } case kINVENTORY: { if (!pActor->inventory_disabled()) diff --git a/src/xrGame/ui/UIGameTutorialSimpleItem.cpp b/src/xrGame/ui/UIGameTutorialSimpleItem.cpp index 83184d000d8..b197f67be87 100644 --- a/src/xrGame/ui/UIGameTutorialSimpleItem.cpp +++ b/src/xrGame/ui/UIGameTutorialSimpleItem.cpp @@ -270,7 +270,7 @@ void CUISequenceSimpleItem::Start() CUIPdaWnd& pda = ui_game_sp->GetPdaMenu(); if (!xr_stricmp(m_pda_section, "pda_map")) { - pda.SetActiveSubdialog("eptMap"); + pda.Show_MapWnd(true); bShowPda = true; } else if (!xr_stricmp(m_pda_section, "pda_tasks")) diff --git a/src/xrGame/ui/UIPdaWnd.cpp b/src/xrGame/ui/UIPdaWnd.cpp index ea12fa10ad7..8ff9c683e01 100644 --- a/src/xrGame/ui/UIPdaWnd.cpp +++ b/src/xrGame/ui/UIPdaWnd.cpp @@ -329,6 +329,24 @@ void CUIPdaWnd::Show_SecondTaskWnd(bool status) } } +void CUIPdaWnd::Show_MapWnd(bool status) +{ + if (pUIMapWnd) + { + if (status) + SetActiveSubdialog("eptMap"); + } +} + +void CUIPdaWnd::Show_ContactsWnd(bool status) +{ + if (true) // XXX: replace with contacts wnd pointer + { + if (status) + SetActiveSubdialog("eptContacts"); + } +} + void CUIPdaWnd::Draw() { inherited::Draw(); @@ -433,15 +451,11 @@ bool CUIPdaWnd::OnKeyboardAction(int dik, EUIMessages keyboard_action) UITabControl->SetNextActiveTab(true, true); return true; - hide_pda: case kUI_BACK: if (WINDOW_KEY_PRESSED == keyboard_action) HideDialog(); return true; } - if (IsBinded(kACTIVE_JOBS, dik)) - goto hide_pda; - return false; } diff --git a/src/xrGame/ui/UIPdaWnd.h b/src/xrGame/ui/UIPdaWnd.h index c2b4ac9b1fe..dac3f76be33 100644 --- a/src/xrGame/ui/UIPdaWnd.h +++ b/src/xrGame/ui/UIPdaWnd.h @@ -76,6 +76,8 @@ class CUIPdaWnd final : public CUIDialogWnd void SetActiveCaption(); void SetCaption(pcstr text); void Show_SecondTaskWnd(bool status); + void Show_MapWnd(bool status); + void Show_ContactsWnd(bool status); void SetActiveDialog(CUIWindow* wnd) { m_pActiveDialog = wnd; } CUIWindow* GetActiveDialog() const { return m_pActiveDialog; }