]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_in.c
modified: src/lib/16_in.c
[16.git] / src / lib / 16_in.c
index 34679d9696f52a79c0454501ba624568c255125d..24d6f9e976890dd501137e1f6a16d12682fb6781 100644 (file)
@@ -19,8 +19,9 @@
 //
 //     ID Engine
 //     ID_IN.c - Input Manager
-//     v1.0d1
+//     v1.0d1w
 //     By Jason Blochowiak
+// Open Watcom port by sparky4
 //
 
 //
 
 #include "src/lib/16_in.h"
 
-//     Internal routines
+/*\r
+=============================================================================\r
+\r
+                                       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
+\r
+               //KeyboardDef   KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};\r
+               JoystickDef     JoyDefs[MaxJoys];\r
+               ControlType     Controls[MaxPlayers];\r
+\r
+               dword   MouseDownCount;
 
+//     Internal routines
 ///////////////////////////////////////////////////////////////////////////
 //
 //     INL_KeyService() - Handles a keyboard interrupt (key up/down)
 //
 ///////////////////////////////////////////////////////////////////////////
-static void interrupt
+void interrupt
 INL_KeyService(void)
 {
 static boolean special;
-               byte    k,c,
-                               temp;
+               byte    k,c;
+               register byte temp;
 
        k = inp(0x60);  // Get the scan code
 
@@ -109,10 +130,13 @@ static    boolean special;
 
        if (INL_KeyHook && !special)
                INL_KeyHook();
+       #ifdef TESTKEYIN
+       printf("%c %x %u\n", c, k, Keyboard[k]);
+       #endif
        outp(0x20,0x20);
 }
 
-static void
+void
 Mouse(int x)
 {
        union REGS CPURegs;
@@ -440,14 +464,14 @@ IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)
        def->joyMinX = minx;
        def->joyMaxX = maxx;
        r = maxx - minx;
-       d = r / 5;
+       d = r / 3;
        def->threshMinX = ((r / 2) - d) + minx;
        def->threshMaxX = ((r / 2) + d) + minx;
 
        def->joyMinY = miny;
        def->joyMaxY = maxy;
        r = maxy - miny;
-       d = r / 5;
+       d = r / 3;
        def->threshMinY = ((r / 2) - d) + miny;
        def->threshMaxY = ((r / 2) + d) + miny;
 
@@ -511,7 +535,7 @@ IN_Startup(void)
        checkmouse = true;
        for (i = 1;i < __argc;i++)
        {
-               switch (US_CheckParm(__argv[i],ParmStrings))
+               switch (US_CheckParm(__argv[i],ParmStringsIN))
                {
                case 0:
                        checkjoys = false;
@@ -595,8 +619,7 @@ IN_ClearKeysDown(void)
 
        LastScan = sc_None;
        LastASCII = key_None;
-       for (i = 0;i < NumCodes;i++)
-               Keyboard[i] = false;
+       memset (Keyboard,0,sizeof(Keyboard));
 }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -652,6 +675,7 @@ IN_ReadCursor(CursorInfo *info)
        }
 }
 
+#ifndef DUMU
 ///////////////////////////////////////////////////////////////////////////
 //
 //     IN_ReadControl() - Reads the device associated with the specified
@@ -728,14 +752,14 @@ register  KeyboardDef     *def;
                        type = ctrl_Keyboard1;
                        def = &KbdDefs[type - ctrl_Keyboard];
 
-                       if (Keyboard[def->upleft])
+/*                     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;
+                               mx = motion_Right,my = motion_Down;*/
 
                        if (Keyboard[def->up])
                                my = motion_Up;
@@ -803,7 +827,7 @@ register    KeyboardDef     *def;
 #endif
 }
 
-#if 0
+#else
 ///////////////////////////////////////////////////////////////////////////
 //
 //     IN_ReadControl() - Reads the device associated with the specified
@@ -853,14 +877,14 @@ register  KeyboardDef     *def;
                case ctrl_Keyboard2:
                        def = &KbdDefs[type - ctrl_Keyboard];
 
-                       if (Keyboard[def->upleft])
+/*                     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;
+                               mx = motion_Right,my = motion_Down;*/
 
                        if (Keyboard[def->up])
                                my = motion_Up;
@@ -1188,3 +1212,9 @@ IN_UserInput(dword delay,boolean clear)
        } while (TimeCount - lasttime < delay);
        return(false);
 }
+
+boolean IN_qb(byte kee)
+{
+       if(Keyboard[kee]==true) return 1;
+       else return 0;
+}