=================== Key_Bind_f =================== */
| 1011 | =================== |
| 1012 | */ |
| 1013 | void 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 | ============ |
nothing calls this directly
no test coverage detected