Added VOICE_TEAM and VOICE_LISTENTEAM flags to the SDKTools voice functionality.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401474
This commit is contained in:
Michael McKoy 2007-09-23 21:01:07 +00:00
parent 7df54ec38d
commit e4728b0413
2 changed files with 24 additions and 8 deletions

View File

@ -35,6 +35,8 @@
#define SPEAK_MUTED 1
#define SPEAK_ALL 2
#define SPEAK_LISTENALL 4
#define SPEAK_TEAM 8
#define SPEAK_LISTENTEAM 16
size_t g_VoiceFlags[65];
size_t g_VoiceFlagsCount = 0;
@ -48,14 +50,26 @@ bool SDKTools::OnSetClientListening(int iReceiver, int iSender, bool bListen)
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, false));
}
if (g_VoiceFlags[iSender] & SPEAK_ALL)
if ((g_VoiceFlags[iSender] & SPEAK_ALL) || (g_VoiceFlags[iReceiver] & SPEAK_LISTENALL))
{
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, true));
}
if (g_VoiceFlags[iReceiver] & SPEAK_LISTENALL)
if ((g_VoiceFlags[iSender] & SPEAK_TEAM) || (g_VoiceFlags[iReceiver] & SPEAK_LISTENTEAM))
{
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, true));
IGamePlayer *pReceiver = playerhelpers->GetGamePlayer(iReceiver);
IGamePlayer *pSender = playerhelpers->GetGamePlayer(iSender);
if (pReceiver && pSender && pReceiver->IsInGame() && pSender->IsInGame())
{
IPlayerInfo *pRInfo = pReceiver->GetPlayerInfo();
IPlayerInfo *pSInfo = pSender->GetPlayerInfo();
if (pRInfo && pSInfo && pRInfo->GetTeamIndex() == pSInfo->GetTeamIndex())
{
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, bListen, &IVoiceServer::SetClientListening, (iReceiver, iSender, true));
}
}
}
RETURN_META_VALUE(MRES_IGNORED, bListen);

View File

@ -39,9 +39,11 @@
* @section voice flags.
*/
#define VOICE_NORMAL 0 /**< Allow the client to listen and speak normally. */
#define VOICE_MUTED 1 /**< Mutes the client from speaking to everyone. */
#define VOICE_MUTED 1 /**< Mutes the client from speaking to everyone. */
#define VOICE_SPEAKALL 2 /**< Allow the client to speak to everyone. */
#define VOICE_LISTENALL 4 /**< Allow the client to listen to everyone. */
#define VOICE_TEAM 8 /**< Allow the client to always speak to team, even when dead. */
#define VOICE_LISTENTEAM 16 /**< Allow the client to always hear teammates, including dead ones. */
/**
* @endsection