コード例 #1
0
ファイル: ss_pack.c プロジェクト: Comanche93/eech
static void pack_local_data (entity *en, pack_modes mode)
{
   ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES));

   switch (mode)
   {
      ////////////////////////////////////////
      case PACK_MODE_SERVER_SESSION:
      case PACK_MODE_CLIENT_SESSION:
      case PACK_MODE_BROWSE_SESSION:
      ////////////////////////////////////////
		{

			break;
		}

      ////////////////////////////////////////
      case PACK_MODE_UPDATE_ENTITY:
      ////////////////////////////////////////
      {
         session
            *raw;

         raw = (session *) get_local_entity_data (en);

         pack_float_value (en, FLOAT_TYPE_ELAPSED_TIME, raw->elapsed_time);

         pack_float_value (en, FLOAT_TYPE_LIGHTNING_TIMER, raw->lightning_timer);

			//
			// rain effect
			//

         pack_float_value (en, FLOAT_TYPE_WEATHER_RADIUS, raw->weather_radius);

			pack_vec3d (en, VEC3D_TYPE_WEATHER_POSITION, &raw->weather_position);
			pack_vec3d (en, VEC3D_TYPE_WEATHER_VELOCITY, &raw->weather_velocity);

			//
			// wind effect
			//

         pack_float_value (en, FLOAT_TYPE_WIND_EFFECT_RADIUS, raw->wind_effect_radius);
         pack_float_value (en, FLOAT_TYPE_WIND_GUSTING_VALUE, raw->wind_gusting_value);

			pack_vec3d (en, VEC3D_TYPE_WIND_DIRECTION_VECTOR, &raw->wind_direction_vector);
			pack_vec3d (en, VEC3D_TYPE_WIND_EFFECT_POSITION, &raw->wind_effect_position);
			pack_vec3d (en, VEC3D_TYPE_WIND_EFFECT_VELOCITY, &raw->wind_effect_velocity);

			//

         pack_int_value (en, INT_TYPE_WEATHER_INCREASING, raw->weather_increasing);

         pack_int_value (en, INT_TYPE_WIND_INCREASING, raw->wind_increasing);

         break;
      }
   }
}
コード例 #2
0
ファイル: se_pack.c プロジェクト: DexterWard/comanche
void pack_local_only_sound_effect_data (entity *en, pack_modes mode)
{
	sound_effect
		*raw;

	ASSERT (en);

	raw = get_local_entity_data (en);

	//
	// check properties
	//

	ASSERT (raw->looping); 

	ASSERT (raw->sound_effect_sequence_count == 1);

	//
	// pack data
	//

	if (mode == PACK_MODE_CLIENT_SESSION)
	{
		pack_entity_safe_ptr (en);
	}

	pack_int_value (en, INT_TYPE_SIDE, raw->side);

	pack_int_value (en, INT_TYPE_ENTITY_SUB_TYPE, raw->eff.sub_type);

	pack_int_value (en, INT_TYPE_VALID_SOUND_EFFECT, raw->valid_sound_effect);

	pack_int_value (en, INT_TYPE_SOUND_EFFECT_INDEX, raw->effect_index [0]);

	#if DEBUG_MODULE

	debug_log ("SE_PACK: Packed Local-Only %d - Sub-type %d", get_local_entity_safe_index (en), raw->eff.sub_type);

	#endif
}
コード例 #3
0
ファイル: division.c プロジェクト: Comanche93/eech
void pack_local_division_database (pack_modes mode)
{
	int
		side,
		type,
		loop,
		count,
		valid;

	if (mode == PACK_MODE_SERVER_SESSION)
	{
		for (side = 0; side < NUM_ENTITY_SIDES; side ++)
		{
			for (type = 0; type < NUM_ENTITY_SUB_TYPE_DIVISIONS; type ++)
			{
				valid = division_id_database [side][type].valid;
	
				pack_int_value (NULL, INT_TYPE_VALID, valid);
	
				if (valid)
				{
					count = division_id_database [side][type].count;
					
					ASSERT(count > 0);			
	
					pack_int_value (NULL, INT_TYPE_COUNT, count);
	
					pack_int_value (NULL, INT_TYPE_COUNT, division_id_database [side][type].next);
	
					for (loop = 0; loop < count; loop ++)
					{
						pack_int_value (NULL, INT_TYPE_COUNT, division_id_database [side][type].number_list [loop]);
					}
				}
			}
		}
	}
}
コード例 #4
0
ファイル: se_pack.c プロジェクト: DexterWard/comanche
static void pack_local_data (entity *en, pack_modes mode)
{
	ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES));

	switch (mode)
	{
		////////////////////////////////////////
		case PACK_MODE_SERVER_SESSION:
		case PACK_MODE_CLIENT_SESSION:
		////////////////////////////////////////
		{
			sound_effect
				*raw;

			int
				loop;

			raw = get_local_entity_data (en);

			if (effect_database [raw->eff.sub_type].constructed_locally)
			{
				return;
			}

			if (mode == PACK_MODE_SERVER_SESSION)
			{
	
				if (get_local_entity_type (raw->eff.special_effect_link.parent) == ENTITY_TYPE_SESSION)
				{
	
					return;
				}
			}

			pack_entity_type (get_local_entity_type (en));

			pack_entity_safe_ptr (en);

			//
			// pack effect data
			//

			pack_effect_data (en, &raw->eff, mode);

			//
			// pack sound effect data
			//

			pack_int_value (en, INT_TYPE_SOUND_EFFECT_SEQUENCE_COUNT, raw->sound_effect_sequence_count);

			for (loop = 0; loop < raw->sound_effect_sequence_count; loop ++)
			{
				pack_int_value (en, INT_TYPE_SOUND_EFFECT_INDEX, raw->effect_index [loop]);
			}

			pack_float_value (en, FLOAT_TYPE_AMPLIFICATION, raw->amplification);

			pack_float_value (en, FLOAT_TYPE_EFFECT_LIFETIME, raw->effect_lifetime);

			pack_float_value (en, FLOAT_TYPE_VALID_EFFECT_LIFETIME, raw->valid_effect_lifetime);

			// sound_effect_data

			pack_int_value (en, INT_TYPE_SOUND_CHANNEL, raw->sound_channel);

			pack_int_value (en, INT_TYPE_SOUND_LOCALITY, raw->sound_locality);

			pack_int_value (en, INT_TYPE_VALID_SOUND_EFFECT, raw->valid_sound_effect);

			pack_int_value (en, INT_TYPE_SOUND_EFFECT_LOOPING, raw->looping);

			pack_int_value (en, INT_TYPE_SOUND_EFFECT_PANNING, raw->panning);

			if (get_local_entity_parent (en, LIST_TYPE_UPDATE))
			{
				pack_int_value (en, INT_TYPE_VALID, TRUE);
			}
			else
			{
				pack_int_value (en, INT_TYPE_VALID, FALSE);
			}

			#if DEBUG_MODULE

			debug_log ("SE_PACK: Packed %d - Sub-type %d", get_local_entity_safe_index (en), raw->eff.sub_type);

			#endif

			break;
		}
		////////////////////////////////////////
		case PACK_MODE_BROWSE_SESSION:
		////////////////////////////////////////
		{
			break;
		}
		////////////////////////////////////////
		case PACK_MODE_UPDATE_ENTITY:
		////////////////////////////////////////
		{
			break;
		}
	}
}
コード例 #5
0
ファイル: rv_pack.c プロジェクト: Comanche93/eech
static void pack_local_data (entity *en, pack_modes mode)
{
	ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES));

	switch (mode)
	{
		////////////////////////////////////////
		case PACK_MODE_SERVER_SESSION:
		case PACK_MODE_CLIENT_SESSION:
		////////////////////////////////////////
		{
			routed_vehicle
				*raw;

			raw = (routed_vehicle *) get_local_entity_data (en);

			pack_entity_type (get_local_entity_type (en));

			pack_entity_safe_ptr (en);

			//
			// pack vehicle data
			//

			pack_vehicle_data (en, &raw->vh, mode);

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

			if ((raw->vh.mob.velocity == 0.0) && (raw->desired_velocity == 0.0))
			{

				pack_int_value (en, INT_TYPE_VALID, TRUE);
			}
			else
			{
				
				pack_int_value (en, INT_TYPE_VALID, FALSE);

				pack_float_value (en, FLOAT_TYPE_LOW_VELOCITY, raw->vh.mob.velocity);

				pack_float_value (en, FLOAT_TYPE_DESIRED_VELOCITY, raw->desired_velocity);
			}

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

			//
			// pack routed data
			//

			/////////////////////////////////////////////////////////////////
			if ((raw->sub_waypoint_count == 0) && (raw->waypoint_next_index == 0) && (raw->waypoint_this_index == 0))
			{

				pack_int_value (en, INT_TYPE_VALID, FALSE);
			}
			else
			{

				pack_int_value (en, INT_TYPE_VALID, TRUE);
	
				pack_int_value (en, INT_TYPE_SUB_WAYPOINT_COUNT, raw->sub_waypoint_count);
	
				pack_int_value (en, INT_TYPE_WAYPOINT_NEXT_INDEX, raw->waypoint_next_index);
	
				pack_int_value (en, INT_TYPE_WAYPOINT_THIS_INDEX, raw->waypoint_this_index);
			}
			/////////////////////////////////////////////////////////////////

			// sub_waypoint_list reconstructed locally

			//
			// spin through special effects link and pack up local only smoke trails
			//

			pack_routed_vehicle_meta_smoke_lists (en, mode);

			pack_mobile_local_sound_effects (en, mode);

			break;
		}
		////////////////////////////////////////
		case PACK_MODE_BROWSE_SESSION:
		////////////////////////////////////////
		{

			break;
		}
		////////////////////////////////////////
		case PACK_MODE_UPDATE_ENTITY:
		////////////////////////////////////////
		{

			routed_vehicle
				*raw;

			raw = (routed_vehicle *) get_local_entity_data (en);

			pack_vec3d (en, VEC3D_TYPE_POSITION, &raw->vh.mob.position);

			pack_attitude_matrix (en, raw->vh.mob.attitude);

			pack_int_value (en, INT_TYPE_SUB_WAYPOINT_COUNT, raw->sub_waypoint_count);

			break;
		}
	}
}
コード例 #6
0
ファイル: fx_pack.c プロジェクト: Comanche93/eech
void pack_fixed_data (entity *en, fixed *raw, pack_modes mode)
{
	ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES));

	switch (mode)
	{
		////////////////////////////////////////
		case PACK_MODE_SERVER_SESSION:
		case PACK_MODE_CLIENT_SESSION:
		////////////////////////////////////////
		{
			pack_vec3d (en, VEC3D_TYPE_POSITION, &raw->position);

			/////////////////////////////////////////////////////////////////
			if (mode == PACK_MODE_SERVER_SESSION)
			{

				if (raw->task_dependent_root.first_child)
				{

					pack_int_value (en, INT_TYPE_VALID, TRUE);

					pack_list_root (en, LIST_TYPE_TASK_DEPENDENT, &raw->task_dependent_root);
				}
				else
				{

					pack_int_value (en, INT_TYPE_VALID, FALSE);
				}
			}
			/////////////////////////////////////////////////////////////////

			/////////////////////////////////////////////////////////////////
			if (raw->target_root.first_child)
			{

				pack_int_value (en, INT_TYPE_VALID, TRUE);

				pack_list_root (en, LIST_TYPE_TARGET, &raw->target_root);
			}
			else
			{

				pack_int_value (en, INT_TYPE_VALID, FALSE);
			}
			/////////////////////////////////////////////////////////////////

			// gunship_target_link

			// sector_link

			pack_int_value (en, INT_TYPE_ENTITY_SUB_TYPE, raw->sub_type);

			pack_int_value (en, INT_TYPE_OBJECT_3D_SHAPE, raw->object_3d_shape);

			pack_int_value (en, INT_TYPE_ALIVE, raw->alive);

			pack_int_value (en, INT_TYPE_SIDE, raw->side);

			// gunship_radar_los_clear

			// object_drawn_once_this_frame

			pack_float_value (en, FLOAT_TYPE_HEADING, raw->heading);

			if (raw->heading == 0.0)
			{

				debug_log ("FX_PACK: heading = zero");
			}

			break;
		}
		////////////////////////////////////////
		case PACK_MODE_BROWSE_SESSION:
		////////////////////////////////////////
		{
			break;
		}
		////////////////////////////////////////
		case PACK_MODE_UPDATE_ENTITY:
		////////////////////////////////////////
		{
			//
			// cannot update entity at this level as the update may not apply to all entity types below
			//

			break;
		}
	}
}
コード例 #7
0
ファイル: su_pack.c プロジェクト: DexterWard/comanche
void pack_local_site_updatable_data (pack_modes mode)
{

	entity
		*en;

	site_updatable
		*raw;

	int
		pack_size,
		count,
		alive,
		total;

	if ((mode != PACK_MODE_SERVER_SESSION) && (mode != PACK_MODE_CLIENT_SESSION))
	{

		return;
	}

	debug_log ("RLE SITE UPDATEABLE");

	pack_size = 0;

	count = 0;

	alive = TRUE;

	total = 0;

	en = get_local_entity_list ();

	while (en)
	{

		if (get_local_entity_type (en) == ENTITY_TYPE_SITE_UPDATABLE)
		{

			total ++;

			raw = get_local_entity_data (en);

			if (alive == raw->fix.alive)
			{

				count ++;
			}
			else
			{

				pack_int_value (NULL, INT_TYPE_LENGTH, count);
				pack_size += NUM_LENGTH_BITS;

				pack_int_value (NULL, INT_TYPE_ALIVE, alive);
				pack_size += NUM_ALIVE_BITS;

				#if DEBUG_MODULE

				debug_log ("SU_PACK: packing count %d, alive %d", count, alive);

				#endif

				alive = raw->fix.alive;

				count = 1;
			}
		}

		en = get_local_entity_succ (en);
	}

	pack_int_value (NULL, INT_TYPE_LENGTH, count);
	pack_size += NUM_LENGTH_BITS;

	pack_int_value (NULL, INT_TYPE_ALIVE, alive);
	pack_size += NUM_ALIVE_BITS;

	#if DEBUG_MODULE

	debug_log ("SU_PACK: packing count %d, alive %d", count, alive);

	#endif

	//debug_log ("SU_PACK: packing %d entities took %d bytes (%d bits)", total, pack_size / 8, pack_size);
}
コード例 #8
0
ファイル: pi_pack.c プロジェクト: DexterWard/comanche
static void pack_local_data (entity *en, pack_modes mode)
{
   ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES));

   switch (mode)
   {
      ////////////////////////////////////////
      case PACK_MODE_SERVER_SESSION:
      ////////////////////////////////////////
		{
			break;
		}
      ////////////////////////////////////////
      case PACK_MODE_CLIENT_SESSION:
      ////////////////////////////////////////
      {
         pilot
            *raw;

         raw = get_local_entity_data (en);

         pack_entity_type (get_local_entity_type (en));

         pack_entity_safe_ptr (en);

         //
         // pack data
         //

         pack_int_value (en, INT_TYPE_ENTITY_SUB_TYPE, raw->sub_type);

         pack_string (en, STRING_TYPE_PILOTS_NAME, raw->pilots_name);

         pack_int_value (en, INT_TYPE_PILOT_RANK, raw->rank);

         pack_int_value (en, INT_TYPE_KILLS, raw->kills);

         pack_int_value (en, INT_TYPE_UNIQUE_ID, raw->unique_id);

			// crew_role

         pack_list_root (en, LIST_TYPE_PILOT_LOCK, &raw->pilot_lock_root);

         pack_list_link (en, LIST_TYPE_AIRCREW, &raw->aircrew_link);

         pack_list_link (en, LIST_TYPE_PILOT, &raw->pilot_link);

         pack_list_link (en, LIST_TYPE_PLAYER_TASK, &raw->player_task_link);

         pack_int_value (en, INT_TYPE_SIDE, raw->side);

			pack_int_value (en, INT_TYPE_DIFFICULTY_LEVEL, raw->difficulty_level);

         break;
      }
      ////////////////////////////////////////
      case PACK_MODE_BROWSE_SESSION:
      ////////////////////////////////////////
      {
         pilot
            *raw;

         raw = get_local_entity_data (en);

         pack_entity_type (get_local_entity_type (en));

         pack_entity_safe_ptr (en);

         //
         // pack data
         //

         pack_int_value (en, INT_TYPE_ENTITY_SUB_TYPE, raw->sub_type);

         pack_string (en, STRING_TYPE_PILOTS_NAME, raw->pilots_name);

         pack_int_value (en, INT_TYPE_PILOT_RANK, raw->rank);

         pack_int_value (en, INT_TYPE_KILLS, raw->kills);

         pack_int_value (en, INT_TYPE_UNIQUE_ID, raw->unique_id);

			// crew_role

			// aircrew_link

         pack_list_link (en, LIST_TYPE_PILOT, &raw->pilot_link);

         pack_int_value (en, INT_TYPE_SIDE, raw->side);

			// difficulty level

         break;
      }
      ////////////////////////////////////////
      case PACK_MODE_UPDATE_ENTITY:
      ////////////////////////////////////////
      {
         break;
      }
   }
}
コード例 #9
0
ファイル: br_pack.c プロジェクト: Comanche93/eech
void pack_local_bridge_data (pack_modes mode)
{
   entity
      *en;

   bridge
      *raw;

	int
		alive,
		count;

   ASSERT (mode != PACK_MODE_UPDATE_ENTITY);

   if (mode != PACK_MODE_SERVER_SESSION)
   {
      return;
   }

	//
	// RLE bridge alive flags
	//

	count = 0;

	alive = TRUE;

	debug_log ("RLE BRIDGE");

	en = get_local_entity_list ();

	while (en)
	{

		if (get_local_entity_type (en) == ENTITY_TYPE_BRIDGE)
		{

			raw = (bridge *) get_local_entity_data (en);

			if (alive == raw->alive)
			{
				count ++;
			}
			else
			{

				pack_int_value (NULL, INT_TYPE_LENGTH, count);

				pack_int_value (NULL, INT_TYPE_ALIVE, alive);

				#if DEBUG_MODULE

				debug_log ("BR_PACK: packing count %d, alive %d", count, alive);

				#endif

				alive = raw->alive;

				count = 1;
			}
		}
	
		en = get_local_entity_succ (en);
	}

	pack_int_value (NULL, INT_TYPE_LENGTH, count);

	pack_int_value (NULL, INT_TYPE_ALIVE, alive);

	#if DEBUG_MODULE

	debug_log ("BR_PACK: packing count %d, alive %d", count, alive);

	#endif
}
コード例 #10
0
ファイル: sc_pack.c プロジェクト: DexterWard/comanche
void pack_local_sector_data (pack_modes mode)
{
	entity
		*en;

	sector
		*raw;

	entity_sides
		current_side;

	int
		sector_pack_size,
		side_count,
		x_sec,
		z_sec,
		total_side_count;

	ASSERT (mode != PACK_MODE_UPDATE_ENTITY);

	if (mode == PACK_MODE_BROWSE_SESSION)
	{
		return;
	}

	//
	// RLE encode the sector sides
	//

	debug_log ("RLE SECTOR");

	sector_pack_size = 0;

	en = get_local_raw_sector_entity (0, 0);

	raw = get_local_entity_data (en);

	pack_int_value (NULL, INT_TYPE_SIDE, raw->side);

	sector_pack_size += NUM_SIDE_BITS;

	current_side = raw->side;

	side_count = 0;

	total_side_count = 0;

	for (z_sec = MIN_MAP_Z_SECTOR; z_sec <= MAX_MAP_Z_SECTOR; z_sec++)
	{

		for (x_sec = MIN_MAP_X_SECTOR; x_sec <= MAX_MAP_X_SECTOR; x_sec++)
		{

			en = get_local_raw_sector_entity(x_sec, z_sec);

			raw = get_local_entity_data (en);

			if (current_side != raw->side)
			{

				current_side = raw->side;

				pack_int_value (NULL, INT_TYPE_LENGTH, side_count);

				#if DEBUG_MODULE

				debug_log ("SC_PACK : packed %d sectors for %s", side_count, entity_side_names [current_side]);

				#endif

				total_side_count += side_count;

				sector_pack_size += NUM_LENGTH_BITS;

				pack_int_value (NULL, INT_TYPE_SIDE, raw->side);

				sector_pack_size += NUM_SIDE_BITS;

				side_count = 1;
			}
			else
			{

				side_count ++;
			}
		}
	}

	pack_int_value (NULL, INT_TYPE_LENGTH, side_count);

	#if DEBUG_MODULE

	debug_log ("SC_PACK : packed %d sectors for %s", side_count, entity_side_names [current_side]);

	#endif

	total_side_count += side_count;

	sector_pack_size += NUM_LENGTH_BITS;

	//
	// Termination
	//

	pack_int_value (NULL, INT_TYPE_SIDE, ENTITY_SIDE_NEUTRAL);
	sector_pack_size += NUM_SIDE_BITS;

	pack_int_value (NULL, INT_TYPE_LENGTH, 0);
	sector_pack_size += NUM_LENGTH_BITS;

	debug_log ("SC_PACK : packed %d sectors", total_side_count);

	ASSERT (total_side_count == (NUM_MAP_Z_SECTORS * NUM_MAP_X_SECTORS));

	//
	// Pack FOG OF WAR
	//

	for (z_sec = MIN_MAP_Z_SECTOR; z_sec <= MAX_MAP_Z_SECTOR; z_sec++)
	{
		for (x_sec = MIN_MAP_X_SECTOR; x_sec <= MAX_MAP_X_SECTOR; x_sec++)
		{
			en = get_local_raw_sector_entity(x_sec, z_sec);

			raw = get_local_entity_data (en);

			pack_float_value (en, FLOAT_TYPE_FOG_OF_WAR, raw->fog_of_war [ENTITY_SIDE_BLUE_FORCE]);
			pack_float_value (en, FLOAT_TYPE_FOG_OF_WAR, raw->fog_of_war [ENTITY_SIDE_RED_FORCE]);
		}
	}

	//
	// If saving game write out sector values (threat etc)
	//

	if (mode == PACK_MODE_SERVER_SESSION)
	{

		for (z_sec = MIN_MAP_Z_SECTOR; z_sec <= MAX_MAP_Z_SECTOR; z_sec++)
		{

			for (x_sec = MIN_MAP_X_SECTOR; x_sec <= MAX_MAP_X_SECTOR; x_sec++)
			{

				en = get_local_raw_sector_entity(x_sec, z_sec);

				raw = get_local_entity_data (en);

				/////////////////////////////////////////////////////////////////
				if (raw->sector_task_root.first_child)
				{

					pack_int_value (en, INT_TYPE_VALID, TRUE);

					pack_list_root (en, LIST_TYPE_SECTOR_TASK, &raw->sector_task_root);
				}
				else
				{

					pack_int_value (en, INT_TYPE_VALID, FALSE);
				}
				/////////////////////////////////////////////////////////////////

				if (raw->special_effect_root.first_child)
				{

					pack_int_value (en, INT_TYPE_VALID, TRUE);

					pack_list_root (en, LIST_TYPE_SPECIAL_EFFECT, &raw->special_effect_root);
				}
				else
				{

					pack_int_value (en, INT_TYPE_VALID, FALSE);
				}

				//debug_log ("SC_PACK: packing sector %d, %d", raw->x_sector, raw->z_sector);

				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_COUNT, raw->keysite_count);

				pack_float_value (en, FLOAT_TYPE_PROTOTYPE_1, raw->tallest_structure_height);
			}
		}
	}

	//debug_log ("SC_PACK: packing %d sectors took %d bytes (%d bits)", NUM_MAP_X_SECTORS * NUM_MAP_Z_SECTORS, sector_pack_size / 8, sector_pack_size);
}
コード例 #11
0
ファイル: fc_pack.c プロジェクト: Comanche93/eech
void pack_local_force_data (entity *en, pack_modes mode)
{

	int
		count,
		loop;

	force
		*raw;

	campaign_criteria_type
		*campaign_criteria;

	ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES));

	ASSERT (en);

	raw = (force *) get_local_entity_data (en);
	
	switch (mode)
	{
		////////////////////////////////////////
		case PACK_MODE_SERVER_SESSION:
		////////////////////////////////////////
		{
         pack_string (en, STRING_TYPE_FORCE_NAME, raw->force_name);

			// keysite_force
	
			// pilot	root
	
			pack_list_root (en, LIST_TYPE_DIVISION, &raw->division_root);
	
			pack_list_root (en, LIST_TYPE_CAMPAIGN_OBJECTIVE, &raw->campaign_objective_root);
	
			// air_registry_root
			// ground_registry_root
			// sea_registry_root

//			pack_list_root (en, LIST_TYPE_INDEPENDENT_GROUP, &raw->independent_group_root);
	
			// force_link
		
			// update link
		
			// task generation //////////////////////////////////////////////
		
			for (loop = 0; loop < NUM_ENTITY_SUB_TYPE_TASKS; loop ++)
			{
				pack_int_value (en, INT_TYPE_VALID, raw->task_generation [loop].valid);

				pack_int_value (en, INT_TYPE_TASK_GENERATION, raw->task_generation [loop].created);
			}
			/////////////////////////////////////////////////////////////////
		
			// campaign criteria ////////////////////////////////////////////
		
			count = 0;
		
			campaign_criteria = raw->campaign_criteria;
		
			while (campaign_criteria)
			{
				count ++;
		
				campaign_criteria = campaign_criteria->next;
			}
		
			pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_COUNT, count);
		
			campaign_criteria = raw->campaign_criteria;
		
			while (campaign_criteria)
			{
		
				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_TYPE, campaign_criteria->criteria_type);
		
				pack_int_value (en, INT_TYPE_VALID, campaign_criteria->valid);
		
				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_RESULT, campaign_criteria->result);
		
				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_VALUE, campaign_criteria->value1);
		
				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_VALUE, campaign_criteria->value2);
		
				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_VALUE, campaign_criteria->value3);
		
				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_VALUE, campaign_criteria->value4);
		
				campaign_criteria = campaign_criteria->next;
			}
			/////////////////////////////////////////////////////////////////
		
			// force_info_criteria
		
			for (loop = 0; loop < NUM_FORCE_INFO_CATAGORIES; loop ++)
			{
				pack_int_value (en, INT_TYPE_VALUE, raw->force_info_current_hardware [loop]);
		
				pack_int_value (en, INT_TYPE_VALUE, raw->force_info_reserve_hardware [loop]);
			}
			/////////////////////////////////////////////////////////////////
	
			for (loop = 0; loop < NUM_ENTITY_SUB_TYPE_GROUPS; loop ++)
			{
				pack_int_value (en, INT_TYPE_VALUE, raw->kills [loop]);
				pack_int_value (en, INT_TYPE_VALUE, raw->losses [loop]);
//				pack_int_value (en, INT_TYPE_VALUE, raw->group_count [loop]);
			}

			pack_float_value (en, FLOAT_TYPE_SLEEP, raw->sleep);
		
			pack_int_value (en, INT_TYPE_FORCE_ATTITUDE, raw->force_attitude);

			// sector_count
		
			pack_int_value (en, INT_TYPE_COLOUR, raw->colour);
		
			pack_int_value (en, INT_TYPE_SIDE, raw->side);
	
			break;
		}

		////////////////////////////////////////
		case PACK_MODE_CLIENT_SESSION:
		////////////////////////////////////////
		{

         pack_string (en, STRING_TYPE_FORCE_NAME, raw->force_name);

			// keysite_force
	
			pack_list_root (en, LIST_TYPE_PILOT, &raw->pilot_root);

			pack_list_root (en, LIST_TYPE_DIVISION, &raw->division_root);

			pack_list_root (en, LIST_TYPE_CAMPAIGN_OBJECTIVE, &raw->campaign_objective_root);

			//	air_registry_root
			//	ground_registry_root
			//	sea_registry_root

//			pack_list_root (en, LIST_TYPE_INDEPENDENT_GROUP, &raw->independent_group_root);
	
			pack_list_link (en, LIST_TYPE_FORCE, &raw->force_link);

			// update link

			// task generation //////////////////////////////////////////////

			for (loop = 0; loop < NUM_ENTITY_SUB_TYPE_TASKS; loop ++)
			{
				pack_int_value (en, INT_TYPE_VALID, raw->task_generation [loop].valid);

				pack_int_value (en, INT_TYPE_TASK_GENERATION, raw->task_generation [loop].created);
			}
			/////////////////////////////////////////////////////////////////

			// campaign criteria ////////////////////////////////////////////

			count = 0;

			campaign_criteria = raw->campaign_criteria;

			while (campaign_criteria)
			{
				count ++;

				campaign_criteria = campaign_criteria->next;
			}

			pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_COUNT, count);

			campaign_criteria = raw->campaign_criteria;

			while (campaign_criteria)
			{

				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_TYPE, campaign_criteria->criteria_type);

				pack_int_value (en, INT_TYPE_VALID, campaign_criteria->valid);

				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_RESULT, campaign_criteria->result);

				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_VALUE, campaign_criteria->value1);

				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_VALUE, campaign_criteria->value2);

				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_VALUE, campaign_criteria->value3);

				pack_int_value (en, INT_TYPE_CAMPAIGN_CRITERIA_VALUE, campaign_criteria->value4);

				campaign_criteria = campaign_criteria->next;
			}
			/////////////////////////////////////////////////////////////////

			// force_info_criteria

			for (loop = 0; loop < NUM_FORCE_INFO_CATAGORIES; loop ++)
			{
				pack_int_value (en, INT_TYPE_VALUE, raw->force_info_current_hardware [loop]);

				pack_int_value (en, INT_TYPE_VALUE, raw->force_info_reserve_hardware [loop]);
			}
			/////////////////////////////////////////////////////////////////

			for (loop = 0; loop < NUM_ENTITY_SUB_TYPE_GROUPS; loop ++)
			{
				pack_int_value (en, INT_TYPE_VALUE, raw->kills [loop]);
				pack_int_value (en, INT_TYPE_VALUE, raw->losses [loop]);
//				pack_int_value (en, INT_TYPE_VALUE, raw->group_count [loop]);
			}

			pack_float_value (en, FLOAT_TYPE_SLEEP, raw->sleep);

			pack_int_value (en, INT_TYPE_FORCE_ATTITUDE, raw->force_attitude);

			pack_int_value (en, INT_TYPE_FORCE_SECTOR_COUNT, raw->sector_count);

			pack_int_value (en, INT_TYPE_COLOUR, raw->colour);

			pack_int_value (en, INT_TYPE_SIDE, raw->side);

			break;
		}
		////////////////////////////////////////
		case PACK_MODE_BROWSE_SESSION:
		////////////////////////////////////////
		{
         pack_string (en, STRING_TYPE_FORCE_NAME, raw->force_name);

			// keysite_force_root

			pack_list_root (en, LIST_TYPE_PILOT, &raw->pilot_root);

			pack_list_link (en, LIST_TYPE_FORCE, &raw->force_link);

			// update link

			// task_generation

			// campaign_criteria

			// force_info_catagories

			// sleep

			pack_int_value (en, INT_TYPE_FORCE_ATTITUDE, raw->force_attitude);

			pack_int_value (en, INT_TYPE_COLOUR, raw->colour);

			pack_int_value (en, INT_TYPE_SIDE, raw->side);

			break;
		}
	}
}
コード例 #12
0
ファイル: vh_pack.c プロジェクト: Comanche93/eech
void pack_vehicle_data (entity *en, vehicle *raw, pack_modes mode)
{
	int
		package;

	ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES));

	switch (mode)
	{
		////////////////////////////////////////
		case PACK_MODE_SERVER_SESSION:
		case PACK_MODE_CLIENT_SESSION:
		////////////////////////////////////////
		{
			//
			// pack mobile data
			//

			pack_mobile_data (en, &raw->mob, mode);

			//
			// pack vehicle data
			//

			pack_int_value (en, INT_TYPE_OBJECT_3D_SHAPE, raw->object_3d_shape);

			// inst3d

			if (mode == PACK_MODE_SERVER_SESSION)
			{

				/////////////////////////////////////////////////////////////////
				if (raw->task_dependent_root.first_child)
				{

					pack_int_value (en, INT_TYPE_VALID, TRUE);

					pack_list_root (en, LIST_TYPE_TASK_DEPENDENT, &raw->task_dependent_root);
				}
				else
				{

					pack_int_value (en, INT_TYPE_VALID, FALSE);
				}
				/////////////////////////////////////////////////////////////////
			}

			/////////////////////////////////////////////////////////////////
			if (raw->launched_weapon_root.first_child)
			{

				pack_int_value (en, INT_TYPE_VALID, TRUE);

				pack_list_root (en, LIST_TYPE_LAUNCHED_WEAPON, &raw->launched_weapon_root);
			}
			else
			{

				pack_int_value (en, INT_TYPE_VALID, FALSE);
			}
			/////////////////////////////////////////////////////////////////

			/////////////////////////////////////////////////////////////////
			if (raw->movement_dependent_root.first_child)
			{

				pack_int_value (en, INT_TYPE_VALID, TRUE);

				pack_list_root (en, LIST_TYPE_MOVEMENT_DEPENDENT, &raw->movement_dependent_root);
			}
			else
			{

				pack_int_value (en, INT_TYPE_VALID, FALSE);
			}
			/////////////////////////////////////////////////////////////////

			pack_list_link (en, LIST_TYPE_FOLLOWER, &raw->follower_link);

			// gunship_target_link

			pack_list_link (en, LIST_TYPE_MEMBER, &raw->member_link);

			/////////////////////////////////////////////////////////////////
			if (raw->movement_dependent_link.parent)
			{

				pack_int_value (en, INT_TYPE_VALID, TRUE);

				pack_list_link (en, LIST_TYPE_MOVEMENT_DEPENDENT, &raw->movement_dependent_link);
			}
			else
			{

				pack_int_value (en, INT_TYPE_VALID, FALSE);
			}
			/////////////////////////////////////////////////////////////////

			// view_link

			if (mode == PACK_MODE_SERVER_SESSION)
			{
				pack_list_link (en, LIST_TYPE_TAKEOFF_QUEUE, &raw->takeoff_queue_link);
			}

			pack_int_value (en, INT_TYPE_OPERATIONAL_STATE, raw->operational_state);

			pack_float_value (en, FLOAT_TYPE_SLEEP, raw->sleep);

			if (mode == PACK_MODE_SERVER_SESSION)
			{
				pack_float_value (en, FLOAT_TYPE_DISTANCE, raw->distance);	// only needed by server?
			}

			/////////////////////////////////////////////////////////////////
			if (raw->operational_state == OPERATIONAL_STATE_LANDED)
			{

				pack_float_value (en, FLOAT_TYPE_LOADING_DOOR_STATE, raw->loading_door_state);
			}
			/////////////////////////////////////////////////////////////////

			// radar_rotation_state

			if (mode == PACK_MODE_SERVER_SESSION)
			{
				pack_float_value (en, FLOAT_TYPE_DEATH_TIMER, raw->death_timer);

				pack_float_value (en, FLOAT_TYPE_TARGET_FIRE_TIMER, raw->target_fire_timer);

				pack_float_value (en, FLOAT_TYPE_TARGET_SCAN_TIMER, raw->target_scan_timer);
			}

			// view_interest_level

			// weapon_burst_timer

			pack_float_value (en, FLOAT_TYPE_WEAPON_SYSTEM_READY_STATE, raw->weapon_system_ready_state);

			if (mode == PACK_MODE_SERVER_SESSION)
			{
				pack_float_value (en, FLOAT_TYPE_DECOY_RELEASE_TIMER, raw->decoy_release_timer);
			}

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

			pack_int_value (en, INT_TYPE_WEAPON_CONFIG_TYPE, raw->weapon_config_type);

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

				pack_int_value (en, INT_TYPE_WEAPON_PACKAGE_NUMBER, raw->weapon_package_status_array[package].number);

				pack_int_value (en, INT_TYPE_WEAPON_PACKAGE_DAMAGED, raw->weapon_package_status_array[package].damaged);

				if (weapon_config_database[raw->weapon_config_type][package].rotate)
				{
					pack_float_value (en, FLOAT_TYPE_WEAPON_SYSTEM_HEADING, raw->weapon_package_status_array[package].weapon_system_heading);

					pack_float_value (en, FLOAT_TYPE_WEAPON_SYSTEM_PITCH, raw->weapon_package_status_array[package].weapon_system_pitch);
				}

				// muzzle_flash_timer
			}

			pack_int_value (en, INT_TYPE_SELECTED_WEAPON, raw->selected_weapon);

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

			// sound_effect_data

			pack_int_value (en, INT_TYPE_FORMATION_POSITION, raw->formation_position);

			// selected_weapon_system_ready

			// weapon_and_target_vectors_valid

			// gunship_radar_los_clear

			// los_to_target

			pack_int_value (en, INT_TYPE_LIGHTS_ON, raw->lights_on);

			// cpg_identified

			pack_int_value (en, INT_TYPE_GROUP_MEMBER_NUMBER, raw->group_member_number);

			// id_number_significant_digits

			pack_int_value (en, INT_TYPE_DAMAGE_LEVEL, raw->damage_level);

			// id_number

			// weapon_vector

			// weapon_to_target_vector

			// terrain_info

			break;
		}
		////////////////////////////////////////
		case PACK_MODE_BROWSE_SESSION:
		////////////////////////////////////////
		{
			break;
		}
		////////////////////////////////////////
		case PACK_MODE_UPDATE_ENTITY:
		////////////////////////////////////////
		{
			//
			// cannot update entity at this level as the update may not apply to all entity types below
			//

			break;
		}
	}
}
コード例 #13
0
ファイル: ss_pack.c プロジェクト: Comanche93/eech
void pack_local_session_data (pack_modes mode)
{
	session
		*raw;

	entity
		*en;

   ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES));

	en = get_session_entity ();

	ASSERT (en);

	raw = (session *) get_local_entity_data (en);

   switch (mode)
   {
      ////////////////////////////////////////
      case PACK_MODE_SERVER_SESSION:
      ////////////////////////////////////////
		{
			ASSERT (!raw->session_complete);
		
			pack_int_value (en, INT_TYPE_VERSION_NUMBER, raw->version_number);
		
			pack_list_root (en, LIST_TYPE_FORCE, &raw->force_root);
		
			// special_effect_root
		
			// update_link
		
			pack_float_value (en, FLOAT_TYPE_ELAPSED_TIME, raw->elapsed_time);
		
			pack_float_value (en, FLOAT_TYPE_LIGHTNING_TIMER, raw->lightning_timer);
		
			pack_float_value (en, FLOAT_TYPE_START_TIME, raw->start_time);
		
			// time_of_day_resync
		
			pack_float_value (en, FLOAT_TYPE_TIME_OF_DAY_ACCELERATION, raw->time_of_day_acceleration);
		
			pack_float_value (en, FLOAT_TYPE_FOG_OF_WAR_MAXIMUM_VALUE, raw->fog_of_war_maximum_value);
		
			//
			// rain effect
			//
		
			pack_float_value (en, FLOAT_TYPE_WEATHER_RADIUS, raw->weather_radius);
			pack_float_value (en, FLOAT_TYPE_WEATHER_MODE_TRANSITIONAL_PERIOD, raw->weather_mode_transitional_period);
			pack_float_value (en, FLOAT_TYPE_WEATHER_MODE_TRANSITIONAL_STATUS, raw->weather_mode_transitional_status);
		
			pack_int_value (en, INT_TYPE_WEATHER_MODE, raw->weather_mode);
			pack_int_value (en, INT_TYPE_TARGET_WEATHER_MODE, raw->target_weather_mode);
		
			pack_vec3d (en, VEC3D_TYPE_WEATHER_POSITION, &raw->weather_position);
			pack_vec3d (en, VEC3D_TYPE_WEATHER_VELOCITY, &raw->weather_velocity);
		
			//
			// wind effect
			//
		
			pack_float_value (en, FLOAT_TYPE_WIND_EFFECT_RADIUS, raw->wind_effect_radius);
			pack_float_value (en, FLOAT_TYPE_WIND_GUSTING_VALUE, raw->wind_gusting_value);
			pack_float_value (en, FLOAT_TYPE_WIND_MINIMUM_SPEED, raw->wind_minimum_speed);
			pack_float_value (en, FLOAT_TYPE_WIND_MAXIMUM_SPEED, raw->wind_maximum_speed);
		
			pack_vec3d (en, VEC3D_TYPE_WIND_DIRECTION_VECTOR, &raw->wind_direction_vector);
			pack_vec3d (en, VEC3D_TYPE_WIND_EFFECT_POSITION, &raw->wind_effect_position);
			pack_vec3d (en, VEC3D_TYPE_WIND_EFFECT_VELOCITY, &raw->wind_effect_velocity);
		
			//
		
			pack_int_value (en, INT_TYPE_DAY_SEGMENT_TYPE, raw->day_segment_type);

			pack_float_value (en, FLOAT_TYPE_POPULATION_X_MIN, raw->population_x_min);
			pack_float_value (en, FLOAT_TYPE_POPULATION_X_MAX, raw->population_x_max);
			pack_float_value (en, FLOAT_TYPE_POPULATION_Z_MIN, raw->population_z_min);
			pack_float_value (en, FLOAT_TYPE_POPULATION_Z_MAX, raw->population_z_max);
		
			pack_int_value (en, INT_TYPE_CAMPAIGN_MEDAL, raw->campaign_medal);

			pack_int_value (en, INT_TYPE_CAMPAIGN_REQUIRES_APACHE_HAVOC, raw->campaign_requires_apache_havoc);
		
			pack_int_value (en, INT_TYPE_AUTO_ASSIGN_GUNSHIP, raw->auto_assign_gunship);
		
			pack_int_value (en, INT_TYPE_INFINITE_FUEL, raw->infinite_fuel);
		
			pack_int_value (en, INT_TYPE_INFINITE_WEAPONS, raw->infinite_weapons);
		
			pack_int_value (en, INT_TYPE_SUPPRESS_AI_FIRE, raw->suppress_ai_fire);
		
			pack_int_value (en, INT_TYPE_INVULNERABLE_FROM_COLLISIONS, raw->invulnerable_from_collisions);

			pack_int_value (en, INT_TYPE_INVULNERABLE_FROM_WEAPONS, raw->invulnerable_from_weapons);
		
			pack_int_value (en, INT_TYPE_CHEATS_ENABLED, raw->cheats_enabled);
		
			pack_int_value (en, INT_TYPE_SKIP_NIGHT_TIME, raw->skip_night_time);
		
			pack_int_value (en, INT_TYPE_WEATHER_INCREASING, raw->weather_increasing);
		
			pack_int_value (en, INT_TYPE_WIND_INCREASING, raw->wind_increasing);
		
			pack_int_value (en, INT_TYPE_LOCAL_WEATHER_MODEL, raw->local_weather_model);

			break;
		}

      ////////////////////////////////////////
      case PACK_MODE_CLIENT_SESSION:
      ////////////////////////////////////////
      {
         pack_entity_safe_ptr (en);

         pack_int_value (en, INT_TYPE_VERSION_NUMBER, raw->version_number);

			pack_int_value (en, INT_TYPE_SESSION_COMPLETE, raw->session_complete);
		
         pack_list_root (en, LIST_TYPE_FORCE, &raw->force_root);

			pack_list_root (en, LIST_TYPE_SPECIAL_EFFECT, &raw->special_effect_root);

			// update_link

         pack_float_value (en, FLOAT_TYPE_ELAPSED_TIME, raw->elapsed_time);

         pack_float_value (en, FLOAT_TYPE_LIGHTNING_TIMER, raw->lightning_timer);

         pack_float_value (en, FLOAT_TYPE_START_TIME, raw->start_time);

			// time_of_day_resync

         pack_float_value (en, FLOAT_TYPE_TIME_OF_DAY_ACCELERATION, raw->time_of_day_acceleration);

			pack_float_value (en, FLOAT_TYPE_FOG_OF_WAR_MAXIMUM_VALUE, raw->fog_of_war_maximum_value);
		
			//
			// rain effect
			//

         pack_float_value (en, FLOAT_TYPE_WEATHER_RADIUS, raw->weather_radius);
         pack_float_value (en, FLOAT_TYPE_WEATHER_MODE_TRANSITIONAL_PERIOD, raw->weather_mode_transitional_period);
         pack_float_value (en, FLOAT_TYPE_WEATHER_MODE_TRANSITIONAL_STATUS, raw->weather_mode_transitional_status);

         pack_int_value (en, INT_TYPE_WEATHER_MODE, raw->weather_mode);
         pack_int_value (en, INT_TYPE_TARGET_WEATHER_MODE, raw->target_weather_mode);

			pack_vec3d (en, VEC3D_TYPE_WEATHER_POSITION, &raw->weather_position);
			pack_vec3d (en, VEC3D_TYPE_WEATHER_VELOCITY, &raw->weather_velocity);

			//
			// wind effect
			//

         pack_float_value (en, FLOAT_TYPE_WIND_EFFECT_RADIUS, raw->wind_effect_radius);
         pack_float_value (en, FLOAT_TYPE_WIND_GUSTING_VALUE, raw->wind_gusting_value);
         pack_float_value (en, FLOAT_TYPE_WIND_MINIMUM_SPEED, raw->wind_minimum_speed);
         pack_float_value (en, FLOAT_TYPE_WIND_MAXIMUM_SPEED, raw->wind_maximum_speed);

			pack_vec3d (en, VEC3D_TYPE_WIND_DIRECTION_VECTOR, &raw->wind_direction_vector);
			pack_vec3d (en, VEC3D_TYPE_WIND_EFFECT_POSITION, &raw->wind_effect_position);
			pack_vec3d (en, VEC3D_TYPE_WIND_EFFECT_VELOCITY, &raw->wind_effect_velocity);

			//

         pack_int_value (en, INT_TYPE_DAY_SEGMENT_TYPE, raw->day_segment_type);

			pack_float_value (en, FLOAT_TYPE_POPULATION_X_MIN, raw->population_x_min);
			pack_float_value (en, FLOAT_TYPE_POPULATION_X_MAX, raw->population_x_max);
			pack_float_value (en, FLOAT_TYPE_POPULATION_Z_MIN, raw->population_z_min);
			pack_float_value (en, FLOAT_TYPE_POPULATION_Z_MAX, raw->population_z_max);
		
			pack_int_value (en, INT_TYPE_CAMPAIGN_MEDAL, raw->campaign_medal);
		
			pack_int_value (en, INT_TYPE_CAMPAIGN_REQUIRES_APACHE_HAVOC, raw->campaign_requires_apache_havoc);

         pack_int_value (en, INT_TYPE_AUTO_ASSIGN_GUNSHIP, raw->auto_assign_gunship);

         pack_int_value (en, INT_TYPE_INFINITE_FUEL, raw->infinite_fuel);

         pack_int_value (en, INT_TYPE_INFINITE_WEAPONS, raw->infinite_weapons);

         pack_int_value (en, INT_TYPE_SUPPRESS_AI_FIRE, raw->suppress_ai_fire);

         pack_int_value (en, INT_TYPE_INVULNERABLE_FROM_COLLISIONS, raw->invulnerable_from_collisions);

         pack_int_value (en, INT_TYPE_INVULNERABLE_FROM_WEAPONS, raw->invulnerable_from_weapons);

			pack_int_value (en, INT_TYPE_CHEATS_ENABLED, raw->cheats_enabled);
		
         pack_int_value (en, INT_TYPE_SKIP_NIGHT_TIME, raw->skip_night_time);

         pack_int_value (en, INT_TYPE_WEATHER_INCREASING, raw->weather_increasing);

         pack_int_value (en, INT_TYPE_WIND_INCREASING, raw->wind_increasing);

         pack_int_value (en, INT_TYPE_LOCAL_WEATHER_MODEL, raw->local_weather_model);

         break;
      }

      ////////////////////////////////////////
      case PACK_MODE_BROWSE_SESSION:
      ////////////////////////////////////////
      {
         pack_entity_safe_ptr (en);

			pack_int_value (en, INT_TYPE_VERSION_NUMBER, raw->version_number);

         pack_list_root (en, LIST_TYPE_FORCE, &raw->force_root);

			// update_link

			// tour of duty time

         pack_float_value (en, FLOAT_TYPE_ELAPSED_TIME, raw->elapsed_time);

			// lightning_timer

         pack_float_value (en, FLOAT_TYPE_START_TIME, raw->start_time);

			// time_of_day_resync

			// time_of_day_acceleration

			// weather radius

			// weather_mode_transitional_period

			// weather_mode_transitional_status

         pack_int_value (en, INT_TYPE_WEATHER_MODE, raw->weather_mode);

			// target_weather_mode

			// weather position

			// weather velocity

         pack_int_value (en, INT_TYPE_DAY_SEGMENT_TYPE, raw->day_segment_type);

			pack_float_value (en, FLOAT_TYPE_POPULATION_X_MIN, raw->population_x_min);
			pack_float_value (en, FLOAT_TYPE_POPULATION_X_MAX, raw->population_x_max);
			pack_float_value (en, FLOAT_TYPE_POPULATION_Z_MIN, raw->population_z_min);
			pack_float_value (en, FLOAT_TYPE_POPULATION_Z_MAX, raw->population_z_max);
		
			pack_int_value (en, INT_TYPE_CAMPAIGN_REQUIRES_APACHE_HAVOC, raw->campaign_requires_apache_havoc);

			// infinite_weapons

			// skip_night_time

			// weather increasing

         break;
      }
	}
}
コード例 #14
0
ファイル: ef_pack.c プロジェクト: DexterWard/comanche
void pack_effect_data (entity *en, effect *raw, pack_modes mode)
{
	ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES));

	switch (mode)
	{
		////////////////////////////////////////
		case PACK_MODE_SERVER_SESSION:
		case PACK_MODE_CLIENT_SESSION:
		////////////////////////////////////////
		{
			//
			// some effects should never be packed up ( should be re-constructed when the vehicle is unpacked )
			//

			ASSERT (!effect_database [raw->sub_type].constructed_locally);

			pack_int_value (en, INT_TYPE_ENTITY_SUB_TYPE, raw->sub_type);

			pack_vec3d (en, VEC3D_TYPE_POSITION, &raw->position);

			/////////////////////////////////////////////////////////////////
			//
			// Special effect packing, manually packing link data
			//
			if (raw->special_effect_link.parent)
			{
				list_link
					link;

				entity
					*spec;

				pack_int_value (en, INT_TYPE_VALID, TRUE);

				//
				// parent
				//

				link.parent = raw->special_effect_link.parent;

				//
				// succ : search forwards through special effect list for valid child succ
				//

				spec = get_local_entity_child_succ (en, LIST_TYPE_SPECIAL_EFFECT);

				while (TRUE)
				{
					if ((spec == NULL) ||
							(effect_database [get_local_entity_int_value (spec, INT_TYPE_ENTITY_SUB_TYPE)].constructed_locally == FALSE))
					{
						link.child_succ = spec;

						break;
					}

					spec = get_local_entity_child_succ (spec, LIST_TYPE_SPECIAL_EFFECT);
				}

				//
				// pred : search backwards through special effect list for valid child pred
				//

				spec = get_local_entity_child_pred (en, LIST_TYPE_SPECIAL_EFFECT);

				while (TRUE)
				{
					if ((spec == NULL) ||
							(effect_database [get_local_entity_int_value (spec, INT_TYPE_ENTITY_SUB_TYPE)].constructed_locally == FALSE))
					{
						link.child_pred = spec;

						break;
					}

					spec = get_local_entity_child_pred (spec, LIST_TYPE_SPECIAL_EFFECT);
				}

				pack_list_link (en, LIST_TYPE_SPECIAL_EFFECT, &link);
			}
			else
			{

				pack_int_value (en, INT_TYPE_VALID, FALSE);
			}
			/////////////////////////////////////////////////////////////////

			// update_link

			break;
		}
		////////////////////////////////////////
		case PACK_MODE_BROWSE_SESSION:
		////////////////////////////////////////
		{
			break;
		}
		////////////////////////////////////////
		case PACK_MODE_UPDATE_ENTITY:
		////////////////////////////////////////
		{
			//
			// cannot update entity at this level as the update may not apply to all entity types below
			//

			break;
		}
	}
}
コード例 #15
0
ファイル: ks_pack.c プロジェクト: Comanche93/eech
void pack_local_keysite_data (pack_modes mode)
{
   entity
      *en,
		*landing_en;

	landing
		*landing_raw;

   keysite
      *raw;

   ASSERT (mode != PACK_MODE_UPDATE_ENTITY);

   if (mode == PACK_MODE_BROWSE_SESSION)
   {
      return;
   }

	en = get_local_entity_list ();

	while (en)
	{

		if (get_local_entity_type (en) == ENTITY_TYPE_KEYSITE)
		{

			//
			// pack keysite data
			//

			pack_entity_safe_ptr (en);

			raw = (keysite *) get_local_entity_data (en);

			pack_float_value (en, FLOAT_TYPE_AMMO_SUPPLY_LEVEL, raw->supplies.ammo_supply_level);

			pack_float_value (en, FLOAT_TYPE_FUEL_SUPPLY_LEVEL, raw->supplies.fuel_supply_level);

			pack_float_value (en, FLOAT_TYPE_KEYSITE_STRENGTH, raw->keysite_strength);

			pack_float_value (en, FLOAT_TYPE_KEYSITE_MAXIMUM_STRENGTH, raw->keysite_maximum_strength);

			pack_int_value (en, INT_TYPE_ALIVE, raw->alive);

			pack_int_value (en, INT_TYPE_SIDE, raw->side);

			pack_int_value (en, INT_TYPE_IN_USE, raw->in_use);

			pack_int_value (en, INT_TYPE_KEYSITE_ID, raw->keysite_id);

			pack_int_value (en, INT_TYPE_KEYSITE_USABLE_STATE, raw->keysite_usable_state);

			pack_list_root (en, LIST_TYPE_UNASSIGNED_TASK, &raw->unassigned_task_root);
			pack_list_root (en, LIST_TYPE_ASSIGNED_TASK, &raw->assigned_task_root);
			pack_list_root (en, LIST_TYPE_COMPLETED_TASK, &raw->completed_task_root);

//			pack_list_root (en, LIST_TYPE_KEYSITE_GROUP, &raw->keysite_group_root);

			pack_list_root (en, LIST_TYPE_DIVISION_HEADQUARTERS, &raw->division_headquarters_root);

			if (raw->campaign_objective_link.parent)
			{
				pack_int_value (en, INT_TYPE_VALID, TRUE);

				pack_list_link (en, LIST_TYPE_CAMPAIGN_OBJECTIVE, &raw->campaign_objective_link);
			}
			else
			{
				pack_int_value (en, INT_TYPE_VALID, FALSE);
			}

			#if DEBUG_MODULE

			debug_log ("KS_PACK: packing up keysite %s", raw->keysite_name);

			#endif

			if (mode == PACK_MODE_SERVER_SESSION)
			{
	
				pack_float_value (en, FLOAT_TYPE_REPAIR_TIMER, raw->repair_timer);

				pack_float_value (en, FLOAT_TYPE_SLEEP, raw->sleep);

				pack_float_value (en, FLOAT_TYPE_ASSIST_TIMER, raw->assist_timer);

				pack_float_value (en, FLOAT_TYPE_ASSIGN_TIMER, raw->assign_timer);

				//
				// pack landing data
				//
	
				landing_en = get_local_entity_first_child (en, LIST_TYPE_LANDING_SITE);
	
				while (landing_en)
				{
	
					landing_raw = (landing *) get_local_entity_data (landing_en);
	
					pack_int_value (landing_en, INT_TYPE_RESERVED_LANDING_SITES, landing_raw->reserved_landing_sites);
	
					//pack_int_value (en, INT_TYPE_FREE_LANDING_SITES, landing_raw->free_landing_sites);
	
					pack_int_value (landing_en, INT_TYPE_LANDING_LOCK, landing_raw->landing_lock);
	
					pack_int_value (landing_en, INT_TYPE_LANDED_LOCK, landing_raw->landed_lock);
	
					pack_int_value (landing_en, INT_TYPE_TAKEOFF_LOCK, landing_raw->takeoff_lock);

					pack_list_root (landing_en, LIST_TYPE_TAKEOFF_QUEUE, &landing_raw->takeoff_queue_root);

					#if DEBUG_MODULE

					debug_log ("KS_PACK: packing up %s landing entity, reserved %d, free %d, locks (landing %d, landed %d, takeoff %d)", entity_sub_type_landing_names [landing_raw->sub_type], landing_raw->reserved_landing_sites, landing_raw->free_landing_sites, landing_raw->landing_lock, landing_raw->landed_lock, landing_raw->takeoff_lock );

					#endif
	
					landing_en = get_local_entity_child_succ (landing_en, LIST_TYPE_LANDING_SITE);
				}
			}

		}

		en = get_local_entity_succ (en);
	}
}
コード例 #16
0
ファイル: cb_pack.c プロジェクト: DexterWard/comanche
void pack_local_city_building_data (pack_modes mode)
{

	entity
		*en;

	city_building
		*raw;

	int
		city_building_pack_size,
		city_building_count,
		city_building_alive,
		count;

	if ((mode != PACK_MODE_SERVER_SESSION) && (mode != PACK_MODE_CLIENT_SESSION))
	{

		return;
	}

	debug_log ("RLE CITY BLOCK");

	city_building_pack_size = 0;

	city_building_count = 0;

	city_building_alive = TRUE;

	count = 0;

	en = get_local_entity_list ();

	while (en)
	{

		if (get_local_entity_type (en) == ENTITY_TYPE_CITY_BUILDING)
		{

			count ++;

			raw = get_local_entity_data (en);

			if (city_building_alive == raw->fix.alive)
			{

				city_building_count ++;
			}
			else
			{

				pack_int_value (NULL, INT_TYPE_LENGTH, city_building_count);
				city_building_pack_size += NUM_LENGTH_BITS;

				pack_int_value (NULL, INT_TYPE_ALIVE, city_building_alive);
				city_building_pack_size += NUM_ALIVE_BITS;

				city_building_alive = raw->fix.alive;

				city_building_count = 1;
			}
		}

		en = get_local_entity_succ (en);
	}

	pack_int_value (NULL, INT_TYPE_LENGTH, city_building_count);
	city_building_pack_size += NUM_LENGTH_BITS;

	pack_int_value (NULL, INT_TYPE_ALIVE, city_building_alive);
	city_building_pack_size += NUM_ALIVE_BITS;

	//debug_log ("CB_PACK: packing %d city_building took %d bytes (%d bits)", count, city_building_pack_size / 8, city_building_pack_size);
}
コード例 #17
0
ファイル: aa_pack.c プロジェクト: Comanche93/eech
void pack_local_anti_aircraft_data (pack_modes mode)
{

	entity
		*en;

	anti_aircraft
		*raw;

	int
		pack_size,
		count,
		alive,
		total;

	if ((mode != PACK_MODE_SERVER_SESSION) && (mode != PACK_MODE_CLIENT_SESSION))
	{

		return;
	}

	debug_log ("RLE SAM & AAA");

	pack_size = 0;

	count = 0;

	alive = TRUE;

	total = 0;

	en = get_local_entity_list ();

	while (en)
	{

		if (get_local_entity_type (en) == ENTITY_TYPE_ANTI_AIRCRAFT)
		{

			total ++;

			raw = (anti_aircraft *) get_local_entity_data (en);

			if (alive == raw->vh.mob.alive)
			{

				count ++;
			}
			else
			{

				pack_int_value (NULL, INT_TYPE_LENGTH, count);
				pack_size += NUM_LENGTH_BITS;

				pack_int_value (NULL, INT_TYPE_ALIVE, alive);
				pack_size += NUM_ALIVE_BITS;

				#if DEBUG_MODULE

				debug_log ("AA_PACK: packing count %d, alive %d", count, alive);

				#endif

				alive = raw->vh.mob.alive;

				count = 1;
			}
		}

		en = get_local_entity_succ (en);
	}

	pack_int_value (NULL, INT_TYPE_LENGTH, count);
	pack_size += NUM_LENGTH_BITS;

	pack_int_value (NULL, INT_TYPE_ALIVE, alive);
	pack_size += NUM_ALIVE_BITS;

	#if DEBUG_MODULE

	debug_log ("AA_PACK: packing count %d, alive %d", count, alive);

	#endif

	//debug_log ("AA_PACK: packing %d anti_aircraft took %d bytes (%d bits)", total, pack_size / 8, pack_size);
}