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
41 int joydefs_calibrate_flag = 0;
43 //added 9/6/98 Matt Mueller - not needed at all in linux code but bunches
44 int Joy_is_Sidewinder=0;// of main/* stuff uses it
49 //int t1 = TICKER + 19/4; // Wait 1/4 second...
51 //while( TICKER < t1 );
57 int joycal_message( char * title, char * text )
61 m[0].type = NM_TYPE_TEXT; m[0].text = text;
62 m[1].type = NM_TYPE_MENU; m[1].text = TXT_OK;
63 i = newmenu_do( title, NULL, 2, m, NULL );
69 extern int WriteConfigFile();
71 extern joystick_device j_joystick[MAX_JOY_DEVS];
72 extern joystick_axis j_axis[JOY_MAX_AXES];
73 extern joystick_button j_button[JOY_MAX_BUTTONS];
75 void joydefs_calibrate()
79 int temp_values[JOY_MAX_AXES];
82 //added/killed on 10/17/98 by Hans de Goede for joystick/mouse # fix
83 //-killed- int nsticks = 0;
84 //end this section kill - Hans
86 joydefs_calibrate_flag = 0;
89 nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK );
93 if (j_joystick[0].version) {
94 joycal_message ("No Calibration", "calibration not required for\njoystick v1.x");
98 for (i = 0; i < joy_num_axes; i += 2)
100 sprintf (title, "js%d Calibration", j_axis[i].joydev);
102 sprintf (text, "center joystick %d", j_axis[i].joydev);
103 joycal_message (title, text);
104 joystick_read_raw_axis (JOY_ALL_AXIS, temp_values);
105 j_axis[i].center_val = temp_values[i];
106 j_axis[i + 1].center_val = temp_values[i + 1];
108 sprintf (text, "move joystick %d to the upper left", j_axis[i].joydev);
109 joycal_message (title, text);
110 joystick_read_raw_axis (JOY_ALL_AXIS, temp_values);
111 j_axis[i].min_val = temp_values[i];
112 j_axis[i + 1].min_val = temp_values[i + 1];
114 sprintf (text, "move joystick %d to the lower right", j_axis[i].joydev);
115 joycal_message (title, text);
116 joystick_read_raw_axis (JOY_ALL_AXIS, temp_values);
117 j_axis[i].max_val = temp_values[i];
118 j_axis[i + 1].max_val = temp_values[i + 1];
126 void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem )
129 int oc_type = Config_control_type.intval;
137 cvar_setint(&Config_control_type, i);
139 //added on 10/17/98 by Hans de Goede for joystick/mouse # fix
140 // remap mouse, since "Flightstick Pro", "Thrustmaster FCS"
141 // and "Gravis Gamepad" where removed from the options
142 if (Config_control_type.intval == 2)
143 cvar_setint(&Config_control_type, CONTROL_MOUSE);
144 //end this section addition - Hans
146 if ( (oc_type != Config_control_type.intval) && (Config_control_type.intval == CONTROL_THRUSTMASTER_FCS ) ) {
147 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
150 if (oc_type != Config_control_type.intval) {
151 switch (Config_control_type.intval) {
152 // case CONTROL_NONE:
153 case CONTROL_JOYSTICK:
154 case CONTROL_FLIGHTSTICK_PRO:
155 case CONTROL_THRUSTMASTER_FCS:
156 case CONTROL_GRAVIS_GAMEPAD:
157 // case CONTROL_MOUSE:
158 // case CONTROL_CYBERMAN:
159 joydefs_calibrate_flag = 1;
166 extern ubyte kc_use_external_control;
167 extern ubyte kc_enable_external_control;
168 extern ubyte *kc_external_name;
170 void joydefs_config()
172 //added/changed/killed on 10/17/98 by Hans de Goede for joystick/mouse # fix
173 //-killed- char xtext[128];
174 //-killed- int i, old_masks, masks;
177 //-killed- int nitems;
180 //-killed- nitems = 6;
181 int i, i1=5, j, nitems=7;
182 //end this section kill/change - Hans
184 m[0].type = NM_TYPE_RADIO; m[0].text = "KEYBOARD"; m[0].value = 0; m[0].group = 0;
185 m[1].type = NM_TYPE_RADIO; m[1].text = "JOYSTICK"; m[1].value = 0; m[1].group = 0;
186 m[2].type = NM_TYPE_RADIO; m[2].text = "MOUSE"; m[2].value = 0; m[2].group = 0;
187 m[3].type = NM_TYPE_TEXT; m[3].text="";
188 m[4].type = NM_TYPE_MENU; m[4].text="CUSTOMIZE ABOVE";
189 m[5].type = NM_TYPE_MENU; m[5].text="CUSTOMIZE KEYBOARD";
190 //added on 2/5/99 by Victor Rachels for D1X keys menu
191 m[6].type = NM_TYPE_MENU; m[6].text="CUSTOMIZE D1X KEYS";
192 //end this section addition - VR
194 //added/changed/killed on 10/17/98 by Hans de Goede for joystick/mouse # fix
195 //-killed- m[Config_control_type.intval].value = 1;
200 i = Config_control_type.intval;
201 if(i==CONTROL_MOUSE) i = 2;
204 //end this section change/addition - Hans
206 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 );
208 //added 6-15-99 Owen Evans
209 for (j = 0; j <= 2; j++)
211 cvar_setint(&Config_control_type, j);
212 i = Config_control_type.intval;
213 if (Config_control_type.intval == 2)
214 cvar_setint(&Config_control_type, CONTROL_MOUSE);
219 //added/changed on 10/17/98 by Hans de Goede for joystick/mouse # fix
220 //-killed- kconfig(Config_control_type.intval, m[Config_control_type.intval].text);
221 kconfig (i, m[i].text);
222 //end this section change - Hans
225 kconfig(0, "KEYBOARD");
227 //added on 2/5/99 by Victor Rachels for D1X keys menu
229 kconfig(3, "D1X KEYS");
231 //end this section addition - VR