#include <string.h>\r
#include "src/lib/lib_head.h"\r
\r
-//++++#ifdef __DEBUG__\r
+#ifdef __DEBUG__\r
#define __DEBUG_InputMgr__\r
-//++++#endif\r
+#endif
\r
+#ifdef __DEBUG_InputMgr__\r
#define TESTKEYIN
-#define TESTCONTROLNOISY\r
+#define TESTCONTROLNOISY
+#endif\r
\r
#define KeyInt 9 // The keyboard ISR number\r
\r
motion_None = 0,\r
motion_Right = 1,motion_Down = 1\r
} Motion;\r
-typedef enum {\r
- dir_North,//dir_NorthEast,\r
- dir_East,//dir_SouthEast,\r
- dir_South,//dir_Soutinest,\r
- dir_West,//dir_Nortinest,\r
- dir_None\r
+typedef enum {
+ dir_North,//dir_NorthEast,
+ dir_West,//dir_Nortinest,
+ dir_None,\r
+ dir_East,//,dir_SouthEast,
+ dir_South,//dir_Soutinest,
} Direction;\r
typedef struct {\r
boolean button0,button1,button2,button3;\r
typedef struct {\r
ScanCode button0,button1,\r
//upleft,\r
- up,\r
+ up,
+ down,
+ left,
+ right\r
//upright,\r
- left, right,\r
//downleft,\r
- down\r
//,downright\r
;\r
} KeyboardDef;\r
ControlType Controls;
} player_t;
-typedef struct
+/*\r
+=============================================================================\r
+\r
+ GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/
+/*extern struct inconfig
{
boolean MousePresent;\r
boolean JoysPresent[MaxJoys];\r
char LastASCII;\r
ScanCode LastScan;
- boolean IN_Started;\r
- boolean CapsLock;\r
- ScanCode CurCode,LastCode;
-
KeyboardDef KbdDefs[MaxKbds];
JoystickDef JoyDefs[MaxJoys];
JoypadDef JoypadDefs[MaxPads];
-} inconfig;
-\r
-/*\r
-=============================================================================\r
-\r
- GLOBAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-\r
-//\r
-// configuration variables\r
-//\r
-//static boolean MousePresent;\r
-//static boolean JoysPresent[MaxJoys];\r
-//static boolean JoyPadPresent[MaxPads];\r
-\r
-// Global variables\r
-// extern boolean JoystickCalibrated; // MDM (GAMERS EDGE) - added\r
-// extern ControlType ControlTypeUsed; // MDM (GAMERS EDGE) - added\r
-\r
- //extern boolean Keyboard[NumCodes];\r
- //extern boolean Paused;\r
- //extern char LastASCII;\r
- //extern ScanCode LastScan;\r
-\r
- //extern KeyboardDef KbdDefs[];
- //static KeyboardDef KbdDefs[MaxKbds] = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};\r
- //extern JoystickDef JoyDefs[MaxJoys];\r
- //extern ControlType Controls[MaxPlayers];\r
-\r
- //extern dword MouseDownCount;\r
-\r
+} inpu;*/
+
#ifdef DEMO0\r
static Demo DemoMode = demo_Off;\r
static byte /*_seg*/ *DemoBuffer;\r
static word DemoOffset,DemoSize;\r
#endif\r
-\r
+
extern dword far* clockdw;\r
\r
-/*\r
-=============================================================================\r
-\r
- LOCAL VARIABLES\r
-\r
-=============================================================================\r
-*/\r
-static byte far ASCIINames[] = // Unshifted ASCII for scan codes\r
- {\r
-// 0 1 2 3 4 5 6 7 8 9 A B C D E F\r
- 0 ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8 ,9 , // 0\r
- 'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0 ,'a','s', // 1\r
- 'd','f','g','h','j','k','l',';',39 ,'`',0 ,92 ,'z','x','c','v', // 2\r
- 'b','n','m',',','.','/',0 ,'*',0 ,' ',0 ,0 ,0 ,0 ,0 ,0 , // 3\r
- 0 ,0 ,0 ,0 ,0 ,0 ,0 ,'7','8','9','-','4','5','6','+','1', // 4\r
- '2','3','0',127,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5\r
- 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6\r
- 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7\r
- },\r
- far ShiftNames[] = // Shifted ASCII for scan codes\r
- {\r
-//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0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6\r
- 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7\r
- },\r
- *ScanNames[] = // Scan code names with single chars\r
- {\r
- "?","?","1","2","3","4","5","6","7","8","9","0","-","+","?","?",\r
- "Q","W","E","R","T","Y","U","I","O","P","[","]","|","?","A","S",\r
- "D","F","G","H","J","K","L",";","\"","?","?","?","Z","X","C","V",\r
- "B","N","M",",",".","/","?","?","?","?","?","?","?","?","?","?",\r
- "?","?","?","?","?","?","?","?","\xf","?","-","\x15","5","\x11","+","?",\r
- "\x13","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",\r
- "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",\r
- "?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?"\r
- }, // DEBUG - consolidate these\r
- far ExtScanCodes[] = // Scan codes with >1 char names\r
- {\r
- 1,0xe,0xf,0x1d,0x2a,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,\r
- 0x3f,0x40,0x41,0x42,0x43,0x44,0x57,0x59,0x46,0x1c,0x36,\r
- 0x37,0x38,0x47,0x49,0x4f,0x51,0x52,0x53,0x45,0x48,\r
- 0x50,0x4b,0x4d,0x00\r
- },\r
- *ExtScanNames[] = // Names corresponding to ExtScanCodes\r
- {\r
- "Esc","BkSp","Tab","Ctrl","LShft","Space","CapsLk","F1","F2","F3","F4",\r
- "F5","F6","F7","F8","F9","F10","F11","F12","ScrlLk","Enter","RShft",\r
- "PrtSc","Alt","Home","PgUp","End","PgDn","Ins","Del","NumLk","Up",\r
- "Down","Left","Right",""\r
- };
-\r
-static Direction DirTable[] = // Quick lookup for total direction\r
- {\r
- //dir_Nortinest,\r
- dir_North,\r
- //dir_NorthEast,\r
- dir_West, dir_None, dir_East,\r
- //dir_Soutinest,\r
- dir_South//,dir_SouthEast\r
- };\r
-\r
-static void (*INL_KeyHook)(void);\r
-static void interrupt (*OldKeyVect)(void);\r
-\r
-static char *ParmStringsIN[] = {"nojoys","nomouse",nil};\r
-\r
-// Function prototypes\r
-#define IN_KeyDown(code) (Keyboard[(code)])\r
-#define IN_ClearKey(code) {Keyboard[code] = false; if (code == LastScan) LastScan = sc_None;}\r
-
// Internal routines
-void interrupt INL_KeyService(inconfig *in);
-void Mouse(int x);
+extern void interrupt INL_KeyService();
+extern void Mouse(int x);
//static void INL_GetMouseDelta(int *x,int *y);
//static word INL_GetMouseButtons(void);
-void IN_GetJoyAbs(word joy,word *xp,word *yp);
+extern void IN_GetJoyAbs(word joy,word *xp,word *yp);
//static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive);
//static word INL_GetJoyButtons(word joy);
-word IN_GetJoyButtonsDB(word joy);
+extern word IN_GetJoyButtonsDB(word joy);
//static void INL_StartKbd(void);
//static void INL_ShutKbd(void);
//static boolean INL_StartMouse(void);
//static void INL_ShutMouse(void);
//static void INL_SetJoyScale(word joy);
-void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy, inconfig *in);
+extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy);
//static boolean INL_StartJoy(word joy);
//static void INL_ShutJoy(word joy);
-void IN_Startup(inconfig *in);
-void IN_Default(boolean gotit,player_t *player,ControlType nt, inconfig *in);
-void IN_Shutdown(inconfig *in);
-void IN_SetKeyHook(void (*hook)());
-void IN_ClearKeysDown(inconfig *in);
+extern void IN_Startup();
+extern void IN_Default(boolean gotit,player_t *player,ControlType nt);
+extern void IN_Shutdown();
+extern void IN_SetKeyHook(void (*hook)());
+extern void IN_ClearKeysDown();
//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);
-void IN_ReadCursor(CursorInfo *info);
-void IN_ReadControl(int playnum,player_t *player);
-void IN_SetControlType(word playnum,player_t *player,ControlType type);
+extern void IN_ReadCursor(CursorInfo *info);
+extern void IN_ReadControl(int playnum,player_t *player);
+extern void IN_SetControlType(word playnum,player_t *player,ControlType type);
#if DEMO0
-boolean IN_StartDemoRecord(word bufsize);
-void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);
-void IN_StopDemo(void);
-void IN_FreeDemoBuffer(void);
+extern boolean IN_StartDemoRecord(word bufsize);
+extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);
+extern void IN_StopDemo(void);
+extern void IN_FreeDemoBuffer(void);
#endif
-byte *IN_GetScanName(ScanCode scan);
-ScanCode IN_WaitForKey(void);
-char IN_WaitForASCII(void);
-void IN_AckBack(void);
-void IN_Ack(void);
-boolean IN_IsUserInput(void);
-boolean IN_UserInput(dword delay,boolean clear);
-\r
-/*extern void IN_Startup(void),IN_Shutdown(void),\r
- IN_Default(boolean gotit,ControlType in),\r
- IN_SetKeyHook(void (*)()),\r
- IN_ClearKeysDown(void),\r
- IN_ReadCursor(CursorInfo *),\r
- IN_ReadControl(int,ControlInfo *),\r
- IN_SetControlType(int,ControlType),\r
- IN_GetJoyAbs(word joy,word *xp,word *yp),\r
- IN_SetupJoy(word joy,word minx,word maxx,\r
- word miny,word maxy),\r
- Mouse(int x),\r
-#ifdef DEMO0\r
- IN_StartDemoPlayback(byte __segment *buffer,word bufsize),\r
- IN_StopDemo(void),IN_FreeDemoBuffer(void),\r
-#endif\r
- IN_Ack(void),IN_AckBack(void);\r
-extern boolean IN_UserInput(dword delay,boolean clear),\r
- IN_IsUserInput(void)\r
-#ifdef DEMO0\r
- , IN_StartDemoRecord(word bufsize)\r
-#endif\r
-;\r
-extern byte *IN_GetScanName(ScanCode);\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 scan);
+extern ScanCode IN_WaitForKey();
+extern char IN_WaitForASCII();
+extern void IN_AckBack();
+extern void IN_Ack();
+extern boolean IN_IsUserInput();
+extern boolean IN_UserInput(dword delay,boolean clear);
+extern boolean IN_KeyDown(byte code);
+extern void IN_ClearKey(byte code);
+extern boolean IN_qb(byte kee);
\r
-boolean IN_qb(byte kee);\r
#endif\r