From a524bf50fe37eb25587799deb935430329d04fde Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sun, 28 Jan 2001 15:58:17 +0000 Subject: [PATCH] Removed duplicate files, and unified input headers. --- input/ggi/Makefile.am | 4 - input/ggi/event.c | 127 ------ input/ggi/include/Makefile.am | 2 - input/ggi/include/event.h | 14 - input/ggi/include/key.h | 277 -------------- input/ggi/include/mouse.h | 127 ------ input/ggi/init.c | 11 - input/ggi/key.c | 495 ------------------------ input/ggi/mouse.c | 158 -------- input/linux/include/joy.h | 151 -------- input/linux/include/joystick.h | 266 ------------- input/linux/joydefs.c | 237 ------------ input/linux/joystick.c | 377 ------------------ input/sdl/Makefile.am | 4 - input/sdl/event.c | 54 --- input/sdl/include/Makefile.am | 2 - input/sdl/include/event.h | 9 - input/sdl/include/key.h | 275 ------------- input/sdl/include/mouse.h | 127 ------ input/sdl/key.c | 616 ------------------------------ input/sdl/mouse.c | 234 ------------ input/svgalib/Makefile.am | 1 - input/svgalib/include/Makefile.am | 2 - input/svgalib/include/event.h | 9 - input/svgalib/include/key.h | 275 ------------- input/svgalib/include/mouse.h | 130 ------- 26 files changed, 3984 deletions(-) delete mode 100644 input/ggi/Makefile.am delete mode 100644 input/ggi/event.c delete mode 100644 input/ggi/include/Makefile.am delete mode 100644 input/ggi/include/event.h delete mode 100644 input/ggi/include/key.h delete mode 100644 input/ggi/include/mouse.h delete mode 100644 input/ggi/init.c delete mode 100644 input/ggi/key.c delete mode 100644 input/ggi/mouse.c delete mode 100644 input/linux/include/joy.h delete mode 100644 input/linux/include/joystick.h delete mode 100644 input/linux/joydefs.c delete mode 100644 input/linux/joystick.c delete mode 100644 input/sdl/Makefile.am delete mode 100644 input/sdl/event.c delete mode 100644 input/sdl/include/Makefile.am delete mode 100644 input/sdl/include/event.h delete mode 100644 input/sdl/include/key.h delete mode 100644 input/sdl/include/mouse.h delete mode 100644 input/sdl/key.c delete mode 100644 input/sdl/mouse.c delete mode 100644 input/svgalib/Makefile.am delete mode 100644 input/svgalib/include/Makefile.am delete mode 100644 input/svgalib/include/event.h delete mode 100644 input/svgalib/include/key.h delete mode 100644 input/svgalib/include/mouse.h diff --git a/input/ggi/Makefile.am b/input/ggi/Makefile.am deleted file mode 100644 index 6f470da3..00000000 --- a/input/ggi/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -SUBDIRS = include - -EXTRA_DIST = \ -event.c init.c key.c mouse.c diff --git a/input/ggi/event.c b/input/ggi/event.c deleted file mode 100644 index 3ba2697c..00000000 --- a/input/ggi/event.c +++ /dev/null @@ -1,127 +0,0 @@ -#include -#include -#include -#include -#include -#include "event.h" -#include "error.h" -#include "fix.h" - -static int initialised=0; - -#ifdef GGI_VIDEO -#include -extern ggi_visual_t *screenvis; -#endif -gii_input_t inputs; - -extern void keyboard_handler(int key, ubyte state); -extern void mouse_handler_button(int button, ubyte state); -extern void mouse_handler_relative(int x, int y); -extern void mouse_handler_absolute(int x, int y); - -void event_poll() -{ - int n; - struct timeval tv; - gii_event event; - - if (!initialised) - event_init(); - if (inputs==NULL) - return; -// Error("GII error: no inputs (perhaps you need to set GII_INPUT env var)\n"); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - giiEventPoll(inputs, emAll, &tv); - - n = giiEventsQueued(inputs, emAll); - - while (n-- > 0) - { - giiEventRead(inputs, &event, emAll); - switch (event.any.type) - { - case evKeyPress: - keyboard_handler(event.key.label, 1); - break; - case evKeyRelease: - keyboard_handler(event.key.label, 0); - break; - case evPtrAbsolute: - mouse_handler_absolute(event.pmove.x, event.pmove.y); - break; - case evPtrRelative: - mouse_handler_relative(event.pmove.x, event.pmove.y); - break; - case evPtrButtonPress: - mouse_handler_button(event.pbutton.button, 1); - break; - case evPtrButtonRelease: - mouse_handler_button(event.pbutton.button, 0); - break; - } - } -} - -void event_close() -{ - if (inputs) - giiClose(inputs); - giiExit(); -} - -#ifdef GII_XWIN -int gii_xwin_initialized=0; -#include -//void lock_nothing(void){return;} -void init_gii_xwin(Display *disp,Window win){ - printf("gii xwin %i %i\n",initialised,gii_xwin_initialized); - if (!initialised) - event_init(); - if (gii_xwin_initialized){ - gii_event ev; - gii_xwin_cmddata_setparam *giiargs=(gii_xwin_cmddata_setparam *) &ev.cmd.data; - memset(&ev,0,sizeof(gii_cmd_nodata_event)+sizeof(gii_xwin_cmddata_setparam)); - ev.cmd.code=GII_CMDCODE_XWINSETPARAM; - ev.any.type = evCommand; - ev.any.size=sizeof(gii_cmd_nodata_event)+sizeof(gii_xwin_cmddata_setparam); - giiargs->win=win; - giiargs->ptralwaysrel=1; - giiEventSend(inputs,&ev); - }else{ - gii_input_t inputs2; - gii_inputxwin_arg giiargs; - memset(&giiargs,0,sizeof(giiargs)); - giiargs.disp=disp; - giiargs.win=win; - giiargs.ptralwaysrel=1; - //giiargs.gglock=lock_nothing; - inputs2=giiOpen("xwin",&giiargs,NULL); - if (inputs2){ - gii_xwin_initialized=1; - if (inputs) - inputs=giiJoinInputs(inputs,inputs2); - else - inputs=inputs2; - } - } -} -#endif - -int event_init() -{ - if (!initialised){ - giiInit(); -#ifdef GGI_VIDEO - inputs = ggiJoinInputs(screenvis, NULL); -#else - inputs=giiOpen(NULL); -#endif - initialised = 1; - atexit(event_close); - } - return 0; -} diff --git a/input/ggi/include/Makefile.am b/input/ggi/include/Makefile.am deleted file mode 100644 index 1b9c30c0..00000000 --- a/input/ggi/include/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -EXTRA_DIST = \ -event.h key.h mouse.h diff --git a/input/ggi/include/event.h b/input/ggi/include/event.h deleted file mode 100644 index 35bfd62f..00000000 --- a/input/ggi/include/event.h +++ /dev/null @@ -1,14 +0,0 @@ -// Event header file - -#ifndef _EVENT_H -#define _EVENT_H - -int event_init(); -void event_poll(); - -#ifdef GII_XWIN -#include -void init_gii_xwin(Display *disp,Window win); -#endif - -#endif diff --git a/input/ggi/include/key.h b/input/ggi/include/key.h deleted file mode 100644 index 1a3aa850..00000000 --- a/input/ggi/include/key.h +++ /dev/null @@ -1,277 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ -/* - * $Source: /cvs/cvsroot/d2x/input/ggi/include/key.h,v $ - * $Revision: 1.2 $ - * $Author: bradleyb $ - * $Date: 2001-01-22 15:42:15 $ - * - * Header for keyboard functions - * - * $Log: not supported by cvs2svn $ - * Revision 1.1.1.1 2001/01/19 03:29:59 bradleyb - * Import of d2x-0.0.8 - * - * Revision 1.2 1999/07/10 02:59:06 donut - * more from orulz - * - * Revision 1.19 1994/10/24 13:58:12 john - * Hacked in support for pause key onto code 0x61. - * - * Revision 1.18 1994/10/21 15:17:10 john - * Added KEY_PRINT_SCREEN - * - * Revision 1.17 1994/08/31 12:22:13 john - * Added KEY_DEBUGGED - * - * Revision 1.16 1994/08/24 18:53:50 john - * Made Cyberman read like normal mouse; added dpmi module; moved - * mouse from assembly to c. Made mouse buttons return time_down. - * - * Revision 1.15 1994/08/18 14:56:16 john - * *** empty log message *** - * - * Revision 1.14 1994/08/08 10:43:24 john - * Recorded when a key was pressed for key_inkey_time. - * - * Revision 1.13 1994/06/17 17:17:28 john - * Added keyd_time_last_key_was_pressed or something like that. - * - * Revision 1.12 1994/04/29 12:14:19 john - * Locked all memory used during interrupts so that program - * won't hang when using virtual memory. - * - * Revision 1.11 1994/02/17 15:57:14 john - * Changed key libary to C. - * - * Revision 1.10 1994/01/31 08:34:09 john - * Fixed reversed lshift/rshift keys. - * - * Revision 1.9 1994/01/18 10:58:17 john - * *** empty log message *** - * - * Revision 1.8 1993/10/16 19:24:43 matt - * Added new function key_clear_times() & key_clear_counts() - * - * Revision 1.7 1993/10/15 10:17:09 john - * added keyd_last_key_pressed and released for use with recorder. - * - * Revision 1.6 1993/10/06 16:20:37 john - * fixed down arrow bug - * - * Revision 1.5 1993/10/04 13:26:42 john - * changed the #defines for scan codes. - * - * Revision 1.4 1993/09/28 11:35:20 john - * added key_peekkey - * - * Revision 1.3 1993/09/20 18:36:43 john - * *** empty log message *** - * - * Revision 1.1 1993/07/10 13:10:39 matt - * Initial revision - * - * - */ - -#ifndef _KEY_H -#define _KEY_H - -#include "fix.h" -#include "pstypes.h" -#include // For 'toupper' - -extern int giiKeyTranslate (int keylabel); - -//========================================================================== -// This installs the int9 vector and initializes the keyboard in buffered -// ASCII mode. key_close simply undoes that. -extern void key_init(); -extern void key_close(); - -//========================================================================== -// These are configuration parameters to setup how the buffer works. -// set keyd_buffer_type to 0 for no key buffering. -// set it to 1 and it will buffer scancodes. -extern unsigned char keyd_buffer_type; -extern unsigned char keyd_repeat; // 1=allow repeating, 0=dont allow repeat - -// keyd_editor_mode... 0=game mode, 1=editor mode. -// Editor mode makes key_down_time always return 0 if modifiers are down. -extern unsigned char keyd_editor_mode; - -// Time in seconds when last key was pressed... -extern volatile int keyd_time_when_last_pressed; - -//========================================================================== -// These are the "buffered" keypress routines. Use them by setting the -// "keyd_buffer_type" variable. - -extern void key_putkey (unsigned short); // simulates a keystroke -extern void key_flush(); // Clears the 256 char buffer -extern int key_checkch(); // Returns 1 if a char is waiting -extern int key_getch(); // Gets key if one waiting other waits for one. -extern int key_inkey(); // Gets key if one, other returns 0. -extern int key_inkey_time(fix *time); // Same as inkey, but returns the time the key was pressed down. -extern int key_peekkey(); // Same as inkey, but doesn't remove key from buffer. - -extern unsigned char key_to_ascii(int keycode ); -extern char *key_name(int keycode); // Convert keycode to the name of the key - -extern void key_debug(); // Does an INT3 - -//========================================================================== -// These are the unbuffered routines. Index by the keyboard scancode. - -// Set to 1 if the key is currently down, else 0 -extern volatile unsigned char keyd_pressed[]; -extern volatile unsigned char keyd_last_pressed; -extern volatile unsigned char keyd_last_released; - -// Returns the seconds this key has been down since last call. -extern fix key_down_time(int scancode); - -// Returns number of times key has went from up to down since last call. -extern unsigned int key_down_count(int scancode); - -// Returns number of times key has went from down to up since last call. -extern unsigned int key_up_count(int scancode); - -// Clears the times & counts used by the above functions -// Took out... use key_flush(); -//void key_clear_times(); -//void key_clear_counts(); - -extern char * key_text[256]; - -#define KEY_SHIFTED 0x100 -#define KEY_ALTED 0x200 -#define KEY_CTRLED 0x400 -#define KEY_DEBUGGED 0x800 - -#define KEY_0 0x0B -#define KEY_1 0x02 -#define KEY_2 0x03 -#define KEY_3 0x04 -#define KEY_4 0x05 -#define KEY_5 0x06 -#define KEY_6 0x07 -#define KEY_7 0x08 -#define KEY_8 0x09 -#define KEY_9 0x0A - -#define KEY_A 0x1E -#define KEY_B 0x30 -#define KEY_C 0x2E -#define KEY_D 0x20 -#define KEY_E 0x12 -#define KEY_F 0x21 -#define KEY_G 0x22 -#define KEY_H 0x23 -#define KEY_I 0x17 -#define KEY_J 0x24 -#define KEY_K 0x25 -#define KEY_L 0x26 -#define KEY_M 0x32 -#define KEY_N 0x31 -#define KEY_O 0x18 -#define KEY_P 0x19 -#define KEY_Q 0x10 -#define KEY_R 0x13 -#define KEY_S 0x1F -#define KEY_T 0x14 -#define KEY_U 0x16 -#define KEY_V 0x2F -#define KEY_W 0x11 -#define KEY_X 0x2D -#define KEY_Y 0x15 -#define KEY_Z 0x2C - -#define KEY_MINUS 0x0C -#define KEY_EQUAL 0x0D -#define KEY_DIVIDE 0x35 -#define KEY_SLASH 0x2B -#define KEY_COMMA 0x33 -#define KEY_PERIOD 0x34 -#define KEY_SEMICOL 0x27 - -#define KEY_LBRACKET 0x1A -#define KEY_RBRACKET 0x1B - -#define KEY_RAPOSTRO 0x28 -#define KEY_LAPOSTRO 0x29 - -#define KEY_ESC 0x01 -#define KEY_ENTER 0x1C -#define KEY_BACKSP 0x0E -#define KEY_TAB 0x0F -#define KEY_SPACEBAR 0x39 - -#define KEY_NUMLOCK 0x45 -#define KEY_SCROLLOCK 0x46 -#define KEY_CAPSLOCK 0x3A - -#define KEY_LSHIFT 0x2A -#define KEY_RSHIFT 0x36 - -#define KEY_LALT 0x38 -#define KEY_RALT 0xB8 - -#define KEY_LCTRL 0x1D -#define KEY_RCTRL 0x9D - -#define KEY_F1 0x3B -#define KEY_F2 0x3C -#define KEY_F3 0x3D -#define KEY_F4 0x3E -#define KEY_F5 0x3F -#define KEY_F6 0x40 -#define KEY_F7 0x41 -#define KEY_F8 0x42 -#define KEY_F9 0x43 -#define KEY_F10 0x44 -#define KEY_F11 0x57 -#define KEY_F12 0x58 - -#define KEY_PAD0 0x52 -#define KEY_PAD1 0x4F -#define KEY_PAD2 0x50 -#define KEY_PAD3 0x51 -#define KEY_PAD4 0x4B -#define KEY_PAD5 0x4C -#define KEY_PAD6 0x4D -#define KEY_PAD7 0x47 -#define KEY_PAD8 0x48 -#define KEY_PAD9 0x49 -#define KEY_PADMINUS 0x4A -#define KEY_PADPLUS 0x4E -#define KEY_PADPERIOD 0x53 -#define KEY_PADDIVIDE 0xB5 -#define KEY_PADMULTIPLY 0x37 -#define KEY_PADENTER 0x9C - -#define KEY_INSERT 0xD2 -#define KEY_HOME 0xC7 -#define KEY_PAGEUP 0xC9 -#define KEY_DELETE 0xD3 -#define KEY_END 0xCF -#define KEY_PAGEDOWN 0xD1 -#define KEY_UP 0xC8 -#define KEY_DOWN 0xD0 -#define KEY_LEFT 0xCB -#define KEY_RIGHT 0xCD - -#define KEY_PRINT_SCREEN 0xB7 -#define KEY_PAUSE 0x61 - -#endif diff --git a/input/ggi/include/mouse.h b/input/ggi/include/mouse.h deleted file mode 100644 index 6f44c665..00000000 --- a/input/ggi/include/mouse.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ -/* - * $Source: /cvs/cvsroot/d2x/input/ggi/include/mouse.h,v $ - * $Revision: 1.1.1.1 $ - * $Author: bradleyb $ - * $Date: 2001-01-19 03:29:59 $ - * - * Header for mouse functions - * - * $Log: not supported by cvs2svn $ - * Revision 1.1 1999/06/15 05:38:08 donut - * Orulz' ggi patches. - * - * Revision 1.10 1995/02/02 10:22:29 john - * Added cyberman init parameter. - * - * Revision 1.9 1994/11/18 23:18:09 john - * Changed some shorts to ints. - * - * Revision 1.8 1994/09/13 12:33:49 john - * Added functions to get down count and state. - * - * Revision 1.7 1994/08/29 20:52:20 john - * Added better cyberman support; also, joystick calibration - * value return funcctiionn, - * - * Revision 1.6 1994/08/24 17:54:35 john - * *** empty log message *** - * - * Revision 1.5 1994/08/24 17:51:43 john - * Added transparent cyberman support - * - * Revision 1.4 1993/07/27 09:32:22 john - * *** empty log message *** - * - * Revision 1.3 1993/07/26 10:46:44 john - * added definition for mouse_set_pos - * - * Revision 1.2 1993/07/22 13:07:59 john - * added header for mousesetlimts - * - * Revision 1.1 1993/07/10 13:10:40 matt - * Initial revision - * - * - */ - -#ifndef MOUSE_H -#define MOUSE_H - -#include "pstypes.h" -#include "fix.h" - -#define MOUSE_MAX_BUTTONS 3 - -#define MB_LEFT 0 -#define MB_RIGHT 1 -#define MB_MIDDLE 2 -#define MB_Z_UP 3 -#define MB_Z_DOWN 4 -#define MB_PITCH_BACKWARD 5 -#define MB_PITCH_FORWARD 6 -#define MB_BANK_LEFT 7 -#define MB_BANK_RIGHT 8 -#define MB_HEAD_LEFT 9 -#define MB_HEAD_RIGHT 10 - -#define MOUSE_LBTN 1 -#define MOUSE_RBTN 2 -#define MOUSE_MBTN 4 - -#undef NOMOUSE -#ifndef NOMOUSE - -//======================================================================== -// Check for mouse driver, reset driver if installed. returns number of -// buttons if driver is present. - -extern int mouse_set_limits( int x1, int y1, int x2, int y2 ); -extern void mouse_flush(); // clears all mice events... - -//======================================================================== -extern void mouse_get_pos( int *x, int *y); -extern void mouse_get_delta( int *dx, int *dy ); -extern int mouse_get_btns(); -extern void mouse_set_pos( int x, int y); -extern void mouse_get_cyberman_pos( int *x, int *y ); - -// Returns how long this button has been down since last call. -extern fix mouse_button_down_time(int button); - -// Returns how many times this button has went down since last call. -extern int mouse_button_down_count(int button); - -// Returns 1 if this button is currently down -extern int mouse_button_state(int button); - -#else -// 'Neutered' functions... :-) -#define mouse_init(a) -1 -#define mouse_set_limits(a,b,c,d) -1 -#define mouse_flush() -#define mouse_close() -#define mouse_get_pos(a,b) -#define mouse_get_delta(a,b) -#define mouse_get_btns() 0 -#define mouse_set_pos(a,b) -#define mouse_get_cyberman_pos(a,b) -#define mouse_button_down_time(a) 0 -#define mouse_button_down_count(a) 0 -#define mouse_button_state(a) 0 - -#endif - -#endif - diff --git a/input/ggi/init.c b/input/ggi/init.c deleted file mode 100644 index 80ccebc5..00000000 --- a/input/ggi/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include -#include "text.h" -#include "event.h" -#include "error.h" -#include "args.h" - -void arch_ggi_init() -{ -} diff --git a/input/ggi/key.c b/input/ggi/key.c deleted file mode 100644 index 8d4cb074..00000000 --- a/input/ggi/key.c +++ /dev/null @@ -1,495 +0,0 @@ -#include -#include -#include - -#include - -#include "event.h" -#include "error.h" -#include "key.h" -#include "timer.h" -#include "mono.h" - -//added on 9/3/98 by Matt Mueller to free some cpu instead of hogging during menus and such -#include "d_delay.h" -//end this section addition - Matt Mueller - -#define KEY_BUFFER_SIZE 16 - -static unsigned char Installed = 0; - -//-------- Variable accessed by outside functions --------- -unsigned char keyd_buffer_type; // 0=No buffer, 1=buffer ASCII, 2=buffer scans -unsigned char keyd_repeat; -unsigned char keyd_editor_mode; -volatile unsigned char keyd_last_pressed; -volatile unsigned char keyd_last_released; -volatile unsigned char keyd_pressed[256]; -volatile int keyd_time_when_last_pressed; - -typedef struct Key_info { - ubyte state; // state of key 1 == down, 0 == up - ubyte last_state; // previous state of key - int counter; // incremented each time key is down in handler - fix timewentdown; // simple counter incremented each time in interrupt and key is down - fix timehelddown; // counter to tell how long key is down -- gets reset to 0 by key routines - ubyte downcount; // number of key counts key was down - ubyte upcount; // number of times key was released -} Key_info; - -typedef struct keyboard { - unsigned short keybuffer[KEY_BUFFER_SIZE]; - Key_info keys[256]; - fix time_pressed[KEY_BUFFER_SIZE]; - unsigned int keyhead, keytail; -} keyboard; - -static /*volatile*/ keyboard key_data; - -char * key_text[256] = { -"","ESC","1","2","3","4","5","6","7","8","9","0","-", -"=","BSPC","TAB","Q","W","E","R","T","Y","U","I","O", -"P","[","]","ƒ","LCTRL","A","S","D","F", -"G","H","J","K","L",";","'","`", -"LSHFT","\\","Z","X","C","V","B","N","M",",", -".","/","RSHFT","PAD*","LALT","SPC", -"CPSLK","F1","F2","F3","F4","F5","F6","F7","F8","F9", -"F10","NMLCK","SCLK","PAD7","PAD8","PAD9","PAD-", -"PAD4","PAD5","PAD6","PAD+","PAD1","PAD2","PAD3","PAD0", -"PAD.","","","","F11","F12","","","","","","","","","", -"","","","","","","","","","","","","","","","","","","","", -"","","","","","","","","","","","","","","","","","","","", -"","","","","","","","","","","","","","","","","","", -"PADƒ","RCTRL","","","","","","","","","","","","","", -"","","","","","","","","","","PAD/","","","RALT","", -"","","","","","","","","","","","","","HOME","‚","PGUP", -"","","","","","END","€","PGDN","INS", -"DEL","","","","","","","","","","","","","","","","","", -"","","","","","","","","","","","","","","","","","","","", -"","","","","","","" }; - -unsigned char ascii_table[128] = -{ 255, 255, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',255,255, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 255, 255, - 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', 39, '`', - 255, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 255,'*', - 255, ' ', 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,255,255, - 255, 255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255 }; - -unsigned char shifted_ascii_table[128] = -{ 255, 255, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+',255,255, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 255, 255, - 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', - 255, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 255,255, - 255, ' ', 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,255,255, - 255, 255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255 }; - -int giiKeyTranslate (int keylabel) { - switch (keylabel) - { - case GIIUC_0: return KEY_0; - case GIIUC_1: return KEY_1; - case GIIUC_2: return KEY_2; - case GIIUC_3: return KEY_3; - case GIIUC_4: return KEY_4; - case GIIUC_5: return KEY_5; - case GIIUC_6: return KEY_6; - case GIIUC_7: return KEY_7; - case GIIUC_8: return KEY_8; - case GIIUC_9: return KEY_9; - - case GIIUC_A: return KEY_A; - case GIIUC_B: return KEY_B; - case GIIUC_C: return KEY_C; - case GIIUC_D: return KEY_D; - case GIIUC_E: return KEY_E; - case GIIUC_F: return KEY_F; - case GIIUC_G: return KEY_G; - case GIIUC_H: return KEY_H; - case GIIUC_I: return KEY_I; - case GIIUC_J: return KEY_J; - case GIIUC_K: return KEY_K; - case GIIUC_L: return KEY_L; - case GIIUC_M: return KEY_M; - case GIIUC_N: return KEY_N; - case GIIUC_O: return KEY_O; - case GIIUC_P: return KEY_P; - case GIIUC_Q: return KEY_Q; - case GIIUC_R: return KEY_R; - case GIIUC_S: return KEY_S; - case GIIUC_T: return KEY_T; - case GIIUC_U: return KEY_U; - case GIIUC_V: return KEY_V; - case GIIUC_W: return KEY_W; - case GIIUC_X: return KEY_X; - case GIIUC_Y: return KEY_Y; - case GIIUC_Z: return KEY_Z; - - case GIIUC_Minus: return KEY_MINUS; - case GIIUC_Equal: return KEY_EQUAL; - case GIIUC_Slash: return KEY_DIVIDE; - case GIIUC_BackSlash: return KEY_SLASH; - case GIIUC_Comma: return KEY_COMMA; - case GIIUC_Period: return KEY_PERIOD; - case GIIUC_Semicolon: return KEY_SEMICOL; - - case GIIUC_BracketLeft: return KEY_LBRACKET; - case GIIUC_BracketRight: return KEY_RBRACKET; - - case GIIUC_Apostrophe: return KEY_RAPOSTRO; - case GIIUC_Grave: return KEY_LAPOSTRO; - - case GIIUC_Escape: return KEY_ESC; - case GIIK_Enter: return KEY_ENTER; - case GIIUC_BackSpace: return KEY_BACKSP; - case GIIUC_Tab: return KEY_TAB; - case GIIUC_Space: return KEY_SPACEBAR; - - case GIIK_NumLock: return KEY_NUMLOCK; - case GIIK_ScrollLock: return KEY_SCROLLOCK; - case GIIK_CapsLock: return KEY_CAPSLOCK; - - case GIIK_ShiftL: return KEY_LSHIFT; - case GIIK_ShiftR: return KEY_RSHIFT; - - case GIIK_AltL: return KEY_LALT; - case GIIK_AltR: return KEY_RALT; - - case GIIK_CtrlL: return KEY_LCTRL; - case GIIK_CtrlR: return KEY_RCTRL; - - case GIIK_F1: return KEY_F1; - case GIIK_F2: return KEY_F2; - case GIIK_F3: return KEY_F3; - case GIIK_F4: return KEY_F4; - case GIIK_F5: return KEY_F5; - case GIIK_F6: return KEY_F6; - case GIIK_F7: return KEY_F7; - case GIIK_F8: return KEY_F8; - case GIIK_F9: return KEY_F9; - case GIIK_F10: return KEY_F10; - case GIIK_F11: return KEY_F11; - case GIIK_F12: return KEY_F12; - - case GIIK_P0: return KEY_PAD0; - case GIIK_P1: return KEY_PAD1; - case GIIK_P2: return KEY_PAD2; - case GIIK_P3: return KEY_PAD3; - case GIIK_P4: return KEY_PAD4; - case GIIK_P5: return KEY_PAD5; - case GIIK_P6: return KEY_PAD6; - case GIIK_P7: return KEY_PAD7; - case GIIK_P8: return KEY_PAD8; - case GIIK_P9: return KEY_PAD9; - case GIIK_PMinus: return KEY_PADMINUS; - case GIIK_PPlus: return KEY_PADPLUS; - case GIIK_PDecimal: return KEY_PADPERIOD; - case GIIK_PSlash: return KEY_PADDIVIDE; - case GIIK_PAsterisk: return KEY_PADMULTIPLY; - case GIIK_PEnter: return KEY_PADENTER; - - case GIIK_Insert: return KEY_INSERT; - case GIIK_Home: return KEY_HOME; - case GIIK_PageUp: return KEY_PAGEUP; - case GIIK_Delete: return KEY_DELETE; - case GIIK_End: return KEY_END; - case GIIK_PageDown: return KEY_PAGEDOWN; - case GIIK_Up: return KEY_UP; - case GIIK_Down: return KEY_DOWN; - case GIIK_Left: return KEY_LEFT; - case GIIK_Right: return KEY_RIGHT; - - case GIIK_PrintScreen: return KEY_PRINT_SCREEN; - case GIIK_Pause: return KEY_PAUSE; - } - return 0; -} - -//killed on 10/03/98 by Matt Mueller -//unsigned char key_to_ascii(int a) -//{ -// if (!isprint(a)) return 255; -// if (a & KEY_SHIFTED) { -// return (toupper((unsigned char) a)); -// } else { -// return ((unsigned char) a); -// } -//} -//end kill -MM - -//added on 10/03/98 by Matt Mueller to fix shifted keys (copied from dos/key.c) -unsigned char key_to_ascii(int keycode) -{ - int shifted; - - shifted = keycode & KEY_SHIFTED; - keycode &= 0xFF; - - if ( keycode>=127 ) - return 255; - - if (shifted) - return shifted_ascii_table[keycode]; - else - return ascii_table[keycode]; -} -//end addition -MM - -void keyboard_handler(int button, ubyte state) -{ - ubyte key_state; - int i, keycode; - unsigned short event_key; - Key_info *key; - unsigned char temp; - - key_state = state; - event_key = giiKeyTranslate(button); - //mprintf((0,"keyboard_handler(%i,%i):%i\n",button,state,event_key)); - - //===================================================== - //Here a translation from win keycodes to mac keycodes! - //===================================================== - - for (i = 255; i >= 0; i--) { - - keycode = i; - key = &(key_data.keys[keycode]); - if (i == event_key) - state = key_state; - else - state = key->last_state; - - if ( key->last_state == state ) { - if (state) { - key->counter++; - keyd_last_pressed = keycode; - keyd_time_when_last_pressed = timer_get_fixed_seconds(); - } - } else { - if (state) { - keyd_last_pressed = keycode; - keyd_pressed[keycode] = 1; - key->downcount += state; - key->state = 1; - key->timewentdown = keyd_time_when_last_pressed = timer_get_fixed_seconds(); - key->counter++; - } else { - keyd_pressed[keycode] = 0; - keyd_last_released = keycode; - key->upcount += key->state; - key->state = 0; - key->counter = 0; - key->timehelddown += timer_get_fixed_seconds() - key->timewentdown; - } - } - if ( (state && !key->last_state) || (state && key->last_state && (key->counter > 30) && (key->counter & 0x01)) ) { - if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT]) - keycode |= KEY_SHIFTED; - if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT]) - keycode |= KEY_ALTED; - if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL]) - keycode |= KEY_CTRLED; - if ( keyd_pressed[KEY_DELETE] ) - keycode |= KEY_DEBUGGED; - temp = key_data.keytail+1; - if ( temp >= KEY_BUFFER_SIZE ) temp=0; - if (temp!=key_data.keyhead) { - key_data.keybuffer[key_data.keytail] = keycode; - key_data.time_pressed[key_data.keytail] = keyd_time_when_last_pressed; - key_data.keytail = temp; - } - } - key->last_state = state; - } -} - -void key_close() -{ - Installed = 0; -} - -void key_init() -{ - Installed=1; - - keyd_time_when_last_pressed = timer_get_fixed_seconds(); - keyd_buffer_type = 1; - keyd_repeat = 1; - -// Clear the keyboard array - key_flush(); - atexit(key_close); -} - -void key_flush() -{ - int i; - fix curtime; - - if (!Installed) - key_init(); - - key_data.keyhead = key_data.keytail = 0; - - //Clear the keyboard buffer - for (i=0; i= KEY_BUFFER_SIZE ) n=0; - return n; -} - -int key_checkch() -{ - int is_one_waiting = 0; - event_poll(); - if (key_data.keytail!=key_data.keyhead) - is_one_waiting = 1; - return is_one_waiting; -} - -int key_inkey() -{ - int key = 0; - if (!Installed) - key_init(); - event_poll(); - if (key_data.keytail!=key_data.keyhead) { - key = key_data.keybuffer[key_data.keyhead]; - key_data.keyhead = add_one(key_data.keyhead); - } -//added 9/3/98 by Matt Mueller to free cpu time instead of hogging during menus and such -// else d_delay(1); -//end addition - Matt Mueller - return key; -} - -int key_inkey_time(fix * time) -{ - int key = 0; - - if (!Installed) - key_init(); - event_poll(); - if (key_data.keytail!=key_data.keyhead) { - key = key_data.keybuffer[key_data.keyhead]; - *time = key_data.time_pressed[key_data.keyhead]; - key_data.keyhead = add_one(key_data.keyhead); - } - return key; -} - -int key_peekkey() -{ - int key = 0; - event_poll(); - if (key_data.keytail!=key_data.keyhead) - key = key_data.keybuffer[key_data.keyhead]; - - return key; -} - -int key_getch() -{ - int dummy=0; - - if (!Installed) - return 0; -// return getch(); - - while (!key_checkch()) - dummy++; - return key_inkey(); -} - -unsigned int key_get_shift_status() -{ - unsigned int shift_status = 0; - - if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT] ) - shift_status |= KEY_SHIFTED; - - if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT] ) - shift_status |= KEY_ALTED; - - if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL] ) - shift_status |= KEY_CTRLED; - -#ifndef NDEBUG - if (keyd_pressed[KEY_DELETE]) - shift_status |=KEY_DEBUGGED; -#endif - - return shift_status; -} - -// Returns the number of seconds this key has been down since last call. -fix key_down_time(int scancode) -{ - fix time_down, time; - - event_poll(); - if ((scancode<0)|| (scancode>255)) return 0; - - if (!keyd_pressed[scancode]) { - time_down = key_data.keys[scancode].timehelddown; - key_data.keys[scancode].timehelddown = 0; - } else { - time = timer_get_fixed_seconds(); - time_down = time - key_data.keys[scancode].timewentdown; - key_data.keys[scancode].timewentdown = time; - } - - return time_down; -} - -unsigned int key_down_count(int scancode) -{ - int n; - event_poll(); - if ((scancode<0)|| (scancode>255)) return 0; - - n = key_data.keys[scancode].downcount; - key_data.keys[scancode].downcount = 0; - - return n; -} - -unsigned int key_up_count(int scancode) -{ - int n; - event_poll(); - if ((scancode<0)|| (scancode>255)) return 0; - - n = key_data.keys[scancode].upcount; - key_data.keys[scancode].upcount = 0; - - return n; -} - diff --git a/input/ggi/mouse.c b/input/ggi/mouse.c deleted file mode 100644 index 7bf97316..00000000 --- a/input/ggi/mouse.c +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include -#include -#include "fix.h" -#include "timer.h" -#include "event.h" -#include "mouse.h" - -struct mousebutton { - ubyte pressed; - fix time_went_down; - fix time_held_down; - uint num_downs; - uint num_ups; -}; - -#define MOUSE_MAX_BUTTONS 3 - -static struct mouseinfo { - struct mousebutton buttons[MOUSE_MAX_BUTTONS]; -//added on 10/17/98 by Hans de Goede for mouse functionality - int min_x, min_y; - int max_x, max_y; - int delta_x, delta_y; - int x,y; -} Mouse; - -void mouse_correct() -{ - if (Mouse.x < Mouse.min_x) - Mouse.x = Mouse.min_x; - else if (Mouse.x > Mouse.max_x) - Mouse.x = Mouse.max_x; - if (Mouse.y < Mouse.min_y) - Mouse.y = Mouse.min_y; - else if (Mouse.y > Mouse.max_y) - Mouse.y = Mouse.max_y; -} - -void mouse_handler_absolute(int x, int y) -{ - Mouse.delta_x += (x - Mouse.x); - Mouse.delta_y += (y - Mouse.y); - Mouse.x = x; - Mouse.y = y; -// mouse_correct(); -} - -void mouse_handler_relative(int x, int y) -{ - Mouse.delta_x += x; - Mouse.delta_y += y; - Mouse.x += x; - Mouse.y += y; -// mouse_correct(); -} - -void mouse_handler_button(int button, ubyte state) -{ - if (!Mouse.buttons[button].pressed && state) - { - Mouse.buttons[button].time_went_down = timer_get_fixed_seconds(); - Mouse.buttons[button].num_downs++; - } - else if (Mouse.buttons[button].pressed && !state) - { - Mouse.buttons[button].num_ups++; - } - - Mouse.buttons[button].pressed = state; -} - -void Mouse_close(void) -{ -} - -void Mouse_init(void) -{ - memset(&Mouse, 0, sizeof(Mouse)); -} - -int mouse_set_limits( int x1, int y1, int x2, int y2 ) -{ - Mouse.min_x = x1; - Mouse.max_x = x2; - Mouse.min_y = y1; - Mouse.max_y = y2; - return MOUSE_MAX_BUTTONS; -} - -void mouse_flush() // clears all mice events... -{ - Mouse.x = 0; - Mouse.y = 0; - Mouse.delta_x = 0; - Mouse.delta_y = 0; -} - -//======================================================================== -void mouse_get_pos( int *x, int *y) -{ - event_poll(); - *x = Mouse.x; - *y = Mouse.y; -} - -void mouse_get_delta( int *dx, int *dy ) -{ - event_poll(); - *dx = Mouse.delta_x; - *dy = Mouse.delta_y; - Mouse.delta_x = 0; - Mouse.delta_y = 0; -} - -int mouse_get_btns() -{ - ubyte buttons = 0; - int i; - event_poll(); - for (i = 0; i < MOUSE_MAX_BUTTONS; i++) - buttons |= (Mouse.buttons[i].pressed << i); - return buttons; -} - -void mouse_set_pos( int x, int y) -{ - Mouse.x = x; - Mouse.y = y; -} - -void mouse_get_cyberman_pos( int *x, int *y ) -{ -} - -// Returns how long this button has been down since last call. -fix mouse_button_down_time(int button) -{ - if (Mouse.buttons[button].pressed) - return (timer_get_fixed_seconds() - Mouse.buttons[button].time_went_down); - else - return 0; -} - -// Returns how many times this button has went down since last call -int mouse_button_down_count(int button) -{ - int count = Mouse.buttons[button].num_downs; - Mouse.buttons[button].num_downs = 0; - return count; -} - -// Returns 1 if this button is currently down -int mouse_button_state(int button) -{ - return Mouse.buttons[button].pressed; -} diff --git a/input/linux/include/joy.h b/input/linux/include/joy.h deleted file mode 100644 index b4d731a7..00000000 --- a/input/linux/include/joy.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ - -#ifndef _JOY_H -#define _JOY_H - -#include "pstypes.h" -#include "fix.h" - -#define JOY_1_BUTTON_A 1 -#define JOY_1_BUTTON_B 2 -#define JOY_2_BUTTON_A 4 -#define JOY_2_BUTTON_B 8 -#define JOY_ALL_BUTTONS (1+2+4+8) - -#define JOY_1_X_AXIS 1 -#define JOY_1_Y_AXIS 2 -#define JOY_2_X_AXIS 4 -#define JOY_2_Y_AXIS 8 -#define JOY_ALL_AXIS (1+2+4+8) - -#define JOY_SLOW_READINGS 1 -#define JOY_POLLED_READINGS 2 -#define JOY_BIOS_READINGS 4 -#define JOY_FRIENDLY_READINGS 8 - -#define MAX_AXES 32 -#define MAX_BUTTONS 64 - -#define JOY_NUM_AXES 5 - -typedef struct joystick_device { - int device_number; - int version; - int buffer; - char num_buttons; - char num_axes; -} joystick_device; - -typedef struct joystick_axis { - int value; - int min_val; - int center_val; - int max_val; - int joydev; -} joystick_axis; - -typedef struct joystick_button { - ubyte state; - ubyte last_state; -//changed 6/24/1999 to finally squish the timedown bug - Owen Evans - fix timedown; -//end changed - OE - ubyte downcount; - int num; - int joydev; -} joystick_button; - -//========================================================================== -// This initializes the joy and does a "quick" calibration which -// assumes the stick is centered and sets the minimum value to 0 and -// the maximum value to 2 times the centered reading. Returns 0 if no -// joystick was detected, 1 if everything is ok. -// joy_init() is called. - -extern int joy_init(); -extern void joy_close(); - -extern char joy_installed; -extern char joy_present; - -extern int j_num_axes; -extern int j_num_buttons; - -extern int joy_deadzone; - -extern joystick_device j_joystick[4]; -extern joystick_axis j_axis[MAX_AXES]; -extern joystick_button j_button[MAX_BUTTONS]; - -//========================================================================== -// The following 3 routines can be used to zero in on better joy -// calibration factors. To use them, ask the user to hold the stick -// in either the upper left, lower right, or center and then have them -// press a key or button and then call the appropriate one of these -// routines, and it will read the stick and update the calibration factors. -// Usually, assuming that the stick was centered when joy_init was -// called, you really only need to call joy_set_lr, since the upper -// left position is usually always 0,0 on most joys. But, the safest -// bet is to do all three, or let the user choose which ones to set. - -extern void joy_set_cen(); - -//========================================================================== -// This reads the joystick. X and Y will be between -128 and 127. -// Takes about 1 millisecond in the worst case when the stick -// is in the lower right hand corner. Always returns 0,0 if no stick -// is present. - -extern void joy_get_pos( int *x, int *y ); - -//========================================================================== -// This just reads the buttons and returns their status. When bit 0 -// is 1, button 1 is pressed, when bit 1 is 1, button 2 is pressed. -extern int joy_get_btns(); - -//========================================================================== -// This returns the number of times a button went either down or up since -// the last call to this function. -extern int joy_get_button_up_cnt( int btn ); -extern int joy_get_button_down_cnt( int btn ); - -//========================================================================== -// This returns how long (in approximate milliseconds) that each of the -// buttons has been held down since the last call to this function. -// It is the total time... say you pressed it down for 3 ticks, released -// it, and held it down for 6 more ticks. The time returned would be 9. -extern fix joy_get_button_down_time( int btn ); - -extern int j_Update_state (); -extern int j_Get_joydev_axis_number (int all_axis_number); -extern int j_Get_joydev_button_number (int all_button_number); - -extern ubyte joystick_read_raw_axis( ubyte mask, int * axis ); -extern void joy_flush(); -extern ubyte joy_get_present_mask(); -extern void joy_set_timer_rate(int max_value ); -extern int joy_get_timer_rate(); - -extern int joy_get_button_state( int btn ); -extern void joy_get_cal_vals(int *axis_min, int *axis_center, int *axis_max); -extern void joy_set_cal_vals(int *axis_min, int *axis_center, int *axis_max); -extern void joy_set_btn_values( int btn, int state, fix timedown, int downcount, int upcount ); -extern int joy_get_scaled_reading( int raw, int axn ); -extern void joy_set_slow_reading( int flag ); - -extern void joy_set_min (int axis_number, int value); -extern void joy_set_center (int axis_number, int value); -extern void joy_set_max (int axis_number, int value); - -#endif diff --git a/input/linux/include/joystick.h b/input/linux/include/joystick.h deleted file mode 100644 index e201d454..00000000 --- a/input/linux/include/joystick.h +++ /dev/null @@ -1,266 +0,0 @@ -#ifndef _LINUX_JOYSTICK_H -#define _LINUX_JOYSTICK_H - -/* - * /usr/include/linux/joystick.h Version 1.2 - * - * Copyright (C) 1996-1998 Vojtech Pavlik - */ - -#include -#include - -/* - * Version - */ - -#define JS_VERSION 0x01020a - -/* - * Types and constants for reading from /dev/js - */ - -#define JS_EVENT_BUTTON 0x01 /* button pressed/released */ -#define JS_EVENT_AXIS 0x02 /* joystick moved */ -#define JS_EVENT_INIT 0x80 /* initial state of device */ - -struct js_event { - __u32 time; /* event timestamp in miliseconds */ - __s16 value; /* value */ - __u8 type; /* event type */ - __u8 number; /* axis/button number */ -}; - -/* - * IOCTL commands for joystick driver - */ - -#define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */ - -#define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */ -#define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */ -#define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */ - -#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ -#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ - -/* - * Types and constants for get/set correction - */ - -#define JS_CORR_NONE 0x00 /* returns raw values */ -#define JS_CORR_BROKEN 0x01 /* broken line */ - -struct js_corr { - __s32 coef[8]; - __s16 prec; - __u16 type; -}; - -/* - * v0.x compatibility definitions - */ - -#define JS_RETURN sizeof(struct JS_DATA_TYPE) -#define JS_TRUE 1 -#define JS_FALSE 0 -#define JS_X_0 0x01 -#define JS_Y_0 0x02 -#define JS_X_1 0x04 -#define JS_Y_1 0x08 -#define JS_MAX 2 - -#define JS_DEF_TIMEOUT 0x1300 -#define JS_DEF_CORR 0 -#define JS_DEF_TIMELIMIT 10L - -#define JS_SET_CAL 1 -#define JS_GET_CAL 2 -#define JS_SET_TIMEOUT 3 -#define JS_GET_TIMEOUT 4 -#define JS_SET_TIMELIMIT 5 -#define JS_GET_TIMELIMIT 6 -#define JS_GET_ALL 7 -#define JS_SET_ALL 8 - -struct JS_DATA_TYPE { - int buttons; - int x; - int y; -}; - -struct JS_DATA_SAVE_TYPE { - int JS_TIMEOUT; - int BUSY; - long JS_EXPIRETIME; - long JS_TIMELIMIT; - struct JS_DATA_TYPE JS_SAVE; - struct JS_DATA_TYPE JS_CORR; -}; - -/* - * Internal definitions - */ - -#ifdef __KERNEL__ - -#define JS_BUFF_SIZE 64 /* output buffer size */ - -#include - -#ifndef KERNEL_VERSION -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#endif - -#ifndef LINUX_VERSION_CODE -#error "You need to use at least 2.0 Linux kernel." -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,0,0) -#error "You need to use at least 2.0 Linux kernel." -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) -#define JS_HAS_RDTSC (current_cpu_data.x86_capability & 0x10) -#include -#else -#ifdef MODULE -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,35) -#define JS_HAS_RDTSC (x86_capability & 0x10) -#else -#define JS_HAS_RDTSC 0 -#endif -#else -#define JS_HAS_RDTSC (x86_capability & 0x10) -#endif -#define __initdata -#define __init -#define MODULE_AUTHOR(x) -#define MODULE_PARM(x,y) -#define MODULE_SUPPORTED_DEVICE(x) -#define signal_pending(x) (((x)->signal) & ~((x)->blocked)) -#endif - -/* - * Parport stuff - */ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) -#define USE_PARPORT -#endif - -#ifdef USE_PARPORT -#include -#define JS_PAR_STATUS(y) parport_read_status(y->port) -#define JS_PAR_DATA_IN(y) parport_read_data(y->port) -#define JS_PAR_DATA_OUT(x,y) parport_write_data(y->port, x) -#define JS_PAR_CTRL_OUT(x,y) parport_write_control(y->port, x) -#else -#define JS_PAR_STATUS(y) inb(y+1) -#define JS_PAR_DATA_IN(y) inb(y) -#define JS_PAR_DATA_OUT(x,y) outb(x,y) -#define JS_PAR_CTRL_OUT(x,y) outb(x,y+2) -#endif - -#define JS_PAR_STATUS_INVERT (0x80) - -/* - * Internal types - */ - -struct js_dev; - -typedef int (*js_read_func)(void *info, int **axes, int **buttons); -typedef unsigned int (*js_time_func)(void); -typedef int (*js_delta_func)(unsigned int x, unsigned int y); -typedef int (*js_ops_func)(struct js_dev *dev); - -struct js_data { - int *axes; - int *buttons; -}; - -struct js_dev { - struct js_dev *next; - struct js_list *list; - struct js_port *port; - struct wait_queue *wait; - struct js_data cur; - struct js_data new; - struct js_corr *corr; - struct js_event buff[JS_BUFF_SIZE]; - js_ops_func open; - js_ops_func close; - int ahead; - int bhead; - int tail; - int num_axes; - int num_buttons; - char *name; -}; - -struct js_list { - struct js_list *next; - struct js_dev *dev; - int tail; - int startup; -}; - -struct js_port { - struct js_port *next; - struct js_port *prev; - js_read_func read; - struct js_dev **devs; - int **axes; - int **buttons; - struct js_corr **corr; - void *info; - int ndevs; -}; - -/* - * Sub-module interface - */ - -extern unsigned int js_time_speed; -extern js_time_func js_get_time; -extern js_delta_func js_delta; - -extern unsigned int js_time_speed_a; -extern js_time_func js_get_time_a; -extern js_delta_func js_delta_a; - -extern struct js_port *js_register_port(struct js_port *port, void *info, - int devs, int infos, js_read_func read); -extern struct js_port *js_unregister_port(struct js_port *port); - -extern int js_register_device(struct js_port *port, int number, int axes, - int buttons, char *name, js_ops_func open, js_ops_func close); -extern void js_unregister_device(struct js_dev *dev); - -/* - * Kernel interface - */ - -extern int js_init(void); -extern int js_am_init(void); -extern int js_an_init(void); -extern int js_as_init(void); -extern int js_console_init(void); -extern int js_db9_init(void); -extern int js_gr_init(void); -extern int js_l4_init(void); -extern int js_lt_init(void); -extern int js_sw_init(void); -extern int js_tm_init(void); - -extern void js_am_setup(char *str, int *ints); -extern void js_an_setup(char *str, int *ints); -extern void js_as_setup(char *str, int *ints); -extern void js_console_setup(char *str, int *ints); -extern void js_db9_setup(char *str, int *ints); -extern void js_l4_setup(char *str, int *ints); - -#endif /* __KERNEL__ */ - -#endif /* _LINUX_JOYSTICK_H */ diff --git a/input/linux/joydefs.c b/input/linux/joydefs.c deleted file mode 100644 index 8e072e0d..00000000 --- a/input/linux/joydefs.c +++ /dev/null @@ -1,237 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ - -#include -#include -#include -#include - -#include "pstypes.h" -#include "mono.h" -#include "key.h" -#include "joy.h" -#include "timer.h" -#include "error.h" - -#include "inferno.h" -#include "game.h" -#include "object.h" -#include "player.h" - -#include "controls.h" -#include "joydefs.h" -//#include "victor.h" -#include "render.h" -#include "palette.h" -#include "newmenu.h" -#include "args.h" -#include "text.h" -#include "kconfig.h" -#include "digi.h" -#include "playsave.h" - -int joydefs_calibrate_flag = 0; - -//added 9/6/98 Matt Mueller - not needed at all in linux code but bunches -int Joy_is_Sidewinder=0;// of main/* stuff uses it -//end addition - -void joy_delay() -{ - //int t1 = TICKER + 19/4; // Wait 1/4 second... - //stop_time(); - //while( TICKER < t1 ); - //joy_flush(); - //start_time(); -} - - -int joycal_message( char * title, char * text ) -{ - int i; - newmenu_item m[2]; - m[0].type = NM_TYPE_TEXT; m[0].text = text; - m[1].type = NM_TYPE_MENU; m[1].text = TXT_OK; - i = newmenu_do( title, NULL, 2, m, NULL ); - if ( i < 0 ) - return 1; - return 0; -} - -extern int WriteConfigFile(); - -extern joystick_device j_joystick[4]; -extern joystick_axis j_axis[MAX_AXES]; -extern joystick_button j_button[MAX_BUTTONS]; - -void joydefs_calibrate() -{ - - int i; - int temp_values[MAX_AXES]; - char title[50]; - char text[256]; -//added/killed on 10/17/98 by Hans de Goede for joystick/mouse # fix -//-killed- int nsticks = 0; -//end this section kill - Hans - - joydefs_calibrate_flag = 0; - - if (!joy_present) { - nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK ); - return; - } - - if (j_joystick[0].version) { - joycal_message ("No Calibration", "calibration not required for\njoystick v1.x"); - return; - } - - for (i = 0; i < j_num_axes; i += 2) { - sprintf (title, "js%d Calibration", j_axis[i].joydev); - - sprintf (text, "center joystick %d", j_axis[i].joydev); - joycal_message (title, text); - joystick_read_raw_axis (JOY_ALL_AXIS, temp_values); - j_axis[i].center_val = temp_values[i]; - j_axis[i + 1].center_val = temp_values[i + 1]; - - sprintf (text, "move joystick %d to the upper left", j_axis[i].joydev); - joycal_message (title, text); - joystick_read_raw_axis (JOY_ALL_AXIS, temp_values); - j_axis[i].min_val = temp_values[i]; - j_axis[i + 1].min_val = temp_values[i + 1]; - - sprintf (text, "move joystick %d to the lower right", j_axis[i].joydev); - joycal_message (title, text); - joystick_read_raw_axis (JOY_ALL_AXIS, temp_values); - j_axis[i].max_val = temp_values[i]; - j_axis[i + 1].max_val = temp_values[i + 1]; - - } - - WriteConfigFile (); -} - - -//char *control_text[CONTROL_MAX_TYPES] = { "Keyboard only", "Joystick", "Flightstick Pro", "Thrustmaster FCS", "Gravis Gamepad", "Mouse", "Cyberman" }; - -void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem ) -{ - int i; - int oc_type = Config_control_type; - - nitems = nitems; - last_key = last_key; - citem = citem; - - for (i=0; i<3; i++ ) - if (items[i].value) Config_control_type = i; - -//added on 10/17/98 by Hans de Goede for joystick/mouse # fix - // remap mouse, since "Flightstick Pro", "Thrustmaster FCS" - // and "Gravis Gamepad" where removed from the options - if (Config_control_type == 2) Config_control_type = CONTROL_MOUSE; -//end this section addition - Hans - - if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) { - nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS ); - } - - if (oc_type != Config_control_type) { - switch (Config_control_type) { - // case CONTROL_NONE: - case CONTROL_JOYSTICK: - case CONTROL_FLIGHTSTICK_PRO: - case CONTROL_THRUSTMASTER_FCS: - case CONTROL_GRAVIS_GAMEPAD: - // case CONTROL_MOUSE: - // case CONTROL_CYBERMAN: - joydefs_calibrate_flag = 1; - } - kc_set_controls(); - } - -} - -extern ubyte kc_use_external_control; -extern ubyte kc_enable_external_control; -extern ubyte *kc_external_name; - -void joydefs_config() -{ -//added/changed/killed on 10/17/98 by Hans de Goede for joystick/mouse # fix -//-killed- char xtext[128]; -//-killed- int i, old_masks, masks; - newmenu_item m[13]; -//-killed- int i1=5; -//-killed- int nitems; -//-killed- -//-killed- do { -//-killed- nitems = 6; - int i, i1=5, j, nitems=7; -//end this section kill/change - Hans - - m[0].type = NM_TYPE_RADIO; m[0].text = "KEYBOARD"; m[0].value = 0; m[0].group = 0; - m[1].type = NM_TYPE_RADIO; m[1].text = "JOYSTICK"; m[1].value = 0; m[1].group = 0; - m[2].type = NM_TYPE_RADIO; m[2].text = "MOUSE"; m[2].value = 0; m[2].group = 0; - m[3].type = NM_TYPE_TEXT; m[3].text=""; - m[4].type = NM_TYPE_MENU; m[4].text="CUSTOMIZE ABOVE"; - m[5].type = NM_TYPE_MENU; m[5].text="CUSTOMIZE KEYBOARD"; -//added on 2/5/99 by Victor Rachels for D1X keys menu - m[6].type = NM_TYPE_MENU; m[6].text="CUSTOMIZE D1X KEYS"; -//end this section addition - VR - -//added/changed/killed on 10/17/98 by Hans de Goede for joystick/mouse # fix -//-killed- m[Config_control_type].value = 1; - - do { - - - i = Config_control_type; - if(i==CONTROL_MOUSE) i = 2; - m[i].value=1; -//end section - OE -//end this section change/addition - Hans - - i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 ); - -//added 6-15-99 Owen Evans - for (j = 0; j <= 2; j++) - if (m[j].value) - Config_control_type = j; - i = Config_control_type; - if (Config_control_type == 2) - Config_control_type = CONTROL_MOUSE; -//end added - OE - - switch(i1) { - case 4: -//added/changed on 10/17/98 by Hans de Goede for joystick/mouse # fix -//-killed- kconfig(Config_control_type, m[Config_control_type].text); - kconfig (i, m[i].text); -//end this section change - Hans - break; - case 5: - kconfig(0, "KEYBOARD"); - break; -//added on 2/5/99 by Victor Rachels for D1X keys menu - case 6: - kconfig(3, "D1X KEYS"); - break; -//end this section addition - VR - } - - } while(i1>-1); - -} diff --git a/input/linux/joystick.c b/input/linux/joystick.c deleted file mode 100644 index ab23e6af..00000000 --- a/input/linux/joystick.c +++ /dev/null @@ -1,377 +0,0 @@ -#include -#include -#include -#include "joystick.h" -#include -#include -#include - -#include "timer.h" -#include "pstypes.h" -#include "mono.h" -#include "joy.h" - -char joy_installed = 0; -char joy_present = 0; - -joystick_device j_joystick[4]; -joystick_axis j_axis[MAX_AXES]; -joystick_button j_button[MAX_BUTTONS]; - -int j_num_axes = 0, j_num_buttons = 0; -int timer_rate; - -int j_axes_in_sticks[4]; /* number of axes in the first [x] sticks */ -int j_buttons_in_sticks[4]; /* number of buttons in the first [x] sticks */ - -int joy_deadzone = 0; - -int j_Get_joydev_axis_number (int all_axis_number) { - int i, joy_axis_number = all_axis_number; - - for (i = 0; i < j_axis[all_axis_number].joydev; i++) { - joy_axis_number -= j_joystick[i].num_axes; - } - - return joy_axis_number; -} - - -int j_Get_joydev_button_number (int all_button_number) { - int i, joy_button_number = all_button_number; - - for (i = 0; i < j_button[all_button_number].joydev; i++) { - joy_button_number -= j_joystick[i].num_buttons; - } - - return joy_button_number; -} - - -int j_Update_state () { - int num_processed = 0, i; - struct js_event current_event; - struct JS_DATA_TYPE joy_data; - - for (i = 0; i < j_num_buttons; i++) { - //changed 6/24/1999 to finally squish the timedown bug - Owen Evans - if (j_button[i].state != j_button[i].last_state) { - if (j_button[i].state) { - j_button[i].downcount++; - j_button[i].timedown = timer_get_fixed_seconds(); - } - } - //end changed - OE - j_button[i].last_state = j_button[i].state; - } - - for (i = 0; i < 4; i++) { - if (j_joystick[i].buffer >= 0) { - if (j_joystick[i].version) { - while (read (j_joystick[i].buffer, ¤t_event, sizeof (struct js_event)) > 0) { - num_processed++; - switch (current_event.type & ~JS_EVENT_INIT) { - case JS_EVENT_AXIS: - j_axis[j_axes_in_sticks[i] + current_event.number].value = current_event.value; - break; - case JS_EVENT_BUTTON: - j_button[j_buttons_in_sticks[i] + current_event.number].state = current_event.value; - break; - } - } - } else { - read (j_joystick[i].buffer, &joy_data, JS_RETURN); - j_axis[j_axes_in_sticks[i] + 0].value = joy_data.x; - j_axis[j_axes_in_sticks[i] + 1].value = joy_data.y; - j_button[j_buttons_in_sticks[i] + 0].state = (joy_data.buttons & 0x01); - j_button[j_buttons_in_sticks[i] + 1].state = (joy_data.buttons & 0x02) >> 1; - } - } - } - - return num_processed; -} - - -void joy_set_cal_vals(int *axis_min, int *axis_center, int *axis_max) { - int i; - - for (i = 0; i < 4; i++) { - j_axis[i].center_val = axis_center[i]; - j_axis[i].min_val = axis_min[i]; - j_axis[i].max_val = axis_max[i]; - } -} - - -void joy_get_cal_vals(int *axis_min, int *axis_center, int *axis_max) { - int i; - - //edited 05/18/99 Matt Mueller - we should return all axes instead of j_num_axes, since they are all given to us in joy_set_cal_vals ( and because checker complains :) - for (i = 0; i < 4; i++) { - //end edit -MM - axis_center[i] = j_axis[i].center_val; - axis_min[i] = j_axis[i].min_val; - axis_max[i] = j_axis[i].max_val; - } -} - - -void joy_set_min (int axis_number, int value) { - j_axis[axis_number].min_val = value; -} - - -void joy_set_center (int axis_number, int value) { - j_axis[axis_number].center_val = value; -} - - -void joy_set_max (int axis_number, int value) { - j_axis[axis_number].max_val = value; -} - - -ubyte joy_get_present_mask () { - return 1; -} - - -void joy_set_timer_rate (int max_value) { - timer_rate = max_value; -} - - -int joy_get_timer_rate () { - return timer_rate; -} - - -void joy_flush () { - int i; - - if (!joy_installed) return; - - for (i = 0; i < j_num_buttons; i++) { - j_button[i].timedown = 0; - j_button[i].downcount = 0; - } - -} - - -ubyte joystick_read_raw_axis (ubyte mask, int *axes) { - int i; - - j_Update_state(); - - for (i = 0; i < j_num_axes; i++) { - axes[i] = j_axis[i].value; - } - - return 0; -} - - -/* joy_init () is pretty huge, a bit klunky, and by no means pretty. But who cares? It does the job and it's only run once. */ - - -int joy_init () { - int i, j; - - if (joy_installed) return 0; - joy_flush (); - - if (!joy_installed) { - - printf ("Initializing joystick... "); - - j_joystick[0].buffer = open ("/dev/js0", O_NONBLOCK); - j_joystick[1].buffer = open ("/dev/js1", O_NONBLOCK); - j_joystick[2].buffer = open ("/dev/js2", O_NONBLOCK); - j_joystick[3].buffer = open ("/dev/js3", O_NONBLOCK); - - if (j_joystick[0].buffer >= 0 || j_joystick[1].buffer >= 0 || j_joystick[2].buffer >= 0 || j_joystick[3].buffer >= 0) { - printf ("found: "); - - for (i = 0; i < 4; i++) { - if (j_joystick[i].buffer >= 0) { - ioctl (j_joystick[i].buffer, JSIOCGAXES, &j_joystick[i].num_axes); - ioctl (j_joystick[i].buffer, JSIOCGBUTTONS, &j_joystick[i].num_buttons); - ioctl (j_joystick[i].buffer, JSIOCGVERSION, &j_joystick[i].version); - if (!j_joystick[i].version) { - j_joystick[i].num_axes = 2; - j_joystick[i].num_buttons = 2; - printf ("js%d (v0.x) " , i); - } else { - printf ("js%d (v%d.%d.%d) ", - i, - (j_joystick[i].version & 0xff0000) >> 16, - (j_joystick[i].version & 0xff00) >> 8, - j_joystick[i].version & 0xff); - } - - for (j = j_num_axes; j < (j_num_axes + j_joystick[i].num_axes); j++) { - j_axis[j].joydev = i; - if (j_joystick[i].version) { - j_axis[j].center_val = 0; - j_axis[j].max_val = 32767; - j_axis[j].min_val = -32767; - } - } - for (j = j_num_buttons; j < (j_num_buttons + j_joystick[i].num_buttons); j++) { - j_button[j].joydev = i; - } - - j_num_axes += j_joystick[i].num_axes; - j_num_buttons += j_joystick[i].num_buttons; - - } else { - j_joystick[i].num_buttons = 0; - j_joystick[i].num_axes = 0; - } - - for (j = 0; j < i; j++) { - j_axes_in_sticks[i] += j_joystick[j].num_axes; - j_buttons_in_sticks[i] += j_joystick[j].num_buttons; - } - } - } else { - printf ("no joysticks found\n"); - return 0; - } - - printf ("\n"); - - if (j_num_axes > MAX_AXES) - j_num_axes = MAX_AXES; - if (j_num_buttons > MAX_BUTTONS) - j_num_buttons = MAX_BUTTONS; - - joy_present = 1; - joy_installed = 1; - return 1; - } - - return 1; -} - - -void joy_close() { - int i; - - if (!joy_installed) return; - - for (i = 0; i < 4; i++) { - if (j_joystick[i].buffer>=0) { - printf ("closing js%d\n", i); - close (j_joystick[i].buffer); - } - j_joystick[i].buffer=-1; - } - - joy_present=0; - joy_installed=0; -} - - -void joy_set_cen() { -} - - -int joy_get_scaled_reading(int raw, int axis_num) -{ - int d, x; - - raw -= j_axis[axis_num].center_val; - - if (raw < 0) - d = j_axis[axis_num].center_val - j_axis[axis_num].min_val; - else if (raw > 0) - d = j_axis[axis_num].max_val - j_axis[axis_num].center_val; - else - d = 0; - - if (d) - x = ((raw << 7) / d); - else - x = 0; - - if ( x < -128 ) - x = -128; - if ( x > 127 ) - x = 127; - -//added on 4/13/99 by Victor Rachels to add deadzone control - d = (joy_deadzone) * 6; - if ((x > (-1*d)) && (x < d)) - x = 0; -//end this section addition -VR - - return x; -} - - -void joy_get_pos(int *x, int *y) { - int axis[MAX_AXES]; - - if ((!joy_installed)||(!joy_present)) { *x=*y=0; return; } - - joystick_read_raw_axis (JOY_ALL_AXIS, axis); - - *x = joy_get_scaled_reading( axis[0], 0 ); - *y = joy_get_scaled_reading( axis[1], 1 ); -} - - -int joy_get_btns () { - return 0; -} - - -int joy_get_button_state (int btn) { - if(btn >= j_num_buttons) - return 0; - j_Update_state (); - - return j_button[btn].state; -} - - -int joy_get_button_down_cnt (int btn) { - int downcount; - - j_Update_state (); - - downcount = j_button[btn].downcount; - j_button[btn].downcount = 0; - - return downcount; -} - - -//changed 6/24/99 to finally squish the timedown bug - Owen Evans -fix joy_get_button_down_time(int btn) { - fix downtime; - j_Update_state (); - - if (j_button[btn].state) { - downtime = timer_get_fixed_seconds() - j_button[btn].timedown; - j_button[btn].timedown = timer_get_fixed_seconds(); - } else { - downtime = 0; - } - - return downtime; -} -//end changed - OE - -void joy_poll() { - -} - - -void joy_set_slow_reading(int flag) { - -} - diff --git a/input/sdl/Makefile.am b/input/sdl/Makefile.am deleted file mode 100644 index cc9a1256..00000000 --- a/input/sdl/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -SUBDIRS = include - -EXTRA_DIST = \ -event.c key.c mouse.c diff --git a/input/sdl/event.c b/input/sdl/event.c deleted file mode 100644 index 15c72690..00000000 --- a/input/sdl/event.c +++ /dev/null @@ -1,54 +0,0 @@ -// SDL Event related stuff - -#include -#include -#include - -#include - -extern void key_handler(SDL_KeyboardEvent *event); -//added on 10/17/98 by Hans de Goede for mouse functionality -extern void mouse_button_handler(SDL_MouseButtonEvent *mbe); -extern void mouse_motion_handler(SDL_MouseMotionEvent *mme); -//end this section addition - Hans - -static int initialised=0; - -void event_poll() -{ - SDL_Event event; - while (SDL_PollEvent(&event)) - { -// if( (event.type == SDL_KEYEVENT) { -//added/changed on 10/17/98 by Hans de Goede for mouse functionality -//-killed- if( (event.type == SDL_KEYDOWN) || (event.type == SDL_KEYUP) ) { - switch(event.type) - { - case SDL_KEYDOWN: - case SDL_KEYUP: - key_handler((SDL_KeyboardEvent *)&event); - break; - case SDL_MOUSEBUTTONDOWN: - case SDL_MOUSEBUTTONUP: - mouse_button_handler((SDL_MouseButtonEvent *)&event); - break; - case SDL_MOUSEMOTION: - mouse_motion_handler((SDL_MouseMotionEvent *)&event); - break; -//-killed- return; -//end this section addition/change - Hans - case SDL_QUIT: { -// void quit_request(); -// quit_request(); - } break; - } - } -} - -int event_init() -{ - // We should now be active and responding to events. - initialised = 1; - - return 0; -} diff --git a/input/sdl/include/Makefile.am b/input/sdl/include/Makefile.am deleted file mode 100644 index 1b9c30c0..00000000 --- a/input/sdl/include/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -EXTRA_DIST = \ -event.h key.h mouse.h diff --git a/input/sdl/include/event.h b/input/sdl/include/event.h deleted file mode 100644 index 1aeaedbd..00000000 --- a/input/sdl/include/event.h +++ /dev/null @@ -1,9 +0,0 @@ -// Event header file - -#ifndef _EVENT_H -#define _EVENT_H - -int event_init(); -void event_poll(); - -#endif diff --git a/input/sdl/include/key.h b/input/sdl/include/key.h deleted file mode 100644 index 245d2b22..00000000 --- a/input/sdl/include/key.h +++ /dev/null @@ -1,275 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ -/* - * $Source: /cvs/cvsroot/d2x/input/sdl/include/key.h,v $ - * $Revision: 1.2 $ - * $Author: bradleyb $ - * $Date: 2001-01-20 13:49:14 $ - * - * Header for keyboard functions - * - * $Log: not supported by cvs2svn $ - * Revision 1.1.1.1 2001/01/19 03:29:59 bradleyb - * Import of d2x-0.0.8 - * - * Revision 1.1.1.1 1999/06/14 22:02:01 donut - * Import of d1x 1.37 source. - * - * Revision 1.19 1994/10/24 13:58:12 john - * Hacked in support for pause key onto code 0x61. - * - * Revision 1.18 1994/10/21 15:17:10 john - * Added KEY_PRINT_SCREEN - * - * Revision 1.17 1994/08/31 12:22:13 john - * Added KEY_DEBUGGED - * - * Revision 1.16 1994/08/24 18:53:50 john - * Made Cyberman read like normal mouse; added dpmi module; moved - * mouse from assembly to c. Made mouse buttons return time_down. - * - * Revision 1.15 1994/08/18 14:56:16 john - * *** empty log message *** - * - * Revision 1.14 1994/08/08 10:43:24 john - * Recorded when a key was pressed for key_inkey_time. - * - * Revision 1.13 1994/06/17 17:17:28 john - * Added keyd_time_last_key_was_pressed or something like that. - * - * Revision 1.12 1994/04/29 12:14:19 john - * Locked all memory used during interrupts so that program - * won't hang when using virtual memory. - * - * Revision 1.11 1994/02/17 15:57:14 john - * Changed key libary to C. - * - * Revision 1.10 1994/01/31 08:34:09 john - * Fixed reversed lshift/rshift keys. - * - * Revision 1.9 1994/01/18 10:58:17 john - * *** empty log message *** - * - * Revision 1.8 1993/10/16 19:24:43 matt - * Added new function key_clear_times() & key_clear_counts() - * - * Revision 1.7 1993/10/15 10:17:09 john - * added keyd_last_key_pressed and released for use with recorder. - * - * Revision 1.6 1993/10/06 16:20:37 john - * fixed down arrow bug - * - * Revision 1.5 1993/10/04 13:26:42 john - * changed the #defines for scan codes. - * - * Revision 1.4 1993/09/28 11:35:20 john - * added key_peekkey - * - * Revision 1.3 1993/09/20 18:36:43 john - * *** empty log message *** - * - * Revision 1.1 1993/07/10 13:10:39 matt - * Initial revision - * - * - */ - -#ifndef _KEY_H -#define _KEY_H - -#include "fix.h" -#include "pstypes.h" -#include // For 'toupper' - -//========================================================================== -// This installs the int9 vector and initializes the keyboard in buffered -// ASCII mode. key_close simply undoes that. -extern void key_init(); -extern void key_close(); - -//========================================================================== -// These are configuration parameters to setup how the buffer works. -// set keyd_buffer_type to 0 for no key buffering. -// set it to 1 and it will buffer scancodes. -extern unsigned char keyd_buffer_type; -extern unsigned char keyd_repeat; // 1=allow repeating, 0=dont allow repeat - -// keyd_editor_mode... 0=game mode, 1=editor mode. -// Editor mode makes key_down_time always return 0 if modifiers are down. -extern unsigned char keyd_editor_mode; - -// Time in seconds when last key was pressed... -extern volatile int keyd_time_when_last_pressed; - -//========================================================================== -// These are the "buffered" keypress routines. Use them by setting the -// "keyd_buffer_type" variable. - -extern void key_putkey (unsigned short); // simulates a keystroke -extern void key_flush(); // Clears the 256 char buffer -extern int key_checkch(); // Returns 1 if a char is waiting -extern int key_getch(); // Gets key if one waiting other waits for one. -extern int key_inkey(); // Gets key if one, other returns 0. -extern int key_inkey_time(fix *time); // Same as inkey, but returns the time the key was pressed down. -extern int key_peekkey(); // Same as inkey, but doesn't remove key from buffer. - -extern unsigned char key_to_ascii(int keycode ); -extern char *key_name(int keycode); // Convert keycode to the name of the key - -extern void key_debug(); // Does an INT3 - -//========================================================================== -// These are the unbuffered routines. Index by the keyboard scancode. - -// Set to 1 if the key is currently down, else 0 -extern volatile unsigned char keyd_pressed[]; -extern volatile unsigned char keyd_last_pressed; -extern volatile unsigned char keyd_last_released; - -// Returns the seconds this key has been down since last call. -extern fix key_down_time(int scancode); - -// Returns number of times key has went from up to down since last call. -extern unsigned int key_down_count(int scancode); - -// Returns number of times key has went from down to up since last call. -extern unsigned int key_up_count(int scancode); - -// Clears the times & counts used by the above functions -// Took out... use key_flush(); -//void key_clear_times(); -//void key_clear_counts(); - -extern char * key_text[256]; - -#define KEY_SHIFTED 0x100 -#define KEY_ALTED 0x200 -#define KEY_CTRLED 0x400 -#define KEY_DEBUGGED 0x800 - -#define KEY_0 0x0B -#define KEY_1 0x02 -#define KEY_2 0x03 -#define KEY_3 0x04 -#define KEY_4 0x05 -#define KEY_5 0x06 -#define KEY_6 0x07 -#define KEY_7 0x08 -#define KEY_8 0x09 -#define KEY_9 0x0A - -#define KEY_A 0x1E -#define KEY_B 0x30 -#define KEY_C 0x2E -#define KEY_D 0x20 -#define KEY_E 0x12 -#define KEY_F 0x21 -#define KEY_G 0x22 -#define KEY_H 0x23 -#define KEY_I 0x17 -#define KEY_J 0x24 -#define KEY_K 0x25 -#define KEY_L 0x26 -#define KEY_M 0x32 -#define KEY_N 0x31 -#define KEY_O 0x18 -#define KEY_P 0x19 -#define KEY_Q 0x10 -#define KEY_R 0x13 -#define KEY_S 0x1F -#define KEY_T 0x14 -#define KEY_U 0x16 -#define KEY_V 0x2F -#define KEY_W 0x11 -#define KEY_X 0x2D -#define KEY_Y 0x15 -#define KEY_Z 0x2C - -#define KEY_MINUS 0x0C -#define KEY_EQUAL 0x0D -#define KEY_DIVIDE 0x35 -#define KEY_SLASH 0x2B -#define KEY_COMMA 0x33 -#define KEY_PERIOD 0x34 -#define KEY_SEMICOL 0x27 - -#define KEY_LBRACKET 0x1A -#define KEY_RBRACKET 0x1B - -#define KEY_RAPOSTRO 0x28 -#define KEY_LAPOSTRO 0x29 - -#define KEY_ESC 0x01 -#define KEY_ENTER 0x1C -#define KEY_BACKSP 0x0E -#define KEY_TAB 0x0F -#define KEY_SPACEBAR 0x39 - -#define KEY_NUMLOCK 0x45 -#define KEY_SCROLLOCK 0x46 -#define KEY_CAPSLOCK 0x3A - -#define KEY_LSHIFT 0x2A -#define KEY_RSHIFT 0x36 - -#define KEY_LALT 0x38 -#define KEY_RALT 0xB8 - -#define KEY_LCTRL 0x1D -#define KEY_RCTRL 0x9D - -#define KEY_F1 0x3B -#define KEY_F2 0x3C -#define KEY_F3 0x3D -#define KEY_F4 0x3E -#define KEY_F5 0x3F -#define KEY_F6 0x40 -#define KEY_F7 0x41 -#define KEY_F8 0x42 -#define KEY_F9 0x43 -#define KEY_F10 0x44 -#define KEY_F11 0x57 -#define KEY_F12 0x58 - -#define KEY_PAD0 0x52 -#define KEY_PAD1 0x4F -#define KEY_PAD2 0x50 -#define KEY_PAD3 0x51 -#define KEY_PAD4 0x4B -#define KEY_PAD5 0x4C -#define KEY_PAD6 0x4D -#define KEY_PAD7 0x47 -#define KEY_PAD8 0x48 -#define KEY_PAD9 0x49 -#define KEY_PADMINUS 0x4A -#define KEY_PADPLUS 0x4E -#define KEY_PADPERIOD 0x53 -#define KEY_PADDIVIDE 0xB5 -#define KEY_PADMULTIPLY 0x37 -#define KEY_PADENTER 0x9C - -#define KEY_INSERT 0xD2 -#define KEY_HOME 0xC7 -#define KEY_PAGEUP 0xC9 -#define KEY_DELETE 0xD3 -#define KEY_END 0xCF -#define KEY_PAGEDOWN 0xD1 -#define KEY_UP 0xC8 -#define KEY_DOWN 0xD0 -#define KEY_LEFT 0xCB -#define KEY_RIGHT 0xCD - -#define KEY_PRINT_SCREEN 0xB7 -#define KEY_PAUSE 0x61 - -#endif diff --git a/input/sdl/include/mouse.h b/input/sdl/include/mouse.h deleted file mode 100644 index 24518a8d..00000000 --- a/input/sdl/include/mouse.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ -/* - * $Source: /cvs/cvsroot/d2x/input/sdl/include/mouse.h,v $ - * $Revision: 1.1.1.1 $ - * $Author: bradleyb $ - * $Date: 2001-01-19 03:29:59 $ - * - * Header for mouse functions - * - * $Log: not supported by cvs2svn $ - * Revision 1.1.1.1 1999/06/14 22:02:02 donut - * Import of d1x 1.37 source. - * - * Revision 1.10 1995/02/02 10:22:29 john - * Added cyberman init parameter. - * - * Revision 1.9 1994/11/18 23:18:09 john - * Changed some shorts to ints. - * - * Revision 1.8 1994/09/13 12:33:49 john - * Added functions to get down count and state. - * - * Revision 1.7 1994/08/29 20:52:20 john - * Added better cyberman support; also, joystick calibration - * value return funcctiionn, - * - * Revision 1.6 1994/08/24 17:54:35 john - * *** empty log message *** - * - * Revision 1.5 1994/08/24 17:51:43 john - * Added transparent cyberman support - * - * Revision 1.4 1993/07/27 09:32:22 john - * *** empty log message *** - * - * Revision 1.3 1993/07/26 10:46:44 john - * added definition for mouse_set_pos - * - * Revision 1.2 1993/07/22 13:07:59 john - * added header for mousesetlimts - * - * Revision 1.1 1993/07/10 13:10:40 matt - * Initial revision - * - * - */ - -#ifndef MOUSE_H -#define MOUSE_H - -#include "pstypes.h" -#include "fix.h" - -#define MOUSE_MAX_BUTTONS 8 - -#define MB_LEFT 0 -#define MB_RIGHT 1 -#define MB_MIDDLE 2 -#define MB_Z_UP 3 -#define MB_Z_DOWN 4 -#define MB_PITCH_BACKWARD 5 -#define MB_PITCH_FORWARD 6 -#define MB_BANK_LEFT 7 -#define MB_BANK_RIGHT 8 -#define MB_HEAD_LEFT 9 -#define MB_HEAD_RIGHT 10 - -#define MOUSE_LBTN 1 -#define MOUSE_RBTN 2 -#define MOUSE_MBTN 4 - -#undef NOMOUSE -#ifndef NOMOUSE - -//======================================================================== -// Check for mouse driver, reset driver if installed. returns number of -// buttons if driver is present. - -extern int mouse_set_limits( int x1, int y1, int x2, int y2 ); -extern void mouse_flush(); // clears all mice events... - -//======================================================================== -extern void mouse_get_pos( int *x, int *y); -extern void mouse_get_delta( int *dx, int *dy ); -extern int mouse_get_btns(); -extern void mouse_set_pos( int x, int y); -extern void mouse_get_cyberman_pos( int *x, int *y ); - -// Returns how long this button has been down since last call. -extern fix mouse_button_down_time(int button); - -// Returns how many times this button has went down since last call. -extern int mouse_button_down_count(int button); - -// Returns 1 if this button is currently down -extern int mouse_button_state(int button); - -#else -// 'Neutered' functions... :-) -#define mouse_init(a) -1 -#define mouse_set_limits(a,b,c,d) -1 -#define mouse_flush() -#define mouse_close() -#define mouse_get_pos(a,b) -#define mouse_get_delta(a,b) -#define mouse_get_btns() 0 -#define mouse_set_pos(a,b) -#define mouse_get_cyberman_pos(a,b) -#define mouse_button_down_time(a) 0 -#define mouse_button_down_count(a) 0 -#define mouse_button_state(a) 0 - -#endif - -#endif - diff --git a/input/sdl/key.c b/input/sdl/key.c deleted file mode 100644 index 9eb590c5..00000000 --- a/input/sdl/key.c +++ /dev/null @@ -1,616 +0,0 @@ -// SDL keyboard input support - -#include -#include -#include - -#include - -#include "event.h" -#include "error.h" -#include "key.h" -#include "timer.h" - -//added on 9/3/98 by Matt Mueller to free some cpu instead of hogging during menus and such -#include "d_delay.h" -//end this section addition - Matt Mueller - -#define KEY_BUFFER_SIZE 16 - -static unsigned char Installed = 0; - -//-------- Variable accessed by outside functions --------- -unsigned char keyd_buffer_type; // 0=No buffer, 1=buffer ASCII, 2=buffer scans -unsigned char keyd_repeat; -unsigned char keyd_editor_mode; -volatile unsigned char keyd_last_pressed; -volatile unsigned char keyd_last_released; -volatile unsigned char keyd_pressed[256]; -volatile int keyd_time_when_last_pressed; - -typedef struct Key_info { - ubyte state; // state of key 1 == down, 0 == up - ubyte last_state; // previous state of key - int counter; // incremented each time key is down in handler - fix timewentdown; // simple counter incremented each time in interrupt and key is down - fix timehelddown; // counter to tell how long key is down -- gets reset to 0 by key routines - ubyte downcount; // number of key counts key was down - ubyte upcount; // number of times key was released -} Key_info; - -typedef struct keyboard { - unsigned short keybuffer[KEY_BUFFER_SIZE]; - Key_info keys[256]; - fix time_pressed[KEY_BUFFER_SIZE]; - unsigned int keyhead, keytail; -} keyboard; - -static keyboard key_data; - -typedef struct key_props { - char *key_text; - unsigned char ascii_value; - unsigned char shifted_ascii_value; - SDLKey sym; -} key_props; - -key_props key_properties[256] = { -{ "", 255, 255, -1 }, -{ "ESC", 255, 255, SDLK_ESCAPE }, -{ "1", '1', '!', SDLK_1 }, -{ "2", '2', '@', SDLK_2 }, -{ "3", '3', '#', SDLK_3 }, -{ "4", '4', '$', SDLK_4 }, -{ "5", '5', '%', SDLK_5 }, -{ "6", '6', '^', SDLK_6 }, -{ "7", '7', '&', SDLK_7 }, -{ "8", '8', '*', SDLK_8 }, -{ "9", '9', '(', SDLK_9 }, -{ "0", '0', ')', SDLK_0 }, -{ "-", '-', '_', SDLK_MINUS }, -{ "=", '=', '+', SDLK_EQUALS }, -{ "BSPC", 255, 255, SDLK_BACKSPACE }, -{ "TAB", 255, 255, SDLK_TAB }, -{ "Q", 'q', 'Q', SDLK_q }, -{ "W", 'w', 'W', SDLK_w }, -{ "E", 'e', 'E', SDLK_e }, -{ "R", 'r', 'R', SDLK_r }, -{ "T", 't', 'T', SDLK_t }, -{ "Y", 'y', 'Y', SDLK_y }, -{ "U", 'u', 'U', SDLK_u }, -{ "I", 'i', 'I', SDLK_i }, -{ "O", 'o', 'O', SDLK_o }, -{ "P", 'p', 'P', SDLK_p }, -{ "[", '[', '{', SDLK_LEFTBRACKET }, -{ "]", ']', '}', SDLK_RIGHTBRACKET }, -//edited 06/08/99 Matt Mueller - set to correct key_text -{ "ƒ", 255, 255, SDLK_RETURN }, -//end edit -MM -{ "LCTRL", 255, 255, SDLK_LCTRL }, -{ "A", 'a', 'A', SDLK_a }, -{ "S", 's', 'S', SDLK_s }, -{ "D", 'd', 'D', SDLK_d }, -{ "F", 'f', 'F', SDLK_f }, -{ "G", 'g', 'G', SDLK_g }, -{ "H", 'h', 'H', SDLK_h }, -{ "J", 'j', 'J', SDLK_j }, -{ "K", 'k', 'K', SDLK_k }, -{ "L", 'l', 'L', SDLK_l }, -//edited 06/08/99 Matt Mueller - set to correct sym -{ ";", ';', ':', SDLK_SEMICOLON }, -//end edit -MM -{ "'", '\'', '"', SDLK_QUOTE }, -//edited 06/08/99 Matt Mueller - set to correct sym -{ "`", '`', '~', SDLK_BACKQUOTE }, -//end edit -MM -{ "LSHFT", 255, 255, SDLK_LSHIFT }, -{ "\\", '\\', '|', SDLK_BACKSLASH }, -{ "Z", 'z', 'Z', SDLK_z }, -{ "X", 'x', 'X', SDLK_x }, -{ "C", 'c', 'C', SDLK_c }, -{ "V", 'v', 'V', SDLK_v }, -{ "B", 'b', 'B', SDLK_b }, -{ "N", 'n', 'N', SDLK_n }, -{ "M", 'm', 'M', SDLK_m }, -//edited 06/08/99 Matt Mueller - set to correct syms -{ ",", ',', '<', SDLK_COMMA }, -{ ".", '.', '>', SDLK_PERIOD }, -{ "/", '/', '?', SDLK_SLASH }, -//end edit -MM -{ "RSHFT", 255, 255, SDLK_RSHIFT }, -{ "PAD*", '*', 255, SDLK_KP_MULTIPLY }, -{ "LALT", 255, 255, SDLK_LALT }, -{ "SPC", ' ', ' ', SDLK_SPACE }, -{ "CPSLK", 255, 255, SDLK_CAPSLOCK }, -{ "F1", 255, 255, SDLK_F1 }, -{ "F2", 255, 255, SDLK_F2 }, -{ "F3", 255, 255, SDLK_F3 }, -{ "F4", 255, 255, SDLK_F4 }, -{ "F5", 255, 255, SDLK_F5 }, -{ "F6", 255, 255, SDLK_F6 }, -{ "F7", 255, 255, SDLK_F7 }, -{ "F8", 255, 255, SDLK_F8 }, -{ "F9", 255, 255, SDLK_F9 }, -{ "F10", 255, 255, SDLK_F10 }, -{ "NMLCK", 255, 255, SDLK_NUMLOCK }, -{ "SCLK", 255, 255, SDLK_SCROLLOCK }, -{ "PAD7", 255, 255, SDLK_KP7 }, -{ "PAD8", 255, 255, SDLK_KP8 }, -{ "PAD9", 255, 255, SDLK_KP9 }, -{ "PAD-", 255, 255, SDLK_KP_MINUS }, -{ "PAD4", 255, 255, SDLK_KP4 }, -{ "PAD5", 255, 255, SDLK_KP5 }, -{ "PAD6", 255, 255, SDLK_KP6 }, -{ "PAD+", 255, 255, SDLK_KP_PLUS }, -{ "PAD1", 255, 255, SDLK_KP1 }, -{ "PAD2", 255, 255, SDLK_KP2 }, -{ "PAD3", 255, 255, SDLK_KP3 }, -{ "PAD0", 255, 255, SDLK_KP0 }, -{ "PAD.", 255, 255, SDLK_KP_PERIOD }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "F11", 255, 255, SDLK_F11 }, -{ "F12", 255, 255, SDLK_F12 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -//edited 06/08/99 Matt Mueller - add pause ability -{ "PAUSE", 255, 255, SDLK_PAUSE }, -//end edit -MM -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -//edited 06/08/99 Matt Mueller - set to correct key_text -{ "PADƒ", 255, 255, SDLK_KP_ENTER }, -//end edit -MM -//edited 06/08/99 Matt Mueller - set to correct sym -{ "RCTRL", 255, 255, SDLK_RCTRL }, -//end edit -MM -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "PAD/", 255, 255, SDLK_KP_DIVIDE }, -{ "", 255, 255, -1 }, -//edited 06/08/99 Matt Mueller - add printscreen ability -{ "PRSCR", 255, 255, SDLK_PRINT }, -//end edit -MM -{ "RALT", 255, 255, SDLK_RALT }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "HOME", 255, 255, SDLK_HOME }, -//edited 06/08/99 Matt Mueller - set to correct key_text -{ "UP", 255, 255, SDLK_UP }, -//end edit -MM -{ "PGUP", 255, 255, SDLK_PAGEUP }, -{ "", 255, 255, -1 }, -//edited 06/08/99 Matt Mueller - set to correct key_text -{ "LEFT", 255, 255, SDLK_LEFT }, -//end edit -MM -{ "", 255, 255, -1 }, -//edited 06/08/99 Matt Mueller - set to correct key_text -{ "RIGHT", 255, 255, SDLK_RIGHT }, -//end edit -MM -{ "", 255, 255, -1 }, -//edited 06/08/99 Matt Mueller - set to correct key_text -{ "END", 255, 255, SDLK_END }, -//end edit -MM -{ "DOWN", 255, 255, SDLK_DOWN }, -{ "PGDN", 255, 255, SDLK_PAGEDOWN }, -{ "INS", 255, 255, SDLK_INSERT }, -{ "DEL", 255, 255, SDLK_DELETE }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -{ "", 255, 255, -1 }, -}; - -char *key_text[256]; - -void key_buid_key_text(void) -{ -} - -unsigned char key_to_ascii(int keycode ) -{ - int shifted; - - shifted = keycode & KEY_SHIFTED; - keycode &= 0xFF; - - if (shifted) - return key_properties[keycode].shifted_ascii_value; - else - return key_properties[keycode].ascii_value; -} - -void key_handler(SDL_KeyboardEvent *event) -{ - ubyte state; - int i, keycode, event_key, key_state; - Key_info *key; - unsigned char temp; - - event_key = event->keysym.sym; - - key_state = (event->state == SDL_PRESSED); // !(wInfo & KF_UP); - //===================================================== - //Here a translation from win keycodes to mac keycodes! - //===================================================== - - for (i = 255; i >= 0; i--) { - - keycode = i; - key = &(key_data.keys[keycode]); - if (key_properties[i].sym == event_key) - state = key_state; - else - state = key->last_state; - - if ( key->last_state == state ) { - if (state) { - key->counter++; - keyd_last_pressed = keycode; - keyd_time_when_last_pressed = timer_get_fixed_seconds(); - } - } else { - if (state) { - keyd_last_pressed = keycode; - keyd_pressed[keycode] = 1; - key->downcount += state; - key->state = 1; - key->timewentdown = keyd_time_when_last_pressed = timer_get_fixed_seconds(); - key->counter++; - } else { - keyd_pressed[keycode] = 0; - keyd_last_released = keycode; - key->upcount += key->state; - key->state = 0; - key->counter = 0; - key->timehelddown += timer_get_fixed_seconds() - key->timewentdown; - } - } - if ( (state && !key->last_state) || (state && key->last_state && (key->counter > 30) && (key->counter & 0x01)) ) { - if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT]) - keycode |= KEY_SHIFTED; - if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT]) - keycode |= KEY_ALTED; - if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL]) - keycode |= KEY_CTRLED; - if ( keyd_pressed[KEY_DELETE] ) - keycode |= KEY_DEBUGGED; - temp = key_data.keytail+1; - if ( temp >= KEY_BUFFER_SIZE ) temp=0; - if (temp!=key_data.keyhead) { - key_data.keybuffer[key_data.keytail] = keycode; - key_data.time_pressed[key_data.keytail] = keyd_time_when_last_pressed; - key_data.keytail = temp; - } - } - key->last_state = state; - } -} - -void key_close() -{ - Installed = 0; -} - -void key_init() -{ - int i; - - if (Installed) return; - - Installed=1; - - keyd_time_when_last_pressed = timer_get_fixed_seconds(); - keyd_buffer_type = 1; - keyd_repeat = 1; - - for(i=0; i<256; i++) - key_text[i] = key_properties[i].key_text; - - // Clear the keyboard array - key_flush(); - atexit(key_close); -} - -void key_flush() -{ - int i; - fix curtime; - - if (!Installed) - key_init(); - - key_data.keyhead = key_data.keytail = 0; - - //Clear the keyboard buffer - for (i=0; i= KEY_BUFFER_SIZE ) n=0; - return n; -} - -int key_checkch() -{ - int is_one_waiting = 0; - event_poll(); - if (key_data.keytail!=key_data.keyhead) - is_one_waiting = 1; - return is_one_waiting; -} - -int key_inkey() -{ - int key = 0; - if (!Installed) - key_init(); - event_poll(); - if (key_data.keytail!=key_data.keyhead) { - key = key_data.keybuffer[key_data.keyhead]; - key_data.keyhead = add_one(key_data.keyhead); - } -//added 9/3/98 by Matt Mueller to free cpu time instead of hogging during menus and such - else d_delay(1); -//end addition - Matt Mueller - - return key; -} - -int key_inkey_time(fix * time) -{ - int key = 0; - - if (!Installed) - key_init(); - event_poll(); - if (key_data.keytail!=key_data.keyhead) { - key = key_data.keybuffer[key_data.keyhead]; - *time = key_data.time_pressed[key_data.keyhead]; - key_data.keyhead = add_one(key_data.keyhead); - } - return key; -} - -int key_peekkey() -{ - int key = 0; - event_poll(); - if (key_data.keytail!=key_data.keyhead) - key = key_data.keybuffer[key_data.keyhead]; - - return key; -} - -int key_getch() -{ - int dummy=0; - - if (!Installed) - return 0; -// return getch(); - - while (!key_checkch()) - dummy++; - return key_inkey(); -} - -unsigned int key_get_shift_status() -{ - unsigned int shift_status = 0; - - if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT] ) - shift_status |= KEY_SHIFTED; - - if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT] ) - shift_status |= KEY_ALTED; - - if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL] ) - shift_status |= KEY_CTRLED; - -#ifndef NDEBUG - if (keyd_pressed[KEY_DELETE]) - shift_status |=KEY_DEBUGGED; -#endif - - return shift_status; -} - -// Returns the number of seconds this key has been down since last call. -fix key_down_time(int scancode) -{ - fix time_down, time; - - event_poll(); - if ((scancode<0)|| (scancode>255)) return 0; - - if (!keyd_pressed[scancode]) { - time_down = key_data.keys[scancode].timehelddown; - key_data.keys[scancode].timehelddown = 0; - } else { - time = timer_get_fixed_seconds(); - time_down = time - key_data.keys[scancode].timewentdown; - key_data.keys[scancode].timewentdown = time; - } - - return time_down; -} - -unsigned int key_down_count(int scancode) -{ - int n; - event_poll(); - if ((scancode<0)|| (scancode>255)) return 0; - - n = key_data.keys[scancode].downcount; - key_data.keys[scancode].downcount = 0; - - return n; -} - -unsigned int key_up_count(int scancode) -{ - int n; - event_poll(); - if ((scancode<0)|| (scancode>255)) return 0; - - n = key_data.keys[scancode].upcount; - key_data.keys[scancode].upcount = 0; - - return n; -} diff --git a/input/sdl/mouse.c b/input/sdl/mouse.c deleted file mode 100644 index c0f01830..00000000 --- a/input/sdl/mouse.c +++ /dev/null @@ -1,234 +0,0 @@ -// SDL mouse driver. - -#include -#include -#include -#include "fix.h" -#include "timer.h" -#include "event.h" -#include "mouse.h" - -struct mousebutton { - ubyte pressed; - fix time_went_down; - fix time_held_down; - uint num_downs; - uint num_ups; -}; - -static struct mouseinfo { - struct mousebutton buttons[MOUSE_MAX_BUTTONS]; -//added on 10/17/98 by Hans de Goede for mouse functionality - int min_x, min_y; - int max_x, max_y; - int delta_x, delta_y; - int x,y; -//end this section addition - Hans -} Mouse; - -//added on 10/17/98 by Hans de Goede for mouse functionality -void d_mouse_init(void) -{ - memset(&Mouse,0,sizeof(Mouse)); -} - -//added/changed on 10/17/98 by Hans de Goede for mouse functionality -//void mouse_handler(SDL_MouseButtonEvent *mbe) -void mouse_button_handler(SDL_MouseButtonEvent *mbe) -{ - // to bad, SDL buttons use a different mapping as descent expects, - // this is atleast true and tested for the first three buttons - int button_remap[11] = { - MB_LEFT, - MB_MIDDLE, - MB_RIGHT, - MB_Z_UP, - MB_Z_DOWN, - MB_PITCH_BACKWARD, - MB_PITCH_FORWARD, - MB_BANK_LEFT, - MB_BANK_RIGHT, - MB_HEAD_LEFT, - MB_HEAD_RIGHT }; - - int button = button_remap[mbe->button - 1]; // -1 since SDL seems to start counting at 1 - - if (mbe->state == SDL_PRESSED) { -// Mouse.buttons[mbe->button].pressed = 1; -// Mouse.buttons[mbe->button].time_went_down = timer_get_fixed_seconds(); -// Mouse.buttons[mbe->button].num_downs++; - Mouse.buttons[button].pressed = 1; - Mouse.buttons[button].time_went_down = timer_get_fixed_seconds(); - Mouse.buttons[button].num_downs++; - } else { -// Mouse.buttons[mbe->button].pressed = 0; -// Mouse.buttons[mbe->button].time_held_down += timer_get_fixed_seconds() - Mouse.buttons[mbe->button].time_went_down; -// Mouse.buttons[mbe->button].num_ups++; - Mouse.buttons[button].pressed = 0; - Mouse.buttons[button].time_held_down += timer_get_fixed_seconds() - Mouse.buttons[mbe->button].time_went_down; - Mouse.buttons[button].num_ups++; -//end this section addition/change - Hans - } -} - -//added on 10/17/98 by Hans de Goede for mouse functionality -void mouse_motion_handler(SDL_MouseMotionEvent *mme) -{ - Mouse.delta_x += mme->xrel; - Mouse.delta_y += mme->yrel; - Mouse.x += mme->xrel; - Mouse.y += mme->yrel; - if (Mouse.x > Mouse.max_x) Mouse.x = Mouse.max_x; - else if (Mouse.x < Mouse.min_x) Mouse.x = Mouse.min_x; - if (Mouse.y > Mouse.max_y) Mouse.y = Mouse.max_y; - else if (Mouse.y < Mouse.min_y) Mouse.y = Mouse.min_y; -} -//end this section addition - Hans - - -int mouse_set_limits( int x1, int y1, int x2, int y2 ) -{ -//added on 10/17/98 by Hans de Goede for mouse functionality -//-killed- // Shrug... -//-killed- event_poll(); - Mouse.min_x = x1; - Mouse.min_y = y1; - Mouse.max_x = x2; - Mouse.max_y = y2; -//end this section addition - Hans - return 0; -} - -void mouse_flush() // clears all mice events... -{ - int i; - fix current_time; - - event_poll(); - - current_time = timer_get_fixed_seconds(); - for (i=0; i Mouse.max_x) Mouse.x = Mouse.max_x; - else if (Mouse.x < Mouse.min_x) Mouse.x = Mouse.min_x; - if (Mouse.y > Mouse.max_y) Mouse.y = Mouse.max_y; - else if (Mouse.y < Mouse.min_y) Mouse.y = Mouse.min_y; -//end this section change - Hans -} - -void mouse_get_cyberman_pos( int *x, int *y ) -{ - // Shrug... - event_poll(); -} - -// Returns how long this button has been down since last call. -fix mouse_button_down_time(int button) -{ - fix time_down, time; - - event_poll(); - - if (!Mouse.buttons[button].pressed) { - time_down = Mouse.buttons[button].time_held_down; - Mouse.buttons[button].time_held_down = 0; - } else { - time = timer_get_fixed_seconds(); - time_down = time - Mouse.buttons[button].time_held_down; - Mouse.buttons[button].time_held_down = time; - } - return time_down; -} - -// Returns how many times this button has went down since last call -int mouse_button_down_count(int button) -{ - int count; - - event_poll(); - - count = Mouse.buttons[button].num_downs; - Mouse.buttons[button].num_downs = 0; - - return count; -} - -// Returns 1 if this button is currently down -int mouse_button_state(int button) -{ - event_poll(); - return Mouse.buttons[button].pressed; -} - - diff --git a/input/svgalib/Makefile.am b/input/svgalib/Makefile.am deleted file mode 100644 index 7b92e00e..00000000 --- a/input/svgalib/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = include diff --git a/input/svgalib/include/Makefile.am b/input/svgalib/include/Makefile.am deleted file mode 100644 index 1b9c30c0..00000000 --- a/input/svgalib/include/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -EXTRA_DIST = \ -event.h key.h mouse.h diff --git a/input/svgalib/include/event.h b/input/svgalib/include/event.h deleted file mode 100644 index 1aeaedbd..00000000 --- a/input/svgalib/include/event.h +++ /dev/null @@ -1,9 +0,0 @@ -// Event header file - -#ifndef _EVENT_H -#define _EVENT_H - -int event_init(); -void event_poll(); - -#endif diff --git a/input/svgalib/include/key.h b/input/svgalib/include/key.h deleted file mode 100644 index b89c94cc..00000000 --- a/input/svgalib/include/key.h +++ /dev/null @@ -1,275 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ -/* - * $Source: /cvs/cvsroot/d2x/input/svgalib/include/key.h,v $ - * $Revision: 1.1 $ - * $Author: bradleyb $ - * $Date: 2001-01-22 13:00:22 $ - * - * Header for keyboard functions - * - * $Log: not supported by cvs2svn $ - * Revision 1.1.1.1 2001/01/19 03:30:15 bradleyb - * Import of d2x-0.0.8 - * - * Revision 1.1.1.1 1999/06/14 22:01:46 donut - * Import of d1x 1.37 source. - * - * Revision 1.19 1994/10/24 13:58:12 john - * Hacked in support for pause key onto code 0x61. - * - * Revision 1.18 1994/10/21 15:17:10 john - * Added KEY_PRINT_SCREEN - * - * Revision 1.17 1994/08/31 12:22:13 john - * Added KEY_DEBUGGED - * - * Revision 1.16 1994/08/24 18:53:50 john - * Made Cyberman read like normal mouse; added dpmi module; moved - * mouse from assembly to c. Made mouse buttons return time_down. - * - * Revision 1.15 1994/08/18 14:56:16 john - * *** empty log message *** - * - * Revision 1.14 1994/08/08 10:43:24 john - * Recorded when a key was pressed for key_inkey_time. - * - * Revision 1.13 1994/06/17 17:17:28 john - * Added keyd_time_last_key_was_pressed or something like that. - * - * Revision 1.12 1994/04/29 12:14:19 john - * Locked all memory used during interrupts so that program - * won't hang when using virtual memory. - * - * Revision 1.11 1994/02/17 15:57:14 john - * Changed key libary to C. - * - * Revision 1.10 1994/01/31 08:34:09 john - * Fixed reversed lshift/rshift keys. - * - * Revision 1.9 1994/01/18 10:58:17 john - * *** empty log message *** - * - * Revision 1.8 1993/10/16 19:24:43 matt - * Added new function key_clear_times() & key_clear_counts() - * - * Revision 1.7 1993/10/15 10:17:09 john - * added keyd_last_key_pressed and released for use with recorder. - * - * Revision 1.6 1993/10/06 16:20:37 john - * fixed down arrow bug - * - * Revision 1.5 1993/10/04 13:26:42 john - * changed the #defines for scan codes. - * - * Revision 1.4 1993/09/28 11:35:20 john - * added key_peekkey - * - * Revision 1.3 1993/09/20 18:36:43 john - * *** empty log message *** - * - * Revision 1.1 1993/07/10 13:10:39 matt - * Initial revision - * - * - */ - -#ifndef _KEY_H -#define _KEY_H - -#include "fix.h" -#include "pstypes.h" -#include // For 'toupper' - -//========================================================================== -// This installs the int9 vector and initializes the keyboard in buffered -// ASCII mode. key_close simply undoes that. -extern void key_init(); -extern void key_close(); - -//========================================================================== -// These are configuration parameters to setup how the buffer works. -// set keyd_buffer_type to 0 for no key buffering. -// set it to 1 and it will buffer scancodes. -extern unsigned char keyd_buffer_type; -extern unsigned char keyd_repeat; // 1=allow repeating, 0=dont allow repeat - -// keyd_editor_mode... 0=game mode, 1=editor mode. -// Editor mode makes key_down_time always return 0 if modifiers are down. -extern unsigned char keyd_editor_mode; - -// Time in seconds when last key was pressed... -extern volatile int keyd_time_when_last_pressed; - -//========================================================================== -// These are the "buffered" keypress routines. Use them by setting the -// "keyd_buffer_type" variable. - -extern void key_putkey (unsigned short); // simulates a keystroke -extern void key_flush(); // Clears the 256 char buffer -extern int key_checkch(); // Returns 1 if a char is waiting -extern int key_getch(); // Gets key if one waiting other waits for one. -extern int key_inkey(); // Gets key if one, other returns 0. -extern int key_inkey_time(fix *time); // Same as inkey, but returns the time the key was pressed down. -extern int key_peekkey(); // Same as inkey, but doesn't remove key from buffer. - -extern unsigned char key_to_ascii(int keycode ); -extern char *key_name(int keycode); // Convert keycode to the name of the key - -extern void key_debug(); // Does an INT3 - -//========================================================================== -// These are the unbuffered routines. Index by the keyboard scancode. - -// Set to 1 if the key is currently down, else 0 -extern volatile unsigned char keyd_pressed[]; -extern volatile unsigned char keyd_last_pressed; -extern volatile unsigned char keyd_last_released; - -// Returns the seconds this key has been down since last call. -extern fix key_down_time(int scancode); - -// Returns number of times key has went from up to down since last call. -extern unsigned int key_down_count(int scancode); - -// Returns number of times key has went from down to up since last call. -extern unsigned int key_up_count(int scancode); - -// Clears the times & counts used by the above functions -// Took out... use key_flush(); -//void key_clear_times(); -//void key_clear_counts(); - -extern char * key_text[256]; - -#define KEY_SHIFTED 0x100 -#define KEY_ALTED 0x200 -#define KEY_CTRLED 0x400 -#define KEY_DEBUGGED 0x800 - -#define KEY_0 11 -#define KEY_1 2 -#define KEY_2 3 -#define KEY_3 4 -#define KEY_4 5 -#define KEY_5 6 -#define KEY_6 7 -#define KEY_7 8 -#define KEY_8 9 -#define KEY_9 10 - -#define KEY_A 30 -#define KEY_B 48 -#define KEY_C 46 -#define KEY_D 32 -#define KEY_E 18 -#define KEY_F 33 -#define KEY_G 34 -#define KEY_H 35 -#define KEY_I 23 -#define KEY_J 36 -#define KEY_K 37 -#define KEY_L 38 -#define KEY_M 50 -#define KEY_N 49 -#define KEY_O 24 -#define KEY_P 25 -#define KEY_Q 16 -#define KEY_R 19 -#define KEY_S 31 -#define KEY_T 20 -#define KEY_U 22 -#define KEY_V 47 -#define KEY_W 17 -#define KEY_X 45 -#define KEY_Y 21 -#define KEY_Z 44 - -#define KEY_MINUS 12 -#define KEY_EQUAL 13 -#define KEY_DIVIDE 43 -#define KEY_SLASH 28 -#define KEY_COMMA 51 -#define KEY_PERIOD 52 -#define KEY_SEMICOL 39 - -#define KEY_LBRACKET 26 -#define KEY_RBRACKET 27 - -#define KEY_RAPOSTRO 40 -#define KEY_LAPOSTRO 41 - -#define KEY_ESC 1 -#define KEY_ENTER 28 -#define KEY_BACKSP 14 -#define KEY_TAB 15 -#define KEY_SPACEBAR 57 - -#define KEY_NUMLOCK 69 -#define KEY_SCROLLOCK 70 -#define KEY_CAPSLOCK 58 - -#define KEY_LSHIFT 42 -#define KEY_RSHIFT 54 - -#define KEY_LALT 56 -#define KEY_RALT 100 - -#define KEY_LCTRL 29 -#define KEY_RCTRL 97 - -#define KEY_F1 59 -#define KEY_F2 60 -#define KEY_F3 61 -#define KEY_F4 62 -#define KEY_F5 63 -#define KEY_F6 64 -#define KEY_F7 65 -#define KEY_F8 66 -#define KEY_F9 67 -#define KEY_F10 68 -#define KEY_F11 87 -#define KEY_F12 88 - -#define KEY_PAD0 82 -#define KEY_PAD1 79 -#define KEY_PAD2 80 -#define KEY_PAD3 81 -#define KEY_PAD4 75 -#define KEY_PAD5 76 -#define KEY_PAD6 77 -#define KEY_PAD7 71 -#define KEY_PAD8 72 -#define KEY_PAD9 73 -#define KEY_PADMINUS 74 -#define KEY_PADPLUS 78 -#define KEY_PADPERIOD 83 -#define KEY_PADDIVIDE 98 -#define KEY_PADMULTIPLY 55 -#define KEY_PADENTER 96 - -#define KEY_INSERT 110 -#define KEY_HOME 102 -#define KEY_PAGEUP 104 -#define KEY_DELETE 111 -#define KEY_END 107 -#define KEY_PAGEDOWN 109 -#define KEY_UP 103 -#define KEY_DOWN 108 -#define KEY_LEFT 105 -#define KEY_RIGHT 106 - -#define KEY_PRINT_SCREEN 99 -#define KEY_PAUSE 119 - -#endif diff --git a/input/svgalib/include/mouse.h b/input/svgalib/include/mouse.h deleted file mode 100644 index 2fa94a63..00000000 --- a/input/svgalib/include/mouse.h +++ /dev/null @@ -1,130 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ -/* - * $Source: /cvs/cvsroot/d2x/input/svgalib/include/mouse.h,v $ - * $Revision: 1.1 $ - * $Author: bradleyb $ - * $Date: 2001-01-22 13:00:22 $ - * - * Header for mouse functions - * - * $Log: not supported by cvs2svn $ - * Revision 1.1.1.1 2001/01/19 03:30:15 bradleyb - * Import of d2x-0.0.8 - * - * Revision 1.1.1.1 1999/06/14 22:01:46 donut - * Import of d1x 1.37 source. - * - * Revision 1.10 1995/02/02 10:22:29 john - * Added cyberman init parameter. - * - * Revision 1.9 1994/11/18 23:18:09 john - * Changed some shorts to ints. - * - * Revision 1.8 1994/09/13 12:33:49 john - * Added functions to get down count and state. - * - * Revision 1.7 1994/08/29 20:52:20 john - * Added better cyberman support; also, joystick calibration - * value return funcctiionn, - * - * Revision 1.6 1994/08/24 17:54:35 john - * *** empty log message *** - * - * Revision 1.5 1994/08/24 17:51:43 john - * Added transparent cyberman support - * - * Revision 1.4 1993/07/27 09:32:22 john - * *** empty log message *** - * - * Revision 1.3 1993/07/26 10:46:44 john - * added definition for mouse_set_pos - * - * Revision 1.2 1993/07/22 13:07:59 john - * added header for mousesetlimts - * - * Revision 1.1 1993/07/10 13:10:40 matt - * Initial revision - * - * - */ - -#ifndef MOUSE_H -#define MOUSE_H - -#include "pstypes.h" -#include "fix.h" - -#define MOUSE_MAX_BUTTONS 8 - -#define MB_LEFT 0 -#define MB_RIGHT 1 -#define MB_MIDDLE 2 -#define MB_Z_UP 3 -#define MB_Z_DOWN 4 -#define MB_PITCH_BACKWARD 5 -#define MB_PITCH_FORWARD 6 -#define MB_BANK_LEFT 7 -#define MB_BANK_RIGHT 8 -#define MB_HEAD_LEFT 9 -#define MB_HEAD_RIGHT 10 - -#define MOUSE_LBTN 1 -#define MOUSE_RBTN 2 -#define MOUSE_MBTN 4 - -#undef NOMOUSE -#ifndef NOMOUSE - -//======================================================================== -// Check for mouse driver, reset driver if installed. returns number of -// buttons if driver is present. - -extern int mouse_set_limits( int x1, int y1, int x2, int y2 ); -extern void mouse_flush(); // clears all mice events... - -//======================================================================== -extern void mouse_get_pos( int *x, int *y); -extern void mouse_get_delta( int *dx, int *dy ); -extern int mouse_get_btns(); -extern void mouse_set_pos( int x, int y); -extern void mouse_get_cyberman_pos( int *x, int *y ); - -// Returns how long this button has been down since last call. -extern fix mouse_button_down_time(int button); - -// Returns how many times this button has went down since last call. -extern int mouse_button_down_count(int button); - -// Returns 1 if this button is currently down -extern int mouse_button_state(int button); - -#else -// 'Neutered' functions... :-) -#define mouse_init(a) -1 -#define mouse_set_limits(a,b,c,d) -1 -#define mouse_flush() -#define mouse_close() -#define mouse_get_pos(a,b) -#define mouse_get_delta(a,b) -#define mouse_get_btns() 0 -#define mouse_set_pos(a,b) -#define mouse_get_cyberman_pos(a,b) -#define mouse_button_down_time(a) 0 -#define mouse_button_down_count(a) 0 -#define mouse_button_state(a) 0 - -#endif - -#endif - -- 2.39.2