annotate Keyboard.h @ 123:05b2d9653abc

15.11.12
author Ritor1
date Thu, 15 Nov 2012 16:36:30 +0600
parents 8b8875f5b359
children af624eaf2fc5
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #pragma once
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 /* 284 */
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5 enum InputAction : __int32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7 INPUT_MoveForward = 0x0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8 INPUT_MoveBackwards = 0x1,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9 INPUT_TurnLeft = 0x2,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10 INPUT_TurnRight = 0x3,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11 INPUT_Yell = 0x4,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
12 INPUT_Jump = 0x5,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
13 INPUT_Combat = 0x6,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
14 INPUT_CastReady = 0x7,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
15 INPUT_Attack = 0x8,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
16 INPUT_EventTrigger = 0x9,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17 INPUT_Cast = 0xA,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18 INPUT_Pass = 0xB,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19 INPUT_CharCycle = 0xC,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20 INPUT_Quest = 0xD,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 INPUT_QuickRef = 0xE,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22 INPUT_Rest = 0xF,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23 INPUT_TimeCal = 0x10,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24 INPUT_Autonotes = 0x11,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25 INPUT_Mapbook = 0x12,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26 INPUT_AlwaysRun = 0x13,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
27 INPUT_LookUp = 0x14,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28 INPUT_LookDown = 0x15,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29 INPUT_CenterView = 0x16,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30 INPUT_ZoomIn = 0x17,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31 INPUT_ZoomOut = 0x18,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32 INPUT_FlyUp = 0x19,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33 INPUT_FlyDown = 0x1A,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34 INPUT_Land = 0x1B,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35 INPUT_StrafeLeft = 0x1C,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 INPUT_StrafeRight = 0x1D,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 };
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41 enum KeyToggleType : __int32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43 TOGGLE_Continuously = 0x0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44 TOGGLE_OneTimePress = 0x1,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
45 };
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
46
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
47 #pragma pack(push, 1)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
48 struct KeyboardActionMapping
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
49 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
50 KeyboardActionMapping();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
51
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
52 void SetKeyMapping(int uAction, int vKey, KeyToggleType type);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
53 unsigned int GetActionVKey(enum InputAction eAction);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
54 const char *GetVKeyDisplayName(signed int a1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
55 const unsigned __int8 GetActionDefaultVKey(const char *Str);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
56 void ReadMappings();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
57 void StoreMappings();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
58 bool _459F10(unsigned int a2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
59 void _459ED1(int a2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
60 void _459E5A(int a2, int a3, struct GUIWindow *pWindow);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
61 void ResetKeys();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
62 void SetDefaultMapping();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
63
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
64 unsigned int uLastKeyPressed;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
65 int field_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
66 int field_8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
67 unsigned int pVirtualKeyCodesMapping[30];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
68 KeyToggleType pToggleTypes[30];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
69 int field_FC;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
70 unsigned __int8 pPressedKeysBuffer[257];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
71 unsigned __int8 uNumKeysPressed;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
72 char field_202;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
73 char field_203;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
74 int field_204;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
75 struct GUIWindow *pWindow;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
76 };
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
77 #pragma pack(pop)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
78
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
79 #pragma pack(push, 1)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
80 struct Keyboard
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
81 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
82 Keyboard();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
83 bool WasKeyPressed(int vKey);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
84 bool IsKeyBeingHeld(int vKey);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
85 bool IsShiftHeld();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
86 void EnterCriticalSection();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
87
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
88 void (__thiscall ***vdestructor_ptr)(Keyboard *, bool);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
89 unsigned int bUsingAsynKeyboard;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
90 };
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
91 #pragma pack(pop)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
92
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
93
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
94 #pragma pack(push, 1)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
95 struct AsyncKeyboard
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
96 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
97 AsyncKeyboard();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
98 ~AsyncKeyboard();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
99
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
100 bool Initialize();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
101 char map_key(int key);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
102 char _45B4EC(unsigned __int8 a2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
103 void Thread();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
104 char _45B3A4();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
105 void Suspend();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
106 void Resume();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
107 char CreateDirectInputKeyboard();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
108 char _45B229();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
109 void _45B1B1();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
110 void Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
111
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
112 static int __stdcall ThreadStarter(AsyncKeyboard *pInstance);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
113 static void EnterCriticalSection();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
114 static void LeaveCriticalSection();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
115 };
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
116 #pragma pack(pop)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
117
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
118
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
119 extern struct KeyboardActionMapping *pKeyActionMap;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
120 extern struct AsyncKeyboard *pAsyncKeyboard;