Пример #1
0
//-----------------------------------------------------------------------------
// Name: IsMuted
// Desc: Returns whether or not the specificed player is muted by the current
//		 player. This works for anyone, not just people in the current game, so
//		 the friends UI can use it.
//-----------------------------------------------------------------------------
bool CVoiceManager::IsMuted( XUID xuid )
{
	for( int i = 0; i < m_MuteListSize; ++i )
	{
		if( XOnlineAreUsersIdentical( &xuid, &m_MuteList[i].xuid ) )
			return true;
	}

	return false;
}
Пример #2
0
//-----------------------------------------------------------------------------
// Name: SetMute
// Desc: Sets the mute state for the given user to the specified state.
//		 Updates XHV, and also our user's global mute list (if logged on).
//-----------------------------------------------------------------------------
void CVoiceManager::SetMute( XUID xuid, BOOL bMuted )
{
	// First, set the mute state in XHV
	m_XHVVoiceManager.SetMute( xuid, IN_GetMainController(), bMuted );

	// If we're logged on, we need to update our global list
	if( logged_on )
	{
		// Make the change to our mutelist
		if( bMuted )
			XOnlineMutelistAdd( IN_GetMainController(), xuid );
		else
			XOnlineMutelistRemove( IN_GetMainController(), xuid );

		// Signal that we've made a change. This forces Tick() to refresh
		// our list, just in case.
		m_MuteState = MUTE_WORKING;
	}

	// If the user is in our game currently, send them a message:
	int idx;
	for( idx = 0; idx < MAX_ONLINE_PLAYERS; ++idx )
	{
		if( xbOnlineInfo.xbPlayerList[idx].isActive &&
			XOnlineAreUsersIdentical( &xuid, &xbOnlineInfo.xbPlayerList[idx].xuid ) )
			break;
	}

	// If they're not in the game, nothing else to do
	if( idx == MAX_ONLINE_PLAYERS )
		return;

	// Update our flags, and let the other person know:
	XBPlayerInfo *plyrInfo = &xbOnlineInfo.xbPlayerList[idx];
	if( bMuted )
	{
		plyrInfo->flags |= MUTED_PLAYER;
		SendVoiceInfo( VOICEINFO_ADDREMOTEMUTE, plyrInfo );
	}
	else
	{
		plyrInfo->flags &= ~(MUTED_PLAYER);
		SendVoiceInfo( VOICEINFO_REMOVEREMOTEMUTE, plyrInfo );
	}

	return;
}
Пример #3
0
//-----------------------------------------------------------------------------
// Name: FindPlayerVoiceInfo
// Desc: Helper function to find an entry in the player voice info list
//-----------------------------------------------------------------------------
HRESULT CXHVVoiceManager::FindPlayerVoiceInfo( XUID xuidRemoteTalker, DWORD* pdwEntry )
{
    for( DWORD i = 0; i < m_dwNumRemoteTalkers; i++ )
    {
        if( XOnlineAreUsersIdentical( &m_pPlayerVoiceInfo[i].xuid,
                                      &xuidRemoteTalker ) )
        {
            if( pdwEntry )
            {
                *pdwEntry = i;
            }
            return S_OK;
        }
    }

    return E_FAIL;
}
Пример #4
0
//-----------------------------------------------------------------------------
// Name: OnPlayerJoined 
// Desc: Called whenever someone is going to start sending or receiving chat.
//		 Originally intended for first-join only, but now it re-checks mute
//		 lists and such as well.
//-----------------------------------------------------------------------------
HRESULT CVoiceManager::OnPlayerJoined( XBPlayerInfo *plyrInfo )
{
	// Register the new player with XHV
	m_XHVVoiceManager.RegisterRemoteTalker( plyrInfo->xuid );

	// VVFIXME - fancier priority scheme needed!
	m_XHVVoiceManager.SetRemoteTalkerPriority( plyrInfo->xuid, IN_GetMainController(), XHV_PLAYBACK_PRIORITY_MAX );

	// Scan for the player in our mute list
	for( int i = 0; i < m_MuteListSize; ++i )
	{
		if( XOnlineAreUsersIdentical( &m_MuteList[i].xuid, &plyrInfo->xuid ) )
		{
			// OK. We don't like this person. Mark them muted, and tell them.
			plyrInfo->flags |= MUTED_PLAYER;
			m_XHVVoiceManager.SetMute( plyrInfo->xuid, IN_GetMainController(), TRUE );
			SendVoiceInfo( VOICEINFO_ADDREMOTEMUTE, plyrInfo );
			break;
		}
	}

	return S_OK;
}