From 46c5344d7149cffc06cf920486d476fb653fb22c Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Wed, 18 Sep 2024 16:43:18 +0800 Subject: [PATCH] Fix 0.7 client team colors (Closed #8977) --- src/game/client/gameclient.cpp | 19 ++++++++++--------- src/game/client/gameclient.h | 2 +- src/game/client/sixup_translate_game.cpp | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index b47921ccb..2def08d9a 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1565,7 +1565,7 @@ void CGameClient::OnNewSnapshot() pClient->m_SkinInfo.m_ColorFeet = ColorRGBA(1, 1, 1); } - pClient->UpdateRenderInfo(IsTeamPlay(), g_Config.m_ClDummy); + pClient->UpdateRenderInfo(IsTeamPlay()); } } else if(Item.m_Type == NETOBJTYPE_PLAYERINFO) @@ -2388,7 +2388,7 @@ void CGameClient::CClientStats::Reset() m_FlagCaptures = 0; } -void CGameClient::CClientData::UpdateRenderInfo(bool IsTeamPlay, int Conn) +void CGameClient::CClientData::UpdateRenderInfo(bool IsTeamPlay) { m_RenderInfo = m_SkinInfo; @@ -2403,6 +2403,7 @@ void CGameClient::CClientData::UpdateRenderInfo(bool IsTeamPlay, int Conn) m_RenderInfo.m_ColorFeet = color_cast(ColorHSLA(aTeamColors[m_Team])); // 0.7 + for(auto &Sixup : m_RenderInfo.m_aSixup) { const ColorRGBA aTeamColorsSixup[2] = { ColorRGBA(0.753f, 0.318f, 0.318f, 1.0f), @@ -2410,19 +2411,20 @@ void CGameClient::CClientData::UpdateRenderInfo(bool IsTeamPlay, int Conn) const ColorRGBA aMarkingColorsSixup[2] = { ColorRGBA(0.824f, 0.345f, 0.345f, 1.0f), ColorRGBA(0.345f, 0.514f, 0.824f, 1.0f)}; - float MarkingAlpha = m_RenderInfo.m_aSixup[Conn].m_aColors[protocol7::SKINPART_MARKING].a; - for(auto &Color : m_RenderInfo.m_aSixup[Conn].m_aColors) + float MarkingAlpha = Sixup.m_aColors[protocol7::SKINPART_MARKING].a; + for(auto &Color : Sixup.m_aColors) Color = aTeamColorsSixup[m_Team]; if(MarkingAlpha > 0.1f) - m_RenderInfo.m_aSixup[Conn].m_aColors[protocol7::SKINPART_MARKING] = aMarkingColorsSixup[m_Team]; + Sixup.m_aColors[protocol7::SKINPART_MARKING] = aMarkingColorsSixup[m_Team]; } } else { m_RenderInfo.m_ColorBody = color_cast(ColorHSLA(12829350)); m_RenderInfo.m_ColorFeet = color_cast(ColorHSLA(12829350)); - for(auto &Color : m_RenderInfo.m_aSixup[Conn].m_aColors) - Color = color_cast(ColorHSLA(12829350)); + for(auto &Sixup : m_RenderInfo.m_aSixup) + for(auto &Color : Sixup.m_aColors) + Color = color_cast(ColorHSLA(12829350)); } } } @@ -3757,8 +3759,7 @@ void CGameClient::RefreshSkins() Client.m_SkinInfo.m_OriginalRenderSkin.Reset(); Client.m_SkinInfo.m_ColorableRenderSkin.Reset(); } - for(int Dummy = 0; Dummy < NUM_DUMMIES; Dummy++) - Client.UpdateRenderInfo(IsTeamPlay(), Dummy); + Client.UpdateRenderInfo(IsTeamPlay()); } for(auto &pComponent : m_vpAll) diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 175c0d414..bf0f9071d 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -438,7 +438,7 @@ public: bool m_SpecCharPresent; vec2 m_SpecChar; - void UpdateRenderInfo(bool IsTeamPlay, int Conn); + void UpdateRenderInfo(bool IsTeamPlay); void Reset(); class CSixup diff --git a/src/game/client/sixup_translate_game.cpp b/src/game/client/sixup_translate_game.cpp index f83f1604d..195d55b9e 100644 --- a/src/game/client/sixup_translate_game.cpp +++ b/src/game/client/sixup_translate_game.cpp @@ -196,7 +196,7 @@ void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn) { m_aClients[pMsg7->m_ClientId].m_Team = pMsg7->m_Team; m_pClient->m_TranslationContext.m_aClients[pMsg7->m_ClientId].m_Team = pMsg7->m_Team; - m_aClients[pMsg7->m_ClientId].UpdateRenderInfo(IsTeamPlay(), Conn); + m_aClients[pMsg7->m_ClientId].UpdateRenderInfo(IsTeamPlay()); // if(pMsg7->m_ClientId == m_LocalClientId) // {