1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
7 // static char *VB_Name = "modInput";
11 boolean KeyState[255 + 1];
12 DemoBufferObject DemoBuffer;
15 // Public KeyFlagSpace As Boolean
16 // Public KeyFlagUp As Boolean
17 // Public KeyFlagLeft As Boolean
18 // Public KeyFlagDown As Boolean
19 // Public KeyFlagRight As Boolean
20 // Public KeyFlagEnter As Boolean
21 // Public KeyFlagESC As Boolean
22 // Public KeyFlagR As Boolean
23 // Public KeyFlagRShift As Boolean
27 int map_key_RND_to_SP(int key)
31 return (key & MV_UP ? keySpaceUp :
32 key & MV_LEFT ? keySpaceLeft :
33 key & MV_DOWN ? keySpaceDown :
34 key & MV_RIGHT ? keySpaceRight : keySpace);
38 return (key & MV_UP ? keyUp :
39 key & MV_LEFT ? keyLeft :
40 key & MV_DOWN ? keyDown :
41 key & MV_RIGHT ? keyRight : keyNone);
45 int map_key_SP_to_RND(int key)
47 return (key == keyUp ? MV_UP :
48 key == keyLeft ? MV_LEFT :
49 key == keyDown ? MV_DOWN :
50 key == keyRight ? MV_RIGHT :
51 key == keySpaceUp ? KEY_BUTTON | MV_UP :
52 key == keySpaceLeft ? KEY_BUTTON | MV_LEFT :
53 key == keySpaceDown ? KEY_BUTTON | MV_DOWN :
54 key == keySpaceRight ? KEY_BUTTON | MV_RIGHT :
55 key == keySpace ? KEY_BUTTON : MV_NONE);
58 void subCheckJoystick()
62 int subCheckRightMouseButton()
64 int subCheckRightMouseButton;
66 // return button state
68 return subCheckRightMouseButton;
71 int subProcessKeyboardInput(byte action)
73 int subProcessKeyboardInput;
75 static int LastKey = 0;
79 DemoKeyCode = map_key_RND_to_SP(action);
82 printf("::: DemoKeyCode == %d\n", DemoKeyCode);
85 return subProcessKeyboardInput;
89 // On Error GoTo NoKeyboardAccessEH
90 // Call DKeyboard.Acquire
92 // Call DKeyboard.GetDeviceStateKeyboard(KeyState)
99 printf("::: DemoKeyCode == %d\n", DemoKeyCode);
102 if (ExitToMenuFlag != 0)
103 return subProcessKeyboardInput;
107 if (KeyState[vbKeySpace])
109 if (KeyState[vbKeyUp])
111 DemoKeyCode = keySpaceUp;
113 else if (KeyState[vbKeyLeft])
115 DemoKeyCode = keySpaceLeft;
117 else if (KeyState[vbKeyDown])
119 DemoKeyCode = keySpaceDown;
121 else if (KeyState[vbKeyRight])
123 DemoKeyCode = keySpaceRight;
127 DemoKeyCode = keySpace;
133 if (KeyState[vbKeyUp])
137 else if (KeyState[vbKeyLeft])
139 DemoKeyCode = keyLeft;
141 else if (KeyState[vbKeyDown])
143 DemoKeyCode = keyDown;
145 else if (KeyState[vbKeyRight])
147 DemoKeyCode = keyRight;
151 DemoKeyCode = keyNone;
159 if (RecordDemoFlag == 1)
160 DemoBuffer.AddDemoKey(DemoKeyCode);
162 if (DemoKeyCode != LastKey && ! NoDisplayFlag)
165 MainForm.ShowKey(DemoKeyCode);
167 LastKey = DemoKeyCode;
170 if (KeyState[vbKeyEscape])
174 // Call MainForm.menSpeed_Click(4)
179 printf("::: Input.c: subProcessKeyboardInput(): kill murphy\n");
183 // ExplodeFieldSP MurphyPosIndex
184 // LeadOutCounter = &H20
188 if (KeyState[vbKeyR])
190 subFetchAndInitLevelB();
193 if (KeyState[vbKeyShift])
194 subDisplayRedDiskCount();
197 if (KeyState[vbKeyReturn])
198 MainForm.PanelVisible = (ShowPanel == 0);
202 // Call DKeyboard.Unacquire
203 return subProcessKeyboardInput;
205 // NoKeyboardAccessEH:
206 Debug.Print("! Keyboard access");
208 return subProcessKeyboardInput;