Beispiel #1
0
static void update_indicator_lamps (void)
{
	entity
		*en;

	en = get_gunship_entity ();

	blackhawk_lamps.indicator_lamp_1 = get_current_flight_dynamics_rotor_brake ();

	blackhawk_lamps.indicator_lamp_2 = get_current_flight_dynamics_overtorque ();

	blackhawk_lamps.indicator_lamp_3 = get_current_flight_dynamics_low_rotor_rpm ();

	blackhawk_lamps.indicator_lamp_4 = get_current_flight_dynamics_wheel_brake ();

	blackhawk_lamps.indicator_lamp_5 = get_current_flight_dynamics_auto_pilot ();

	blackhawk_lamps.indicator_lamp_6 = get_current_flight_dynamics_auto_hover ();

	blackhawk_lamps.indicator_lamp_7 = get_local_entity_int_value (en, INT_TYPE_RADAR_ON);

	blackhawk_lamps.indicator_lamp_8 = get_local_entity_int_value (en, INT_TYPE_RADAR_JAMMER_ON);

	blackhawk_lamps.indicator_lamp_9 = get_local_entity_int_value (en, INT_TYPE_INFRA_RED_JAMMER_ON);
}
Beispiel #2
0
int get_local_group_member_max_formation_position (entity *group)
{

	entity
		*member;

	int
		max_formation_position;

	max_formation_position = 0;

	member = get_local_entity_first_child (group, LIST_TYPE_MEMBER);

	while (member)
	{

		if (max_formation_position < get_local_entity_int_value (member, INT_TYPE_FORMATION_POSITION))
		{

			max_formation_position = get_local_entity_int_value (member, INT_TYPE_FORMATION_POSITION);
		}

		member = get_local_entity_child_succ (member, LIST_TYPE_MEMBER);
	}

	return max_formation_position;
}
Beispiel #3
0
entity *get_group_at_road_node (int node)
{
	entity
		*force,
		*group;

	force = get_local_entity_first_child (get_session_entity (), LIST_TYPE_FORCE);

	while (force)
	{
		group = get_local_entity_first_child (force, LIST_TYPE_GROUND_REGISTRY);

		while (group)
		{
			if ((get_local_entity_int_value (group, INT_TYPE_ROUTE_NODE) == node) &&
				(get_local_entity_int_value (group, INT_TYPE_ALIVE)))
			{
				#if DEBUG_MODULE

				debug_log ("GP_MSGS: found retreat group %d side %s at node %d", group, entity_side_names [get_local_entity_int_value (group, INT_TYPE_SIDE)], node);

				#endif

				return group;
			}

			group = get_local_entity_child_succ (group, LIST_TYPE_GROUND_REGISTRY);
		}

		force = get_local_entity_child_succ (force, LIST_TYPE_FORCE);
	}

	return NULL;
}
Beispiel #4
0
int check_group_task_type_valid_members (entity *group, entity_sub_types task_type)
{
	entity
		*guide,
		*task;

	guide = get_local_entity_first_child (group, LIST_TYPE_GUIDE_STACK);

	while (guide)
	{
		if (get_local_entity_int_value (guide, INT_TYPE_VALID_GUIDE_MEMBERS) != TASK_ASSIGN_NO_MEMBERS)
		{
			task = get_local_entity_parent (guide, LIST_TYPE_GUIDE);

			if (get_local_entity_int_value (task, INT_TYPE_ENTITY_SUB_TYPE) == task_type)
			{
				return TRUE;
			}
		}

		guide = get_local_entity_child_succ (guide, LIST_TYPE_GUIDE_STACK);
	}

	return FALSE;
}
Beispiel #5
0
void free_group_callsign (entity *en)
{

	int
		side,
		index;

	if (get_comms_model () != COMMS_MODEL_SERVER)
	{

		return;
	}

	if (get_local_entity_int_value (en, INT_TYPE_AIRCRAFT_GROUP))
	{

		side = get_local_entity_int_value (en, INT_TYPE_SIDE);

		index = get_local_entity_int_value (en, INT_TYPE_GROUP_CALLSIGN);

		ASSERT (group_callsign_names [index].side [side] > 0);

		group_callsign_names [index].side [side] --;
	}
}
Beispiel #6
0
static void set_local_int_value (entity *en, int_types type, int value)
{
	fixed_wing
		*raw;

	#if DEBUG_MODULE

	debug_log_entity_args (ENTITY_DEBUG_LOCAL, ENTITY_DEBUG_INT_VALUE, en, type, value);

	#endif

	raw = get_local_entity_data (en);

	switch (type)
	{
		////////////////////////////////////////
		case INT_TYPE_OPERATIONAL_STATE:
		////////////////////////////////////////
		{
			int
				state1,
				state2;

			state1 = get_local_entity_int_value (en, INT_TYPE_MOBILE_MOVING);

			raw->ac.operational_state = value;

			state2 = get_local_entity_int_value (en, INT_TYPE_MOBILE_MOVING);

			if ((state1 == FALSE) && (state2 == TRUE))
			{
				//
				// wasn't moving, but is now
				//

				resume_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_ENGINE_LOOPING1);
			}
			else if ((state1 == TRUE) && (state2 == FALSE))
			{
				//
				// was moving, but isn't anymore
				//

				pause_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_ENGINE_LOOPING1, 0.5);

				pause_local_entity_sound_type (en, ENTITY_SUB_TYPE_EFFECT_SOUND_ENGINE_LOOPING2, 0.5);
			}

			break;
		}
		////////////////////////////////////////
		default:
		////////////////////////////////////////
		{
			debug_fatal_invalid_int_type (en, type);

			break;
		}
	}
}
Beispiel #7
0
void terminate_all_engage_tasks (entity *group)
{
	entity
		*guide,
		*task;

	ASSERT (group);

	ASSERT (get_comms_model () == COMMS_MODEL_SERVER);

	do
	{
		guide = get_local_entity_first_child (group, LIST_TYPE_GUIDE_STACK);

		while (guide)
		{
			if (get_local_entity_int_value (guide, INT_TYPE_VALID_GUIDE_MEMBERS) == 0)
			{
				task = get_local_entity_parent (guide, LIST_TYPE_GUIDE);

				ASSERT (get_local_entity_int_value (task, INT_TYPE_ENTITY_SUB_TYPE) == ENTITY_SUB_TYPE_TASK_ENGAGE);

				if (get_local_entity_int_value (task, INT_TYPE_TASK_TERMINATED) == TASK_TERMINATED_IN_PROGRESS)
				{
					notify_local_entity (ENTITY_MESSAGE_TASK_TERMINATED, task, group, TASK_TERMINATED_ABORTED);

					break;
				}
			}

			guide = get_local_entity_child_succ (guide, LIST_TYPE_GUIDE_STACK);
		}
	}
	while (guide);
}
Beispiel #8
0
void engage_specific_targets(entity *wingman, entity *targets[])
{
	entity
		*group;

	unsigned int valid_members = 0, member_number, i;

	ASSERT(get_local_entity_int_value (wingman, INT_TYPE_PLAYER) == ENTITY_PLAYER_AI);

	group = get_local_entity_parent(wingman, LIST_TYPE_MEMBER);
	
	if (!get_local_entity_int_value (group, INT_TYPE_ENGAGE_ENEMY))
		return;

	member_number = get_local_entity_int_value(wingman, INT_TYPE_GROUP_MEMBER_NUMBER);
	valid_members = (1 << member_number);
	
	for (i = 0; i < 16; i++)
	{
		entity* target = targets[i];
		if (!target)
			break;

		engage_specific_target(group, target, valid_members, FALSE);
	}
}
Beispiel #9
0
static int response_to_waypoint_lower_undercarriage_action (entity_messages message, entity *receiver, entity *sender, va_list pargs)
{

	#if DEBUG_MODULE

	debug_log_entity_message (message, receiver, sender, pargs);

	#endif

	if (get_comms_model () == COMMS_MODEL_SERVER)
	{
		if (
				(get_local_entity_int_value (receiver, INT_TYPE_PLAYER) == ENTITY_PLAYER_AI) ||
				(get_local_entity_int_value (receiver, INT_TYPE_AUTO_PILOT))
			)
		{
			lower_client_server_entity_undercarriage (receiver);
		}
	}

	/////////////////////////////////////////////////////////////////
	//
	//
	/////////////////////////////////////////////////////////////////

	return (TRUE);
}
Beispiel #10
0
void play_entity_weapon_low_speech (entity *en, entity_sub_types weapon_type)
{
	int
		speech_index;

	//
	// only play speech for players
	//

	speech_index = weapon_database [weapon_type].weapon_low_cpg_speech;

	if (speech_index != -1)
	{
		if (get_local_entity_int_value (en, INT_TYPE_PLAYER) != ENTITY_PLAYER_AI)
		{
			if (!get_local_entity_int_value (get_session_entity (), INT_TYPE_INFINITE_WEAPONS))
			{
				play_client_server_cpg_message
				(
					en,
					1.0,
					5.0,
					SPEECH_CATEGORY_AMMO_LOW,
					-1.0,
					speech_index
				);
			}
		}
	}
}
Beispiel #11
0
void animate_person (entity *en)
{
	person
		*raw;
	
	int
		state;
			
	float
		scale,
		remainder,
		position;
	
	ASSERT (en);
	
	raw = (person *) get_local_entity_data (en);

	if (get_local_entity_int_value (en, INT_TYPE_ALIVE))
	{
		if (get_local_entity_int_value (en, INT_TYPE_OBJECT_DRAWN_ONCE_THIS_FRAME))
		{
			return;
		}
	
		get_keyframed_animation_state (raw->person_animation_state, &state, &remainder);
	
		scale = (person_animation_database[state].end - person_animation_database[state].start);
					
		position = (remainder * scale + person_animation_database[state].start) / PERSON_ANIMATION_TOTAL_LENGTH;
					
		#ifdef DEBUG_PERSON_ANIMATION
	
		if (en == get_external_view_entity ())
		{
			debug_log ("frame :%f", (position * PERSON_ANIMATION_TOTAL_LENGTH));
		}
	
		#endif
	
		animate_entity_simple_keyframed_sub_objects (raw->vh.inst3d, OBJECT_3D_SUB_OBJECT_TROOP_TORSO, position);
	
		animate_entity_simple_keyframed_sub_objects (raw->vh.inst3d, OBJECT_3D_SUB_OBJECT_TROOP_ARM, position);
	
		animate_entity_simple_keyframed_sub_objects (raw->vh.inst3d, OBJECT_3D_SUB_OBJECT_TROOP_HEAD, position);
	
		animate_entity_simple_keyframed_sub_objects (raw->vh.inst3d, OBJECT_3D_SUB_OBJECT_TROOP_LEG, position);
	}
	else
	{
		animate_entity_simple_keyframed_sub_objects (raw->vh.inst3d, OBJECT_3D_SUB_OBJECT_TROOP_TORSO, raw->person_animation_state);
	
		animate_entity_simple_keyframed_sub_objects (raw->vh.inst3d, OBJECT_3D_SUB_OBJECT_TROOP_ARM, raw->person_animation_state);
	
		animate_entity_simple_keyframed_sub_objects (raw->vh.inst3d, OBJECT_3D_SUB_OBJECT_TROOP_HEAD, raw->person_animation_state);
	
		animate_entity_simple_keyframed_sub_objects (raw->vh.inst3d, OBJECT_3D_SUB_OBJECT_TROOP_LEG, raw->person_animation_state);
	}

}
Beispiel #12
0
void initialise_attack_guide (entity *en)
{
	entity
		*task,
		*aggressor,
		*target;

	ASSERT (en);

	task = get_local_entity_parent (en, LIST_TYPE_GUIDE);

	ASSERT (task);

	ASSERT (get_local_entity_int_value (task, INT_TYPE_ENTITY_SUB_TYPE) == ENTITY_SUB_TYPE_TASK_ENGAGE);

	aggressor = get_local_entity_ptr_value (en, PTR_TYPE_TASK_LEADER);

	ASSERT (aggressor);

	target = get_local_entity_parent (task, LIST_TYPE_TASK_DEPENDENT);

	ASSERT (target);

	if (!get_local_entity_int_value (aggressor, INT_TYPE_IDENTIFY_AIRCRAFT))
	{
		//
		// Surface-Air & Surface-Surface
		//

		entity_sub_types
			best_weapon;

		//
		// find best weapon for target
		//

		best_weapon = get_best_weapon_for_target (aggressor, target, BEST_WEAPON_CRITERIA_ALL);
	
		set_client_server_entity_int_value (aggressor, INT_TYPE_SELECTED_WEAPON, best_weapon);

		return;
	}

	//
	// Air-Air & Air-Surface
	//

	if (get_local_entity_int_value (target, INT_TYPE_AIRBORNE_AIRCRAFT))
	{			
		initialise_air_to_air_attack_guide (en, aggressor, target);
	}
	else
	{
		initialise_air_to_ground_attack_guide (en, aggressor, target);
	}
}
Beispiel #13
0
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);
}
Beispiel #14
0
int get_comanche_stub_wings_attached (entity *en)
{
    weapon_package_status
    *package_status;

    weapon_config_types
    config_type;

    int
    package;

    ASSERT (en);

    if (get_local_entity_int_value (en, INT_TYPE_ENTITY_SUB_TYPE) != ENTITY_SUB_TYPE_AIRCRAFT_RAH66_COMANCHE)
    {
        return (FALSE);
    }

    //
    // search packages for stub wings (include empty and damaged weapons)
    //

    package_status = (weapon_package_status *) get_local_entity_ptr_value (en, PTR_TYPE_WEAPON_PACKAGE_STATUS_ARRAY);

    if (package_status)
    {
        config_type = (weapon_config_types) get_local_entity_int_value (en, INT_TYPE_WEAPON_CONFIG_TYPE);

        ASSERT (weapon_config_type_valid (config_type));

        for (package = 0; package < NUM_WEAPON_PACKAGES; package++)
        {
            if (weapon_config_database[config_type][package].sub_type == ENTITY_SUB_TYPE_WEAPON_NO_WEAPON)
            {
                break;
            }

            if
            (
                (weapon_config_database[config_type][package].heading_depth == COMANCHE_LHS_STUB_WING) ||
                (weapon_config_database[config_type][package].heading_depth == COMANCHE_RHS_STUB_WING)
            )
            {
                return (TRUE);
            }
        }
    }

    return (FALSE);
}
Beispiel #15
0
void play_building_destroyed_speech (entity *building, entity *aggressor)
{
	int
		val,
		array_type,
		speech_index;

	entity_sides
		aggressor_side;

	ASSERT (aggressor);

	if (get_local_entity_int_value (aggressor, INT_TYPE_IDENTIFY_AIRCRAFT))
	{
		// PLAY_SPEECH (WINGMAN/CPG)
		//
		// (There goes the neighbourhood) | (meeting adjourned) etc.

		aggressor_side = (entity_sides) get_local_entity_int_value (aggressor, INT_TYPE_SIDE);
		
		val = get_speech_random_value
				(
					building_destroyed_cpg_comments,
					num_building_destroyed_cpg_comments [aggressor_side],
					last_building_destroyed_cpg_comment [aggressor_side]
				);

		array_type = building_destroyed_cpg_comments [val].array_type;
		speech_index = building_destroyed_cpg_comments [val].speech_index;

		if (get_local_entity_int_value (aggressor, INT_TYPE_PLAYER) != ENTITY_PLAYER_AI)
		{
			play_client_server_cpg_message (aggressor, 0.4, 4.0, SPEECH_CATEGORY_DESTROYED_TARGETS, 18.0, speech_index);
		}
		else
		{
			play_client_server_wingman_message
			(
				aggressor,
				0.4,
				4.0,
				SPEECH_CATEGORY_DESTROYED_TARGETS, 18.0,
				SPEECH_INTRODUCTION_SOMETIMES,
				SPEECH_ARRAY_WINGMAN_MESSAGES, SPEECH_WINGMAN_TARGET_DESTROYED
			);
		}
	}
}
Beispiel #16
0
void play_entity_weapon_launched_speech (entity *en, entity_sub_types weapon_type)
{
	int
		speech_index;

	//
	// only play speech for players
	//

	speech_index = weapon_database [weapon_type].weapon_launched_cpg_speech;

	if (speech_index != -1)
	{
		if (get_local_entity_int_value (en, INT_TYPE_PLAYER) != ENTITY_PLAYER_AI)
		{
			play_client_server_cpg_message
			(
				en,
				0.8,
				2.0,
				SPEECH_CATEGORY_FIRING,
				8.0,
				speech_index
			);
		}
	}
}
Beispiel #17
0
void damage_routed_vehicle_3d_object (entity *en)
{
	routed_vehicle
		*raw;

	ASSERT (en);

	raw = (routed_vehicle *) get_local_entity_data (en);

	//
	// destruct old object
	//

	destruct_3d_object (raw->vh.inst3d);

	//
	// construct new (damaged) object
	//

	raw->vh.object_3d_shape = get_local_entity_int_value (en, INT_TYPE_DESTROYED_3D_SHAPE);

	raw->vh.inst3d = construct_3d_object (raw->vh.object_3d_shape);

	//
	// set id number for new object
	//

	set_routed_vehicle_id_number (en);
}
Beispiel #18
0
int object_internal_lighting_valid (entity *en)
{
	day_segment_types
		day_segment_type;

	if (get_local_entity_int_value (en, INT_TYPE_PLAYER) != ENTITY_PLAYER_AI)
	{
		return (get_local_entity_int_value (en, INT_TYPE_LIGHTS_ON));
	}
	else
	{
		day_segment_type = get_local_entity_int_value (get_session_entity (), INT_TYPE_DAY_SEGMENT_TYPE);

		return ((day_segment_type == DAY_SEGMENT_TYPE_NIGHT) || (day_segment_type == DAY_SEGMENT_TYPE_DUSK));
	}
}
Beispiel #19
0
void process_entity_smoke_list_creation (void)
{
	
	comms_entity_smoke_list_creation_type
		*this_smoke_list_creation;

	while (entity_smoke_list_creation)
	{

		this_smoke_list_creation = entity_smoke_list_creation;

		ASSERT (this_smoke_list_creation->en);

		attach_local_meta_smoke_lists_to_object (this_smoke_list_creation->en,
																this_smoke_list_creation->meta_smoke_type,
																this_smoke_list_creation->attachment_point,
																this_smoke_list_creation->entity_index_list);

		if (get_local_entity_int_value (this_smoke_list_creation->en, INT_TYPE_MOBILE_MOVING))
		{

			set_infinite_smoke_list_generating_state (this_smoke_list_creation->en, ENTITY_SUB_TYPE_EFFECT_SMOKE_LIST_VEHICLE_WAKE, INFINITE_SMOKE_ON);
		}
		else
		{
			set_infinite_smoke_list_generating_state (this_smoke_list_creation->en, ENTITY_SUB_TYPE_EFFECT_SMOKE_LIST_VEHICLE_WAKE, INFINITE_SMOKE_OFF);
		}

		free_mem (this_smoke_list_creation);

		entity_smoke_list_creation = entity_smoke_list_creation->next;
	}
}
Beispiel #20
0
static float get_canopy_doors_aiming_state (void)
{
	float
		aiming_state;

	ASSERT (get_gunship_entity ());

	ASSERT (current_flight_dynamics);

	if (get_local_entity_int_value (get_gunship_entity (), INT_TYPE_AIRBORNE_AIRCRAFT))
	{
		aiming_state = CANOPY_DOOR_STATE_CLOSED;
	}
	else
	{
		if (current_flight_dynamics->rotor_brake)
		{
			aiming_state = CANOPY_DOOR_STATE_OPEN;
		}
		else
		{
			aiming_state = CANOPY_DOOR_STATE_CLOSED;
		}
	}

	return (aiming_state);
}
Beispiel #21
0
void set_next_waypoint (void)
{
	entity
		*guide;

	//
	// Can only change your current waypoint if you have a gunship, and you are leader of your current task
	//

	if (!get_gunship_entity ())
	{
		return;
	}

	if (!get_local_entity_int_value (get_gunship_entity (), INT_TYPE_TASK_LEADER))
	{
		return;
	}

	guide = get_local_entity_parent (get_gunship_entity (), LIST_TYPE_FOLLOWER);

	if (!guide)
	{
		return;
	}

	set_guide_next_waypoint (guide);
}
Beispiel #22
0
int check_group_task_type (entity *group, entity_sub_types task_type)
{

	entity
		*guide,
		*task;

	guide = get_local_entity_first_child (group, LIST_TYPE_GUIDE_STACK);

	while (guide)
	{

		task = get_local_entity_parent (guide, LIST_TYPE_GUIDE);

		if (get_local_entity_int_value (task, INT_TYPE_ENTITY_SUB_TYPE) == task_type)
		{

			return TRUE;
		}

		guide = get_local_entity_child_succ (guide, LIST_TYPE_GUIDE_STACK);
	}

	return FALSE;
}
Beispiel #23
0
entity *get_local_force_entity (entity_sides side)
{

	entity
		*force;

	if (!get_session_entity ())
	{

		return NULL;
	}

	force = get_local_entity_first_child (get_session_entity (), LIST_TYPE_FORCE);

	while (force)
	{

		debug_assert (get_local_entity_type (force) == ENTITY_TYPE_FORCE);

		if (get_local_entity_int_value (force, INT_TYPE_SIDE) == side)
		{

			return force;
		}

		force = get_local_entity_child_succ (force, LIST_TYPE_FORCE);
	}

	return NULL;
}
Beispiel #24
0
void update_weapon_load_shared_mem ()
{
	weapon_package_status
		*package_status;

	unsigned next_free = 0;

	if (!gPtrSharedMemory || !get_gunship_entity())
		return;

	package_status = (weapon_package_status *) get_local_entity_ptr_value(get_gunship_entity(), PTR_TYPE_WEAPON_PACKAGE_STATUS_ARRAY);

	if (package_status)
	{
		int package;
		weapon_config_types config_type = (weapon_config_types) get_local_entity_int_value (get_gunship_entity(), INT_TYPE_WEAPON_CONFIG_TYPE);

		for (package = 0; package < MAX_WEAPON_LOAD_DATA; package++)
		{
			entity_sub_types weapon_type;
			int number;

			weapon_type = weapon_config_database[config_type][package].sub_type;
			number = package_status[package].number;

			gPtrSharedMemory->weapon_load[next_free].weapon_type = weapon_type;
			gPtrSharedMemory->weapon_load[next_free].weapon_count = number;
			next_free++;
		}
	}
	else
		memset(gPtrSharedMemory->weapon_load, 0, sizeof(gPtrSharedMemory->weapon_load));
}
Beispiel #25
0
void set_kiowa_weapon_damage_status (void)
{
	entity
		*en;

	entity_sub_types
		weapon_sub_type;

	en = get_gunship_entity ();

	set_client_server_entity_weapon_damage (en, KIOWA_LHS_PYLON, ENTITY_SUB_TYPE_WEAPON_NO_WEAPON, kiowa_damage.lh_pylon);
	set_client_server_entity_weapon_damage (en, KIOWA_RHS_PYLON, ENTITY_SUB_TYPE_WEAPON_NO_WEAPON, kiowa_damage.rh_pylon);
	set_client_server_entity_weapon_damage (en, KIOWA_CHAFF_DISPENSER, ENTITY_SUB_TYPE_WEAPON_CHAFF, kiowa_damage.chaff_dispenser);
	set_client_server_entity_weapon_damage (en, KIOWA_FLARE_DISPENSER, ENTITY_SUB_TYPE_WEAPON_FLARE, kiowa_damage.flare_dispenser);

	//
	// check if selected weapon is still available, if not, select next
	//

	weapon_sub_type = get_local_entity_int_value (en, INT_TYPE_SELECTED_WEAPON);

	if (weapon_sub_type != ENTITY_SUB_TYPE_WEAPON_NO_WEAPON)
	{
		if (!get_local_entity_weapon_available (en, weapon_sub_type))
		{
			weapon_sub_type = get_next_available_weapon_sub_type (en);

			set_gunship_weapon (weapon_sub_type);
		}
	}
}
Beispiel #26
0
int get_current_virtual_cockpit_camera (crew_roles role)
{
	int
		current_virtual_cockpit_camera;

	if (get_local_entity_int_value (get_gunship_entity (), INT_TYPE_EJECTED))
	{
		if (role == CREW_ROLE_PILOT)
		{
			ASSERT (get_number_of_3d_object_cameras (virtual_cockpit_inst3d, OBJECT_3D_CAMERA_VIEW_STATIC_PILOT_EJECT) > 0);

			current_virtual_cockpit_camera = 0;
		}
		else
		{
			ASSERT (get_number_of_3d_object_cameras (virtual_cockpit_inst3d, OBJECT_3D_CAMERA_VIEW_STATIC_WSO_EJECT) > 0);

			current_virtual_cockpit_camera = 0;
		}
	}
	else
	{
		if (role == CREW_ROLE_PILOT)
		{
			current_virtual_cockpit_camera = current_pilot_virtual_cockpit_camera;
		}
		else
		{
			current_virtual_cockpit_camera = current_co_pilot_virtual_cockpit_camera;
		}
	}

	return (current_virtual_cockpit_camera);
}
Beispiel #27
0
object_3d_camera_index_numbers get_crew_camera_index (crew_roles role)
{
	object_3d_camera_index_numbers
		crew_camera_index;

	if (get_local_entity_int_value (get_gunship_entity (), INT_TYPE_EJECTED))
	{
		if (role == CREW_ROLE_PILOT)
		{
			crew_camera_index = OBJECT_3D_CAMERA_VIEW_STATIC_PILOT_EJECT;
		}
		else
		{
			crew_camera_index = OBJECT_3D_CAMERA_VIEW_STATIC_WSO_EJECT;
		}
	}
	else
	{
		if (role == CREW_ROLE_PILOT)
		{
			crew_camera_index = OBJECT_3D_CAMERA_VIEW_STATIC_PILOT;
		}
		else
		{
			crew_camera_index = OBJECT_3D_CAMERA_VIEW_STATIC_WSO;
		}
	}

	return (crew_camera_index);
}
Beispiel #28
0
void add_to_force_info (entity *force_en, entity *new_en)
{

	force
		*raw;

	int
		index;

	if (!force_en)
	{

		return;
	}

	if (!get_force_hardware_update ())
	{

		return;
	}
		
	raw = (force *) get_local_entity_data (force_en);

	index = get_local_entity_int_value (new_en, INT_TYPE_FORCE_INFO_CATAGORY);

	raw->force_info_current_hardware [index] ++;

	if (get_game_status () == GAME_STATUS_INITIALISED)
	{

		raw->force_info_reserve_hardware [index] --;
	}
}
Beispiel #29
0
static int response_to_collision (entity_messages message, entity *receiver, entity *sender, va_list pargs)
{
	int
		total_damage_level;

	float
		damage_modifier;

	#if DEBUG_MODULE >= 2

	debug_log_entity_message (message, receiver, sender, pargs);

	#endif

	damage_modifier = va_arg (pargs, double);

	damage_client_server_entity (receiver, sender, damage_modifier);

	total_damage_level = get_local_entity_int_value (receiver, INT_TYPE_DAMAGE_LEVEL);

	if (total_damage_level <= 0)
	{
		kill_client_server_entity (receiver);
	}

	return (TRUE);
}
Beispiel #30
0
void add_mobile_to_force_losses_stats (entity *en, entity *victim)
{
	force
		*raw;

	int
		sub_type;

	entity
		*group;

	ASSERT (en);

	ASSERT (victim);

	raw = (force *) get_local_entity_data (en);

	group = get_local_entity_parent (victim, LIST_TYPE_MEMBER);

	ASSERT (group);

	sub_type = get_local_entity_int_value (group, INT_TYPE_ENTITY_SUB_TYPE);

	raw->losses [sub_type] ++;
}