Config file fixes from JonoF

git-svn-id: https://svn.eduke32.com/eduke32@112 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-04-25 04:35:39 +00:00
parent e09d8d7cd9
commit 2308af760d
2 changed files with 59 additions and 43 deletions

View File

@ -195,7 +195,6 @@ void CONFIG_SetDefaults( void )
{ {
// JBF 20031211 // JBF 20031211
int32 i,f; int32 i,f;
byte k1,k2;
FXDevice = -1; FXDevice = -1;
MusicDevice = -1; MusicDevice = -1;
@ -252,51 +251,64 @@ void CONFIG_SetDefaults( void )
Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!"); Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!");
// JBF 20031211 // JBF 20031211
Bmemset(KeyboardKeys, 0xff, sizeof(KeyboardKeys)); memset(KeyboardKeys, 0xff, sizeof(KeyboardKeys));
for (i=0; i < NUMGAMEFUNCTIONS; i++) { for (i=0; i < NUMGAMEFUNCTIONS; i+=3) {
f = CONFIG_FunctionNameToNum( keydefaults[3*i+0] ); f = CONFIG_FunctionNameToNum( keydefaults[i+0] );
if (f == -1) continue; if (f == -1) continue;
k1 = KB_StringToScanCode( keydefaults[3*i+1] ); KeyboardKeys[f][0] = KB_StringToScanCode( keydefaults[i+1] );
k2 = KB_StringToScanCode( keydefaults[3*i+2] ); KeyboardKeys[f][1] = KB_StringToScanCode( keydefaults[i+2] );
KeyboardKeys[f][0] = k1; if (f == gamefunc_Show_Console) OSD_CaptureKey(KeyboardKeys[f][0]);
KeyboardKeys[f][1] = k2; else CONTROL_MapKey( f, KeyboardKeys[f][0], KeyboardKeys[f][1] );
} }
Bmemset(MouseFunctions, -1, sizeof(MouseFunctions)); memset(MouseFunctions, -1, sizeof(MouseFunctions));
for (i=0; i<MAXMOUSEBUTTONS; i++) { for (i=0; i<MAXMOUSEBUTTONS; i++) {
MouseFunctions[i][0] = CONFIG_FunctionNameToNum( mousedefaults[i] ); MouseFunctions[i][0] = CONFIG_FunctionNameToNum( mousedefaults[i] );
CONTROL_MapButton( MouseFunctions[i][0], i, 0, controldevice_mouse );
if (i<4) continue; if (i<4) continue;
MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] ); MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] );
CONTROL_MapButton( MouseFunctions[i][1], i, 1, controldevice_mouse );
} }
Bmemset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions)); memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
for (i=0; i<MAXMOUSEAXES; i++) { for (i=0; i<MAXMOUSEAXES; i++) {
MouseAnalogueScale[i] = 65536; MouseAnalogueScale[i] = 65536;
CONTROL_SetAnalogAxisScale( i, MouseAnalogueScale[i], controldevice_mouse );
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2] ); MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2] );
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2+1] ); 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] ); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum( mouseanalogdefaults[i] );
CONTROL_MapAnalogAxis( i, MouseAnalogueAxes[i], controldevice_mouse);
} }
CONTROL_SetMouseSensitivity(32768); CONTROL_SetMouseSensitivity(32768);
Bmemset(JoystickFunctions, -1, sizeof(JoystickFunctions)); memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
for (i=0; i<MAXJOYBUTTONS; i++) { for (i=0; i<MAXJOYBUTTONS; i++) {
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdefaults[i] ); JoystickFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdefaults[i] );
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum( joystickclickeddefaults[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 );
} }
Bmemset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions)); memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
for (i=0; i<MAXJOYAXES; i++) { for (i=0; i<MAXJOYAXES; i++) {
JoystickAnalogueScale[i] = 65536; JoystickAnalogueScale[i] = 65536;
JoystickAnalogueDead[i] = 1000; JoystickAnalogueDead[i] = 1000;
JoystickAnalogueSaturate[i] = 9500; JoystickAnalogueSaturate[i] = 9500;
CONTROL_SetAnalogAxisScale( i, JoystickAnalogueScale[i], controldevice_joystick );
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2] ); JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2] );
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2+1] ); 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] ); JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum( joystickanalogdefaults[i] );
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
} }
} }
/* /*
@ -539,6 +551,8 @@ void CONFIG_ReadSetup( void )
CONTROL_ClearAssignments(); CONTROL_ClearAssignments();
CONFIG_SetDefaults(); CONFIG_SetDefaults();
setupread = 1;
if (SafeFileExists(setupfilename)) // JBF 20031211 if (SafeFileExists(setupfilename)) // JBF 20031211
scripthandle = SCRIPT_Load( setupfilename ); scripthandle = SCRIPT_Load( setupfilename );
@ -680,7 +694,8 @@ void CONFIG_WriteSetup( void )
{ {
int32 dummy; int32 dummy;
//if (!setupread) return; if (!setupread) return;
if (scripthandle < 0) if (scripthandle < 0)
scripthandle = SCRIPT_Init(setupfilename); scripthandle = SCRIPT_Init(setupfilename);

View File

@ -7977,16 +7977,15 @@ void loadtmb(void)
void Shutdown( void ) void Shutdown( void )
{ {
int i; int i;
extern int32 scripthandle;
SoundShutdown(); SoundShutdown();
MusicShutdown(); MusicShutdown();
uninittimer(); uninittimer();
uninitengine(); uninitengine();
CONTROL_Shutdown(); CONTROL_Shutdown();
if (scripthandle)
CONFIG_WriteSetup(); CONFIG_WriteSetup();
KB_Shutdown(); KB_Shutdown();
for(i=0;i<MAXQUOTES;i++) for(i=0;i<MAXQUOTES;i++)
{ {
if(fta_quotes[i] != NULL) if(fta_quotes[i] != NULL)
@ -7994,6 +7993,7 @@ void Shutdown( void )
if(redefined_quotes[i] != NULL) if(redefined_quotes[i] != NULL)
Bfree(redefined_quotes[i]); Bfree(redefined_quotes[i]);
} }
for(i=0;i<iGameVarCount;i++) for(i=0;i<iGameVarCount;i++)
{ {
if(aGameVars[i].szLabel != NULL) if(aGameVars[i].szLabel != NULL)
@ -8003,6 +8003,7 @@ void Shutdown( void )
if(aGameVars[i].plValues != NULL) if(aGameVars[i].plValues != NULL)
Bfree(aGameVars[i].plValues); Bfree(aGameVars[i].plValues);
} }
if(label != NULL) if(label != NULL)
Bfree(label); Bfree(label);
if(labelcode != NULL) if(labelcode != NULL)
@ -8520,7 +8521,7 @@ void app_main(int argc,char **argv)
int xres[] = {800,640,320}; int xres[] = {800,640,320};
int yres[] = {600,480,240}; int yres[] = {600,480,240};
int bpp[] = {32,16,8}; int bpp[] = {32,16,8};
initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...", initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...\n",
ScreenWidth,ScreenHeight,ScreenBPP,ScreenMode?"fullscreen":"windowed"); ScreenWidth,ScreenHeight,ScreenBPP,ScreenMode?"fullscreen":"windowed");
/* ScreenMode = 0; // JBF: was 2 /* ScreenMode = 0; // JBF: was 2
ScreenWidth = 800; ScreenWidth = 800;