1 /* Catacomb Apocalypse Source Code
\r
2 * Copyright (C) 1993-2014 Flat Rock Software
\r
4 * This program is free software; you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation; either version 2 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License along
\r
15 * with this program; if not, write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
21 // ID_IN.h - Header file for Input Manager
\r
23 // By Jason Blochowiak
\r
24 // Open Watcom port by sparky4
\r
31 #include "src/lib/16_head.h"
32 #include "src/lib/bitmap.h"
\r
35 //#define __DEBUG_InputMgr__
\r
38 #ifdef __DEBUG_InputMgr__
\r
40 //#define TESTCONTROLNOISY
\r
43 #define KeyInt 9 // The keyboard ISR number
\r
45 // Stuff for the joystick
\r
46 #define JoyScaleMax 32768
\r
47 #define JoyScaleShift 8
\r
48 #define MaxJoyValue 5000
\r
50 #define MaxPlayers 4
\r
54 #define NumCodes 128
\r
56 typedef byte ScanCode;
\r
59 #define sc_Return 0x1c
\r
60 #define sc_Enter sc_Return
\r
61 #define sc_Escape 0x01
\r
62 #define sc_Space 0x39
\r
63 #define sc_BackSpace 0x0e
\r
66 #define sc_Control 0x1d
\r
67 #define sc_CapsLock 0x3a
\r
68 #define sc_LShift 0x2a
\r
69 #define sc_RShift 0x36
\r
70 #define sc_UpArrow 0x48
\r
71 #define sc_DownArrow 0x50
\r
72 #define sc_LeftArrow 0x4b
\r
73 #define sc_RightArrow 0x4d
\r
74 #define sc_Insert 0x52
\r
75 #define sc_Delete 0x53
\r
76 #define sc_Home 0x47
\r
78 #define sc_PgUp 0x49
\r
79 #define sc_PgDn 0x51
\r
132 #define key_Return 0x0d
\r
133 #define key_Enter key_Return
\r
134 #define key_Escape 0x1b
\r
135 #define key_Space 0x20
\r
136 #define key_BackSpace 0x08
\r
137 #define key_Tab 0x09
\r
138 #define key_Delete 0x7f
\r
140 #define key_LSuper 0x5b
\r
141 #define key_RSuper 0x5c
\r
142 #define key_Menu 0x5d
\r
144 // Stuff for the mouse
\r
149 #define MouseInt 0x33
\r
152 demo_Off,demo_Record,demo_Playback,demo_PlayDone
\r
156 //ctrl_None, // MDM (GAMERS EDGE) - added
\r
158 ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,
\r
160 ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,
\r
163 ctrl_Joypad1 = ctrl_Joypad,ctrl_Joypad2
\r
166 motion_Left = -1,motion_Up = -1,
\r
168 motion_Right = 1,motion_Down = 1
\r
171 dir_North,//dir_NorthEast,
\r
172 dir_West,//dir_Nortinest,
\r
174 dir_East,//,dir_SouthEast,
\r
175 dir_South,//dir_Soutinest,
\r
178 boolean button0,button1,button2,button3;
\r
180 Motion xaxis,yaxis;
\r
185 ScanCode button0,button1,
\r
197 word joyMinX,joyMinY,
\r
198 threshMinX,threshMinY,
\r
199 threshMaxX,threshMaxY,
\r
201 joyMultXL,joyMultYL,
\r
202 joyMultXH,joyMultYH;
\r
211 int x; //player exact position on the viewable map
\r
212 int y; //player exact position on the viewable map
\r
213 int tx; //player tile position on the viewable map
\r
214 int ty; //player tile position on the viewable map
\r
215 int triggerx; //player's trigger box tile position on the viewable map
\r
216 int triggery; //player's trigger box tile position on the viewable map
\r
217 int setx; //NOT USED YET! player sprite sheet set on the image x
\r
218 int sety; //NOT USED YET! player sprite sheet set on the image y
\r
219 word q; //loop variable
220 word speed; //player speed!
\r
221 bitmap_t data; //supposively the sprite sheet data
\r
222 int hp; //hitpoints of the player
223 word persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */
\r
225 ControlType Controls;
229 =============================================================================
\r
233 =============================================================================
\r
235 /*extern struct inconfig
\r
237 boolean MousePresent;
\r
238 boolean JoysPresent[MaxJoys];
\r
239 boolean JoyPadPresent[MaxPads];
\r
240 boolean Keyboard[NumCodes];
\r
245 KeyboardDef KbdDefs[MaxKbds];
\r
246 JoystickDef JoyDefs[MaxJoys];
\r
247 JoypadDef JoypadDefs[MaxPads];
\r
251 static Demo DemoMode = demo_Off;
\r
252 static byte /*_seg*/ *DemoBuffer;
\r
253 static word DemoOffset,DemoSize;
\r
256 extern dword far* clockdw;
\r
258 // Internal routines
\r
259 extern void interrupt INL_KeyService();
\r
260 extern void Mouse(int x);
\r
261 //static void INL_GetMouseDelta(int *x,int *y);
\r
262 //static word INL_GetMouseButtons(void);
\r
263 extern void IN_GetJoyAbs(word joy,word *xp,word *yp);
\r
264 //static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive);
\r
265 //static word INL_GetJoyButtons(word joy);
\r
266 extern word IN_GetJoyButtonsDB(word joy);
\r
267 //static void INL_StartKbd(void);
\r
268 //static void INL_ShutKbd(void);
\r
269 //static boolean INL_StartMouse(void);
\r
270 //static void INL_ShutMouse(void);
\r
271 //static void INL_SetJoyScale(word joy);
\r
272 extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy);
\r
273 //static boolean INL_StartJoy(word joy);
\r
274 //static void INL_ShutJoy(word joy);
\r
275 extern void IN_Startup();
\r
276 extern void IN_Default(boolean gotit,player_t *player,ControlType nt);
\r
277 extern void IN_Shutdown();
\r
278 extern void IN_SetKeyHook(void (*hook)());
\r
279 extern void IN_ClearKeysDown();
\r
280 //static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);
\r
281 extern void IN_ReadCursor(CursorInfo *info);
\r
282 extern void IN_ReadControl(int playnum,player_t *player);
\r
283 extern void IN_SetControlType(word playnum,player_t *player,ControlType type);
\r
285 extern boolean IN_StartDemoRecord(word bufsize);
\r
286 extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);
\r
287 extern void IN_StopDemo(void);
\r
288 extern void IN_FreeDemoBuffer(void);
\r
290 extern byte *IN_GetScanName(ScanCode scan);
\r
291 extern ScanCode IN_WaitForKey();
\r
292 extern char IN_WaitForASCII();
\r
293 extern void IN_AckBack();
\r
294 extern void IN_Ack();
\r
295 extern boolean IN_IsUserInput();
\r
296 extern boolean IN_UserInput(dword delay,boolean clear);
\r
297 extern boolean IN_KeyDown(byte code);
\r
298 extern void IN_ClearKey(byte code);
\r
299 extern boolean IN_qb(byte kee);
\r