33 #define VK_CONTROL 0x63
35 #define VK_ESCAPE 0x45
37 //Keyboard variables for each player
38 int ChosenKeys
[3 * 5];
48 unsigned int JoyUp
, JoyLeft
, JoyRight
, JoyDown
;
51 //Initializes the standard keys
54 ChosenKeys
[ 0] = VK_UP
;
55 ChosenKeys
[ 1] = VK_DOWN
;
56 ChosenKeys
[ 2] = VK_LEFT
;
57 ChosenKeys
[ 3] = VK_RIGHT
;
58 ChosenKeys
[ 4] = VK_CONTROL
;
59 ChosenKeys
[ 5] = VK_W
;
60 ChosenKeys
[ 6] = VK_X
;
61 ChosenKeys
[ 7] = VK_A
;
62 ChosenKeys
[ 8] = VK_D
;
63 ChosenKeys
[ 9] = VK_TAB
;
64 ChosenKeys
[10] = VK_U
;
65 ChosenKeys
[11] = VK_N
;
66 ChosenKeys
[12] = VK_H
;
67 ChosenKeys
[13] = VK_K
;
68 ChosenKeys
[14] = VK_B
;
72 //Get info about joystick axes
73 JoyAvail
= (joyGetDevCaps (JOYSTICKID1
, &JoyCaps
, sizeof (JoyCaps
)) == JOYERR_NOERROR
);
75 JoyUp
= (JoyCaps
.wYmax
- JoyCaps
.wYmin
) * 1 / 6;
76 JoyDown
= (JoyCaps
.wYmax
- JoyCaps
.wYmin
) * 5 / 6;
77 JoyLeft
= (JoyCaps
.wXmax
- JoyCaps
.wXmin
) * 1 / 6;
78 JoyRight
= (JoyCaps
.wXmax
- JoyCaps
.wXmin
) * 5 / 6;
84 //Stores keyboard definition in registry
89 RegCreateKey (HKEY_LOCAL_MACHINE
, "Software\\Bomberman", &KeyHandle
);
90 RegSetValueEx (KeyHandle
, "Keys", 0, REG_BINARY
, (LPBYTE
)ChosenKeys
, 60);
91 RegCloseKey (KeyHandle
);
95 //Checks for keyboard input
103 Up
[0] = GetAsyncKeyState (ChosenKeys
[ 0]);
104 Down
[0] = GetAsyncKeyState (ChosenKeys
[ 1]);
105 Left
[0] = GetAsyncKeyState (ChosenKeys
[ 2]);
106 Right
[0] = GetAsyncKeyState (ChosenKeys
[ 3]);
107 Fire
[0] = GetAsyncKeyState (ChosenKeys
[ 4]);
109 Up
[1] = GetAsyncKeyState (ChosenKeys
[ 5]);
110 Down
[1] = GetAsyncKeyState (ChosenKeys
[ 6]);
111 Left
[1] = GetAsyncKeyState (ChosenKeys
[ 7]);
112 Right
[1] = GetAsyncKeyState (ChosenKeys
[ 8]);
113 Fire
[1] = GetAsyncKeyState (ChosenKeys
[ 9]);
115 Up
[2] = GetAsyncKeyState (ChosenKeys
[10]);
116 Down
[2] = GetAsyncKeyState (ChosenKeys
[11]);
117 Left
[2] = GetAsyncKeyState (ChosenKeys
[12]);
118 Right
[2] = GetAsyncKeyState (ChosenKeys
[13]);
119 Fire
[2] = GetAsyncKeyState (ChosenKeys
[14]);
122 //Player 4 - joystick
124 joyGetPos (JOYSTICKID1
, &JoyInfo
);
125 Up
[3] = (JoyInfo
.wYpos
< JoyUp
);
126 Down
[3] = (JoyInfo
.wYpos
> JoyDown
);
127 Left
[3] = (JoyInfo
.wXpos
< JoyLeft
);
128 Right
[3] = (JoyInfo
.wXpos
> JoyRight
);
129 Fire
[3] = (JoyInfo
.wButtons
& JOY_BUTTON1
);
133 Esc
= GetAsyncKeyState (VK_ESCAPE
);
136 //Flush the keyboard buffer
139 InPointer
= OutPointer
;
142 //Returns a character
147 if (InPointer
== OutPointer
)