X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_in.c;h=f3a807661d2b4f231042a00457605be0e6f7ca51;hb=93e1ab2e43ce82facb47476d9ee461b0d5beb83e;hp=84804f6cb9e1cda1338dbc19b63daa3bb6a85a83;hpb=1283a77d97ded3c0b1f0522b27af9d11da672f52;p=16.git diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 84804f6c..f3a80766 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -1,21 +1,3 @@ -/* Catacomb Apocalypse 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. - */ - // // ID Engine // ID_IN.c - Input Manager @@ -37,6 +19,9 @@ // #include "src/lib/16_in.h" +#pragma hdrstop + +static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ /* ============================================================================= @@ -47,9 +32,8 @@ */ struct inconfig { - boolean MousePresent; - boolean JoysPresent[MaxJoys]; - boolean JoyPadPresent[MaxPads]; + boolean MousePresent; + boolean JoysPresent[MaxJoys]; boolean Keyboard[NumCodes]; boolean Paused; char LastASCII; @@ -57,10 +41,8 @@ struct inconfig KeyboardDef KbdDefs[MaxKbds]; JoystickDef JoyDefs[MaxJoys]; - JoypadDef JoypadDefs[MaxPads]; } inpu; -//extern inconfig inpu; //inpu.KbdDefs = {0x1d,0x38,/*0x47,*/0x48,/*0x49,*/0x4b,0x4d,/*0x4f,*/0x50/*,0x51*/}; /* @@ -81,10 +63,6 @@ static struct instat { ScanCode CurCode,LastCode; } inst; -static void (*INL_KeyHook)(void); -static void interrupt (*OldKeyVect)(void); -static char *ParmStringsIN[] = {"nojoys","nomouse",nil}; - static byte far ASCIINames[] = // Unshifted ASCII for scan codes { // 0 1 2 3 4 5 6 7 8 9 A B C D E F @@ -149,38 +127,37 @@ static byte far ASCIINames[] = // Unshifted ASCII for scan codes static Direction DirTable[] = // Quick lookup for total direction { - //dir_Nortinest, - dir_North, - dir_West, - dir_None, - dir_East, - dir_South - //dir_NorthEast, - //dir_Soutinest, - //,dir_SouthEast + /*dir_NorthWest, */dir_North,/* dir_NorthEast,*/ + dir_West, dir_None, dir_East, + /*dir_SouthWest, */dir_South/*, dir_SouthEast*/ }; #ifdef __cplusplus } #endif +static void (*INL_KeyHook)(void); +static void interrupt (*OldKeyVect)(void); +static char *ParmStringsIN[] = {"nojoys","nomouse",nil}; + // Internal routines + /////////////////////////////////////////////////////////////////////////// // // INL_KeyService() - Handles a keyboard interrupt (key up/down) // /////////////////////////////////////////////////////////////////////////// -void interrupt -INL_KeyService() +/*static */void interrupt +INL_KeyService(void) { static boolean special; - byte k,c; - register byte temp; + byte k,c, + temp; - k = inp(0x60); // Get the scan code + k = inportb(0x60); // Get the scan code // Tell the XT keyboard controller to clear the key - outp(0x61,(temp = inp(0x61)) | 0x80); - outp(0x61,temp); + outportb(0x61,(temp = inportb(0x61)) | 0x80); + outportb(0x61,temp); if (k == 0xe0) // Special key prefix special = true; @@ -234,18 +211,21 @@ static boolean special; if (INL_KeyHook && !special) INL_KeyHook(); -//#ifdef TESTKEYIN - if(testkeyin > 0) printf("%c %x %u\n", c, k, inpu.Keyboard[k]); -//endif - outp(0x20,0x20); +#ifdef __DEBUG_InputMgr__ + if(dbg_testkeyin > 0) printf("%c %u [0x%x %u] %u\n", c, c, k, k, inpu.Keyboard[k]); +#endif + outportb(0x20,0x20); } -void -Mouse(int x) +void INL_Mouse(int x) { - union REGS CPURegs; - x = CPURegs.x.ax; - int86(MouseInt,&CPURegs,&CPURegs); + //union REGS CPURegs; + //x = CPURegs.x.ax; + __asm { + mov ax,x + int MouseInt + } + //int86(MouseInt,&CPURegs,&CPURegs); } /////////////////////////////////////////////////////////////////////////// @@ -299,8 +279,7 @@ IN_GetJoyAbs(word joy,word *xp,word *yp) yb = 1 << ys; // Read the absolute joystick values - __asm - { + __asm { pushf // Save some registers push si push di @@ -320,8 +299,13 @@ IN_GetJoyAbs(word joy,word *xp,word *yp) push bp // Don't mess up stack frame mov bp,MaxJoyValue - +#ifdef __BORLANDC__ + } +#endif loo: +#ifdef __BORLANDC__ + __asm { +#endif in al,dx // Get bits indicating whether all are finished dec bp // Check bounding register @@ -338,8 +322,13 @@ loo: add cl,bl jnz loo // If both bits were 0, drop out - +#ifdef __BORLANDC__ + } +#endif done: +#ifdef __BORLANDC__ + __asm { +#endif pop bp mov cl,[xs] // Get the number of bits to shift @@ -363,14 +352,12 @@ done: /////////////////////////////////////////////////////////////////////////// // // INL_GetJoyDelta() - Returns the relative movement of the specified -// joystick (from +/-127, scaled adaptively) +// joystick (from +/-127) // /////////////////////////////////////////////////////////////////////////// -static void -INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive) +void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/) { word x,y; - word time; word TimeCount = *clockw; JoystickDef *def; static word lasttime; @@ -423,18 +410,17 @@ static word lasttime; } else *dy = 0; - - if (adaptive) - { - time = (TimeCount - lasttime) / 2; - if (time) - { - if (time > 8) - time = 8; - *dx *= time; - *dy *= time; - } - } +// if (adaptive) +// { +// time = (TimeCount - lasttime) / 2; +// if (time) +// { +// if (time > 8) +// time = 8; +// *dx *= time; +// *dy *= time; +// } +// } lasttime = TimeCount; } @@ -449,7 +435,7 @@ INL_GetJoyButtons(word joy) { register word result; - result = inp(0x201); // Get all the joystick buttons + result = inportb(0x201); // Get all the joystick buttons result >>= joy? 6 : 4; // Shift into bits 0-1 result &= 3; // Mask off the useless bits result ^= 3; @@ -474,6 +460,7 @@ IN_GetJoyButtonsDB(word joy) result1 = INL_GetJoyButtons(joy); lasttime = TimeCount; while(TimeCount == lasttime) + //; result2 = INL_GetJoyButtons(joy); } while(result1 != result2); return(result1); @@ -485,14 +472,14 @@ IN_GetJoyButtonsDB(word joy) // /////////////////////////////////////////////////////////////////////////// static void -INL_StartKbd() +INL_StartKbd(void) { - INL_KeyHook = 0; // Clear key hook + INL_KeyHook = NULL; // Clear key hook IN_ClearKeysDown(); - OldKeyVect = _dos_getvect(KeyInt); - _dos_setvect(KeyInt,INL_KeyService); + OldKeyVect = getvect(KeyInt);//IN_KbdLED(); + setvect(KeyInt,INL_KeyService); } /////////////////////////////////////////////////////////////////////////// @@ -505,7 +492,7 @@ INL_ShutKbd(void) { pokeb(0x40,0x17,peekb(0x40,0x17) & 0xfaf0); // Clear ctrl/alt/shift flags - _dos_setvect(KeyInt,OldKeyVect); + setvect(KeyInt,OldKeyVect); } /////////////////////////////////////////////////////////////////////////// @@ -516,14 +503,26 @@ INL_ShutKbd(void) static boolean INL_StartMouse(void) { - union REGS CPURegs; - if(_dos_getvect(MouseInt)) +#if 0 + if (getvect(MouseInt)) { Mouse(MReset); - if(CPURegs.x.ax == 0xffff) + if (_AX == 0xffff) return(true); } return(false); +#endif + byte far *vector; + + + if ((vector=MK_FP(peek(0,0x33*4+2),peek(0,0x33*4)))==NULL) + return false; + + if (*vector == 207) + return false; + + Mouse(MReset); + return true; } /////////////////////////////////////////////////////////////////////////// @@ -637,9 +636,9 @@ IN_Startup() checkjoys = true; checkmouse = true; - for (i = 1;i < __argc;i++) + for (i = 1;i < _argc;i++) { - switch (US_CheckParm(__argv[i],ParmStringsIN)) + switch (US_CheckParm(_argv[i],ParmStringsIN)) { case 0: checkjoys = false; @@ -657,6 +656,7 @@ IN_Startup() inpu.JoysPresent[i] = checkjoys? INL_StartJoy(i) : false; inst.IN_Started = true; + } /////////////////////////////////////////////////////////////////////////// @@ -667,14 +667,13 @@ IN_Startup() void IN_Default(boolean gotit,player_t *player,ControlType nt) { + int i; if ( (!gotit) || ((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]) ) nt = ctrl_Keyboard1; inpu.KbdDefs[0].button0 = 0x1c; @@ -687,7 +686,9 @@ IN_Default(boolean gotit,player_t *player,ControlType nt) //in.KbdDefs[0].downleft = 0x4f; inpu.KbdDefs[0].down = 0x50; //in.KbdDefs[0].downright = 0x51; - IN_SetControlType(0,player,nt); + IN_SetControlType(player,nt); + for(i=0; i>MaxPlayers;i++) + player[i].enti.d =2; } /////////////////////////////////////////////////////////////////////////// @@ -696,7 +697,7 @@ IN_Default(boolean gotit,player_t *player,ControlType nt) // /////////////////////////////////////////////////////////////////////////// void -IN_Shutdown() +IN_Shutdown(void) { word i; @@ -725,13 +726,13 @@ IN_SetKeyHook(void (*hook)()) /////////////////////////////////////////////////////////////////////////// // -// IN_ClearKeyDown() - Clears the keyboard array +// IN_ClearKeysDown() - Clears the keyboard array // /////////////////////////////////////////////////////////////////////////// void -IN_ClearKeysDown() +IN_ClearKeysDown(void) { - int i; + //int i; inpu.LastScan = sc_None; inpu.LastASCII = key_None; @@ -784,29 +785,36 @@ IN_ReadCursor(CursorInfo *info) continue; buttons = INL_GetJoyButtons(i); - INL_GetJoyDelta(i,&dx,&dy,true); + INL_GetJoyDelta(i,&dx,&dy/*,true*/); dx /= 64; dy /= 64; INL_AdjustCursor(info,buttons,dx,dy); } } +//if else for gfxtesting and direction +#define DIRECTIONIFELSE (player->info.dir == 2) +//#define NDIRECTIONIFELSE (player->info.dir != 2) + /////////////////////////////////////////////////////////////////////////// // // IN_ReadControl() - Reads the device associated with the specified // player and fills in the control info struct // /////////////////////////////////////////////////////////////////////////// -void near -IN_ReadControl(int playnum,player_t *player) +void +IN_ReadControl(player_t *player) { boolean realdelta; +#if DEMO0 byte dbyte; +#endif word buttons; int dx,dy; Motion mx,my; ControlType type; sword conpee; + byte dir=DirTable[2]; register KeyboardDef *def; dx = dy = 0; @@ -831,11 +839,11 @@ register KeyboardDef *def; realdelta = false; } else if (DemoMode == demo_PlayDone) - Quit("Demo playback exceeded"); + Quit ("Demo playback exceeded"); else { #endif - switch (type = player[playnum].Controls) + switch (type = player->Controls) { case ctrl_Keyboard1: case ctrl_Keyboard2: @@ -849,16 +857,39 @@ register KeyboardDef *def; mx = motion_Left,my = motion_Down; else if (Keyboard[def->downright]) mx = motion_Right,my = motion_Down;*/ +//TODO: make this into a function that the joystick AND keyboard can use wwww + if(DIRECTIONIFELSE)//(player->info.dir == 2) + { if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){ - if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down] && player[playnum].d == 2))// || player[playnum].info.dir == 0) - my = motion_Up; - if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up] && player[playnum].d == 2))// || player[playnum].info.dir == 4) - my = motion_Down; + if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down])) + my = motion_Up; + if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up])) + my = motion_Down; }else if(!inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]){ - if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right] && player[playnum].d == 2))// || player[playnum].info.dir == 1) - mx = motion_Left; - if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left] && player[playnum].d == 2))// || player[playnum].info.dir == 3) - mx = motion_Right; + if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right])) + mx = motion_Left; + if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left])) + mx = motion_Right; + }else{ //2 keys pressed + switch (player->pdir) + { + case 0: + case 4: + if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right])){ dir = DirTable[1]; }//mx = motion_Left; } + else if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left])){ dir = DirTable[3]; }//mx = motion_Right; } + break; + case 1: + case 3: + if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down])){ dir = DirTable[0]; }//my = motion_Up; } + else if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up])){ dir = DirTable[4]; }//my = motion_Down; } + break; + default: + break; + } +#ifdef __DEBUG_InputMgr__ + //if(dbg_testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c ", dirchar(player->pdir)); } +#endif + } } //input from player if (inpu.Keyboard[def->button0]) @@ -869,7 +900,7 @@ register KeyboardDef *def; break; case ctrl_Joystick1: case ctrl_Joystick2: - INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy,false); + INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy/*,false*/); buttons = INL_GetJoyButtons(type - ctrl_Joystick); realdelta = true; break; @@ -878,10 +909,6 @@ register KeyboardDef *def; buttons = INL_GetMouseButtons(); realdelta = true; break; - case ctrl_Joypad1: - case ctrl_Joypad2: - printf("wwww"); - break; } #ifdef DEMO0 } @@ -898,21 +925,23 @@ register KeyboardDef *def; dy = my;// * 127; } - 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)]; - conpee=(((my + 1) * 2) + (mx + 1)); - if(conpee) conpee--; - player[playnum].info.dir = DirTable[conpee]; - if(player[playnum].q==1 && (mx!=motion_None || my!=motion_None)) + player->info.x = dx; + player->info.xaxis = mx; + player->info.y = dy; + player->info.yaxis = my; + player->info.button0 = buttons & (1 << 0); + player->info.button1 = buttons & (1 << 1); + player->info.button2 = buttons & (1 << 2); + player->info.button3 = buttons & (1 << 3); +// player->info.dir = DirTable[((my + 1) * 3) + (mx + 1)]; + conpee=(((my + 1) * 2) + (mx + 1))-1; + player->info.dir = DirTable[conpee]; + + if(DirTable[conpee]!=2) player->pdir=DirTable[conpee]; + if(player->enti.q==1 &&( dir!=2 || (mx!=motion_None || my!=motion_None))) { - player[playnum].d = player[playnum].info.dir; + if(dir==2) player->enti.d = player->info.dir; + else player->enti.d = DirTable[dir]; } #if DEMO0 @@ -933,22 +962,26 @@ register KeyboardDef *def; DemoOffset += 2; if (DemoOffset >= DemoSize) - Quit("Demo buffer overflow"); + Quit ("Demo buffer overflow"); DemoBuffer[DemoOffset] = 1; DemoBuffer[DemoOffset + 1] = dbyte; } } #endif -//#ifdef TESTCONTROLNOISY -if(testcontrolnoisy > 0) -if((inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])&& player[playnum].info.dir!=2) +#ifdef __DEBUG_InputMgr__ +if(dbg_testcontrolnoisy > 0) +if(player->info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])*/ || player->enti.q>1) { - printf("(mx)=%d ", mx); - printf("(my)=%d ", my); - printf("dir=%d\n", player[playnum].info.dir); + //printf("b1=%u b2=%u b3=%u b4=%u ", player->info.button0, player->info.button1, player->info.button2, player->info.button3); + //printf("q=%d ", player->enti.q); + //printf("cpee=%c ", dirchar(conpee)); + printf("pdir=%c d=%c dir=%c ", dirchar(player->pdir), dirchar(player->enti.d), dirchar(player->info.dir)); + /*if(realdelta) */printf("dx=%d dy=%d mx=%d my=%d", player->info.x, player->info.y, player->info.xaxis, player->info.yaxis); + //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]); + printf("\n"); } -//#endif +#endif } /////////////////////////////////////////////////////////////////////////// @@ -958,10 +991,10 @@ if((inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->lef // /////////////////////////////////////////////////////////////////////////// void -IN_SetControlType(word playnum,player_t *player,ControlType type) +IN_SetControlType(player_t *player,ControlType type) { // DEBUG - check that requested type is present? - player[playnum].Controls = type; + player->Controls = type; } #if DEMO0 @@ -1054,7 +1087,7 @@ IN_GetScanName(ScanCode scan) // /////////////////////////////////////////////////////////////////////////// ScanCode -IN_WaitForKey() +IN_WaitForKey(void) { ScanCode result; @@ -1071,7 +1104,7 @@ IN_WaitForKey() // /////////////////////////////////////////////////////////////////////////// char -IN_WaitForASCII() +IN_WaitForASCII(void) { char result; @@ -1083,66 +1116,66 @@ IN_WaitForASCII() /////////////////////////////////////////////////////////////////////////// // -// IN_AckBack() - Waits for either an ASCII keypress or a button press +// IN_Ack() - waits for a button or key press. If a button is down, upon +// calling, it must be released for it to be recognized // /////////////////////////////////////////////////////////////////////////// -void -IN_AckBack() + +boolean btnstate[8]; + +void IN_StartAck(void) { - word i; + unsigned i,buttons; - while (!inpu.LastScan) - { - if (inpu.MousePresent) - { - if (INL_GetMouseButtons()) - { - while (INL_GetMouseButtons()) - ; - return; - } - } +// +// get initial state of everything +// + IN_ClearKeysDown(); + memset (btnstate,0,sizeof(btnstate)); - for (i = 0;i < MaxJoys;i++) - { - if (inpu.JoysPresent[i]) - { - if (IN_GetJoyButtonsDB(i)) - { - while (IN_GetJoyButtonsDB(i)) - ; - return; - } - } - } - } + buttons = IN_JoyButtons () << 4; + if (inpu.MousePresent) + buttons |= IN_MouseButtons (); - IN_ClearKey(inpu.LastScan); - inpu.LastScan = sc_None; + for (i=0;i<8;i++,buttons>>=1) + if (buttons&1) + btnstate[i] = true; } -/////////////////////////////////////////////////////////////////////////// -// -// IN_Ack() - Clears user input & then calls IN_AckBack() -// -/////////////////////////////////////////////////////////////////////////// -void -IN_Ack() + +boolean IN_CheckAck (void) { - word i; + unsigned i,buttons; - IN_ClearKey(inpu.LastScan); - inpu.LastScan = sc_None; +// +// see if something has been pressed +// + if (inpu.LastScan) + return true; + buttons = IN_JoyButtons () << 4; if (inpu.MousePresent) - while (INL_GetMouseButtons()) - ; - for (i = 0;i < MaxJoys;i++) - if (inpu.JoysPresent[i]) - while (IN_GetJoyButtonsDB(i)) - ; + buttons |= IN_MouseButtons (); + + for (i=0;i<8;i++,buttons>>=1) + if ( buttons&1 ) + { + if (!btnstate[i]) + return true; + } + else + btnstate[i]=false; + + return false; +} + + +void IN_Ack (void) +{ + IN_StartAck (); - IN_AckBack(); + while (!IN_CheckAck ()) + ; } /////////////////////////////////////////////////////////////////////////// @@ -1179,28 +1212,76 @@ IN_IsUserInput() // button up. // /////////////////////////////////////////////////////////////////////////// -boolean -IN_UserInput(dword delay,boolean clear) +boolean IN_UserInput(word delay) { word TimeCount = *clockw; word lasttime; lasttime = TimeCount; + IN_StartAck (); do { - if (IN_IsUserInput()) - { - if (clear) - IN_AckBack(); - return(true); - } + if (IN_CheckAck()) + return true; } while (TimeCount - lasttime < delay); return(false); } +//=========================================================================== + +/* +=================== += += IN_MouseButtons += +=================== +*/ + +byte IN_MouseButtons (void) +{ + union REGS CPURegs; + if (inpu.MousePresent) + { + Mouse(MButtons); + return CPURegs.x.bx; + } + else + return 0; +} + + +/* +=================== += += IN_JoyButtons += +=================== +*/ + +byte IN_JoyButtons (void) +{ + byte joybits; + + joybits = inportb(0x201); // Get all the joystick buttons + joybits >>= 4; // only the high bits are useful + joybits ^= 15; // return with 1=pressed + + return joybits; +} + boolean IN_KeyDown(byte code) { +#ifdef __DEBUG_InputMgr__ + if(!dbg_nointest) +#endif return inpu.Keyboard[code]; +#ifdef __DEBUG_InputMgr__ + else + if(dbg_nointest && kbhit()) + return 1; + else + return 0; +#endif } void IN_ClearKey(byte code) @@ -1212,9 +1293,29 @@ void IN_ClearKey(byte code) boolean IN_qb(byte kee) { -//#ifdef TESTKEYIN - if(testkeyin > 0) printf("%u\n", inpu.Keyboard[kee]); -//#endif +#ifdef __DEBUG_InputMgr__ + if(dbg_testkeyin) printf("%u\n", inpu.Keyboard[kee]); +#endif if(inpu.Keyboard[kee]==true) return 1; else return 0; } + +ScanCode IN_GetLastScan() +{ + return inpu.LastScan; +} + +ScanCode IN_GetCurCode() +{ + return inst.CurCode; +} + +void IN_KbdLED() +{ + byte far *lock_key; + + // turn off num-lock via BIOS + lock_key = MK_FP(0x040, 0x017); // Pointing to the address of the bios shift state keys + *lock_key&=(~(16 | 32 | 64)); // toggle off the locks by changing the values of the 4th, 5th, and 6th bits of the address byte of 0040:0017 + OldKeyVect(); // call BIOS keyhandler to change keyboard lights +}