Merge pull request #428 from diamante0018/develop

[Voice] Clear muted list when dc
This commit is contained in:
Edo 2022-08-14 13:41:42 +02:00 committed by GitHub
commit 7dd3a6b290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -242,6 +242,11 @@ namespace Components
}
}
void Voice::CL_ClearMutedList()
{
std::memset(s_playerMute, 0, sizeof(s_playerMute));
}
bool Voice::CL_IsPlayerMuted_Hk([[maybe_unused]] Game::SessionData* session, [[maybe_unused]] const int localClientNum, const int muteClientIndex)
{
AssertIn(muteClientIndex, Game::MAX_CLIENTS);
@ -312,12 +317,9 @@ namespace Components
}
void Voice::UI_Mute_player(int clientNum, const int localClientNum)
{
if (Game::cgArray->clientNum != Game::sharedUiInfo->playerClientNums[clientNum])
{
CL_TogglePlayerMute(localClientNum, Game::sharedUiInfo->playerClientNums[clientNum]);
}
}
__declspec(naked) void Voice::UI_Mute_Player_Stub()
{
@ -342,6 +344,8 @@ namespace Components
std::memset(voicePacketCount, 0, sizeof(voicePacketCount));
std::memset(s_playerMute, 0, sizeof(s_playerMute));
Events::OnSteamDisconnect(CL_ClearMutedList);
// Write voice packets to the server instead of other clients
Utils::Hook(0x487935, CL_WriteVoicePacket_Hk, HOOK_CALL).install()->quick();
Utils::Hook(0x5AD945, CL_WriteVoicePacket_Hk, HOOK_CALL).install()->quick();

View File

@ -31,6 +31,7 @@ namespace Components
static void SV_PreGameUserVoice(Game::client_t* cl, Game::msg_t* msg);
static void SV_VoicePacket(Game::netadr_t from, Game::msg_t* msg);
static void CL_ClearMutedList();
static bool CL_IsPlayerMuted_Hk(Game::SessionData* session, int localClientNum, int muteClientIndex);
static void CL_MutePlayer_Hk(Game::SessionData* session, int muteClientIndex);
static void Voice_UnmuteMember_Hk(Game::SessionData* session, int clientNum);