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