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