engine: client: handle K_ESCAPE in Key_Console, remove special case for it in Key_Event

This commit is contained in:
Alibek Omarov 2025-02-23 06:47:44 +03:00
parent fe1fd5b024
commit 425cc61c4c
2 changed files with 12 additions and 22 deletions

View file

@ -1467,6 +1467,16 @@ Handles history and console scrollback
*/ */
void Key_Console( int key ) void Key_Console( int key )
{ {
// exit the console by pressing MINUS on NSwitch
// or both Back(Select)/Start buttons for everyone else
if( key == K_BACK_BUTTON || key == K_START_BUTTON || key == K_ESCAPE )
{
if( cls.state == ca_active && !cl.background )
Key_SetKeyDest( key_game );
else UI_SetActiveMenu( true );
return;
}
// ctrl-L clears screen // ctrl-L clears screen
if( key == 'l' && Key_IsDown( K_CTRL )) if( key == 'l' && Key_IsDown( K_CTRL ))
{ {
@ -1575,16 +1585,6 @@ void Key_Console( int key )
return; return;
} }
// exit the console by pressing MINUS on NSwitch
// or both Back(Select)/Start buttons for everyone else
if( key == K_BACK_BUTTON || key == K_START_BUTTON )
{
if( cls.state == ca_active && !cl.background )
Key_SetKeyDest( key_game );
else UI_SetActiveMenu( true );
return;
}
// pass to the normal editline routine // pass to the normal editline routine
Field_KeyDownEvent( &con.input, key ); Field_KeyDownEvent( &con.input, key );
} }

View file

@ -726,18 +726,8 @@ void GAME_EXPORT Key_Event( int key, int down )
return; // handled in client.dll return; // handled in client.dll
} }
break; break;
case key_message: default:
Key_Message( key ); break;
return;
case key_console:
if( cls.state == ca_active && !cl.background )
Key_SetKeyDest( key_game );
else UI_SetActiveMenu( true );
return;
case key_menu:
UI_KeyEvent( key, true );
return;
default: return;
} }
} }