// [RC] Returns the (first) key name, if any, used for a command void C_FindBind(char *Command, char *Key) { int key1 = -1; int key2 = -1; C_GetKeysForCommand(Command, &key1, &key2); if(key1 <= 0) sprintf(Key, "None"); else sprintf(Key, "%s", KeyNames[key1]); }
void C_ChangeBinding (const char *str, int newone) { // Check which bindings that are already set. If both binding slots are taken, // erase all bindings and reassign the new one and the secondary binding to the key instead. int first = -1; int second = -1; C_GetKeysForCommand(str, &first, &second); if (newone == first || newone == second) { return; } else if (first > -1 && second > -1) { C_UnbindACommand(str); Bindings[newone] = str; Bindings[second] = str; } else { Bindings[newone] = str; } }