1 /* Reconstructed Commander Keen 4-6 Source Code
\r
2 * Copyright (C) 2021 K1n9_Duk3
\r
4 * This file is primarily based on:
\r
5 * Catacomb 3-D Source Code
\r
6 * Copyright (C) 1993-2014 Flat Rock Software
\r
8 * This program is free software; you can redistribute it and/or modify
\r
9 * it under the terms of the GNU General Public License as published by
\r
10 * the Free Software Foundation; either version 2 of the License, or
\r
11 * (at your option) any later version.
\r
13 * This program is distributed in the hope that it will be useful,
\r
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
16 * GNU General Public License for more details.
\r
18 * You should have received a copy of the GNU General Public License along
\r
19 * with this program; if not, write to the Free Software Foundation, Inc.,
\r
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
25 // ID_IN.h - Header file for Input Manager
\r
27 // By Jason Blochowiak
\r
31 #include "ID_Types.h"
\r
38 #define __DEBUG_InputMgr__
\r
41 #define MaxPlayers 4
\r
44 #define NumCodes 128
\r
46 typedef byte ScanCode;
\r
49 #define sc_Return 0x1c
\r
50 #define sc_Enter sc_Return
\r
51 #define sc_Escape 0x01
\r
52 #define sc_Space 0x39
\r
53 #define sc_BackSpace 0x0e
\r
56 #define sc_Control 0x1d
\r
57 #define sc_CapsLock 0x3a
\r
58 #define sc_LShift 0x2a
\r
59 #define sc_RShift 0x36
\r
60 #define sc_UpArrow 0x48
\r
61 #define sc_DownArrow 0x50
\r
62 #define sc_LeftArrow 0x4b
\r
63 #define sc_RightArrow 0x4d
\r
64 #define sc_Insert 0x52
\r
65 #define sc_Delete 0x53
\r
66 #define sc_Home 0x47
\r
68 #define sc_PgUp 0x49
\r
69 #define sc_PgDn 0x51
\r
81 #define sc_F12 0x59 // BUG: F12 uses scan code 0x58!
\r
122 #define key_Return 0x0d
\r
123 #define key_Enter key_Return
\r
124 #define key_Escape 0x1b
\r
125 #define key_Space 0x20
\r
126 #define key_BackSpace 0x08
\r
127 #define key_Tab 0x09
\r
128 #define key_Delete 0x7f
\r
130 // Stuff for the mouse
\r
135 #define MouseInt 0x33
\r
136 #define Mouse(x) _AX = x,geninterrupt(MouseInt)
\r
139 demo_Off,demo_Record,demo_Playback,demo_PlayDone
\r
143 ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,
\r
145 ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,
\r
149 motion_Left = -1,motion_Up = -1,
\r
151 motion_Right = 1,motion_Down = 1
\r
154 dir_North,dir_NorthEast,
\r
155 dir_East,dir_SouthEast,
\r
156 dir_South,dir_SouthWest,
\r
157 dir_West,dir_NorthWest,
\r
167 boolean button0,button1;
\r
169 Motion xaxis,yaxis;
\r
172 typedef CursorInfo ControlInfo;
\r
174 ScanCode button0,button1,
\r
175 upleft, up, upright,
\r
177 downleft, down, downright;
\r
180 word joyMinX,joyMinY,
\r
181 threshMinX,threshMinY,
\r
182 threshMaxX,threshMaxY,
\r
184 joyMultXL,joyMultYL,
\r
185 joyMultXH,joyMultYH;
\r
187 // Global variables
\r
188 extern boolean Keyboard[],
\r
191 extern boolean Paused;
\r
192 extern char LastASCII;
\r
193 extern ScanCode LastScan;
\r
194 extern KeyboardDef KbdDefs[];
\r
195 extern JoystickDef JoyDefs[];
\r
196 extern ControlType Controls[MaxPlayers];
\r
197 extern boolean GravisGamepad;
\r
198 extern word GravisAction[4];
\r
199 extern word GravisMap[4];
\r
201 extern Demo DemoMode;
\r
202 extern byte _seg *DemoBuffer;
\r
203 extern word DemoOffset,DemoSize;
\r
205 // Function prototypes
\r
206 #define IN_KeyDown(code) (Keyboard[(code)])
\r
207 #define IN_ClearKey(code) {Keyboard[code] = false;\
\r
208 if (code == LastScan) LastScan = sc_None;}
\r
210 // DEBUG - put names in prototypes
\r
211 extern void IN_Startup(void),IN_Shutdown(void),
\r
212 IN_Default(boolean gotit,ControlType in),
\r
213 IN_SetKeyHook(void (*)()),
\r
214 IN_ClearKeysDown(void),
\r
215 IN_ReadCursor(CursorInfo *),
\r
216 IN_ReadControl(int,ControlInfo *),
\r
217 IN_SetControlType(int,ControlType),
\r
218 IN_GetJoyAbs(word joy,word *xp,word *yp),
\r
219 IN_SetupJoy(word joy,word minx,word maxx,
\r
220 word miny,word maxy),
\r
221 IN_StartDemoPlayback(byte _seg *buffer,word bufsize),
\r
222 IN_StopDemo(void),IN_FreeDemoBuffer(void),
\r
223 IN_Ack(void),IN_AckBack(void);
\r
224 extern boolean IN_UserInput(longword delay,boolean clear),
\r
225 IN_IsUserInput(void),
\r
226 IN_StartDemoRecord(word bufsize);
\r
227 extern byte *IN_GetScanName(ScanCode);
\r
228 extern char IN_WaitForASCII(void);
\r
229 extern ScanCode IN_WaitForKey(void);
\r
230 extern word IN_GetJoyButtonsDB(word joy);
\r