From: Rudolf Polzer Date: Mon, 15 Aug 2011 19:01:21 +0000 (+0200) Subject: rebind keys from impulses to the aliases X-Git-Tag: xonotic-v0.5.0~140^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=550c4fb867a98da338560bfb4ea2fa0bfc482355;p=xonotic%2Fxonotic-data.pk3dir.git rebind keys from impulses to the aliases --- diff --git a/qcsrc/menu/xonotic/keybinder.c b/qcsrc/menu/xonotic/keybinder.c index f4a6c5a3e..90dfe9fa8 100644 --- a/qcsrc/menu/xonotic/keybinder.c +++ b/qcsrc/menu/xonotic/keybinder.c @@ -70,6 +70,16 @@ entity makeXonoticKeyBinder() me.configureXonoticKeyBinder(me); return me; } +void replace_bind(string from, string to) +{ + n = tokenize(findkeysforcommand(from)); // 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 +87,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) {