]> 4ch.mooo.com Git - 16.git/blob - 16/cawat/ID_IN.H
wwww
[16.git] / 16 / cawat / ID_IN.H
1 /* Catacomb Armageddon Source Code\r
2  * Copyright (C) 1993-2014 Flat Rock Software\r
3  *\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
8  *\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
13  *\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
17  */\r
18 \r
19 //\r
20 //      ID Engine\r
21 //      ID_IN.h - Header file for Input Manager\r
22 //      v1.0d1\r
23 //      By Jason Blochowiak\r
24 //\r
25
26 #include "lib_head.h"
27 \r
28 #ifndef __TYPES__\r
29 #include "ID_Types.h"\r
30 #endif\r
31 \r
32 #ifndef __ID_IN__\r
33 #define __ID_IN__\r
34 \r
35 #ifdef  __DEBUG__\r
36 #define __DEBUG_InputMgr__\r
37 #endif\r
38 \r
39 #define MaxPlayers      4\r
40 #define MaxKbds         2\r
41 #define MaxJoys         2\r
42 #define NumCodes        128\r
43 \r
44 typedef byte            ScanCode;\r
45 #define sc_None                 0\r
46 #define sc_Bad                  0xff\r
47 #define sc_Return               0x1c\r
48 #define sc_Enter                sc_Return\r
49 #define sc_Escape               0x01\r
50 #define sc_Space                0x39\r
51 #define sc_BackSpace    0x0e\r
52 #define sc_Tab                  0x0f\r
53 #define sc_Alt                  0x38\r
54 #define sc_Control              0x1d\r
55 #define sc_CapsLock             0x3a\r
56 #define sc_LShift               0x2a\r
57 #define sc_RShift               0x36\r
58 #define sc_UpArrow              0x48\r
59 #define sc_DownArrow    0x50\r
60 #define sc_LeftArrow    0x4b\r
61 #define sc_RightArrow   0x4d\r
62 #define sc_Insert               0x52\r
63 #define sc_Delete               0x53\r
64 #define sc_Home                 0x47\r
65 #define sc_End                  0x4f\r
66 #define sc_PgUp                 0x49\r
67 #define sc_PgDn                 0x51\r
68 #define sc_F1                   0x3b\r
69 #define sc_F2                   0x3c\r
70 #define sc_F3                   0x3d\r
71 #define sc_F4                   0x3e\r
72 #define sc_F5                   0x3f\r
73 #define sc_F6                   0x40\r
74 #define sc_F7                   0x41\r
75 #define sc_F8                   0x42\r
76 #define sc_F9                   0x43\r
77 #define sc_F10                  0x44\r
78 #define sc_F11                  0x57\r
79 #define sc_F12                  0x59\r
80 \r
81 #define sc_A                    0x1e\r
82 #define sc_B                    0x30\r
83 #define sc_C                    0x2e\r
84 #define sc_D                    0x20\r
85 #define sc_E                    0x12\r
86 #define sc_F                    0x21\r
87 #define sc_G                    0x22\r
88 #define sc_H                    0x23\r
89 #define sc_I                    0x17\r
90 #define sc_J                    0x24\r
91 #define sc_K                    0x25\r
92 #define sc_L                    0x26\r
93 #define sc_M                    0x32\r
94 #define sc_N                    0x31\r
95 #define sc_O                    0x18\r
96 #define sc_P                    0x19\r
97 #define sc_Q                    0x10\r
98 #define sc_R                    0x13\r
99 #define sc_S                    0x1f\r
100 #define sc_T                    0x14\r
101 #define sc_U                    0x16\r
102 #define sc_V                    0x2f\r
103 #define sc_W                    0x11\r
104 #define sc_X                    0x2d\r
105 #define sc_Y                    0x15\r
106 #define sc_Z                    0x2c\r
107 \r
108 #define key_None                0\r
109 #define key_Return              0x0d\r
110 #define key_Enter               key_Return\r
111 #define key_Escape              0x1b\r
112 #define key_Space               0x20\r
113 #define key_BackSpace   0x08\r
114 #define key_Tab                 0x09\r
115 #define key_Delete              0x7f\r
116 \r
117 //      Stuff for the mouse\r
118 #define MReset          0\r
119 #define MButtons        3\r
120 #define MDelta          11\r
121 \r
122 #define MouseInt        0x33\r
123 #define Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
124 \r
125 typedef enum            {\r
126                                                 demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
127                                         } Demo;\r
128 typedef enum            {\r
129                                                 ctrl_None,                              // MDM (GAMERS EDGE) - added\r
130                                                 ctrl_Keyboard,\r
131                                                         ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
132                                                 ctrl_Joystick,\r
133                                                         ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
134                                                 ctrl_Mouse\r
135                                         } ControlType;\r
136 typedef enum            {\r
137                                                 motion_Left = -1,motion_Up = -1,\r
138                                                 motion_None = 0,\r
139                                                 motion_Right = 1,motion_Down = 1\r
140                                         } Motion;\r
141 typedef enum            {\r
142                                                 dir_North,dir_NorthEast,\r
143                                                 dir_East,dir_SouthEast,\r
144                                                 dir_South,dir_SouthWest,\r
145                                                 dir_West,dir_NorthWest,\r
146                                                 dir_None\r
147                                         } Direction;\r
148 typedef struct          {\r
149                                                 boolean         button0,button1;\r
150                                                 int                     x,y;\r
151                                                 Motion          xaxis,yaxis;\r
152                                                 Direction       dir;\r
153                                         } CursorInfo;\r
154 typedef CursorInfo      ControlInfo;\r
155 typedef struct          {\r
156                                                 ScanCode        button0,button1,\r
157                                                                         upleft,         up,             upright,\r
158                                                                         left,                           right,\r
159                                                                         downleft,       down,   downright;\r
160                                         } KeyboardDef;\r
161 typedef struct          {\r
162                                                 word            joyMinX,joyMinY,\r
163                                                                         threshMinX,threshMinY,\r
164                                                                         threshMaxX,threshMaxY,\r
165                                                                         joyMaxX,joyMaxY,\r
166                                                                         joyMultXL,joyMultYL,\r
167                                                                         joyMultXH,joyMultYH;\r
168                                         } JoystickDef;\r
169 // Global variables\r
170 extern  boolean         Keyboard[],\r
171                                         MousePresent,\r
172                                         JoysPresent[];\r
173 extern  boolean         Paused;\r
174 extern  char            LastASCII;\r
175 extern  ScanCode        LastScan;\r
176 extern  KeyboardDef     KbdDefs[];\r
177 extern  JoystickDef     JoyDefs[];\r
178 extern  ControlType     Controls[MaxPlayers];\r
179 \r
180 extern  boolean JoystickCalibrated;                             // MDM (GAMERS EDGE) - added\r
181 extern  ControlType ControlTypeUsed;                            // MDM (GAMERS EDGE) - added\r
182 \r
183 extern  Demo            DemoMode;\r
184 extern  byte _seg       *DemoBuffer;\r
185 extern  word            DemoOffset,DemoSize;\r
186 \r
187 // Function prototypes\r
188 #define IN_KeyDown(code)        (Keyboard[(code)])\r
189 #define IN_ClearKey(code)       {Keyboard[code] = false;\\r
190                                                         if (code == LastScan) LastScan = sc_None;}\r
191 \r
192 // DEBUG - put names in prototypes\r
193 extern  void            IN_Startup(void),IN_Shutdown(void),\r
194                                         IN_Default(boolean gotit,ControlType in),\r
195                                         IN_SetKeyHook(void (*)()),\r
196                                         IN_ClearKeysDown(void),\r
197                                         IN_ReadCursor(CursorInfo *),\r
198                                         IN_ReadControl(int,ControlInfo *),\r
199                                         IN_SetControlType(int,ControlType),\r
200                                         IN_GetJoyAbs(word joy,word *xp,word *yp),\r
201                                         IN_SetupJoy(word joy,word minx,word maxx,\r
202                                                                 word miny,word maxy),\r
203                                         IN_StartDemoPlayback(byte _seg *buffer,word bufsize),\r
204                                         IN_StopDemo(void),IN_FreeDemoBuffer(void),\r
205                                         IN_Ack(void),IN_AckBack(void);\r
206 extern  boolean         IN_UserInput(longword delay,boolean clear),\r
207                                         IN_IsUserInput(void),\r
208                                         IN_StartDemoRecord(word bufsize);\r
209 extern  byte            *IN_GetScanName(ScanCode);\r
210 extern  char            IN_WaitForASCII(void);\r
211 extern  ScanCode        IN_WaitForKey(void);\r
212 extern  word            IN_GetJoyButtonsDB(word joy);\r
213 \r
214 #endif\r