hedgewars/uKeys.pas
changeset 948 5d49a92c240a
parent 947 4e0c3ad89483
child 991 d17c71ee074e
equal deleted inserted replaced
947:4e0c3ad89483 948:5d49a92c240a
    24 type TBinds = array[0..cKeyMaxIndex] of shortstring;
    24 type TBinds = array[0..cKeyMaxIndex] of shortstring;
    25 
    25 
    26 function KeyNameToCode(name: string): word;
    26 function KeyNameToCode(name: string): word;
    27 procedure ProcessKbd;
    27 procedure ProcessKbd;
    28 procedure ResetKbd;
    28 procedure ResetKbd;
       
    29 procedure FreezeEnterKey;
    29 procedure InitKbdKeyTable;
    30 procedure InitKbdKeyTable;
    30 
    31 
    31 procedure SetBinds(var binds: TBinds);
    32 procedure SetBinds(var binds: TBinds);
    32 procedure SetDefaultBinds;
    33 procedure SetDefaultBinds;
    33 
    34 
    70 if CurrentBinds[i][0] <> #0 then
    71 if CurrentBinds[i][0] <> #0 then
    71 	begin
    72 	begin
    72 	if (i > 3) and (pkbd^[i] <> 0) then KbdKeyPressed:= true;
    73 	if (i > 3) and (pkbd^[i] <> 0) then KbdKeyPressed:= true;
    73 	if (tkbd[i] = 0) and (pkbd^[i] <> 0) then ParseCommand(CurrentBinds[i], Trusted)
    74 	if (tkbd[i] = 0) and (pkbd^[i] <> 0) then ParseCommand(CurrentBinds[i], Trusted)
    74 	else if (CurrentBinds[i][1] = '+')
    75 	else if (CurrentBinds[i][1] = '+')
    75 			and (pkbd^[i] = 0)and(tkbd[i] <> 0) then
    76 			and (pkbd^[i] = 0)
       
    77 			and (tkbd[i] <> 0) then
    76 			begin
    78 			begin
    77 			s:= CurrentBinds[i];
    79 			s:= CurrentBinds[i];
    78 			s[1]:= '-';
    80 			s[1]:= '-';
    79 			ParseCommand(s, Trusted)
    81 			ParseCommand(s, Trusted)
    80 			end;
    82 			end;
   116 DefaultBinds[ 99]:= 'capture';
   118 DefaultBinds[ 99]:= 'capture';
   117 DefaultBinds[102]:= 'fullscr';
   119 DefaultBinds[102]:= 'fullscr';
   118 DefaultBinds[104]:= 'findhh';
   120 DefaultBinds[104]:= 'findhh';
   119 DefaultBinds[112]:= 'pause';
   121 DefaultBinds[112]:= 'pause';
   120 DefaultBinds[115]:= '+speedup';
   122 DefaultBinds[115]:= '+speedup';
       
   123 DefaultBinds[116]:= 'chat';
   121 DefaultBinds[127]:= 'rotmask';
   124 DefaultBinds[127]:= 'rotmask';
   122 SetDefaultBinds
   125 SetDefaultBinds
   123 end;
   126 end;
   124 
   127 
   125 procedure SetBinds(var binds: TBinds);
   128 procedure SetBinds(var binds: TBinds);
   130 procedure SetDefaultBinds;
   133 procedure SetDefaultBinds;
   131 begin
   134 begin
   132 CurrentBinds:= DefaultBinds
   135 CurrentBinds:= DefaultBinds
   133 end;
   136 end;
   134 
   137 
       
   138 procedure FreezeEnterKey;
       
   139 begin
       
   140 tkbd[13]:= 1;
       
   141 tkbd[271]:= 1
       
   142 end;
   135 
   143 
   136 initialization
   144 initialization
   137 
   145 
   138 end.
   146 end.