Exemple #1
0
/*
-----------------------------------------------------------------------------
 Function: 

 Parameters:

 Returns:

 Notes: 
-----------------------------------------------------------------------------
*/
PUBLIC void ProcessGuards( void )
{
	int n, tex;
	assert( NumGuards < MAX_GUARDS );
	for( n = 0 ; n < NumGuards ; ++n )
	{
		if( ! DoGuard( &Guards[ n ] ) )
		{ // remove guard from the game forever!
			RemoveActor( &Guards[ n-- ] );
			continue;
		}

		Sprite_SetPos( Guards[ n ].sprite, Guards[ n ].x, Guards[ n ].y, Guards[ n ].angle );
		tex = objstate[ Guards[ n ].type ][ Guards[ n ].state ].texture;
		
		if( objstate[ Guards[ n ].type ][ Guards[ n ].state ].rotate )
		{
			if( Guards[ n ].type == en_rocket || Guards[ n ].type == en_hrocket )
			{
				tex += r_add8dir[ Get8dir( angle_wise( FINE2RAD(Player.position.angle), FINE2RAD(Guards[ n ].angle) ) ) ];				
			}
			else
			{
				tex += add8dir[ Get8dir( angle_wise( FINE2RAD(Player.position.angle), FINE2RAD(Guards[ n ].angle) ) ) ];				
			}
		}
		
		Sprite_SetTex( Guards[ n ].sprite, 0, tex );
	}
}
Exemple #2
0
/*
-----------------------------------------------------------------------------
 Function: interpolate_angle -Linear interpolate between angle A and B by
								fraction 'f'.

 Parameters: 

 Returns: 

 Notes: 
-----------------------------------------------------------------------------
*/
INLINECALL float interpolate_angle( float from, float to, float fraction )
{
	float diff = angle_diff( from, to ) * fraction;

	if( angle_wise( to, from ) >= M_PI )
	{
		return from - diff;
	}
	else
	{
		return from + diff;
	}
}