Skip to content

Commit

Permalink
Support map and contacts hotkeys (#392)
Browse files Browse the repository at this point in the history
General exit from PDA when using kACTIVE_JOBS binding (P key on the keyboard) is now handled in CUIGameSP, like in SOC/CS
  • Loading branch information
Xottab-DUTY committed Jan 14, 2025
1 parent 70ebced commit a16c1eb
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/xrGame/UIGameCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 18 additions & 0 deletions src/xrGame/UIGameSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ui/UIGameTutorialSimpleItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
22 changes: 18 additions & 4 deletions src/xrGame/ui/UIPdaWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions src/xrGame/ui/UIPdaWnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit a16c1eb

Please sign in to comment.