hedgewars/uKeys.pas
changeset 947 4e0c3ad89483
parent 883 07a568ba44e0
child 948 5d49a92c240a
equal deleted inserted replaced
946:42c5cc87cbd1 947:4e0c3ad89483
    65 i:= SDL_GetMouseState(nil, nil);
    65 i:= SDL_GetMouseState(nil, nil);
    66 pkbd^[1]:= (i and 1);
    66 pkbd^[1]:= (i and 1);
    67 pkbd^[2]:= ((i shr 1) and 1);
    67 pkbd^[2]:= ((i shr 1) and 1);
    68 pkbd^[3]:= ((i shr 2) and 1);
    68 pkbd^[3]:= ((i shr 2) and 1);
    69 for i:= 1 to cKeyMaxIndex do
    69 for i:= 1 to cKeyMaxIndex do
    70     if CurrentBinds[i][0] <> #0 then
    70 if CurrentBinds[i][0] <> #0 then
    71       begin
    71 	begin
    72       if (i > 3) and (pkbd^[i] <> 0) then KbdKeyPressed:= true;
    72 	if (i > 3) and (pkbd^[i] <> 0) then KbdKeyPressed:= true;
    73       if CurrentBinds[i][1] = '+' then
    73 	if (tkbd[i] = 0) and (pkbd^[i] <> 0) then ParseCommand(CurrentBinds[i], Trusted)
    74           begin
    74 	else if (CurrentBinds[i][1] = '+')
    75           if (pkbd^[i] <> 0)and(tkbd[i]  = 0) then ParseCommand(CurrentBinds[i], Trusted) else
    75 			and (pkbd^[i] = 0)and(tkbd[i] <> 0) then
    76           if (pkbd^[i] =  0)and(tkbd[i] <> 0) then
    76 			begin
    77              begin
    77 			s:= CurrentBinds[i];
    78              s:= CurrentBinds[i];
    78 			s[1]:= '-';
    79              s[1]:= '-';
    79 			ParseCommand(s, Trusted)
    80              ParseCommand(s, Trusted)
    80 			end;
    81              end;
    81 	tkbd[i]:= pkbd^[i]
    82           end else
    82 	end
    83           if (tkbd[i] = 0) and (pkbd^[i] <> 0) then ParseCommand(CurrentBinds[i], Trusted);
       
    84        tkbd[i]:= pkbd^[i]
       
    85        end
       
    86 end;
    83 end;
    87 
    84 
    88 procedure ResetKbd;
    85 procedure ResetKbd;
    89 var i, t: LongInt;
    86 var i, t: LongInt;
    90     pkbd: PByteArray;
    87     pkbd: PByteArray;