X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_in.c;h=0ac77f15d5cb49a06d6ce0a0e6bdf27cde49666c;hb=5c3da8981be76348ea34711b6297c0d2d3ed19ab;hp=a3e3fabdeffa30baf01a58bbe9f894f9cbf31bff;hpb=424d6f05d9aaa0000302df70be10c2598886a030;p=16.git diff --git a/src/lib/16_in.c b/src/lib/16_in.c index a3e3fabd..0ac77f15 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -169,6 +169,7 @@ static Direction DirTable[] = // Quick lookup for total direction static void (*INL_KeyHook)(void); static void interrupt (*OldKeyVect)(void); static char *ParmStringsIN[] = {"nojoys","nomouse",nil}; +static void INL_StartKbd(void); // Internal routines @@ -248,17 +249,6 @@ static boolean special; outportb(0x20,0x20); } -void INL_Mouse(int x) -{ - //union REGS CPURegs; - //x = CPURegs.x.ax; - __asm { - mov ax,x - int MouseInt - } - //int86(MouseInt,&CPURegs,&CPURegs); -} - /////////////////////////////////////////////////////////////////////////// // // INL_GetMouseDelta() - Gets the amount that the mouse has moved from the @@ -268,10 +258,9 @@ void INL_Mouse(int x) static void INL_GetMouseDelta(int *x,int *y) { - union REGS CPURegs; Mouse(MDelta); - *x = CPURegs.x.cx; - *y = CPURegs.x.dx; + *x = _CX; + *y = _DX; } /////////////////////////////////////////////////////////////////////////// @@ -283,11 +272,10 @@ INL_GetMouseDelta(int *x,int *y) static word INL_GetMouseButtons(void) { - union REGS CPURegs; word buttons; Mouse(MButtons); - buttons = CPURegs.x.bx; + buttons = _BX; return(buttons); } @@ -389,9 +377,9 @@ done: void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/, global_game_variables_t *gvar) { word x,y; - word TimeCount = *clockw; +//00 word TimeCount = *clockw; JoystickDef *def; -static word lasttime; +//00static word lasttime; IN_GetJoyAbs(joy,&x,&y); def = gvar->in.JoyDefs + joy; @@ -452,7 +440,7 @@ static word lasttime; // *dy *= time; // } // } - lasttime = TimeCount; +//00 lasttime = TimeCount; } /////////////////////////////////////////////////////////////////////////// @@ -482,15 +470,15 @@ register word result; word IN_GetJoyButtonsDB(word joy) { - word TimeCount = *clockw; - word lasttime; +//00 word TimeCount = *clockw; +//00 word lasttime; word result1,result2; do { result1 = INL_GetJoyButtons(joy); - lasttime = TimeCount; - while(TimeCount == lasttime) +//00 lasttime = TimeCount; +//00 while(TimeCount == lasttime) //; result2 = INL_GetJoyButtons(joy); } while(result1 != result2); @@ -503,7 +491,7 @@ IN_GetJoyButtonsDB(word joy) // /////////////////////////////////////////////////////////////////////////// static void -INL_StartKbd() +INL_StartKbd(void) { INL_KeyHook = NULL; // Clear key hook @@ -542,7 +530,7 @@ INL_StartMouse(void) return(true); } return(false); -#endif +#else byte far *vector; @@ -554,6 +542,7 @@ INL_StartMouse(void) Mouse(MReset); return true; +#endif } /////////////////////////////////////////////////////////////////////////// @@ -689,7 +678,6 @@ IN_Startup(global_game_variables_t *gvar) gvar->in.inst = &inst; gvar->in.IN_Started = true; - } /////////////////////////////////////////////////////////////////////////// @@ -878,8 +866,7 @@ register KeyboardDef *def; #endif switch (type = player->Controls) { - case ctrl_Keyboard1: - case ctrl_Keyboard2: + case ctrl_Keyboard: def = &(gvar->in.KbdDefs[type - ctrl_Keyboard]); /* if (Keyboard[def->upleft]) @@ -954,8 +941,8 @@ register KeyboardDef *def; } else { - dx = mx;// * 127; - dy = my;// * 127; + dx = mx * 127; + dy = my * 127; } player->info.x = dx; @@ -1003,6 +990,22 @@ register KeyboardDef *def; } #endif #ifdef __DEBUG_InputMgr__ +if(dbg_joymousedelta) +{ + { +static int old_dx,old_dy; +static word old_buttons=0; + if(dx!=old_dx || dy!=old_dy) printf("dx,dy [%d,%d] %d,%d\n", dx, dy, mx, my); + if(dx!=old_dx) old_dx=dx; + if(dy!=old_dy) old_dy=dy; + if(old_buttons!=buttons) + { + printf(" buttons={%u,%u,%u,%u}\n", player->info.button0, player->info.button1, player->info.button2, player->info.button3); + old_buttons=buttons; + } + } +} + if(dbg_testcontrolnoisy > 0) 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) { @@ -1277,11 +1280,10 @@ boolean IN_UserInput(word delay, global_game_variables_t *gvar) byte IN_MouseButtons (global_game_variables_t *gvar) { - union REGS CPURegs; if (gvar->in.MousePresent) { Mouse(MButtons); - return CPURegs.x.bx; + return _BX; } else return 0;