mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-13 23:28:04 +03:00
Move sv_alltalk 1.0 to CanPlayerHearPlayer
This commit is contained in:
parent
a7bdaa011a
commit
60b6cf9160
@ -89,19 +89,21 @@ LINK_HOOK_CLASS_CUSTOM_CHAIN(bool, CCStrikeGameMgrHelper, CSGameRules, CanPlayer
|
||||
|
||||
bool CCStrikeGameMgrHelper::__API_HOOK(CanPlayerHearPlayer)(CBasePlayer *pListener, CBasePlayer *pSender)
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
switch ((int)sv_alltalk.value)
|
||||
{
|
||||
case 1: // allows everyone to talk
|
||||
return true;
|
||||
#ifdef REGAMEDLL_ADD
|
||||
case 2:
|
||||
return (pListener->m_iTeam == pSender->m_iTeam);
|
||||
case 3:
|
||||
return (pListener->m_iTeam == pSender->m_iTeam || pListener->IsObserver());
|
||||
case 4:
|
||||
return (pListener->IsAlive() == pSender->IsAlive() || pSender->IsAlive());
|
||||
default: // HLDS Behavior
|
||||
default: // Default behavior
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
|
@ -161,26 +161,23 @@ void CVoiceGameMgr::UpdateMasks()
|
||||
{
|
||||
m_UpdateInterval = 0;
|
||||
|
||||
bool bAllTalk = sv_alltalk.value == 1.0f;
|
||||
|
||||
for (int iClient = 0; iClient < m_nMaxPlayers; iClient++)
|
||||
{
|
||||
CBaseEntity *pEnt = UTIL_PlayerByIndex(iClient + 1);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(iClient + 1);
|
||||
|
||||
if (!pEnt
|
||||
if (!pPlayer
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
|| !pEnt->IsPlayer()
|
||||
|| !pPlayer->IsPlayer()
|
||||
#endif
|
||||
)
|
||||
continue;
|
||||
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEnt);
|
||||
CPlayerBitVec gameRulesMask;
|
||||
|
||||
// Request the state of their "VModEnable" cvar.
|
||||
if (g_bWantModEnable[iClient])
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, m_msgRequestState, nullptr, pEnt->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, m_msgRequestState, nullptr, pPlayer->pev);
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
@ -189,8 +186,8 @@ void CVoiceGameMgr::UpdateMasks()
|
||||
// Build a mask of who they can hear based on the game rules.
|
||||
for (int iOtherClient = 0; iOtherClient < m_nMaxPlayers; iOtherClient++)
|
||||
{
|
||||
CBaseEntity *pEnt = UTIL_PlayerByIndex(iOtherClient + 1);
|
||||
if (pEnt && (bAllTalk || m_pHelper->CanPlayerHearPlayer(pPlayer, (CBasePlayer *)pEnt)))
|
||||
CBasePlayer *pSender = UTIL_PlayerByIndex(iOtherClient + 1);
|
||||
if (pSender && m_pHelper->CanPlayerHearPlayer(pPlayer, pSender))
|
||||
{
|
||||
gameRulesMask[iOtherClient] = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user