Fix: Editor, Debug mode always open immediately

This commit is contained in:
def 2014-01-31 01:41:57 +01:00
parent 2f4820f9ae
commit 3ca4514d21
2 changed files with 22 additions and 4 deletions

View file

@ -1930,6 +1930,11 @@ void CClient::Run()
// process pending commands // process pending commands
m_pConsole->StoreCommands(false); m_pConsole->StoreCommands(false);
bool LastD = false;
bool LastQ = false;
bool LastE = false;
bool LastG = false;
while (1) while (1)
{ {
// //
@ -1980,19 +1985,19 @@ void CClient::Run()
} }
// panic quit button // panic quit button
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyPressed('q')) if(CtrlShiftKey('q', LastQ))
{ {
Quit(); Quit();
break; break;
} }
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('d')) if(CtrlShiftKey('d', LastD))
g_Config.m_Debug ^= 1; g_Config.m_Debug ^= 1;
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('g')) if(CtrlShiftKey('g', LastG))
g_Config.m_DbgGraphs ^= 1; g_Config.m_DbgGraphs ^= 1;
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('e')) if(CtrlShiftKey('e', LastE))
{ {
g_Config.m_ClEditor = g_Config.m_ClEditor^1; g_Config.m_ClEditor = g_Config.m_ClEditor^1;
Input()->MouseModeRelative(); Input()->MouseModeRelative();
@ -2113,6 +2118,18 @@ void CClient::Run()
} }
} }
bool CClient::CtrlShiftKey(int Key, bool &Last)
{
if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && !Last && Input()->KeyPressed(Key))
{
Last = true;
return true;
}
else if (Last && !Input()->KeyPressed(Key))
Last = false;
return false;
}
void CClient::Con_Connect(IConsole::IResult *pResult, void *pUserData) void CClient::Con_Connect(IConsole::IResult *pResult, void *pUserData)
{ {

View file

@ -274,6 +274,7 @@ public:
void Run(); void Run();
bool CtrlShiftKey(int Key, bool &Last);
static void Con_Connect(IConsole::IResult *pResult, void *pUserData); static void Con_Connect(IConsole::IResult *pResult, void *pUserData);
static void Con_Disconnect(IConsole::IResult *pResult, void *pUserData); static void Con_Disconnect(IConsole::IResult *pResult, void *pUserData);