MCPcopy Create free account
hub / github.com/assaultcube/AC / autokeymap

Function autokeymap

source/src/console.cpp:178–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178keym *autokeymap(int keycode, int scancode)
179{
180 static bool scdone[SDL_NUM_SCANCODES] = { false };
181 int sc = keycode <= SDLK_SCANCODE_MASK ? scancode : (keycode & (SDLK_SCANCODE_MASK - 1));
182 if(sc < 0 || sc >= SDL_NUM_SCANCODES || scdone[sc]) return NULL;
183 scdone[sc] = true;
184 string text;
185 filtertext(text, SDL_GetScancodeName((SDL_Scancode) sc), FTXT__AUTOKEYMAPNAME);
186 if(!*text || (int)SDL_GetScancodeFromName(text) != sc || findbind(text)) return NULL; // name is not unique (collision probably caused by filtertext) or can't be properly resolved in reverse
187 clientlogf("autokeymap: create keymap entry for scancode %d, \"%s\"", sc, text);
188 sc |= SDLK_SCANCODE_MASK;
189 keymap(&sc, text);
190 return keyms.access(sc);
191}
192
193void findkey(int *code)
194{

Callers 1

keypressFunction · 0.85

Calls 5

filtertextFunction · 0.85
findbindFunction · 0.85
clientlogfFunction · 0.85
keymapFunction · 0.85
accessMethod · 0.80

Tested by

no test coverage detected