diff -r 29948153fda2 -r ea6ad9a97fca hedgewars/uInputHandler.pas --- a/hedgewars/uInputHandler.pas Mon May 28 19:15:51 2012 +0200 +++ b/hedgewars/uInputHandler.pas Mon May 28 19:33:57 2012 +0200 @@ -45,7 +45,7 @@ implementation uses uConsole, uCommands, uMisc, uVariables, uConsts, uUtils, uDebug; -var tkbd: TKeyboardState; +var tkbd: array[0..cKeyMaxIndex] of boolean; quitKeyCode: Byte; KeyNames: array [0..cKeyMaxIndex] of string[15]; CurrentBinds: TBinds; @@ -65,8 +65,8 @@ s : string; begin -if(tkbd[code] = ord(KeyDown)) then exit; -tkbd[code]:= ord(KeyDown); +if not(tkbd[code] xor KeyDown) then exit; +tkbd[code]:= KeyDown; hideAmmoMenu:= false; @@ -80,16 +80,16 @@ if(KeyDown and (code = quitKeyCode)) then begin {$IFDEF DARWIN} - if ((tkbd[KeyNameToCode('left_meta')] = 1) or (tkbd[KeyNameToCode('right_meta')] = 1)) then + if tkbd[KeyNameToCode('left_meta')] or tkbd[KeyNameToCode('right_meta')] then {$ELSE} - if ((tkbd[KeyNameToCode('left_ctrl')] = 1) or (tkbd[KeyNameToCode('right_ctrl')] = 1)) then + if tkbd[KeyNameToCode('left_ctrl')] or tkbd[KeyNameToCode('right_ctrl')] then {$ENDIF} ParseCommand('halt', true); end; if CurrentBinds[code][0] <> #0 then begin - if (code > 3) and (KeyDown) and not ((CurrentBinds[code] = 'put') or (CurrentBinds[code] = 'ammomenu') or (CurrentBinds[code] = '+cur_u') or (CurrentBinds[code] = '+cur_d') or (CurrentBinds[code] = '+cur_l') or (CurrentBinds[code] = '+cur_r')) then hideAmmoMenu:= true; + if (code > 3) and KeyDown and not ((CurrentBinds[code] = 'put') or (CurrentBinds[code] = 'ammomenu') or (CurrentBinds[code] = '+cur_u') or (CurrentBinds[code] = '+cur_d') or (CurrentBinds[code] = '+cur_l') or (CurrentBinds[code] = '+cur_r')) then hideAmmoMenu:= true; if KeyDown then begin @@ -133,7 +133,7 @@ var t: LongInt; begin for t:= 0 to cKeyMaxIndex do - if(tkbd[t] <> 0) then + if tkbd[t] then ProcessKey(t, False); end; @@ -255,10 +255,10 @@ procedure FreezeEnterKey; begin - tkbd[3]:= 1; - tkbd[13]:= 1; - tkbd[27]:= 1; - tkbd[271]:= 1; + tkbd[3]:= True; + tkbd[13]:= True; + tkbd[27]:= True; + tkbd[271]:= True; end; var Controller: array [0..5] of PSDL_Joystick;