2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
16 * Linux joystick support
52 int joydefs_calibrate_flag = 0;
54 //added 9/6/98 Matt Mueller - not needed at all in linux code but bunches
55 int Joy_is_Sidewinder=0;// of main/* stuff uses it
60 //int t1 = TICKER + 19/4; // Wait 1/4 second...
62 //while( TICKER < t1 );
68 int joycal_message( char * title, char * text )
72 m[0].type = NM_TYPE_TEXT; m[0].text = text;
73 m[1].type = NM_TYPE_MENU; m[1].text = TXT_OK;
74 i = newmenu_do( title, NULL, 2, m, NULL );
80 extern int WriteConfigFile();
82 extern joystick_device j_joystick[MAX_JOY_DEVS];
83 extern joystick_axis j_axis[JOY_MAX_AXES];
84 extern joystick_button j_button[JOY_MAX_BUTTONS];
86 void joydefs_calibrate()
90 int temp_values[JOY_MAX_AXES];
93 //added/killed on 10/17/98 by Hans de Goede for joystick/mouse # fix
94 //-killed- int nsticks = 0;
95 //end this section kill - Hans
97 joydefs_calibrate_flag = 0;
100 nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK );
104 if (j_joystick[0].version) {
105 joycal_message ("No Calibration", "calibration not required for\njoystick v1.x");
109 for (i = 0; i < joy_num_axes; i += 2)
111 sprintf (title, "js%d Calibration", j_axis[i].joydev);
113 sprintf (text, "center joystick %d", j_axis[i].joydev);
114 joycal_message (title, text);
115 joystick_read_raw_axis (JOY_ALL_AXIS, temp_values);
116 j_axis[i].center_val = temp_values[i];
117 j_axis[i + 1].center_val = temp_values[i + 1];
119 sprintf (text, "move joystick %d to the upper left", j_axis[i].joydev);
120 joycal_message (title, text);
121 joystick_read_raw_axis (JOY_ALL_AXIS, temp_values);
122 j_axis[i].min_val = temp_values[i];
123 j_axis[i + 1].min_val = temp_values[i + 1];
125 sprintf (text, "move joystick %d to the lower right", j_axis[i].joydev);
126 joycal_message (title, text);
127 joystick_read_raw_axis (JOY_ALL_AXIS, temp_values);
128 j_axis[i].max_val = temp_values[i];
129 j_axis[i + 1].max_val = temp_values[i + 1];
137 void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem )
140 int oc_type = Config_control_type.intval;
148 cvar_setint(&Config_control_type, i);
150 //added on 10/17/98 by Hans de Goede for joystick/mouse # fix
151 // remap mouse, since "Flightstick Pro", "Thrustmaster FCS"
152 // and "Gravis Gamepad" where removed from the options
153 if (Config_control_type.intval == 2)
154 cvar_setint(&Config_control_type, CONTROL_MOUSE);
155 //end this section addition - Hans
157 if ( (oc_type != Config_control_type.intval) && (Config_control_type.intval == CONTROL_THRUSTMASTER_FCS ) ) {
158 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
161 if (oc_type != Config_control_type.intval) {
162 switch (Config_control_type.intval) {
163 // case CONTROL_NONE:
164 case CONTROL_JOYSTICK:
165 case CONTROL_FLIGHTSTICK_PRO:
166 case CONTROL_THRUSTMASTER_FCS:
167 case CONTROL_GRAVIS_GAMEPAD:
168 // case CONTROL_MOUSE:
169 // case CONTROL_CYBERMAN:
170 joydefs_calibrate_flag = 1;
177 extern ubyte kc_use_external_control;
178 extern ubyte kc_enable_external_control;
179 extern ubyte *kc_external_name;
181 void joydefs_config()
183 //added/changed/killed on 10/17/98 by Hans de Goede for joystick/mouse # fix
184 //-killed- char xtext[128];
185 //-killed- int i, old_masks, masks;
188 //-killed- int nitems;
191 //-killed- nitems = 6;
192 int i, i1=5, j, nitems=7;
193 //end this section kill/change - Hans
195 m[0].type = NM_TYPE_RADIO; m[0].text = "KEYBOARD"; m[0].value = 0; m[0].group = 0;
196 m[1].type = NM_TYPE_RADIO; m[1].text = "JOYSTICK"; m[1].value = 0; m[1].group = 0;
197 m[2].type = NM_TYPE_RADIO; m[2].text = "MOUSE"; m[2].value = 0; m[2].group = 0;
198 m[3].type = NM_TYPE_TEXT; m[3].text="";
199 m[4].type = NM_TYPE_MENU; m[4].text="CUSTOMIZE ABOVE";
200 m[5].type = NM_TYPE_MENU; m[5].text="CUSTOMIZE KEYBOARD";
201 //added on 2/5/99 by Victor Rachels for D1X keys menu
202 m[6].type = NM_TYPE_MENU; m[6].text="CUSTOMIZE D1X KEYS";
203 //end this section addition - VR
205 //added/changed/killed on 10/17/98 by Hans de Goede for joystick/mouse # fix
206 //-killed- m[Config_control_type.intval].value = 1;
211 i = Config_control_type.intval;
212 if(i==CONTROL_MOUSE) i = 2;
215 //end this section change/addition - Hans
217 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 );
219 //added 6-15-99 Owen Evans
220 for (j = 0; j <= 2; j++)
222 cvar_setint(&Config_control_type, j);
223 i = Config_control_type.intval;
224 if (Config_control_type.intval == 2)
225 cvar_setint(&Config_control_type, CONTROL_MOUSE);
230 //added/changed on 10/17/98 by Hans de Goede for joystick/mouse # fix
231 //-killed- kconfig(Config_control_type.intval, m[Config_control_type.intval].text);
232 kconfig (i, m[i].text);
233 //end this section change - Hans
236 kconfig(0, "KEYBOARD");
238 //added on 2/5/99 by Victor Rachels for D1X keys menu
240 kconfig(3, "D1X KEYS");
242 //end this section addition - VR