X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_in.c;h=a6b43dfbb22784e1a6b2c9358b38a1b699027c8d;hb=c060c91a1c7e418122606fdc5cd7c9ce5a55495d;hp=314ddbfd2318fc15ed845e2f22bb94902e78dfef;hpb=9ea7542f2ec7df1106ef9bae41d066920fb79521;p=16.git diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 314ddbfd..a6b43dfb 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -501,11 +501,17 @@ IN_GetJoyButtonsDB(word joy) static void INL_StartKbd() { + byte far *lock_key; INL_KeyHook = 0; // Clear key hook IN_ClearKeysDown(); OldKeyVect = _dos_getvect(KeyInt); + + // 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 _dos_setvect(KeyInt,INL_KeyService); } @@ -703,7 +709,7 @@ IN_Default(boolean gotit,player_t *player,ControlType nt) //in.KbdDefs[0].downright = 0x51; IN_SetControlType(0,player,nt); for(i=0; i>MaxPlayers;i++) - player[i].d=2; + player[i].enti.d =2; } /////////////////////////////////////////////////////////////////////////// @@ -814,7 +820,7 @@ IN_ReadCursor(CursorInfo *info) // /////////////////////////////////////////////////////////////////////////// void near -IN_ReadControl(int pn,player_t *player) +IN_ReadControl(word pn, player_t *player) { boolean realdelta; #if DEMO0 @@ -949,10 +955,10 @@ register KeyboardDef *def; player[pn].info.dir = DirTable[conpee]; if(DirTable[conpee]!=2) player[pn].pdir=DirTable[conpee]; - if(player[pn].q==1 &&( dir!=2 || (mx!=motion_None || my!=motion_None))) + if(player[pn].enti.q==1 &&( dir!=2 || (mx!=motion_None || my!=motion_None))) { - if(dir==2) player[pn].d = player[pn].info.dir; - else player[pn].d = DirTable[dir]; + if(dir==2) player[pn].enti.d = player[pn].info.dir; + else player[pn].enti.d = DirTable[dir]; } #if DEMO0 @@ -982,12 +988,12 @@ register KeyboardDef *def; #endif #ifdef __DEBUG_InputMgr__ if(dbg_testcontrolnoisy > 0) -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) +if(player[pn].info.dir!=2/*(inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])*/ || player[pn].enti.q>1) { //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); - //printf("q=%d ", player[pn].q); + //printf("q=%d ", player[pn].enti.q); //printf("cpee=%c ", dirchar(conpee)); - printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].d), dirchar(player[pn].info.dir)); + printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].enti.d), dirchar(player[pn].info.dir)); /*if(realdelta) */printf("dx=%d dy=%d mx=%d my=%d", player[pn].info.x, player[pn].info.y, player[pn].info.xaxis, player[pn].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"); @@ -1245,15 +1251,57 @@ IN_UserInput(dword delay,boolean clear) 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 = inp(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_notest) + if(!dbg_nointest) #endif return inpu.Keyboard[code]; #ifdef __DEBUG_InputMgr__ else - if(dbg_notest && kbhit()) + if(dbg_nointest && kbhit()) return 1; else return 0; @@ -1276,21 +1324,12 @@ boolean IN_qb(byte kee) else return 0; } -//init player! -void IN_initplayer(player_t *player, word pn) +ScanCode IN_GetLastScan() +{ + return inpu.LastScan; +} + +ScanCode IN_GetCurCode() { - player[pn].x = player[pn].tx*TILEWH; - player[pn].y = player[pn].ty*TILEWH; - player[pn].triggerx = player[pn].tx; - player[pn].triggery = player[pn].ty+1; -/* player[0].info.x = player[0].tx; - player[0].info.xaxis = player[0].tx*TILEWH; - player[0].info.y = player[0].ty; - player[0].info.yaxis = player[0].ty*TILEWH;*/ - player[pn].q=1; - player[pn].d=2; - player[pn].hp=4; - player[pn].speed=4; - player[pn].persist_aniframe=0; - player[pn].spt=(TILEWH/(player[pn].speed)); //speed per tile wwww + return inst.CurCode; }