29 #include "../idlib/precompiled.h"
39 static const char unnamedkeys[] =
"*,-=./[\\]1234567890abcdefghijklmnopqrstuvwxyz";
48 {
"TAB",
K_TAB,
"#str_07018"},
49 {
"ENTER",
K_ENTER,
"#str_07019"},
51 {
"SPACE",
K_SPACE,
"#str_07021"},
58 {
"ALT",
K_ALT,
"#str_07027"},
60 {
"CTRL",
K_CTRL,
"#str_07028"},
61 {
"SHIFT",
K_SHIFT,
"#str_07029"},
63 {
"LWIN",
K_LWIN,
"#str_07030"},
64 {
"RWIN",
K_RWIN,
"#str_07031"},
65 {
"MENU",
K_MENU,
"#str_07032"},
73 {
"F1",
K_F1,
"#str_07036"},
74 {
"F2",
K_F2,
"#str_07037"},
75 {
"F3",
K_F3,
"#str_07038"},
76 {
"F4",
K_F4,
"#str_07039"},
77 {
"F5",
K_F5,
"#str_07040"},
78 {
"F6",
K_F6,
"#str_07041"},
79 {
"F7",
K_F7,
"#str_07042"},
80 {
"F8",
K_F8,
"#str_07043"},
81 {
"F9",
K_F9,
"#str_07044"},
82 {
"F10",
K_F10,
"#str_07045"},
83 {
"F11",
K_F11,
"#str_07046"},
84 {
"F12",
K_F12,
"#str_07047"},
86 {
"INS",
K_INS,
"#str_07048"},
87 {
"DEL",
K_DEL,
"#str_07049"},
88 {
"PGDN",
K_PGDN,
"#str_07050"},
89 {
"PGUP",
K_PGUP,
"#str_07051"},
90 {
"HOME",
K_HOME,
"#str_07052"},
91 {
"END",
K_END,
"#str_07053"},
105 {
"JOY1",
K_JOY1,
"#str_07062"},
106 {
"JOY2",
K_JOY2,
"#str_07063"},
107 {
"JOY3",
K_JOY3,
"#str_07064"},
108 {
"JOY4",
K_JOY4,
"#str_07065"},
109 {
"JOY5",
K_JOY5,
"#str_07066"},
110 {
"JOY6",
K_JOY6,
"#str_07067"},
111 {
"JOY7",
K_JOY7,
"#str_07068"},
112 {
"JOY8",
K_JOY8,
"#str_07069"},
113 {
"JOY9",
K_JOY9,
"#str_07070"},
114 {
"JOY10",
K_JOY10,
"#str_07071"},
115 {
"JOY11",
K_JOY11,
"#str_07072"},
116 {
"JOY12",
K_JOY12,
"#str_07073"},
117 {
"JOY13",
K_JOY13,
"#str_07074"},
118 {
"JOY14",
K_JOY14,
"#str_07075"},
119 {
"JOY15",
K_JOY15,
"#str_07076"},
120 {
"JOY16",
K_JOY16,
"#str_07077"},
121 {
"JOY17",
K_JOY17,
"#str_07078"},
122 {
"JOY18",
K_JOY18,
"#str_07079"},
123 {
"JOY19",
K_JOY19,
"#str_07080"},
124 {
"JOY20",
K_JOY20,
"#str_07081"},
125 {
"JOY21",
K_JOY21,
"#str_07082"},
126 {
"JOY22",
K_JOY22,
"#str_07083"},
127 {
"JOY23",
K_JOY23,
"#str_07084"},
128 {
"JOY24",
K_JOY24,
"#str_07085"},
129 {
"JOY25",
K_JOY25,
"#str_07086"},
130 {
"JOY26",
K_JOY26,
"#str_07087"},
131 {
"JOY27",
K_JOY27,
"#str_07088"},
132 {
"JOY28",
K_JOY28,
"#str_07089"},
133 {
"JOY29",
K_JOY29,
"#str_07090"},
134 {
"JOY30",
K_JOY30,
"#str_07091"},
135 {
"JOY31",
K_JOY31,
"#str_07092"},
136 {
"JOY32",
K_JOY32,
"#str_07093"},
138 {
"AUX1",
K_AUX1,
"#str_07094"},
139 {
"AUX2",
K_AUX2,
"#str_07095"},
140 {
"AUX3",
K_AUX3,
"#str_07096"},
141 {
"AUX4",
K_AUX4,
"#str_07097"},
142 {
"AUX5",
K_AUX5,
"#str_07098"},
143 {
"AUX6",
K_AUX6,
"#str_07099"},
144 {
"AUX7",
K_AUX7,
"#str_07100"},
145 {
"AUX8",
K_AUX8,
"#str_07101"},
146 {
"AUX9",
K_AUX9,
"#str_07102"},
147 {
"AUX10",
K_AUX10,
"#str_07103"},
148 {
"AUX11",
K_AUX11,
"#str_07104"},
149 {
"AUX12",
K_AUX12,
"#str_07105"},
150 {
"AUX13",
K_AUX13,
"#str_07106"},
151 {
"AUX14",
K_AUX14,
"#str_07107"},
152 {
"AUX15",
K_AUX15,
"#str_07108"},
153 {
"AUX16",
K_AUX16,
"#str_07109"},
159 {
"KP_5",
K_KP_5,
"#str_07114"},
174 {
"PAUSE",
K_PAUSE,
"#str_07128"},
176 {
"SEMICOLON",
';',
"#str_07129"},
177 {
"APOSTROPHE",
'\'',
"#str_07130"},
198 #define ID_DOOM_LEGACY
200 #ifdef ID_DOOM_LEGACY
239 for( i = 0; i <
sizeof( unnamedkeys ) - 1; i++ ) {
243 for ( kn = keynames; kn->
name; kn++ ) {
272 if ( keynum == -1 ) {
276 return keys[keynum].
down;
294 if ( !str || !str[0] ) {
298 return (
unsigned char)(str[0]);
302 if ( str[0] ==
'0' && str[1] ==
'x' && strlen( str ) == 4 ) {
306 if ( n1 >=
'0' && n1 <=
'9' ) {
308 }
else if ( n1 >=
'a' && n1 <=
'f' ) {
315 if ( n2 >=
'0' && n2 <=
'9' ) {
317 }
else if ( n2 >=
'a' && n2 <=
'f' ) {
327 for ( kn = keynames; kn->
name; kn++ ) {
346 static char tinystr[5];
349 if ( keynum == -1 ) {
350 return "<KEY NOT FOUND>";
353 if ( keynum < 0 || keynum > 255 ) {
354 return "<OUT OF RANGE>";
358 if ( keynum > 32 && keynum < 127 && keynum !=
'"' && keynum !=
';' && keynum !=
'\'' ) {
365 for ( kn = keynames; kn->
name; kn++ ) {
366 if ( keynum == kn->
keynum ) {
367 if ( !localized || kn->
strId[0] !=
'#' ) {
391 if ( localized && keynum >= 161 && keynum <= 255 ) {
403 tinystr[2] = i > 9 ? i - 10 +
'a' : i +
'0';
404 tinystr[3] = j > 9 ? j - 10 +
'a' : j +
'0';
416 if ( keynum == -1 ) {
424 keys[keynum].
binding = binding;
441 if ( keynum == -1 ) {
465 if ( args.
Argc() != 2 ) {
466 common->
Printf(
"unbind <key> : remove commands from a key\n" );
506 common->
Printf(
"bind <key> [command] : attach a command to a key\n" );
516 if ( keys[b].binding.Length() ) {
527 for ( i = 2; i <
c; i++ ) {
528 strcat( cmd, args.
Argv( i ) );
550 int key = atoi( args.
Argv( 1 ) );
570 f->
Printf(
"unbindall\n" );
573 if ( keys[i].binding.Length() ) {
577 if ( !
strcmp( name,
"\\" ) ) {
578 f->
Printf(
"bind \"\\\" \"%s\"\n", keys[i].binding.c_str() );
595 if ( keys[i].binding.Length() ) {
612 if ( bind && *bind ) {
614 if ( keys[i].binding.Icmp( bind ) == 0 ) {
615 if ( keyName[0] !=
'\0' ) {
622 if ( keyName[0] ==
'\0' ) {
637 if ( keyNum<0 || keyNum >=
MAX_KEYS ) {
649 bool unbound =
false;
652 if ( binding && *binding ) {
654 if ( keys[i].binding.Icmp( binding ) == 0 ) {
671 if ( binding && *binding ) {
673 if ( keys[i].binding.Icmp( binding ) == 0 ) {
687 if ( keynum >= 0 && keynum <
MAX_KEYS ) {
688 return ( keys[keynum].binding.Icmp( binding ) == 0 );
702 keys[keynum].
down = down;
704 #ifdef ID_DOOM_LEGACY
729 if ( keys[keynum].usercmdAction ) {
734 if ( keys[keynum].binding.Length() ) {
750 if ( keys[i].down ) {
753 keys[
i].
down =
false;
const char * OSX_GetLocalizedString(const char *key)
assert(prefInfo.fullscreenBtn)
idCVarSystem * cvarSystem
virtual void virtual void virtual const idLangDict * GetLanguageDict(void)=0
virtual void Clear(void)=0
virtual void SetModifiedFlags(int flags)=0
virtual int CommandStringUsercmdData(const char *cmdString)=0
int Icmp(const char *text) const
int Icmpn(const char *text, int n) const
virtual void BufferCommandText(cmdExecution_t exec, const char *text)=0
GLuint GLuint GLsizei count
static void Copynz(char *dest, const char *src, int destsize)
const char * GetString(const char *str) const
idUsercmdGen * usercmdGen
virtual void Printf(const char *fmt,...) id_attribute((format(printf
void Append(const char a)
const char * c_str(void) const
const char * Argv(int arg) const
char * va(const char *fmt,...)
unsigned char Sys_MapCharForKey(int key)
virtual int Printf(const char *fmt,...) id_attribute((format(printf
virtual void AddCommand(const char *cmdName, cmdFunction_t function, int flags, const char *description, argCompletion_t argCompletion=NULL)=0