Example #1
0
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
}
Example #2
0
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");
	}
}
Example #3
0
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);
}
Example #4
0
void notify_difficulty_option_button ( ui_object *obj, void *arg )
{
    int
    selection;

    selection = get_global_difficulty_level ();

    selection--;

    if (selection < GAME_DIFFICULTY_HARD)
    {
        selection = GAME_DIFFICULTY_EASY;
    }

    set_global_difficulty_level ((enum GAME_DIFFICULTY_SETTINGS) selection);

    set_ui_object_text (obj, option_difficulty_text [selection - 1]);

    // don't leave text selected

    set_toggle_button_off (obj);
}
Example #5
0
float get_local_entity_armour_thickness (entity *target, entity *weapon)
{
	float
		armour_thickness;

	entity_sub_types
		sub_type;

	ASSERT (target);

	ASSERT (weapon);

	ASSERT (get_local_entity_int_value (weapon, INT_TYPE_IDENTIFY_WEAPON));

	ASSERT (get_comms_model () == COMMS_MODEL_SERVER);

	armour_thickness = 0.0;

	////////////////////////////////////////
	//
	// only vehicles are armoured
	//
	////////////////////////////////////////

	if (!get_local_entity_int_value (target, INT_TYPE_IDENTIFY_VEHICLE))
	{
		return (armour_thickness);
	}

	sub_type = get_local_entity_int_value (target, INT_TYPE_ENTITY_SUB_TYPE);

	////////////////////////////////////////
	//
	// only some vehicles are armoured
	//
	////////////////////////////////////////
	{
		int
			armoured;

		armoured =
		(
			(vehicle_database[sub_type].armour_front > 0.0) ||
			(vehicle_database[sub_type].armour_side > 0.0) ||
			(vehicle_database[sub_type].armour_rear > 0.0)
		);

		if (!armoured)
		{
			return (armour_thickness);
		}
	}

	////////////////////////////////////////
	//
	// get game difficulty level (use player's own level)
	//
	////////////////////////////////////////
	{
		game_difficulty_settings
			difficulty;

		entity
			*launcher,
			*pilot;

		difficulty = get_global_difficulty_level ();

		launcher = get_local_entity_parent (weapon, LIST_TYPE_LAUNCHED_WEAPON);

		if (launcher)
		{
			if (get_local_entity_int_value (launcher, INT_TYPE_PLAYER) != ENTITY_PLAYER_AI)
			{
				pilot = get_local_entity_first_child (launcher, LIST_TYPE_AIRCREW);

				if (pilot)
				{
					difficulty = get_local_entity_int_value (pilot, INT_TYPE_DIFFICULTY_LEVEL);
				}
			}
		}

		if (difficulty == GAME_DIFFICULTY_EASY)
		{
			return (armour_thickness);
		}
	}

	////////////////////////////////////////
	//
	// get armour thickness
	//
	////////////////////////////////////////
	{
		float
			target_zvx,
			target_zvz,
			weapon_zvx,
			weapon_zvz,
			cos_theta,
			theta;

		matrix3x3
			*target_attitude,
			*weapon_attitude;

		target_attitude = get_local_entity_attitude_matrix_ptr (target);
		weapon_attitude = get_local_entity_attitude_matrix_ptr (weapon);

		target_zvx = (*target_attitude)[2][0];
		target_zvz = (*target_attitude)[2][2];
		weapon_zvx = -(*weapon_attitude)[2][0];
		weapon_zvz = -(*weapon_attitude)[2][2];

		cos_theta = (target_zvx * weapon_zvx) + (target_zvz * weapon_zvz);

		cos_theta = bound (cos_theta, -1.0, 1.0);

		theta = acos (cos_theta);

		if (theta <= rad (45.0))
		{
			armour_thickness = vehicle_database[sub_type].armour_front;
		}
		else if (theta <= rad (135.0))
		{
			armour_thickness = vehicle_database[sub_type].armour_side;
		}
		else
		{
			armour_thickness = vehicle_database[sub_type].armour_rear;
		}
	}

	return (armour_thickness);
}