From 5b5eb0b2c0da1898b4b1a8922c14c0ede25f71e5 Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Fri, 22 Oct 2010 17:29:46 +0200 Subject: [PATCH] ingame browser added (config: cl_serverbrowser, hotkey: ctrl+shift+b --- src/engine/client/client.cpp | 5 +++++ src/engine/shared/config_variables.h | 1 + src/game/client/components/menus.cpp | 13 ++++++++----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index f9fa7f7b0..e7ae144e9 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -540,6 +540,8 @@ void CClient::DisconnectWithReason(const char *pReason) // stop demo playback and recorder m_DemoPlayer.Stop(); m_DemoRecorder.Stop(); + + g_Config.m_ClServerBrowser = 0; // m_RconAuthed = 0; @@ -1721,6 +1723,9 @@ void CClient::Run() g_Config.m_ClEditor = g_Config.m_ClEditor^1; Input()->MouseModeRelative(); } + + if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('b')) + g_Config.m_ClServerBrowser ^= 1; /* if(!gfx_window_open()) diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 327ed52b0..7d4e09307 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -14,6 +14,7 @@ MACRO_CONFIG_INT(ConsoleOutputLevel, console_output_level, 0, 0, 2, CFGFLAG_CLIE MACRO_CONFIG_INT(ClCpuThrottle, cl_cpu_throttle, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "", -1) MACRO_CONFIG_INT(ClEditor, cl_editor, 0, 0, 1, CFGFLAG_CLIENT, "", -1) +MACRO_CONFIG_INT(ClServerBrowser, cl_serverbrowser, 0, 0, 1, CFGFLAG_CLIENT, "Whether to force the server browser", -1) MACRO_CONFIG_INT(ClEventthread, cl_eventthread, 0, 0, 1, CFGFLAG_CLIENT, "Enables the usage of a thread to pump the events", -1) diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 1e52fbcfe..c1a0b31c3 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -796,7 +796,7 @@ int CMenus::Render() s_First = false; } - if(Client()->State() == IClient::STATE_ONLINE) + if(Client()->State() == IClient::STATE_ONLINE && !g_Config.m_ClServerBrowser) { ms_ColorTabbarInactive = ms_ColorTabbarInactiveIngame; ms_ColorTabbarActive = ms_ColorTabbarActiveIngame; @@ -829,7 +829,7 @@ int CMenus::Render() } // render current page - if(Client()->State() != IClient::STATE_OFFLINE) + if(Client()->State() != IClient::STATE_OFFLINE && !g_Config.m_ClServerBrowser) { if(m_GamePage == PAGE_GAME) RenderGame(MainView); @@ -1072,7 +1072,7 @@ void CMenus::SetActive(bool Active) m_NeedSendinfo = false; } - if(Client()->State() == IClient::STATE_ONLINE) + if(Client()->State() == IClient::STATE_ONLINE && !g_Config.m_ClServerBrowser) { m_pClient->OnRelease(); } @@ -1187,7 +1187,7 @@ void CMenus::OnRender() Graphics()->QuadsDrawTL(60, 60, 5000, 5000); Graphics()->QuadsEnd(); return;*/ - + if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK) SetActive(true); @@ -1197,6 +1197,9 @@ void CMenus::OnRender() Graphics()->MapScreen(Screen.x, Screen.y, Screen.w, Screen.h); RenderDemoPlayer(Screen); } + + if(g_Config.m_ClServerBrowser) + SetActive(true); if(Client()->State() == IClient::STATE_ONLINE && m_pClient->m_ServerMode == m_pClient->SERVERMODE_PUREMOD) { @@ -1251,7 +1254,7 @@ void CMenus::OnRender() UI()->Update(mx,my,mx*3.0f,my*3.0f,Buttons); // render - if(Client()->State() != IClient::STATE_DEMOPLAYBACK) + if(Client()->State() != IClient::STATE_DEMOPLAYBACK || g_Config.m_ClServerBrowser) Render(); // render cursor