3 // ID_IN.c - Input Manager
\r
5 // By Jason Blochowiak
\r
9 // This module handles dealing with the various input devices
\r
11 // Depends on: Memory Mgr (for demo recording), Sound Mgr (for timing stuff),
\r
12 // User Mgr (for command line parms)
\r
15 // LastScan - The keyboard scan code of the last key pressed
\r
16 // LastASCII - The ASCII value of the last key pressed
\r
17 // DEBUG - there are more globals
\r
20 #include "ID_HEADS.H"
\r
23 #define KeyInt 9 // The keyboard ISR number
\r
32 #define MouseInt 0x33
\r
33 #define Mouse(x) _AX = x,geninterrupt(MouseInt)
\r
36 // joystick constants
\r
38 #define JoyScaleMax 32768
\r
39 #define JoyScaleShift 8
\r
40 #define MaxJoyValue 5000
\r
43 =============================================================================
\r
47 =============================================================================
\r
51 // configuration variables
\r
53 boolean MousePresent;
\r
54 boolean JoysPresent[MaxJoys];
\r
55 boolean JoyPadPresent;
\r
59 boolean Keyboard[NumCodes];
\r
64 KeyboardDef KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};
\r
65 JoystickDef JoyDefs[MaxJoys];
\r
66 ControlType Controls[MaxPlayers];
\r
68 longword MouseDownCount;
\r
70 Demo DemoMode = demo_Off;
\r
71 byte _seg *DemoBuffer;
\r
72 word DemoOffset,DemoSize;
\r
75 =============================================================================
\r
79 =============================================================================
\r
81 static byte far ASCIINames[] = // Unshifted ASCII for scan codes
\r
83 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
\r
84 0 ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8 ,9 , // 0
\r
85 'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0 ,'a','s', // 1
\r
86 'd','f','g','h','j','k','l',';',39 ,'`',0 ,92 ,'z','x','c','v', // 2
\r
87 'b','n','m',',','.','/',0 ,'*',0 ,' ',0 ,0 ,0 ,0 ,0 ,0 , // 3
\r
88 0 ,0 ,0 ,0 ,0 ,0 ,0 ,'7','8','9','-','4','5','6','+','1', // 4
\r
89 '2','3','0',127,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5
\r
90 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6
\r
91 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7
\r
93 far ShiftNames[] = // Shifted ASCII for scan codes
\r
95 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
\r
96 0 ,27 ,'!','@','#','$','%','^','&','*','(',')','_','+',8 ,9 , // 0
\r
97 'Q','W','E','R','T','Y','U','I','O','P','{','}',13 ,0 ,'A','S', // 1
\r
98 'D','F','G','H','J','K','L',':',34 ,'~',0 ,'|','Z','X','C','V', // 2
\r
99 'B','N','M','<','>','?',0 ,'*',0 ,' ',0 ,0 ,0 ,0 ,0 ,0 , // 3
\r
100 0 ,0 ,0 ,0 ,0 ,0 ,0 ,'7','8','9','-','4','5','6','+','1', // 4
\r
101 '2','3','0',127,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5
\r
102 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6
\r
103 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7
\r
105 far SpecialNames[] = // ASCII for 0xe0 prefixed codes
\r
107 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
\r
108 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 0
\r
109 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,13 ,0 ,0 ,0 , // 1
\r
110 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 2
\r
111 0 ,0 ,0 ,0 ,0 ,'/',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 3
\r
112 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 4
\r
113 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5
\r
114 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6
\r
115 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7
\r
119 static boolean IN_Started;
\r
120 static boolean CapsLock;
\r
121 static ScanCode CurCode,LastCode;
\r
123 static Direction DirTable[] = // Quick lookup for total direction
\r
125 dir_NorthWest, dir_North, dir_NorthEast,
\r
126 dir_West, dir_None, dir_East,
\r
127 dir_SouthWest, dir_South, dir_SouthEast
\r
130 static void (*INL_KeyHook)(void);
\r
131 static void interrupt (*OldKeyVect)(void);
\r
133 static char *ParmStrings[] = {"nojoys","nomouse",nil};
\r
135 // Internal routines
\r
137 ///////////////////////////////////////////////////////////////////////////
\r
139 // INL_KeyService() - Handles a keyboard interrupt (key up/down)
\r
141 ///////////////////////////////////////////////////////////////////////////
\r
142 static void interrupt
\r
143 INL_KeyService(void)
\r
145 static boolean special;
\r
150 k = inportb(0x60); // Get the scan code
\r
152 // Tell the XT keyboard controller to clear the key
\r
153 outportb(0x61,(temp = inportb(0x61)) | 0x80);
\r
154 outportb(0x61,temp);
\r
156 if (k == 0xe0) // Special key prefix
\r
158 else if (k == 0xe1) // Handle Pause key
\r
162 if (k & 0x80) // Break code
\r
166 // DEBUG - handle special keys: ctl-alt-delete, print scrn
\r
168 Keyboard[k] = false;
\r
172 LastCode = CurCode;
\r
173 CurCode = LastScan = k;
\r
174 Keyboard[k] = true;
\r
177 c = SpecialNames[k];
\r
180 if (k == sc_CapsLock)
\r
183 // DEBUG - make caps lock light work
\r
186 if (Keyboard[sc_LShift] || Keyboard[sc_RShift]) // If shifted
\r
189 if ((c >= 'A') && (c <= 'Z') && CapsLock)
\r
195 if ((c >= 'a') && (c <= 'z') && CapsLock)
\r
206 if (INL_KeyHook && !special)
\r
208 outportb(0x20,0x20);
\r
211 ///////////////////////////////////////////////////////////////////////////
\r
213 // INL_GetMouseDelta() - Gets the amount that the mouse has moved from the
\r
216 ///////////////////////////////////////////////////////////////////////////
\r
218 INL_GetMouseDelta(int *x,int *y)
\r
225 ///////////////////////////////////////////////////////////////////////////
\r
227 // INL_GetMouseButtons() - Gets the status of the mouse buttons from the
\r
230 ///////////////////////////////////////////////////////////////////////////
\r
232 INL_GetMouseButtons(void)
\r
241 ///////////////////////////////////////////////////////////////////////////
\r
243 // IN_GetJoyAbs() - Reads the absolute position of the specified joystick
\r
245 ///////////////////////////////////////////////////////////////////////////
\r
247 IN_GetJoyAbs(word joy,word *xp,word *yp)
\r
254 xs = joy? 2 : 0; // Find shift value for x axis
\r
255 xb = 1 << xs; // Use shift value to get x bit mask
\r
256 ys = joy? 3 : 1; // Do the same for y axis
\r
259 // Read the absolute joystick values
\r
260 asm pushf // Save some registers
\r
263 asm cli // Make sure an interrupt doesn't screw the timings
\r
268 asm out dx,al // Clear the resistors
\r
270 asm mov ah,[xb] // Get masks into registers
\r
273 asm xor si,si // Clear count registers
\r
275 asm xor bh,bh // Clear high byte of bx for later
\r
277 asm push bp // Don't mess up stack frame
\r
278 asm mov bp,MaxJoyValue
\r
281 asm in al,dx // Get bits indicating whether all are finished
\r
283 asm dec bp // Check bounding register
\r
284 asm jz done // We have a silly value - abort
\r
286 asm mov bl,al // Duplicate the bits
\r
287 asm and bl,ah // Mask off useless bits (in [xb])
\r
288 asm add si,bx // Possibly increment count register
\r
289 asm mov cl,bl // Save for testing later
\r
292 asm and bl,ch // [yb]
\r
296 asm jnz loop // If both bits were 0, drop out
\r
301 asm mov cl,[xs] // Get the number of bits to shift
\r
302 asm shr si,cl // and shift the count that many times
\r
307 asm mov [x],si // Store the values into the variables
\r
312 asm popf // Restore the registers
\r
318 ///////////////////////////////////////////////////////////////////////////
\r
320 // INL_GetJoyDelta() - Returns the relative movement of the specified
\r
321 // joystick (from +/-127)
\r
323 ///////////////////////////////////////////////////////////////////////////
\r
324 void INL_GetJoyDelta(word joy,int *dx,int *dy)
\r
329 static longword lasttime;
\r
331 IN_GetJoyAbs(joy,&x,&y);
\r
332 def = JoyDefs + joy;
\r
334 if (x < def->threshMinX)
\r
336 if (x < def->joyMinX)
\r
339 x = -(x - def->threshMinX);
\r
340 x *= def->joyMultXL;
\r
341 x >>= JoyScaleShift;
\r
342 *dx = (x > 127)? -127 : -x;
\r
344 else if (x > def->threshMaxX)
\r
346 if (x > def->joyMaxX)
\r
349 x = x - def->threshMaxX;
\r
350 x *= def->joyMultXH;
\r
351 x >>= JoyScaleShift;
\r
352 *dx = (x > 127)? 127 : x;
\r
357 if (y < def->threshMinY)
\r
359 if (y < def->joyMinY)
\r
362 y = -(y - def->threshMinY);
\r
363 y *= def->joyMultYL;
\r
364 y >>= JoyScaleShift;
\r
365 *dy = (y > 127)? -127 : -y;
\r
367 else if (y > def->threshMaxY)
\r
369 if (y > def->joyMaxY)
\r
372 y = y - def->threshMaxY;
\r
373 y *= def->joyMultYH;
\r
374 y >>= JoyScaleShift;
\r
375 *dy = (y > 127)? 127 : y;
\r
380 lasttime = TimeCount;
\r
383 ///////////////////////////////////////////////////////////////////////////
\r
385 // INL_GetJoyButtons() - Returns the button status of the specified
\r
388 ///////////////////////////////////////////////////////////////////////////
\r
390 INL_GetJoyButtons(word joy)
\r
392 register word result;
\r
394 result = inportb(0x201); // Get all the joystick buttons
\r
395 result >>= joy? 6 : 4; // Shift into bits 0-1
\r
396 result &= 3; // Mask off the useless bits
\r
401 ///////////////////////////////////////////////////////////////////////////
\r
403 // IN_GetJoyButtonsDB() - Returns the de-bounced button status of the
\r
404 // specified joystick
\r
406 ///////////////////////////////////////////////////////////////////////////
\r
408 IN_GetJoyButtonsDB(word joy)
\r
411 word result1,result2;
\r
415 result1 = INL_GetJoyButtons(joy);
\r
416 lasttime = TimeCount;
\r
417 while (TimeCount == lasttime)
\r
419 result2 = INL_GetJoyButtons(joy);
\r
420 } while (result1 != result2);
\r
424 ///////////////////////////////////////////////////////////////////////////
\r
426 // INL_StartKbd() - Sets up my keyboard stuff for use
\r
428 ///////////////////////////////////////////////////////////////////////////
\r
432 INL_KeyHook = NULL; // no key hook routine
\r
434 IN_ClearKeysDown();
\r
436 OldKeyVect = getvect(KeyInt);
\r
437 setvect(KeyInt,INL_KeyService);
\r
440 ///////////////////////////////////////////////////////////////////////////
\r
442 // INL_ShutKbd() - Restores keyboard control to the BIOS
\r
444 ///////////////////////////////////////////////////////////////////////////
\r
448 poke(0x40,0x17,peek(0x40,0x17) & 0xfaf0); // Clear ctrl/alt/shift flags
\r
450 setvect(KeyInt,OldKeyVect);
\r
453 ///////////////////////////////////////////////////////////////////////////
\r
455 // INL_StartMouse() - Detects and sets up the mouse
\r
457 ///////////////////////////////////////////////////////////////////////////
\r
459 INL_StartMouse(void)
\r
462 if (getvect(MouseInt))
\r
471 unsigned char far *vector;
\r
474 if ((vector=MK_FP(peek(0,0x33*4+2),peek(0,0x33*4)))==NULL)
\r
477 if (*vector == 207)
\r
484 ///////////////////////////////////////////////////////////////////////////
\r
486 // INL_ShutMouse() - Cleans up after the mouse
\r
488 ///////////////////////////////////////////////////////////////////////////
\r
490 INL_ShutMouse(void)
\r
495 // INL_SetJoyScale() - Sets up scaling values for the specified joystick
\r
498 INL_SetJoyScale(word joy)
\r
502 def = &JoyDefs[joy];
\r
503 def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX);
\r
504 def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX);
\r
505 def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY);
\r
506 def->joyMultYH = JoyScaleMax / (def->joyMaxY - def->threshMaxY);
\r
509 ///////////////////////////////////////////////////////////////////////////
\r
511 // IN_SetupJoy() - Sets up thresholding values and calls INL_SetJoyScale()
\r
512 // to set up scaling values
\r
514 ///////////////////////////////////////////////////////////////////////////
\r
516 IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)
\r
521 def = &JoyDefs[joy];
\r
523 def->joyMinX = minx;
\r
524 def->joyMaxX = maxx;
\r
527 def->threshMinX = ((r / 2) - d) + minx;
\r
528 def->threshMaxX = ((r / 2) + d) + minx;
\r
530 def->joyMinY = miny;
\r
531 def->joyMaxY = maxy;
\r
534 def->threshMinY = ((r / 2) - d) + miny;
\r
535 def->threshMaxY = ((r / 2) + d) + miny;
\r
537 INL_SetJoyScale(joy);
\r
540 ///////////////////////////////////////////////////////////////////////////
\r
542 // INL_StartJoy() - Detects & auto-configures the specified joystick
\r
543 // The auto-config assumes the joystick is centered
\r
545 ///////////////////////////////////////////////////////////////////////////
\r
547 INL_StartJoy(word joy)
\r
551 IN_GetJoyAbs(joy,&x,&y);
\r
555 ((x == 0) || (x > MaxJoyValue - 10))
\r
556 || ((y == 0) || (y > MaxJoyValue - 10))
\r
561 IN_SetupJoy(joy,0,x * 2,0,y * 2);
\r
566 ///////////////////////////////////////////////////////////////////////////
\r
568 // INL_ShutJoy() - Cleans up the joystick stuff
\r
570 ///////////////////////////////////////////////////////////////////////////
\r
572 INL_ShutJoy(word joy)
\r
574 JoysPresent[joy] = false;
\r
578 ///////////////////////////////////////////////////////////////////////////
\r
580 // IN_Startup() - Starts up the Input Mgr
\r
582 ///////////////////////////////////////////////////////////////////////////
\r
586 boolean checkjoys,checkmouse;
\r
594 for (i = 1;i < _argc;i++)
\r
596 switch (US_CheckParm(_argv[i],ParmStrings))
\r
602 checkmouse = false;
\r
608 MousePresent = checkmouse? INL_StartMouse() : false;
\r
610 for (i = 0;i < MaxJoys;i++)
\r
611 JoysPresent[i] = checkjoys? INL_StartJoy(i) : false;
\r
616 ///////////////////////////////////////////////////////////////////////////
\r
618 // IN_Default() - Sets up default conditions for the Input Mgr
\r
620 ///////////////////////////////////////////////////////////////////////////
\r
622 IN_Default(boolean gotit,ControlType in)
\r
627 || ((in == ctrl_Joystick1) && !JoysPresent[0])
\r
628 || ((in == ctrl_Joystick2) && !JoysPresent[1])
\r
629 || ((in == ctrl_Mouse) && !MousePresent)
\r
631 in = ctrl_Keyboard1;
\r
632 IN_SetControlType(0,in);
\r
635 ///////////////////////////////////////////////////////////////////////////
\r
637 // IN_Shutdown() - Shuts down the Input Mgr
\r
639 ///////////////////////////////////////////////////////////////////////////
\r
649 for (i = 0;i < MaxJoys;i++)
\r
653 IN_Started = false;
\r
656 ///////////////////////////////////////////////////////////////////////////
\r
658 // IN_SetKeyHook() - Sets the routine that gets called by INL_KeyService()
\r
659 // everytime a real make/break code gets hit
\r
661 ///////////////////////////////////////////////////////////////////////////
\r
663 IN_SetKeyHook(void (*hook)())
\r
665 INL_KeyHook = hook;
\r
668 ///////////////////////////////////////////////////////////////////////////
\r
670 // IN_ClearKeysDown() - Clears the keyboard array
\r
672 ///////////////////////////////////////////////////////////////////////////
\r
674 IN_ClearKeysDown(void)
\r
678 LastScan = sc_None;
\r
679 LastASCII = key_None;
\r
680 memset (Keyboard,0,sizeof(Keyboard));
\r
684 ///////////////////////////////////////////////////////////////////////////
\r
686 // IN_ReadControl() - Reads the device associated with the specified
\r
687 // player and fills in the control info struct
\r
689 ///////////////////////////////////////////////////////////////////////////
\r
691 IN_ReadControl(int player,ControlInfo *info)
\r
699 register KeyboardDef *def;
\r
702 mx = my = motion_None;
\r
705 if (DemoMode == demo_Playback)
\r
707 dbyte = DemoBuffer[DemoOffset + 1];
\r
708 my = (dbyte & 3) - 1;
\r
709 mx = ((dbyte >> 2) & 3) - 1;
\r
710 buttons = (dbyte >> 4) & 3;
\r
712 if (!(--DemoBuffer[DemoOffset]))
\r
715 if (DemoOffset >= DemoSize)
\r
716 DemoMode = demo_PlayDone;
\r
721 else if (DemoMode == demo_PlayDone)
\r
722 Quit("Demo playback exceeded");
\r
725 switch (type = Controls[player])
\r
727 case ctrl_Keyboard:
\r
730 if (Keyboard[def->upleft])
\r
731 mx = motion_Left,my = motion_Up;
\r
732 else if (Keyboard[def->upright])
\r
733 mx = motion_Right,my = motion_Up;
\r
734 else if (Keyboard[def->downleft])
\r
735 mx = motion_Left,my = motion_Down;
\r
736 else if (Keyboard[def->downright])
\r
737 mx = motion_Right,my = motion_Down;
\r
739 if (Keyboard[def->up])
\r
741 else if (Keyboard[def->down])
\r
744 if (Keyboard[def->left])
\r
746 else if (Keyboard[def->right])
\r
749 if (Keyboard[def->button0])
\r
751 if (Keyboard[def->button1])
\r
755 case ctrl_Joystick1:
\r
756 case ctrl_Joystick2:
\r
757 INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy);
\r
758 buttons = INL_GetJoyButtons(type - ctrl_Joystick);
\r
762 INL_GetMouseDelta(&dx,&dy);
\r
763 buttons = INL_GetMouseButtons();
\r
771 mx = (dx < 0)? motion_Left : ((dx > 0)? motion_Right : motion_None);
\r
772 my = (dy < 0)? motion_Up : ((dy > 0)? motion_Down : motion_None);
\r
784 info->button0 = buttons & (1 << 0);
\r
785 info->button1 = buttons & (1 << 1);
\r
786 info->button2 = buttons & (1 << 2);
\r
787 info->button3 = buttons & (1 << 3);
\r
788 info->dir = DirTable[((my + 1) * 3) + (mx + 1)];
\r
790 if (DemoMode == demo_Record)
\r
792 // Pack the control info into a byte
\r
793 dbyte = (buttons << 4) | ((mx + 1) << 2) | (my + 1);
\r
797 (DemoBuffer[DemoOffset + 1] == dbyte)
\r
798 && (DemoBuffer[DemoOffset] < 255)
\r
800 (DemoBuffer[DemoOffset])++;
\r
803 if (DemoOffset || DemoBuffer[DemoOffset])
\r
806 if (DemoOffset >= DemoSize)
\r
807 Quit("Demo buffer overflow");
\r
809 DemoBuffer[DemoOffset] = 1;
\r
810 DemoBuffer[DemoOffset + 1] = dbyte;
\r
815 ///////////////////////////////////////////////////////////////////////////
\r
817 // IN_SetControlType() - Sets the control type to be used by the specified
\r
820 ///////////////////////////////////////////////////////////////////////////
\r
822 IN_SetControlType(int player,ControlType type)
\r
824 // DEBUG - check that requested type is present?
\r
825 Controls[player] = type;
\r
828 ///////////////////////////////////////////////////////////////////////////
\r
830 // IN_WaitForKey() - Waits for a scan code, then clears LastScan and
\r
831 // returns the scan code
\r
833 ///////////////////////////////////////////////////////////////////////////
\r
835 IN_WaitForKey(void)
\r
839 while (!(result = LastScan))
\r
845 ///////////////////////////////////////////////////////////////////////////
\r
847 // IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and
\r
848 // returns the ASCII value
\r
850 ///////////////////////////////////////////////////////////////////////////
\r
852 IN_WaitForASCII(void)
\r
856 while (!(result = LastASCII))
\r
862 ///////////////////////////////////////////////////////////////////////////
\r
864 // IN_Ack() - waits for a button or key press. If a button is down, upon
\r
865 // calling, it must be released for it to be recognized
\r
867 ///////////////////////////////////////////////////////////////////////////
\r
869 boolean btnstate[8];
\r
871 void IN_StartAck(void)
\r
873 unsigned i,buttons;
\r
876 // get initial state of everything
\r
878 IN_ClearKeysDown();
\r
879 memset (btnstate,0,sizeof(btnstate));
\r
881 buttons = IN_JoyButtons () << 4;
\r
883 buttons |= IN_MouseButtons ();
\r
885 for (i=0;i<8;i++,buttons>>=1)
\r
887 btnstate[i] = true;
\r
891 boolean IN_CheckAck (void)
\r
893 unsigned i,buttons;
\r
896 // see if something has been pressed
\r
901 buttons = IN_JoyButtons () << 4;
\r
903 buttons |= IN_MouseButtons ();
\r
905 for (i=0;i<8;i++,buttons>>=1)
\r
922 while (!IN_CheckAck ())
\r
927 ///////////////////////////////////////////////////////////////////////////
\r
929 // IN_UserInput() - Waits for the specified delay time (in ticks) or the
\r
930 // user pressing a key or a mouse button. If the clear flag is set, it
\r
931 // then either clears the key or waits for the user to let the mouse
\r
934 ///////////////////////////////////////////////////////////////////////////
\r
935 boolean IN_UserInput(longword delay)
\r
939 lasttime = TimeCount;
\r
945 } while (TimeCount - lasttime < delay);
\r
949 //===========================================================================
\r
952 ===================
\r
956 ===================
\r
959 byte IN_MouseButtons (void)
\r
972 ===================
\r
976 ===================
\r
979 byte IN_JoyButtons (void)
\r
983 joybits = inportb(0x201); // Get all the joystick buttons
\r
984 joybits >>= 4; // only the high bits are useful
\r
985 joybits ^= 15; // return with 1=pressed
\r