MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ProcessEvent

Method ProcessEvent

neo/framework/Console.cpp:804–879  ·  view source on GitHub ↗

============== ProcessEvent ============== */

Source from the content-addressed store, hash-verified

802==============
803*/
804bool idConsoleLocal::ProcessEvent( const sysEvent_t *event, bool forceAccept ) {
805 bool consoleKey = false;
806 if(event->evType == SE_KEY)
807 {
808 bool shiftPressed = idKeyInput::IsDown( K_SHIFT );
809 if( event->evValue == K_CONSOLE || event->evValue == Sys_GetConsoleKey( shiftPressed )
810 || (event->evValue == K_ESCAPE && shiftPressed) ) // shift+esc should also open console
811 {
812 consoleKey = true;
813 }
814 }
815
816#if ID_CONSOLE_LOCK
817 // If the console's not already down, and we have it turned off, check for ctrl+alt
818 if ( !keyCatching && !com_allowConsole.GetBool() ) {
819 if ( !idKeyInput::IsDown( K_CTRL ) || !idKeyInput::IsDown( K_ALT ) ) {
820 consoleKey = false;
821 }
822 }
823#endif
824
825 // we always catch the console key event
826 if ( !forceAccept && consoleKey ) {
827 // ignore up events
828 if ( event->evValue2 == 0 ) {
829 return true;
830 }
831
832 consoleField.ClearAutoComplete();
833
834 // a down event will toggle the destination lines
835 if ( keyCatching ) {
836 Close();
837 cvarSystem->SetCVarBool( "ui_chat", false );
838 } else {
839 consoleField.Clear();
840 keyCatching = true;
841 if ( idKeyInput::IsDown( K_SHIFT ) && event->evValue != K_ESCAPE ) {
842 // if the shift key is down, don't open the console as much
843 // except we used shift+esc.
844 SetDisplayFraction( 0.2f );
845 } else {
846 SetDisplayFraction( 0.5f );
847 }
848 cvarSystem->SetCVarBool( "ui_chat", true );
849 }
850 return true;
851 }
852
853 // if we aren't key catching, dump all the other events
854 if ( !forceAccept && !keyCatching ) {
855 return false;
856 }
857
858 // handle key and character events
859 if ( event->evType == SE_CHAR ) {
860 // never send the console key as a character
861 if ( event->evValue != Sys_GetConsoleKey( idKeyInput::IsDown( K_SHIFT ) ) ) {

Callers

nothing calls this directly

Calls 6

Sys_GetConsoleKeyFunction · 0.85
ClearAutoCompleteMethod · 0.80
SetCVarBoolMethod · 0.80
CharEventMethod · 0.80
GetBoolMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected