41 var tkbd: TKeyboardState; |
41 var tkbd: TKeyboardState; |
42 KeyNames: array [0..cKeyMaxIndex] of string[15]; |
42 KeyNames: array [0..cKeyMaxIndex] of string[15]; |
43 DefaultBinds, CurrentBinds: TBinds; |
43 DefaultBinds, CurrentBinds: TBinds; |
44 |
44 |
45 function KeyNameToCode(name: string): word; |
45 function KeyNameToCode(name: string): word; |
|
46 var Result: Word; |
46 begin |
47 begin |
47 Result:= cKeyMaxIndex; |
48 Result:= cKeyMaxIndex; |
48 while (Result > 0) and (KeyNames[Result] <> name) do dec(Result) |
49 while (Result > 0) and (KeyNames[Result] <> name) do dec(Result); |
|
50 KeyNameToCode:= Result |
49 end; |
51 end; |
50 |
52 |
51 procedure ProcessKbd; |
53 procedure ProcessKbd; |
52 var i: integer; |
54 var i: integer; |
53 s: shortstring; |
55 s: shortstring; |
54 pkbd: PByteArray; |
56 pkbd: PByteArray; |
55 Trusted: boolean; |
57 Trusted: boolean; |
56 begin |
58 begin |
57 KbdKeyPressed:= false; |
59 KbdKeyPressed:= false; |
58 Trusted:= (CurrentTeam <> nil) |
60 Trusted:= (CurrentTeam <> nil) |
59 and (not CurrentTeam.ExtDriven) |
61 and (not CurrentTeam^.ExtDriven) |
60 and (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].BotLevel = 0); |
62 and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].BotLevel = 0); |
61 |
63 |
62 pkbd:= SDL_GetKeyState(nil); |
64 pkbd:= SDL_GetKeyState(nil); |
63 i:= SDL_GetMouseState(nil, nil); |
65 i:= SDL_GetMouseState(nil, nil); |
64 pkbd^[1]:= (i and 1); |
66 pkbd^[1]:= (i and 1); |
65 pkbd^[2]:= ((i shr 1) and 1); |
67 pkbd^[2]:= ((i shr 1) and 1); |