예제 #1
0
void StatsReport::SetPlayerNames( void )
{
	C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
	if ( !pPlayer )
		return;

	int nMarine = 0;

	C_ASW_Game_Resource *pGameResource = ASWGameResource();

	for ( int i = 0; i < pGameResource->GetMaxMarineResources() && nMarine < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		CASW_Marine_Resource *pMR = pGameResource->GetMarineResource( i );
		if ( pMR )
		{
			C_ASW_Player *pCommander = pMR->GetCommander();

			Color color = getColorPerIndex(pMR->GetCommanderIndex());

			if ( pPlayer != pCommander )
			{
				color[ 3 ] = 128;
			}

			m_pStatGraphPlayer->m_pStatGraphs[ nMarine ]->SetLineColor( color );
			m_pPlayerNames[ nMarine ]->SetFgColor( color );

			wchar_t wszMarineName[ 32 ];
			pMR->GetDisplayName( wszMarineName, sizeof( wszMarineName ) );

			m_pPlayerNames[ nMarine ]->SetText( wszMarineName );

			if ( gpGlobals->maxClients == 1 )
			{
				// Don't need these in singleplayer
				m_pAvatarImages[ nMarine ]->SetVisible( false );
				m_pReadyCheckImages[ nMarine ]->SetVisible( false );
			}
			else
			{
#if !defined(NO_STEAM)
				CSteamID steamID;

				if ( pCommander )
				{
					player_info_t pi;
					if ( engine->GetPlayerInfo( pCommander->entindex(), &pi ) )
					{
						if ( pi.friendsID )
						{
							CSteamID steamIDForPlayer( pi.friendsID, 1, steamapicontext->SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
							steamID = steamIDForPlayer;
						}
					}
				}

				if ( steamID.IsValid() )
				{
					m_pAvatarImages[ nMarine ]->SetAvatarBySteamID( &steamID );

					int wide, tall;
					m_pAvatarImages[ nMarine ]->GetSize( wide, tall );

					CAvatarImage *pImage = static_cast< CAvatarImage* >( m_pAvatarImages[ nMarine ]->GetImage() );
					if ( pImage )
					{
						pImage->SetAvatarSize( wide, tall );
						pImage->SetPos( -AVATAR_INDENT_X, -AVATAR_INDENT_Y );
					}
				}
#endif
			}

			nMarine++;
		}
	}

	while ( nMarine < ASW_STATS_REPORT_MAX_PLAYERS )
	{
		m_pAvatarImages[ nMarine ]->SetVisible( false );
		m_pReadyCheckImages[ nMarine ]->SetVisible( false );
		nMarine++;
	}
}
예제 #2
0
void StatsReport::OnThink()
{
	int nMarine = 0;

	m_pObjectiveMap->ClearBlips();

	C_ASW_Game_Resource *pGameResource = ASWGameResource();

	for ( int i = 0; i < pGameResource->GetMaxMarineResources() && nMarine < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		CASW_Marine_Resource *pMR = pGameResource->GetMarineResource( i );
		if ( pMR )
		{
			Vector vPos;
			vPos.x = pMR->m_TimelinePosX.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp );
			vPos.y = pMR->m_TimelinePosY.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp );
			vPos.z = 0.0f;

			bool bDead = ( pMR->m_TimelineHealth.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp ) <= 0.0f );
			
			m_pObjectiveMap->AddBlip( MapBlip_t( vPos, bDead ? Color( 255, 255, 255, 255 ) : getColorPerIndex(pMR->GetCommanderIndex()), bDead ? MAP_BLIP_TEXTURE_DEATH : MAP_BLIP_TEXTURE_NORMAL ) );

			if ( m_pReadyCheckImages[ nMarine ]->IsVisible() )
			{
				C_ASW_Player *pPlayer = pMR->GetCommander();
				if ( pPlayer )
				{
					if ( !pMR->IsInhabited() || ASWGameResource()->IsPlayerReady( pPlayer ) )
					{
						m_pReadyCheckImages[ i ]->SetImage( "swarm/HUD/TickBoxTicked" );
					}
					else if ( pPlayer == ASWGameResource()->GetLeader() )
					{
						m_pReadyCheckImages[ i ]->SetImage( "swarm/PlayerList/LeaderIcon" );
					}
					else
					{
						m_pReadyCheckImages[ i ]->SetImage( "swarm/HUD/TickBoxEmpty" );
					}
				}
			}

			nMarine++;
		}
	}

	for ( int i = 0; i < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		
	}
}