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-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
16 * Joystick Settings Stuff
56 int joydefs_calibrate_flag = 0;
59 ubyte joydefs_calibrating = 0; // stupid hack all because of silly mouse cursor emulation
66 //delay(250); // changed by allender because 1) more portable
67 // 2) was totally broken on PC
73 int joycal_message( char * title, char * text )
77 MAC(joydefs_calibrating = 1;)
78 m[0].type = NM_TYPE_TEXT; m[0].text = text;
79 m[1].type = NM_TYPE_MENU; m[1].text = TXT_OK;
80 i = newmenu_do( title, NULL, 2, m, NULL );
81 MAC(joydefs_calibrating = 0;)
87 extern int WriteConfigFile();
89 void joydefs_calibrate(void)
92 if ( (Config_control_type!=CONTROL_JOYSTICK) && (Config_control_type!=CONTROL_FLIGHTSTICK_PRO) && (Config_control_type!=CONTROL_THRUSTMASTER_FCS) )
95 if ( (Config_control_type == CONTROL_NONE) || (Config_control_type == CONTROL_MOUSE) )
100 apply_modified_palette();
103 gr_palette_load(gr_palette);
105 joydefs_calibrate2();
116 void joydefs_calibrate2()
120 int org_axis_center[4];
123 int axis_min[4] = { 0, 0, 0, 0 };
124 int axis_cen[4] = { 0, 0, 0, 0 };
125 int axis_max[4] = { 0, 0, 0, 0 };
132 joydefs_calibrate_flag = 0;
134 joy_get_cal_vals(org_axis_min, org_axis_center, org_axis_max);
137 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
140 nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK );
144 masks = joy_get_present_mask();
147 if ( masks == JOY_ALL_AXIS )
155 if (Config_control_type == CONTROL_THRUSTMASTER_FCS)
156 nsticks = 1; //ignore for now the Sidewinder Pro X2 axis
158 if ( nsticks == 2 ) {
159 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
160 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
162 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
163 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
166 if (joycal_message( title, text )) {
167 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
170 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
171 axis_min[0] = temp_values[0];
172 axis_min[1] = temp_values[1];
175 if ( nsticks == 2 ) {
176 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
177 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
179 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
180 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
182 if (joycal_message( title, text)) {
183 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
186 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
187 axis_max[0] = temp_values[0];
188 axis_max[1] = temp_values[1];
191 if ( nsticks == 2 ) {
192 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_CENTER);
193 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
195 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_CENTER);
196 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
198 if (joycal_message( title, text)) {
199 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
202 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
203 axis_cen[0] = temp_values[0];
204 axis_cen[1] = temp_values[1];
205 axis_cen[2] = temp_values[2];
208 // The fcs uses axes 3 for hat, so don't calibrate it.
209 if ( Config_control_type == CONTROL_THRUSTMASTER_FCS ) {
211 //set Y2 axis, which is hat
213 axis_cen[3] = temp_values[3]/2;
214 axis_max[3] = temp_values[3];
217 //if X2 exists, calibrate it (for Sidewinder Pro)
218 if ( kconfig_is_axes_used(2) && (masks & JOY_2_X_AXIS) ) {
219 sprintf( title, "Joystick X2 axis\nLEFT");
220 sprintf( text, "Move joystick X2 axis\nall the way left");
221 if (joycal_message( title, text )) {
222 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
225 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
226 axis_min[2] = temp_values[2];
227 axis_min[3] = temp_values[3];
230 sprintf( title, "Joystick X2 axis\nRIGHT");
231 sprintf( text, "Move joystick X2 axis\nall the way right");
232 if (joycal_message( title, text )) {
233 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
236 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
237 axis_max[2] = temp_values[2];
238 axis_max[3] = temp_values[3];
243 masks = joy_get_present_mask();
245 if ( nsticks == 2 ) {
246 if ( kconfig_is_axes_used(2) || kconfig_is_axes_used(3) ) {
247 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
248 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
249 if (joycal_message( title, text )) {
250 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
253 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
254 axis_min[2] = temp_values[2];
255 axis_min[3] = temp_values[3];
258 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
259 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
260 if (joycal_message( title, text )) {
261 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
264 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
265 axis_max[2] = temp_values[2];
266 axis_max[3] = temp_values[3];
269 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_CENTER);
270 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
271 if (joycal_message( title, text )) {
272 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
275 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
276 axis_cen[2] = temp_values[2];
277 axis_cen[3] = temp_values[3];
282 else if ( (!(masks & JOY_2_X_AXIS)) && (masks & JOY_2_Y_AXIS) ) {
283 if ( kconfig_is_axes_used(3) ) {
284 // A throttle axis!!!!!
285 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_FORWARD);
286 if (joycal_message( title, TXT_MOVE_THROTTLE_F)) {
287 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
290 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
291 axis_min[3] = temp_values[3];
294 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_REVERSE);
295 if (joycal_message( title, TXT_MOVE_THROTTLE_R)) {
296 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
299 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
300 axis_max[3] = temp_values[3];
303 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_CENTER);
304 if (joycal_message( title, TXT_MOVE_THROTTLE_C)) {
305 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
308 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
309 axis_cen[3] = temp_values[3];
315 joy_set_cal_vals(axis_min, axis_cen, axis_max);
320 void joydefs_calibrate2()
324 int org_axis_center[4];
327 int axis_min[4] = { 0, 0, 0, 0 };
328 int axis_cen[4] = { 0, 0, 0, 0 };
329 int axis_max[4] = { 0, 0, 0, 0 };
336 joydefs_calibrate_flag = 0;
338 if ( Config_control_type == CONTROL_THRUSTMASTER_FCS ) {
339 axis_cen[0] = axis_cen[1] = axis_cen[2] = 0;
340 axis_min[0] = axis_min[1] = axis_min[2] = -127;
341 axis_max[0] = axis_max[1] = axis_max[2] = 127;
345 joy_set_cal_vals(axis_min, axis_cen, axis_max);
349 if ( Config_control_type == CONTROL_FLIGHTSTICK_PRO ) // no calibration needed
352 joy_get_cal_vals(org_axis_min, org_axis_center, org_axis_max);
355 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
358 nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK );
362 masks = joy_get_present_mask();
364 if ( masks == JOY_ALL_AXIS )
369 if ( (Config_control_type == CONTROL_THRUSTMASTER_FCS) || (Config_control_type == CONTROL_FLIGHTSTICK_PRO) )
370 nsticks = 1; //ignore for now the Sidewinder Pro X2 axis
372 if ( nsticks == 2 ) {
373 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
374 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
376 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
377 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
380 if (joycal_message( title, text )) {
381 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
384 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
385 axis_min[0] = temp_values[0];
386 axis_min[1] = temp_values[1];
389 if ( nsticks == 2 ) {
390 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
391 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
393 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
394 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
396 if (joycal_message( title, text)) {
397 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
400 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
401 axis_max[0] = temp_values[0];
402 axis_max[1] = temp_values[1];
405 if ( nsticks == 2 ) {
406 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_CENTER);
407 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
409 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_CENTER);
410 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
412 if (joycal_message( title, text)) {
413 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
416 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
417 axis_cen[0] = temp_values[0];
418 axis_cen[1] = temp_values[1];
419 axis_cen[2] = temp_values[2];
422 masks = joy_get_present_mask();
424 if ( nsticks == 2 ) {
425 if ( kconfig_is_axes_used(2) || kconfig_is_axes_used(3) ) {
426 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
427 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
428 if (joycal_message( title, text )) {
429 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
432 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
433 axis_min[2] = temp_values[2];
434 axis_min[3] = temp_values[3];
437 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
438 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
439 if (joycal_message( title, text )) {
440 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
443 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
444 axis_max[2] = temp_values[2];
445 axis_max[3] = temp_values[3];
448 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_CENTER);
449 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
450 if (joycal_message( title, text )) {
451 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
454 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
455 axis_cen[2] = temp_values[2];
456 axis_cen[3] = temp_values[3];
460 if ( kconfig_is_axes_used(3) ) {
461 // A throttle axis!!!!!
462 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_FORWARD);
463 if (joycal_message( title, TXT_MOVE_THROTTLE_F)) {
464 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
467 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
468 axis_min[3] = temp_values[3];
471 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_REVERSE);
472 if (joycal_message( title, TXT_MOVE_THROTTLE_R)) {
473 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
476 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
477 axis_max[3] = temp_values[3];
480 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_CENTER);
481 if (joycal_message( title, TXT_MOVE_THROTTLE_C)) {
482 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
485 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
486 axis_cen[3] = temp_values[3];
490 joy_set_cal_vals(axis_min, axis_cen, axis_max);
497 //char *control_text[CONTROL_MAX_TYPES] = { "Keyboard only", "Joystick", "Flightstick Pro", "Thrustmaster FCS", "Gravis Gamepad", "Mouse", "Cyberman" };
499 #ifndef MACINTOSH // mac will have own verion of this function
501 #define CONTROL_MAX_TYPES_DOS (CONTROL_MAX_TYPES-1) //last item is windows only
503 void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem )
506 int oc_type = Config_control_type;
512 for (i=0; i<CONTROL_MAX_TYPES_DOS; i++ )
513 if (items[i].value) Config_control_type = i;
515 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) {
516 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
519 if (oc_type != Config_control_type) {
520 switch (Config_control_type) {
521 // case CONTROL_NONE:
522 case CONTROL_JOYSTICK:
523 case CONTROL_FLIGHTSTICK_PRO:
524 case CONTROL_THRUSTMASTER_FCS:
525 // case CONTROL_GRAVIS_GAMEPAD:
526 // case CONTROL_MOUSE:
527 // case CONTROL_CYBERMAN:
528 joydefs_calibrate_flag = 1;
535 #else // ifndef MACINTOSH
537 #define MAX_MAC_CONTROL_TYPES 6
539 char *ch_warning = "Choosing this option will\noverride any settings for Descent II\nin the CH control panels. This\noption provides direct programming\nonly. See the readme for details.";
540 char *tm_warning = "Choosing this option might\ncause settings in the Thrustmaster\ncontrol panels to be overridden\ndepending on the direct inhibition\nsetting in that panel.\nSee the readme for details.";
541 char *ms_warning = "When using a Mousestick II,\nbe sure that there is not a stick\nset active for Descent II.\nHaving a stick set active might cause\nundesirable joystick and\nkeyboard behavior. See\nthe readme for detals.";
542 char *joy_warning = "Please use your joystick's\ncontrol panel to customize the\nbuttons and axis for Descent II.\nSee the joystick's manual for\ninstructions.";
544 void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem )
547 int oc_type = Config_control_type;
548 char *warning_text = NULL;
554 for (i=0; i<MAX_MAC_CONTROL_TYPES; i++ )
555 if (items[i].value) Config_control_type = i;
557 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_FLIGHTSTICK_PRO ) ) {
558 warning_text = ch_warning;
561 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) {
562 warning_text = tm_warning;
565 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_GRAVIS_GAMEPAD ) ) {
566 warning_text = ms_warning;
571 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, warning_text );
575 if (oc_type != Config_control_type) {
576 switch (Config_control_type) {
577 case CONTROL_JOYSTICK:
578 case CONTROL_FLIGHTSTICK_PRO:
579 case CONTROL_THRUSTMASTER_FCS:
580 case CONTROL_GRAVIS_GAMEPAD: // this really means a firebird or mousestick
581 joydefs_calibrate_flag = 1;
584 joydefs_set_type( Config_control_type );
591 extern ubyte kc_use_external_control;
592 extern ubyte kc_enable_external_control;
593 extern ubyte *kc_external_name;
600 void joydefs_config()
602 int i, old_masks, masks,nitems;
608 m[0].type = NM_TYPE_RADIO; m[0].text = CONTROL_TEXT(0); m[0].value = 0; m[0].group = 0;
609 m[1].type = NM_TYPE_RADIO; m[1].text = CONTROL_TEXT(1); m[1].value = 0; m[1].group = 0;
610 m[2].type = NM_TYPE_RADIO; m[2].text = CONTROL_TEXT(2); m[2].value = 0; m[2].group = 0;
611 m[3].type = NM_TYPE_RADIO; m[3].text = CONTROL_TEXT(3); m[3].value = 0; m[3].group = 0;
612 // change the text for the thrustmaster
613 m[3].text = "Thrustmaster";
614 m[4].type = NM_TYPE_RADIO; m[4].text = CONTROL_TEXT(4); m[4].value = 0; m[4].group = 0;
615 // change the text of the gravis gamepad to be the mac gravis sticks
616 m[4].text = "Gravis Firebird/MouseStick II";
617 m[5].type = NM_TYPE_RADIO; m[5].text = CONTROL_TEXT(5); m[5].value = 0; m[5].group = 0;
619 m[6].type = NM_TYPE_MENU; m[6].text=TXT_CUST_ABOVE;
620 m[7].type = NM_TYPE_TEXT; m[7].text="";
621 m[8].type = NM_TYPE_SLIDER; m[8].text=TXT_JOYS_SENSITIVITY; m[8].value=Config_joystick_sensitivity; m[8].min_value =0; m[8].max_value = 8;
622 m[9].type = NM_TYPE_TEXT; m[9].text="";
623 m[10].type = NM_TYPE_MENU; m[10].text=TXT_CUST_KEYBOARD;
626 m[Config_control_type].value = 1;
628 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 );
629 Config_joystick_sensitivity = m[8].value;
634 for (i=0; i<4; i++ ) {
635 if (kconfig_is_axes_used(i))
638 if ( Config_control_type==0 )
640 Config_control_type=0;
641 else if ( Config_control_type == 1) // this is just a joystick
642 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, joy_warning );
643 else if ( Config_control_type<5 ) {
646 if (Config_control_type == 3)
647 strcpy(title, "Thrustmaster");
648 else if (Config_control_type == 4)
649 strcpy(title, "Gravis Firebird/Mousestick II");
651 strcpy(title, CONTROL_TEXT(Config_control_type) );
656 kconfig(2, CONTROL_TEXT(Config_control_type) );
659 for (i=0; i<4; i++ ) {
660 if (kconfig_is_axes_used(i))
664 switch (Config_control_type) {
665 case CONTROL_JOYSTICK:
666 case CONTROL_FLIGHTSTICK_PRO:
667 case CONTROL_THRUSTMASTER_FCS:
668 case CONTROL_GRAVIS_GAMEPAD:
670 for (i=0; i<4; i++ ) {
671 if ( (masks&(1<<i)) && (!(old_masks&(1<<i))))
672 joydefs_calibrate_flag = 1;
680 kconfig(0, TXT_KEYBOARD);
686 switch (Config_control_type) {
687 case CONTROL_JOYSTICK:
688 // case CONTROL_FLIGHTSTICK_PRO:
689 case CONTROL_THRUSTMASTER_FCS:
690 case CONTROL_GRAVIS_GAMEPAD:
691 if ( joydefs_calibrate_flag )
698 // silly routine to tell the joystick handler which type of control
700 void joydefs_set_type(ubyte type)
706 case CONTROL_NONE: joy_type = JOY_AS_NONE; break;
707 case CONTROL_JOYSTICK: joy_type = JOY_AS_MOUSE; break;
708 case CONTROL_FLIGHTSTICK_PRO: joy_type = JOY_AS_JOYMANAGER; break;
709 case CONTROL_THRUSTMASTER_FCS: joy_type = JOY_AS_THRUSTMASTER; break;
710 case CONTROL_GRAVIS_GAMEPAD: joy_type = JOY_AS_MOUSESTICK; break;
711 case CONTROL_MOUSE: joy_type = JOY_AS_MOUSE; break;
713 joy_set_type(joy_type);
716 #else // #ifdef MACINTOSH
718 //NOTE: UNIX/DOS VERSION
719 void joydefs_config()
721 int i, old_masks, masks,nitems;
728 m[0].type = NM_TYPE_RADIO; m[0].text = CONTROL_TEXT(0); m[0].value = 0; m[0].group = 0;
729 m[1].type = NM_TYPE_RADIO; m[1].text = CONTROL_TEXT(1); m[1].value = 0; m[1].group = 0;
730 m[2].type = NM_TYPE_RADIO; m[2].text = CONTROL_TEXT(2); m[2].value = 0; m[2].group = 0;
731 m[3].type = NM_TYPE_RADIO; m[3].text = CONTROL_TEXT(3); m[3].value = 0; m[3].group = 0;
732 m[4].type = NM_TYPE_RADIO; m[4].text = CONTROL_TEXT(4); m[4].value = 0; m[4].group = 0;
733 m[5].type = NM_TYPE_RADIO; m[5].text = CONTROL_TEXT(5); m[5].value = 0; m[5].group = 0;
734 m[6].type = NM_TYPE_RADIO; m[6].text = CONTROL_TEXT(6); m[6].value = 0; m[6].group = 0;
736 m[ 7].type = NM_TYPE_MENU; m[ 7].text=TXT_CUST_ABOVE;
737 m[ 8].type = NM_TYPE_TEXT; m[ 8].text="";
738 m[ 9].type = NM_TYPE_SLIDER; m[ 9].text=TXT_JOYS_SENSITIVITY; m[9].value=Config_joystick_sensitivity; m[9].min_value =0; m[9].max_value = 8;
739 m[10].type = NM_TYPE_TEXT; m[10].text="";
740 m[11].type = NM_TYPE_MENU; m[11].text=TXT_CUST_KEYBOARD;
742 m[Config_control_type].value = 1;
744 if ( kc_use_external_control ) {
745 sprintf( xtext, "Enable %s", kc_external_name );
746 m[12].type = NM_TYPE_CHECK; m[12].text = xtext; m[12].value = kc_enable_external_control;
750 m[nitems].type = NM_TYPE_MENU; m[nitems].text="CUSTOMIZE D2X KEYS"; nitems++;
752 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 );
753 Config_joystick_sensitivity = m[9].value;
758 for (i=0; i<4; i++ ) {
759 if (kconfig_is_axes_used(i))
762 if ( Config_control_type==0 )
763 kconfig(0, TXT_KEYBOARD);
764 else if ( Config_control_type<5 )
765 kconfig(1, CONTROL_TEXT(Config_control_type) );
767 kconfig(2, CONTROL_TEXT(Config_control_type) );
770 for (i=0; i<4; i++ ) {
771 if (kconfig_is_axes_used(i))
775 switch (Config_control_type) {
776 case CONTROL_JOYSTICK:
777 case CONTROL_FLIGHTSTICK_PRO:
778 case CONTROL_THRUSTMASTER_FCS:
780 for (i=0; i<4; i++ ) {
781 if ( (masks&(1<<i)) && (!(old_masks&(1<<i))))
782 joydefs_calibrate_flag = 1;
790 kconfig(0, TXT_KEYBOARD);
793 kconfig(4, "D2X KEYS");
797 if ( kc_use_external_control ) {
798 kc_enable_external_control = m[12].value;
803 switch (Config_control_type) {
804 case CONTROL_JOYSTICK:
805 case CONTROL_FLIGHTSTICK_PRO:
806 case CONTROL_THRUSTMASTER_FCS:
807 if ( joydefs_calibrate_flag )
814 #endif // ifdef MACINTOSH
816 #else //ifndef WINDOWS
818 void joydef_menuset_win(int nitems, newmenu_item * items, int *last_key, int citem )
821 int oc_type = Config_control_type;
823 Int3(); //need to make this code work for windows
829 for (i=0; i<CONTROL_MAX_TYPES; i++ )
830 if (items[i].value) Config_control_type = i;
832 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) {
833 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
836 if (oc_type != Config_control_type) {
837 switch (Config_control_type) {
838 // case CONTROL_NONE:
839 case CONTROL_JOYSTICK:
840 case CONTROL_FLIGHTSTICK_PRO:
841 case CONTROL_THRUSTMASTER_FCS:
842 // case CONTROL_GRAVIS_GAMEPAD:
843 // case CONTROL_MOUSE:
844 // case CONTROL_CYBERMAN:
845 joydefs_calibrate_flag = 1;
852 //NOTE: WINDOWS VERSION
853 void joydefs_config()
855 int i, old_masks, masks,nitems;
860 Int3(); //this routine really needs to be cleaned up
864 m[0].type = NM_TYPE_RADIO; m[0].text = CONTROL_TEXT(0); m[0].value = 0; m[0].group = 0;
865 m[1].type = NM_TYPE_RADIO; m[1].text = CONTROL_TEXT(1); m[1].value = 0; m[1].group = 0;
866 m[2].type = NM_TYPE_RADIO; m[2].text = CONTROL_TEXT(2); m[2].value = 0; m[2].group = 0;
867 m[3].type = NM_TYPE_RADIO; m[3].text = CONTROL_TEXT(3); m[3].value = 0; m[3].group = 0;
868 m[4].type = NM_TYPE_RADIO; m[4].text = CONTROL_TEXT(4); m[4].value = 0; m[4].group = 0;
869 m[5].type = NM_TYPE_RADIO; m[5].text = CONTROL_TEXT(5); m[5].value = 0; m[5].group = 0;
870 m[6].type = NM_TYPE_RADIO; m[6].text = CONTROL_TEXT(6); m[6].value = 0; m[6].group = 0;
871 m[7].type = NM_TYPE_RADIO; m[7].text = CONTROL_TEXT(7); m[7].value = 0; m[7].group = 0;
873 m[8].type = NM_TYPE_MENU; m[8].text=TXT_CUST_ABOVE;
874 m[9].type = NM_TYPE_TEXT; m[9].text="";
875 m[10].type = NM_TYPE_SLIDER; m[10].text=TXT_JOYS_SENSITIVITY; m[10].value=Config_joystick_sensitivity; m[10].min_value =0; m[10].max_value = 8;
876 m[11].type = NM_TYPE_TEXT; m[11].text="";
877 m[12].type = NM_TYPE_MENU; m[12].text=TXT_CUST_KEYBOARD;
879 m[Config_control_type].value = 1;
881 if ( kc_use_external_control ) {
882 sprintf( xtext, "Enable %s", kc_external_name );
883 m[13].type = NM_TYPE_CHECK; m[13].text = xtext; m[13].value = kc_enable_external_control;
887 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_win, i1 );
888 Config_joystick_sensitivity = m[10].value;
893 for (i=0; i<4; i++ ) {
894 if (kconfig_is_axes_used(i))
897 if ( Config_control_type==0 )
899 Config_control_type=0;
900 else if ( Config_control_type<5 )
901 kconfig(1, CONTROL_TEXT(Config_control_type) );
903 kconfig(2, CONTROL_TEXT(Config_control_type) );
906 for (i=0; i<4; i++ ) {
907 if (kconfig_is_axes_used(i))
911 switch (Config_control_type) {
912 case CONTROL_JOYSTICK:
913 case CONTROL_FLIGHTSTICK_PRO:
914 case CONTROL_THRUSTMASTER_FCS:
916 for (i=0; i<4; i++ ) {
917 if ( (masks&(1<<i)) && (!(old_masks&(1<<i))))
918 joydefs_calibrate_flag = 1;
926 kconfig(0, TXT_KEYBOARD);
930 if ( kc_use_external_control ) {
931 kc_enable_external_control = m[13].value;
936 switch (Config_control_type) {
937 case CONTROL_JOYSTICK:
938 case CONTROL_FLIGHTSTICK_PRO:
939 case CONTROL_THRUSTMASTER_FCS:
940 if ( joydefs_calibrate_flag )
947 #endif //ifndef WINDOWS