From fadccd409ab77bd9f555a12683b1ac7e4c266177 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Mon, 12 Jan 2015 02:10:20 -0800 Subject: [PATCH] convert control type, joystick sensitivity to cvars --- arch/dos/joydefs.c | 38 ++++++++------- arch/linux/joydefs.c | 28 ++++++----- arch/sdl/joydefs.c | 28 ++++++----- main/config.c | 13 +++-- main/config.h | 4 +- main/game.c | 2 +- main/gameseq.c | 8 ---- main/inferno.c | 8 ++-- main/kconfig.c | 42 ++++++++-------- main/newmenu.c | 4 +- main/playsave.c | 112 ++----------------------------------------- 11 files changed, 94 insertions(+), 193 deletions(-) diff --git a/arch/dos/joydefs.c b/arch/dos/joydefs.c index 01e34c3b..c0982cca 100644 --- a/arch/dos/joydefs.c +++ b/arch/dos/joydefs.c @@ -96,7 +96,10 @@ void joydefs_calibrate() joydefs_calibrate_flag = 0; - if ( (Config_control_type!=CONTROL_JOYSTICK) && (Config_control_type!=CONTROL_FLIGHTSTICK_PRO) && (Config_control_type!=CONTROL_THRUSTMASTER_FCS) && (Config_control_type!=CONTROL_GRAVIS_GAMEPAD) ) + if ( (Config_control_type.intval != CONTROL_JOYSTICK) && + (Config_control_type.intval != CONTROL_FLIGHTSTICK_PRO) && + (Config_control_type.intval != CONTROL_THRUSTMASTER_FCS) && + (Config_control_type.intval != CONTROL_GRAVIS_GAMEPAD) ) return; joy_get_cal_vals(org_axis_min, org_axis_center, org_axis_max); @@ -165,14 +168,14 @@ void joydefs_calibrate() joy_delay(); // The fcs uses axes 3 for hat, so don't calibrate it. - if (Config_control_type == CONTROL_THRUSTMASTER_FCS) { + if (Config_control_type.intval == CONTROL_THRUSTMASTER_FCS) { axis_min[3] = 0; axis_cen[3] = temp_values[3]/2; axis_max[3] = temp_values[3]; joy_delay(); } - if (Joy_is_Sidewinder || Config_control_type != CONTROL_THRUSTMASTER_FCS) { + if (Joy_is_Sidewinder || Config_control_type.intval != CONTROL_THRUSTMASTER_FCS) { // masks = joy_get_present_mask(); if ( nsticks == 2 ) { @@ -273,7 +276,7 @@ void joydefs_calibrate() //added 9/1/98 by Victor Rachels to make sidewinder calibratable /* if(Joy_is_Sidewinder) - Config_control_type=tempstick; */ + cvar_setint(&Config_control_type, tempstick); */ //end this section addition - Victor Rachels @@ -286,21 +289,22 @@ void joydefs_calibrate() void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem ) { int i; - int oc_type = Config_control_type; + int oc_type = Config_control_type.intval; nitems = nitems; last_key = last_key; citem = citem; for (i=0; i-1); - switch (Config_control_type) { + switch (Config_control_type.intval) { case CONTROL_JOYSTICK: case CONTROL_FLIGHTSTICK_PRO: case CONTROL_THRUSTMASTER_FCS: diff --git a/arch/linux/joydefs.c b/arch/linux/joydefs.c index 14f5525e..5be54af6 100644 --- a/arch/linux/joydefs.c +++ b/arch/linux/joydefs.c @@ -141,27 +141,29 @@ void joydefs_calibrate() void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem ) { int i; - int oc_type = Config_control_type; + int oc_type = Config_control_type.intval; nitems = nitems; last_key = last_key; citem = citem; for (i=0; i<3; i++ ) - if (items[i].value) Config_control_type = i; + if (items[i].value) + cvar_setint(&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; + if (Config_control_type.intval == 2) + cvar_setint(&Config_control_type, CONTROL_MOUSE); //end this section addition - Hans - if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) { + if ( (oc_type != Config_control_type.intval) && (Config_control_type.intval == CONTROL_THRUSTMASTER_FCS ) ) { nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS ); } - if (oc_type != Config_control_type) { - switch (Config_control_type) { + if (oc_type != Config_control_type.intval) { + switch (Config_control_type.intval) { // case CONTROL_NONE: case CONTROL_JOYSTICK: case CONTROL_FLIGHTSTICK_PRO: @@ -205,12 +207,12 @@ void joydefs_config() //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; +//-killed- m[Config_control_type.intval].value = 1; do { - i = Config_control_type; + i = Config_control_type.intval; if(i==CONTROL_MOUSE) i = 2; m[i].value=1; //end section - OE @@ -221,16 +223,16 @@ void joydefs_config() //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; + cvar_setint(&Config_control_type, j); + i = Config_control_type.intval; + if (Config_control_type.intval == 2) + cvar_setint(&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); +//-killed- kconfig(Config_control_type.intval, m[Config_control_type.intval].text); kconfig (i, m[i].text); //end this section change - Hans break; diff --git a/arch/sdl/joydefs.c b/arch/sdl/joydefs.c index 0074b955..489d4e3e 100644 --- a/arch/sdl/joydefs.c +++ b/arch/sdl/joydefs.c @@ -36,19 +36,21 @@ void joydefs_calibrate() void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem ) { int i; - int oc_type = Config_control_type; + int oc_type = Config_control_type.intval; for (i=0; i<3; i++ ) - if (items[i].value) Config_control_type = i; + if (items[i].value) + cvar_setint(&Config_control_type, i); - if (Config_control_type == 2) Config_control_type = CONTROL_MOUSE; + if (Config_control_type.intval == 2) + cvar_setint(&Config_control_type, CONTROL_MOUSE); - if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) { + if ( (oc_type != Config_control_type.intval) && (Config_control_type.intval == CONTROL_THRUSTMASTER_FCS ) ) { nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS ); } - if (oc_type != Config_control_type) { - switch (Config_control_type) { + if (oc_type != Config_control_type.intval) { + switch (Config_control_type.intval) { // case CONTROL_NONE: case CONTROL_JOYSTICK: case CONTROL_FLIGHTSTICK_PRO: @@ -74,27 +76,27 @@ void joydefs_config() m[3].type = NM_TYPE_TEXT; m[3].text = ""; m[4].type = NM_TYPE_MENU; m[4].text = TXT_CUST_ABOVE; m[5].type = NM_TYPE_TEXT; m[5].text = ""; - m[6].type = NM_TYPE_SLIDER; m[6].text = TXT_JOYS_SENSITIVITY; m[6].value = Config_joystick_sensitivity; m[6].min_value = 0; m[6].max_value = 16; + m[6].type = NM_TYPE_SLIDER; m[6].text = TXT_JOYS_SENSITIVITY; m[6].value = Config_joystick_sensitivity.intval; m[6].min_value = 0; m[6].max_value = 16; m[7].type = NM_TYPE_TEXT; m[7].text = ""; m[8].type = NM_TYPE_MENU; m[8].text = TXT_CUST_KEYBOARD; m[9].type = NM_TYPE_MENU; m[9].text = "CUSTOMIZE D2X KEYS"; do { - i = Config_control_type; + i = Config_control_type.intval; if (i == CONTROL_MOUSE) i = 2; m[i].value = 1; i1 = newmenu_do1(NULL, TXT_CONTROLS, nitems, m, joydef_menuset_1, i1); - Config_joystick_sensitivity = m[6].value; + cvar_setint(&Config_joystick_sensitivity, m[6].value); 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; + cvar_setint(&Config_control_type, j); + i = Config_control_type.intval; + if (Config_control_type.intval == 2) + cvar_setint(&Config_control_type, CONTROL_MOUSE); switch (i1) { case 4: diff --git a/main/config.c b/main/config.c index 2104c929..78aef7a6 100644 --- a/main/config.c +++ b/main/config.c @@ -56,10 +56,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "physfsx.h" -ubyte Config_control_type = 0; -ubyte Config_joystick_sensitivity = 8; - - #ifdef __MSDOS__ cvar_t Config_digi_type = { "DigiDeviceID8", "0", 1 }; cvar_t digi_driver_board_16 = { "DigiDeviceID16", "0", 1 }; @@ -75,7 +71,9 @@ cvar_t Config_midi_volume = { "MidiVolume", "8", 1 }; cvar_t Config_redbook_volume = { "RedbookVolume", "8", 1 }; cvar_t Config_detail_level = { "DetailLevel", "4", 1 }; cvar_t Config_gamma_level = { "GammaLevel", "0", 1 }; +cvar_t Config_control_type = { "ControlType", "0", 1 }; cvar_t Config_channels_reversed = { "StereoReverse", "0", 1 }; +cvar_t Config_joystick_sensitivity = { "JoystickSensitivity", "8", 1 }; cvar_t Config_joystick_min = { "JoystickMin", "0,0,0,0", 1 }; cvar_t Config_joystick_max = { "JoystickMax", "0,0,0,0", 1 }; cvar_t Config_joystick_cen = { "JoystickCen", "0,0,0,0", 1 }; @@ -172,6 +170,8 @@ static void config_init(void) cvar_registervariable(&Config_channels_reversed); cvar_registervariable(&Config_gamma_level); cvar_registervariable(&Config_detail_level); + cvar_registervariable(&Config_control_type); + cvar_registervariable(&Config_joystick_sensitivity); cvar_registervariable(&Config_joystick_min); cvar_registervariable(&Config_joystick_cen); cvar_registervariable(&Config_joystick_max); @@ -270,8 +270,9 @@ int ReadConfigFile() cvar_setint( &Config_digi_volume, 8 ); cvar_setint( &Config_midi_volume, 8 ); cvar_setint( &Config_redbook_volume, 8 ); - Config_control_type = 0; + cvar_setint( &Config_control_type, CONTROL_NONE ); cvar_setint( &Config_channels_reversed, 0); + cvar_setint( &Config_joystick_sensitivity, 8 ); //set these here in case no cfg file SaveMovieHires = MovieHires.intval; @@ -328,6 +329,8 @@ int ReadConfigFile() digi_set_volume( (Config_digi_volume.intval * 32768) / 8, (Config_midi_volume.intval * 128) / 8 ); + kc_set_controls(); + strncpy(guidebot_name, real_guidebot_name.string, GUIDEBOT_NAME_LEN); guidebot_name[GUIDEBOT_NAME_LEN] = 0; diff --git a/main/config.h b/main/config.h index 1e1cd66e..cec8e87b 100644 --- a/main/config.h +++ b/main/config.h @@ -51,9 +51,9 @@ extern ConfigInfo gConfigInfo; extern ubyte Config_master_volume; #endif extern cvar_t Config_redbook_volume; -extern ubyte Config_control_type; +extern cvar_t Config_control_type; extern cvar_t Config_channels_reversed; -extern ubyte Config_joystick_sensitivity; +extern cvar_t Config_joystick_sensitivity; //values for Config_control_type #define CONTROL_NONE 0 diff --git a/main/game.c b/main/game.c index 98e1e1df..882231d6 100644 --- a/main/game.c +++ b/main/game.c @@ -722,7 +722,7 @@ int set_screen_mode(int sm) //we probably should do something else here, like select a standard mode } #ifdef MACINTOSH - if ( (Config_control_type == 1) && (Function_mode == FMODE_GAME) ) + if ( (Config_control_type.intval == CONTROL_JOYSTICK) && (Function_mode == FMODE_GAME) ) joydefs_calibrate(); #endif reset_cockpit(); diff --git a/main/gameseq.c b/main/gameseq.c index 87c68da8..851abad3 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -721,14 +721,6 @@ int RegisterPlayer() int allow_abort_flag = 1; if ( Players[Player_num].callsign[0] == 0 ) { - //--------------------------------------------------------------------- - // Set default config options in case there is no config file - // kc_keyboard, kc_joystick, kc_mouse are statically defined. - Config_joystick_sensitivity = 8; - Config_control_type =CONTROL_NONE; - kc_set_controls(); - //---------------------------------------------------------------- - // Read the last player's name from config file, not lastplr.txt strncpy( Players[Player_num].callsign, config_last_player.string, CALLSIGN_LEN ); diff --git a/main/inferno.c b/main/inferno.c index 731f63e1..f1401de3 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -844,10 +844,10 @@ void check_joystick_calibration() { int x1, y1, x2, y2, c; fix t1; - if ( (Config_control_type!=CONTROL_JOYSTICK) && - (Config_control_type!=CONTROL_FLIGHTSTICK_PRO) && - (Config_control_type!=CONTROL_THRUSTMASTER_FCS) && - (Config_control_type!=CONTROL_GRAVIS_GAMEPAD) + if ( (Config_control_type.intval != CONTROL_JOYSTICK) && + (Config_control_type.intval != CONTROL_FLIGHTSTICK_PRO) && + (Config_control_type.intval != CONTROL_THRUSTMASTER_FCS) && + (Config_control_type.intval != CONTROL_GRAVIS_GAMEPAD) ) return; joy_get_pos( &x1, &y1 ); diff --git a/main/kconfig.c b/main/kconfig.c index f098366d..b63d142b 100644 --- a/main/kconfig.c +++ b/main/kconfig.c @@ -812,7 +812,7 @@ void kconfig_sub(kc_item * items,int nitems, char * title) } } else { for (i=0; i0) && (Config_control_type<5)) { + if ( (Config_control_type.intval >= CONTROL_JOYSTICK) && (Config_control_type.intval < CONTROL_MOUSE)) { for (i = 0; i < NUM_OTHER_CONTROLS; i++) { if (kc_joystick[i].type == BT_JOY_AXIS && kc_joystick[i].value != 255) { cvar_setint(&joy_advaxes[kc_joystick[i].value], kc_other_axismap[i]); @@ -1393,7 +1393,7 @@ void kconfig(int n, char * title) } } - } else if (Config_control_type > 4) { + } else if (Config_control_type.intval >= CONTROL_MOUSE) { for (i = 0; i < NUM_OTHER_CONTROLS; i++) { if (kc_mouse[i].type == BT_MOUSE_AXIS && kc_mouse[i].value != 255) { cvar_setint(&mouse_axes[kc_mouse[i].value], kc_other_axismap[i]); @@ -1411,7 +1411,7 @@ void kconfig_read_fcs( int raw_axis ) { int raw_button, button, axis_min[4], axis_center[4], axis_max[4]; - if (Config_control_type!=CONTROL_THRUSTMASTER_FCS) return; + if (Config_control_type.intval != CONTROL_THRUSTMASTER_FCS) return; joy_get_cal_vals(axis_min, axis_center, axis_max); @@ -1607,7 +1607,7 @@ void controls_read_all() ctime = timer_get_fixed_seconds(); //--------- Read Joystick ----------- - if ( (LastReadTime + JOYSTICK_READ_TIME > ctime) && (Config_control_type!=CONTROL_THRUSTMASTER_FCS) ) { + if ( (LastReadTime + JOYSTICK_READ_TIME > ctime) && (Config_control_type.intval != CONTROL_THRUSTMASTER_FCS) ) { # ifndef __MSDOS__ if ((ctime < 0) && (LastReadTime >= 0)) # else @@ -1615,7 +1615,7 @@ void controls_read_all() # endif LastReadTime = ctime; use_joystick=1; - } else if ((Config_control_type>0) && (Config_control_type<5) ) { + } else if ((Config_control_type.intval >= CONTROL_JOYSTICK) && (Config_control_type.intval < CONTROL_MOUSE) ) { LastReadTime = ctime; channel_masks = joystick_read_raw_axis( JOY_ALL_AXIS, raw_joy_axis ); @@ -1626,7 +1626,7 @@ void controls_read_all() #endif int joy_null_value = 10; - if ( (i==3) && (Config_control_type==CONTROL_THRUSTMASTER_FCS) ) { + if ( (i == 3) && (Config_control_type.intval == CONTROL_THRUSTMASTER_FCS) ) { kconfig_read_fcs( raw_joy_axis[i] ); } else { raw_joy_axis[i] = joy_get_scaled_reading( raw_joy_axis[i], i ); @@ -1655,7 +1655,7 @@ void controls_read_all() use_joystick=0; } - if (Config_control_type==5 && !CybermouseActive) { + if (Config_control_type.intval == CONTROL_MOUSE && !CybermouseActive) { //--------- Read Mouse ----------- #ifdef SDL_INPUT mouse_get_delta_z( &dx, &dy, &dz ); @@ -1669,7 +1669,7 @@ void controls_read_all() #endif //mprintf(( 0, "Mouse %d,%d 0x%x\n", mouse_axis[0], mouse_axis[1], FrameTime )); use_mouse=1; - } else if (Config_control_type==6 && !CybermouseActive) { + } else if (Config_control_type.intval == CONTROL_CYBERMAN && !CybermouseActive) { //--------- Read Cyberman ----------- mouse_get_cyberman_pos(&idx,&idy ); mouse_axis[0] = (idx*FrameTime)/128; @@ -1716,18 +1716,18 @@ void controls_read_all() // From joystick... if ( (use_joystick)&&(kc_joystick[13].value < 255 )) { if ( !kc_joystick[14].value ) // If not inverted... - Controls.pitch_time -= (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity)/8; + Controls.pitch_time -= (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity.intval)/8; else - Controls.pitch_time += (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity)/8; + Controls.pitch_time += (joy_axis[kc_joystick[13].value]*Config_joystick_sensitivity.intval)/8; } // From mouse... //mprintf(( 0, "UM: %d, PV: %d\n", use_mouse, kc_mouse[13].value )); if ( (use_mouse)&&(kc_mouse[13].value < 255) ) { if ( !kc_mouse[14].value ) // If not inverted... - Controls.pitch_time -= (mouse_axis[kc_mouse[13].value]*Config_joystick_sensitivity)/8; + Controls.pitch_time -= (mouse_axis[kc_mouse[13].value]*Config_joystick_sensitivity.intval)/8; else - Controls.pitch_time += (mouse_axis[kc_mouse[13].value]*Config_joystick_sensitivity)/8; + Controls.pitch_time += (mouse_axis[kc_mouse[13].value]*Config_joystick_sensitivity.intval)/8; } } else { Controls.pitch_time = 0; @@ -1807,17 +1807,17 @@ if (!Player_is_dead) // From joystick... if ( (use_joystick)&&(kc_joystick[15].value < 255 )) { if ( !kc_joystick[16].value ) // If not inverted... - Controls.heading_time += (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8; + Controls.heading_time += (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity.intval)/8; else - Controls.heading_time -= (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8; + Controls.heading_time -= (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity.intval)/8; } // From mouse... if ( (use_mouse)&&(kc_mouse[15].value < 255 )) { if ( !kc_mouse[16].value ) // If not inverted... - Controls.heading_time += (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8; + Controls.heading_time += (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity.intval)/8; else - Controls.heading_time -= (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8; + Controls.heading_time -= (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity.intval)/8; } } else { Controls.heading_time = 0; @@ -1882,17 +1882,17 @@ if (!Player_is_dead) // From joystick... if ( (use_joystick)&&(kc_joystick[15].value < 255) ) { if ( !kc_joystick[16].value ) // If not inverted... - Controls.bank_time -= (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8; + Controls.bank_time -= (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity.intval)/8; else - Controls.bank_time += (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity)/8; + Controls.bank_time += (joy_axis[kc_joystick[15].value]*Config_joystick_sensitivity.intval)/8; } // From mouse... if ( (use_mouse)&&(kc_mouse[15].value < 255 )) { if ( !kc_mouse[16].value ) // If not inverted... - Controls.bank_time += (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8; + Controls.bank_time += (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity.intval)/8; else - Controls.bank_time -= (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity)/8; + Controls.bank_time -= (mouse_axis[kc_mouse[15].value]*Config_joystick_sensitivity.intval)/8; } } diff --git a/main/newmenu.c b/main/newmenu.c index 1279a9a1..6deccc82 100644 --- a/main/newmenu.c +++ b/main/newmenu.c @@ -652,7 +652,7 @@ int check_button_press() { int i; - switch (Config_control_type) { + switch (Config_control_type.intval) { case CONTROL_JOYSTICK: case CONTROL_FLIGHTSTICK_PRO: case CONTROL_THRUSTMASTER_FCS: @@ -674,7 +674,7 @@ int check_button_press() break; default: - Error("Bad control type (Config_control_type):%i",Config_control_type); + Error("Bad ControlType: %i", Config_control_type.intval); } return 0; diff --git a/main/playsave.c b/main/playsave.c index 9098a08e..6ffcb39f 100644 --- a/main/playsave.c +++ b/main/playsave.c @@ -112,7 +112,7 @@ hli highest_levels[MAX_MISSIONS]; //version 21 -> 22: save lifetime netstats //version 22 -> 23: ?? //version 23 -> 24: add name of joystick for windows version. -//version 24 -> 25: removed kconfig data, joy name, guidebot name +//version 24 -> 25: removed kconfig data, joy name, guidebot name, control type, joy sensitivity #define COMPATIBLE_PLAYER_FILE_VERSION 17 @@ -121,115 +121,16 @@ int Default_leveling_on=1; extern ubyte SecondaryOrder[],PrimaryOrder[]; extern void InitWeaponOrdering(); -#ifdef MACINTOSH -extern ubyte default_firebird_settings[]; -extern ubyte default_mousestick_settings[]; -#endif int new_player_config() { - int nitems; - int i,j,control_choice; - newmenu_item m[8]; - int mct=CONTROL_MAX_TYPES; - - #ifndef WINDOWS - mct--; - #endif - - InitWeaponOrdering (); //setup default weapon priorities - -#if defined(MACINTOSH) && defined(USE_ISP) - if (!ISpEnabled()) - { -#endif -RetrySelection: - #if !defined(MACINTOSH) - for (i=0; i0) && (Config_control_type<5)) { - joydefs_calibrate(); - } - #else // some macintosh only stuff here - if ( Config_control_type==CONTROL_THRUSTMASTER_FCS) { - extern char *tm_warning; - - i = nm_messagebox( TXT_IMPORTANT_NOTE, 2, "Choose another", TXT_OK, tm_warning ); - if (i==0) goto RetrySelection; - } else if ( Config_control_type==CONTROL_FLIGHTSTICK_PRO ) { - extern char *ch_warning; - - i = nm_messagebox( TXT_IMPORTANT_NOTE, 2, "Choose another", TXT_OK, ch_warning ); - if (i==0) goto RetrySelection; - } else if ( Config_control_type==CONTROL_GRAVIS_GAMEPAD ) { - extern char *ms_warning; - - i = nm_messagebox( TXT_IMPORTANT_NOTE, 2, "Choose another", TXT_OK, ms_warning ); - if (i==0) goto RetrySelection; - // stupid me -- get real default setting for either mousestick or firebird - joydefs_set_type( Config_control_type ); - if (joy_have_firebird()) - for (i=0; i0) && (Config_control_type<5) ) { - joydefs_set_type( Config_control_type ); - joydefs_calibrate(); - } - - #endif - Player_default_difficulty = 1; Auto_leveling_on = Default_leveling_on = 1; n_highest_levels = 1; highest_levels[0].shortname[0] = 0; //no name for mission 0 highest_levels[0].level_num = 1; //was highest level in old struct - Config_joystick_sensitivity = 8; Cockpit_3d_view[0]=CV_NONE; Cockpit_3d_view[1]=CV_NONE; @@ -367,6 +268,7 @@ int read_player_file() { int n_control_types = (player_file_version<20)?7:CONTROL_MAX_TYPES; ubyte kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS], control_type_win; + ubyte Config_control_type, Config_joystick_sensitivity; if (player_file_version < 25) if (PHYSFS_read(file, kconfig_settings, MAX_CONTROLS*n_control_types, 1) != 1) @@ -379,10 +281,6 @@ int read_player_file() else if (PHYSFS_read(file, &Config_joystick_sensitivity, sizeof(ubyte), 1) !=1 ) goto read_player_file_failed; - #ifdef MACINTOSH - joydefs_set_type(Config_control_type); - #endif - for (i=0;i<11;i++) { PrimaryOrder[i] = cfile_read_byte(file); @@ -597,9 +495,9 @@ int write_player_file() //write kconfig info { - if (PHYSFS_write(file, &Config_control_type, sizeof(ubyte), 1) != 1) + if (PHYSFSX_writeU8(file, Config_control_type.intval) != 1) goto write_player_file_failed; - else if (PHYSFS_write(file, &Config_joystick_sensitivity, sizeof(ubyte), 1) != 1) + else if (PHYSFSX_writeU8(file, Config_joystick_sensitivity.intval) != 1) goto write_player_file_failed; for (i = 0; i < 11; i++) -- 2.39.2