1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\r
6 * Project 16 is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * Project 16 is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
\r
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
\r
19 * Fifth Floor, Boston, MA 02110-1301 USA.
\r
24 // ID_IN.h - Header file for Input Manager
\r
26 // By Jason Blochowiak
\r
27 // Open Watcom port by sparky4
\r
34 #include "src/lib/16_head.h"
\r
35 #include "src/lib/16_timer.h"
\r
36 #include "src/lib/16_dbg.h"
\r
37 #ifdef __WATCOMC__ //borland C BCEXMM.EXE
\r
38 #include "src/lib/16_spri.h"
\r
39 #include "src/lib/16_enti.h"
\r
42 #define KeyInt 9 // The keyboard ISR number
\r
44 // Stuff for the joystick
\r
45 #define JoyScaleMax 32768
\r
46 #define JoyScaleShift 8
\r
47 #define MaxJoyValue 5000
\r
49 //#define MaxPlayers 2//future plans for multiple playable charaters and being able to alternate
\r
52 #define NumCodes 128
\r
54 //typedef byte ScanCode;
\r
57 #define sc_Return 0x1c
\r
58 #define sc_Enter sc_Return
\r
59 #define sc_Escape 0x01
\r
60 #define sc_Space 0x39
\r
61 #define sc_BackSpace 0x0e
\r
64 #define sc_Control 0x1d
\r
65 #define sc_CapsLock 0x3a
\r
66 #define sc_LShift 0x2a
\r
67 #define sc_RShift 0x36
\r
68 #define sc_UpArrow 0x48
\r
69 #define sc_DownArrow 0x50
\r
70 #define sc_LeftArrow 0x4b
\r
71 #define sc_RightArrow 0x4d
\r
72 #define sc_Insert 0x52
\r
73 #define sc_Delete 0x53
\r
74 #define sc_Home 0x47
\r
76 #define sc_PgUp 0x49
\r
77 #define sc_PgDn 0x51
\r
130 #define key_Return 0x0d
\r
131 #define key_Enter key_Return
\r
132 #define key_Escape 0x1b
\r
133 #define key_Space 0x20
\r
134 #define key_BackSpace 0x08
\r
135 #define key_Tab 0x09
\r
136 #define key_Delete 0x7f
\r
138 #define key_LSuper 0x5b
\r
139 #define key_RSuper 0x5c
\r
140 #define key_Menu 0x5d
\r
142 // Stuff for the mouse
\r
147 #define MouseInt 0x33
\r
150 demo_Off,demo_Record,demo_Playback,demo_PlayDone
\r
153 //moved to 16_tdef.h
\r
155 //ctrl_None, // MDM (GAMERS EDGE) - added
\r
157 ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,
\r
159 ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,
\r
163 motion_Left = -1,motion_Up = -1,
\r
165 motion_Right = 1,motion_Down = 1
\r
168 dir_North,//dir_NorthEast,
\r
169 dir_West,//dir_Nortinest,
\r
171 dir_East,//,dir_SouthEast,
\r
172 dir_South,//dir_Soutinest,
\r
175 boolean near button0,button1,button2,button3;
\r
177 Motion near xaxis,yaxis;
\r
178 Direction near dir;
\r
182 ScanCode near button0,button1,
\r
194 word near joyMinX,joyMinY,
\r
195 threshMinX,threshMinY,
\r
196 threshMaxX,threshMaxY,
\r
198 joyMultXL,joyMultYL,
\r
199 joyMultXH,joyMultYH;
\r
203 =============================================================================
\r
207 =============================================================================
\r
210 static Demo DemoMode = demo_Off;
\r
211 static byte /*_seg*/ *DemoBuffer;
\r
212 static word DemoOffset,DemoSize;
\r
215 // Internal routines
\r
216 extern void IN_Startup(void),IN_Shutdown(void),
\r
217 IN_Default(boolean gotit,player_t *player,ControlType nt),
\r
218 IN_SetKeyHook(void (*)()),
\r
219 IN_ClearKeysDown(void),
\r
220 IN_ReadCursor(CursorInfo *),
\r
221 IN_ReadControl(player_t *player),
\r
222 IN_SetControlType(player_t *player,ControlType type),
\r
223 IN_GetJoyAbs(word joy,word *xp,word *yp),
\r
224 IN_SetupJoy(word joy,word minx,word maxx,
\r
225 word miny,word maxy),
\r
227 IN_StopDemo(void),IN_FreeDemoBuffer(void),
\r
229 IN_Ack(void),IN_AckBack(void);
\r
230 extern boolean IN_UserInput(word delay);
\r
231 extern char IN_WaitForASCII(void);
\r
232 extern ScanCode IN_WaitForKey(void);
\r
233 extern word IN_GetJoyButtonsDB(word joy);
\r
234 extern byte *IN_GetScanName(ScanCode);
\r
237 byte IN_MouseButtons (void);
\r
238 byte IN_JoyButtons (void);
\r
240 void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/);
\r
241 void IN_StartAck(void);
\r
242 boolean IN_CheckAck (void);
\r
243 boolean IN_IsUserInput();
\r
244 #define Mouse(x) INL_Mouse(x)
\r
245 //void IN_SetKeyHook(void (*hook)());
\r
247 boolean IN_StartDemoRecord(word bufsize);
\r
248 void IN_StartDemoPlayback(byte *buffer,word bufsize);
\r
249 void IN_StopDemo(void);
\r
250 void IN_FreeDemoBuffer(void);
\r
253 boolean IN_KeyDown(byte code),
\r
255 void IN_ClearKey(byte code),
\r
257 ScanCode IN_GetLastScan(),
\r