entity *free_flight_auto_assign_gunship (void) { vec3d *pos; entity *force, *new_task, *group, *member, **gunship_list, *en; entity_sub_types sub_type; int c, index, count; // // Auto assign a helicopter for free flight // ASSERT (get_comms_model () == COMMS_MODEL_SERVER); ASSERT (get_game_type () == GAME_TYPE_FREE_FLIGHT); ASSERT (get_pilot_entity ()); if (get_gunship_entity ()) { return NULL; } force = get_local_entity_parent (get_pilot_entity (), LIST_TYPE_PILOT); ASSERT (force); // // Count up candidates // count = 0; en = get_local_entity_first_child (force, LIST_TYPE_AIR_REGISTRY); while (en) { if (get_local_entity_int_value (en, INT_TYPE_GROUP_MODE) == GROUP_MODE_IDLE) { member = get_local_entity_first_child (en, LIST_TYPE_MEMBER); while (member) { sub_type = get_local_entity_int_value (member, INT_TYPE_ENTITY_SUB_TYPE); if ((sub_type == ENTITY_SUB_TYPE_AIRCRAFT_RAH66_COMANCHE) || (sub_type == ENTITY_SUB_TYPE_AIRCRAFT_KA52_HOKUM_B)) { if (get_local_entity_suitable_for_player (member, get_pilot_entity ())) { count ++; } } member = get_local_entity_child_succ (member, LIST_TYPE_MEMBER); } } en = get_local_entity_child_succ (en, LIST_TYPE_AIR_REGISTRY); } if (count == 0) { return NULL; } // // Create list of candidates // gunship_list = safe_malloc (sizeof (entity *) * count); count = 0; en = get_local_entity_first_child (force, LIST_TYPE_AIR_REGISTRY); while (en) { if (get_local_entity_int_value (en, INT_TYPE_GROUP_MODE) == GROUP_MODE_IDLE) { member = get_local_entity_first_child (en, LIST_TYPE_MEMBER); while (member) { sub_type = get_local_entity_int_value (member, INT_TYPE_ENTITY_SUB_TYPE); if ((sub_type == ENTITY_SUB_TYPE_AIRCRAFT_RAH66_COMANCHE) || (sub_type == ENTITY_SUB_TYPE_AIRCRAFT_KA52_HOKUM_B)) { if (get_local_entity_suitable_for_player (member, get_pilot_entity ())) { gunship_list [count] = member; count ++; } } member = get_local_entity_child_succ (member, LIST_TYPE_MEMBER); } } en = get_local_entity_child_succ (en, LIST_TYPE_AIR_REGISTRY); } // // Pick one... // ASSERT (count > 0); index = rand16 () % count; for (c = 0; c < count; c ++) { en = gunship_list [index]; group = get_local_entity_parent (en, LIST_TYPE_MEMBER); pos = get_local_entity_vec3d_ptr (en, VEC3D_TYPE_POSITION); new_task = create_user_task (en, ENTITY_SUB_TYPE_TASK_FREE_FLIGHT, pos, NULL, NULL); set_assign_create_waypoint_route (FALSE); if (assign_primary_task_to_group (group, new_task)) { set_gunship_entity (en); set_view_mode (VIEW_MODE_COCKPIT_PANEL_LEVEL_AHEAD); safe_free (gunship_list); initialise_free_flight_screen_map_page_objects (); return en; } else { debug_log ("FLIGHT: can't assign user to Created task"); destroy_client_server_entity (new_task); } set_assign_create_waypoint_route (TRUE); index ++; if (index == count) { index = 0; } } safe_free (gunship_list); return NULL; }
static void update_client (entity *en) { helicopter *raw; int loop; aircraft_damage_types damage_type; raw = get_local_entity_data (en); update_local_entity_view_interest_level (en); update_local_helicopter_rotor_sounds (en); damage_type = aircraft_critically_damaged (en); if (raw->ac.mob.alive) { switch (raw->player) { //////////////////////////////////////// case ENTITY_PLAYER_AI: //////////////////////////////////////// { //////////////////////////////////////// for (loop = 0; loop < get_entity_movement_iterations (); loop ++) { if ((damage_type == AIRCRAFT_DAMAGE_CRITICAL) || (get_local_entity_int_value (en, INT_TYPE_EJECTED))) { helicopter_death_movement (en); } else { if (!get_local_entity_int_value (en, INT_TYPE_LANDED)) { get_3d_terrain_point_data (raw->ac.mob.position.x, raw->ac.mob.position.z, &raw->ac.terrain_info); } helicopter_movement (en); } } //////////////////////////////////////// //////////////////////////////////////// // // ORDER IS CRITICAL // if (raw->ac.mob.alive) { update_rotors (en); update_aircraft_loading_doors (en); update_aircraft_cargo_doors (en); update_aircraft_undercarriage (en); update_aircraft_weapon_system_ready (en); update_entity_weapon_systems (en); update_entity_weapon_system_weapon_and_target_vectors (en); } // //////////////////////////////////////// break; } //////////////////////////////////////// case ENTITY_PLAYER_LOCAL: //////////////////////////////////////// { if (en != get_gunship_entity ()) { // // Client might be waiting for server to set old gunship to AI controlled. // return; } if (raw->invulnerable_timer > 0.0) { raw->invulnerable_timer -= get_delta_time (); } update_current_flight_dynamics_fuel_weight (); if ((!fire_continuous_weapon) && (get_local_entity_sound_type_valid (en, weapon_database [raw->ac.selected_weapon].launch_sound_effect_sub_type))) { pause_client_server_continuous_weapon_sound_effect (en, raw->ac.selected_weapon); } //helicopter_death_movement (en); //////////////////////////////////////// if ((!get_local_entity_int_value (en, INT_TYPE_AUTO_PILOT)) && (!get_local_entity_int_value (en, INT_TYPE_EJECTED))) { update_flight_dynamics (); transmit_entity_comms_message (ENTITY_COMMS_UPDATE, en); } else { if (get_local_entity_int_value (en, INT_TYPE_LANDED)) { if (get_local_entity_int_value (en, INT_TYPE_AUTO_PILOT)) { set_current_flight_dynamics_rotor_brake (TRUE); set_current_flight_dynamics_auto_pilot (FALSE); current_flight_dynamics->input_data.collective.value = 0.0; } } if ((damage_type == AIRCRAFT_DAMAGE_CRITICAL) || (get_local_entity_int_value (en, INT_TYPE_EJECTED)) || (get_local_entity_int_value (en, INT_TYPE_LANDED))) { set_current_flight_dynamics_auto_pilot (FALSE); } for (loop = 0; loop < get_entity_movement_iterations (); loop ++) { if ((damage_type == AIRCRAFT_DAMAGE_CRITICAL) || (get_local_entity_int_value (en, INT_TYPE_EJECTED))) { helicopter_death_movement (en); } else { if (!get_local_entity_int_value (en, INT_TYPE_LANDED)) { get_3d_terrain_point_data (raw->ac.mob.position.x, raw->ac.mob.position.z, &raw->ac.terrain_info); } helicopter_movement (en); if (get_local_entity_int_value (en, INT_TYPE_AUTO_PILOT)) { set_dynamics_entity_values (get_gunship_entity ()); } } } } //////////////////////////////////////// // // ORDER IS CRITICAL // if (raw->ac.mob.alive) { update_aircraft_loading_doors (en); update_aircraft_cargo_doors (en); update_aircraft_undercarriage (en); update_aircraft_weapon_system_ready (en); update_entity_weapon_systems (en); update_entity_weapon_system_weapon_and_target_vectors (en); update_avionics (); update_cockpits (); update_aircraft_decoy_release (en); } // //////////////////////////////////////// // // Check if gunship has a task - if not then set gunship entity to NULL // if (!get_local_entity_parent (en, LIST_TYPE_FOLLOWER)) { if (!get_local_entity_int_value (en, INT_TYPE_EJECTED)) { if (en == get_gunship_entity ()) { set_gunship_entity (NULL); } } } break; } //////////////////////////////////////// case ENTITY_PLAYER_REMOTE: //////////////////////////////////////// { //////////////////////////////////////// // // ORDER IS CRITICAL // if (raw->ac.mob.alive) { update_aircraft_loading_doors (en); update_aircraft_cargo_doors (en); update_aircraft_undercarriage (en); update_aircraft_weapon_system_ready (en); update_entity_weapon_systems (en); update_entity_weapon_system_weapon_and_target_vectors (en); } if ((get_local_entity_int_value (en, INT_TYPE_AUTO_PILOT)) || (get_local_entity_int_value (en, INT_TYPE_EJECTED))) { for (loop = 0; loop < get_entity_movement_iterations (); loop ++) { // no need for death_movement as if the remote_player is damaged it will default back to manual flight. if (get_local_entity_int_value (en, INT_TYPE_EJECTED)) { helicopter_death_movement (en); } else { if (!get_local_entity_int_value (en, INT_TYPE_LANDED)) { get_3d_terrain_point_data (raw->ac.mob.position.x, raw->ac.mob.position.z, &raw->ac.terrain_info); } helicopter_movement (en); } } } else { interpolate_entity_position (en); } // //////////////////////////////////////// break; } } } else { if (get_local_entity_int_value (en, INT_TYPE_OPERATIONAL_STATE) == OPERATIONAL_STATE_DEAD) { } else { for (loop = 0; loop < get_entity_movement_iterations (); loop ++) { helicopter_death_movement (en); } } } }
void destroy_local_entities (void) { entity *en; en = get_local_entity_list (); if (get_gunship_entity()) set_gunship_entity(NULL); while (en) { #if DEBUG_MODULE { static int reported_segment = FALSE, reported_city_building = FALSE, reported_sector = FALSE; #if DEBUG_UPDATE_LIST_VALIDATION entity *succ, *pred, *updt; if (get_update_entity ()) { updt = get_local_entity_first_child (get_update_entity (), LIST_TYPE_UPDATE); while (updt) { ASSERT (updt->type != ENTITY_TYPE_UNKNOWN); succ = get_local_entity_child_succ (updt, LIST_TYPE_UPDATE); if (succ) { ASSERT (get_local_entity_child_pred (succ, LIST_TYPE_UPDATE) == updt); } pred = get_local_entity_child_pred (updt, LIST_TYPE_UPDATE); if (pred) { ASSERT (get_local_entity_child_succ (pred, LIST_TYPE_UPDATE) == updt); } updt = get_local_entity_child_succ (updt, LIST_TYPE_UPDATE); } } #endif switch (get_local_entity_type (en)) { case ENTITY_TYPE_SEGMENT: case ENTITY_TYPE_SECTOR: case ENTITY_TYPE_CITY_BUILDING: { if (get_local_entity_type (en) == ENTITY_TYPE_SEGMENT) { if (reported_segment) { break; } reported_segment = TRUE; } if (get_local_entity_type (en) == ENTITY_TYPE_SECTOR) { if (reported_sector) { break; } reported_sector = TRUE; } if (get_local_entity_type (en) == ENTITY_TYPE_CITY_BUILDING) { if (reported_city_building) { break; } reported_city_building = TRUE; } } default: { debug_log ("EN_DSTRY: destroying %s, index %d, sub_type %d", get_local_entity_type_name (en), get_local_entity_index (en), get_local_entity_int_value (en, INT_TYPE_ENTITY_SUB_TYPE)); break; } } } #endif destroy_local_entity_family(en); en = get_local_entity_list (); } }
static void update_server (entity *en) { entity *group; helicopter *raw; int loop; aircraft_damage_types damage_type; raw = get_local_entity_data (en); update_local_entity_view_interest_level (en); update_local_helicopter_rotor_sounds (en); damage_type = aircraft_critically_damaged (en); if (raw->ac.mob.alive) { switch (raw->player) { //////////////////////////////////////// case ENTITY_PLAYER_AI: //////////////////////////////////////// { //////////////////////////////////////// for (loop = 0; loop < get_entity_movement_iterations (); loop ++) { if ((damage_type == AIRCRAFT_DAMAGE_CRITICAL) || (get_local_entity_int_value (en, INT_TYPE_EJECTED))) { helicopter_death_movement (en); } else { if (!get_local_entity_int_value (en, INT_TYPE_LANDED)) { get_3d_terrain_point_data (raw->ac.mob.position.x, raw->ac.mob.position.z, &raw->ac.terrain_info); } helicopter_movement (en); } } // provide resync for AI wingmen group = get_local_entity_parent (en, LIST_TYPE_MEMBER); if (group) { if ((get_local_entity_int_value (en, INT_TYPE_OPERATIONAL_STATE) != OPERATIONAL_STATE_LANDED) && (get_local_entity_int_value (group, INT_TYPE_MULTIPLAYER_GROUP))) { transmit_entity_comms_message (ENTITY_COMMS_UPDATE, en); } } //////////////////////////////////////// // // ORDER IS CRITICAL // if (raw->ac.mob.alive) { update_rotors (en); update_aircraft_loading_doors (en); update_aircraft_cargo_doors (en); update_aircraft_undercarriage (en); update_aircraft_rudder (en); update_aircraft_target_scan (en); update_aircraft_weapon_system_ready (en); update_entity_weapon_systems (en); update_entity_weapon_system_weapon_and_target_vectors (en); update_aircraft_weapon_fire (en); update_aircraft_decoy_release (en); } // //////////////////////////////////////// break; } //////////////////////////////////////// case ENTITY_PLAYER_LOCAL: //////////////////////////////////////// { ASSERT (en == get_gunship_entity ()); if (raw->invulnerable_timer > 0.0) { raw->invulnerable_timer -= get_delta_time (); } update_current_flight_dynamics_fuel_weight (); update_current_flight_dynamics_flight_time (); //////////////////////////////////////// if ((!get_local_entity_int_value (en, INT_TYPE_AUTO_PILOT)) && (!get_local_entity_int_value (en, INT_TYPE_EJECTED))) { update_flight_dynamics (); update_player_helicopter_waypoint_distance (en); } else { if ((damage_type == AIRCRAFT_DAMAGE_CRITICAL) || (get_local_entity_int_value (en, INT_TYPE_EJECTED)) || (get_local_entity_int_value (en, INT_TYPE_LANDED))) { set_current_flight_dynamics_auto_pilot (FALSE); if (get_local_entity_int_value (en, INT_TYPE_LANDED)) { set_current_flight_dynamics_rotor_brake (TRUE); current_flight_dynamics->input_data.collective.value = 0.0; } } for (loop = 0; loop < get_entity_movement_iterations (); loop ++) { if (get_local_entity_int_value (en, INT_TYPE_EJECTED)) { helicopter_death_movement (en); } else { get_3d_terrain_point_data (raw->ac.mob.position.x, raw->ac.mob.position.z, &raw->ac.terrain_info); helicopter_movement (en); if (get_local_entity_int_value (en, INT_TYPE_AUTO_PILOT)) { set_dynamics_entity_values (en); } } } } //////////////////////////////////////// transmit_entity_comms_message (ENTITY_COMMS_UPDATE, en); //////////////////////////////////////// // // ORDER IS CRITICAL // if (raw->ac.mob.alive) { update_aircraft_loading_doors (en); update_aircraft_cargo_doors (en); update_aircraft_undercarriage (en); update_aircraft_weapon_system_ready (en); update_entity_weapon_systems (en); update_entity_weapon_system_weapon_and_target_vectors (en); update_avionics (); update_cockpits (); update_aircraft_decoy_release (en); } // //////////////////////////////////////// // // Check if gunship has a task - if not then set gunship entity to NULL // if (!get_local_entity_parent (en, LIST_TYPE_FOLLOWER)) { if (!get_local_entity_int_value (en, INT_TYPE_EJECTED)) { if (en == get_gunship_entity ()) { set_gunship_entity (NULL); } } } break; } //////////////////////////////////////// case ENTITY_PLAYER_REMOTE: //////////////////////////////////////// { //////////////////////////////////////// if (raw->invulnerable_timer > 0.0) { raw->invulnerable_timer -= get_delta_time (); } if ((get_local_entity_int_value (en, INT_TYPE_AUTO_PILOT)) || (get_local_entity_int_value (en, INT_TYPE_EJECTED))) { for (loop = 0; loop < get_entity_movement_iterations (); loop ++) { if ((damage_type == AIRCRAFT_DAMAGE_CRITICAL) || (get_local_entity_int_value (en, INT_TYPE_EJECTED))) { helicopter_death_movement (en); } else { if (!get_local_entity_int_value (en, INT_TYPE_LANDED)) { get_3d_terrain_point_data (raw->ac.mob.position.x, raw->ac.mob.position.z, &raw->ac.terrain_info); } helicopter_movement (en); } } #if DEBUG_MODULE debug_log ("HC_UPDT: SERVER: moving client %d using AUTO PILOT", get_local_entity_index (en)); #endif } else { interpolate_entity_position (en); update_player_helicopter_waypoint_distance (en); } //////////////////////////////////////// // // ORDER IS CRITICAL // if (raw->ac.mob.alive) { update_aircraft_loading_doors (en); update_aircraft_cargo_doors (en); update_aircraft_undercarriage (en); update_aircraft_weapon_system_ready (en); update_entity_weapon_systems (en); update_entity_weapon_system_weapon_and_target_vectors (en); } // //////////////////////////////////////// break; } } } else { if (get_local_entity_int_value (en, INT_TYPE_OPERATIONAL_STATE) == OPERATIONAL_STATE_DEAD) { raw->ac.death_timer -= get_delta_time (); if (raw->ac.death_timer <= 0.0) { if (get_local_entity_int_value (en, INT_TYPE_PLAYER) == ENTITY_PLAYER_AI) { // // don't destroy helicopters while they are still occupied by players (otherwise avionics / pilot-entity etc. don't get deinitialised) // destroy_client_server_entity_family (en); } else { raw->ac.death_timer = 0.0; } } } else { for (loop = 0; loop < get_entity_movement_iterations (); loop ++) { helicopter_death_movement (en); } } } }
static void kill_local (entity *en) { int losses; helicopter *raw; entity *task, *group, *member, *destroy_task; //////////////////////////////////////// // // PRE-AMBLE // //////////////////////////////////////// #if DEBUG_MODULE >= 2 debug_log_entity_args (ENTITY_DEBUG_LOCAL, ENTITY_DEBUG_KILL, en); #endif if (!get_local_entity_int_value (en, INT_TYPE_ALIVE)) { return; } raw = get_local_entity_data (en); group = get_local_entity_parent (en, LIST_TYPE_MEMBER); ASSERT (group); // // update force info // remove_from_force_info (get_local_force_entity (raw->ac.mob.side), en); if (en == get_gunship_entity ()) { // // Award Points for mission // task = get_local_entity_primary_task (en); if (task) { if (get_local_entity_int_value (task, INT_TYPE_TASK_STATE) == TASK_STATE_COMPLETED) { // // Only award points for COMPLETE missions (also means player can't rejoin that mission and get points again) // notify_gunship_entity_mission_terminated (en, task); } } } //////////////////////////////////////// // // VALIDATE // //////////////////////////////////////// //////////////////////////////////////// // // DESTROY COMPONENTS // //////////////////////////////////////// #if DEBUG_MODULE debug_log ("HC_DSTRY: killing helicopter %s", entity_sub_type_aircraft_names [raw->ac.mob.sub_type]); #endif if (get_comms_model () == COMMS_MODEL_SERVER) { // notify regen of kill add_entity_to_regen_queue ( get_local_entity_int_value(en, INT_TYPE_SIDE), get_local_entity_type(en), get_local_entity_int_value (en, INT_TYPE_ENTITY_SUB_TYPE), get_local_entity_int_value (group, INT_TYPE_ENTITY_SUB_TYPE) ); // // notify task dependents // task = get_local_entity_first_child (en, LIST_TYPE_TASK_DEPENDENT); while (task) { destroy_task = task; task = get_local_entity_child_succ (task, LIST_TYPE_TASK_DEPENDENT); if (destroy_task->type == ENTITY_TYPE_TASK) { #if DEBUG_MODULE debug_log ("HC_DSTRY: killing helicopter, notifying task %s complete", entity_sub_type_task_names [get_local_entity_int_value (destroy_task, INT_TYPE_ENTITY_SUB_TYPE)]); #endif notify_local_entity (ENTITY_MESSAGE_TASK_COMPLETED, destroy_task, en, TASK_TERMINATED_OBJECTIVE_MESSAGE); } } // // Release landing lock (if any) // release_mobile_entity_landing_locks (en); // // if group contains player, set all helicopters in group to "weapons free", and clear "hold position" flag // if (get_local_entity_int_value (en, INT_TYPE_PLAYER) != ENTITY_PLAYER_AI) { member = get_local_entity_first_child (group, LIST_TYPE_MEMBER); while (member) { set_client_server_entity_int_value (member, INT_TYPE_WEAPONS_HOLD, FALSE); set_client_server_entity_int_value (member, INT_TYPE_POSITION_HOLD, FALSE); member = get_local_entity_child_succ (member, LIST_TYPE_MEMBER); } } } //////////////////////////////////////// // // UNLINK FROM SYSTEM // //////////////////////////////////////// // // helicopter // unlink_local_entity_children (en, LIST_TYPE_GUNSHIP_TARGET); unlink_local_entity_children (en, LIST_TYPE_PADLOCK); // // aircraft // // aircrew_root unlink_local_entity_children (en, LIST_TYPE_TASK_DEPENDENT); //////////////////////////////////////// // // the eject sequence relies on launched weapons NOT being unlinked // // unlink_local_entity_children (en, LIST_TYPE_LAUNCHED_WEAPON); // //////////////////////////////////////// delete_local_entity_from_parents_child_list (en, LIST_TYPE_FOLLOWER); delete_local_entity_from_parents_child_list (en, LIST_TYPE_MEMBER); // gunship_target_link // member_link delete_local_entity_from_parents_child_list (en, LIST_TYPE_MOVEMENT_DEPENDENT); // view_link delete_local_entity_from_parents_child_list (en, LIST_TYPE_TAKEOFF_QUEUE); // // mobile // // // kill weapon sound effects // kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_CHAIN_GUN); // // kill engine sound effects // kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_ROTOR_LOOPING); kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_ROTOR_WIND_UP); kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_ROTOR_WIND_DOWN); // // kill radio / warning effects // kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_INCOMING_MISSILE_WARNING); kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_LOCK_ON_TONE); kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_MCA); kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_RADAR_LOCKED); kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_RADAR_TRACKED); kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_CPG_MESSAGE); kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_RADIO_MESSAGE); kill_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_WARNING_MESSAGE); notify_speech_buffers_entity_killed (en); unlink_local_entity_children (en, LIST_TYPE_TARGET); delete_local_entity_from_parents_child_list (en, LIST_TYPE_PADLOCK); // sector_link delete_local_entity_from_parents_child_list (en, LIST_TYPE_TARGET); // update_link // // death timer (set time after which entity is totally destroyed) // set_local_entity_float_value (en, FLOAT_TYPE_DEATH_TIMER, calculate_mobile_death_timer_value (en)); //////////////////////////////////////// // // KILL // //////////////////////////////////////// damage_helicopter_3d_object (en); // must be done before alive flag set to FALSE remove_mobile_values_from_sector (get_local_entity_parent (en, LIST_TYPE_SECTOR), en); set_local_entity_int_value (en, INT_TYPE_ALIVE, FALSE); // // group losses // losses = get_local_entity_int_value (group, INT_TYPE_LOSSES); losses ++; set_local_entity_int_value (group, INT_TYPE_LOSSES, losses); // // task losses // task = get_local_group_primary_task (group); if (task) { losses = get_local_entity_int_value (task, INT_TYPE_LOSSES); losses ++; set_local_entity_int_value (task, INT_TYPE_LOSSES, losses); } // // Notify Campaign Screen // notify_campaign_screen (CAMPAIGN_SCREEN_GROUP_REMOVE_MEMBER, group); // // Notify the GROUP that the mobile has been killed (N.B. must be done AFTER mobile is unlinked from member list) // if (get_comms_model () == COMMS_MODEL_SERVER) { notify_local_entity (ENTITY_MESSAGE_MOBILE_KILLED, group, en); } // // Notify force to check campaign criteria // if (get_comms_model () == COMMS_MODEL_SERVER) { entity *force; force = get_local_entity_first_child (get_session_entity (), LIST_TYPE_FORCE); while (force) { notify_local_entity (ENTITY_MESSAGE_CHECK_CAMPAIGN_OBJECTIVES, force, en); force = get_local_entity_child_succ (force, LIST_TYPE_FORCE); } } //////////////////////////////////////// // // SPECIAL EFFECTS // //////////////////////////////////////// helicopter_impact_movement (en); if (get_comms_model () == COMMS_MODEL_SERVER) { vec3d *position; sound_sample_indices sound_sample_index; set_client_server_entity_int_value (en, INT_TYPE_MAIN_ROTOR_DAMAGED, TRUE); set_client_server_entity_int_value (en, INT_TYPE_TAIL_ROTOR_DAMAGED, TRUE); create_client_server_object_killed_explosion_effect (en); position = get_local_entity_vec3d_ptr (en, VEC3D_TYPE_POSITION); sound_sample_index = SOUND_SAMPLE_INDEX_SHOT_DOWN_HELICOPTER; create_client_server_sound_effect_entity ( en, ENTITY_SIDE_NEUTRAL, ENTITY_SUB_TYPE_EFFECT_SOUND_ROTOR_LOOPING, SOUND_CHANNEL_SOUND_EFFECT, SOUND_LOCALITY_ALL, NULL, // position 1.0, // amplification TRUE, // valid sound effect TRUE, // looping 1, // sample count &sound_sample_index // sample index list ); } set_local_entity_int_value (en, INT_TYPE_OPERATIONAL_STATE, OPERATIONAL_STATE_DYING); //////////////////////////////////////// // // VIEWS // //////////////////////////////////////// if ((en == get_gunship_entity ()) && (!get_local_entity_int_value (en, INT_TYPE_EJECTED))) { set_gunship_entity (NULL); } #if LANDING_ROUTE_CHECK destroy_debug_entity_landing_route_check (en); #endif ///////////////////////////////////////////////////////////////// // // SPECIAL_EFFECT_HOOK FOR BEING_DESTROYED // ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////// }