diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 7bebbc6dbb8..294145c14ed 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1638,6 +1638,8 @@ void CGameClient::OnNewSnapshot() } else if(m_aStats[pInfo->m_ClientId].IsActive()) m_aStats[pInfo->m_ClientId].JoinSpec(Client()->GameTick(g_Config.m_ClDummy)); + + UpdateBotSkinDecoration(pInfo->m_ClientId); } } else if(Item.m_Type == NETOBJTYPE_DDNETPLAYER) diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 10288126a02..1a241b7625e 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -552,6 +552,7 @@ class CGameClient : public IGameClient template void ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId, int Conn); void ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId) override; + void UpdateBotSkinDecoration(int ClientId); int OnDemoRecSnap7(class CSnapshot *pFrom, class CSnapshot *pTo, int Conn) override; void *TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn); int TranslateSnap(CSnapshot *pSnapDstSix, CSnapshot *pSnapSrcSeven, int Conn, bool Dummy) override; diff --git a/src/game/client/render.cpp b/src/game/client/render.cpp index 747e96b9f78..c52532fd9af 100644 --- a/src/game/client/render.cpp +++ b/src/game/client/render.cpp @@ -283,7 +283,7 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn { vec2 Direction = Dir; vec2 Position = Pos; - bool IsBot = false; + const bool IsBot = pInfo->m_aSixup[g_Config.m_ClDummy].m_BotTexture.IsValid(); // first pass we draw the outline // second pass we draw the filling @@ -299,12 +299,13 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn { vec2 BodyPos = Position + vec2(pAnim->GetBody()->m_X, pAnim->GetBody()->m_Y) * AnimScale; IGraphics::CQuadItem BodyItem(BodyPos.x, BodyPos.y, BaseSize, BaseSize); - IGraphics::CQuadItem BotItem(BodyPos.x + (2.f / 3.f) * AnimScale, BodyPos.y + (-16 + 2.f / 3.f) * AnimScale, BaseSize, BaseSize); // x+0.66, y+0.66 to correct some rendering bug IGraphics::CQuadItem Item; - // draw bot visuals (background) if(IsBot && !OutLine) { + IGraphics::CQuadItem BotItem(BodyPos.x + (2.f / 3.f) * AnimScale, BodyPos.y + (-16 + 2.f / 3.f) * AnimScale, BaseSize, BaseSize); // x+0.66, y+0.66 to correct some rendering bug + + // draw bot visuals (background) Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_BotTexture); Graphics()->QuadsBegin(); Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha); @@ -312,11 +313,8 @@ void CRenderTools::RenderTee7(const CAnimState *pAnim, const CTeeRenderInfo *pIn Item = BotItem; Graphics()->QuadsDraw(&Item, 1); Graphics()->QuadsEnd(); - } - // draw bot visuals (foreground) - if(IsBot && !OutLine) - { + // draw bot visuals (foreground) Graphics()->TextureSet(pInfo->m_aSixup[g_Config.m_ClDummy].m_BotTexture); Graphics()->QuadsBegin(); Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha); diff --git a/src/game/client/render.h b/src/game/client/render.h index 12f40c3f8dc..7a29ab2b7b9 100644 --- a/src/game/client/render.h +++ b/src/game/client/render.h @@ -112,7 +112,7 @@ class CTeeRenderInfo PartColor = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); } m_HatSpriteIndex = 0; - m_BotColor = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f); + m_BotColor = ColorRGBA(0.0f, 0.0f, 0.0f, 0.0f); } bool Valid() const { diff --git a/src/game/client/sixup_translate_game.cpp b/src/game/client/sixup_translate_game.cpp index 6588348cee5..473703ec5a5 100644 --- a/src/game/client/sixup_translate_game.cpp +++ b/src/game/client/sixup_translate_game.cpp @@ -138,6 +138,41 @@ void CGameClient::ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientIn ApplySkin7InfoFromGameMsg(&Msg, ClientId, 0); } +void CGameClient::UpdateBotSkinDecoration(int ClientId) +{ + static const ColorRGBA BOT_COLORS[] = { + ColorRGBA(0xff0000), + ColorRGBA(0xff6600), + ColorRGBA(0x4d9f45), + ColorRGBA(0xd59e29), + ColorRGBA(0x9fd3a9), + ColorRGBA(0xbdd85e), + ColorRGBA(0xc07f94), + ColorRGBA(0xc3a267), + ColorRGBA(0xf8a83b), + ColorRGBA(0xcce2bf), + ColorRGBA(0xe6b498), + ColorRGBA(0x74c7a3), + }; + + for(auto &Sixup : m_aClients[ClientId].m_SkinInfo.m_aSixup) + { + if((m_pClient->m_TranslationContext.m_aClients[ClientId].m_PlayerFlags7 & protocol7::PLAYERFLAG_BOT) != 0) + { + Sixup.m_BotTexture = m_Skins7.BotDecorationTexture(); + if(!Sixup.m_BotColor.a) // bot color has not been set; pick a random color once + { + Sixup.m_BotColor = BOT_COLORS[rand() % std::size(BOT_COLORS)]; + } + } + else + { + Sixup.m_BotTexture.Invalidate(); + Sixup.m_BotColor = ColorRGBA(0.0f, 0.0f, 0.0f, 0.0f); + } + } +} + void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn) { if(!m_pClient->IsSixup())