void notify_show_realism_page (void) { set_ui_object_text (co_pilot_target_option_button, option_cpg_text [get_global_cpg_assist_type ()]); #if DEBUG_MODULE debug_filtered_log ("cpg_assist: %d text: %s",get_global_cpg_assist_type (), option_cpg_text [get_global_cpg_assist_type ()]); #endif set_ui_object_text (co_pilot_ecm_option_button, option_boolean_text [get_global_auto_counter_measures ()]); #if DEBUG_MODULE debug_filtered_log ("acm: %d text: %s", get_global_auto_counter_measures (), option_boolean_text [get_global_auto_counter_measures ()]); #endif set_ui_object_text (avionics_option_button, option_avionics_text [get_global_simple_avionics ()]); #if DEBUG_MODULE debug_filtered_log ("avionics: %d text: %s", get_global_simple_avionics (), option_avionics_text [get_global_simple_avionics ()]); #endif set_ui_object_text (difficulty_option_button, option_difficulty_text [get_global_difficulty_level () - 1]); #if DEBUG_MODULE debug_filtered_log ("diff: %d text: %s", get_global_difficulty_level (), option_difficulty_text [get_global_difficulty_level () - 1]); #endif set_ui_object_text (cpg_report_targets_button, option_cpg_report_targets_text[global_co_pilot_scans_for_targets]); display_options_page (OPTIONS_PAGE_REALISM); #if DEBUG_MODULE debug_filtered_log("Inside show_realism_page"); #endif }
void notify_co_pilot_ecm_option_button ( ui_object *obj, void *arg ) { set_global_auto_counter_measures (!get_global_auto_counter_measures ()); set_ui_object_text (obj, option_boolean_text [get_global_auto_counter_measures ()]); // don't leave text selected set_toggle_button_off (obj); }
void update_kiowa_lamp_avionics (void) { entity *en; en = get_gunship_entity (); update_master_caution (); //////////////////////////////////////// kiowa_lamps.engine_ignition = !get_dynamics_damage_type (DYNAMICS_DAMAGE_LEFT_ENGINE) && current_flight_dynamics->left_engine_rpm.value > 0.01; kiowa_lamps.apu_ignition = current_flight_dynamics->apu_rpm.value > 0.01; kiowa_lamps.engine_fire = get_dynamics_damage_type (DYNAMICS_DAMAGE_LEFT_ENGINE_FIRE); kiowa_lamps.apu_fire = 0; kiowa_lamps.engine_fire_extinguiser = fire_extinguisher_used; kiowa_lamps.hydraulic_pressure = get_dynamics_damage_type (DYNAMICS_DAMAGE_LOW_HYDRAULICS); kiowa_lamps.oil_pressure = get_dynamics_damage_type (DYNAMICS_DAMAGE_LOW_OIL_PRESSURE) || get_dynamics_damage_type (DYNAMICS_DAMAGE_HIGH_OIL_PRESSURE); kiowa_lamps.oil_temperature = 0; kiowa_lamps.overtorque = get_current_flight_dynamics_overtorque (); kiowa_lamps.rotor_rpm = get_current_flight_dynamics_low_rotor_rpm (); kiowa_lamps.fuel_low = current_flight_dynamics->fuel_weight.value < (current_flight_dynamics->fuel_weight.max * 0.25); kiowa_lamps.rotor_brake = get_current_flight_dynamics_rotor_brake (); kiowa_lamps.navigation_lights = get_local_entity_int_value (en, INT_TYPE_LIGHTS_ON); kiowa_lamps.hover_hold = get_current_flight_dynamics_auto_hover (); kiowa_lamps.altitude_hold = get_current_flight_dynamics_altitude_lock (); kiowa_lamps.auto_pilot = get_current_flight_dynamics_auto_pilot (); kiowa_lamps.laser = get_local_entity_int_value (en, INT_TYPE_LASER_ON); kiowa_lamps.ir_jammer = get_local_entity_int_value (en, INT_TYPE_INFRA_RED_JAMMER_ON); kiowa_lamps.auto_counter_measures = get_global_auto_counter_measures (); kiowa_lamps.ase_auto_page = get_global_ase_auto_page (); kiowa_lamps.co_pilot_main_mfd_focus = get_kiowa_main_mfd_has_focus (KIOWA_MAIN_MFD_LOCATION_CO_PILOT); kiowa_lamps.pilot_main_mfd_focus = get_kiowa_main_mfd_has_focus (KIOWA_MAIN_MFD_LOCATION_PILOT); }
void set_ka50_infra_red_jammer_auto (int state) { if (!ka50_damage.infra_red_jammer) { if (get_global_auto_counter_measures ()) { if (state != get_local_entity_int_value (get_gunship_entity (), INT_TYPE_INFRA_RED_JAMMER_ON)) { set_client_server_entity_int_value (get_gunship_entity (), INT_TYPE_INFRA_RED_JAMMER_ON, state); } } } }
void set_ka50_radar_jammer_manual (int state) { if (!ka50_damage.radar_jammer) { if (!get_global_auto_counter_measures ()) { if (state != get_local_entity_int_value (get_gunship_entity (), INT_TYPE_RADAR_JAMMER_ON)) { set_client_server_entity_int_value (get_gunship_entity (), INT_TYPE_RADAR_JAMMER_ON, state); } } } }
void toggle_ka50_infra_red_jammer_manual (void) { if (!ka50_damage.infra_red_jammer) { if (!get_global_auto_counter_measures ()) { if (get_local_entity_int_value (get_gunship_entity (), INT_TYPE_INFRA_RED_JAMMER_ON)) { set_client_server_entity_int_value (get_gunship_entity (), INT_TYPE_INFRA_RED_JAMMER_ON, FALSE); } else { set_client_server_entity_int_value (get_gunship_entity (), INT_TYPE_INFRA_RED_JAMMER_ON, TRUE); } } } play_common_cpg_infra_red_jammer_speech (ka50_damage.infra_red_jammer); }
void toggle_viper_radar_jammer_manual (void) { if (!viper_damage.radar_jammer) { if (!get_global_auto_counter_measures ()) { if (get_local_entity_int_value (get_gunship_entity (), INT_TYPE_RADAR_JAMMER_ON)) { set_client_server_entity_int_value (get_gunship_entity (), INT_TYPE_RADAR_JAMMER_ON, FALSE); } else { set_client_server_entity_int_value (get_gunship_entity (), INT_TYPE_RADAR_JAMMER_ON, TRUE); } } } play_common_cpg_radar_jammer_speech (viper_damage.radar_jammer); }
void play_common_cpg_infra_red_jammer_speech (int damaged) { if (!get_global_auto_counter_measures ()) { if (!damaged) { if (get_local_entity_int_value (get_gunship_entity (), INT_TYPE_INFRA_RED_JAMMER_ON)) { play_client_server_cpg_message (get_gunship_entity (), 0.5, 1.0, SPEECH_CATEGORY_CPG_SYSTEMS, 1.0, SPEECH_CPG_IR_JAMMER_ON); } else { play_client_server_cpg_message (get_gunship_entity (), 0.5, 1.0, SPEECH_CATEGORY_CPG_SYSTEMS, 1.0, SPEECH_CPG_IR_JAMMER_OFF); } } else { play_client_server_cpg_message (get_gunship_entity (), 0.5, 1.0, SPEECH_CATEGORY_CPG_SYSTEMS, 1.0, SPEECH_CPG_IR_JAMMER_DAMAGED); } } }
static void update_status_panel_lamps (void) { hind_lamps.status_1 = hind_damage.radar; hind_lamps.status_2 = hind_damage.flir; hind_lamps.status_3 = hind_damage.llltv; hind_lamps.status_4 = hind_damage.laser_range_finder; hind_lamps.status_5 = hind_damage.radar_jammer; hind_lamps.status_6 = hind_damage.infra_red_jammer; hind_lamps.status_7 = hind_damage.navigation_computer; hind_lamps.status_8 = hind_damage.communications; hind_lamps.status_9 = hind_damage.radar_warning_system; hind_lamps.status_10 = hind_damage.head_up_display; hind_lamps.status_11 = hind_damage.helmet_mounted_sight; hind_lamps.status_12 = hind_damage.tv_display; hind_lamps.status_13 = hind_damage.threat_warning_display; hind_lamps.status_14 = hind_damage.night_vision_goggles; hind_lamps.status_15 = fire_extinguisher_used; hind_lamps.status_16 = get_current_flight_dynamics_rotor_brake (); hind_lamps.status_17 = get_current_flight_dynamics_wheel_brake (); hind_lamps.status_18 = get_global_auto_counter_measures (); }
void update_aircraft_decoy_release (entity *en) { aircraft *raw; int chaff_available, flare_available, chaff_released, flare_released; float range, velocity, time_to_impact; entity_sub_types weapon_sub_type; entity *persuer; vec3d *target_position, *weapon_position; ASSERT (en); #ifdef DEBUG if (get_comms_model () == COMMS_MODEL_CLIENT) { ASSERT (en == get_gunship_entity ()); } #endif raw = get_local_entity_data (en); //////////////////////////////////////// // // update timer // //////////////////////////////////////// raw->decoy_release_timer -= get_delta_time (); if (raw->decoy_release_timer >= 0.0) { return; } raw->decoy_release_timer = 2.0 + frand1 (); //////////////////////////////////////// // // validate // //////////////////////////////////////// if (en == get_gunship_entity ()) { if (!get_global_auto_counter_measures ()) { return; } } else if (get_local_entity_int_value (en, INT_TYPE_PLAYER) != ENTITY_PLAYER_AI) { return; } if (!get_local_entity_int_value (en, INT_TYPE_AIRBORNE_AIRCRAFT)) { return; } persuer = get_local_entity_first_child (en, LIST_TYPE_TARGET); if (!persuer) { return; } chaff_available = get_local_entity_weapon_available (en, ENTITY_SUB_TYPE_WEAPON_CHAFF); flare_available = get_local_entity_weapon_available (en, ENTITY_SUB_TYPE_WEAPON_FLARE); if (!(chaff_available || flare_available)) { return; } //////////////////////////////////////// // // check all persuers // //////////////////////////////////////// target_position = get_local_entity_vec3d_ptr (en, VEC3D_TYPE_POSITION); chaff_released = FALSE; flare_released = FALSE; while (persuer) { if (get_local_entity_type (persuer) == ENTITY_TYPE_WEAPON) { if (get_local_entity_int_value (persuer, INT_TYPE_WEAPON_GUIDANCE_TYPE) != WEAPON_GUIDANCE_TYPE_NONE) { weapon_sub_type = get_decoy_type_for_weapon (persuer); if (weapon_sub_type == ENTITY_SUB_TYPE_WEAPON_CHAFF) { if (chaff_available) { if (!chaff_released) { weapon_position = get_local_entity_vec3d_ptr (persuer, VEC3D_TYPE_POSITION); range = get_approx_3d_range (weapon_position, target_position); velocity = get_local_entity_float_value (persuer, FLOAT_TYPE_VELOCITY); time_to_impact = range / max (velocity, 1.0); if (time_to_impact < 10.0) { launch_client_server_weapon (en, ENTITY_SUB_TYPE_WEAPON_CHAFF); chaff_released = TRUE; if (flare_released) { break; } } } } } else if (weapon_sub_type == ENTITY_SUB_TYPE_WEAPON_FLARE) { if (flare_available) { if (!flare_released) { weapon_position = get_local_entity_vec3d_ptr (persuer, VEC3D_TYPE_POSITION); range = get_approx_3d_range (weapon_position, target_position); velocity = get_local_entity_float_value (persuer, FLOAT_TYPE_VELOCITY); time_to_impact = range / max (velocity, 1.0); if (time_to_impact < 10.0) { launch_client_server_weapon (en, ENTITY_SUB_TYPE_WEAPON_FLARE); flare_released = TRUE; if (chaff_released) { break; } } } } } } } persuer = get_local_entity_child_succ (persuer, LIST_TYPE_TARGET); } }
void update_hokum_lamp_avionics (void) { entity *en; int gear_state; en = get_gunship_entity (); update_master_caution (); //////////////////////////////////////// gear_state = get_local_entity_undercarriage_state (en); gear_transition_timer -= get_delta_time (); if (gear_transition_timer <= 0.0) { gear_transition_state ^= 1; gear_transition_timer = GEAR_TRANSITION_FLASH_RATE; } //////////////////////////////////////// hokum_lamps.left_engine_fire = get_dynamics_damage_type (DYNAMICS_DAMAGE_LEFT_ENGINE_FIRE); hokum_lamps.apu_fire = 0; hokum_lamps.right_engine_fire = get_dynamics_damage_type (DYNAMICS_DAMAGE_RIGHT_ENGINE_FIRE); hokum_lamps.fire_extinguiser = fire_extinguisher_used; hokum_lamps.hydraulic_pressure = get_dynamics_damage_type (DYNAMICS_DAMAGE_LOW_HYDRAULICS); hokum_lamps.oil_pressure = get_dynamics_damage_type (DYNAMICS_DAMAGE_LOW_OIL_PRESSURE) || get_dynamics_damage_type (DYNAMICS_DAMAGE_HIGH_OIL_PRESSURE); hokum_lamps.oil_temperature = 0; hokum_lamps.overtorque = get_current_flight_dynamics_overtorque (); hokum_lamps.rotor_rpm = get_current_flight_dynamics_low_rotor_rpm (); hokum_lamps.fuel_low = current_flight_dynamics->fuel_weight.value < (current_flight_dynamics->fuel_weight.max * 0.25); hokum_lamps.rotor_brake = get_current_flight_dynamics_rotor_brake (); hokum_lamps.wheel_brake = get_current_flight_dynamics_wheel_brake (); hokum_lamps.navigation_lights = get_local_entity_int_value (en, INT_TYPE_LIGHTS_ON); hokum_lamps.hover_hold = get_current_flight_dynamics_auto_hover (); hokum_lamps.altitude_hold = get_current_flight_dynamics_altitude_lock (); hokum_lamps.auto_pilot = get_current_flight_dynamics_auto_pilot (); hokum_lamps.radar = get_local_entity_int_value (en, INT_TYPE_RADAR_ON); hokum_lamps.laser = get_local_entity_int_value (en, INT_TYPE_LASER_ON); hokum_lamps.radar_jammer = get_local_entity_int_value (en, INT_TYPE_RADAR_JAMMER_ON); hokum_lamps.ir_jammer = get_local_entity_int_value (en, INT_TYPE_INFRA_RED_JAMMER_ON); hokum_lamps.auto_counter_measures = get_global_auto_counter_measures (); hokum_lamps.ase_auto_page = get_global_ase_auto_page (); hokum_lamps.gear_damaged = get_dynamics_damage_type (DYNAMICS_DAMAGE_UNDERCARRIAGE); switch (gear_state) { //////////////////////////////////////// case AIRCRAFT_UNDERCARRIAGE_UP: //////////////////////////////////////// { hokum_lamps.gear_status = 1; hokum_lamps.gear_red = 1; break; } //////////////////////////////////////// case AIRCRAFT_UNDERCARRIAGE_LOWERING: //////////////////////////////////////// { hokum_lamps.gear_status = gear_transition_state; hokum_lamps.gear_red = 0; break; } //////////////////////////////////////// case AIRCRAFT_UNDERCARRIAGE_DOWN: //////////////////////////////////////// { hokum_lamps.gear_status = 1; hokum_lamps.gear_red = 0; break; } //////////////////////////////////////// case AIRCRAFT_UNDERCARRIAGE_RAISING: //////////////////////////////////////// { hokum_lamps.gear_status = gear_transition_state; hokum_lamps.gear_red = 1; break; } } hokum_lamps.pilot_lh_mfd_focus = get_hokum_mfd_has_focus (HOKUM_MFD_LOCATION_PILOT_LHS); hokum_lamps.pilot_rh_mfd_focus = get_hokum_mfd_has_focus (HOKUM_MFD_LOCATION_PILOT_RHS); hokum_lamps.co_pilot_lh_mfd_focus = get_hokum_mfd_has_focus (HOKUM_MFD_LOCATION_CO_PILOT_LHS); hokum_lamps.co_pilot_rh_mfd_focus = get_hokum_mfd_has_focus (HOKUM_MFD_LOCATION_CO_PILOT_RHS); }