Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.9 KiB

9 years ago
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#pragma once
3 years ago
#if !defined(VOICE_GAMEMGR_H)
#define VOICE_GAMEMGR_H
9 years ago
#include "voice_common.h"
class CGameRules;
class CBasePlayer;
class IVoiceGameMgrHelper
{
public:
8 years ago
virtual ~IVoiceGameMgrHelper() {}
9 years ago
// Called each frame to determine which players are allowed to hear each other. This overrides
// whatever squelch settings players have.
8 years ago
virtual bool CanPlayerHearPlayer( CBasePlayer *pListener, CBasePlayer *pTalker ) = 0;
9 years ago
};
// CVoiceGameMgr manages which clients can hear which other clients.
class CVoiceGameMgr
{
public:
8 years ago
CVoiceGameMgr();
virtual ~CVoiceGameMgr();
bool Init( IVoiceGameMgrHelper *m_pHelper, int maxClients );
9 years ago
8 years ago
void SetHelper( IVoiceGameMgrHelper *pHelper );
9 years ago
// Updates which players can hear which other players.
// If gameplay mode is DM, then only players within the PVS can hear each other.
// If gameplay mode is teamplay, then only players on the same team can hear each other.
// Player masks are always applied.
8 years ago
void Update( double frametime );
9 years ago
// Called when a new client connects (unsquelches its entity for everyone).
8 years ago
void ClientConnected( struct edict_s *pEdict );
9 years ago
// Called on ClientCommand. Checks for the squelch and unsquelch commands.
// Returns true if it handled the command.
8 years ago
bool ClientCommand( CBasePlayer *pPlayer, const char *cmd );
9 years ago
// Called to determine if the Receiver has muted (blocked) the Sender
// Returns true if the receiver has blocked the sender
8 years ago
bool PlayerHasBlockedPlayer( CBasePlayer *pReceiver, CBasePlayer *pSender );
9 years ago
private:
// Force it to update the client masks.
8 years ago
void UpdateMasks();
9 years ago
private:
8 years ago
int m_msgPlayerVoiceMask;
int m_msgRequestState;
9 years ago
8 years ago
IVoiceGameMgrHelper *m_pHelper;
int m_nMaxPlayers;
double m_UpdateInterval; // How long since the last update.
9 years ago
};
#endif // VOICE_GAMEMGR_H