#ifdef IMPLEMENTATION
+string KEY_NOT_BOUND_CMD = "// not bound";
+
#define MAX_KEYS_PER_FUNCTION 2
#define MAX_KEYBINDS 256
string Xonotic_KeyBinds_Functions[MAX_KEYBINDS];
string s;
Xonotic_KeyBinds_Count = 0;
- fh = fopen("keybinds.txt", FILE_READ);
+ fh = fopen(language_filename("keybinds.txt"), FILE_READ);
if(fh < 0)
return;
while((s = fgets(fh)))
{
k = stof(argv(j));
if(k != -1)
- localcmd("\nunbind \"", keynumtostring(k), "\"\n");
+ //localcmd("\nunbind \"", keynumtostring(k), "\"\n");
+ localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
}
}
localcmd("\nbind \"", keynumtostring(key), "\" \"", func, "\"\n");
+ localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
}
void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandPress, string theCommandRelease)
{
{
k = stof(argv(j));
if(k != -1)
- localcmd("\nunbind \"", keynumtostring(k), "\"\n");
+ //localcmd("\nunbind \"", keynumtostring(k), "\"\n");
+ localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
}
-
+ localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
}
void XonoticKeyBinder_clickListBoxItem(entity me, float i, vector where)
{
switch(key)
{
case K_ENTER:
+ case K_KP_ENTER:
case K_SPACE:
KeyBinder_Bind_Change(me, me);
break;
case K_DEL:
+ case K_KP_DEL:
case K_BACKSPACE:
KeyBinder_Bind_Clear(me, me);
break;
theAlpha *= SKINALPHA_DISABLED;
}
- draw_Text(me.realUpperMargin * eY + extraMargin * eX, descr, me.realFontSize, theColor, theAlpha, 0);
+ s = draw_TextShortenToWidth(descr, me.columnFunctionSize, 0, me.realFontSize);
+ draw_Text(me.realUpperMargin * eY + extraMargin * eX, s, me.realFontSize, theColor, theAlpha, 0);
if(func != "")
{
n = tokenize(findkeysforcommand(func)); // uses '...' strings