Skip to content

Commit

Permalink
Switch console on/off on engine start only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Oct 19, 2023
1 parent a6016f1 commit f1bd1ab
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/xrEngine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ ENGINE_API void Startup()
TaskScheduler->Wait(createApplication);
TaskScheduler->Wait(createSpatialSpace);

Console->Show();

g_pGamePersistent = dynamic_cast<IGame_Persistent*>(NEW_INSTANCE(CLSID_GAME_PERSISTANT));
R_ASSERT(g_pGamePersistent || Engine.External.CanSkipGameModuleLoading());
if (!g_pGamePersistent)
Console->Show();

// Main cycle
Device.Run();
Expand Down
4 changes: 3 additions & 1 deletion src/xrEngine/x_ray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ void CApplication::OnEvent(EVENT E, u64 P1, u64 P2)

if (g_pGameLevel)
{
const bool show = Console->bVisible;
Console->Hide();
g_pGameLevel->net_Stop();
DEL_INSTANCE(g_pGameLevel);
Console->Show();
if (show)
Console->Show();

if ((false == Engine.Event.Peek("KERNEL:quit")) && (false == Engine.Event.Peek("KERNEL:start")))
{
Expand Down
2 changes: 0 additions & 2 deletions src/xrGame/GamePersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ void CGamePersistent::start_logo_intro()
if (!allow_intro())
{
m_intro_event = nullptr;
Console->Show();
Console->Execute("main_menu on");
return;
}
Expand All @@ -450,7 +449,6 @@ void CGamePersistent::start_logo_intro()
m_intro = xr_new<CUISequencer>();
m_intro->m_on_destroy_event.bind(this, &CGamePersistent::update_logo_intro);
m_intro->Start("intro_logo");
Console->Hide();
}
}
}
Expand Down
10 changes: 3 additions & 7 deletions src/xrGame/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,13 @@ void CMainMenu::Activate(bool bActivate)

Device.seqRender.Remove(this);

bool b = !!Console->bVisible;
if (b)
{
const bool show = Console->bVisible;
if (show)
Console->Hide();
}

IR_Release();
if (b)
{
if (show)
Console->Show();
}

if (m_startDialog->IsShown())
m_startDialog->HideDialog();
Expand Down

0 comments on commit f1bd1ab

Please sign in to comment.