]> 4ch.mooo.com Git - 16.git/blob - 16/keen456/KEEN4-6/ID_IN.H
extrcted keen code remake
[16.git] / 16 / keen456 / KEEN4-6 / ID_IN.H
1 /* Reconstructed Commander Keen 4-6 Source Code\r
2  * Copyright (C) 2021 K1n9_Duk3\r
3  *\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
7  *\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
12  *\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
17  *\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
21  */\r
22 \r
23 //\r
24 //      ID Engine\r
25 //      ID_IN.h - Header file for Input Manager\r
26 //      v1.0d1\r
27 //      By Jason Blochowiak\r
28 //\r
29 \r
30 #ifndef __TYPES__\r
31 #include "ID_Types.h"\r
32 #endif\r
33 \r
34 #ifndef __ID_IN__\r
35 #define __ID_IN__\r
36 \r
37 #ifdef  __DEBUG__\r
38 #define __DEBUG_InputMgr__\r
39 #endif\r
40 \r
41 #define MaxPlayers      4\r
42 #define MaxKbds         2\r
43 #define MaxJoys         2\r
44 #define NumCodes        128\r
45 \r
46 typedef byte            ScanCode;\r
47 #define sc_None                 0\r
48 #define sc_Bad                  0xff\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
54 #define sc_Tab                  0x0f\r
55 #define sc_Alt                  0x38\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
67 #define sc_End                  0x4f\r
68 #define sc_PgUp                 0x49\r
69 #define sc_PgDn                 0x51\r
70 #define sc_F1                   0x3b\r
71 #define sc_F2                   0x3c\r
72 #define sc_F3                   0x3d\r
73 #define sc_F4                   0x3e\r
74 #define sc_F5                   0x3f\r
75 #define sc_F6                   0x40\r
76 #define sc_F7                   0x41\r
77 #define sc_F8                   0x42\r
78 #define sc_F9                   0x43\r
79 #define sc_F10                  0x44\r
80 #define sc_F11                  0x57\r
81 #define sc_F12                  0x59    // BUG: F12 uses scan code 0x58!\r
82 \r
83 #define sc_A                    0x1e\r
84 #define sc_B                    0x30\r
85 #define sc_C                    0x2e\r
86 #define sc_D                    0x20\r
87 #define sc_E                    0x12\r
88 #define sc_F                    0x21\r
89 #define sc_G                    0x22\r
90 #define sc_H                    0x23\r
91 #define sc_I                    0x17\r
92 #define sc_J                    0x24\r
93 #define sc_K                    0x25\r
94 #define sc_L                    0x26\r
95 #define sc_M                    0x32\r
96 #define sc_N                    0x31\r
97 #define sc_O                    0x18\r
98 #define sc_P                    0x19\r
99 #define sc_Q                    0x10\r
100 #define sc_R                    0x13\r
101 #define sc_S                    0x1f\r
102 #define sc_T                    0x14\r
103 #define sc_U                    0x16\r
104 #define sc_V                    0x2f\r
105 #define sc_W                    0x11\r
106 #define sc_X                    0x2d\r
107 #define sc_Y                    0x15\r
108 #define sc_Z                    0x2c\r
109 \r
110 #define sc_1                    0x02\r
111 #define sc_2                    0x03\r
112 #define sc_3                    0x04\r
113 #define sc_4                    0x05\r
114 #define sc_5                    0x06\r
115 #define sc_6                    0x07\r
116 #define sc_7                    0x08\r
117 #define sc_8                    0x09\r
118 #define sc_9                    0x0a\r
119 #define sc_0                    0x0b\r
120 \r
121 #define key_None                0\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
129 \r
130 //      Stuff for the mouse\r
131 #define MReset          0\r
132 #define MButtons        3\r
133 #define MDelta          11\r
134 \r
135 #define MouseInt        0x33\r
136 #define Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
137 \r
138 typedef enum            {\r
139                                                 demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
140                                         } Demo;\r
141 typedef enum            {\r
142                                                 ctrl_Keyboard,\r
143                                                         ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
144                                                 ctrl_Joystick,\r
145                                                         ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
146                                                 ctrl_Mouse\r
147                                         } ControlType;\r
148 typedef enum            {\r
149                                                 motion_Left = -1,motion_Up = -1,\r
150                                                 motion_None = 0,\r
151                                                 motion_Right = 1,motion_Down = 1\r
152                                         } Motion;\r
153 typedef enum            {\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
158                                                 dir_None\r
159                                         } Direction;\r
160 typedef enum            {\r
161                                                 ga_Jump,\r
162                                                 ga_Pogo,\r
163                                                 ga_Fire,\r
164                                                 ga_Status\r
165                                         } GravisAType;\r
166 typedef struct          {\r
167                                                 boolean         button0,button1;\r
168                                                 int                     x,y;\r
169                                                 Motion          xaxis,yaxis;\r
170                                                 Direction       dir;\r
171                                         } CursorInfo;\r
172 typedef CursorInfo      ControlInfo;\r
173 typedef struct          {\r
174                                                 ScanCode        button0,button1,\r
175                                                                         upleft,         up,             upright,\r
176                                                                         left,                           right,\r
177                                                                         downleft,       down,   downright;\r
178                                         } KeyboardDef;\r
179 typedef struct          {\r
180                                                 word            joyMinX,joyMinY,\r
181                                                                         threshMinX,threshMinY,\r
182                                                                         threshMaxX,threshMaxY,\r
183                                                                         joyMaxX,joyMaxY,\r
184                                                                         joyMultXL,joyMultYL,\r
185                                                                         joyMultXH,joyMultYH;\r
186                                         } JoystickDef;\r
187 // Global variables\r
188 extern  boolean         Keyboard[],\r
189                                         MousePresent,\r
190                                         JoysPresent[];\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
200 \r
201 extern  Demo            DemoMode;\r
202 extern  byte _seg       *DemoBuffer;\r
203 extern  word            DemoOffset,DemoSize;\r
204 \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
209 \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
231 \r
232 #endif\r