void create_client_pilot (void) { client_pilot_request_data pilot_data; ASSERT (get_comms_model () == COMMS_MODEL_CLIENT); // // pack required gunship data // strcpy (pilot_data.name, get_player_log_name (get_current_player_log ())); pilot_data.side = get_global_gunship_side (); pilot_data.rank = get_player_log_rank (get_global_gunship_side (), get_current_player_log ()); pilot_data.sub_type = ENTITY_SUB_TYPE_PILOT_PILOT; pilot_data.unique_id = direct_play_get_player_id (); pilot_data.difficulty = get_global_difficulty_level (); // // Send request // send_packet (get_server_id (), PACKET_TYPE_CLIENT_PILOT_REQUEST, (unsigned char *) &pilot_data, sizeof (client_pilot_request_data), SEND_TYPE_PERSONAL); // turn off NEXT button while Pilot entity is being created client_server if (get_comms_model () == COMMS_MODEL_CLIENT) { set_display_gunship_buttons (FALSE, "ENGAGE"); } }
void inc_player_log_kills (int side, player_log_type *log, entity *victim) { ASSERT (victim); if (victim == get_gunship_entity ()) { inc_player_log_deaths (side, log); } else { if (get_local_entity_int_value (victim, INT_TYPE_SIDE) != get_global_gunship_side ()) { switch (get_local_entity_type (victim)) { case ENTITY_TYPE_FIXED_WING: case ENTITY_TYPE_HELICOPTER: { inc_player_log_air_kills (side, log); break; } case ENTITY_TYPE_ANTI_AIRCRAFT: case ENTITY_TYPE_ROUTED_VEHICLE: { inc_player_log_ground_kills (side, log); break; } case ENTITY_TYPE_SHIP_VEHICLE: { inc_player_log_sea_kills (side, log); break; } case ENTITY_TYPE_BRIDGE: case ENTITY_TYPE_CITY_BUILDING: case ENTITY_TYPE_SCENIC: case ENTITY_TYPE_SITE: case ENTITY_TYPE_SITE_UPDATABLE: { inc_player_log_fixed_kills (side, log); break; } default: { break; } } } else { inc_player_log_friendly_kills (side, log); } } }
void create_server_pilot (void) { entity *en; ASSERT (get_comms_model () == COMMS_MODEL_SERVER); en = create_new_pilot_entity ( get_player_log_name (get_current_player_log ()), get_global_gunship_side (), get_player_log_rank (get_global_gunship_side (), get_current_player_log ()), ENTITY_SUB_TYPE_PILOT_PILOT, direct_play_get_player_id (), get_global_difficulty_level () ); set_pilot_entity (en); }
entity *create_local_sound_effect_entity ( int index, entity *parent, entity_sides side, entity_sub_types sub_type, sound_channel_types channel, sound_locality_types locality, vec3d *position, float amp, int valid, int looping, int sample_count, sound_sample_indices *sample_indices ) { entity *en; vec3d pos; int panning, create_stack_attributes; ASSERT (parent); create_stack_attributes = force_local_entity_create_stack_attributes; if (get_comms_data_flow () == COMMS_DATA_FLOW_RX) { set_force_local_entity_create_stack_attributes (TRUE); } panning = TRUE; if (position) { pos = *position; } else { position = get_local_entity_vec3d_ptr (parent, VEC3D_TYPE_POSITION); if (position) { pos = *position; } else { pos.x = MID_MAP_X; pos.y = MID_MAP_Y; pos.z = MID_MAP_Z; panning = FALSE; } } // // special cases for speech // switch (sub_type) { case ENTITY_SUB_TYPE_EFFECT_SOUND_RADIO_MESSAGE: { if (get_global_gunship_side () == side) { amp = adjust_radio_message_amplification (amp, &pos); } else { amp = 0.0; } panning = FALSE; break; } case ENTITY_SUB_TYPE_EFFECT_SOUND_CPG_MESSAGE: case ENTITY_SUB_TYPE_EFFECT_SOUND_WARNING_MESSAGE: { if (parent == get_gunship_entity ()) { amp = 1.0; } else { amp = 0.0; } panning = FALSE; break; } } // // create sound // en = create_local_entity ( ENTITY_TYPE_SOUND_EFFECT, index, ENTITY_ATTR_INT_VALUE (INT_TYPE_ENTITY_SUB_TYPE, sub_type), ENTITY_ATTR_PARENT (LIST_TYPE_SPECIAL_EFFECT, parent), ENTITY_ATTR_VEC3D (VEC3D_TYPE_POSITION, pos.x, pos.y, pos.z), ENTITY_ATTR_INT_VALUE (INT_TYPE_SOUND_CHANNEL, channel), ENTITY_ATTR_INT_VALUE (INT_TYPE_SOUND_EFFECT_LOOPING, looping), ENTITY_ATTR_INT_VALUE (INT_TYPE_SOUND_EFFECT_PANNING, panning), ENTITY_ATTR_INT_VALUE (INT_TYPE_SOUND_LOCALITY, locality), ENTITY_ATTR_INT_VALUE (INT_TYPE_VALID_SOUND_EFFECT, valid), ENTITY_ATTR_FLOAT_VALUE (FLOAT_TYPE_AMPLIFICATION, amp), ENTITY_ATTR_END ); set_local_sound_effect_sample_indices (en, sample_count, sample_indices); #if DEBUG_MODULE debug_log ("SOUNDEFF : created effect %s (%d), parent %s (%d), next %d, looping %d, valid %d", application_sound_effects [sample_indices [0]].name, get_local_entity_index (en), get_local_entity_type_name (parent), get_local_entity_index (parent), looping, valid); #endif set_force_local_entity_create_stack_attributes (create_stack_attributes); return en; }
void display_campaign_criteria_time_remaining (void) { #if 0 entity *force_en; force *force_raw; //session //*session_raw; //campaign_criteria_type //*this_campaign_criteria; //float //elapsed_hours, //elapsed_minutes, //elapsed_seconds; //int //remaining_hours, //remaining_minutes, //remaining_seconds; //int //x, y; //char //s [20]; // // display count down timer until campaign completiion (NOT "tour of duty" timer) // // // currently used only for special games, so I have tailored it to suit :- // only displays minutes and seconds, // doesn't display on the clients until after first time-of-day resync // if ((get_game_type () != GAME_TYPE_SPECIAL) && (get_game_type () != GAME_TYPE_MAGAZINE_DEMO)) { return; } ASSERT (get_session_entity ()); force_en = get_local_force_entity (get_global_gunship_side ()); ASSERT (force_en); force_raw = (force *) get_local_entity_data (force_en); /* this_campaign_criteria = force_raw->campaign_criteria; while (this_campaign_criteria) { if (this_campaign_criteria->criteria_type == CAMPAIGN_CRITERIA_TIME_DURATION) { break; } this_campaign_criteria = this_campaign_criteria->next; } if (this_campaign_criteria) { if (this_campaign_criteria->valid) { session_raw = (force *) get_local_entity_data (get_session_entity ()); // // clients don't display until AFTER first resync (otherwise time will be wrong) // if (get_comms_model () == COMMS_MODEL_CLIENT) { if (!display_timer_valid) { return; } } // // get time remaining // get_digital_clock_values (session_raw->elapsed_time_of_day, &elapsed_hours, &elapsed_minutes, &elapsed_seconds); remaining_seconds = (this_campaign_criteria->days - session_raw->elapsed_days) * ONE_DAY; remaining_seconds += (this_campaign_criteria->hours - elapsed_hours) * ONE_HOUR; remaining_seconds += (this_campaign_criteria->minutes - elapsed_minutes) * ONE_MINUTE; remaining_seconds += (this_campaign_criteria->seconds - elapsed_seconds) * ONE_SECOND; if ((remaining_seconds > 0.0) && (remaining_seconds < ONE_HOUR)) { if (remaining_seconds < ONE_MINUTE) { if (remaining_seconds < 10.0) { // // flash if < 10 seconds // if (frac (session_raw->elapsed_time_of_day) < 0.5) { return; } } set_ui_font (UI_FONT_ADS_15_ORANGE); } else { set_ui_font (UI_FONT_ADS_15_WHITE); } get_digital_clock_int_values (remaining_seconds, &remaining_hours, &remaining_minutes, &remaining_seconds); if (lock_screen (active_screen)) { set_full_screen_viewport (); sprintf (s, "T-%02d:%02d", remaining_minutes, remaining_seconds); // string WAS right-justified, but looked bad due to proportional fonts changing the width every second ! // x = get_screen_width (active_screen) - ui_get_string_length (s); x = get_screen_width (active_screen) - 62; y = ui_get_font_height () + 2; ui_display_text (s, x, y); unlock_screen (active_screen); } } } } */ #endif }