game_shared/voice_status.cpp
303132333435
#include "cdll_int.h"
#include
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
303132333435363738
#include "cdll_int.h"
#include
#include "c_ff_player.h"
#include "ff_gamerules.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
212213214215216217218
if ( !pClient || pClient->IsDormant() )
continue;
C_BasePlayer *pPlayer = dynamic_cast(pClient);
if( !pPlayer )
continue;
215216217218219220221
if ( !pClient || pClient->IsDormant() )
continue;
C_FFPlayer *pPlayer = dynamic_cast(pClient);
if( !pPlayer )
continue;
219220221222223224225
// Don't show an icon for dead or spectating players (ie: invisible entities).
if( pPlayer->IsPlayerDead() )
continue;
// Place it 20 units above his head.
Vector vOrigin = pPlayer->WorldSpaceCenter();
vOrigin.z += g_flHeadOffset;
222223224225226227228229230231232233234235236
// Don't show an icon for dead or spectating players (ie: invisible entities).
if( pPlayer->IsPlayerDead() )
continue;
C_FFPlayer *pLocalPlayer = dynamic_cast(C_BasePlayer::GetLocalPlayer());
if( !pLocalPlayer )
continue;
// Don't show an icon for cloaked enemies
if ( pPlayer->IsCloaked() && ( FFGameRules()->PlayerRelationship( pPlayer, pLocalPlayer ) == GR_NOTTEAMMATE ) )
continue;
// Place it 20 units above his head.
Vector vOrigin = pPlayer->WorldSpaceCenter();
vOrigin.z += g_flHeadOffset;
309310311312313314315
}
}
void CVoiceStatus::UpdateServerState(bool bForce)
{
// Can't do anything when we're not in a level.
320321322323324325326327328329330331332333334335336337338339340341342343344345
}
}
int CVoiceStatus::GetSpeakerStatus(int entindex)
{
player_info_t pi;
if ( !engine->GetPlayerInfo( entindex, &pi ) )
return 0;
bool bTalking = !!m_VoicePlayers[entindex];
bool bBanned = m_BanMgr.GetPlayerBan(pi.guid);
bool bNeverSpoken = !m_VoiceEnabledPlayers[entindex];
if (bBanned)
return VOICE_BANNED;
else if (bTalking)
return VOICE_TALKING;
else if (bNeverSpoken)
return VOICE_NEVERSPOKEN;
else
return VOICE_NOTTALKING;
}
void CVoiceStatus::UpdateServerState(bool bForce)
{
// Can't do anything when we're not in a level.
539540541542543544545
Msg("CVoiceStatus::SetPlayerBlockedState: setting player %d ban to %d\n", iPlayer, !m_BanMgr.GetPlayerBan(pi.guid));
}
m_BanMgr.SetPlayerBan(pi.guid, !m_BanMgr.GetPlayerBan(pi.guid));
UpdateServerState(false);
}
}
569570571572573574575576577578579
Msg("CVoiceStatus::SetPlayerBlockedState: setting player %d ban to %d\n", iPlayer, !m_BanMgr.GetPlayerBan(pi.guid));
}
// --> Mirv: What the hell, a toggle??
// m_BanMgr.SetPlayerBan(pi.guid, !m_BanMgr.GetPlayerBan(pi.guid));
m_BanMgr.SetPlayerBan(pi.guid, blocked);
// <-- Mirv: What the hell, a toggle??
UpdateServerState(false);
}
}