X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_console.pas;h=6757bfc51e5bd72f0bc99f7d4f878c7aa31e19b8;hb=4f08d1293d9a8d5814ec24b45be088d04247f5c8;hp=21616113c92c9571a8a44e6e088c6203c81552c9;hpb=d92a9e2807dda8a533def35afa801ed975920885;p=d2df-sdl.git diff --git a/src/game/g_console.pas b/src/game/g_console.pas index 2161611..6757bfc 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -702,8 +702,13 @@ begin 'hidekeyboard': g_Touch_ShowKeyboard(False); 'togglemenu': + if gConsoleShow then + begin + g_Console_Switch; + menu_toggled := True + end + else begin - // this is HACK KeyPress(VK_ESCAPE); menu_toggled := True end; @@ -1378,6 +1383,7 @@ begin if g_Console_MatchBind(K, 'togglemenu') then begin + menu_toggled := True; if gChatShow then g_Console_Chat_Switch else if gConsoleShow then @@ -1721,11 +1727,17 @@ end; procedure g_Console_ProcessBind (key: Integer; down: Boolean); var i: Integer; begin - if (not g_GUIGrabInput) and (not gChatShow) and (not gConsoleShow) and (key >= 0) and (key < e_MaxInputKeys) and ((gInputBinds[key].down <> nil) or (gInputBinds[key].up <> nil)) then + if (key >= 0) and (key < e_MaxInputKeys) and ((gInputBinds[key].down <> nil) or (gInputBinds[key].up <> nil)) then begin + // down binds shouldn't be processed when there's no input focus + // however when the user releases a button the bind should still be processed + // to avoid "sticky" buttons if down then - for i := 0 to High(gInputBinds[key].down) do - g_Console_Process(gInputBinds[key].down[i], True) + begin + if (not g_GUIGrabInput) and (not gChatShow) and (not gConsoleShow) then + for i := 0 to High(gInputBinds[key].down) do + g_Console_Process(gInputBinds[key].down[i], True); + end else for i := 0 to High(gInputBinds[key].up) do g_Console_Process(gInputBinds[key].up[i], True) @@ -1787,8 +1799,7 @@ begin g_Console_BindKey(e_JoyButtonToKey(i, 10), 'togglemenu'); end; - // HACK: VK_ESCAPE always used as togglemenu, so don't touch it! - // VK_CONSOLE + g_Console_BindKey(VK_ESCAPE, 'togglemenu'); g_Console_BindKey(VK_LSTRAFE, '+moveleft; +strafe', '-moveleft; -strafe'); g_Console_BindKey(VK_RSTRAFE, '+moveright; +strafe', '-moveright; -strafe'); g_Console_BindKey(VK_LEFT, '+moveleft', '-moveleft');