Ejemplo n.º 1
0
void update_hokum_virtual_cockpit (void)
{
	int
		draw_glass_cockpit,
		draw_controls,
		draw_crew,
		draw_seats;

	cockpit_detail_levels
		cockpit_detail_level;

	object_3d_sub_object_search_data
		search;

	////////////////////////////////////////
	//
	// sort out what to draw
	//
	////////////////////////////////////////

	switch (get_view_mode ())
	{
		case VIEW_MODE_VIRTUAL_COCKPIT_CREW:
		{
			cockpit_detail_level = COCKPIT_DETAIL_LEVEL_HIGH;

			draw_glass_cockpit = FALSE;

			draw_controls = TRUE;

			break;
		}
		case VIEW_MODE_VIRTUAL_COCKPIT_PILOT_LHS_DISPLAY:
		case VIEW_MODE_VIRTUAL_COCKPIT_PILOT_RHS_DISPLAY:
		case VIEW_MODE_VIRTUAL_COCKPIT_CO_PILOT_LHS_DISPLAY:
		case VIEW_MODE_VIRTUAL_COCKPIT_CO_PILOT_RHS_DISPLAY:
		{
			cockpit_detail_level = COCKPIT_DETAIL_LEVEL_HIGH;

			draw_glass_cockpit = FALSE;

			draw_controls = FALSE;

			break;
		}
		default:
		{
			cockpit_detail_level = get_global_cockpit_detail_level ();

			draw_glass_cockpit = get_global_glass_cockpit ();

			draw_controls = !draw_glass_cockpit;

			break;
		}
	}

	//
	// select 3D instance
	//

	if (draw_glass_cockpit)
	{
		if (virtual_cockpit_inst3d != virtual_cockpit_inst3d_detail_level_glass_inst3d)
		{
			virtual_cockpit_inst3d_detail_level_glass_inst3d->vp = virtual_cockpit_inst3d->vp;

			virtual_cockpit_inst3d = virtual_cockpit_inst3d_detail_level_glass_inst3d;
		}

		draw_crew = FALSE;
	}
	else
	{
		switch (cockpit_detail_level)
		{
			////////////////////////////////////////
			case COCKPIT_DETAIL_LEVEL_LOW:
			////////////////////////////////////////
			{
				if (virtual_cockpit_inst3d != virtual_cockpit_inst3d_detail_level_low_inst3d)
				{
					virtual_cockpit_inst3d_detail_level_low_inst3d->vp = virtual_cockpit_inst3d->vp;

					virtual_cockpit_inst3d = virtual_cockpit_inst3d_detail_level_low_inst3d;
				}

				draw_crew = FALSE;

				break;
			}
			////////////////////////////////////////
			case COCKPIT_DETAIL_LEVEL_MEDIUM:
			////////////////////////////////////////
			{
				if (virtual_cockpit_inst3d != virtual_cockpit_inst3d_detail_level_medium_inst3d)
				{
					virtual_cockpit_inst3d_detail_level_medium_inst3d->vp = virtual_cockpit_inst3d->vp;

					virtual_cockpit_inst3d = virtual_cockpit_inst3d_detail_level_medium_inst3d;
				}

				draw_crew = TRUE;

				break;
			}
			////////////////////////////////////////
			case COCKPIT_DETAIL_LEVEL_HIGH:
			////////////////////////////////////////
			{
				if (virtual_cockpit_inst3d != virtual_cockpit_inst3d_detail_level_high_inst3d)
				{
					virtual_cockpit_inst3d_detail_level_high_inst3d->vp = virtual_cockpit_inst3d->vp;

					virtual_cockpit_inst3d = virtual_cockpit_inst3d_detail_level_high_inst3d;
				}

				draw_crew = TRUE;

				break;
			}
		}
	}

	//
	// HUD view
	//

	if (get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_HUD)
	{
		draw_crew = FALSE;
	}

	//
	// ejected
	//

	draw_seats = TRUE;

	if (get_local_entity_int_value (get_gunship_entity (), INT_TYPE_EJECTED))
	{
		if (get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_CREW)
		{
			draw_controls = FALSE;
		}
		else
		{
			draw_crew = FALSE;

			draw_seats = FALSE;
		}
	}

	//
	// draw crew
	//

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_PILOT_POSITION;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_crew;
	}

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_WSO_POSITION;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_crew;
	}

	//
	// draw seats
	//

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_KA52_EJECTOR_SEAT;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_seats;
	}

	search.search_depth = 1;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_KA52_EJECTOR_SEAT;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_seats;
	}

	//
	// draw controls
	//

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_PILOT_JOYSTICK;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_PILOT_COLLECTIVE;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_PILOT_PEDAL;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 1;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_PILOT_PEDAL;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_WSO_JOYSTICK;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_WSO_COLLECTIVE;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_WSO_PEDAL;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 1;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_WSO_PEDAL;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	////////////////////////////////////////
	//
	// update animations
	//
	////////////////////////////////////////

	//
	// crew animation
	//

	update_hokum_crew_animation ();

	//
	// canopy doors
	//

	animate_hokum_virtual_cockpit_canopy_doors ();

	////////////////////////////////////////
	//
	// sort static hands
	//
	////////////////////////////////////////

	if (!draw_crew)
	{
		search.search_depth = 0;
		search.search_object = virtual_cockpit_inst3d;
		search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_PILOT_HAND_STATIC;

		if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
		{
			search.result_sub_object->visible_object = FALSE;
		}

		search.search_depth = 0;
		search.search_object = virtual_cockpit_inst3d;
		search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_WSO_HAND_STATIC;

		if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
		{
			search.result_sub_object->visible_object = FALSE;
		}
	}
}
Ejemplo n.º 2
0
static void draw_local_3d_object (entity *en, float range)
{
	helicopter
		*raw;

	int
		internal_view;

	raw = get_local_entity_data (en);

	//
	// the player's gunship is visible from the menus - where the in_cockpit flag is invalid
	//

	if (en == get_gunship_entity ())
	{
		internal_view = ((in_cockpit) && (get_in_flight_game_mode () == IN_FLIGHT_GAME_MODE_SIMULATOR));
	}
	else
	{
		internal_view = FALSE;
	}

	////////////////////////////////////////
	//
	// SORT COMANCHE AND HOKUM INSTANCES
	//
	// It is necessary to switch parts on and off for all Comanche and Hokum instances
	// because the player can change gunship so the instances need to be fixed up.
	//
	////////////////////////////////////////

	{
		int
			draw_virtual_cockpit_parts,
			draw_canopy_doors,
			draw_loading_doors,
			ejected;

		object_3d_sub_object_search_data
			search;

		if (raw->ac.object_3d_shape == OBJECT_3D_RAH66)
		{
			////////////////////////////////////////
			//
			// Comanche
			//
			////////////////////////////////////////

			//
			// draw 'canopy' doors on player object and 'loading' doors on AI object
			//

			draw_virtual_cockpit_parts = FALSE;

			draw_canopy_doors = FALSE;

			draw_loading_doors = FALSE;

			if (en == get_gunship_entity ())
			{
				draw_canopy_doors = TRUE;

				if (internal_view)
				{
					draw_virtual_cockpit_parts = TRUE;
				}
			}
			else
			{
				draw_loading_doors = TRUE;
			}

			//
			// fuselage
			//

			search.search_depth = 0;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_RAH66_FUSELAGE;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = !draw_virtual_cockpit_parts;
			}

			//
			// canopy/loading doors
			//

			search.search_depth = 0;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_CANOPY_DOORS;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = draw_canopy_doors;
			}

			search.search_depth = 1;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_CANOPY_DOORS;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = draw_canopy_doors;
			}

			search.search_depth = 0;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_LOADING_DOOR;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = draw_loading_doors;
			}

			search.search_depth = 1;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_LOADING_DOOR;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = draw_loading_doors;
			}
		}
		else if (raw->ac.object_3d_shape == OBJECT_3D_KA_52)
		{
			////////////////////////////////////////
			//
			// Hokum
			//
			////////////////////////////////////////

			//
			// draw 'canopy' doors on player object and 'loading' doors on AI object
			//

			ejected = get_local_entity_int_value (en, INT_TYPE_EJECTED);

			draw_virtual_cockpit_parts = FALSE;

			draw_canopy_doors = FALSE;

			draw_loading_doors = FALSE;

			if (en == get_gunship_entity ())
			{
				if (!ejected)
				{
					draw_canopy_doors = TRUE;
				}

				if (internal_view)
				{
					draw_virtual_cockpit_parts = TRUE;
				}
			}
			else
			{
				if (!ejected)
				{
					draw_loading_doors = TRUE;
				}
			}

			//
			// stub wings
			//

			search.search_depth = 0;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_KA52_WINGS;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = draw_virtual_cockpit_parts;
			}

			//
			// fuselage
			//

			search.search_depth = 0;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_KA52_FUSELAGE;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = !draw_virtual_cockpit_parts;
			}

			//
			// canopy/loading doors
			//

			search.search_depth = 0;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_CANOPY_DOORS;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = draw_canopy_doors;
			}

			search.search_depth = 1;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_CANOPY_DOORS;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = draw_canopy_doors;
			}

			search.search_depth = 0;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_LOADING_DOOR;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = draw_loading_doors;
			}

			search.search_depth = 1;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_LOADING_DOOR;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = draw_loading_doors;
			}

			//
			// ejector seats & crew
			//

			search.search_depth = 0;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_KA52_EJECTOR_SEAT;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = !ejected;
			}

			search.search_depth = 1;
			search.search_object = raw->ac.inst3d;
			search.sub_object_index = OBJECT_3D_SUB_OBJECT_KA52_EJECTOR_SEAT;

			if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
			{
				search.result_sub_object->visible_object = !ejected;
			}
		}
	}

	////////////////////////////////////////

	if (en == get_gunship_entity ())
	{
		//
		// update viewpoint
		//

		raw->ac.inst3d->vp.position = raw->ac.mob.position;

		memcpy (&raw->ac.inst3d->vp.attitude, &raw->ac.mob.attitude, sizeof (matrix3x3));

		//
		// animate
		//

		if (!internal_view)
		{
			if (raw->main_rotor_damaged)
			{
				animate_damaged_helicopter_main_rotors (en, TRUE);
			}
			else
			{
				animate_helicopter_main_rotors (en, TRUE, FALSE);
			}
		}

		animate_helicopter_tail_rotor (en);

		animate_helicopter_wipers (en);

		animate_helicopter_eo (en);

		animate_aircraft_loading_doors (en);

		animate_aircraft_cargo_doors (en);

		animate_aircraft_undercarriage (en);

		animate_aircraft_weapon_system_ready (en);

		animate_aircraft_shadow (en);

		animate_aircraft_rudder (en);

		raw->ac.inst3d->object_internal_lighting = object_internal_lighting_valid (en);

		raw->ac.inst3d->object_sprite_lights = (raw->ac.inst3d->object_internal_lighting && sprite_light_valid (en));

		//
		// draw
		//

		if (!internal_view)
		{
			if (!in_flight_invisible_object)
			{
				animate_and_draw_entity_muzzle_flash_effect (en);

				insert_object_into_3d_scene (OBJECT_3D_DRAW_TYPE_OBJECT, raw->ac.inst3d);
			}
		}
		else
		{
			if (get_comanche_hokum_gunship ())
			{
				if (get_global_draw_cockpit_graphics ())
				{
					if (!get_global_glass_cockpit ())
					{
						if
						(
							(get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_CREW) ||
							(get_global_cockpit_detail_level () == COCKPIT_DETAIL_LEVEL_HIGH)
						)
						{
							animate_and_draw_entity_muzzle_flash_effect (en);

							raw->ac.inst3d->vp.position = virtual_cockpit_inst3d->vp.position;

							memcpy (&raw->ac.inst3d->vp.attitude, &virtual_cockpit_inst3d->vp.attitude, sizeof (matrix3x3));

							insert_relative_object_into_3d_scene (OBJECT_3D_DRAW_TYPE_ZBUFFERED_OBJECT, &raw->ac.inst3d->vp.position, raw->ac.inst3d);
						}
					}
				}
			}
		}
	}
	else
	{
		//
		// update viewpoint
		//

		raw->ac.inst3d->vp.position = raw->ac.mob.position;

		memcpy (&raw->ac.inst3d->vp.attitude, &raw->ac.mob.attitude, sizeof (matrix3x3));

		//
		// animate
		//

		if (get_local_entity_int_value (en, INT_TYPE_ALIVE))
		{
			animate_helicopter_main_rotors (en, FALSE, FALSE);
		}
		else
		{
			animate_damaged_helicopter_main_rotors (en, FALSE);
		}

		animate_helicopter_tail_rotor (en);

		animate_aircraft_loading_doors (en);

		animate_aircraft_cargo_doors (en);

		animate_aircraft_undercarriage (en);

		animate_aircraft_weapon_system_ready (en);

		animate_aircraft_shadow (en);

		animate_and_draw_entity_muzzle_flash_effect (en);

		raw->ac.inst3d->object_internal_lighting = object_internal_lighting_valid (en);

		raw->ac.inst3d->object_sprite_lights = (raw->ac.inst3d->object_internal_lighting && sprite_light_valid (en));

		//
		// draw
		//

		insert_object_into_3d_scene (OBJECT_3D_DRAW_TYPE_OBJECT, raw->ac.inst3d);
	}

	////////////////////////////////////////
	//
	// draw comanche and hokum shadows
	//
	////////////////////////////////////////

	if (raw->ac.object_3d_shape == OBJECT_3D_RAH66)
	{
		object_3d_instance
			*shadow_object;

		shadow_object = construct_temporary_3d_object (OBJECT_3D_RAH66_FUSELAGE, FALSE);

		shadow_object->vp = raw->ac.inst3d->vp;

		insert_object_shadow_into_3d_scene (shadow_object);
	}
	else if (raw->ac.object_3d_shape == OBJECT_3D_KA_52)
	{
		object_3d_instance
			*shadow_object;

		shadow_object = construct_temporary_3d_object (OBJECT_3D_KA_52_FUSELAGE, FALSE);

		shadow_object->vp = raw->ac.inst3d->vp;

		insert_object_shadow_into_3d_scene (shadow_object);
	}

	////////////////////////////////////////

	#if DEBUG_MODULE

	if (en == get_external_view_entity ())
	{
		draw_mobile_entity_debug_info (en);
	}

	#endif
}
Ejemplo n.º 3
0
void update_comanche_virtual_cockpit (void)
{
	int
		depth,
		draw_glass_cockpit,
		draw_controls,
		draw_crew,
		draw_pilot_cockpit,
		draw_co_pilot_cockpit;

	cockpit_detail_levels
		cockpit_detail_level;

	object_3d_sub_object_search_data
		search;

	////////////////////////////////////////
	//
	// sort out what to draw
	//
	////////////////////////////////////////

	switch (get_view_mode ())
	{
		case VIEW_MODE_VIRTUAL_COCKPIT_CREW:
		case VIEW_MODE_VIRTUAL_COCKPIT_PILOT_LHS_DISPLAY:
		case VIEW_MODE_VIRTUAL_COCKPIT_PILOT_RHS_DISPLAY:
		case VIEW_MODE_VIRTUAL_COCKPIT_CO_PILOT_LHS_DISPLAY:
		case VIEW_MODE_VIRTUAL_COCKPIT_CO_PILOT_RHS_DISPLAY:
		{
			cockpit_detail_level = COCKPIT_DETAIL_LEVEL_HIGH;

			draw_glass_cockpit = FALSE;

			break;
		}
		default:
		{
			cockpit_detail_level = get_global_cockpit_detail_level ();

			draw_glass_cockpit = get_global_glass_cockpit ();

			break;
		}
	}

	draw_controls = !draw_glass_cockpit;

	if (get_view_mode () == VIEW_MODE_VIRTUAL_COCKPIT_CREW)
	{
		draw_pilot_cockpit = TRUE;

		draw_co_pilot_cockpit = TRUE;
	}
	else
	{
		if (get_crew_role () == CREW_ROLE_PILOT)
		{
			draw_pilot_cockpit = TRUE;

			draw_co_pilot_cockpit = FALSE;
		}
		else
		{
			draw_pilot_cockpit = FALSE;

			draw_co_pilot_cockpit = TRUE;
		}
	}

	//
	// select 3D instance
	//

	if (draw_glass_cockpit)
	{
		if (virtual_cockpit_inst3d != virtual_cockpit_inst3d_detail_level_glass_inst3d)
		{
			virtual_cockpit_inst3d_detail_level_glass_inst3d->vp = virtual_cockpit_inst3d->vp;

			virtual_cockpit_inst3d = virtual_cockpit_inst3d_detail_level_glass_inst3d;
		}

		draw_crew = FALSE;
	}
	else
	{
		switch (cockpit_detail_level)
		{
			////////////////////////////////////////
			case COCKPIT_DETAIL_LEVEL_LOW:
			////////////////////////////////////////
			{
				if (virtual_cockpit_inst3d != virtual_cockpit_inst3d_detail_level_low_inst3d)
				{
					virtual_cockpit_inst3d_detail_level_low_inst3d->vp = virtual_cockpit_inst3d->vp;

					virtual_cockpit_inst3d = virtual_cockpit_inst3d_detail_level_low_inst3d;
				}

				draw_crew = FALSE;

				break;
			}
			////////////////////////////////////////
			case COCKPIT_DETAIL_LEVEL_MEDIUM:
			////////////////////////////////////////
			{
				if (virtual_cockpit_inst3d != virtual_cockpit_inst3d_detail_level_medium_inst3d)
				{
					virtual_cockpit_inst3d_detail_level_medium_inst3d->vp = virtual_cockpit_inst3d->vp;

					virtual_cockpit_inst3d = virtual_cockpit_inst3d_detail_level_medium_inst3d;
				}

				draw_crew = TRUE;

				break;
			}
			////////////////////////////////////////
			case COCKPIT_DETAIL_LEVEL_HIGH:
			////////////////////////////////////////
			{
				if (virtual_cockpit_inst3d != virtual_cockpit_inst3d_detail_level_high_inst3d)
				{
					virtual_cockpit_inst3d_detail_level_high_inst3d->vp = virtual_cockpit_inst3d->vp;

					virtual_cockpit_inst3d = virtual_cockpit_inst3d_detail_level_high_inst3d;
				}

				draw_crew = TRUE;

				break;
			}
		}
	}

	//
	// draw cockpits
	//

	depth = 0;

	while (TRUE)
	{
		search.search_depth = depth;
		search.search_object = virtual_cockpit_inst3d;
		search.sub_object_index = OBJECT_3D_SUB_OBJECT_VISIBLE_TO_PILOT;

		if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
		{
			search.result_sub_object->visible_object = draw_pilot_cockpit;
		}
		else
		{
			break;
		}

		depth++;
	}

	depth = 0;

	while (TRUE)
	{
		search.search_depth = depth;
		search.search_object = virtual_cockpit_inst3d;
		search.sub_object_index = OBJECT_3D_SUB_OBJECT_VISIBLE_TO_WSO;

		if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
		{
			search.result_sub_object->visible_object = draw_co_pilot_cockpit;
		}
		else
		{
			break;
		}

		depth++;
	}

	//
	// draw crew
	//

//VJ 050206: wideview improvement show other pilot when in wideview
	draw_crew = !(get_global_wide_cockpit () && wide_cockpit_nr == WIDEVIEW_COMANCHE_PILOT);

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COMANCHE_PILOT_VISIBLE;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_crew;
	}

//VJ 050206: wideview improvement show other pilot when in wideview
	draw_crew = !(get_global_wide_cockpit () && wide_cockpit_nr == WIDEVIEW_COMANCHE_COPILOT);

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COMANCHE_WSO_VISIBLE;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_crew;
	}

	//
	// draw controls
	//

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_PILOT_JOYSTICK;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_PILOT_COLLECTIVE;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_WSO_JOYSTICK;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	search.search_depth = 0;
	search.search_object = virtual_cockpit_inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_WSO_COLLECTIVE;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->visible_object = draw_controls;
	}

	////////////////////////////////////////
	//
	// update animations
	//
	////////////////////////////////////////

	//
	// crew animation
	//

	update_comanche_crew_animation ();

	//
	// canopy doors
	//

	animate_comanche_virtual_cockpit_canopy_doors ();

	////////////////////////////////////////
	//
	// sort static hands
	//
	////////////////////////////////////////

	if (!draw_crew)
	{
		search.search_depth = 0;
		search.search_object = virtual_cockpit_inst3d;
		search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_PILOT_HAND_STATIC;

		if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
		{
			search.result_sub_object->visible_object = FALSE;
		}

		search.search_depth = 0;
		search.search_object = virtual_cockpit_inst3d;
		search.sub_object_index = OBJECT_3D_SUB_OBJECT_COCKPIT_WSO_HAND_STATIC;

		if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
		{
			search.result_sub_object->visible_object = FALSE;
		}
	}
}