示例#1
0
StarCatalog::StarCatalog(
    const InputCatalog& incat,
    const ConfigFile& params, std::string fs_prefix) :
    _id(incat.getIdList()), _pos(incat.getPosList()), 
    _sky(incat.getSkyList()), _noise(incat.getNoiseList()),
    _flags(incat.getFlagsList()), _mag(incat.getMagList()), 
    _sg(incat.getSgList()), _nu(_id.size(),DEFVALNEG),
    _objsize(incat.getObjSizeList()),
    _is_star(_id.size(),0), _params(params), _prefix(fs_prefix)
{
    Assert(int(_id.size()) == size());
    Assert(int(_pos.size()) == size());
    Assert(int(_sky.size()) == size());
    Assert(int(_noise.size()) == size());
    Assert(int(_flags.size()) == size());
    if (_sg.size() == 0) _sg.resize(size(),DEFVALNEG);
    Assert(int(_sg.size()) == size());
    if (_nu.size() == 0) _nu.resize(size(),DEFVALNEG);
    Assert(int(_nu.size()) == size());
    if (_objsize.size() == 0) _objsize.resize(size(),DEFVALNEG);
    Assert(int(_objsize.size()) == size());
    Assert(int(_is_star.size()) == size());
    if (params.read("cat_all_stars",false)) {
        for(int i=0;i<size();++i) _is_star[i] = 1;
    } else if (params.read("stars_trust_sg",false)) {
        double minsg = params.get("stars_minsg");
        double maxsg = params.get("stars_maxsg");
        Assert(int(_sg.size()) == size());
        for(int i=0;i<size();++i) 
            _is_star[i] = (_sg[i] >= minsg && _sg[i] <= maxsg);
    } else {
        Assert(int(_mag.size()) == size());
    }
}
示例#2
0
string  cfgLoadStr(const wchar * Section, const wchar * Key, const wchar* Default)
{
	if(!cfgdb.has_entry(string(Section), string(Key)))
	{
			cfgSaveStr(Section, Key, Default);
	}
	return cfgdb.get(string(Section), string(Key), string(Default));
}
示例#3
0
	EvdevControllerMapping load_mapping(FILE* fd)
	{
		ConfigFile mf;
		mf.parse(fd);

		EvdevControllerMapping mapping = {
			mf.get("emulator", "mapping_name", "<Unknown>").c_str(),
			load_keycode(&mf, "dreamcast", "btn_a"),
			load_keycode(&mf, "dreamcast", "btn_b"),
			load_keycode(&mf, "dreamcast", "btn_c"),
			load_keycode(&mf, "dreamcast", "btn_d"),
			load_keycode(&mf, "dreamcast", "btn_x"),
			load_keycode(&mf, "dreamcast", "btn_y"),
			load_keycode(&mf, "dreamcast", "btn_z"),
			load_keycode(&mf, "dreamcast", "btn_start"),
			load_keycode(&mf, "emulator",  "btn_escape"),
			load_keycode(&mf, "dreamcast", "btn_dpad1_left"),
			load_keycode(&mf, "dreamcast", "btn_dpad1_right"),
			load_keycode(&mf, "dreamcast", "btn_dpad1_up"),
			load_keycode(&mf, "dreamcast", "btn_dpad1_down"),
			load_keycode(&mf, "dreamcast", "btn_dpad2_left"),
			load_keycode(&mf, "dreamcast", "btn_dpad2_right"),
			load_keycode(&mf, "dreamcast", "btn_dpad2_up"),
			load_keycode(&mf, "dreamcast", "btn_dpad2_down"),
			load_keycode(&mf, "compat",    "btn_trigger_left"),
			load_keycode(&mf, "compat",    "btn_trigger_right"),
			load_keycode(&mf, "compat",    "axis_dpad1_x"),
			load_keycode(&mf, "compat",    "axis_dpad1_y"),
			load_keycode(&mf, "compat",    "axis_dpad2_x"),
			load_keycode(&mf, "compat",    "axis_dpad2_y"),
			load_keycode(&mf, "dreamcast", "axis_x"),
			load_keycode(&mf, "dreamcast", "axis_y"),
			load_keycode(&mf, "dreamcast", "axis_trigger_left"),
			load_keycode(&mf, "dreamcast", "axis_trigger_right"),
			mf.get_bool("compat", "axis_x_inverted", false),
			mf.get_bool("compat", "axis_y_inverted", false),
			mf.get_bool("compat", "axis_trigger_left_inverted", false),
			mf.get_bool("compat", "axis_trigger_right_inverted", false)
		};
		return mapping;
	}
示例#4
0
void  cfgLoadStr(const wchar * Section, const wchar * Key, wchar * Return,const wchar* Default)
{
	string value = cfgdb.get(Section, Key, Default);
	// FIXME: Buffer overflow possible
	strcpy(Return, value.c_str());
}
示例#5
0
		ParticleSystem::ParticleSystem(TextureManager &texture_manager, ConfigFile &config_file)
			: position(0, 0, 0), unitx(1,0,0), unity(0,1,0), unitz(0,0,1), enabled(true), active(true), alive(true)
		{
			string texture;

			config_file.selectSection("ParticleSystem");
			config_file.get("dimensions", dimensions);
			config_file.get("maxparticles", maxparticles);
			config_file.get("minspawntime", minspawntime);
			config_file.get("maxspawntime", maxspawntime);
			config_file.get("maxspawncount", maxspawncount);

			config_file.selectSection("SpawnVelocity");
			config_file.get("min", minvel);
			config_file.get("max", maxvel);
			config_file.get("acceleration", acceleration);

			config_file.selectSection("Particle");
			config_file.get("texture", texture);
			config_file.get("startsize", startsize);
			config_file.get("endsize", endsize);
			config_file.get("minlifetime", minlifetime);
			config_file.get("maxlifetime", maxlifetime);
			config_file.get("startangle", startangle);
			config_file.get("endangle", endangle);
			config_file.get("startcolor", startcolor);
			config_file.get("endcolor", endcolor);

			this->texture = texture_manager.load(texture);
			spawntime = 0.0;
		}