示例#1
0
void xrSASH::GetAllOptions()
{
	Msg("SASH:: GetAllOptions.");
	TryInitEngine();

	oaNamedOptionStruct Option; 
	oaInitOption(&Option);
	
	DescribeOption("renderer",		Option.Dependency);
	DescribeOption("vid_mode",		Option.Dependency);
	DescribeOption("rs_fullscreen", Option.Dependency);

	DescribeOption("rs_vis_distance",				Option.Dependency);
	DescribeOption("r__geometry_lod",				Option.Dependency);
	DescribeOption("r__detail_density",				Option.Dependency);
	DescribeOption("texture_lod",					Option.Dependency);
	DescribeOption("r__tf_aniso",					Option.Dependency);
	DescribeOption("ai_use_torch_dynamic_lights",	Option.Dependency);

	//	r1 only
	Option.Dependency.ParentName = TEXT("renderer");
	Option.Dependency.ComparisonOp = OA_COMP_OP_EQUAL;
	Option.Dependency.ComparisonVal.Enum = TEXT("renderer_r1");
	Option.Dependency.ComparisonValType = GetOptionType("renderer");
	{
		DescribeOption("r__supersample",		Option.Dependency);
		DescribeOption("r1_no_detail_textures", Option.Dependency);
	}

	//	>=r2
	oaInitOption(&Option);	//	Reset dependency info
	//	Currently only equal/not equal works
	//Option.Dependency.ParentName = TEXT("renderer");
	//Option.Dependency.ComparisonOp = OA_COMP_OP_GREATER_OR_EQUAL;
	//Option.Dependency.ComparisonVal.Enum = TEXT("renderer_r2");
	//Option.Dependency.ComparisonValType = GetOptionType("renderer");
	{
		DescribeOption("r2_sun", Option.Dependency);
		DescribeOption("r2_sun_quality", Option.Dependency);
		DescribeOption("r2_slight_fade", Option.Dependency);
		DescribeOption("r2_ls_squality", Option.Dependency);
		DescribeOption("r2_detail_bump", Option.Dependency);
	}

	//	>=r2.5
	//Option.Dependency.ParentName = TEXT("renderer");
	//Option.Dependency.ComparisonOp = OA_COMP_OP_GREATER_OR_EQUAL;
	//Option.Dependency.ComparisonVal.Enum = TEXT("renderer_r2.5");
	//Option.Dependency.ComparisonValType = GetOptionType("renderer");
	{
		DescribeOption("r2_sun_shafts",			Option.Dependency);
		DescribeOption("r2_ssao",				Option.Dependency);
		DescribeOption("r2_ssao_opt_data",		Option.Dependency);
		DescribeOption("r2_ssao_half_data",		Option.Dependency);
		DescribeOption("r2_ssao_hbao",			Option.Dependency);
		DescribeOption("r2_soft_water",			Option.Dependency);
		DescribeOption("r2_soft_particles",		Option.Dependency);
		DescribeOption("r2_dof_enable",			Option.Dependency);
		DescribeOption("r2_volumetric_lights",	Option.Dependency);
		DescribeOption("r2_steep_parallax",		Option.Dependency);
	}

	//	>=r3
	//Option.Dependency.ParentName = TEXT("renderer");
	//Option.Dependency.ComparisonOp = OA_COMP_OP_GREATER_OR_EQUAL;
	//Option.Dependency.ComparisonVal.Enum = TEXT("renderer_r3");
	//Option.Dependency.ComparisonValType = GetOptionType("renderer");
	{
		DescribeOption("r3_dynamic_wet_surfaces",Option.Dependency);
		DescribeOption("r3_volumetric_smoke",	Option.Dependency);
		DescribeOption("r3_gbuff_opt",			Option.Dependency);
		DescribeOption("r3_use_dx10_1",			Option.Dependency);
		DescribeOption("r3_minmax_sm",			Option.Dependency);
		DescribeOption("r3_msaa",				Option.Dependency);
		//	>= 2x
		//Option.Dependency.ParentName = TEXT("r3_msaa");
		//Option.Dependency.ComparisonOp = OA_COMP_OP_GREATER_OR_EQUAL;
		//Option.Dependency.ComparisonVal.Enum = TEXT("2x");
		//Option.Dependency.ComparisonValType = GetOptionType("r3_msaa");
		{
			DescribeOption("r3_msaa_opt",			Option.Dependency);
			DescribeOption("r3_msaa_alphatest",		Option.Dependency);
		}
	}

	ReleaseEngine();
}
示例#2
0
void xrSASH::DescribeOption( char* pszOptionName, const oaOptionDependency &Dependency)
{
	oaNamedOptionStruct Option; 
	oaInitOption(&Option);

	Option.Dependency = Dependency;

	CConsole::vecCMD_IT I = Console->Commands.find(pszOptionName);
	if (I==Console->Commands.end())
	{
		Msg("SASH:: Option \"%s\" not found.", pszOptionName);
		VERIFY(I!=Console->Commands.end());
		return;
	}
	
	IConsole_Command* pCmd = I->second;
	CCC_Mask* pMask = dynamic_cast<CCC_Mask*>(pCmd);
	CCC_Token* pToken = dynamic_cast<CCC_Token*>(pCmd);
	CCC_Float* pFloat = dynamic_cast<CCC_Float*>(pCmd);
	CCC_Integer* pInt = dynamic_cast<CCC_Integer*>(pCmd);

	Option.Name = pszOptionName;

	Msg("SASH:: Registering option \"%s\".", pszOptionName);

	if (pMask)
	{
		Option.DataType = OA_TYPE_BOOL;
		oaAddOption(&Option);
	}
	else if (pToken)
	{
		Option.DataType = OA_TYPE_ENUM;
		xr_token* pXRToken = pToken->GetToken();

		while (pXRToken->name)
		{
			Option.Value.Enum = (char*)pXRToken->name;
			oaAddOption(&Option);
			++pXRToken;
		}
	}
	else if (pFloat)
	{
		Option.DataType = OA_TYPE_FLOAT;
		float mn,mx;

		pFloat->GetBounds		(mn, mx);
		Option.MinValue.Float	= mn;
		Option.MaxValue.Float	= mx;
		Option.NumSteps			= (int)((mx - mn) / 0.1f);
		oaAddOption				(&Option);
	}
	else if (pInt)
	{
		Option.DataType			= OA_TYPE_INT;
		int mn, mx;
		pInt->GetBounds			(mn, mx);
		Option.MinValue.Int		= mn;
		Option.MaxValue.Int		= mx;
		oaAddOption				(&Option);
	}
	else
	{
		VERIFY(!"Unsupported console command type.");
	}
}
示例#3
0
void SimpleAppSettings::InitOptions(void)
{
  {
    oaNamedOption *Option;
    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "User/Resolution";
    Option->DataType = OA_TYPE_ENUM;
    Option->Value.Enum = "640x480";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "1024x768";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "1600x1200";

    /* AA (enum) */
    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "User/AA";
    Option->DataType = OA_TYPE_ENUM;

    Option->Value.Enum = "Off";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "2X";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "4X";

    /* Sound (bool) */
    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "User/Sound";
    Option->DataType = OA_TYPE_BOOL;

    /* Music Enabled (bool) */
    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "User/Music Enabled";
    Option->DataType = OA_TYPE_BOOL;
    Option->Dependency.ParentName = "User/Sound";
    Option->Dependency.ComparisonOp = OA_COMP_OP_EQUAL;
    Option->Dependency.ComparisonValType = OA_TYPE_BOOL;
    Option->Dependency.ComparisonVal.Bool = OA_ON;

    /* Enemy Density (int) */
    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "User/Enemy Density";
    Option->DataType = OA_TYPE_INT;
    Option->MinValue.Int = 0;
    Option->MaxValue.Int = 100;
    Option->NumSteps = 100;

    /* Compression Level (int) */
    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "Compression Level";
    Option->DataType = OA_TYPE_INT;
    Option->MinValue.Int = 0;
    Option->MaxValue.Int = 10;
    Option->NumSteps = 10;

    /* Texture Quality (float) */
    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "Texture Quality";
    Option->DataType = OA_TYPE_FLOAT;
    Option->MinValue.Float = 0.0;
    Option->MaxValue.Float = 100.0;
    Option->NumSteps = 0;

    /* Texture Size (enum) */
    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "Texture Size";
    Option->DataType = OA_TYPE_ENUM;
    Option->Value.Enum = "128";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "256";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "512";

    ////////////////////////////////////////
    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "vid_mode";
    Option->DataType = OA_TYPE_ENUM;
    Option->Value.Enum = "640x480";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "1024x768";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "1280x1024";

    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "r__tf_aniso";
    Option->DataType = OA_TYPE_INT;
    Option->MinValue.Int = 0;
    Option->MaxValue.Int = 100;
    Option->NumSteps = 100;

    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "r2_sun_shafts";
    Option->DataType = OA_TYPE_ENUM;
    Option->Value.Enum = "High";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "Low";

    Options[NumOptions] = *Option;
    Option = &Options[NumOptions++];
    Option->Value.Enum = "Medium";

    Option = &Options[NumOptions++];
    oaInitOption(Option);
    Option->Name = "r2_slight_fade";
    Option->DataType = OA_TYPE_FLOAT;
    Option->MinValue.Float = 0.0;
    Option->MaxValue.Float = 100.0;
    Option->NumSteps = 200;
    ///////////////////////////////////////
  }

  //****************************************************************************
  //*** Init OptionValues
  //****************************************************************************
  
  // Initialize default options
  for(int i=0; i < NumOptions; ++i)
  {
    string Name(Options[i].Name);
    OptionValueMap[Name].Name = Options[i].Name;
    OptionValueMap[Name].Type = Options[i].DataType;
    OptionValueMap[Name].Value = Options[i].Value;
  }

  InitDefaultOptions();
  ///////////////////////////////////////////////////////
  // Load any persistent options if they've been previously set
  ReadOptionsFile();
}