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