Analog_device.patch

flypiper, 08/19/2010 10:59 am

Download (2.7 kB)

main/Beam.cpp (working copy)
8616 8616
		float rate=1;
8617 8617
		if(hydroSpeedCoupling)
8618 8618
		{
8619
			rate=40.0/(10.0+fabs(wspeed/2.0));
8620

  
8619
			//new rate value (30 instead of 40) to deal with the changed cmdKeyInertia settings
8620
			rate=30.0/(10.0+fabs(wspeed/2.0));
8621 8621
			// minimum rate: 20% --> enables to steer high velocity trucks
8622 8622
			if(rate<1.2) rate = 1.2;
8623 8623
		}
8624
		if (hydrodircommand!=0)
8625
		{
8626
			if (hydrodirstate > hydrodircommand)
8627
				hydrodirstate -= dt * rate;
8628
			else
8629
				hydrodirstate += dt * rate;
8630
		}
8624
		//need a maximum rate for analog devices, otherwise hydro beams break
8625
		if (!hydroSpeedCoupling)
8626
			rate=100;
8627

  
8628
		if (hydrodirstate > hydrodircommand)
8629
			hydrodirstate -= dt * rate;
8630
		else
8631
			hydrodirstate += dt * rate;
8632

  
8631 8633
		if(hydroSpeedCoupling)
8632 8634
		{
8633 8635
			float dirdelta=dt;
main/CmdKeyInertia.cpp (working copy)
35 35
		cmdKeyInertia[i].time=0.0f;
36 36
		cmdKeyInertia[i].startSpline=0;
37 37
		cmdKeyInertia[i].stopSpline=0;
38
		//set "normal" values with nearly no delay
39
		setCmdKeyDelay(i,10.0,10.0,"constant","constant");
38
		cmdKeyInertia[i].startDelay=0;
39
		cmdKeyInertia[i].stopDelay=0;
40 40
	}
41 41
}
42 42
CmdKeyInertia::~CmdKeyInertia()
main/InputEngine.cpp (working copy)
2119 2119
	std::vector<event_trigger_t> t_vec = events[eventID];
2120 2120
	if(t_vec.size() > 0)
2121 2121
	{
2122
		if(t_vec[0].eventtype == ET_MouseAxisX \
2123
			|| t_vec[0].eventtype == ET_MouseAxisY \
2124
			|| t_vec[0].eventtype == ET_MouseAxisZ \
2125
			|| t_vec[0].eventtype == ET_JoystickAxisAbs \
2126
			|| t_vec[0].eventtype == ET_JoystickAxisRel \
2127
			|| t_vec[0].eventtype == ET_JoystickSliderX \
2128
			|| t_vec[0].eventtype == ET_JoystickSliderY)
2129
			return true;
2130
		else
2131
			return false;
2122
		//loop through all eventtypes, because we want to find a analog device wether it is the first device or not
2123
		//this means a analog device is always preferred over a digital one
2124
		for (unsigned int i=0;i<t_vec.size();i++)
2125
		{
2126
			if(t_vec[i].eventtype == ET_MouseAxisX \
2127
				|| t_vec[i].eventtype == ET_MouseAxisY \
2128
				|| t_vec[i].eventtype == ET_MouseAxisZ \
2129
				|| t_vec[i].eventtype == ET_JoystickAxisAbs \
2130
				|| t_vec[i].eventtype == ET_JoystickAxisRel \
2131
				|| t_vec[i].eventtype == ET_JoystickSliderX \
2132
				|| t_vec[i].eventtype == ET_JoystickSliderY)
2133
				{
2134
					return true;
2135
				}
2136
		}
2132 2137
	}
2133 2138
	return false;
2134 2139
#if 0