hedgewars/uInputHandler.pas
changeset 7192 e6c379b486d5
parent 7191 9419294e5f33
child 7193 65a022bf6bde
child 7194 d8e68cbca7ee
equal deleted inserted replaced
7191:9419294e5f33 7192:e6c379b486d5
    57 begin
    57 begin
    58     name:= LowerCase(name);
    58     name:= LowerCase(name);
    59     code:= cKeyMaxIndex;
    59     code:= cKeyMaxIndex;
    60     while (code > 0) and (KeyNames[code] <> name) do dec(code);
    60     while (code > 0) and (KeyNames[code] <> name) do dec(code);
    61 
    61 
    62 
       
    63     MaskModifier(Modifier, code);
    62     MaskModifier(Modifier, code);
    64     WriteLnToConsole(inttostr(code));
       
    65 
       
    66     KeyNameToCode:= code;
    63     KeyNameToCode:= code;
    67 end;
    64 end;
    68 
    65 
    69 procedure MaskModifier(var code: LongInt; Modifier: LongWord);
    66 procedure MaskModifier(var code: LongInt; Modifier: LongWord);
    70 begin
    67 begin
    71     WriteLnToConsole(inttostr(code));
       
    72     code:= code or (modifier shl 10);
    68     code:= code or (modifier shl 10);
    73     WriteLnToConsole(inttostr(code));
       
    74 end;
    69 end;
    75 
    70 
    76 procedure MaskModifier(Modifier: shortstring; var code: LongInt);
    71 procedure MaskModifier(Modifier: shortstring; var code: LongInt);
    77 var mod_ : shortstring;
    72 var mod_ : shortstring;
    78     ModifierCount, i: LongInt;
    73     ModifierCount, i: LongInt;
    87 Modifier:= mod_;
    82 Modifier:= mod_;
    88 for i:= 0 to ModifierCount do
    83 for i:= 0 to ModifierCount do
    89     begin 
    84     begin 
    90     mod_:= '';
    85     mod_:= '';
    91     SplitByChar(Modifier, mod_, ':');
    86     SplitByChar(Modifier, mod_, ':');
    92     WriteLnToConsole(Modifier + ' baaaaa' );
       
    93     if (Modifier = 'lshift')                    then code:= code or (KMOD_LSHIFT shl 10);
    87     if (Modifier = 'lshift')                    then code:= code or (KMOD_LSHIFT shl 10);
    94     if (Modifier = 'rshift')                    then code:= code or (KMOD_RSHIFT shl 10);
    88     if (Modifier = 'rshift')                    then code:= code or (KMOD_RSHIFT shl 10);
    95     if (Modifier = 'lalt')                      then code:= code or (KMOD_LALT   shl 10);
    89     if (Modifier = 'lalt')                      then code:= code or (KMOD_LALT   shl 10);
    96     if (Modifier = 'ralt')                      then code:= code or (KMOD_RALT   shl 10);
    90     if (Modifier = 'ralt')                      then code:= code or (KMOD_RALT   shl 10);
    97     if (Modifier = 'lctrl') or (mod_ = 'lmeta') then code:= code or (KMOD_LCTRL  shl 10);
    91     if (Modifier = 'lctrl') or (mod_ = 'lmeta') then code:= code or (KMOD_LCTRL  shl 10);
   103 procedure ProcessKey(code: LongInt; KeyDown: boolean);
    97 procedure ProcessKey(code: LongInt; KeyDown: boolean);
   104 var
    98 var
   105     Trusted: boolean;
    99     Trusted: boolean;
   106     s      : string;
   100     s      : string;
   107 begin
   101 begin
   108 WriteLnToConsole(inttostr(code) + ' KeyDown:' + inttostr(ord(keydown)) + CurrentBinds[code]) ; 
       
   109 if not(tkbd[code] xor KeyDown) then exit;
   102 if not(tkbd[code] xor KeyDown) then exit;
   110 tkbd[code]:= KeyDown;
   103 tkbd[code]:= KeyDown;
   111 
   104 
   112 hideAmmoMenu:= false;
   105 hideAmmoMenu:= false;
   113 Trusted:= (CurrentTeam <> nil)
   106 Trusted:= (CurrentTeam <> nil)