diff --git a/CMakeLists.txt b/CMakeLists.txt index 8df543c78..acf1ccf7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2127,6 +2127,7 @@ set_src(ENGINE_SHARED GLOB_RECURSE src/engine/shared teehistorian_ex.cpp teehistorian_ex.h teehistorian_ex_chunks.h + translation_context.cpp translation_context.h uuid_manager.cpp uuid_manager.h diff --git a/src/engine/shared/translation_context.cpp b/src/engine/shared/translation_context.cpp new file mode 100644 index 000000000..0214f2c22 --- /dev/null +++ b/src/engine/shared/translation_context.cpp @@ -0,0 +1,38 @@ +#include + +#include "translation_context.h" + +void CTranslationContext::Reset() +{ + m_ServerSettings.Reset(); + + std::fill(std::begin(m_apPlayerInfosRace), std::end(m_apPlayerInfosRace), nullptr); + + for(CClientData &Client : m_aClients) + Client.Reset(); + + std::fill(std::begin(m_aDamageTaken), std::end(m_aDamageTaken), 0); + std::fill(std::begin(m_aDamageTakenTick), std::end(m_aDamageTakenTick), 0); + std::fill(std::begin(m_aLocalClientId), std::end(m_aLocalClientId), -1); + + m_ShouldSendGameInfo = false; + m_GameStateFlags7 = 0; + + m_GameFlags = 0; + m_ScoreLimit = 0; + m_TimeLimit = 0; + m_MatchNum = 0; + m_MatchCurrent = 0; + + m_MapdownloadTotalsize = -1; + m_MapDownloadChunkSize = 0; + m_MapDownloadChunksPerRequest = 0; + + m_FlagCarrierBlue = 0; + m_FlagCarrierRed = 0; + m_TeamscoreRed = 0; + m_TeamscoreBlue = 0; + + m_GameStartTick7 = 0; + m_GameStateEndTick7 = 0; +} diff --git a/src/engine/shared/translation_context.h b/src/engine/shared/translation_context.h index 53d9cdbb9..7c574955b 100644 --- a/src/engine/shared/translation_context.h +++ b/src/engine/shared/translation_context.h @@ -1,7 +1,6 @@ #ifndef ENGINE_SHARED_TRANSLATION_CONTEXT_H #define ENGINE_SHARED_TRANSLATION_CONTEXT_H -#include #include #include @@ -15,23 +14,7 @@ public: Reset(); } - void Reset() - { - for(int &LocalClientId : m_aLocalClientId) - LocalClientId = -1; - m_ShouldSendGameInfo = false; - m_GameFlags = 0; - m_ScoreLimit = 0; - m_TimeLimit = 0; - m_MatchNum = 0; - m_MatchCurrent = 0; - mem_zero(m_aDamageTaken, sizeof(m_aDamageTaken)); - mem_zero(m_aDamageTakenTick, sizeof(m_aDamageTakenTick)); - m_FlagCarrierBlue = 0; - m_FlagCarrierRed = 0; - m_TeamscoreRed = 0; - m_TeamscoreBlue = 0; - } + void Reset(); // this class is not used // it could be used in the in game menu @@ -42,12 +25,28 @@ public: class CServerSettings { public: - bool m_KickVote = false; - int m_KickMin = 0; - bool m_SpecVote = false; - bool m_TeamLock = false; - bool m_TeamBalance = false; - int m_PlayerSlots = 0; + bool m_KickVote; + int m_KickMin; + bool m_SpecVote; + bool m_TeamLock; + bool m_TeamBalance; + int m_PlayerSlots; + + CServerSettings() + { + Reset(); + } + + void Reset() + { + m_KickVote = false; + m_KickMin = 0; + m_SpecVote = false; + m_TeamLock = false; + m_TeamBalance = false; + m_PlayerSlots = 0; + } + } m_ServerSettings; class CClientData diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 7b79c3b68..1ca2c8e08 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -823,14 +823,14 @@ void CChat::AddLine(int ClientId, int Team, const char *pLine) { for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++) { - const char *pPartName = LineAuthor.m_Sixup[g_Config.m_ClDummy].m_aaSkinPartNames[Part]; + const char *pPartName = LineAuthor.m_aSixup[g_Config.m_ClDummy].m_aaSkinPartNames[Part]; int Id = m_pClient->m_Skins7.FindSkinPart(Part, pPartName, false); const CSkins7::CSkinPart *pSkinPart = m_pClient->m_Skins7.GetSkinPart(Part, Id); - if(LineAuthor.m_Sixup[g_Config.m_ClDummy].m_aUseCustomColors[Part]) + if(LineAuthor.m_aSixup[g_Config.m_ClDummy].m_aUseCustomColors[Part]) { pCurrentLine->m_Sixup.m_aTextures[Part] = pSkinPart->m_ColorTexture; pCurrentLine->m_Sixup.m_aColors[Part] = m_pClient->m_Skins7.GetColor( - LineAuthor.m_Sixup[g_Config.m_ClDummy].m_aSkinPartColors[Part], + LineAuthor.m_aSixup[g_Config.m_ClDummy].m_aSkinPartColors[Part], Part == protocol7::SKINPART_MARKING); } else @@ -839,13 +839,13 @@ void CChat::AddLine(int ClientId, int Team, const char *pLine) pCurrentLine->m_Sixup.m_aColors[Part] = vec4(1.0f, 1.0f, 1.0f, 1.0f); } - if(LineAuthor.m_SkinInfo.m_Sixup[g_Config.m_ClDummy].m_HatTexture.IsValid()) + if(LineAuthor.m_SkinInfo.m_aSixup[g_Config.m_ClDummy].m_HatTexture.IsValid()) { if(Part == protocol7::SKINPART_BODY && str_comp(pPartName, "standard")) pCurrentLine->m_Sixup.m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM); if(Part == protocol7::SKINPART_DECORATION && str_comp(pPartName, "twinbopp")) pCurrentLine->m_Sixup.m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM); - pCurrentLine->m_Sixup.m_HatTexture = LineAuthor.m_SkinInfo.m_Sixup[g_Config.m_ClDummy].m_HatTexture; + pCurrentLine->m_Sixup.m_HatTexture = LineAuthor.m_SkinInfo.m_aSixup[g_Config.m_ClDummy].m_HatTexture; } } } @@ -1303,10 +1303,10 @@ void CChat::OnRender() { for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++) { - RenderInfo.m_Sixup[g_Config.m_ClDummy].m_aColors[Part] = Line.m_Sixup.m_aColors[Part]; - RenderInfo.m_Sixup[g_Config.m_ClDummy].m_aTextures[Part] = Line.m_Sixup.m_aTextures[Part]; - RenderInfo.m_Sixup[g_Config.m_ClDummy].m_HatSpriteIndex = Line.m_Sixup.m_HatSpriteIndex; - RenderInfo.m_Sixup[g_Config.m_ClDummy].m_HatTexture = Line.m_Sixup.m_HatTexture; + RenderInfo.m_aSixup[g_Config.m_ClDummy].m_aColors[Part] = Line.m_Sixup.m_aColors[Part]; + RenderInfo.m_aSixup[g_Config.m_ClDummy].m_aTextures[Part] = Line.m_Sixup.m_aTextures[Part]; + RenderInfo.m_aSixup[g_Config.m_ClDummy].m_HatSpriteIndex = Line.m_Sixup.m_HatSpriteIndex; + RenderInfo.m_aSixup[g_Config.m_ClDummy].m_HatTexture = Line.m_Sixup.m_HatTexture; } } diff --git a/src/game/client/components/menus_settings7.cpp b/src/game/client/components/menus_settings7.cpp index 5c6af0577..c305e897b 100644 --- a/src/game/client/components/menus_settings7.cpp +++ b/src/game/client/components/menus_settings7.cpp @@ -115,13 +115,13 @@ void CMenus::RenderSettingsTee7(CUIRect MainView) const CSkins7::CSkinPart *pSkinPart = m_pClient->m_Skins7.GetSkinPart(Part, SkinPart); if(aUCCVars[Part]) { - OwnSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aTextures[Part] = pSkinPart->m_ColorTexture; - OwnSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aColors[Part] = m_pClient->m_Skins7.GetColor(aColorVars[Part], Part == protocol7::SKINPART_MARKING); + OwnSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aTextures[Part] = pSkinPart->m_ColorTexture; + OwnSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aColors[Part] = m_pClient->m_Skins7.GetColor(aColorVars[Part], Part == protocol7::SKINPART_MARKING); } else { - OwnSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aTextures[Part] = pSkinPart->m_OrgTexture; - OwnSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aColors[Part] = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); + OwnSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aTextures[Part] = pSkinPart->m_OrgTexture; + OwnSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aColors[Part] = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); } } @@ -167,13 +167,13 @@ void CMenus::RenderSettingsTee7(CUIRect MainView) const CSkins7::CSkinPart *pSkinPart = m_pClient->m_Skins7.GetSkinPart(Part, SkinPart); if(aUCCVars[Part]) { - TeamSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aTextures[Part] = pSkinPart->m_ColorTexture; - TeamSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aColors[Part] = m_pClient->m_Skins7.GetColor(aColorVars[Part], Part == protocol7::SKINPART_MARKING); + TeamSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aTextures[Part] = pSkinPart->m_ColorTexture; + TeamSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aColors[Part] = m_pClient->m_Skins7.GetColor(aColorVars[Part], Part == protocol7::SKINPART_MARKING); } else { - TeamSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aTextures[Part] = pSkinPart->m_OrgTexture; - TeamSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aColors[Part] = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); + TeamSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aTextures[Part] = pSkinPart->m_OrgTexture; + TeamSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aColors[Part] = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); } } @@ -191,7 +191,7 @@ void CMenus::RenderSettingsTee7(CUIRect MainView) for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++) { ColorRGBA TeamColor = m_pClient->m_Skins7.GetTeamColor(aUCCVars[Part], aColorVars[Part], TEAM_RED, Part); - TeamSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aColors[Part] = TeamColor; + TeamSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aColors[Part] = TeamColor; } RenderTools()->RenderTee(CAnimState::GetIdle(), &TeamSkinInfo, 0, vec2(1, 0), vec2(TeeLeft.x + TeeLeft.w / 2.0f, TeeLeft.y + TeeLeft.h / 2.0f + 6.0f)); @@ -200,7 +200,7 @@ void CMenus::RenderSettingsTee7(CUIRect MainView) for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++) { ColorRGBA TeamColor = m_pClient->m_Skins7.GetTeamColor(aUCCVars[Part], aColorVars[Part], TEAM_BLUE, Part); - TeamSkinInfo.m_Sixup[g_Config.m_ClDummy].m_aColors[Part] = TeamColor; + TeamSkinInfo.m_aSixup[g_Config.m_ClDummy].m_aColors[Part] = TeamColor; } RenderTools()->RenderTee(CAnimState::GetIdle(), &TeamSkinInfo, 0, vec2(-1, 0), vec2(TeeRight.x + TeeRight.w / 2.0f, TeeRight.y + TeeRight.h / 2.0f + 6.0f)); } @@ -419,13 +419,13 @@ void CMenus::RenderSkinSelection7(CUIRect MainView) { if(s->m_aUseCustomColors[Part]) { - Info.m_Sixup[g_Config.m_ClDummy].m_aTextures[Part] = s->m_apParts[Part]->m_ColorTexture; - Info.m_Sixup[g_Config.m_ClDummy].m_aColors[Part] = m_pClient->m_Skins7.GetColor(s->m_aPartColors[Part], Part == protocol7::SKINPART_MARKING); + Info.m_aSixup[g_Config.m_ClDummy].m_aTextures[Part] = s->m_apParts[Part]->m_ColorTexture; + Info.m_aSixup[g_Config.m_ClDummy].m_aColors[Part] = m_pClient->m_Skins7.GetColor(s->m_aPartColors[Part], Part == protocol7::SKINPART_MARKING); } else { - Info.m_Sixup[g_Config.m_ClDummy].m_aTextures[Part] = s->m_apParts[Part]->m_OrgTexture; - Info.m_Sixup[g_Config.m_ClDummy].m_aColors[Part] = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); + Info.m_aSixup[g_Config.m_ClDummy].m_aTextures[Part] = s->m_apParts[Part]->m_OrgTexture; + Info.m_aSixup[g_Config.m_ClDummy].m_aColors[Part] = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); } } @@ -508,18 +508,18 @@ void CMenus::RenderSkinPartSelection7(CUIRect MainView) if(*CSkins7::ms_apUCCVariables[(int)m_Dummy][j]) { if(m_TeePartSelected == j) - Info.m_Sixup[g_Config.m_ClDummy].m_aTextures[j] = s->m_ColorTexture; + Info.m_aSixup[g_Config.m_ClDummy].m_aTextures[j] = s->m_ColorTexture; else - Info.m_Sixup[g_Config.m_ClDummy].m_aTextures[j] = pSkinPart->m_ColorTexture; - Info.m_Sixup[g_Config.m_ClDummy].m_aColors[j] = m_pClient->m_Skins7.GetColor(*CSkins7::ms_apColorVariables[(int)m_Dummy][j], j == protocol7::SKINPART_MARKING); + Info.m_aSixup[g_Config.m_ClDummy].m_aTextures[j] = pSkinPart->m_ColorTexture; + Info.m_aSixup[g_Config.m_ClDummy].m_aColors[j] = m_pClient->m_Skins7.GetColor(*CSkins7::ms_apColorVariables[(int)m_Dummy][j], j == protocol7::SKINPART_MARKING); } else { if(m_TeePartSelected == j) - Info.m_Sixup[g_Config.m_ClDummy].m_aTextures[j] = s->m_OrgTexture; + Info.m_aSixup[g_Config.m_ClDummy].m_aTextures[j] = s->m_OrgTexture; else - Info.m_Sixup[g_Config.m_ClDummy].m_aTextures[j] = pSkinPart->m_OrgTexture; - Info.m_Sixup[0].m_aColors[j] = vec4(1.0f, 1.0f, 1.0f, 1.0f); + Info.m_aSixup[g_Config.m_ClDummy].m_aTextures[j] = pSkinPart->m_OrgTexture; + Info.m_aSixup[0].m_aColors[j] = vec4(1.0f, 1.0f, 1.0f, 1.0f); } } Info.m_Size = 50.0f; diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 5ad8bf76f..c62496613 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -29,7 +29,7 @@ void CPlayers::RenderHand(const CTeeRenderInfo *pInfo, vec2 CenterPos, vec2 Dir, float AngleOffset, vec2 PostRotOffset, float Alpha) { - if(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_BODY].IsValid()) + if(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_BODY].IsValid()) RenderHand7(pInfo, CenterPos, Dir, AngleOffset, PostRotOffset, Alpha); else RenderHand6(pInfo, CenterPos, Dir, AngleOffset, PostRotOffset, Alpha); @@ -56,12 +56,12 @@ void CPlayers::RenderHand7(const CTeeRenderInfo *pInfo, vec2 CenterPos, vec2 Dir HandPos += DirX * PostRotOffset.x; HandPos += DirY * PostRotOffset.y; - ColorRGBA Color = pInfo->m_Sixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_HANDS]; + ColorRGBA Color = pInfo->m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_HANDS]; Color.a = Alpha; IGraphics::CQuadItem QuadOutline(HandPos.x, HandPos.y, 2 * BaseSize, 2 * BaseSize); IGraphics::CQuadItem QuadHand = QuadOutline; - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_HANDS]); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_HANDS]); Graphics()->QuadsBegin(); Graphics()->SetColor(Color); Graphics()->QuadsSetRotation(Angle); @@ -842,7 +842,7 @@ void CPlayers::OnRender() const auto *pSkin = m_pClient->m_Skins.FindOrNullptr("x_ninja"); if(pSkin != nullptr) { - aRenderInfo[i].m_Sixup[g_Config.m_ClDummy].Reset(); + aRenderInfo[i].m_aSixup[g_Config.m_ClDummy].Reset(); aRenderInfo[i].m_OriginalRenderSkin = pSkin->m_OriginalSkin; aRenderInfo[i].m_ColorableRenderSkin = pSkin->m_ColorableSkin; diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 3193246e4..636f9e806 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -2346,18 +2346,18 @@ 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_Sixup[Conn].m_aColors[protocol7::SKINPART_MARKING].a; - for(auto &Color : m_RenderInfo.m_Sixup[Conn].m_aColors) + float MarkingAlpha = m_RenderInfo.m_aSixup[Conn].m_aColors[protocol7::SKINPART_MARKING].a; + for(auto &Color : m_RenderInfo.m_aSixup[Conn].m_aColors) Color = aTeamColorsSixup[m_Team]; if(MarkingAlpha > 0.1f) - m_RenderInfo.m_Sixup[Conn].m_aColors[protocol7::SKINPART_MARKING] = aMarkingColorsSixup[m_Team]; + m_RenderInfo.m_aSixup[Conn].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_Sixup[Conn].m_aColors) + for(auto &Color : m_RenderInfo.m_aSixup[Conn].m_aColors) Color = color_cast(ColorHSLA(12829350)); } } @@ -2374,15 +2374,7 @@ void CGameClient::CClientData::Reset() m_Country = -1; m_aSkinName[0] = '\0'; m_SkinColor = 0; - for(auto &Info : m_Sixup) - { - for(int i = 0; i < protocol7::NUM_SKINPARTS; ++i) - { - Info.m_aaSkinPartNames[i][0] = '\0'; - Info.m_aUseCustomColors[i] = 0; - Info.m_aSkinPartColors[i] = 0; - } - } + m_Team = 0; m_Emoticon = 0; m_EmoticonStartFraction = 0; @@ -2440,6 +2432,19 @@ void CGameClient::CClientData::Reset() std::fill(std::begin(m_aPredTick), std::end(m_aPredTick), 0); m_SpecCharPresent = false; m_SpecChar = vec2(0.0f, 0.0f); + + for(auto &Info : m_aSixup) + Info.Reset(); +} + +void CGameClient::CClientData::CSixup::Reset() +{ + for(int i = 0; i < protocol7::NUM_SKINPARTS; ++i) + { + m_aaSkinPartNames[i][0] = '\0'; + m_aUseCustomColors[i] = 0; + m_aSkinPartColors[i] = 0; + } } void CGameClient::SendSwitchTeam(int Team) @@ -2507,11 +2512,11 @@ bool CGameClient::GotWantedSkin7(bool Dummy) for(int SkinPart = 0; SkinPart < protocol7::NUM_SKINPARTS; SkinPart++) { - if(str_comp(m_aClients[m_aLocalIds[(int)Dummy]].m_Sixup[g_Config.m_ClDummy].m_aaSkinPartNames[SkinPart], apSkinPartsPtr[SkinPart])) + if(str_comp(m_aClients[m_aLocalIds[(int)Dummy]].m_aSixup[g_Config.m_ClDummy].m_aaSkinPartNames[SkinPart], apSkinPartsPtr[SkinPart])) return false; - if(m_aClients[m_aLocalIds[(int)Dummy]].m_Sixup[g_Config.m_ClDummy].m_aUseCustomColors[SkinPart] != aUCCVars[SkinPart]) + if(m_aClients[m_aLocalIds[(int)Dummy]].m_aSixup[g_Config.m_ClDummy].m_aUseCustomColors[SkinPart] != aUCCVars[SkinPart]) return false; - if(m_aClients[m_aLocalIds[(int)Dummy]].m_Sixup[g_Config.m_ClDummy].m_aSkinPartColors[SkinPart] != aColorVars[SkinPart]) + if(m_aClients[m_aLocalIds[(int)Dummy]].m_aSixup[g_Config.m_ClDummy].m_aSkinPartColors[SkinPart] != aColorVars[SkinPart]) return false; } diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 1730612c8..175c0d414 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -444,13 +444,15 @@ public: class CSixup { public: + void Reset(); + char m_aaSkinPartNames[protocol7::NUM_SKINPARTS][protocol7::MAX_SKIN_LENGTH]; int m_aUseCustomColors[protocol7::NUM_SKINPARTS]; int m_aSkinPartColors[protocol7::NUM_SKINPARTS]; }; // 0.7 Skin - CSixup m_Sixup[NUM_DUMMIES]; + CSixup m_aSixup[NUM_DUMMIES]; }; CClientData m_aClients[MAX_CLIENTS]; diff --git a/src/game/client/render.cpp b/src/game/client/render.cpp index 280f7d9bc..8b371f722 100644 --- a/src/game/client/render.cpp +++ b/src/game/client/render.cpp @@ -272,7 +272,7 @@ void CRenderTools::GetRenderTeeOffsetToRenderedTee(const CAnimState *pAnim, cons void CRenderTools::RenderTee(const CAnimState *pAnim, const CTeeRenderInfo *pInfo, int Emote, vec2 Dir, vec2 Pos, float Alpha) const { - if(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_BODY].IsValid()) + if(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_BODY].IsValid()) RenderTee7(pAnim, pInfo, Emote, Dir, Pos, Alpha); else RenderTee6(pAnim, pInfo, Emote, Dir, Pos, Alpha); @@ -307,7 +307,7 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn // draw bot visuals (background) if(IsBot && !OutLine) { - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_BotTexture); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_BotTexture); Graphics()->QuadsBegin(); Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha); SelectSprite7(client_data7::SPRITE_TEE_BOT_BACKGROUND, 0, 0, 0); @@ -319,13 +319,13 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn // draw bot visuals (foreground) if(IsBot && !OutLine) { - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_BotTexture); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_BotTexture); Graphics()->QuadsBegin(); Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha); SelectSprite7(client_data7::SPRITE_TEE_BOT_FOREGROUND, 0, 0, 0); Item = BotItem; Graphics()->QuadsDraw(&Item, 1); - ColorRGBA Color = pInfo->m_Sixup[g_Config.m_ClDummy].m_BotColor; + ColorRGBA Color = pInfo->m_aSixup[g_Config.m_ClDummy].m_BotColor; Color.a = Alpha; Graphics()->SetColor(Color); SelectSprite7(client_data7::SPRITE_TEE_BOT_GLOW, 0, 0, 0); @@ -335,12 +335,12 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn } // draw decoration - if(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_DECORATION].IsValid()) + if(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_DECORATION].IsValid()) { - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_DECORATION]); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_DECORATION]); Graphics()->QuadsBegin(); Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle * pi * 2); - ColorRGBA Color = pInfo->m_Sixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_DECORATION]; + ColorRGBA Color = pInfo->m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_DECORATION]; Color.a = Alpha; Graphics()->SetColor(Color); SelectSprite7(OutLine ? client_data7::SPRITE_TEE_DECORATION_OUTLINE : client_data7::SPRITE_TEE_DECORATION, 0, 0, 0); @@ -350,7 +350,7 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn } // draw body (behind marking) - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_BODY]); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_BODY]); Graphics()->QuadsBegin(); Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle * pi * 2); if(OutLine) @@ -360,7 +360,7 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn } else { - ColorRGBA Color = pInfo->m_Sixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_BODY]; + ColorRGBA Color = pInfo->m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_BODY]; Color.a = Alpha; Graphics()->SetColor(Color); SelectSprite7(client_data7::SPRITE_TEE_BODY, 0, 0, 0); @@ -370,12 +370,12 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn Graphics()->QuadsEnd(); // draw marking - if(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_MARKING].IsValid() && !OutLine) + if(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_MARKING].IsValid() && !OutLine) { - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_MARKING]); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_MARKING]); Graphics()->QuadsBegin(); Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle * pi * 2); - ColorRGBA MarkingColor = pInfo->m_Sixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_MARKING]; + ColorRGBA MarkingColor = pInfo->m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_MARKING]; Graphics()->SetColor(MarkingColor.r * MarkingColor.a, MarkingColor.g * MarkingColor.a, MarkingColor.b * MarkingColor.a, MarkingColor.a * Alpha); SelectSprite7(client_data7::SPRITE_TEE_MARKING, 0, 0, 0); Item = BodyItem; @@ -386,7 +386,7 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn // draw body (in front of marking) if(!OutLine) { - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_BODY]); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_BODY]); Graphics()->QuadsBegin(); Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle * pi * 2); Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha); @@ -400,19 +400,19 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn } // draw eyes - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_EYES]); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_EYES]); Graphics()->QuadsBegin(); Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle * pi * 2); if(IsBot) { - ColorRGBA Color = pInfo->m_Sixup[g_Config.m_ClDummy].m_BotColor; + ColorRGBA Color = pInfo->m_aSixup[g_Config.m_ClDummy].m_BotColor; Color.a = Alpha; Graphics()->SetColor(Color); Emote = EMOTE_SURPRISE; } else { - ColorRGBA Color = pInfo->m_Sixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_EYES]; + ColorRGBA Color = pInfo->m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_EYES]; Color.a = Alpha; Graphics()->SetColor(Color); } @@ -446,14 +446,14 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn Graphics()->QuadsEnd(); // draw xmas hat - if(!OutLine && pInfo->m_Sixup[g_Config.m_ClDummy].m_HatTexture.IsValid()) + if(!OutLine && pInfo->m_aSixup[g_Config.m_ClDummy].m_HatTexture.IsValid()) { - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_HatTexture); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_HatTexture); Graphics()->QuadsBegin(); Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle * pi * 2); Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha); int Flag = Direction.x < 0.0f ? SPRITE_FLAG_FLIP_X : 0; - switch(pInfo->m_Sixup[g_Config.m_ClDummy].m_HatSpriteIndex) + switch(pInfo->m_aSixup[g_Config.m_ClDummy].m_HatSpriteIndex) { case 0: SelectSprite7(client_data7::SPRITE_TEE_HATS_TOP1, Flag, 0, 0); @@ -474,7 +474,7 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn } // draw feet - Graphics()->TextureSet(pInfo->m_Sixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_FEET]); + Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_aTextures[protocol7::SKINPART_FEET]); Graphics()->QuadsBegin(); const CAnimKeyframe *pFoot = Filling ? pAnim->GetFrontFoot() : pAnim->GetBackFoot(); @@ -495,10 +495,10 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn if(Indicate) ColorScale = 0.5f; Graphics()->SetColor( - pInfo->m_Sixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_FEET].r * ColorScale, - pInfo->m_Sixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_FEET].g * ColorScale, - pInfo->m_Sixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_FEET].b * ColorScale, - pInfo->m_Sixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_FEET].a * Alpha); + pInfo->m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_FEET].r * ColorScale, + pInfo->m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_FEET].g * ColorScale, + pInfo->m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_FEET].b * ColorScale, + pInfo->m_aSixup[g_Config.m_ClDummy].m_aColors[protocol7::SKINPART_FEET].a * Alpha); SelectSprite7(client_data7::SPRITE_TEE_FOOT, 0, 0, 0); } diff --git a/src/game/client/render.h b/src/game/client/render.h index ee6ef43d7..ac3b77c77 100644 --- a/src/game/client/render.h +++ b/src/game/client/render.h @@ -52,7 +52,7 @@ public: m_TeeRenderFlags = 0; m_FeetFlipped = false; - for(auto &Sixup : m_Sixup) + for(auto &Sixup : m_aSixup) Sixup.Reset(); } @@ -107,7 +107,7 @@ public: ColorRGBA m_BotColor; }; - CSixup m_Sixup[NUM_DUMMIES]; + CSixup m_aSixup[NUM_DUMMIES]; }; // Tee Render Flags diff --git a/src/game/client/sixup_translate_game.cpp b/src/game/client/sixup_translate_game.cpp index 2d2255656..7c3f6c4a3 100644 --- a/src/game/client/sixup_translate_game.cpp +++ b/src/game/client/sixup_translate_game.cpp @@ -85,41 +85,41 @@ void CGameClient::ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId, int Con char *apSkinPartsPtr[protocol7::NUM_SKINPARTS]; for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++) { - str_utf8_copy_num(pClient->m_Sixup[Conn].m_aaSkinPartNames[Part], pMsg->m_apSkinPartNames[Part], sizeof(pClient->m_Sixup[Conn].m_aaSkinPartNames[Part]), protocol7::MAX_SKIN_LENGTH); - apSkinPartsPtr[Part] = pClient->m_Sixup[Conn].m_aaSkinPartNames[Part]; - pClient->m_Sixup[Conn].m_aUseCustomColors[Part] = pMsg->m_aUseCustomColors[Part]; - pClient->m_Sixup[Conn].m_aSkinPartColors[Part] = pMsg->m_aSkinPartColors[Part]; + str_utf8_copy_num(pClient->m_aSixup[Conn].m_aaSkinPartNames[Part], pMsg->m_apSkinPartNames[Part], sizeof(pClient->m_aSixup[Conn].m_aaSkinPartNames[Part]), protocol7::MAX_SKIN_LENGTH); + apSkinPartsPtr[Part] = pClient->m_aSixup[Conn].m_aaSkinPartNames[Part]; + pClient->m_aSixup[Conn].m_aUseCustomColors[Part] = pMsg->m_aUseCustomColors[Part]; + pClient->m_aSixup[Conn].m_aSkinPartColors[Part] = pMsg->m_aSkinPartColors[Part]; } - m_Skins7.ValidateSkinParts(apSkinPartsPtr, pClient->m_Sixup[Conn].m_aUseCustomColors, pClient->m_Sixup[Conn].m_aSkinPartColors, m_pClient->m_TranslationContext.m_GameFlags); + m_Skins7.ValidateSkinParts(apSkinPartsPtr, pClient->m_aSixup[Conn].m_aUseCustomColors, pClient->m_aSixup[Conn].m_aSkinPartColors, m_pClient->m_TranslationContext.m_GameFlags); if(time_season() == SEASON_XMAS) { - pClient->m_SkinInfo.m_Sixup[Conn].m_HatTexture = m_Skins7.m_XmasHatTexture; - pClient->m_SkinInfo.m_Sixup[Conn].m_HatSpriteIndex = ClientId % CSkins7::HAT_NUM; + pClient->m_SkinInfo.m_aSixup[Conn].m_HatTexture = m_Skins7.m_XmasHatTexture; + pClient->m_SkinInfo.m_aSixup[Conn].m_HatSpriteIndex = ClientId % CSkins7::HAT_NUM; } else - pClient->m_SkinInfo.m_Sixup[Conn].m_HatTexture.Invalidate(); + pClient->m_SkinInfo.m_aSixup[Conn].m_HatTexture.Invalidate(); for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++) { - int Id = m_Skins7.FindSkinPart(Part, pClient->m_Sixup[Conn].m_aaSkinPartNames[Part], false); + int Id = m_Skins7.FindSkinPart(Part, pClient->m_aSixup[Conn].m_aaSkinPartNames[Part], false); const CSkins7::CSkinPart *pSkinPart = m_Skins7.GetSkinPart(Part, Id); - if(pClient->m_Sixup[Conn].m_aUseCustomColors[Part]) + if(pClient->m_aSixup[Conn].m_aUseCustomColors[Part]) { - pClient->m_SkinInfo.m_Sixup[Conn].m_aTextures[Part] = pSkinPart->m_ColorTexture; - pClient->m_SkinInfo.m_Sixup[Conn].m_aColors[Part] = m_Skins7.GetColor(pMsg->m_aSkinPartColors[Part], Part == protocol7::SKINPART_MARKING); + pClient->m_SkinInfo.m_aSixup[Conn].m_aTextures[Part] = pSkinPart->m_ColorTexture; + pClient->m_SkinInfo.m_aSixup[Conn].m_aColors[Part] = m_Skins7.GetColor(pMsg->m_aSkinPartColors[Part], Part == protocol7::SKINPART_MARKING); } else { - pClient->m_SkinInfo.m_Sixup[Conn].m_aTextures[Part] = pSkinPart->m_OrgTexture; - pClient->m_SkinInfo.m_Sixup[Conn].m_aColors[Part] = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); + pClient->m_SkinInfo.m_aSixup[Conn].m_aTextures[Part] = pSkinPart->m_OrgTexture; + pClient->m_SkinInfo.m_aSixup[Conn].m_aColors[Part] = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); } - if(pClient->m_SkinInfo.m_Sixup[Conn].m_HatTexture.IsValid()) + if(pClient->m_SkinInfo.m_aSixup[Conn].m_HatTexture.IsValid()) { - if(Part == protocol7::SKINPART_BODY && str_comp(pClient->m_Sixup[Conn].m_aaSkinPartNames[Part], "standard")) - pClient->m_SkinInfo.m_Sixup[Conn].m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM); - if(Part == protocol7::SKINPART_DECORATION && !str_comp(pClient->m_Sixup[Conn].m_aaSkinPartNames[Part], "twinbopp")) - pClient->m_SkinInfo.m_Sixup[Conn].m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM); + if(Part == protocol7::SKINPART_BODY && str_comp(pClient->m_aSixup[Conn].m_aaSkinPartNames[Part], "standard")) + pClient->m_SkinInfo.m_aSixup[Conn].m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM); + if(Part == protocol7::SKINPART_DECORATION && !str_comp(pClient->m_aSixup[Conn].m_aaSkinPartNames[Part], "twinbopp")) + pClient->m_SkinInfo.m_aSixup[Conn].m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM); } } } diff --git a/src/game/client/sixup_translate_snapshot.cpp b/src/game/client/sixup_translate_snapshot.cpp index 465b9077b..2c33f4e1d 100644 --- a/src/game/client/sixup_translate_snapshot.cpp +++ b/src/game/client/sixup_translate_snapshot.cpp @@ -524,9 +524,9 @@ int CGameClient::OnDemoRecSnap7(CSnapshot *pFrom, CSnapshot *pTo, int Conn) for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++) { - StrToInts(ClientInfoObj.m_aaSkinPartNames[Part], 6, m_aClients[i].m_Sixup[Conn].m_aaSkinPartNames[Part]); - ClientInfoObj.m_aUseCustomColors[Part] = m_aClients[i].m_Sixup[Conn].m_aUseCustomColors[Part]; - ClientInfoObj.m_aSkinPartColors[Part] = m_aClients[i].m_Sixup[Conn].m_aSkinPartColors[Part]; + StrToInts(ClientInfoObj.m_aaSkinPartNames[Part], 6, m_aClients[i].m_aSixup[Conn].m_aaSkinPartNames[Part]); + ClientInfoObj.m_aUseCustomColors[Part] = m_aClients[i].m_aSixup[Conn].m_aUseCustomColors[Part]; + ClientInfoObj.m_aSkinPartColors[Part] = m_aClients[i].m_aSixup[Conn].m_aSkinPartColors[Part]; } mem_copy(pItem, &ClientInfoObj, sizeof(protocol7::CNetObj_De_ClientInfo));