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
141 #define sc_LBrkt 0x1a // [
\r
142 #define sc_RBrkt 0x1b // ]
\r
143 #define sc_BackSlash 0x2b // |
\r
144 #define sc_ForeSlash 0x35 // / ?
\r
146 // Stuff for the mouse
\r
151 #define MouseInt 0x33
\r
154 demo_Off,demo_Record,demo_Playback,demo_PlayDone
\r
157 //moved to 16_tdef.h
\r
159 //ctrl_None, // MDM (GAMERS EDGE) - added
\r
161 ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,
\r
163 ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,
\r
167 motion_Left = -1,motion_Up = -1,
\r
169 motion_Right = 1,motion_Down = 1
\r
172 dir_North,//dir_NorthEast,
\r
173 dir_West,//dir_Nortinest,
\r
175 dir_East,//,dir_SouthEast,
\r
176 dir_South,//dir_Soutinest,
\r
179 boolean near button0,button1,button2,button3;
\r
181 Motion near xaxis,yaxis;
\r
182 Direction near dir;
\r
186 ScanCode near button0,button1,
\r
198 word near joyMinX,joyMinY,
\r
199 threshMinX,threshMinY,
\r
200 threshMaxX,threshMaxY,
\r
202 joyMultXL,joyMultYL,
\r
203 joyMultXH,joyMultYH;
\r
207 =============================================================================
\r
211 =============================================================================
\r
214 static Demo DemoMode = demo_Off;
\r
215 static byte /*_seg*/ *DemoBuffer;
\r
216 static word DemoOffset,DemoSize;
\r
219 // Internal routines
\r
220 extern void IN_Startup(global_game_variables_t *gvar),IN_Shutdown(global_game_variables_t *gvar),
\r
221 IN_Default(boolean gotit,player_t *player,ControlType nt, global_game_variables_t *gvar),
\r
222 IN_SetKeyHook(void (*)()),
\r
223 IN_ClearKeysDown(void),
\r
224 IN_ReadCursor(CursorInfo *, global_game_variables_t *gvar),
\r
225 IN_ReadControl(player_t *player, global_game_variables_t *gvar),
\r
226 IN_SetControlType(player_t *player,ControlType type),
\r
227 IN_GetJoyAbs(word joy,word *xp,word *yp),
\r
228 IN_SetupJoy(word joy,word minx,word maxx,
\r
229 word miny,word maxy, global_game_variables_t *gvar),
\r
231 IN_StopDemo(void),IN_FreeDemoBuffer(void),
\r
233 IN_Ack(global_game_variables_t *gvar),IN_AckBack(void);
\r
234 extern boolean IN_UserInput(word delay, global_game_variables_t *gvar);
\r
235 extern char IN_WaitForASCII(void);
\r
236 extern ScanCode IN_WaitForKey(void);
\r
237 extern word IN_GetJoyButtonsDB(word joy);
\r
238 extern byte *IN_GetScanName(ScanCode);
\r
241 byte IN_MouseButtons (global_game_variables_t *gvar);
\r
242 byte IN_JoyButtons (void);
\r
244 void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/, global_game_variables_t *gvar);
\r
245 void IN_StartAck(global_game_variables_t *gvar);
\r
246 boolean IN_CheckAck (global_game_variables_t *gvar);
\r
247 boolean IN_IsUserInput(global_game_variables_t *gvar);
\r
248 #define Mouse(x) INL_Mouse(x)
\r
249 //void IN_SetKeyHook(void (*hook)());
\r
251 boolean IN_StartDemoRecord(word bufsize);
\r
252 void IN_StartDemoPlayback(byte *buffer,word bufsize);
\r
253 void IN_StopDemo(void);
\r
254 void IN_FreeDemoBuffer(void);
\r
257 //boolean IN_KeyDown(byte code),
\r
258 // IN_qb(byte kee);
\r
259 void IN_ClearKey(byte code),
\r
261 ScanCode IN_GetLastScan(),
\r