diff --git a/src/Components/Modules/Voice.cpp b/src/Components/Modules/Voice.cpp index 90714ffd..b05bf8c3 100644 --- a/src/Components/Modules/Voice.cpp +++ b/src/Components/Modules/Voice.cpp @@ -71,7 +71,7 @@ namespace Components SV_SendClientVoiceData(client); } - bool Voice::OnSameTeam(Game::gentity_s* ent1, Game::gentity_s* ent2) + bool Voice::OnSameTeam(const Game::gentity_s* ent1, const Game::gentity_s* ent2) { if (!ent1->client || !ent2->client) { @@ -247,6 +247,12 @@ namespace Components std::memset(s_playerMute, 0, sizeof(s_playerMute)); } + bool Voice::CL_IsPlayerTalking_Hk([[maybe_unused]] Game::SessionData* session, [[maybe_unused]] const int localClientNum, const int talkingClientIndex) + { + // Skip all the Party related code + return Game::Voice_IsClientTalking(talkingClientIndex); + } + bool Voice::CL_IsPlayerMuted_Hk([[maybe_unused]] Game::SessionData* session, [[maybe_unused]] const int localClientNum, const int muteClientIndex) { AssertIn(muteClientIndex, Game::MAX_CLIENTS); @@ -316,7 +322,7 @@ namespace Components } } - void Voice::UI_Mute_player(int clientNum, const int localClientNum) + void Voice::UI_Mute_player(const int clientNum, const int localClientNum) { CL_TogglePlayerMute(localClientNum, Game::sharedUiInfo->playerClientNums[clientNum]); } @@ -351,6 +357,7 @@ namespace Components Utils::Hook(0x5AD945, CL_WriteVoicePacket_Hk, HOOK_CALL).install()->quick(); Utils::Hook(0x5A9E06, CL_VoicePacket_Hk, HOOK_CALL).install()->quick(); + Utils::Hook(0x4AE740, CL_IsPlayerTalking_Hk, HOOK_JUMP).install()->quick(); Utils::Hook(0x4B6250, CL_IsPlayerMuted_Hk, HOOK_JUMP).install()->quick(); Utils::Hook(0x4519F5, SV_SendClientMessages_Stub, HOOK_CALL).install()->quick(); diff --git a/src/Components/Modules/Voice.hpp b/src/Components/Modules/Voice.hpp index d4b02efc..680a7cf9 100644 --- a/src/Components/Modules/Voice.hpp +++ b/src/Components/Modules/Voice.hpp @@ -24,7 +24,7 @@ namespace Components static void SV_SendClientVoiceData(Game::client_t* client); static void SV_SendClientMessages_Stub(Game::client_t* client, Game::msg_t* msg, unsigned char* snapshotMsgBuf); - static bool OnSameTeam(Game::gentity_s* ent1, Game::gentity_s* ent2); + static bool OnSameTeam(const Game::gentity_s* ent1, const Game::gentity_s* ent2); static void SV_QueueVoicePacket(int talkerNum, int clientNum, Game::VoicePacket_t* voicePacket); static void G_BroadcastVoice(Game::gentity_s* talker, Game::VoicePacket_t* voicePacket); static void SV_UserVoice(Game::client_t* cl, Game::msg_t* msg); @@ -32,6 +32,7 @@ namespace Components static void SV_VoicePacket(Game::netadr_t from, Game::msg_t* msg); static void CL_ClearMutedList(); + static bool CL_IsPlayerTalking_Hk(Game::SessionData* session, int localClientNum, int talkingClientIndex); 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); diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index bf513541..32a75199 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -486,7 +486,9 @@ namespace Game I_strncpyz_t I_strncpyz = I_strncpyz_t(0x4D6F80); XNAddrToString_t XNAddrToString = XNAddrToString_t(0x452690); + Voice_IncomingVoiceData_t Voice_IncomingVoiceData = Voice_IncomingVoiceData_t(0x5001A0); + Voice_IsClientTalking_t Voice_IsClientTalking = Voice_IsClientTalking_t(0x4D9D20); XAssetHeader* DB_XAssetPool = reinterpret_cast(0x7998A8); unsigned int* g_poolSize = reinterpret_cast(0x7995E8); diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index 7d4f09fa..332062e9 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -1176,6 +1176,9 @@ namespace Game typedef int(__cdecl * Voice_IncomingVoiceData_t)(const SessionData* session, int clientNum, unsigned char* data, int size); extern Voice_IncomingVoiceData_t Voice_IncomingVoiceData; + typedef bool(__cdecl * Voice_IsClientTalking_t)(int clientNum); + extern Voice_IsClientTalking_t Voice_IsClientTalking; + constexpr std::size_t STATIC_MAX_LOCAL_CLIENTS = 1; constexpr std::size_t MAX_LOCAL_CLIENTS = 1; constexpr std::size_t MAX_CLIENTS = 18;