]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_in.c
tired i will work on joy stick stuff later
[16.git] / src / lib / 16_in.c
index f4d90dbb13907ae8445bc75aa717b8bc3280125b..9dd9d7816b7ba043cccccfca9d0ab9c46faf2694 100755 (executable)
@@ -169,6 +169,7 @@ static      Direction       DirTable[] =            // Quick lookup for total direction
 static void                    (*INL_KeyHook)(void);\r
 static void interrupt  (*OldKeyVect)(void);\r
 static char                    *ParmStringsIN[] = {"nojoys","nomouse",nil};\r
+static void                    INL_StartKbd(void);\r
 \r
 //     Internal routines\r
 \r
@@ -250,13 +251,13 @@ static    boolean special;
 \r
 void INL_Mouse(int x)\r
 {\r
-       //union REGS CPURegs;\r
-       //x = CPURegs.x.ax;\r
-       __asm {\r
+       union REGS CPURegs;\r
+       x = CPURegs.x.ax;\r
+/*_=_= __asm {\r
                mov     ax,x\r
                int     MouseInt\r
-       }\r
-       //int86(MouseInt,&CPURegs,&CPURegs);\r
+       }*/\r
+       int86(MouseInt,&CPURegs,&CPURegs);\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -272,6 +273,12 @@ INL_GetMouseDelta(int *x,int *y)
        Mouse(MDelta);\r
        *x = CPURegs.x.cx;\r
        *y = CPURegs.x.dx;\r
+#ifdef __DEBUG_InputMgr__\r
+       if(dbg_joymousedelta)\r
+       {\r
+               printf("mousedelta=[%dx%d]\n", *x, *y);\r
+       }\r
+       #endif\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -503,7 +510,7 @@ IN_GetJoyButtonsDB(word joy)
 //\r
 ///////////////////////////////////////////////////////////////////////////\r
 static void\r
-INL_StartKbd(global_game_variables_t *gvar)\r
+INL_StartKbd()\r
 {\r
        INL_KeyHook = NULL;     // Clear key hook\r
 \r
@@ -534,15 +541,15 @@ INL_ShutKbd(void)
 static boolean\r
 INL_StartMouse(void)\r
 {\r
-#if 0\r
+       union REGS CPURegs;\r
        if (getvect(MouseInt))\r
        {\r
                Mouse(MReset);\r
-               if (_AX == 0xffff)\r
+               if (/*_AX*/CPURegs.x.ax == 0xffff)\r
                        return(true);\r
        }\r
        return(false);\r
-#endif\r
+#if 0\r
        byte far *vector;\r
 \r
 \r
@@ -554,6 +561,7 @@ INL_StartMouse(void)
 \r
        Mouse(MReset);\r
        return true;\r
+#endif\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -680,7 +688,7 @@ IN_Startup(global_game_variables_t *gvar)
                }\r
        }\r
 \r
-       INL_StartKbd(gvar);\r
+       INL_StartKbd();\r
        gvar->in.MousePresent = checkmouse? INL_StartMouse() : false;\r
 \r
        for (i = 0;i < MaxJoys;i++)\r
@@ -849,6 +857,9 @@ IN_ReadControl(player_t *player, global_game_variables_t *gvar)
                        sword conpee;\r
                        byte dir=DirTable[2];\r
 register       KeyboardDef     *def;\r
+//#ifdef __DEBUG_InputMgr__\r
+//static               int                     old_dx,old_dy;\r
+//#endif\r
 \r
        dx = dy = 0;\r
        mx = my = motion_None;\r
@@ -1003,6 +1014,13 @@ register KeyboardDef     *def;
        }\r
 #endif\r
 #ifdef __DEBUG_InputMgr__\r
+/*if(dbg_joymousedelta)\r
+{\r
+       if(dx!=old_dx || dy!=old_dy) printf("dx,dy      [%d,%d] %d,%d\n", dx, dy, mx, my);\r
+       if(dx!=old_dx)  old_dx=dx;\r
+       if(dy!=old_dy)  old_dy=dy;\r
+}*/\r
+\r
 if(dbg_testcontrolnoisy > 0)\r
 if(player->info.dir!=2/*(inst.Keyboard[def->up] || inst.Keyboard[def->down] || inst.Keyboard[def->left] || inst.Keyboard[def->right])*/ || player->enti.q>1)\r
 {\r
@@ -1183,8 +1201,13 @@ boolean IN_CheckAck (global_game_variables_t *gvar)
 //\r
 // see if something has been pressed\r
 //\r
-       if (inst.LastScan)\r
-               return true;\r
+       if(!gvar->in.IN_Started)\r
+               getch();\r
+       else\r
+       {\r
+               if (inst.LastScan)\r
+                       return true;\r
+       }\r
 \r
        buttons = IN_JoyButtons () << 4;\r
        if (gvar->in.MousePresent)\r