Esempio n. 1
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);
	}

}
Esempio n. 2
0
void animate_site_radar( entity *en, object_3d_instance *inst3d )
{
	site_updatable
		*raw;

	//
	// articulate the radar on the 3d objects
	//

	ASSERT (en);

	if (get_local_entity_int_value (en, INT_TYPE_OBJECT_DRAWN_ONCE_THIS_FRAME))
	{
		return;
	}

	raw = get_local_entity_data (en);

	animate_entity_simple_keyframed_sub_objects( inst3d, OBJECT_3D_SUB_OBJECT_RADAR, raw->radar_rotation_state );
}