void CReplayListPanel::AddReplaysToList()
{
	// Cache off list item pointers into a temp list for processing
	CUtlLinkedList< IQueryableReplayItem *, int > lstMovies;
	CUtlLinkedList< IQueryableReplayItem *, int > lstReplays;

	// Add all replays to a replays list
	g_pReplayManager->GetReplaysAsQueryableItems( lstReplays );

	// Add all movies to a movies list
	g_pReplayMovieManager->GetMoviesAsQueryableItems( lstMovies );

	// Go through all movies, and add them to the proper collection, based on date
	FOR_EACH_LL( lstMovies, i )
	{
		if ( PassesFilter( lstMovies[ i ] ) )
		{
			AddReplayItem( lstMovies[ i ]->GetItemHandle() );
		}
	}

	// Add any replays to the "temporary replays" collection
	FOR_EACH_LL( lstReplays, i )
	{
		if ( PassesFilter( lstReplays[ i ] ) )
		{
			m_pReplaysCollection->AddReplay( lstReplays[ i ] );
		}
	}

	// Add all collection panels to the list panel
	FOR_EACH_VEC( m_vecCollections, i )
	{
		AddItem( NULL, m_vecCollections[ i ] );
	}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
// Purpose: Input handler for testing the activator. If the activator passes the
//			filter test, the OnPass output is fired. If not, the OnFail output is fired.
//-----------------------------------------------------------------------------
void CBaseFilter::InputTestActivator( inputdata_t &inputdata )
{
	if ( PassesFilter( inputdata.pCaller, inputdata.pActivator ) )
	{
		m_OnPass.FireOutput( inputdata.pActivator, this );
	}
	else
	{
		m_OnFail.FireOutput( inputdata.pActivator, this );
	}
}
Ejemplo n.º 3
0
void FilterMostHurt::Check( int _index, const MemoryRecord & record )
{
	if ( mMemorySpan == 0 )
		mMemorySpan = mClient->GetSensoryMemory()->GetMemorySpan();

	const bool noLOS = record.mTargetInfo.mEntInfo.mCategory.CheckFlag( ENT_CAT_NOLOS );
	if ( noLOS || ( IGame::GetTime() - record.GetTimeLastSensed() ) <= mMemorySpan )
	{
		switch ( mType )
		{
			case AiState::SensoryMemory::EntAlly:
				if ( !record.IsAllied() )
					return;
				break;
			case AiState::SensoryMemory::EntEnemy:
				if ( record.IsAllied() )
					return;
				break;
			case AiState::SensoryMemory::EntAny:
				break;
		}

		// Make sure the class matches.
		if ( mAnyPlayerClass )
		{
			if ( record.mTargetInfo.mEntInfo.mClassId >= ANYPLAYERCLASS )
				return;
		}
		else if ( !PassesFilter( record.mTargetInfo.mEntInfo ) )
			return;

		// Make sure the category matches.
		if ( mCategory.AnyFlagSet() && !( mCategory & record.mTargetInfo.mEntInfo.mCategory ).AnyFlagSet() )
			return;

		// Only alive targets count for shootable
		if ( mCategory.CheckFlag( ENT_CAT_SHOOTABLE ) && record.mTargetInfo.mEntInfo.mFlags.CheckFlag( ENT_FLAG_DEAD ) )
			return;

		// Make sure it isn't disabled.
		if ( record.mTargetInfo.mEntInfo.mFlags.CheckFlag( ENT_FLAG_DISABLED ) )
			return;

		// Check the health
		if ( record.mTargetInfo.mEntInfo.mHealth.Percent() > 0 )
		{
			const float healthPercent = record.mTargetInfo.mEntInfo.mHealth.Percent();
			if ( healthPercent < mMostHurtHealthPc )
			{
				mMostHurtHealthPc = healthPercent;
				mBestEntity = record.GetEntity();
			}
		}

		const float healthPc = record.mTargetInfo.mEntInfo.mHealth.Percent();
		if ( healthPc < mMostHurtHealthPc )
		{
			mMostHurtHealthPc = healthPc;
			mBestEntity = record.GetEntity();
		}
	}
}