void draw_2d_triangle (rgb_colour col) { draw_2d_line (-0.5, -0.5, 0.0, 0.5, col); draw_2d_line (0.0, 0.5, 0.5, -0.5, col); draw_2d_line (0.5, -0.5, -0.5, -0.5, col); }
void draw_2d_diamond (rgb_colour col) { draw_2d_line (-0.5, 0.0, 0.0, 0.5, col); draw_2d_line (0.0, 0.5, 0.5, 0.0, col); draw_2d_line (0.5, 0.0, 0.0, -0.5, col); draw_2d_line (0.0, -0.5, -0.5, 0.0, col); }
void draw_2d_square (rgb_colour col) { draw_2d_line (-0.5, -0.5, -0.5, 0.5, col); draw_2d_line (-0.5, 0.5, 0.5, 0.5, col); draw_2d_line (0.5, 0.5, 0.5, -0.5, col); draw_2d_line (-0.5, -0.5, 0.5, -0.5, col); }
static void draw_layout_grid (void) { float x, y; if (display_hud_layout_grid) { for (x = HUD_WINDOW_X_MIN; x <= HUD_WINDOW_X_MAX; x += 0.1) { draw_2d_line (x, HUD_WINDOW_Y_MIN, x, HUD_WINDOW_Y_MAX, sys_col_red); } for (y = HUD_WINDOW_Y_MIN; y <= HUD_WINDOW_Y_MAX; y += 0.1) { draw_2d_line (HUD_WINDOW_X_MIN, y, HUD_WINDOW_X_MAX, y, sys_col_red); } } }
static void draw_layout_grid (void) { float x, y; if (display_mfd_layout_grid) { for (x = -1.0; x <= 1.0; x += 0.1) { draw_2d_line (x, -1.0, x, 1.0, sys_col_red); } for (y = -1.0; y <= 1.0; y += 0.1) { draw_2d_line (-1.0, y, 1.0, y, sys_col_red); } } }
static void draw_aim_marker(float x, float y, float range, float min_range) { const float tick_end = GUN_PIPPER_SIZE - 0.035, start = 0.05, end = 0.25; // draw cross draw_2d_half_thick_line(x, y + start, x, y + end, hud_colour); draw_2d_half_thick_line(x, y - start, x, y - end, hud_colour); draw_2d_half_thick_line(x + start, y, x + end, y, hud_colour); draw_2d_half_thick_line(x - start, y, x - end, y, hud_colour); // draw range bar { int i, min_range_i, end_i; for (i=0; i<NUM_GUN_PIPPER_POINTS; i++) set_2d_pixel(x + gun_pipper_points[i][0], y + gun_pipper_points[i][1], hud_colour); min_range_i = bound((min_range / GUN_PIPPER_MAX_RANGE) * NUM_GUN_PIPPER_POINTS, 0, NUM_GUN_PIPPER_POINTS); end_i = bound((range / GUN_PIPPER_MAX_RANGE) * NUM_GUN_PIPPER_POINTS, 0, NUM_GUN_PIPPER_POINTS); for (i=0; i<end_i; i++) { if (i < min_range_i) draw_2d_mono_sprite (small_hud_plus, x + gun_pipper_points2[i][0], y + gun_pipper_points2[i][1], hud_colour); else draw_2d_mono_sprite (big_hud_dot, x + gun_pipper_points2[i][0], y + gun_pipper_points2[i][1], hud_colour); } } // draw range tick marks draw_2d_line(x, y + GUN_PIPPER_SIZE, x, y + tick_end, hud_colour); draw_2d_line(x + GUN_PIPPER_SIZE * 0.5, y + GUN_PIPPER_SIZE * SIN60, x + tick_end * 0.5, y + tick_end * SIN60, hud_colour); draw_2d_line(x + GUN_PIPPER_SIZE * SIN60, y + GUN_PIPPER_SIZE * 0.5, x + tick_end * SIN60, y + tick_end * 0.5, hud_colour); draw_2d_line(x + GUN_PIPPER_SIZE, y, x + GUN_PIPPER_SIZE - tick_end, y, hud_colour); draw_2d_line(x + GUN_PIPPER_SIZE * SIN60, y - GUN_PIPPER_SIZE * 0.5, x + tick_end * SIN60, y - tick_end * 0.5, hud_colour); }
static void draw_backup_sight(void) { const float nar_tick = 0.035, wide_tick = 0.075; set_2d_pixel(0.0, 0.0, backup_sight_colour); draw_2d_circle(0.0, 0.0, 0.15, backup_sight_colour); draw_2d_circle(0.0, 0.0, 0.4, backup_sight_colour); draw_2d_line(0.0, 0.6, 0.0, 0.1, backup_sight_colour); draw_2d_line(0.0, -0.1, 0.0, -1.0, backup_sight_colour); draw_2d_line(0.8, 0.0, 0.1, 0.0, backup_sight_colour); draw_2d_line(-0.8, 0.0, -0.1, 0.0, backup_sight_colour); // horizontal tick marks draw_2d_line(-wide_tick, 0.2, wide_tick, 0.2, backup_sight_colour); draw_2d_line(-wide_tick, -0.2, wide_tick, -0.2, backup_sight_colour); draw_2d_line(-wide_tick, -0.6, wide_tick, -0.6, backup_sight_colour); draw_2d_line(-wide_tick, -0.8, wide_tick, -0.8, backup_sight_colour); draw_2d_line(-nar_tick, 0.5, nar_tick, 0.5, backup_sight_colour); draw_2d_line(-nar_tick, 0.3, nar_tick, 0.3, backup_sight_colour); draw_2d_line(-nar_tick, -0.3, nar_tick, -0.3, backup_sight_colour); draw_2d_line(-nar_tick, -0.5, nar_tick, -0.5, backup_sight_colour); draw_2d_line(-nar_tick, -0.7, nar_tick, -0.7, backup_sight_colour); draw_2d_line(-nar_tick, -0.9, nar_tick, -0.9, backup_sight_colour); // vertical tick marks draw_2d_line(-0.6, wide_tick, -0.6, -wide_tick, backup_sight_colour); draw_2d_line(-0.2, wide_tick, -0.2, -wide_tick, backup_sight_colour); draw_2d_line( 0.2, wide_tick, 0.2, -wide_tick, backup_sight_colour); draw_2d_line( 0.6, wide_tick, 0.6, -wide_tick, backup_sight_colour); draw_2d_line(-0.7, nar_tick, -0.7, -nar_tick, backup_sight_colour); draw_2d_line(-0.5, nar_tick, -0.5, -nar_tick, backup_sight_colour); draw_2d_line(-0.3, nar_tick, -0.3, -nar_tick, backup_sight_colour); draw_2d_line( 0.7, nar_tick, 0.7, -nar_tick, backup_sight_colour); draw_2d_line( 0.5, nar_tick, 0.5, -nar_tick, backup_sight_colour); draw_2d_line( 0.3, nar_tick, 0.3, -nar_tick, backup_sight_colour); }
void draw_2d_cross (rgb_colour col) { draw_2d_line (-0.5, -0.5, 0.5, 0.5, col); draw_2d_line (-0.5, 0.5, 0.5, -0.5, col); }
static void draw_2d_eo_display (eo_params *eo, target_acquisition_systems system, int damaged, int valid_3d) { const char *s; char buffer[200]; int heading_readout; float width, heading, marker_position, target_range = 0.0, y_adjust, i, j, x, y; entity *source, *target; vec3d *source_position, target_point; viewpoint tmp; object_3d_visibility visibility; ASSERT (eo); source = get_gunship_entity (); source_position = get_local_entity_vec3d_ptr (source, VEC3D_TYPE_POSITION); target = get_local_entity_parent (source, LIST_TYPE_TARGET); target_range = get_range_to_target(); //////////////////////////////////////// // // text // //////////////////////////////////////// set_mono_font_colour (MFD_EO_TEXT_COLOUR); set_mono_font_type (MONO_FONT_TYPE_7X12); // // sensor type // y_adjust = 5.0; set_2d_mono_font_position (-1.0, 1.0); set_mono_font_rel_position (1.0, y_adjust); switch (system) { case TARGET_ACQUISITION_SYSTEM_FLIR: { print_mono_font_string ("FLIR"); break; } case TARGET_ACQUISITION_SYSTEM_LLLTV: { print_mono_font_string ("LLLTV"); break; } case TARGET_ACQUISITION_SYSTEM_PERISCOPE: { print_mono_font_string ("SCOPE"); break; } default: { print_mono_font_string ("XXX"); break; } } // // damaged // if (damaged) { draw_2d_line (-0.5, -0.5, 0.5, 0.5, MFD_COLOUR1); draw_2d_line ( 0.5, -0.5, -0.5, 0.5, MFD_COLOUR1); return; } // // heading // heading = get_heading_from_attitude_matrix (eo_vp.attitude); if (heading < 0.0) { heading += rad (360.0); } heading_readout = (int) deg (heading); if (heading_readout == 0) { heading_readout = 360; } sprintf (buffer, "%d", heading_readout); width = get_mono_font_string_width (buffer); set_2d_mono_font_position (0.0, 1.0); set_mono_font_rel_position ((-width * 0.5) + 1.0, y_adjust); print_mono_font_string (buffer); // airspeed sprintf(buffer, "%+04.0f", current_flight_dynamics->indicated_airspeed.value); set_2d_mono_font_position (-1.0, 1.0); set_mono_font_rel_position(1.0, 18.0); print_mono_font_string(buffer); // altitude if (current_flight_dynamics->radar_altitude.value < 300.0) { sprintf(buffer, "R%03.0f", current_flight_dynamics->radar_altitude.value); set_2d_mono_font_position (1.0, 1.0); set_mono_font_rel_position(-get_mono_font_string_width(buffer) - 2.0, 18.0); print_mono_font_string(buffer); } // // low light // if (eo_low_light) { y_adjust = 32.0; set_2d_mono_font_position (-1.0, 1.0); set_mono_font_rel_position (1.0, y_adjust); print_mono_font_string ("LO LIGHT"); } // // field of view // switch (eo->field_of_view) { case EO_FOV_NARROW: case EO_FOV_MEDIUM: { s = "NARROW"; break; } case EO_FOV_WIDE: { s = "WIDE"; break; } default: { s = "XXX"; break; } } width = get_mono_font_string_width (s); width += 2.0; y_adjust = 5.0; set_2d_mono_font_position (1.0, 1.0); set_mono_font_rel_position (-width, y_adjust); print_mono_font_string (s); // // target name // y_adjust = -12.0; s = get_target_display_name (target, buffer, TRUE); if (s) { set_2d_mono_font_position (-1.0, -1.0); set_mono_font_rel_position (1.0, y_adjust); print_mono_font_string (s); } // // target range // if (target_range > 0.0) { sprintf (buffer, "%.1fKm", target_range * (1.0 / 1000.0)); width = get_mono_font_string_width (buffer); set_2d_mono_font_position (1.0, -1.0); width += 2.0; set_mono_font_rel_position (-width, y_adjust); print_mono_font_string (buffer); } // // locked // if (eo_is_locked()) { y_adjust = -25.0; set_2d_mono_font_position (-1.0, -1.0); set_mono_font_rel_position (1.0, y_adjust); print_mono_font_string ("LOCKED"); } // Jabberwock 031107 Designated targets target = get_local_entity_parent (get_gunship_entity (), LIST_TYPE_TARGET); if (target && get_local_entity_parent (target, LIST_TYPE_DESIGNATED_TARGET)) { y_adjust = -25.0; width = get_mono_font_string_width ("MARKED"); set_2d_mono_font_position (1.0, -1.0); set_mono_font_rel_position (-width - 1.0, y_adjust); print_mono_font_string ("MARKED"); } // Jabberwock 031107 ends // added ground stabi by GCsDriver 08-12-2007 // // 030418 loke // draw an indication if ground stablisation is enabled // if (eo_ground_stabilised) { y_adjust = -38.0; width = get_mono_font_string_width ("S"); set_2d_mono_font_position (1.0, -1.0); set_mono_font_rel_position (-width, y_adjust); print_mono_font_string ("S"); } //////////////////////////////////////// // // line graphics // //////////////////////////////////////// // // datum // draw_2d_line (-0.075, 0.0, -0.025, 0.0, MFD_EO_TEXT_COLOUR); draw_2d_line (0.035, 0.0, 0.08, 0.0, MFD_EO_TEXT_COLOUR); draw_2d_line (0.0, -0.075, 0.0, -0.025, MFD_EO_TEXT_COLOUR); draw_2d_line (0.0, 0.035, 0.0, 0.08, MFD_EO_TEXT_COLOUR); // // azimuth // draw_2d_line (-0.5, 0.8, 0.5, 0.8, MFD_EO_TEXT_COLOUR); marker_position = (eo_azimuth / eo_max_azimuth) * 0.5; draw_2d_line (-0.5, 0.8 - 0.02, -0.5, 0.8 + 0.02, MFD_EO_TEXT_COLOUR); draw_2d_line (0.5, 0.8 - 0.02, 0.5, 0.8 + 0.02, MFD_EO_TEXT_COLOUR); draw_2d_line (0.0, 0.8 - 0.01, 0.0, 0.8 + 0.01, MFD_EO_TEXT_COLOUR); draw_2d_mono_sprite (large_azimuth_marker, marker_position, 0.8, MFD_EO_TEXT_COLOUR); // // elevation // draw_2d_line (-0.9, 0.1, -0.9, -0.3, MFD_EO_TEXT_COLOUR); if (eo_elevation < 0.0) { marker_position = (eo_elevation / eo_min_elevation) * -0.3; } else { marker_position = (eo_elevation / eo_max_elevation) * 0.1; } draw_2d_line (-0.9 - 0.02, 0.1, -0.9 + 0.02, 0.1, MFD_EO_TEXT_COLOUR); draw_2d_line (-0.9 - 0.02, -0.3, -0.9 + 0.02, -0.3, MFD_EO_TEXT_COLOUR); draw_2d_line (-0.9 - 0.01, 0.0, -0.9 + 0.01, 0.0, MFD_EO_TEXT_COLOUR); draw_2d_mono_sprite (large_elevation_marker, -0.9, marker_position, MFD_EO_TEXT_COLOUR); // // range // draw_2d_line (0.9, 0.0, 0.9, -0.5, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, 0.000, 0.9 + 0.02, 0.000, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.025, 0.9 + 0.01, -0.025, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.050, 0.9 + 0.01, -0.050, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.075, 0.9 + 0.01, -0.075, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.100, 0.9 + 0.02, -0.100, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.125, 0.9 + 0.01, -0.125, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.150, 0.9 + 0.01, -0.150, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.175, 0.9 + 0.01, -0.175, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.200, 0.9 + 0.02, -0.200, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.225, 0.9 + 0.01, -0.225, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.250, 0.9 + 0.01, -0.250, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.275, 0.9 + 0.01, -0.275, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.300, 0.9 + 0.02, -0.300, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.400, 0.9 + 0.02, -0.400, MFD_EO_TEXT_COLOUR); draw_2d_line (0.9, -0.500, 0.9 + 0.02, -0.500, MFD_EO_TEXT_COLOUR); if (target_range > 0.0) { marker_position = (min (target_range, eo_max_visual_range) / eo_max_visual_range) * -0.5; draw_2d_mono_sprite (large_range_marker, 0.9, marker_position, MFD_EO_TEXT_COLOUR); } // horizon { float roll = get_local_entity_float_value (get_gunship_entity (), FLOAT_TYPE_ROLL); float pitch = get_local_entity_float_value (get_gunship_entity (), FLOAT_TYPE_PITCH); float pitch_adjustment = -pitch / rad(90) * 0.5; draw_2d_half_thick_line(-0.35, 0.0, -0.3, 0.0, MFD_EO_TEXT_COLOUR); draw_2d_half_thick_line( 0.35, 0.0, 0.3, 0.0, MFD_EO_TEXT_COLOUR); // draw datum set_2d_instance_rotation (mfd_env, roll); draw_2d_half_thick_line(-0.75, pitch_adjustment, -0.4, pitch_adjustment, MFD_EO_TEXT_COLOUR); draw_2d_half_thick_line( 0.75, pitch_adjustment, 0.4, pitch_adjustment, MFD_EO_TEXT_COLOUR); reset_2d_instance (mfd_env); } // // target gates // if (valid_3d) { if (target) { if (!((!d3d_can_render_to_texture) && (!draw_large_mfd))) { tmp = main_vp; main_vp = eo_vp; get_local_entity_target_point (target, &target_point); visibility = get_position_3d_screen_coordinates (&target_point, &i, &j); if ((visibility == OBJECT_3D_COMPLETELY_VISIBLE) || (visibility == OBJECT_3D_PARTIALLY_VISIBLE)) { i -= i_translate_3d; j -= j_translate_3d; i *= i_scale_3d; j *= j_scale_3d; get_2d_world_position (i, j, &x, &y); draw_2d_line (x - 0.20, y + 0.20, x - 0.15, y + 0.20, MFD_EO_TEXT_COLOUR); draw_2d_line (x + 0.20, y + 0.20, x + 0.15, y + 0.20, MFD_EO_TEXT_COLOUR); draw_2d_line (x - 0.20, y - 0.20, x - 0.15, y - 0.20, MFD_EO_TEXT_COLOUR); draw_2d_line (x + 0.20, y - 0.20, x + 0.15, y - 0.20, MFD_EO_TEXT_COLOUR); draw_2d_line (x - 0.20, y + 0.20, x - 0.20, y + 0.15, MFD_EO_TEXT_COLOUR); draw_2d_line (x - 0.20, y - 0.20, x - 0.20, y - 0.15, MFD_EO_TEXT_COLOUR); draw_2d_line (x + 0.20, y + 0.20, x + 0.20, y + 0.15, MFD_EO_TEXT_COLOUR); draw_2d_line (x + 0.20, y - 0.20, x + 0.20, y - 0.15, MFD_EO_TEXT_COLOUR); } main_vp = tmp; } } } }