diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index d3059549107a05b8fa58b92df8bbb916880f7109..bbbd1c2024df8a367eff8f7beb22a575c427ba83 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
function g_Console_FindBind (n: Integer; down: AnsiString; up: AnsiString = ''): Integer;
procedure g_Console_BindKey (key: Integer; down: AnsiString; up: AnsiString = '');
procedure g_Console_ProcessBind (key: Integer; down: Boolean);
function g_Console_FindBind (n: Integer; down: AnsiString; up: AnsiString = ''): Integer;
procedure g_Console_BindKey (key: Integer; down: AnsiString; up: AnsiString = '');
procedure g_Console_ProcessBind (key: Integer; down: Boolean);
+procedure g_Console_ProcessBindRepeat (key: Integer);
procedure g_Console_ResetBinds;
procedure conwriteln (const s: AnsiString; show: Boolean=false);
procedure g_Console_ResetBinds;
procedure conwriteln (const s: AnsiString; show: Boolean=false);
end;
gInputBinds: Array [0..e_MaxInputKeys - 1] of record
end;
gInputBinds: Array [0..e_MaxInputKeys - 1] of record
+ rep: Boolean;
down, up: SSArray;
end;
menu_toggled: BOOLEAN; (* hack for menu controls *)
down, up: SSArray;
end;
menu_toggled: BOOLEAN; (* hack for menu controls *)
begin
g_Console_Add('bind <key> <down action> [up action]')
end;
begin
g_Console_Add('bind <key> <down action> [up action]')
end;
+ 'bindrep':
+ // bindrep <key>
+ if Length(p) = 2 then
+ begin
+ key := LowerCase(p[1]);
+ i := 0;
+ while (i < e_MaxInputKeys) and (key <> LowerCase(e_KeyNames[i])) do inc(i);
+ if i < e_MaxInputKeys then
+ gInputBinds[i].rep := True
+ else
+ g_Console_Add('bindrep: "' + p[1] + '" is not a key')
+ end
+ else
+ g_Console_Add('bindrep <key>');
+ 'bindunrep':
+ // bindunrep <key>
+ if Length(p) = 2 then
+ begin
+ key := LowerCase(p[1]);
+ i := 0;
+ while (i < e_MaxInputKeys) and (key <> LowerCase(e_KeyNames[i])) do inc(i);
+ if i < e_MaxInputKeys then
+ gInputBinds[i].rep := False
+ else
+ g_Console_Add('bindunrep: "' + p[1] + '" is not a key')
+ end
+ else
+ g_Console_Add('bindunrep <key>');
'bindlist':
for i := 0 to e_MaxInputKeys - 1 do
if (gInputBinds[i].down <> nil) or (gInputBinds[i].up <> nil) then
'bindlist':
for i := 0 to e_MaxInputKeys - 1 do
if (gInputBinds[i].down <> nil) or (gInputBinds[i].up <> nil) then
AddCommand('g_language', SystemCommands);
AddCommand('bind', BindCommands);
AddCommand('g_language', SystemCommands);
AddCommand('bind', BindCommands);
+ AddCommand('bindrep', BindCommands);
+ AddCommand('bindunrep', BindCommands);
AddCommand('bindlist', BindCommands);
AddCommand('unbind', BindCommands);
AddCommand('unbindall', BindCommands);
AddCommand('bindlist', BindCommands);
AddCommand('unbind', BindCommands);
AddCommand('unbindall', BindCommands);
AddCommand('ready', GameCommands);
AddCommand('kick', GameCommands);
AddCommand('kick_id', GameCommands);
AddCommand('ready', GameCommands);
AddCommand('kick', GameCommands);
AddCommand('kick_id', GameCommands);
+ AddCommand('kick_pid', GameCommands);
AddCommand('ban', GameCommands);
AddCommand('ban', GameCommands);
- AddCommand('permban', GameCommands);
AddCommand('ban_id', GameCommands);
AddCommand('ban_id', GameCommands);
+ AddCommand('ban_pid', GameCommands);
+ AddCommand('permban', GameCommands);
AddCommand('permban_id', GameCommands);
AddCommand('permban_id', GameCommands);
+ AddCommand('permban_pid', GameCommands);
+ AddCommand('permban_ip', GameCommands);
AddCommand('unban', GameCommands);
AddCommand('connect', GameCommands);
AddCommand('disconnect', GameCommands);
AddCommand('unban', GameCommands);
AddCommand('connect', GameCommands);
AddCommand('disconnect', GameCommands);
WhitelistCommand('endmap');
WhitelistCommand('restart');
WhitelistCommand('kick');
WhitelistCommand('endmap');
WhitelistCommand('restart');
WhitelistCommand('kick');
+ WhitelistCommand('kick_pid');
WhitelistCommand('ban');
WhitelistCommand('ban');
+ WhitelistCommand('ban_pid');
WhitelistCommand('centerprint');
WhitelistCommand('addbot');
WhitelistCommand('centerprint');
WhitelistCommand('addbot');
ASSERT(key < e_MaxInputKeys);
if key > 0 then
begin
ASSERT(key < e_MaxInputKeys);
if key > 0 then
begin
+ gInputBinds[key].rep := False;
gInputBinds[key].down := ParseAlias(down);
gInputBinds[key].up := ParseAlias(up);
end;
gInputBinds[key].down := ParseAlias(down);
gInputBinds[key].up := ParseAlias(up);
end;
menu_toggled := False
end;
menu_toggled := False
end;
+procedure g_Console_ProcessBindRepeat (key: Integer);
+ var i: Integer;
+begin
+ if gConsoleShow or gChatShow or (g_ActiveWindow <> nil) then
+ begin
+ KeyPress(key); // key repeat in menus and shit
+ Exit;
+ end;
+ if BindsAllowed(key) and gInputBinds[key].rep then
+ begin
+ for i := 0 to High(gInputBinds[key].down) do
+ g_Console_Process(gInputBinds[key].down[i], True);
+ end;
+end;
+
procedure g_Console_ResetBinds;
var i: Integer;
begin
procedure g_Console_ResetBinds;
var i: Integer;
begin
if Length(gInputBinds[i].up) > 0 then
Write(f, ' ', QuoteStr(GetCommandString(gInputBinds[i].up)));
WriteLn(f, '');
if Length(gInputBinds[i].up) > 0 then
Write(f, ' ', QuoteStr(GetCommandString(gInputBinds[i].up)));
WriteLn(f, '');
+ if gInputBinds[i].rep then
+ WriteLn(f, 'bindrep ', e_KeyNames[i]);
end;
// lang
end;
// lang