예제 #1
0
void cbVar (CConfigFile::CVar &var)
{
	if (CWaterTask::getInstance().WaterShape == 0)
	{
		nlwarning ("Can't set water parameter");
		return;
	}
	
	if (var.Name == "Map1Scale")
		CWaterTask::getInstance().WaterShape->setHeightMapScale(0, NLMISC::CVector2f(var.asFloat(0), var.asFloat(1)));
	else if (var.Name == "Map2Scale")
		CWaterTask::getInstance().WaterShape->setHeightMapScale(1, NLMISC::CVector2f(var.asFloat(0), var.asFloat(1)));
	else if (var.Name == "Map1Speed")
		CWaterTask::getInstance().WaterShape->setHeightMapSpeed(0, NLMISC::CVector2f(var.asFloat(0), var.asFloat(1)));
	else if (var.Name == "Map2Speed")
		CWaterTask::getInstance().WaterShape->setHeightMapSpeed(1, NLMISC::CVector2f(var.asFloat(0), var.asFloat(1)));
	else if (var.Name == "WaveHeightFactor")
		CWaterTask::getInstance().WaterShape->setWaveHeightFactor(var.asFloat());
	else if (var.Name == "WavesParams")
	{
		CWaterHeightMap &whm = GetWaterPoolManager().getPoolByID(0);
		whm.setWaves (var.asFloat(0), var.asFloat(1), (uint)var.asFloat(2), var.asFloat(3) == 1.0f);
	}
	else if (var.Name == "WavesPropagation")
	{
		CWaterHeightMap &whm = GetWaterPoolManager().getPoolByID(0);
		whm.setPropagationTime(var.asFloat());
	}
	else
		nlstop;
}
예제 #2
0
void	cbUpdateMouseListenerConfig(CConfigFile::CVar &var)
{
	if (var.Name == "MouseInvert") MouseListener->setInvertMouseMode(var.asInt() != 0);
	else if (var.Name == "MouseZoomStep") MouseZoomStep = var.asFloat ();
	else if (var.Name == "ViewLagBehind") MouseListener->setViewLagBehind(var.asFloat ());
	else if (var.Name == "ViewHeight") MouseListener->setViewHeight(var.asFloat ());
	else if (var.Name == "ViewTargetHeight") MouseListener->setViewTargetHeight(var.asFloat ());
	else nlwarning ("Unknown variable update %s", var.Name.c_str());
}
예제 #3
0
파일: radar.cpp 프로젝트: rbjarnason/Mayans
void cbUpdateRadar (CConfigFile::CVar &var)
{
	if (var.Name == "RadarPosX") RadarPosX = var.asFloat ();
	else if (var.Name == "RadarPosY") RadarPosY = var.asFloat ();
	else if (var.Name == "RadarWidth") RadarWidth = var.asFloat ();
	else if (var.Name == "RadarHeight") RadarHeight = var.asFloat ();
	else if (var.Name == "RadarBackColor") RadarBackColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarFrontColor") RadarFrontColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarSelfColor") RadarSelfColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarOtherColor") RadarOtherColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarDynamicColor") RadarDynamicColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarPlaceColor") RadarPlaceColor.set (var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
	else if (var.Name == "RadarEntitySize") RadarEntitySize = var.asFloat ();
	else if (var.Name == "RadarState") RadarState = var.asInt ();
	else if (var.Name == "RadarDistance") RadarDistance = var.asInt ();
	else if (var.Name == "RadarMinDistance") RadarMinDistance = var.asInt ();
	else if (var.Name == "RadarMaxDistance") RadarMaxDistance = var.asInt ();
	else if (var.Name == "URLSelectionTimeout") SelectionTimeOut = var.asInt ();
	else if (var.Name == "RadarParticularPlaces")
	{
		RadarParticularPlaces.clear ();
		for (sint i = 0; i < var.size(); i += 4)
		{
			RadarParticularPlaces.push_back (RadarParticularPlace(var.asFloat(i), var.asFloat(i+1), var.asString(i+2), var.asString(i+3)));
		}
	}
	else if (var.Name == "RadarFontSize") RadarFontSize = var.asInt ();
	else if (var.Name == "RadarLittlePosX") RadarLittlePosX = var.asFloat ();
	else if (var.Name == "RadarLittlePosY") RadarLittlePosY = var.asFloat ();
	else if (var.Name == "RadarLittleRadius") RadarLittleRadius = var.asFloat ();
	else nlwarning ("Unknown variable update %s", var.Name.c_str());
}
예제 #4
0
void cbUpdateCompass (CConfigFile::CVar &var)
{
	if (var.Name == "CompassPosX") CompassPosX = var.asFloat ();
	else if (var.Name == "CompassPosY") CompassPosY = var.asFloat ();
	else if (var.Name == "CompassRadius") CompassRadius = var.asFloat ();
	else if (var.Name == "CompassColor") 
	{
		CompassColor.set(var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
		CompassMaterial.setColor(CompassColor);
	}
	else nlwarning ("Unknown variable update %s", var.Name.c_str());
}
예제 #5
0
// Float version
bool	getVarFromConfigFile(CConfigFile &cf, const string &name, float &variable, float defaultValue = 0.0f)
{
	CConfigFile::CVar	*ptr = cf.getVarPtr(name);
	bool	success;
	variable = ((success = (ptr != NULL)) ? ptr->asFloat() : defaultValue);
	return success;
}