-/* Catacomb Armageddon Source Code
- * Copyright (C) 1993-2014 Flat Rock Software
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+/* Catacomb Apocalypse Source Code\r
+ * Copyright (C) 1993-2014 Flat Rock Software\r
+ *\r
+ * This program 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 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program 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 along\r
+ * with this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
*/
//
// ID_IN.c - Input Manager
// v1.0d1w
// By Jason Blochowiak
-// Open Watcom port by sparky4
+// Open Watcom port by sparky4
//
//
GLOBAL VARIABLES\r
\r
=============================================================================\r
-*/\r
-// Global variables
- boolean JoystickCalibrated=false; // MDM (GAMERS EDGE) - added\r
- ControlType ControlTypeUsed; // MDM (GAMERS EDGE) - added\r
- boolean Keyboard[NumCodes];\r
- boolean Paused;\r
- char LastASCII;\r
- ScanCode LastScan;\r
+*/
+struct inconfig
+{
+ boolean MousePresent;\r
+ boolean JoysPresent[MaxJoys];\r
+ boolean JoyPadPresent[MaxPads];
+ boolean Keyboard[NumCodes];\r
+ boolean Paused;\r
+ char LastASCII;\r
+ ScanCode LastScan;
+
+ KeyboardDef KbdDefs[MaxKbds];// = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/};
+ JoystickDef JoyDefs[MaxJoys];
+ JoypadDef JoypadDefs[MaxPads];
+} inpu;
+
+//struct inconfig in;
+
+//inpu.KbdDefs = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/};
+
+/*\r
+=============================================================================\r
+\r
+ LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/
+
+#ifdef __cplusplus /* Function must be declared C style */
+extern "C" {
+#endif
+\r
+static struct instat {
+ boolean IN_Started;\r
+ boolean CapsLock;\r
+ ScanCode CurCode,LastCode;
+} inst;
+\r
+static void (*INL_KeyHook)(void);
+static void interrupt (*OldKeyVect)(void);
+static char *ParmStringsIN[] = {"nojoys","nomouse",nil};
\r
- //KeyboardDef KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};\r
- JoystickDef JoyDefs[MaxJoys];\r
- ControlType Controls[MaxPlayers];\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
+// 0 1 2 3 4 5 6 7 8 9 A B C D E F\r
+ 0 ,27 ,'!','@','#','$','%','^','&','*','(',')','_','+',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',':',34 ,'~',0 ,'|','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 SpecialNames[] = // ASCII for 0xe0 prefixed codes\r
+ {\r
+// 0 1 2 3 4 5 6 7 8 9 A B C D E F\r
+ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 0\r
+ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,13 ,0 ,0 ,0 , // 1\r
+ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 2\r
+ 0 ,0 ,0 ,0 ,0 ,'/',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 3\r
+ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 4\r
+ 0 ,0 ,0 ,0 ,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
+ *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
- dword MouseDownCount;
+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
+ };
+#ifdef __cplusplus
+}
+#endif
// Internal routines
///////////////////////////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////////////////////////
void interrupt
-INL_KeyService(void)
+INL_KeyService()
{
static boolean special;
byte k,c;
if (k == 0xe0) // Special key prefix
special = true;
else if (k == 0xe1) // Handle Pause key
- Paused = true;
+ inpu.Paused = true;
else
{
if (k & 0x80) // Break code
// DEBUG - handle special keys: ctl-alt-delete, print scrn
- Keyboard[k] = false;
+ inpu.Keyboard[k] = false;
}
else // Make code
{
- LastCode = CurCode;
- CurCode = LastScan = k;
- Keyboard[k] = true;
+ inst.LastCode = inst.CurCode;
+ inst.CurCode = inpu.LastScan = k;
+ inpu.Keyboard[k] = true;
if (special)
c = SpecialNames[k];
{
if (k == sc_CapsLock)
{
- CapsLock ^= true;
+ inst.CapsLock ^= true;
// DEBUG - make caps lock light work
}
- if (Keyboard[sc_LShift] || Keyboard[sc_RShift]) // If shifted
+ if (inpu.Keyboard[sc_LShift] || inpu.Keyboard[sc_RShift]) // If shifted
{
c = ShiftNames[k];
- if ((c >= 'A') && (c <= 'Z') && CapsLock)
+ if ((c >= 'A') && (c <= 'Z') && inst.CapsLock)
c += 'a' - 'A';
}
else
{
c = ASCIINames[k];
- if ((c >= 'a') && (c <= 'z') && CapsLock)
+ if ((c >= 'a') && (c <= 'z') && inst.CapsLock)
c -= 'a' - 'A';
}
}
if (c)
- LastASCII = c;
+ inpu.LastASCII = c;
}
special = false;
if (INL_KeyHook && !special)
INL_KeyHook();
#ifdef TESTKEYIN
- printf("%c %x %u\n", c, k, Keyboard[k]);
+ printf("%c %x %u\n", c, k, inpu.Keyboard[k]);
#endif
outp(0x20,0x20);
}
static dword lasttime;
IN_GetJoyAbs(joy,&x,&y);
- def = JoyDefs + joy;
+ def = inpu.JoyDefs + joy;
if (x < def->threshMinX)
{
//
///////////////////////////////////////////////////////////////////////////
static void
-INL_StartKbd(void)
+INL_StartKbd()
{
INL_KeyHook = 0; // Clear key hook
{
JoystickDef *def;
- def = &JoyDefs[joy];
+ def = &(inpu.JoyDefs[joy]);
def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX);
def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX);
def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY);
word d,r;
JoystickDef *def;
- def = &JoyDefs[joy];
+ def = &(inpu.JoyDefs[joy]);
def->joyMinX = minx;
def->joyMaxX = maxx;
static void
INL_ShutJoy(word joy)
{
- JoysPresent[joy] = false;
+ inpu.JoysPresent[joy] = false;
}
// Public routines
//
///////////////////////////////////////////////////////////////////////////
void
-IN_Startup(void)
+IN_Startup()
{
boolean checkjoys,checkmouse;
word i;
- if (IN_Started)
+ if (inst.IN_Started)
return;
checkjoys = true;
}
INL_StartKbd();
- MousePresent = checkmouse? INL_StartMouse() : false;
+ inpu.MousePresent = checkmouse? INL_StartMouse() : false;
for (i = 0;i < MaxJoys;i++)
- JoysPresent[i] = checkjoys? INL_StartJoy(i) : false;
+ inpu.JoysPresent[i] = checkjoys? INL_StartJoy(i) : false;
- IN_Started = true;
+ inst.IN_Started = true;
}
///////////////////////////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////////////////////////
void
-IN_Default(boolean gotit,ControlType in)
+IN_Default(boolean gotit,player_t *player,ControlType nt)
{
if
(
(!gotit)
- || ((in == ctrl_Joystick1) && !JoysPresent[0])
- || ((in == ctrl_Joystick2) && !JoysPresent[1])
- || ((in == ctrl_Mouse) && !MousePresent)
+ || ((nt == ctrl_Joystick1) && !inpu.JoysPresent[0])
+ || ((nt == ctrl_Joystick2) && !inpu.JoysPresent[1])
+ || ((nt == ctrl_Mouse) && !inpu.MousePresent)
+ || ((nt == ctrl_Joypad1) && !inpu.JoyPadPresent[0])
+ || ((nt == ctrl_Joypad2) && !inpu.JoyPadPresent[1])
)
- in = ctrl_Keyboard1;
- IN_SetControlType(0,in);
+ nt = ctrl_Keyboard1;
+ IN_SetControlType(0,player,nt);
}
///////////////////////////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////////////////////////
void
-IN_Shutdown(void)
+IN_Shutdown()
{
word i;
- if (!IN_Started)
+ if (!inst.IN_Started)
return;
INL_ShutMouse();
INL_ShutJoy(i);
INL_ShutKbd();
- IN_Started = false;
+ inst.IN_Started = false;
}
///////////////////////////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////////////////////////
void
-IN_ClearKeysDown(void)
+IN_ClearKeysDown()
{
int i;
- LastScan = sc_None;
- LastASCII = key_None;
- memset (Keyboard,0,sizeof(Keyboard));
+ inpu.LastScan = sc_None;
+ inpu.LastASCII = key_None;
+ memset (inpu.Keyboard,0,sizeof(inpu.Keyboard));
}
///////////////////////////////////////////////////////////////////////////
info->x = info->y = 0;
info->button0 = info->button1 = false;
- if (MousePresent)
+ if (inpu.MousePresent)
{
buttons = INL_GetMouseButtons();
INL_GetMouseDelta(&dx,&dy);
for (i = 0;i < MaxJoys;i++)
{
- if (!JoysPresent[i])
+ if (!inpu.JoysPresent[i])
continue;
buttons = INL_GetJoyButtons(i);
}
}
-#ifndef DUMU
-///////////////////////////////////////////////////////////////////////////
-//
-// IN_ReadControl() - Reads the device associated with the specified
-// player and fills in the control info struct
-//
-///////////////////////////////////////////////////////////////////////////
-void
-IN_ReadControl(int player,ControlInfo *info)
-{
- boolean realdelta=false; // MDM (GAMERS EDGE)
- byte dbyte;
- word buttons;
- int dx,dy;
- Motion mx,my;
- ControlType type;
-register KeyboardDef *def;
-
- dx = dy = 0;
- mx = my = motion_None;
- buttons = 0;
-
-#if DEMO0
- if (DemoMode == demo_Playback)
- {
- dbyte = DemoBuffer[DemoOffset + 1];
- my = (dbyte & 3) - 1;
- mx = ((dbyte >> 2) & 3) - 1;
- buttons = (dbyte >> 4) & 3;
-
- if (!(--DemoBuffer[DemoOffset]))
- {
- DemoOffset += 2;
- if (DemoOffset >= DemoSize)
- DemoMode = demo_PlayDone;
- }
-
- realdelta = false;
- }
- else if (DemoMode == demo_PlayDone)
- Quit("Demo playback exceeded");
- else
- {
-#endif
- // MDM begin (GAMERS EDGE) - added this block
- ControlTypeUsed = ctrl_None;
-
- // Handle mouse input...
- //
- if ((MousePresent) && (ControlTypeUsed == ctrl_None))
- {
- INL_GetMouseDelta(&dx,&dy);
- buttons = INL_GetMouseButtons();
- realdelta = true;
- if (dx || dy || buttons)
- ControlTypeUsed = ctrl_Mouse;
- }
-
- // Handle joystick input...
- //
- if ((JoystickCalibrated) && (ControlTypeUsed == ctrl_None))
- {
- type = ctrl_Joystick1;
- INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy,false);
- buttons = INL_GetJoyButtons(type - ctrl_Joystick);
- realdelta = true;
- if (dx || dy || buttons)
- ControlTypeUsed = ctrl_Joystick;
- }
-
- // Handle keyboard input...
- //
- if (ControlTypeUsed == ctrl_None)
- {
- type = ctrl_Keyboard1;
- def = &KbdDefs[type - ctrl_Keyboard];
-
-/* if (Keyboard[def->upleft])
- mx = motion_Left,my = motion_Up;
- else if (Keyboard[def->upright])
- mx = motion_Right,my = motion_Up;
- else if (Keyboard[def->downleft])
- mx = motion_Left,my = motion_Down;
- else if (Keyboard[def->downright])
- mx = motion_Right,my = motion_Down;*/
-
- if (Keyboard[def->up])
- my = motion_Up;
- else if (Keyboard[def->down])
- my = motion_Down;
-
- if (Keyboard[def->left])
- mx = motion_Left;
- else if (Keyboard[def->right])
- mx = motion_Right;
-
- if (Keyboard[def->button0])
- buttons += 1 << 0;
- if (Keyboard[def->button1])
- buttons += 1 << 1;
- realdelta = false;
- if (mx || my || buttons)
- ControlTypeUsed = ctrl_Keyboard;
- } // MDM end (GAMERS EDGE)
- }
-
- if (realdelta)
- {
- mx = (dx < 0)? motion_Left : ((dx > 0)? motion_Right : motion_None);
- my = (dy < 0)? motion_Up : ((dy > 0)? motion_Down : motion_None);
- }
- else
- {
- dx = mx * 127;
- dy = my * 127;
- }
-
- info->x = dx;
- info->xaxis = mx;
- info->y = dy;
- info->yaxis = my;
- info->button0 = buttons & (1 << 0);
- info->button1 = buttons & (1 << 1);
- info->dir = DirTable[((my + 1) * 3) + (mx + 1)];
-
-#if DEMO0
- if (DemoMode == demo_Record)
- {
- // Pack the control info into a byte
- dbyte = (buttons << 4) | ((mx + 1) << 2) | (my + 1);
-
- if
- (
- (DemoBuffer[DemoOffset + 1] == dbyte)
- && (DemoBuffer[DemoOffset] < 255)
- )
- (DemoBuffer[DemoOffset])++;
- else
- {
- if (DemoOffset || DemoBuffer[DemoOffset])
- DemoOffset += 2;
-
- if (DemoOffset >= DemoSize)
- Quit("Demo buffer overflow");
-
- DemoBuffer[DemoOffset] = 1;
- DemoBuffer[DemoOffset + 1] = dbyte;
- }
- }
-#endif
-}
-
-#else
///////////////////////////////////////////////////////////////////////////
//
// IN_ReadControl() - Reads the device associated with the specified
//
///////////////////////////////////////////////////////////////////////////
void
-IN_ReadControl(int player,ControlInfo *info)
+IN_ReadControl(int playnum,player_t *player)
{
boolean realdelta;
byte dbyte;
else
{
#endif
- switch (type = Controls[player])
+ switch (type = player[playnum].Controls)
{
case ctrl_Keyboard1:
case ctrl_Keyboard2:
- def = &KbdDefs[type - ctrl_Keyboard];
+ def = &(inpu.KbdDefs[type - ctrl_Keyboard]);
/* if (Keyboard[def->upleft])
mx = motion_Left,my = motion_Up;
else if (Keyboard[def->downright])
mx = motion_Right,my = motion_Down;*/
- if (Keyboard[def->up])
+ if (inpu.Keyboard[def->up])
my = motion_Up;
- else if (Keyboard[def->down])
+ else if (inpu.Keyboard[def->down])
my = motion_Down;
- if (Keyboard[def->left])
+ if (inpu.Keyboard[def->left])
mx = motion_Left;
- else if (Keyboard[def->right])
+ else if (inpu.Keyboard[def->right])
mx = motion_Right;
- if (Keyboard[def->button0])
+ if (inpu.Keyboard[def->button0])
buttons += 1 << 0;
- if (Keyboard[def->button1])
+ if (inpu.Keyboard[def->button1])
buttons += 1 << 1;
realdelta = false;
break;
buttons = INL_GetMouseButtons();
realdelta = true;
break;
+ case ctrl_Joypad1:
+ case ctrl_Joypad2:
+ printf("wwww");
+ break;
}
+#ifdef DEMO0
}
+#endif
if (realdelta)
{
dy = my * 127;
}
- info->x = dx;
- info->xaxis = mx;
- info->y = dy;
- info->yaxis = my;
- info->button0 = buttons & (1 << 0);
- info->button1 = buttons & (1 << 1);
- info->dir = DirTable[((my + 1) * 3) + (mx + 1)];
+ player[playnum].info.x = dx;
+ player[playnum].info.xaxis = mx;
+ player[playnum].info.y = dy;
+ player[playnum].info.yaxis = my;
+ player[playnum].info.button0 = buttons & (1 << 0);
+ player[playnum].info.button1 = buttons & (1 << 1);
+ player[playnum].info.button2 = buttons & (1 << 2);
+ player[playnum].info.button3 = buttons & (1 << 3);
+ player[playnum].info.dir = DirTable[((my + 1) * 3) + (mx + 1)];
#if DEMO0
if (DemoMode == demo_Record)
}
#endif
}
-#endif
///////////////////////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////////////////////
void
-IN_SetControlType(int player,ControlType type)
+IN_SetControlType(word playnum,player_t *player,ControlType type)
{
// DEBUG - check that requested type is present?
- Controls[player] = type;
+ player[playnum].Controls = type;
}
#if DEMO0
//
///////////////////////////////////////////////////////////////////////////
ScanCode
-IN_WaitForKey(void)
+IN_WaitForKey()
{
ScanCode result;
- while (!(result = LastScan))
+ while (!(result = inpu.LastScan))
;
- LastScan = 0;
+ inpu.LastScan = 0;
return(result);
}
//
///////////////////////////////////////////////////////////////////////////
char
-IN_WaitForASCII(void)
+IN_WaitForASCII()
{
char result;
- while (!(result = LastASCII))
+ while (!(result = inpu.LastASCII))
;
- LastASCII = '\0';
+ inpu.LastASCII = '\0';
return(result);
}
//
///////////////////////////////////////////////////////////////////////////
void
-IN_AckBack(void)
+IN_AckBack()
{
word i;
- while (!LastScan)
+ while (!inpu.LastScan)
{
- if (MousePresent)
+ if (inpu.MousePresent)
{
if (INL_GetMouseButtons())
{
for (i = 0;i < MaxJoys;i++)
{
- if (JoysPresent[i])
+ if (inpu.JoysPresent[i])
{
if (IN_GetJoyButtonsDB(i))
{
}
}
- IN_ClearKey(LastScan);
- LastScan = sc_None;
+ IN_ClearKey(inpu.LastScan);
+ inpu.LastScan = sc_None;
}
///////////////////////////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////////////////////////
void
-IN_Ack(void)
+IN_Ack()
{
word i;
- IN_ClearKey(LastScan);
- LastScan = sc_None;
+ IN_ClearKey(inpu.LastScan);
+ inpu.LastScan = sc_None;
- if (MousePresent)
+ if (inpu.MousePresent)
while (INL_GetMouseButtons())
;
for (i = 0;i < MaxJoys;i++)
- if (JoysPresent[i])
+ if (inpu.JoysPresent[i])
while (IN_GetJoyButtonsDB(i))
;
//
///////////////////////////////////////////////////////////////////////////
boolean
-IN_IsUserInput(void)
+IN_IsUserInput()
{
boolean result;
word i;
- result = LastScan;
+ result = inpu.LastScan;
- if (MousePresent)
+ if (inpu.MousePresent)
if (INL_GetMouseButtons())
result = true;
for (i = 0;i < MaxJoys;i++)
- if (JoysPresent[i])
+ if (inpu.JoysPresent[i])
if (INL_GetJoyButtons(i))
result = true;
return(false);
}
+boolean IN_KeyDown(byte code)
+{
+ return inpu.Keyboard[code];
+}
+\r
+void IN_ClearKey(byte code)
+{
+ inpu.Keyboard[code] = false;
+ if(code == inpu.LastScan)
+ inpu.LastScan = sc_None;
+ }
+
boolean IN_qb(byte kee)
{
- if(Keyboard[kee]==true) return 1;
+ printf("%u\n", inpu.Keyboard[kee]);
+ if(inpu.Keyboard[kee]==true) return 1;
else return 0;
}