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,52 +251,65 @@ 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] );
if (i<4) continue; CONTROL_MapButton( MouseFunctions[i][0], i, 0, controldevice_mouse );
MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] ); if (i<4) continue;
}
Bmemset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions)); MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] );
for (i=0; i<MAXMOUSEAXES; i++) { CONTROL_MapButton( MouseFunctions[i][1], i, 1, controldevice_mouse );
MouseAnalogueScale[i] = 65536; }
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2] ); memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2+1] ); for (i=0; i<MAXMOUSEAXES; i++) {
MouseAnalogueScale[i] = 65536;
CONTROL_SetAnalogAxisScale( i, MouseAnalogueScale[i], controldevice_mouse );
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum( mouseanalogdefaults[i] ); MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2] );
} MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2+1] );
CONTROL_SetMouseSensitivity(32768); CONTROL_MapDigitalAxis( i, MouseDigitalFunctions[i][0], 0, controldevice_mouse );
CONTROL_MapDigitalAxis( i, MouseDigitalFunctions[i][1], 1, controldevice_mouse );
Bmemset(JoystickFunctions, -1, sizeof(JoystickFunctions)); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum( mouseanalogdefaults[i] );
for (i=0; i<MAXJOYBUTTONS; i++) { CONTROL_MapAnalogAxis( i, MouseAnalogueAxes[i], controldevice_mouse);
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdefaults[i] ); }
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum( joystickclickeddefaults[i] ); CONTROL_SetMouseSensitivity(32768);
}
Bmemset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions)); memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
for (i=0; i<MAXJOYAXES; i++) { for (i=0; i<MAXJOYBUTTONS; i++) {
JoystickAnalogueScale[i] = 65536; JoystickFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdefaults[i] );
JoystickAnalogueDead[i] = 1000; JoystickFunctions[i][1] = CONFIG_FunctionNameToNum( joystickclickeddefaults[i] );
JoystickAnalogueSaturate[i] = 9500; CONTROL_MapButton( JoystickFunctions[i][0], i, 0, controldevice_joystick );
CONTROL_MapButton( JoystickFunctions[i][1], i, 1, controldevice_joystick );
}
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2] ); memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2+1] ); for (i=0; i<MAXJOYAXES; i++) {
JoystickAnalogueScale[i] = 65536;
JoystickAnalogueDead[i] = 1000;
JoystickAnalogueSaturate[i] = 9500;
CONTROL_SetAnalogAxisScale( i, JoystickAnalogueScale[i], controldevice_joystick );
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum( joystickanalogdefaults[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);
}
} }
/* /*
=================== ===================
@ -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;