Ejemplo n.º 1
0
wchar_t* CASW_Briefing::GetMarineName( 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;
	if ( !pMR )
		return L"";

	static wchar_t wszMarineNameResult[ 32 ];	

	pMR->GetDisplayName( wszMarineNameResult, sizeof( wszMarineNameResult ) );
	return wszMarineNameResult;
}
Ejemplo n.º 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;
}