Example #1
0
int32 CONFIG_ReadSetup( void )
   {
   int32 dummy;
   char ret;
   extern char ds[];
   extern char PlayerNameArg[32];

#if MEGAWANG
   extern BOOL ClassicLighting;
   extern int32_t r_usenewshading;
   extern int32_t r_usetileshades;
   extern int32 useDarts;
   dnInitKeyNames();
#endif
       
   CONTROL_ClearAssignments();
   CONFIG_SetDefaults();
   
#if MEGAWANG
       if (SafeFileExists(localsetupfilename)) {
           scripthandle = SCRIPT_Load(localsetupfilename);
       }
       if (scripthandle < 0) {
           goto read_common_config;
       }
#else
   if (SafeFileExists(setupfilename))
      scripthandle = SCRIPT_Load(setupfilename);
   
   if (scripthandle < 0) return -1;
#endif
       
      SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenMode",&ScreenMode);
      SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenWidth",&ScreenWidth);
      SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenHeight",&ScreenHeight);
      SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenBPP", &ScreenBPP);
      if (ScreenBPP < 8) ScreenBPP = 8;

#ifdef RENDERTYPEWIN
      SCRIPT_GetNumber( scripthandle, "Screen Setup", "MaxRefreshFreq", (int32*)&maxrefreshfreq);
#endif
       
#if MEGAWANG
        SCRIPT_GetNumber( scripthandle, "Screen Setup", "VerticalSync",&vsync);
        SCRIPT_GetNumber( scripthandle, "Screen Setup", "MaxFPS",&max_fps);
        SCRIPT_GetNumber( scripthandle, "Options", "UseDarts", &useDarts);
        SCRIPT_GetNumber( scripthandle, "Options", "FOV", &dummy);
        if (dummy < 60) {
            dummy = 60;
        }
        if (dummy > 145) {
            dummy = 145;
        }
        xfov = dummy/90.0f;
       
       SCRIPT_GetBoolean(scripthandle, "Screen Setup", "ClassicLighting", &ClassicLighting);
       if (ClassicLighting) {
           r_usenewshading = 2;
           r_usetileshades = 1;
       } else {
           r_usenewshading = 0;
           r_usetileshades = 0;
       }
#endif
 
      SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode);
      SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy);
      SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr);

#if MEGAWANG
       SCRIPT_Free(scripthandle);
   read_common_config:
       if (SafeFileExists(setupfilename))
           scripthandle = SCRIPT_Load(setupfilename);
       
       if (scripthandle < 0) return -1;
#endif
       
      SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXDevice",&FXDevice);
      SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicDevice",&MusicDevice);
      SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXVolume",&FXVolume);
      gs.SoundVolume = FXVolume;
      SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicVolume",&MusicVolume);
      gs.MusicVolume = MusicVolume;
 
      SCRIPT_GetNumber( scripthandle, "Sound Setup", "NumVoices",&NumVoices);
      SCRIPT_GetNumber( scripthandle, "Sound Setup", "NumChannels",&NumChannels);
      SCRIPT_GetNumber( scripthandle, "Sound Setup", "NumBits",&NumBits);
      SCRIPT_GetNumber( scripthandle, "Sound Setup", "MixRate",&MixRate);
      SCRIPT_GetNumber( scripthandle, "Sound Setup", "ReverseStereo",&dummy);
      gs.FlipStereo = dummy;
      if (gs.FlipStereo) gs.FlipStereo = 1;

      SCRIPT_GetNumber( scripthandle, "Setup", "ForceSetup",&ForceSetup);
      SCRIPT_GetNumber( scripthandle, "Controls","UseMouse",&UseMouse);
      SCRIPT_GetNumber( scripthandle, "Controls","UseJoystick",&UseJoystick);
      SCRIPT_GetString( scripthandle, "Comm Setup", "RTSName",RTSName);
   
      SCRIPT_GetString( scripthandle, "Comm Setup","PlayerName",CommPlayerName);
    
   ReadGameSetup(scripthandle);
    
   CONFIG_ReadKeys(scripthandle);

   //CONFIG_SetupMouse(scripthandle);
   //CONFIG_SetupJoystick(scripthandle);
   
   if (PlayerNameArg[0] != '\0')
      {
      strcpy(CommPlayerName, PlayerNameArg);
      }
   return 0;
   }
Example #2
0
int32 CONFIG_ReadSetup( void )
{
	int32 dummy,i;
	char commmacro[] = "CommbatMacro# ";
	extern int32 CommandWeaponChoice;

    dnInitKeyNames();   
	CONTROL_ClearAssignments();
	CONFIG_SetDefaults();

	setupread = 1;
    
    if (SafeFileExists(localsetupfilename)) {
        scripthandle = SCRIPT_Load(localsetupfilename);
        if (scripthandle >= 0) {
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "Shadows",&ud.shadows);
            SCRIPT_GetString( scripthandle, "Screen Setup", "Password",&ud.pwlockout[0]);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "Detail",&ud.detail);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "Tilt",&ud.screen_tilting);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "Messages",&ud.fta_on);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenWidth",&ScreenWidth);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenHeight",&ScreenHeight);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenMode",&ScreenMode);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenGamma",&ud.brightness);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "Out",&ud.lockout);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "ScreenBPP", &ScreenBPP);
			SCRIPT_GetBoolean( scripthandle, "Screen Setup", "VerticalSync", &ud.vsync);
			SCRIPT_GetNumber( scripthandle, "Screen Setup", "MaxFPS", &ud.fps_max);
            if (ScreenBPP < 24) ScreenBPP = 24;
            #ifdef RENDERTYPEWIN
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "MaxRefreshFreq", (int32*)&maxrefreshfreq);
            #endif
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr);
            SCRIPT_GetNumber( scripthandle, "Screen Setup", "GLUseCompressedTextureCache", &glusetexcache);
        }
    }
	
	if (SafeFileExists(setupfilename))	// JBF 20031211
	   scripthandle = SCRIPT_Load( setupfilename );

	if (scripthandle < 0) return -1;

	for(dummy = 0;dummy < 10;dummy++)
	{
		commmacro[13] = dummy+'0';
		SCRIPT_GetString( scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
	}
	SCRIPT_GetString( scripthandle, "Comm Setup","PlayerName",&myname[0]);
	SCRIPT_GetString( scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);


	SCRIPT_GetNumber( scripthandle, "Setup", "ForceSetup",&ForceSetup);
	SCRIPT_GetNumber( scripthandle, "Misc", "Executions",&ud.executions); ud.executions++;
	SCRIPT_GetNumber( scripthandle, "Misc", "RunMode",&RunMode);
	SCRIPT_GetNumber( scripthandle, "Misc", "Crosshairs",&ud.crosshair);
	SCRIPT_GetNumber( scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale);
	SCRIPT_GetNumber( scripthandle, "Misc", "ShowLevelStats",&ud.levelstats);
	SCRIPT_GetNumber( scripthandle, "Misc", "ShowOpponentWeapons",&ShowOpponentWeapons);
	dummy = useprecache; SCRIPT_GetNumber( scripthandle, "Misc", "UsePrecache",&dummy); useprecache = dummy != 0;
	// weapon choices are defaulted in checkcommandline, which may override them
	if (!CommandWeaponChoice) for(i=0;i<10;i++)
	{
		Bsprintf(buf,"WeaponChoice%ld",i);
		dummy = -1;
		SCRIPT_GetNumber( scripthandle, "Misc", buf, &dummy);
		if (dummy >= 0) ud.wchoice[0][i] = dummy;
	}

	SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXDevice",&FXDevice);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicDevice",&MusicDevice);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXVolume",&FXVolume);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicVolume",&MusicVolume);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "SoundToggle",&SoundToggle);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicToggle",&MusicToggle);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "VoiceToggle",&VoiceToggle);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "AmbienceToggle",&AmbienceToggle);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "NumVoices",&NumVoices);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "NumChannels",&NumChannels);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "NumBits",&NumBits);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "MixRate",&MixRate);
	SCRIPT_GetNumber( scripthandle, "Sound Setup", "ReverseStereo",&ReverseStereo);

	SCRIPT_GetNumber( scripthandle, "Controls","UseJoystick",&UseJoystick);
	SCRIPT_GetNumber( scripthandle, "Controls","UseMouse",&UseMouse);
	SCRIPT_GetNumber( scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip);	// mouse aiming inverted
	SCRIPT_GetNumber( scripthandle, "Controls","MouseAiming",&ud.mouseaiming);		// 1=momentary/0=toggle
	//SCRIPT_GetNumber( scripthandle, "Controls","GameMouseAiming",(int32 *)&ps[0].aim_mode);	// dupe of below (?)
	ps[0].aim_mode = ud.mouseaiming;
	SCRIPT_GetNumber( scripthandle, "Controls","AimingFlag",(int32 *)&myaimmode);	// (if toggle mode) gives state
	SCRIPT_GetNumber( scripthandle, "Controls","RunKeyBehaviour",&ud.runkey_mode);	// JBF 20031125
	SCRIPT_GetNumber( scripthandle, "Controls","AutoAim",&AutoAim);			// JBF 20031125
	ps[0].auto_aim = AutoAim;
	SCRIPT_GetNumber( scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch);

	CONFIG_ReadKeys();

	//CONFIG_SetupMouse(scripthandle);
	//CONFIG_SetupJoystick(scripthandle);
	return 0;
}