void CONFIG_SetupJoystick( void ) { int32 i; char str[80],*p; char temp[80]; int32 function, scale; if (scripthandle < 0) return; for (i=0;i<MAXJOYBUTTONS;i++) { Bsprintf(str,"JoystickButton%d",i); temp[0] = 0; if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) JoystickButtons[i] = CONFIG_FunctionNameToNum(temp); Bsprintf(str,"JoystickButtonClicked%d",i); temp[0] = 0; if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) JoystickButtonsClicked[i] = CONFIG_FunctionNameToNum(temp); } // map over the axes for (i=0;i<MAXJOYAXES;i++) { Bsprintf(str,"JoystickAnalogAxes%d",i); temp[0] = 0; if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) JoystickAnalogAxes[i] = CONFIG_AnalogNameToNum(temp); Bsprintf(str,"JoystickDigitalAxes%d_0",i); temp[0] = 0; if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) JoystickDigitalAxes[i][0] = CONFIG_FunctionNameToNum(temp); Bsprintf(str,"JoystickDigitalAxes%d_1",i); temp[0] = 0; if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) JoystickDigitalAxes[i][1] = CONFIG_FunctionNameToNum(temp); Bsprintf(str,"JoystickAnalogScale%d",i); scale = JoystickAnalogScale[i]; SCRIPT_GetNumber(scripthandle, "Controls", str,&scale); JoystickAnalogScale[i] = scale; Bsprintf(str,"JoystickAnalogDead%d",i); scale = JoystickAnalogDead[i]; SCRIPT_GetNumber(scripthandle, "Controls", str,&scale); JoystickAnalogDead[i] = scale; Bsprintf(str,"JoystickAnalogSaturate%d",i); scale = JoystickAnalogSaturate[i]; SCRIPT_GetNumber(scripthandle, "Controls", str,&scale); JoystickAnalogSaturate[i] = scale; } for (i=0;i<MAXJOYBUTTONS;i++) { CONTROL_MapButton( JoystickButtons[i], i, FALSE, controldevice_joystick ); CONTROL_MapButton( JoystickButtonsClicked[i], i, TRUE, controldevice_joystick ); } for (i=0;i<MAXJOYAXES;i++) { CONTROL_MapAnalogAxis(i, JoystickAnalogAxes[i], controldevice_joystick); CONTROL_MapDigitalAxis( i, JoystickDigitalAxes[i][0], 0, controldevice_joystick ); CONTROL_MapDigitalAxis( i, JoystickDigitalAxes[i][1], 1, controldevice_joystick ); CONTROL_SetAnalogAxisScale( i, JoystickAnalogScale[i], controldevice_joystick ); CONTROL_SetJoyAxisDead(i, JoystickAnalogDead[i]); CONTROL_SetJoyAxisSaturate(i, JoystickAnalogSaturate[i]); } }
void CONFIG_SetDefaults( void ) { int32 i,f; byte k1,k2; FXDevice = 0; MusicDevice = 0; NumVoices = 16; NumChannels = 2; NumBits = 16; MixRate = 44100; SoundToggle = 1; MusicToggle = 1; VoiceToggle = 1; AmbienceToggle = 1; FXVolume = 220; MusicVolume = 200; ReverseStereo = 0; MusicParams[0] = 0; myaimmode = ps[0].aim_mode = 0; ud.mouseaiming = 0; ud.weaponswitch = 3; // new+empty AutoAim = 1; UseJoystick = 0; UseMouse = 1; ud.mouseflip = 0; ud.runkey_mode = 0; ud.statusbarscale = 100; ud.screen_size = 8; ud.screen_tilting = 1; ud.shadows = 1; ud.detail = 1; ud.lockout = 0; ud.pwlockout[0] = '\0'; ud.crosshair = 0; ud.m_marker = 1; ud.m_ffire = 1; ud.levelstats = 0; ShowOpponentWeapons = 0; Bstrcpy(ud.rtsname, "DUKE.RTS"); Bstrcpy(myname, "Duke"); Bstrcpy(ud.ridecule[0], "An inspiration for birth control."); Bstrcpy(ud.ridecule[1], "You're gonna die for that!"); Bstrcpy(ud.ridecule[2], "It hurts to be you."); Bstrcpy(ud.ridecule[3], "Lucky Son of a Bitch."); Bstrcpy(ud.ridecule[4], "Hmmm....Payback time."); Bstrcpy(ud.ridecule[5], "You bottom dwelling scum sucker."); Bstrcpy(ud.ridecule[6], "Damn, you're ugly."); Bstrcpy(ud.ridecule[7], "Ha ha ha...Wasted!"); Bstrcpy(ud.ridecule[8], "You suck!"); Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!"); memset(KeyboardKeys, 0xff, sizeof(KeyboardKeys)); for (i=0; i < (int32)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3) { f = CONFIG_FunctionNameToNum( keydefaults[i+0] ); if (f == -1) continue; KeyboardKeys[f][0] = KB_StringToScanCode( keydefaults[i+1] ); KeyboardKeys[f][1] = KB_StringToScanCode( keydefaults[i+2] ); if (f == gamefunc_Show_Console) OSD_CaptureKey(KeyboardKeys[f][0]); else CONTROL_MapKey( f, KeyboardKeys[f][0], KeyboardKeys[f][1] ); } memset(MouseFunctions, -1, sizeof(MouseFunctions)); for (i=0; i<MAXMOUSEBUTTONS; i++) { MouseFunctions[i][0] = CONFIG_FunctionNameToNum( mousedefaults[i] ); CONTROL_MapButton( MouseFunctions[i][0], i, 0, controldevice_mouse ); if (i>=4) continue; MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] ); CONTROL_MapButton( MouseFunctions[i][1], i, 1, controldevice_mouse ); } memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions)); for (i=0; i<MAXMOUSEAXES; i++) { MouseAnalogueScale[i] = 65536; CONTROL_SetAnalogAxisScale( i, MouseAnalogueScale[i], controldevice_mouse ); MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2] ); MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2+1] ); CONTROL_MapDigitalAxis( i, MouseDigitalFunctions[i][0], 0, controldevice_mouse ); CONTROL_MapDigitalAxis( i, MouseDigitalFunctions[i][1], 1, controldevice_mouse ); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum( mouseanalogdefaults[i] ); CONTROL_MapAnalogAxis( i, MouseAnalogueAxes[i], controldevice_mouse); } CONTROL_SetMouseSensitivity(32768); memset(JoystickFunctions, -1, sizeof(JoystickFunctions)); for (i=0; i<MAXJOYBUTTONS; i++) { JoystickFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdefaults[i] ); JoystickFunctions[i][1] = CONFIG_FunctionNameToNum( joystickclickeddefaults[i] ); CONTROL_MapButton( JoystickFunctions[i][0], i, 0, controldevice_joystick ); CONTROL_MapButton( JoystickFunctions[i][1], i, 1, controldevice_joystick ); } memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions)); for (i=0; i<MAXJOYAXES; i++) { JoystickAnalogueScale[i] = 65536; JoystickAnalogueDead[i] = 1024; JoystickAnalogueSaturate[i] = 32767-1024; CONTROL_SetAnalogAxisScale( i, JoystickAnalogueScale[i], controldevice_joystick ); CONTROL_SetJoyAxisDead(i, JoystickAnalogueDead[i]); CONTROL_SetJoyAxisSaturate(i, JoystickAnalogueSaturate[i]); JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2] ); JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2+1] ); CONTROL_MapDigitalAxis( i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick ); CONTROL_MapDigitalAxis( i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick ); JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum( joystickanalogdefaults[i] ); CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick); } }