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.
15 #pragma off (unreferenced)
16 static char rcsid[] = "$Id: joydefs.c,v 1.1.1.1 2001-01-19 03:30:14 bradleyb Exp $";
17 #pragma on (unreferenced)
45 int joydefs_calibrate_flag = 0;
48 ubyte joydefs_calibrating = 0; // stupid hack all because of silly mouse cursor emulation
55 delay(250); // changed by allender because 1) more portable
56 // 2) was totally broken on PC
62 int joycal_message( char * title, char * text )
66 MAC(joydefs_calibrating = 1;)
67 m[0].type = NM_TYPE_TEXT; m[0].text = text;
68 m[1].type = NM_TYPE_MENU; m[1].text = TXT_OK;
69 i = newmenu_do( title, NULL, 2, m, NULL );
70 MAC(joydefs_calibrating = 0;)
76 extern int WriteConfigFile();
78 void joydefs_calibrate(void)
81 if ( (Config_control_type!=CONTROL_JOYSTICK) && (Config_control_type!=CONTROL_FLIGHTSTICK_PRO) && (Config_control_type!=CONTROL_THRUSTMASTER_FCS) )
84 if ( (Config_control_type == CONTROL_NONE) || (Config_control_type == CONTROL_MOUSE) )
89 apply_modified_palette();
92 gr_palette_load(gr_palette);
102 void joydefs_calibrate2()
106 int org_axis_center[4];
109 int axis_min[4] = { 0, 0, 0, 0 };
110 int axis_cen[4] = { 0, 0, 0, 0 };
111 int axis_max[4] = { 0, 0, 0, 0 };
118 joydefs_calibrate_flag = 0;
120 joy_get_cal_vals(org_axis_min, org_axis_center, org_axis_max);
123 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
126 nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK );
130 masks = joy_get_present_mask();
133 if ( masks == JOY_ALL_AXIS )
141 if (Config_control_type == CONTROL_THRUSTMASTER_FCS)
142 nsticks = 1; //ignore for now the Sidewinder Pro X2 axis
144 if ( nsticks == 2 ) {
145 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
146 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
148 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
149 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
152 if (joycal_message( title, text )) {
153 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
156 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
157 axis_min[0] = temp_values[0];
158 axis_min[1] = temp_values[1];
161 if ( nsticks == 2 ) {
162 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
163 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
165 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
166 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
168 if (joycal_message( title, text)) {
169 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
172 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
173 axis_max[0] = temp_values[0];
174 axis_max[1] = temp_values[1];
177 if ( nsticks == 2 ) {
178 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_CENTER);
179 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
181 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_CENTER);
182 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
184 if (joycal_message( title, text)) {
185 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
188 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
189 axis_cen[0] = temp_values[0];
190 axis_cen[1] = temp_values[1];
191 axis_cen[2] = temp_values[2];
194 // The fcs uses axes 3 for hat, so don't calibrate it.
195 if ( Config_control_type == CONTROL_THRUSTMASTER_FCS ) {
197 //set Y2 axis, which is hat
199 axis_cen[3] = temp_values[3]/2;
200 axis_max[3] = temp_values[3];
203 //if X2 exists, calibrate it (for Sidewinder Pro)
204 if ( kconfig_is_axes_used(2) && (masks & JOY_2_X_AXIS) ) {
205 sprintf( title, "Joystick X2 axis\nLEFT");
206 sprintf( text, "Move joystick X2 axis\nall the way left");
207 if (joycal_message( title, text )) {
208 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
211 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
212 axis_min[2] = temp_values[2];
213 axis_min[3] = temp_values[3];
216 sprintf( title, "Joystick X2 axis\nRIGHT");
217 sprintf( text, "Move joystick X2 axis\nall the way right");
218 if (joycal_message( title, text )) {
219 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
222 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
223 axis_max[2] = temp_values[2];
224 axis_max[3] = temp_values[3];
229 masks = joy_get_present_mask();
231 if ( nsticks == 2 ) {
232 if ( kconfig_is_axes_used(2) || kconfig_is_axes_used(3) ) {
233 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
234 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
235 if (joycal_message( title, text )) {
236 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
239 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
240 axis_min[2] = temp_values[2];
241 axis_min[3] = temp_values[3];
244 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
245 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
246 if (joycal_message( title, text )) {
247 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
250 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
251 axis_max[2] = temp_values[2];
252 axis_max[3] = temp_values[3];
255 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_CENTER);
256 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
257 if (joycal_message( title, text )) {
258 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
261 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
262 axis_cen[2] = temp_values[2];
263 axis_cen[3] = temp_values[3];
268 else if ( (!(masks & JOY_2_X_AXIS)) && (masks & JOY_2_Y_AXIS) ) {
269 if ( kconfig_is_axes_used(3) ) {
270 // A throttle axis!!!!!
271 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_FORWARD);
272 if (joycal_message( title, TXT_MOVE_THROTTLE_F)) {
273 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
276 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
277 axis_min[3] = temp_values[3];
280 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_REVERSE);
281 if (joycal_message( title, TXT_MOVE_THROTTLE_R)) {
282 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
285 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
286 axis_max[3] = temp_values[3];
289 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_CENTER);
290 if (joycal_message( title, TXT_MOVE_THROTTLE_C)) {
291 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
294 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
295 axis_cen[3] = temp_values[3];
301 joy_set_cal_vals(axis_min, axis_cen, axis_max);
306 void joydefs_calibrate2()
310 int org_axis_center[4];
313 int axis_min[4] = { 0, 0, 0, 0 };
314 int axis_cen[4] = { 0, 0, 0, 0 };
315 int axis_max[4] = { 0, 0, 0, 0 };
322 joydefs_calibrate_flag = 0;
324 if ( Config_control_type == CONTROL_THRUSTMASTER_FCS ) {
325 axis_cen[0] = axis_cen[1] = axis_cen[2] = 0;
326 axis_min[0] = axis_min[1] = axis_min[2] = -127;
327 axis_max[0] = axis_max[1] = axis_max[2] = 127;
331 joy_set_cal_vals(axis_min, axis_cen, axis_max);
335 if ( Config_control_type == CONTROL_FLIGHTSTICK_PRO ) // no calibration needed
338 joy_get_cal_vals(org_axis_min, org_axis_center, org_axis_max);
341 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
344 nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK );
348 masks = joy_get_present_mask();
350 if ( masks == JOY_ALL_AXIS )
355 if ( (Config_control_type == CONTROL_THRUSTMASTER_FCS) || (Config_control_type == CONTROL_FLIGHTSTICK_PRO) )
356 nsticks = 1; //ignore for now the Sidewinder Pro X2 axis
358 if ( nsticks == 2 ) {
359 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
360 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
362 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
363 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
366 if (joycal_message( title, text )) {
367 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
370 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
371 axis_min[0] = temp_values[0];
372 axis_min[1] = temp_values[1];
375 if ( nsticks == 2 ) {
376 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
377 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
379 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
380 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
382 if (joycal_message( title, text)) {
383 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
386 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
387 axis_max[0] = temp_values[0];
388 axis_max[1] = temp_values[1];
391 if ( nsticks == 2 ) {
392 sprintf( title, "%s #1\n%s", TXT_JOYSTICK, TXT_CENTER);
393 sprintf( text, "%s #1 %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
395 sprintf( title, "%s\n%s", TXT_JOYSTICK, TXT_CENTER);
396 sprintf( text, "%s %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
398 if (joycal_message( title, text)) {
399 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
402 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
403 axis_cen[0] = temp_values[0];
404 axis_cen[1] = temp_values[1];
405 axis_cen[2] = temp_values[2];
408 masks = joy_get_present_mask();
410 if ( nsticks == 2 ) {
411 if ( kconfig_is_axes_used(2) || kconfig_is_axes_used(3) ) {
412 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_UPPER_LEFT);
413 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_UL);
414 if (joycal_message( title, text )) {
415 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
418 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
419 axis_min[2] = temp_values[2];
420 axis_min[3] = temp_values[3];
423 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_LOWER_RIGHT);
424 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_LR);
425 if (joycal_message( title, text )) {
426 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
429 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
430 axis_max[2] = temp_values[2];
431 axis_max[3] = temp_values[3];
434 sprintf( title, "%s #2\n%s", TXT_JOYSTICK, TXT_CENTER);
435 sprintf( text, "%s #2 %s", TXT_MOVE_JOYSTICK, TXT_TO_C);
436 if (joycal_message( title, text )) {
437 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
440 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
441 axis_cen[2] = temp_values[2];
442 axis_cen[3] = temp_values[3];
446 if ( kconfig_is_axes_used(3) ) {
447 // A throttle axis!!!!!
448 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_FORWARD);
449 if (joycal_message( title, TXT_MOVE_THROTTLE_F)) {
450 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
453 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
454 axis_min[3] = temp_values[3];
457 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_REVERSE);
458 if (joycal_message( title, TXT_MOVE_THROTTLE_R)) {
459 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
462 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
463 axis_max[3] = temp_values[3];
466 sprintf( title, "%s\n%s", TXT_THROTTLE, TXT_CENTER);
467 if (joycal_message( title, TXT_MOVE_THROTTLE_C)) {
468 joy_set_cal_vals(org_axis_min, org_axis_center, org_axis_max);
471 joystick_read_raw_axis( JOY_ALL_AXIS, temp_values );
472 axis_cen[3] = temp_values[3];
476 joy_set_cal_vals(axis_min, axis_cen, axis_max);
483 //char *control_text[CONTROL_MAX_TYPES] = { "Keyboard only", "Joystick", "Flightstick Pro", "Thrustmaster FCS", "Gravis Gamepad", "Mouse", "Cyberman" };
485 #ifndef MACINTOSH // mac will have own verion of this function
487 #define CONTROL_MAX_TYPES_DOS (CONTROL_MAX_TYPES-1) //last item is windows only
489 void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem )
492 int oc_type = Config_control_type;
498 for (i=0; i<CONTROL_MAX_TYPES_DOS; i++ )
499 if (items[i].value) Config_control_type = i;
501 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) {
502 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
505 if (oc_type != Config_control_type) {
506 switch (Config_control_type) {
507 // case CONTROL_NONE:
508 case CONTROL_JOYSTICK:
509 case CONTROL_FLIGHTSTICK_PRO:
510 case CONTROL_THRUSTMASTER_FCS:
511 // case CONTROL_GRAVIS_GAMEPAD:
512 // case CONTROL_MOUSE:
513 // case CONTROL_CYBERMAN:
514 joydefs_calibrate_flag = 1;
521 #else // ifndef MACINTOSH
523 #define MAX_MAC_CONTROL_TYPES 6
525 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.";
526 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.";
527 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.";
528 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.";
530 void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem )
533 int oc_type = Config_control_type;
534 char *warning_text = NULL;
540 for (i=0; i<MAX_MAC_CONTROL_TYPES; i++ )
541 if (items[i].value) Config_control_type = i;
543 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_FLIGHTSTICK_PRO ) ) {
544 warning_text = ch_warning;
547 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) {
548 warning_text = tm_warning;
551 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_GRAVIS_GAMEPAD ) ) {
552 warning_text = ms_warning;
557 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, warning_text );
561 if (oc_type != Config_control_type) {
562 switch (Config_control_type) {
563 case CONTROL_JOYSTICK:
564 case CONTROL_FLIGHTSTICK_PRO:
565 case CONTROL_THRUSTMASTER_FCS:
566 case CONTROL_GRAVIS_GAMEPAD: // this really means a firebird or mousestick
567 joydefs_calibrate_flag = 1;
570 joydefs_set_type( Config_control_type );
577 extern ubyte kc_use_external_control;
578 extern ubyte kc_enable_external_control;
579 extern ubyte *kc_external_name;
586 void joydefs_config()
588 int i, old_masks, masks,nitems;
594 m[0].type = NM_TYPE_RADIO; m[0].text = CONTROL_TEXT(0); m[0].value = 0; m[0].group = 0;
595 m[1].type = NM_TYPE_RADIO; m[1].text = CONTROL_TEXT(1); m[1].value = 0; m[1].group = 0;
596 m[2].type = NM_TYPE_RADIO; m[2].text = CONTROL_TEXT(2); m[2].value = 0; m[2].group = 0;
597 m[3].type = NM_TYPE_RADIO; m[3].text = CONTROL_TEXT(3); m[3].value = 0; m[3].group = 0;
598 // change the text for the thrustmaster
599 m[3].text = "Thrustmaster";
600 m[4].type = NM_TYPE_RADIO; m[4].text = CONTROL_TEXT(4); m[4].value = 0; m[4].group = 0;
601 // change the text of the gravis gamepad to be the mac gravis sticks
602 m[4].text = "Gravis Firebird/MouseStick II";
603 m[5].type = NM_TYPE_RADIO; m[5].text = CONTROL_TEXT(5); m[5].value = 0; m[5].group = 0;
606 m[6].type = NM_TYPE_MENU; m[6].text=TXT_CUST_ABOVE;
607 m[7].type = NM_TYPE_TEXT; m[7].text="";
608 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;
609 m[9].type = NM_TYPE_TEXT; m[9].text="";
610 m[10].type = NM_TYPE_MENU; m[10].text=TXT_CUST_KEYBOARD;
613 m[Config_control_type].value = 1;
615 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 );
616 Config_joystick_sensitivity = m[8].value;
621 for (i=0; i<4; i++ ) {
622 if (kconfig_is_axes_used(i))
625 if ( Config_control_type==0 )
627 Config_control_type=0;
628 else if ( Config_control_type == 1) // this is just a joystick
629 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, joy_warning );
630 else if ( Config_control_type<5 ) {
634 if (Config_control_type == 3)
635 strcpy(title, "Thrustmaster");
636 else if (Config_control_type == 4)
637 strcpy(title, "Gravis Firebird/Mousestick II");
639 strcpy(title, CONTROL_TEXT(Config_control_type) );
644 kconfig(2, CONTROL_TEXT(Config_control_type) );
647 for (i=0; i<4; i++ ) {
648 if (kconfig_is_axes_used(i))
652 switch (Config_control_type) {
653 case CONTROL_JOYSTICK:
654 case CONTROL_FLIGHTSTICK_PRO:
655 case CONTROL_THRUSTMASTER_FCS:
656 case CONTROL_GRAVIS_GAMEPAD:
658 for (i=0; i<4; i++ ) {
659 if ( (masks&(1<<i)) && (!(old_masks&(1<<i))))
660 joydefs_calibrate_flag = 1;
668 kconfig(0, TXT_KEYBOARD);
674 switch (Config_control_type) {
675 case CONTROL_JOYSTICK:
676 // case CONTROL_FLIGHTSTICK_PRO:
677 case CONTROL_THRUSTMASTER_FCS:
678 case CONTROL_GRAVIS_GAMEPAD:
679 if ( joydefs_calibrate_flag )
686 // silly routine to tell the joystick handler which type of control
688 void joydefs_set_type(ubyte type)
694 case CONTROL_NONE: joy_type = JOY_AS_NONE; break;
695 case CONTROL_JOYSTICK: joy_type = JOY_AS_MOUSE; break;
696 case CONTROL_FLIGHTSTICK_PRO: joy_type = JOY_AS_JOYMANAGER; break;
697 case CONTROL_THRUSTMASTER_FCS: joy_type = JOY_AS_THRUSTMASTER; break;
698 case CONTROL_GRAVIS_GAMEPAD: joy_type = JOY_AS_MOUSESTICK; break;
699 case CONTROL_MOUSE: joy_type = JOY_AS_MOUSE; break;
701 joy_set_type(joy_type);
704 #else // #ifdef MACINTOSH
707 void joydefs_config()
709 int i, old_masks, masks,nitems;
716 m[0].type = NM_TYPE_RADIO; m[0].text = CONTROL_TEXT(0); m[0].value = 0; m[0].group = 0;
717 m[1].type = NM_TYPE_RADIO; m[1].text = CONTROL_TEXT(1); m[1].value = 0; m[1].group = 0;
718 m[2].type = NM_TYPE_RADIO; m[2].text = CONTROL_TEXT(2); m[2].value = 0; m[2].group = 0;
719 m[3].type = NM_TYPE_RADIO; m[3].text = CONTROL_TEXT(3); m[3].value = 0; m[3].group = 0;
720 m[4].type = NM_TYPE_RADIO; m[4].text = CONTROL_TEXT(4); m[4].value = 0; m[4].group = 0;
721 m[5].type = NM_TYPE_RADIO; m[5].text = CONTROL_TEXT(5); m[5].value = 0; m[5].group = 0;
722 m[6].type = NM_TYPE_RADIO; m[6].text = CONTROL_TEXT(6); m[6].value = 0; m[6].group = 0;
724 m[ 7].type = NM_TYPE_MENU; m[ 7].text=TXT_CUST_ABOVE;
725 m[ 8].type = NM_TYPE_TEXT; m[ 8].text="";
726 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;
727 m[10].type = NM_TYPE_TEXT; m[10].text="";
728 m[11].type = NM_TYPE_MENU; m[11].text=TXT_CUST_KEYBOARD;
730 m[Config_control_type].value = 1;
732 if ( kc_use_external_control ) {
733 sprintf( xtext, "Enable %s", kc_external_name );
734 m[12].type = NM_TYPE_CHECK; m[12].text = xtext; m[12].value = kc_enable_external_control;
738 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1 );
739 Config_joystick_sensitivity = m[9].value;
744 for (i=0; i<4; i++ ) {
745 if (kconfig_is_axes_used(i))
748 if ( Config_control_type==0 )
749 kconfig(0, TXT_KEYBOARD);
750 else if ( Config_control_type<5 )
751 kconfig(1, CONTROL_TEXT(Config_control_type) );
753 kconfig(2, CONTROL_TEXT(Config_control_type) );
756 for (i=0; i<4; i++ ) {
757 if (kconfig_is_axes_used(i))
761 switch (Config_control_type) {
762 case CONTROL_JOYSTICK:
763 case CONTROL_FLIGHTSTICK_PRO:
764 case CONTROL_THRUSTMASTER_FCS:
766 for (i=0; i<4; i++ ) {
767 if ( (masks&(1<<i)) && (!(old_masks&(1<<i))))
768 joydefs_calibrate_flag = 1;
776 kconfig(0, TXT_KEYBOARD);
780 if ( kc_use_external_control ) {
781 kc_enable_external_control = m[12].value;
786 switch (Config_control_type) {
787 case CONTROL_JOYSTICK:
788 case CONTROL_FLIGHTSTICK_PRO:
789 case CONTROL_THRUSTMASTER_FCS:
790 if ( joydefs_calibrate_flag )
797 #endif // ifdef MACINTOSH
799 #else //ifndef WINDOWS
801 void joydef_menuset_win(int nitems, newmenu_item * items, int *last_key, int citem )
804 int oc_type = Config_control_type;
806 Int3(); //need to make this code work for windows
812 for (i=0; i<CONTROL_MAX_TYPES; i++ )
813 if (items[i].value) Config_control_type = i;
815 if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) {
816 nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
819 if (oc_type != Config_control_type) {
820 switch (Config_control_type) {
821 // case CONTROL_NONE:
822 case CONTROL_JOYSTICK:
823 case CONTROL_FLIGHTSTICK_PRO:
824 case CONTROL_THRUSTMASTER_FCS:
825 // case CONTROL_GRAVIS_GAMEPAD:
826 // case CONTROL_MOUSE:
827 // case CONTROL_CYBERMAN:
828 joydefs_calibrate_flag = 1;
835 //NOTE: WINDOWS VERSION
836 void joydefs_config()
838 int i, old_masks, masks,nitems;
843 Int3(); //this routine really needs to be cleaned up
847 m[0].type = NM_TYPE_RADIO; m[0].text = CONTROL_TEXT(0); m[0].value = 0; m[0].group = 0;
848 m[1].type = NM_TYPE_RADIO; m[1].text = CONTROL_TEXT(1); m[1].value = 0; m[1].group = 0;
849 m[2].type = NM_TYPE_RADIO; m[2].text = CONTROL_TEXT(2); m[2].value = 0; m[2].group = 0;
850 m[3].type = NM_TYPE_RADIO; m[3].text = CONTROL_TEXT(3); m[3].value = 0; m[3].group = 0;
851 m[4].type = NM_TYPE_RADIO; m[4].text = CONTROL_TEXT(4); m[4].value = 0; m[4].group = 0;
852 m[5].type = NM_TYPE_RADIO; m[5].text = CONTROL_TEXT(5); m[5].value = 0; m[5].group = 0;
853 m[6].type = NM_TYPE_RADIO; m[6].text = CONTROL_TEXT(6); m[6].value = 0; m[6].group = 0;
854 m[7].type = NM_TYPE_RADIO; m[7].text = CONTROL_TEXT(7); m[7].value = 0; m[7].group = 0;
856 m[8].type = NM_TYPE_MENU; m[8].text=TXT_CUST_ABOVE;
857 m[9].type = NM_TYPE_TEXT; m[9].text="";
858 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;
859 m[11].type = NM_TYPE_TEXT; m[11].text="";
860 m[12].type = NM_TYPE_MENU; m[12].text=TXT_CUST_KEYBOARD;
862 m[Config_control_type].value = 1;
864 if ( kc_use_external_control ) {
865 sprintf( xtext, "Enable %s", kc_external_name );
866 m[13].type = NM_TYPE_CHECK; m[13].text = xtext; m[13].value = kc_enable_external_control;
870 i1 = newmenu_do1( NULL, TXT_CONTROLS, nitems, m, joydef_menuset_win, i1 );
871 Config_joystick_sensitivity = m[10].value;
876 for (i=0; i<4; i++ ) {
877 if (kconfig_is_axes_used(i))
880 if ( Config_control_type==0 )
882 Config_control_type=0;
883 else if ( Config_control_type<5 )
884 kconfig(1, CONTROL_TEXT(Config_control_type) );
886 kconfig(2, CONTROL_TEXT(Config_control_type) );
889 for (i=0; i<4; i++ ) {
890 if (kconfig_is_axes_used(i))
894 switch (Config_control_type) {
895 case CONTROL_JOYSTICK:
896 case CONTROL_FLIGHTSTICK_PRO:
897 case CONTROL_THRUSTMASTER_FCS:
899 for (i=0; i<4; i++ ) {
900 if ( (masks&(1<<i)) && (!(old_masks&(1<<i))))
901 joydefs_calibrate_flag = 1;
909 kconfig(0, TXT_KEYBOARD);
913 if ( kc_use_external_control ) {
914 kc_enable_external_control = m[13].value;
919 switch (Config_control_type) {
920 case CONTROL_JOYSTICK:
921 case CONTROL_FLIGHTSTICK_PRO:
922 case CONTROL_THRUSTMASTER_FCS:
923 if ( joydefs_calibrate_flag )
930 #endif //ifndef WINDOWS