From 9ccce9b4b67956d90b124d97d4b64e1ec8e5a411 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Mon, 25 Mar 2024 02:31:07 +0100 Subject: [PATCH] in_namePressed: Only print key name on down events; document it --- Configuration.md | 3 +++ neo/framework/KeyInput.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Configuration.md b/Configuration.md index 58aca74c..5c1ceb29 100644 --- a/Configuration.md +++ b/Configuration.md @@ -159,6 +159,9 @@ This can be configured with the following CVars: from the OS like Alt-Tab or Windows Key won't work and thus not accidentally interrupt your playing. Defaults to `0`. +- `in_namePressed` if set to `1`, the currently pressed key/button (on keyboard/mouse/gamepad) + is printed to the console - useful when setting key-bindings in the console or a config. Default is `0`. + - `in_kbd` allows you to set your keyboard layout so the console key works better. Mostly useful with SDL1.2 - `in_tty` tab completion and history for input from the **terminal** (on Unix-likes, like Linux, macOS, BSD, ...) diff --git a/neo/framework/KeyInput.cpp b/neo/framework/KeyInput.cpp index 76e423d8..71c033bf 100644 --- a/neo/framework/KeyInput.cpp +++ b/neo/framework/KeyInput.cpp @@ -760,8 +760,8 @@ Called by the system for both key up and key down events void idKeyInput::PreliminaryKeyEvent( int keynum, bool down ) { keys[keynum].down = down; - if( cvarSystem->GetCVarBool( "in_namePressed") ) { - KeyReveal( keynum ); + if( down && in_namePressed.GetBool() ) { + KeyReveal( keynum ); } #ifdef ID_DOOM_LEGACY @@ -789,8 +789,8 @@ simple print in the console the name of the key pressed =================== */ void idKeyInput::KeyReveal( int keyNum ) { - const char* keyName = KeyNumToString( keyNum, false ); - common->Printf( "pressed the \"%s\" key.\n", keyName ); + const char* keyName = KeyNumToString( keyNum, false ); + common->Printf( "pressed the \"%s\" key.\n", keyName ); } /*