OSDN Git Service

no idea why bcexmm.exe is broke w tweaked zcroll.exe a bit also Quit is refined now~
[proj16/16.git] / src / lib / 16_in.c
index 8515393..9adfe42 100755 (executable)
@@ -38,7 +38,7 @@
 \r
 #include "src/lib/16_in.h"\r
 \r
-boolean testkeyin=0,testcontrolnoisy=0;\r
+static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
 \r
 /*\r
 =============================================================================\r
@@ -49,8 +49,8 @@ boolean testkeyin=0,testcontrolnoisy=0;
 */\r
 struct inconfig\r
 {\r
-       boolean                 MousePresent;\r
-       boolean                 JoysPresent[MaxJoys];\r
+       boolean         MousePresent;\r
+       boolean         JoysPresent[MaxJoys];\r
        boolean         Keyboard[NumCodes];\r
        boolean         Paused;\r
        char            LastASCII;\r
@@ -164,6 +164,7 @@ static      Direction       DirTable[] =            // Quick lookup for total direction
 #endif\r
 \r
 //     Internal routines\r
+\r
 ///////////////////////////////////////////////////////////////////////////\r
 //\r
 //     INL_KeyService() - Handles a keyboard interrupt (key up/down)\r
@@ -234,18 +235,22 @@ static    boolean special;
 \r
        if (INL_KeyHook && !special)\r
                INL_KeyHook();\r
-//#ifdef TESTKEYIN\r
-       if(testkeyin > 0) printf("%c    %u      [0x%x %u]       %u\n", c, c, k, k, inpu.Keyboard[k]);\r
-//endif\r
+#ifdef __DEBUG_InputMgr__\r
+       if(dbg_testkeyin > 0) printf("%c        %u      [0x%x %u]       %u\n", c, c, k, k, inpu.Keyboard[k]);\r
+#endif\r
        outp(0x20,0x20);\r
 }\r
 \r
 void\r
 Mouse(int x)\r
 {\r
-       union REGS CPURegs;\r
-       x = CPURegs.x.ax;\r
-       int86(MouseInt,&CPURegs,&CPURegs);\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
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -299,8 +304,7 @@ IN_GetJoyAbs(word joy,word *xp,word *yp)
        yb = 1 << ys;\r
 \r
 // Read the absolute joystick values\r
-       __asm\r
-       {\r
+       __asm {\r
                pushf                           // Save some registers\r
                push    si\r
                push    di\r
@@ -320,8 +324,13 @@ IN_GetJoyAbs(word joy,word *xp,word *yp)
 \r
                push    bp                      // Don't mess up stack frame\r
                mov             bp,MaxJoyValue\r
-\r
+#ifdef __BORLANDC__\r
+       }\r
+#endif\r
 loo:\r
+#ifdef __BORLANDC__\r
+       __asm {\r
+#endif\r
                in              al,dx           // Get bits indicating whether all are finished\r
 \r
                dec             bp                      // Check bounding register\r
@@ -338,8 +347,13 @@ loo:
 \r
                add             cl,bl\r
                jnz             loo             // If both bits were 0, drop out\r
-\r
+#ifdef __BORLANDC__\r
+       }\r
+#endif\r
 done:\r
+#ifdef __BORLANDC__\r
+       __asm {\r
+#endif\r
                pop             bp\r
 \r
                mov             cl,[xs]         // Get the number of bits to shift\r
@@ -637,9 +651,9 @@ IN_Startup()
 \r
        checkjoys = true;\r
        checkmouse = true;\r
-       for (i = 1;i < __argc;i++)\r
+       for (i = 1;i < _argc;i++)\r
        {\r
-               switch (US_CheckParm(__argv[i],ParmStringsIN))\r
+               switch (US_CheckParm(_argv[i],ParmStringsIN))\r
                {\r
                case 0:\r
                        checkjoys = false;\r
@@ -733,7 +747,7 @@ IN_SetKeyHook(void (*hook)())
 void\r
 IN_ClearKeysDown()\r
 {\r
-       int     i;\r
+       //int   i;\r
 \r
        inpu.LastScan = sc_None;\r
        inpu.LastASCII = key_None;\r
@@ -803,7 +817,9 @@ void near
 IN_ReadControl(int pn,player_t *player)\r
 {\r
                        boolean         realdelta;\r
+#if DEMO0\r
                        byte            dbyte;\r
+#endif\r
                        word            buttons;\r
                        int                     dx,dy;\r
                        Motion          mx,my;\r
@@ -834,7 +850,7 @@ register    KeyboardDef     *def;
                realdelta = false;\r
        }\r
        else if (DemoMode == demo_PlayDone)\r
-               Quit("Demo playback exceeded");\r
+               Quit ("Demo playback exceeded");\r
        else\r
        {\r
 #endif\r
@@ -881,7 +897,9 @@ register    KeyboardDef     *def;
                                                default:\r
                                                break;\r
                                        }\r
-                                       //if(testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c    ", dirchar(player[pn].pdir)); }\r
+#ifdef __DEBUG_InputMgr__\r
+                                       //if(dbg_testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c        ", dirchar(player[pn].pdir)); }\r
+#endif\r
                                }\r
                        }\r
                        //input from player\r
@@ -955,14 +973,15 @@ register  KeyboardDef     *def;
                                DemoOffset += 2;\r
 \r
                        if (DemoOffset >= DemoSize)\r
-                               Quit("Demo buffer overflow");\r
+                               Quit ("Demo buffer overflow");\r
 \r
                        DemoBuffer[DemoOffset] = 1;\r
                        DemoBuffer[DemoOffset + 1] = dbyte;\r
                }\r
        }\r
 #endif\r
-if(testcontrolnoisy > 0)\r
+#ifdef __DEBUG_InputMgr__\r
+if(dbg_testcontrolnoisy > 0)\r
 if(player[pn].info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])*/ || player[pn].q>1)\r
 {\r
        //printf("b1=%u b2=%u b3=%u b4=%u       ", player[pn].info.button0, player[pn].info.button1, player[pn].info.button2, player[pn].info.button3);\r
@@ -973,6 +992,7 @@ if(player[pn].info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] |
        //else if(!realdelta) printf("%c%d %c%d %c%d %c%d", dirchar(0), inpu.Keyboard[def->up], dirchar(4), inpu.Keyboard[def->down], dirchar(1), inpu.Keyboard[def->left], dirchar(3), inpu.Keyboard[def->right]);\r
        printf("\n");\r
 }\r
+#endif\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////\r
@@ -1239,9 +1259,9 @@ void IN_ClearKey(byte code)
 \r
 boolean IN_qb(byte kee)\r
 {\r
-//#ifdef TESTKEYIN\r
-//     if(testkeyin > 0) printf("%u\n", inpu.Keyboard[kee]);\r
-//#endif\r
+#ifdef __DEBUG_InputMgr__\r
+//     if(dbg_testkeyin > 0) printf("%u\n", inpu.Keyboard[kee]);\r
+#endif\r
        if(inpu.Keyboard[kee]==true) return 1;\r
        else return 0;\r
 }\r