Exemple #1
0
void update_collective_pressure_inputs (void)
{

	current_flight_dynamics->input_data.collective.delta = current_flight_dynamics->input_data.collective.value;

	switch (get_global_collective_input ())
	{

		case KEYBOARD_INPUT:
		case MOUSE_INPUT:
		{
		
			if (current_flight_dynamics->input_data.collective_input_pressure & COLLECTIVE_PRESSURE_BACKWARD)
			{
		
				current_flight_dynamics->input_data.collective_pressure.value = min (0.0f, current_flight_dynamics->input_data.collective_pressure.value);
		
				current_flight_dynamics->input_data.collective_pressure.value -= 5.0 * get_delta_time ();
			}
			else if (current_flight_dynamics->input_data.collective_input_pressure & COLLECTIVE_PRESSURE_FORWARD)
			{
		
				current_flight_dynamics->input_data.collective_pressure.value = max (0.0f, current_flight_dynamics->input_data.collective_pressure.value);
		
				current_flight_dynamics->input_data.collective_pressure.value += 5.0 * get_delta_time ();
			}
			else
			{
		
				current_flight_dynamics->input_data.collective_pressure.value = 0.0;
			}
		
			current_flight_dynamics->input_data.collective_pressure.value = bound (current_flight_dynamics->input_data.collective_pressure.value,
																											current_flight_dynamics->input_data.collective_pressure.min,
																											current_flight_dynamics->input_data.collective_pressure.max);
	
			break;
		}
		case THROTTLE_INPUT:
		{

			int
				joyval;

			float
				input;

			// 030418 loke
			// implemented multiple joystick device selection
			if (command_line_collective_joystick_index == -1)
			{
				joyval = get_joystick_axis (current_flight_dynamics->input_data.cyclic_joystick_device_index, JOYSTICK_DEFAULT_AXIS_THROTTLE);
			}
			else
			{
				joyval = get_joystick_axis (command_line_collective_joystick_index, command_line_collective_joystick_axis);
			}


			if (non_linear_collective)
			{
				input = 0.5 + ((float) joyval ) / ((float) JOYSTICK_AXIS_MAXIMUM - (float) JOYSTICK_AXIS_MINIMUM);

				if (input < command_line_collective_zone_1_limit)
				{
					// start variable percentage at zone1 by GCsDriver 08-12-2007
					input *= command_line_collective_percentage_at_zone1 * zone_1_scale;
					input -= command_line_collective_percentage_at_zone1;  // 0% -> -60
					// original
					//input *= 60.0 * zone_1_scale;
					//input -= 60.0;  // 0% -> -60
				}
				else if (input < command_line_collective_zone_2_limit)
				{
					// find amount over limit
					input -= command_line_collective_zone_1_limit;
					input *= (100.0-command_line_collective_percentage_at_zone1) * zone_2_scale;
					// original
					//input -= command_line_collective_zone_1_limit;
					//input *= 40.0 * zone_2_scale;
				}
				else
				{
					// find amount over limit
					input -= command_line_collective_zone_2_limit;
					input *= 20.0 * zone_3_scale;
					input += (100.0-command_line_collective_percentage_at_zone1);   // 100% -> +40
					// original
					//input -= command_line_collective_zone_2_limit;
					//input *= 20.0 * zone_3_scale;
					//input += 40.0;   // 100% -> +40
					// end variable percentage at zone1 by GCsDriver 08-12-2007
				}
			}
			else
				input = (float) (120.0 * (float) joyval ) / ((float) JOYSTICK_AXIS_MAXIMUM - (float) JOYSTICK_AXIS_MINIMUM);

			if ((current_flight_dynamics->auto_hover != HOVER_HOLD_STABLE) && (current_flight_dynamics->auto_hover != HOVER_HOLD_ALTITUDE_LOCK))
			{
		
				if (get_current_dynamics_options (DYNAMICS_OPTIONS_REVERSE_THROTTLE_INPUT))
				{
	
					current_flight_dynamics->input_data.collective.value = (float) 60.0 - input;
				}
				else
				{
	
					current_flight_dynamics->input_data.collective.value = (float) 60.0 + input;
				}
			}
			break;
		}
	}

	// recalculate collective position

	if (current_flight_dynamics->input_data.collective_pressure.value)
	{
	
		current_flight_dynamics->input_data.collective.value += 10.0 * current_flight_dynamics->input_data.collective_pressure.value * get_delta_time ();
	}
	else
	{

		// restore
	}

	if (current_flight_dynamics->input_data.collective.damaged)
	{

		current_flight_dynamics->input_data.collective.value += (get_model_delta_time ()) * (7.5 * sfrand1 () * current_flight_dynamics->input_data.collective.delta);
	}

	current_flight_dynamics->input_data.collective.value = bound (current_flight_dynamics->input_data.collective.value,
																						current_flight_dynamics->input_data.collective.min,
																						current_flight_dynamics->input_data.collective.max);
		
	current_flight_dynamics->input_data.collective.delta -= current_flight_dynamics->input_data.collective.value;
	current_flight_dynamics->input_data.collective.delta *= -1.0;
}
Exemple #2
0
void update_dynamics_damage (void)
{

	int
		damage;

	for (damage = 1; damage < NUM_DYNAMICS_DAMAGE_TYPES; damage = damage << 1)
	{

		if (current_flight_dynamics->dynamics_damage & damage)
		{

			switch (damage)
			{

				case DYNAMICS_DAMAGE_MAIN_ROTOR:
				case DYNAMICS_DAMAGE_TAIL_ROTOR:
				case DYNAMICS_DAMAGE_LEFT_ENGINE:
				case DYNAMICS_DAMAGE_RIGHT_ENGINE:
				case DYNAMICS_DAMAGE_LOW_HYDRAULICS:
				case DYNAMICS_DAMAGE_LOW_OIL_PRESSURE:
				case DYNAMICS_DAMAGE_HIGH_OIL_PRESSURE:
				case DYNAMICS_DAMAGE_AVIONICS:
				case DYNAMICS_DAMAGE_FIRE_EXTINGUISHER:
				case DYNAMICS_DAMAGE_UNDERCARRIAGE:
				{

					break;
				}
				case DYNAMICS_DAMAGE_LEFT_ENGINE_FIRE:
				{

					if (current_flight_dynamics->dynamics_damage & ~DYNAMICS_DAMAGE_LEFT_ENGINE)
					{

						current_flight_dynamics->left_engine_temp.value += 10.0 * get_delta_time ();

						if (current_flight_dynamics->left_engine_temp.value > current_flight_dynamics->left_engine_temp.max)
						{

							dynamics_damage_model (DYNAMICS_DAMAGE_LEFT_ENGINE, FALSE);
						}

						#if DEBUG_MODULE

						debug_log ("DYNAMICS: left engine fire temp %f", current_flight_dynamics->left_engine_temp.value);

						#endif
					}

					break;
				}
				case DYNAMICS_DAMAGE_RIGHT_ENGINE_FIRE:
				{

					if (current_flight_dynamics->dynamics_damage & ~DYNAMICS_DAMAGE_RIGHT_ENGINE)
					{

						current_flight_dynamics->right_engine_temp.value += 10.0 * get_delta_time ();

						if (current_flight_dynamics->right_engine_temp.value > current_flight_dynamics->right_engine_temp.max)
						{

							dynamics_damage_model (DYNAMICS_DAMAGE_RIGHT_ENGINE, FALSE);
						}

						#if DEBUG_MODULE

						debug_log ("DYNAMICS: right engine fire temp %f", current_flight_dynamics->right_engine_temp.value);

						#endif
					}

					break;
				}
				case DYNAMICS_DAMAGE_STABILISER:
				{

					//
					// move cog about ramdomly
					//

					if (get_local_entity_int_value (get_gunship_entity (), INT_TYPE_AIRBORNE_AIRCRAFT))
					{

						current_flight_dynamics->centre_of_gravity.x += current_flight_dynamics->roll.value * get_model_delta_time ();
						current_flight_dynamics->centre_of_gravity.z -= current_flight_dynamics->pitch.value * get_model_delta_time ();

						current_flight_dynamics->centre_of_gravity.x = bound (current_flight_dynamics->centre_of_gravity.x, -0.1, 0.1);
						current_flight_dynamics->centre_of_gravity.z = bound (current_flight_dynamics->centre_of_gravity.z, -0.1, 0.1);

						#if DEBUG_MODULE

						debug_log ("DYNAMICS: stabaliser damaged : cog %f, %f", current_flight_dynamics->centre_of_gravity.x, current_flight_dynamics->centre_of_gravity.z);

						#endif
					}

					break;
				}

				case DYNAMICS_DAMAGE_FUEL_LEAK:
				{

					current_flight_dynamics->fuel_weight.value -= FUEL_LEAK_RATE * get_delta_time ();

					current_flight_dynamics->fuel_weight.value = max (current_flight_dynamics->fuel_weight.value, 0.0);

					#if DEBUG_MODULE

					debug_log ("DYNAMICS: fuel leak, currently %f", current_flight_dynamics->fuel_weight.value);

					#endif

					break;
				}
			}
		}
	}
}
Exemple #3
0
void update_cyclic_pressure_inputs (void)
{

	float
		trim_x,
		trim_y;

	if (!current_flight_dynamics)
	{

		return;
	}

	if (hydraulic_pressure_loss_rate && hydraulic_pressure > 0.0)
	{
		hydraulic_pressure -= hydraulic_pressure_loss_rate * get_delta_time();

		if (hydraulic_pressure < 0.0)
			hydraulic_pressure = 0.0;
	}

	trim_x = current_flight_dynamics->input_data.cyclic_x_trim.value;
	trim_y = current_flight_dynamics->input_data.cyclic_y_trim.value;

	if (trim_button_held)
	{
		current_flight_dynamics->input_data.cyclic_x.value = current_flight_dynamics->input_data.cyclic_x_trim.value;
		current_flight_dynamics->input_data.cyclic_y.value = current_flight_dynamics->input_data.cyclic_y_trim.value;
	}
	else
		switch (get_global_cyclic_input ())
		{

			case KEYBOARD_INPUT:
			case MOUSE_INPUT:
			{

				if (current_flight_dynamics->input_data.cyclic_input_pressure & CYCLIC_PRESSURE_LEFT)
				{

					current_flight_dynamics->input_data.cyclic_horizontal_pressure.value = min (0.0f, current_flight_dynamics->input_data.cyclic_horizontal_pressure.value);

					current_flight_dynamics->input_data.cyclic_x.value = min ((current_flight_dynamics->input_data.cyclic_x.value) / 2.0f, current_flight_dynamics->input_data.cyclic_x.value);

					current_flight_dynamics->input_data.cyclic_horizontal_pressure.value -= MODEL_FRAME_RATE * get_model_delta_time ();

					if ((current_flight_dynamics->auto_hover == HOVER_HOLD_NORMAL) ||
						(current_flight_dynamics->auto_hover == HOVER_HOLD_STABLE))
					{

						set_current_flight_dynamics_auto_hover (HOVER_HOLD_NONE);
						set_current_flight_dynamics_auto_pilot (FALSE);
					}
				}
				else if (current_flight_dynamics->input_data.cyclic_input_pressure & CYCLIC_PRESSURE_RIGHT)
				{

					current_flight_dynamics->input_data.cyclic_horizontal_pressure.value = max (0.0f, current_flight_dynamics->input_data.cyclic_horizontal_pressure.value);

					current_flight_dynamics->input_data.cyclic_x.value = max ((current_flight_dynamics->input_data.cyclic_x.value) / 2.0f, current_flight_dynamics->input_data.cyclic_x.value);

					current_flight_dynamics->input_data.cyclic_horizontal_pressure.value += MODEL_FRAME_RATE * get_model_delta_time ();

					if ((current_flight_dynamics->auto_hover == HOVER_HOLD_NORMAL) ||
						(current_flight_dynamics->auto_hover == HOVER_HOLD_STABLE))
					{

						set_current_flight_dynamics_auto_hover (HOVER_HOLD_NONE);
						set_current_flight_dynamics_auto_pilot (FALSE);
					}
				}
				else
				{

					if (fabs (current_flight_dynamics->input_data.cyclic_horizontal_pressure.value) < 1.0)
					{

						current_flight_dynamics->input_data.cyclic_horizontal_pressure.value = 0.0;
					}
					else
					{

						current_flight_dynamics->input_data.cyclic_horizontal_pressure.value -= ((MODEL_FRAME_RATE * get_model_delta_time ()) / 2.0) * (current_flight_dynamics->input_data.cyclic_horizontal_pressure.value);
					}
				}



				if (current_flight_dynamics->input_data.cyclic_input_pressure & CYCLIC_PRESSURE_BACKWARD)
				{

					current_flight_dynamics->input_data.cyclic_vertical_pressure.value = min (0.0f, current_flight_dynamics->input_data.cyclic_vertical_pressure.value);

					current_flight_dynamics->input_data.cyclic_y.value = min (current_flight_dynamics->input_data.cyclic_y.value / 2.0f, current_flight_dynamics->input_data.cyclic_y.value);

					current_flight_dynamics->input_data.cyclic_vertical_pressure.value -= MODEL_FRAME_RATE * get_model_delta_time ();

					if ((current_flight_dynamics->auto_hover == HOVER_HOLD_NORMAL) ||
						(current_flight_dynamics->auto_hover == HOVER_HOLD_STABLE))
					{

						set_current_flight_dynamics_auto_hover (HOVER_HOLD_NONE);
						set_current_flight_dynamics_auto_pilot (FALSE);
					}
				}
				else if (current_flight_dynamics->input_data.cyclic_input_pressure & CYCLIC_PRESSURE_FORWARD)
				{

					current_flight_dynamics->input_data.cyclic_vertical_pressure.value = max (0.0f, current_flight_dynamics->input_data.cyclic_vertical_pressure.value);

					current_flight_dynamics->input_data.cyclic_y.value = max (current_flight_dynamics->input_data.cyclic_y.value / 2.0f, current_flight_dynamics->input_data.cyclic_y.value);

					current_flight_dynamics->input_data.cyclic_vertical_pressure.value += MODEL_FRAME_RATE * get_model_delta_time ();

					if ((current_flight_dynamics->auto_hover == HOVER_HOLD_NORMAL) ||
						(current_flight_dynamics->auto_hover == HOVER_HOLD_STABLE))
					{

						set_current_flight_dynamics_auto_hover (HOVER_HOLD_NONE);
						set_current_flight_dynamics_auto_pilot (FALSE);
					}
				}
				else
				{

					if (fabs (current_flight_dynamics->input_data.cyclic_vertical_pressure.value) < 1.0)
					{

						current_flight_dynamics->input_data.cyclic_vertical_pressure.value = 0.0;
					}
					else
					{

						current_flight_dynamics->input_data.cyclic_vertical_pressure.value -= ((MODEL_FRAME_RATE * get_model_delta_time ()) / 2.0) * (current_flight_dynamics->input_data.cyclic_vertical_pressure.value);
					}
				}

				// limit pressure inputs

				current_flight_dynamics->input_data.cyclic_horizontal_pressure.value = bound (
																					current_flight_dynamics->input_data.cyclic_horizontal_pressure.value,
																					current_flight_dynamics->input_data.cyclic_horizontal_pressure.min,
																					current_flight_dynamics->input_data.cyclic_horizontal_pressure.max
																					);

				current_flight_dynamics->input_data.cyclic_vertical_pressure.value = bound (current_flight_dynamics->input_data.cyclic_vertical_pressure.value,
																					current_flight_dynamics->input_data.cyclic_vertical_pressure.min,
																					current_flight_dynamics->input_data.cyclic_vertical_pressure.max
																					);

				// recalculate cyclic position

				if (current_flight_dynamics->input_data.cyclic_horizontal_pressure.value)
				{

					current_flight_dynamics->input_data.cyclic_x.value += (MODEL_FRAME_RATE * get_model_delta_time ()) * current_flight_dynamics->input_data.cyclic_horizontal_pressure.value;
					//current_flight_dynamics->input_data.cyclic_x.value += (MODEL_FRAME_RATE * get_model_delta_time ()) * (current_flight_dynamics->input_data.cyclic_horizontal_pressure.value);// + current_flight_dynamics->input_data.cyclic_x_trim.value);
				}
				else
				{

					// restore x
					//Werewolf: Removed old debug code, removed redundant multiplications

					if (get_global_cyclic_input () == KEYBOARD_INPUT)
					{
						if (get_current_dynamics_options (DYNAMICS_OPTIONS_KEYBOARD_ASSISTANCE))
						{
							current_flight_dynamics->input_data.cyclic_x.value += ((1.0 / 16.0) * MODEL_FRAME_RATE * get_model_delta_time ()) * (current_flight_dynamics->input_data.cyclic_x_trim.value - current_flight_dynamics->input_data.cyclic_x.value);
						}
						else
						{
							current_flight_dynamics->input_data.cyclic_x.value += ((3.0 / 4.0) * MODEL_FRAME_RATE * get_model_delta_time ()) * (current_flight_dynamics->input_data.cyclic_x_trim.value - current_flight_dynamics->input_data.cyclic_x.value);
						}
					}
					else if (get_global_cyclic_input () == MOUSE_INPUT)
					{
						if (fabs (current_flight_dynamics->input_data.cyclic_x.value) < 5.0)
						{
							current_flight_dynamics->input_data.cyclic_x.value *= 0.8;
						}
					}
				}

				if (current_flight_dynamics->input_data.cyclic_vertical_pressure.value)
				{
					//current_flight_dynamics->input_data.cyclic_y.value += (MODEL_FRAME_RATE * get_model_delta_time ()) * (current_flight_dynamics->input_data.cyclic_vertical_pressure.value + current_flight_dynamics->input_data.cyclic_y_trim.value);
					current_flight_dynamics->input_data.cyclic_y.value += (MODEL_FRAME_RATE * get_model_delta_time ()) * (current_flight_dynamics->input_data.cyclic_vertical_pressure.value);// + current_flight_dynamics->input_data.cyclic_y_trim.value);
				}
				else
				{

					// restore y

					if (get_global_cyclic_input () == KEYBOARD_INPUT)
					{
						if (get_current_dynamics_options (DYNAMICS_OPTIONS_KEYBOARD_ASSISTANCE))
						{
							current_flight_dynamics->input_data.cyclic_y.value += ((1.0 / 16.0) * MODEL_FRAME_RATE * get_model_delta_time ()) * (current_flight_dynamics->input_data.cyclic_y_trim.value - current_flight_dynamics->input_data.cyclic_y.value);
						}
						else
						{
							current_flight_dynamics->input_data.cyclic_y.value += ((3.0 / 4.0) * MODEL_FRAME_RATE * get_model_delta_time ()) * (current_flight_dynamics->input_data.cyclic_y_trim.value - current_flight_dynamics->input_data.cyclic_y.value);
						}
					}
					else if (get_global_cyclic_input () == MOUSE_INPUT)
					{
						if (fabs (current_flight_dynamics->input_data.cyclic_y.value) < 5.0)
						{
							debug_fatal ("CYCLIC: code with delta time");
							current_flight_dynamics->input_data.cyclic_y.value *= 0.8;
						}
					}
				}

				break;
			}

			case JOYSTICK_INPUT:
			{

				int
					joyval;

				float
					input;

				// 030418 loke
				// implemented multiple joystick device selection

				// x

				if (command_line_cyclic_joystick_index == -1)
				{
					joyval = get_joystick_axis (current_flight_dynamics->input_data.cyclic_joystick_device_index, JOYSTICK_DEFAULT_AXIS_ROLL);
				}
				else
				{
					joyval = get_joystick_axis (command_line_cyclic_joystick_index, command_line_cyclic_joystick_x_axis);
				}

				if (command_line_nonlinear_cyclic)
				{
					// in non-linear mode it uses a curve described by f(x) = x*x + x
					// gives a not so sensitive control around centre
					input = (2.0 * (float) joyval ) / ((float) JOYSTICK_AXIS_MAXIMUM - (float) JOYSTICK_AXIS_MINIMUM);
					if (input >= 0)
						input *= input;
					else
						input *= -input;
					input += input;
					input *= 50;
				}
				else
					input = (float) (200.0 * (float) joyval ) / ((float) JOYSTICK_AXIS_MAXIMUM - (float) JOYSTICK_AXIS_MINIMUM);

				if (fabs (input) < command_line_dynamics_cyclic_dead_zone)
				{

					input = 0.0;
				}

				current_flight_dynamics->input_data.cyclic_x.value = input;
        
        //ataribaby 1/1/2009 allow trim with ALT HOLD
				if (current_flight_dynamics->auto_hover == HOVER_HOLD_NONE || current_flight_dynamics->auto_hover == HOVER_HOLD_ALTITUDE_LOCK)
					current_flight_dynamics->input_data.cyclic_x.value += current_flight_dynamics->input_data.cyclic_x_trim.value;

				// y

				if (command_line_cyclic_joystick_index == -1)
				{
					joyval = get_joystick_axis (current_flight_dynamics->input_data.cyclic_joystick_device_index, JOYSTICK_DEFAULT_AXIS_PITCH);
				}
				else
				{
					joyval = get_joystick_axis (command_line_cyclic_joystick_index, command_line_cyclic_joystick_y_axis);
				}

				if (command_line_nonlinear_cyclic)
				{
					// in non-linear mode it uses a curve described by f(x) = x*x + x
					// gives a not so sensitive control around centre
					input = -2.0 * ((float) joyval ) / ((float) JOYSTICK_AXIS_MAXIMUM - (float) JOYSTICK_AXIS_MINIMUM);
					if (input >= 0)
						input *= input;
					else
						input *= -input;
					input += input;
					input *= 50.0;
				}
				else
					input = -(float) (200.0 * joyval) / (JOYSTICK_AXIS_MAXIMUM - JOYSTICK_AXIS_MINIMUM);

				if (fabs (input) < command_line_dynamics_cyclic_dead_zone)
				{

					input = 0.0;
				}

				current_flight_dynamics->input_data.cyclic_y.value = input;
        
        //ataribaby 1/1/2009 allow trim with ALT HOLD 
				if (current_flight_dynamics->auto_hover == HOVER_HOLD_NONE || current_flight_dynamics->auto_hover == HOVER_HOLD_ALTITUDE_LOCK)
					current_flight_dynamics->input_data.cyclic_y.value += current_flight_dynamics->input_data.cyclic_y_trim.value;

				/*
				debug_log ("CYCLIC: x %f, y %f", ((float) fabs (200.0 * get_joystick_axis(current_flight_dynamics->input_data.cyclic_joystick_device_index, JOYSTICK_DEFAULT_AXIS_ROLL) / (JOYSTICK_AXIS_MAXIMUM - JOYSTICK_AXIS_MINIMUM)),
					((float) fabs (200.0 * get_joystick_axis(current_flight_dynamics->input_data.cyclic_joystick_device_index, JOYSTICK_DEFAULT_AXIS_PITCH)) / (JOYSTICK_AXIS_MAXIMUM - JOYSTICK_AXIS_MINIMUM)));
				*/

				{
					// 030418 loke
					// implemented multiple joystick device selection

					int
						joystick_x_pos,
						joystick_y_pos;

					if (command_line_cyclic_joystick_index == -1)
					{
						joystick_x_pos = get_joystick_axis (current_flight_dynamics->input_data.cyclic_joystick_device_index, JOYSTICK_DEFAULT_AXIS_ROLL);
						joystick_y_pos = get_joystick_axis (current_flight_dynamics->input_data.cyclic_joystick_device_index, JOYSTICK_DEFAULT_AXIS_PITCH);
					}
					else
					{
						joystick_x_pos = get_joystick_axis (command_line_cyclic_joystick_index, command_line_cyclic_joystick_x_axis);
						joystick_y_pos = get_joystick_axis (command_line_cyclic_joystick_index, command_line_cyclic_joystick_y_axis);
					}

					if (((float) fabs (200.0 * joystick_x_pos) / (JOYSTICK_AXIS_MAXIMUM - JOYSTICK_AXIS_MINIMUM) > 10.0) ||
						((float) fabs (200.0 * joystick_y_pos) / (JOYSTICK_AXIS_MAXIMUM - JOYSTICK_AXIS_MINIMUM) > 10.0))
					{

						if ((current_flight_dynamics->auto_hover == HOVER_HOLD_NORMAL) ||
							(current_flight_dynamics->auto_hover == HOVER_HOLD_STABLE))
						{

							set_current_flight_dynamics_auto_hover (HOVER_HOLD_NONE);
							set_current_flight_dynamics_auto_pilot (FALSE);
						}
					}
				}

				break;
			}
		}

	//
	// DEBUG - to get the coolie hat working
	//
	#if 0
	{

		joystick_hat_position
			coolie_position;

		coolie_position = get_joystick_hat( &joystick_devices [current_flight_dynamics->input_data.cyclic_joystick_device_index], 0 );

		switch( coolie_position ) {
		case HAT_CENTERED:
			debug_log ("CYCLIC: coolie centered");
			break;
		case HAT_UP:
			debug_log ("CYCLIC: coolie up");
			break;
		case HAT_LEFT:
			debug_log ("CYCLIC: coolie left");
			break;
		case HAT_DOWN:
			debug_log ("CYCLIC: coolie down");
			break;
		case HAT_RIGHT:
			debug_log ("CYCLIC: coolie right");
			break;
		case HAT_LEFTUP:
			debug_log ("CYCLIC: coolie left+up");
			break;
		case HAT_LEFTDOWN:
			debug_log ("CYCLIC: coolie left+down");
			break;
		case HAT_RIGHTUP:
			debug_log ("CYCLIC: coolie right+up");
			break;
		case HAT_RIGHTDOWN:
			debug_log ("CYCLIC: coolie right+down");
			break;
		default:
			debug_log ("CYCLIC: coolie is on fire");
		}
	}
	#endif

	//
	// Damaged hydraulics
	//

	if (current_flight_dynamics->input_data.cyclic_x.damaged)
	{
		current_flight_dynamics->input_data.cyclic_x.value *= hydraulic_pressure;
		current_flight_dynamics->input_data.cyclic_x.value += damaged_lock_x_pos * (1.0 - hydraulic_pressure);
	}

	if (current_flight_dynamics->input_data.cyclic_y.damaged)
	{
		current_flight_dynamics->input_data.cyclic_y.value *= hydraulic_pressure;
		current_flight_dynamics->input_data.cyclic_y.value += damaged_lock_y_pos * (1.0 - hydraulic_pressure);
	}

	//
	// Damaged Stabaliser
	//

	if (current_flight_dynamics->input_data.cyclic_x_trim.damaged)
		current_flight_dynamics->input_data.cyclic_x_trim.value += (MODEL_FRAME_RATE * get_model_delta_time ()) * (0.5 * sfrand1 () * current_flight_dynamics->input_data.cyclic_x_trim.value);

	if (current_flight_dynamics->input_data.cyclic_y_trim.damaged)
		current_flight_dynamics->input_data.cyclic_y_trim.value += (MODEL_FRAME_RATE * get_model_delta_time ()) * (0.5 * sfrand1 () * current_flight_dynamics->input_data.cyclic_y_trim.value);

	// limit cyclic position

	current_flight_dynamics->input_data.cyclic_x.value = bound (
												//current_flight_dynamics->input_data.cyclic_x.value + current_flight_dynamics->input_data.cyclic_x_trim.value,
												current_flight_dynamics->input_data.cyclic_x.value,
												current_flight_dynamics->input_data.cyclic_x.min,
												current_flight_dynamics->input_data.cyclic_x.max
												);

	current_flight_dynamics->input_data.cyclic_y.value = bound (
												//current_flight_dynamics->input_data.cyclic_y.value + current_flight_dynamics->input_data.cyclic_y_trim.value,
												current_flight_dynamics->input_data.cyclic_y.value,
												current_flight_dynamics->input_data.cyclic_y.min,
												current_flight_dynamics->input_data.cyclic_y.max
												);
}