MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / OnKeyboard

Method OnKeyboard

ogsr_engine/xrGame/ui/UIPdaWnd.cpp:562–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560 }
561}
562bool CUIPdaWnd::OnKeyboard(int dik, EUIMessages keyboard_action)
563{
564 if (WINDOW_KEY_PRESSED == keyboard_action && IsShown())
565 {
566 if (psActorFlags.test(AF_3D_PDA))
567 {
568 CPda* pda = Actor()->GetPDA();
569 if (pda && pda->Is3DPDA())
570 {
571 EGameActions action = get_binded_action(dik);
572
573 if (action == kQUIT) // "Hack" to make Esc key open main menu instead of simply hiding the PDA UI
574 {
575 if (pda->GetState() == CPda::eHiding || pda->GetState() == CPda::eHidden)
576 {
577 Console->Execute("main_menu");
578 return false;
579 }
580 else if (pda->m_bZoomed)
581 {
582 pda->m_bZoomed = false;
583 HUD().GetUI()->SetMainInputReceiver(nullptr, false);
584 return true;
585 }
586 else
587 {
588 Actor()->inventory().Activate(NO_ACTIVE_SLOT);
589 return true;
590 }
591 }
592 }
593 }
594 }
595 return inherited::OnKeyboard(dik, keyboard_action);
596}

Callers

nothing calls this directly

Calls 11

IsShownFunction · 0.85
ActorFunction · 0.85
get_binded_actionFunction · 0.85
GetPDAMethod · 0.80
Is3DPDAMethod · 0.80
SetMainInputReceiverMethod · 0.80
GetUIMethod · 0.80
testMethod · 0.45
GetStateMethod · 0.45
ExecuteMethod · 0.45
ActivateMethod · 0.45

Tested by

no test coverage detected