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.

81 lines
2.0 KiB

//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
9 years ago
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#pragma once
#ifndef VOICE_GAMEMGR_H
3 years ago
#define VOICE_GAMEMGR_H
9 years ago
#ifdef _WIN32
#endif
9 years ago
#include "voice_common.h"
9 years ago
class CGameRules;
class CBasePlayer;
9 years ago
class IVoiceGameMgrHelper
{
public:
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.
virtual bool CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pTalker) = 0;
9 years ago
};
9 years ago
// CVoiceGameMgr manages which clients can hear which other clients.
class CVoiceGameMgr
{
public:
CVoiceGameMgr();
virtual ~CVoiceGameMgr();
bool Init(
IVoiceGameMgrHelper *m_pHelper,
int maxClients
);
9 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.
void Update(double frametime);
9 years ago
// Called when a new client connects (unsquelches its entity for everyone).
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.
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
bool PlayerHasBlockedPlayer(CBasePlayer *pReceiver, CBasePlayer *pSender);
9 years ago
private:
9 years ago
// Force it to update the client masks.
void UpdateMasks();
9 years ago
int m_msgPlayerVoiceMask;
int m_msgRequestState;
IVoiceGameMgrHelper *m_pHelper;
int m_nMaxPlayers;
double m_UpdateInterval; // How long since the last update.
9 years ago
};
9 years ago
#endif // VOICE_GAMEMGR_H