More fixes to KILLMSGTEAM

This commit is contained in:
furo 2023-11-23 11:57:35 +01:00
parent 6fc27bea8c
commit 04c5c6a5d6
3 changed files with 47 additions and 0 deletions

View file

@ -628,6 +628,20 @@ void CGhost::OnMessage(int MsgType, void *pRawMsg)
m_LastDeathTick = Client()->GameTick(g_Config.m_ClDummy);
}
}
else if(MsgType == NETMSGTYPE_SV_KILLMSGTEAM)
{
CNetMsg_Sv_KillMsgTeam *pMsg = (CNetMsg_Sv_KillMsgTeam *)pRawMsg;
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(m_pClient->m_Teams.Team(i) == pMsg->m_Team && i == m_pClient->m_Snap.m_LocalClientID)
{
if(m_Recording)
StopRecord();
StopRender();
m_LastDeathTick = Client()->GameTick(g_Config.m_ClDummy);
}
}
}
else if(MsgType == NETMSGTYPE_SV_CHAT)
{
CNetMsg_Sv_Chat *pMsg = (CNetMsg_Sv_Chat *)pRawMsg;

View file

@ -135,6 +135,15 @@ void CRaceDemo::OnMessage(int MsgType, void *pRawMsg)
if(pMsg->m_Victim == m_pClient->m_Snap.m_LocalClientID && Client()->RaceRecord_IsRecording())
StopRecord(m_Time);
}
else if(MsgType == NETMSGTYPE_SV_KILLMSGTEAM)
{
CNetMsg_Sv_KillMsgTeam *pMsg = (CNetMsg_Sv_KillMsgTeam *)pRawMsg;
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(m_pClient->m_Teams.Team(i) == pMsg->m_Team && i == m_pClient->m_Snap.m_LocalClientID && Client()->RaceRecord_IsRecording())
StopRecord(m_Time);
}
}
else if(MsgType == NETMSGTYPE_SV_CHAT)
{
CNetMsg_Sv_Chat *pMsg = (CNetMsg_Sv_Chat *)pRawMsg;

View file

@ -934,6 +934,30 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, int Conn, bool Dumm
}
}
}
else if(MsgId == NETMSGTYPE_SV_KILLMSGTEAM)
{
CNetMsg_Sv_KillMsgTeam *pMsg = (CNetMsg_Sv_KillMsgTeam *)pRawMsg;
// reset prediction
std::vector<std::pair<int, int>> vStrongWeakSorted;
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(m_Teams.Team(i) == pMsg->m_Team)
{
if(CCharacter *pChar = m_GameWorld.GetCharacterByID(i))
{
pChar->ResetPrediction();
vStrongWeakSorted.emplace_back(i, pMsg->m_First == i ? MAX_CLIENTS : pChar ? pChar->GetStrongWeakID() : 0);
}
m_GameWorld.ReleaseHooked(i);
}
}
std::stable_sort(vStrongWeakSorted.begin(), vStrongWeakSorted.end(), [](auto &Left, auto &Right) { return Left.second > Right.second; });
for(auto ID : vStrongWeakSorted)
{
m_CharOrder.GiveWeak(ID.first);
}
}
}
void CGameClient::OnStateChange(int NewState, int OldState)