MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Key_Bind_f

Function Key_Bind_f

code/client/cl_keys.cpp:1013–1036  ·  view source on GitHub ↗

=================== Key_Bind_f =================== */

Source from the content-addressed store, hash-verified

1011===================
1012*/
1013void Key_Bind_f( void ) {
1014 int c = Cmd_Argc();
1015
1016 if ( c < 2 ) {
1017 Com_Printf( "bind <key> [command] : attach a command to a key\n" );
1018 return;
1019 }
1020
1021 int b = Key_StringToKeynum( Cmd_Argv( 1 ) );
1022 if ( b == -1 ) {
1023 Com_Printf( "\"%s\" isn't a valid key\n", Cmd_Argv( 1 ) );
1024 return;
1025 }
1026
1027 if ( c == 2 ) {
1028 if ( kg.keys[b].binding && kg.keys[b].binding[0] )
1029 Com_Printf( S_COLOR_GREY "Bind " S_COLOR_WHITE "%s = " S_COLOR_GREY "\"" S_COLOR_WHITE "%s" S_COLOR_GREY "\"" S_COLOR_WHITE "\n", Key_KeynumToString( b ), kg.keys[b].binding );
1030 else
1031 Com_Printf( "\"%s\" is not bound\n", Key_KeynumToString( b ) );
1032 return;
1033 }
1034
1035 Key_SetBinding( b, Cmd_ArgsFrom( 2 ) );
1036}
1037
1038/*
1039============

Callers

nothing calls this directly

Calls 7

Key_StringToKeynumFunction · 0.70
Key_KeynumToStringFunction · 0.70
Key_SetBindingFunction · 0.70
Cmd_ArgcFunction · 0.50
Com_PrintfFunction · 0.50
Cmd_ArgvFunction · 0.50
Cmd_ArgsFromFunction · 0.50

Tested by

no test coverage detected