Ejemplo n.º 1
0
/*
================================================
idVoiceChatMgr::GetActiveLocalTalkers
================================================
*/
void idVoiceChatMgr::GetActiveLocalTalkers( idStaticList< int, MAX_PLAYERS >& localTalkers )
{

	localTalkers.Clear();
	
	for( int i = 0; i < talkers.Num(); i++ )
	{
	
		if( !talkers[i].IsLocal() )
		{
			continue;
		}
		
		if( !talkers[i].registeredSuccess )
		{
			continue;
		}
		
		if( !TalkerHasData( i ) )
		{
			continue;
		}
		
		localTalkers.Append( i );
	}
}
Ejemplo n.º 2
0
/*
================================================
idVoiceChatMgr::GetRecipientsForTalker
================================================
*/
void idVoiceChatMgr::GetRecipientsForTalker( int talkerIndex, idStaticList< const lobbyAddress_t*, MAX_PLAYERS >& recipients )
{

	recipients.Clear();
	
	talker_t& talker = talkers[talkerIndex];
	
	if( !talker.IsLocal() )
	{
		return;
	}
	
	sendFrame++;
	
	for( int i = 0; i < talkers.Num(); i++ )
	{
		if( !talkers[i].registeredSuccess )
		{
			continue;
		}
		
		if( talkers[i].IsLocal() )
		{
			continue;		// Only want to send to remote talkers
		}
		
		if( !CanSendVoiceTo( talkerIndex, i ) )
		{
			continue;
		}
		
		if( !sendGlobal && talkers[i].groupIndex != activeGroupIndex )
		{
			continue;
		}
		
		assert( talkers[i].machineIndex >= 0 );
		
		remoteMachine_t& remoteMachine = remoteMachines[ talkers[i].machineIndex ];
		
		assert( remoteMachine.refCount > 0 );
		assert( remoteMachine.lobbyType == activeLobbyType );
		
		if( remoteMachine.sendFrame == sendFrame )
		{
			continue;		// Already on the recipient list
		}
		
		remoteMachine.sendFrame = sendFrame;
		
		recipients.Append( &remoteMachine.address );
	}
}
Ejemplo n.º 3
0
/*
================
sdVehiclePathGrid::SetupPathPoints
================
*/
void sdVehiclePathGrid::SetupPathPoints( const idVec3& position, idStaticList< idVec3, MAX_SCRIPTENTITY_PATHPOINTS >& pathPoints, int seed, float cornerX, float cornerY ) const {
	int x, y;
	int xmin, ymin;
	GetCoordsForPoint( x, y, xmin, ymin, position );

	int nx, ny;
	GetEdgePoint( x, y, nx, ny, seed, cornerX, cornerY );

	idVec3 edgePos;
	GetPointInternal( nx, ny, edgePos );

	AdjustTargetForStart( edgePos, position, x, y, xmin, ymin );

	bool ymainaxis = abs( ny - y ) > abs( nx - x );

	int loopPos;
	int loopDir;
	int loopStart;
	int loopEnd;
	float loopLen;
	
	if ( ymainaxis ) {
		loopPos		= ny;
		loopStart	= ny;
		loopDir		= ny > y ? -1 : 1;
		loopLen		= ny - y;
		loopEnd		= y;
	} else {
		loopPos		= nx;
		loopStart	= nx;
		loopDir		= nx > x ? -1 : 1;
		loopLen		= nx - x;
		loopEnd		= x;
	}

	idVec3 endPoint;
	GetPoint( x, y, endPoint );

	idVec3 lastPos;
	GetPoint( nx, ny, lastPos );

	idVec3 inVector = ( endPoint - lastPos );
	inVector[ 2 ] = 0.f;
	inVector.Normalize();
	float scale = 64.f; // inVector.Normalize();

	pathPoints.Clear();

	while ( loopPos != loopEnd ) {
		int currentPos[ 2 ];

		loopPos += loopDir;
		float frac = ( loopPos - loopStart ) / loopLen;

		if ( ymainaxis ) {
			currentPos[ 0 ] = nx + ( ( nx - x ) * frac );
			currentPos[ 1 ] = loopPos;
		} else {
			currentPos[ 0 ] = loopPos;
			currentPos[ 1 ] = ny + ( ( ny - y ) * frac );
		}

		idVec3 newPos;
		GetPointInternal( currentPos[ 0 ], currentPos[ 1 ], newPos );

		//AddSection( lastPos, inVector, newPos, endPoint, loopPos != loopEnd, inSpline );
		pathPoints.Append( newPos );
		lastPos = newPos;
	}

	// add the final point
	idVec3 hoverPos = position;
	hoverPos[ 2 ] = lastPos[ 2 ];
	pathPoints.Append( hoverPos );
}