X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fkeybinder.c;h=1107e60abc6b3296e77dd9582bbe6613a267ef32;hb=ca387f77b7b8044475a7c359e22d2e6d4ebf513d;hp=3117c65e4800af30675dc597c3a97863d73b1d4e;hpb=c94e06a08777b32dea9a5b3a3934da16f50803bf;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/keybinder.c b/qcsrc/menu/xonotic/keybinder.c index 3117c65e4..1107e60ab 100644 --- a/qcsrc/menu/xonotic/keybinder.c +++ b/qcsrc/menu/xonotic/keybinder.c @@ -47,7 +47,7 @@ void Xonotic_KeyBinds_Read() 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))) @@ -70,6 +70,17 @@ entity makeXonoticKeyBinder() me.configureXonoticKeyBinder(me); return me; } +void replace_bind(string from, string to) +{ + float n, j, k; + n = tokenize(findkeysforcommand(from, 0)); // uses '...' strings + for(j = 0; j < n; ++j) + { + k = stof(argv(j)); + if(k != -1) + localcmd("\nbind \"", keynumtostring(k), "\" \"", to, "\"\n"); + } +} void XonoticKeyBinder_configureXonoticKeyBinder(entity me) { me.configureXonoticListBox(me); @@ -77,6 +88,18 @@ void XonoticKeyBinder_configureXonoticKeyBinder(entity me) Xonotic_KeyBinds_Read(); me.nItems = Xonotic_KeyBinds_Count; me.setSelected(me, 0); + + // TEMP: Xonotic 0.1 to later + replace_bind("impulse 1", "weapon_group_1"); + replace_bind("impulse 2", "weapon_group_2"); + replace_bind("impulse 3", "weapon_group_3"); + replace_bind("impulse 4", "weapon_group_4"); + replace_bind("impulse 5", "weapon_group_5"); + replace_bind("impulse 6", "weapon_group_6"); + replace_bind("impulse 7", "weapon_group_7"); + replace_bind("impulse 8", "weapon_group_8"); + replace_bind("impulse 9", "weapon_group_9"); + replace_bind("impulse 14", "weapon_group_0"); } void XonoticKeyBinder_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) { @@ -118,7 +141,7 @@ void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii) if(func == "") return; - n = tokenize(findkeysforcommand(func)); // uses '...' strings + n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings nvalid = 0; for(j = 0; j < n; ++j) { @@ -137,6 +160,7 @@ void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii) } } 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) { @@ -189,7 +213,7 @@ void KeyBinder_Bind_Clear(entity btn, entity me) if(func == "") return; - n = tokenize(findkeysforcommand(func)); // uses '...' strings + n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings for(j = 0; j < n; ++j) { k = stof(argv(j)); @@ -197,7 +221,7 @@ void KeyBinder_Bind_Clear(entity btn, entity me) //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) { @@ -307,7 +331,7 @@ void XonoticKeyBinder_drawListBoxItem(entity me, float i, vector absSize, float draw_Text(me.realUpperMargin * eY + extraMargin * eX, s, me.realFontSize, theColor, theAlpha, 0); if(func != "") { - n = tokenize(findkeysforcommand(func)); // uses '...' strings + n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings s = ""; for(j = 0; j < n; ++j) {