Пример #1
0
const char* CASW_Briefing::GetLeaderName()
{
	if ( !ASWGameResource() )
		return "";

	C_ASW_Player *pLeader = ASWGameResource()->GetLeader();
	if ( !pLeader )
		return "";

	return pLeader->GetPlayerName();
}
Пример #2
0
wchar_t* CASW_Briefing::GetMarineOrPlayerName( int nLobbySlot )
{
	if ( nLobbySlot < 0 || nLobbySlot >= NUM_BRIEFING_LOBBY_SLOTS || !IsLobbySlotOccupied( nLobbySlot ) )
		return L"";

	int nMarineResourceIndex = LobbySlotToMarineResourceIndex( nLobbySlot );
	C_ASW_Marine_Resource *pMR = ASWGameResource() ? ASWGameResource()->GetMarineResource( nMarineResourceIndex ) : NULL;

	bool bUsePlayerName = ( pMR == NULL );

	if ( pMR )
	{
		C_ASW_Player *pPlayer = m_LobbySlotMapping[ nLobbySlot ].m_hPlayer.Get();
		C_ASW_Marine_Resource *pFirstMR = pPlayer ? ASWGameResource()->GetFirstMarineResourceForPlayer( pPlayer ) : NULL;

		if ( pFirstMR == pMR )
		{
			bUsePlayerName = true;
		}
	}
	else if ( !bUsePlayerName )
	{
		// no marine and no player name to use, return blank
		return L"";
	}

	
	static wchar_t wszMarineNameResult[ 32 ];

	// if it's their first marine, show the commander name instead
	if ( bUsePlayerName )
	{		
		C_ASW_Player *pPlayer = m_LobbySlotMapping[ nLobbySlot ].m_hPlayer.Get();
		if ( !pPlayer )
			return L"";

		const char *pszPlayerName = pPlayer->GetPlayerName();
		g_pVGuiLocalize->ConvertANSIToUnicode( pszPlayerName ? pszPlayerName : "", wszMarineNameResult, sizeof( wszMarineNameResult ) );
		return wszMarineNameResult;
	}
	
	pMR->GetDisplayName( wszMarineNameResult, sizeof( wszMarineNameResult ) );
	return wszMarineNameResult;
}
Пример #3
0
const char* CASW_Briefing::GetPlayerNameForMarineProfile( int nProfileIndex )
{
	for ( int i = 0; i < ASWGameResource()->GetMaxMarineResources(); i++ )
	{
		C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( i );
		if ( !pMR )
			continue;

		if ( pMR->GetProfileIndex() == nProfileIndex )
		{
			C_ASW_Player *pPlayer = pMR->GetCommander();
			if ( pPlayer )
			{
				return pPlayer->GetPlayerName();
			}
			break;
		}
	}
	return "";
}