--- /dev/null
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+//\r
+// ID Engine\r
+// ID_IN.h - Header file for Input Manager\r
+// v1.0d1w\r
+// By Jason Blochowiak\r
+// Open Watcom port by sparky4\r
+//\r
+\r
+#ifndef __16_IN__\r
+#define __16_IN__\r
+\r
+#include <string.h>\r
+#include "src/lib/16_head.h"\r
+#include "src/lib/16_timer.h"\r
+#include "src/lib/16_dbg.h"\r
+#ifdef __WATCOMC__ //borland C BCEXMM.EXE\r
+#include "src/lib/16_spri.h"\r
+#include "src/lib/16_enti.h"\r
+#endif\r
+\r
+#define KeyInt 9 // The keyboard ISR number\r
+\r
+// Stuff for the joystick\r
+#define JoyScaleMax 32768\r
+#define JoyScaleShift 8\r
+#define MaxJoyValue 5000\r
+\r
+//#define MaxPlayers 2//future plans for multiple playable charaters and being able to alternate\r
+#define MaxKbds 2\r
+#define MaxJoys 2\r
+#define NumCodes 128\r
+\r
+//typedef byte ScanCode;\r
+#define sc_None 0\r
+#define sc_Bad 0xff\r
+#define sc_Return 0x1c\r
+#define sc_Enter sc_Return\r
+#define sc_Escape 0x01\r
+#define sc_Space 0x39\r
+#define sc_BackSpace 0x0e\r
+#define sc_Tab 0x0f\r
+#define sc_Alt 0x38\r
+#define sc_Control 0x1d\r
+#define sc_CapsLock 0x3a\r
+#define sc_LShift 0x2a\r
+#define sc_RShift 0x36\r
+#define sc_UpArrow 0x48\r
+#define sc_DownArrow 0x50\r
+#define sc_LeftArrow 0x4b\r
+#define sc_RightArrow 0x4d\r
+#define sc_Insert 0x52\r
+#define sc_Delete 0x53\r
+#define sc_Home 0x47\r
+#define sc_End 0x4f\r
+#define sc_PgUp 0x49\r
+#define sc_PgDn 0x51\r
+#define sc_F1 0x3b\r
+#define sc_F2 0x3c\r
+#define sc_F3 0x3d\r
+#define sc_F4 0x3e\r
+#define sc_F5 0x3f\r
+#define sc_F6 0x40\r
+#define sc_F7 0x41\r
+#define sc_F8 0x42\r
+#define sc_F9 0x43\r
+#define sc_F10 0x44\r
+#define sc_F11 0x57\r
+#define sc_F12 0x59\r
+\r
+#define sc_1 0x02\r
+#define sc_2 0x03\r
+#define sc_3 0x04\r
+#define sc_4 0x05\r
+#define sc_5 0x06\r
+#define sc_6 0x07\r
+#define sc_7 0x08\r
+#define sc_8 0x09\r
+#define sc_9 0x0a\r
+#define sc_0 0x0b\r
+\r
+#define sc_A 0x1e\r
+#define sc_B 0x30\r
+#define sc_C 0x2e\r
+#define sc_D 0x20\r
+#define sc_E 0x12\r
+#define sc_F 0x21\r
+#define sc_G 0x22\r
+#define sc_H 0x23\r
+#define sc_I 0x17\r
+#define sc_J 0x24\r
+#define sc_K 0x25\r
+#define sc_L 0x26\r
+#define sc_M 0x32\r
+#define sc_N 0x31\r
+#define sc_O 0x18\r
+#define sc_P 0x19\r
+#define sc_Q 0x10\r
+#define sc_R 0x13\r
+#define sc_S 0x1f\r
+#define sc_T 0x14\r
+#define sc_U 0x16\r
+#define sc_V 0x2f\r
+#define sc_W 0x11\r
+#define sc_X 0x2d\r
+#define sc_Y 0x15\r
+#define sc_Z 0x2c\r
+\r
+#define key_None 0\r
+#define key_Return 0x0d\r
+#define key_Enter key_Return\r
+#define key_Escape 0x1b\r
+#define key_Space 0x20\r
+#define key_BackSpace 0x08\r
+#define key_Tab 0x09\r
+#define key_Delete 0x7f\r
+\r
+#define key_LSuper 0x5b\r
+#define key_RSuper 0x5c\r
+#define key_Menu 0x5d\r
+\r
+// Stuff for the mouse\r
+#define MReset 0\r
+#define MButtons 3\r
+#define MDelta 11\r
+\r
+#define MouseInt 0x33\r
+#ifdef DEMO0\r
+typedef enum {\r
+ demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
+ } Demo;\r
+#endif\r
+//moved to 16_tdef.h\r
+/*typedef enum {\r
+ //ctrl_None, // MDM (GAMERS EDGE) - added\r
+ ctrl_Keyboard,\r
+ ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
+ ctrl_Joystick,\r
+ ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
+ ctrl_Mouse,\r
+ } ControlType;\r
+typedef enum {\r
+ motion_Left = -1,motion_Up = -1,\r
+ motion_None = 0,\r
+ motion_Right = 1,motion_Down = 1\r
+ } Motion;\r
+typedef enum {\r
+ dir_North,//dir_NorthEast,\r
+ dir_West,//dir_Nortinest,\r
+ dir_None,\r
+ dir_East,//,dir_SouthEast,\r
+ dir_South,//dir_Soutinest,\r
+ } Direction;\r
+typedef struct {\r
+ boolean near button0,button1,button2,button3;\r
+ int near x,y;\r
+ Motion near xaxis,yaxis;\r
+ Direction near dir;\r
+ } CursorInfo;\r
+\r
+typedef struct {\r
+ ScanCode near button0,button1,\r
+ //upleft,\r
+ up,\r
+ down,\r
+ left,\r
+ right\r
+ //upright,\r
+ //downleft,\r
+ //,downright\r
+ ;\r
+ } KeyboardDef;\r
+typedef struct {\r
+ word near joyMinX,joyMinY,\r
+ threshMinX,threshMinY,\r
+ threshMaxX,threshMaxY,\r
+ joyMaxX,joyMaxY,\r
+ joyMultXL,joyMultYL,\r
+ joyMultXH,joyMultYH;\r
+ } JoystickDef;*/\r
+\r
+/*\r
+=============================================================================\r
+\r
+ GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+#ifdef DEMO0\r
+ static Demo DemoMode = demo_Off;\r
+ static byte /*_seg*/ *DemoBuffer;\r
+ static word DemoOffset,DemoSize;\r
+#endif\r
+\r
+// Internal routines\r
+extern void IN_Startup(void),IN_Shutdown(void),\r
+ IN_Default(boolean gotit,player_t *player,ControlType nt),\r
+ IN_SetKeyHook(void (*)()),\r
+ IN_ClearKeysDown(void),\r
+ IN_ReadCursor(CursorInfo *),\r
+ IN_ReadControl(player_t *player),\r
+ IN_SetControlType(player_t *player,ControlType type),\r
+ IN_GetJoyAbs(word joy,word *xp,word *yp),\r
+ IN_SetupJoy(word joy,word minx,word maxx,\r
+ word miny,word maxy),\r
+#if DEMO0\r
+ IN_StopDemo(void),IN_FreeDemoBuffer(void),\r
+#endif\r
+ IN_Ack(void),IN_AckBack(void);\r
+extern boolean IN_UserInput(word delay);\r
+extern char IN_WaitForASCII(void);\r
+extern ScanCode IN_WaitForKey(void);\r
+extern word IN_GetJoyButtonsDB(word joy);\r
+extern byte *IN_GetScanName(ScanCode);\r
+\r
+\r
+byte IN_MouseButtons (void);\r
+byte IN_JoyButtons (void);\r
+\r
+void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/);\r
+void IN_StartAck(void);\r
+boolean IN_CheckAck (void);\r
+boolean IN_IsUserInput();\r
+#define Mouse(x) INL_Mouse(x)\r
+//void IN_SetKeyHook(void (*hook)());\r
+#if DEMO0\r
+boolean IN_StartDemoRecord(word bufsize);\r
+void IN_StartDemoPlayback(byte *buffer,word bufsize);\r
+void IN_StopDemo(void);\r
+void IN_FreeDemoBuffer(void);\r
+#endif\r
+\r
+boolean IN_KeyDown(byte code),\r
+ IN_qb(byte kee);\r
+void IN_ClearKey(byte code),\r
+ IN_KbdLED();\r
+ScanCode IN_GetLastScan(),\r
+ IN_GetCurCode();\r
+\r
+#endif\r