mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Make gameclient m_Sixup an array for dummy
This commit is contained in:
parent
f057898ce0
commit
7cffdf40b6
|
@ -390,7 +390,7 @@ public:
|
||||||
|
|
||||||
virtual int ClientVersion7() const = 0;
|
virtual int ClientVersion7() const = 0;
|
||||||
|
|
||||||
virtual void ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId) = 0;
|
virtual void ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId, int Conn) = 0;
|
||||||
virtual int OnDemoRecSnap7(class CSnapshot *pFrom, class CSnapshot *pTo, int Conn) = 0;
|
virtual int OnDemoRecSnap7(class CSnapshot *pFrom, class CSnapshot *pTo, int Conn) = 0;
|
||||||
virtual int TranslateSnap(class CSnapshot *pSnapDstSix, class CSnapshot *pSnapSrcSeven, int Conn, bool Dummy) = 0;
|
virtual int TranslateSnap(class CSnapshot *pSnapDstSix, class CSnapshot *pSnapSrcSeven, int Conn, bool Dummy) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -823,14 +823,14 @@ void CChat::AddLine(int ClientId, int Team, const char *pLine)
|
||||||
{
|
{
|
||||||
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
||||||
{
|
{
|
||||||
const char *pPartName = LineAuthor.m_Sixup.m_aaSkinPartNames[Part];
|
const char *pPartName = LineAuthor.m_Sixup[g_Config.m_ClDummy].m_aaSkinPartNames[Part];
|
||||||
int Id = m_pClient->m_Skins7.FindSkinPart(Part, pPartName, false);
|
int Id = m_pClient->m_Skins7.FindSkinPart(Part, pPartName, false);
|
||||||
const CSkins7::CSkinPart *pSkinPart = m_pClient->m_Skins7.GetSkinPart(Part, Id);
|
const CSkins7::CSkinPart *pSkinPart = m_pClient->m_Skins7.GetSkinPart(Part, Id);
|
||||||
if(LineAuthor.m_Sixup.m_aUseCustomColors[Part])
|
if(LineAuthor.m_Sixup[g_Config.m_ClDummy].m_aUseCustomColors[Part])
|
||||||
{
|
{
|
||||||
pCurrentLine->m_Sixup.m_aTextures[Part] = pSkinPart->m_ColorTexture;
|
pCurrentLine->m_Sixup.m_aTextures[Part] = pSkinPart->m_ColorTexture;
|
||||||
pCurrentLine->m_Sixup.m_aColors[Part] = m_pClient->m_Skins7.GetColor(
|
pCurrentLine->m_Sixup.m_aColors[Part] = m_pClient->m_Skins7.GetColor(
|
||||||
LineAuthor.m_Sixup.m_aSkinPartColors[Part],
|
LineAuthor.m_Sixup[g_Config.m_ClDummy].m_aSkinPartColors[Part],
|
||||||
Part == protocol7::SKINPART_MARKING);
|
Part == protocol7::SKINPART_MARKING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include <engine/client/checksum.h>
|
#include <engine/client/checksum.h>
|
||||||
|
#include <engine/client/enums.h>
|
||||||
#include <engine/demo.h>
|
#include <engine/demo.h>
|
||||||
#include <engine/editor.h>
|
#include <engine/editor.h>
|
||||||
#include <engine/engine.h>
|
#include <engine/engine.h>
|
||||||
|
@ -2373,11 +2374,14 @@ void CGameClient::CClientData::Reset()
|
||||||
m_Country = -1;
|
m_Country = -1;
|
||||||
m_aSkinName[0] = '\0';
|
m_aSkinName[0] = '\0';
|
||||||
m_SkinColor = 0;
|
m_SkinColor = 0;
|
||||||
|
for(auto &Info : m_Sixup)
|
||||||
|
{
|
||||||
for(int i = 0; i < protocol7::NUM_SKINPARTS; ++i)
|
for(int i = 0; i < protocol7::NUM_SKINPARTS; ++i)
|
||||||
{
|
{
|
||||||
m_Sixup.m_aaSkinPartNames[i][0] = '\0';
|
Info.m_aaSkinPartNames[i][0] = '\0';
|
||||||
m_Sixup.m_aUseCustomColors[i] = 0;
|
Info.m_aUseCustomColors[i] = 0;
|
||||||
m_Sixup.m_aSkinPartColors[i] = 0;
|
Info.m_aSkinPartColors[i] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_Team = 0;
|
m_Team = 0;
|
||||||
m_Emoticon = 0;
|
m_Emoticon = 0;
|
||||||
|
@ -2503,11 +2507,11 @@ bool CGameClient::GotWantedSkin7(bool Dummy)
|
||||||
|
|
||||||
for(int SkinPart = 0; SkinPart < protocol7::NUM_SKINPARTS; SkinPart++)
|
for(int SkinPart = 0; SkinPart < protocol7::NUM_SKINPARTS; SkinPart++)
|
||||||
{
|
{
|
||||||
if(str_comp(m_aClients[m_aLocalIds[(int)Dummy]].m_Sixup.m_aaSkinPartNames[SkinPart], apSkinPartsPtr[SkinPart]))
|
if(str_comp(m_aClients[m_aLocalIds[(int)Dummy]].m_Sixup[g_Config.m_ClDummy].m_aaSkinPartNames[SkinPart], apSkinPartsPtr[SkinPart]))
|
||||||
return false;
|
return false;
|
||||||
if(m_aClients[m_aLocalIds[(int)Dummy]].m_Sixup.m_aUseCustomColors[SkinPart] != aUCCVars[SkinPart])
|
if(m_aClients[m_aLocalIds[(int)Dummy]].m_Sixup[g_Config.m_ClDummy].m_aUseCustomColors[SkinPart] != aUCCVars[SkinPart])
|
||||||
return false;
|
return false;
|
||||||
if(m_aClients[m_aLocalIds[(int)Dummy]].m_Sixup.m_aSkinPartColors[SkinPart] != aColorVars[SkinPart])
|
if(m_aClients[m_aLocalIds[(int)Dummy]].m_Sixup[g_Config.m_ClDummy].m_aSkinPartColors[SkinPart] != aColorVars[SkinPart])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <base/color.h>
|
#include <base/color.h>
|
||||||
#include <base/vmath.h>
|
#include <base/vmath.h>
|
||||||
#include <engine/client.h>
|
#include <engine/client.h>
|
||||||
|
#include <engine/client/enums.h>
|
||||||
#include <engine/console.h>
|
#include <engine/console.h>
|
||||||
#include <engine/shared/config.h>
|
#include <engine/shared/config.h>
|
||||||
|
|
||||||
|
@ -449,7 +450,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// 0.7 Skin
|
// 0.7 Skin
|
||||||
CSixup m_Sixup;
|
CSixup m_Sixup[NUM_DUMMIES];
|
||||||
};
|
};
|
||||||
|
|
||||||
CClientData m_aClients[MAX_CLIENTS];
|
CClientData m_aClients[MAX_CLIENTS];
|
||||||
|
@ -509,8 +510,8 @@ public:
|
||||||
void OnConsoleInit() override;
|
void OnConsoleInit() override;
|
||||||
void OnStateChange(int NewState, int OldState) override;
|
void OnStateChange(int NewState, int OldState) override;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId);
|
void ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId, int Conn);
|
||||||
void ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId) override;
|
void ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId, int Conn) override;
|
||||||
int OnDemoRecSnap7(class CSnapshot *pFrom, class CSnapshot *pTo, int Conn) override;
|
int OnDemoRecSnap7(class CSnapshot *pFrom, class CSnapshot *pTo, int Conn) override;
|
||||||
void *TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn);
|
void *TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn);
|
||||||
int TranslateSnap(CSnapshot *pSnapDstSix, CSnapshot *pSnapSrcSeven, int Conn, bool Dummy) override;
|
int TranslateSnap(CSnapshot *pSnapDstSix, CSnapshot *pSnapSrcSeven, int Conn, bool Dummy) override;
|
||||||
|
|
|
@ -79,18 +79,18 @@ void CGameClient::DoTeamChangeMessage7(const char *pName, int ClientId, int Team
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void CGameClient::ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId)
|
void CGameClient::ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId, int Conn)
|
||||||
{
|
{
|
||||||
CClientData *pClient = &m_aClients[ClientId];
|
CClientData *pClient = &m_aClients[ClientId];
|
||||||
char *apSkinPartsPtr[protocol7::NUM_SKINPARTS];
|
char *apSkinPartsPtr[protocol7::NUM_SKINPARTS];
|
||||||
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
||||||
{
|
{
|
||||||
str_utf8_copy_num(pClient->m_Sixup.m_aaSkinPartNames[Part], pMsg->m_apSkinPartNames[Part], sizeof(pClient->m_Sixup.m_aaSkinPartNames[Part]), protocol7::MAX_SKIN_LENGTH);
|
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.m_aaSkinPartNames[Part];
|
apSkinPartsPtr[Part] = pClient->m_Sixup[Conn].m_aaSkinPartNames[Part];
|
||||||
pClient->m_Sixup.m_aUseCustomColors[Part] = pMsg->m_aUseCustomColors[Part];
|
pClient->m_Sixup[Conn].m_aUseCustomColors[Part] = pMsg->m_aUseCustomColors[Part];
|
||||||
pClient->m_Sixup.m_aSkinPartColors[Part] = pMsg->m_aSkinPartColors[Part];
|
pClient->m_Sixup[Conn].m_aSkinPartColors[Part] = pMsg->m_aSkinPartColors[Part];
|
||||||
}
|
}
|
||||||
m_Skins7.ValidateSkinParts(apSkinPartsPtr, pClient->m_Sixup.m_aUseCustomColors, pClient->m_Sixup.m_aSkinPartColors, m_pClient->m_TranslationContext.m_GameFlags);
|
m_Skins7.ValidateSkinParts(apSkinPartsPtr, pClient->m_Sixup[Conn].m_aUseCustomColors, pClient->m_Sixup[Conn].m_aSkinPartColors, m_pClient->m_TranslationContext.m_GameFlags);
|
||||||
|
|
||||||
if(time_season() == SEASON_XMAS)
|
if(time_season() == SEASON_XMAS)
|
||||||
{
|
{
|
||||||
|
@ -102,9 +102,9 @@ void CGameClient::ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId)
|
||||||
|
|
||||||
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
||||||
{
|
{
|
||||||
int Id = m_Skins7.FindSkinPart(Part, pClient->m_Sixup.m_aaSkinPartNames[Part], false);
|
int Id = m_Skins7.FindSkinPart(Part, pClient->m_Sixup[Conn].m_aaSkinPartNames[Part], false);
|
||||||
const CSkins7::CSkinPart *pSkinPart = m_Skins7.GetSkinPart(Part, Id);
|
const CSkins7::CSkinPart *pSkinPart = m_Skins7.GetSkinPart(Part, Id);
|
||||||
if(pClient->m_Sixup.m_aUseCustomColors[Part])
|
if(pClient->m_Sixup[Conn].m_aUseCustomColors[Part])
|
||||||
{
|
{
|
||||||
pClient->m_SkinInfo.m_Sixup.m_aTextures[Part] = pSkinPart->m_ColorTexture;
|
pClient->m_SkinInfo.m_Sixup.m_aTextures[Part] = pSkinPart->m_ColorTexture;
|
||||||
pClient->m_SkinInfo.m_Sixup.m_aColors[Part] = m_Skins7.GetColor(pMsg->m_aSkinPartColors[Part], Part == protocol7::SKINPART_MARKING);
|
pClient->m_SkinInfo.m_Sixup.m_aColors[Part] = m_Skins7.GetColor(pMsg->m_aSkinPartColors[Part], Part == protocol7::SKINPART_MARKING);
|
||||||
|
@ -116,15 +116,15 @@ void CGameClient::ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId)
|
||||||
}
|
}
|
||||||
if(pClient->m_SkinInfo.m_Sixup.m_HatTexture.IsValid())
|
if(pClient->m_SkinInfo.m_Sixup.m_HatTexture.IsValid())
|
||||||
{
|
{
|
||||||
if(Part == protocol7::SKINPART_BODY && str_comp(pClient->m_Sixup.m_aaSkinPartNames[Part], "standard"))
|
if(Part == protocol7::SKINPART_BODY && str_comp(pClient->m_Sixup[Conn].m_aaSkinPartNames[Part], "standard"))
|
||||||
pClient->m_SkinInfo.m_Sixup.m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM);
|
pClient->m_SkinInfo.m_Sixup.m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM);
|
||||||
if(Part == protocol7::SKINPART_DECORATION && !str_comp(pClient->m_Sixup.m_aaSkinPartNames[Part], "twinbopp"))
|
if(Part == protocol7::SKINPART_DECORATION && !str_comp(pClient->m_Sixup[Conn].m_aaSkinPartNames[Part], "twinbopp"))
|
||||||
pClient->m_SkinInfo.m_Sixup.m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM);
|
pClient->m_SkinInfo.m_Sixup.m_HatSpriteIndex = CSkins7::HAT_OFFSET_SIDE + (ClientId % CSkins7::HAT_NUM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameClient::ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId)
|
void CGameClient::ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId, int Conn)
|
||||||
{
|
{
|
||||||
char aSkinPartNames[protocol7::NUM_SKINPARTS][protocol7::MAX_SKIN_ARRAY_SIZE];
|
char aSkinPartNames[protocol7::NUM_SKINPARTS][protocol7::MAX_SKIN_ARRAY_SIZE];
|
||||||
protocol7::CNetMsg_Sv_SkinChange Msg;
|
protocol7::CNetMsg_Sv_SkinChange Msg;
|
||||||
|
@ -136,7 +136,7 @@ void CGameClient::ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientIn
|
||||||
Msg.m_aUseCustomColors[Part] = pObj->m_aUseCustomColors[Part];
|
Msg.m_aUseCustomColors[Part] = pObj->m_aUseCustomColors[Part];
|
||||||
Msg.m_aSkinPartColors[Part] = pObj->m_aSkinPartColors[Part];
|
Msg.m_aSkinPartColors[Part] = pObj->m_aSkinPartColors[Part];
|
||||||
}
|
}
|
||||||
ApplySkin7InfoFromGameMsg(&Msg, ClientId);
|
ApplySkin7InfoFromGameMsg(&Msg, ClientId, Conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn)
|
void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn)
|
||||||
|
@ -293,7 +293,7 @@ void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn)
|
||||||
|
|
||||||
CTranslationContext::CClientData &Client = m_pClient->m_TranslationContext.m_aClients[pMsg7->m_ClientId];
|
CTranslationContext::CClientData &Client = m_pClient->m_TranslationContext.m_aClients[pMsg7->m_ClientId];
|
||||||
Client.m_Active = true;
|
Client.m_Active = true;
|
||||||
ApplySkin7InfoFromGameMsg(pMsg7, pMsg7->m_ClientId);
|
ApplySkin7InfoFromGameMsg(pMsg7, pMsg7->m_ClientId, Conn);
|
||||||
// skin will be moved to the 0.6 snap by the translation context
|
// skin will be moved to the 0.6 snap by the translation context
|
||||||
// and we drop the game message
|
// and we drop the game message
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -495,7 +495,7 @@ void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn)
|
||||||
str_copy(Client.m_aName, pMsg7->m_pName);
|
str_copy(Client.m_aName, pMsg7->m_pName);
|
||||||
str_copy(Client.m_aClan, pMsg7->m_pClan);
|
str_copy(Client.m_aClan, pMsg7->m_pClan);
|
||||||
Client.m_Country = pMsg7->m_Country;
|
Client.m_Country = pMsg7->m_Country;
|
||||||
ApplySkin7InfoFromGameMsg(pMsg7, pMsg7->m_ClientId);
|
ApplySkin7InfoFromGameMsg(pMsg7, pMsg7->m_ClientId, Conn);
|
||||||
if(m_pClient->m_TranslationContext.m_aLocalClientId[Conn] == -1)
|
if(m_pClient->m_TranslationContext.m_aLocalClientId[Conn] == -1)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if(pMsg7->m_Silent || pMsg7->m_Local)
|
if(pMsg7->m_Silent || pMsg7->m_Local)
|
||||||
|
|
|
@ -466,7 +466,7 @@ int CGameClient::TranslateSnap(CSnapshot *pSnapDstSix, CSnapshot *pSnapSrcSeven,
|
||||||
IntsToStr(pInfo->m_aClan, 3, Client.m_aClan, std::size(Client.m_aClan));
|
IntsToStr(pInfo->m_aClan, 3, Client.m_aClan, std::size(Client.m_aClan));
|
||||||
Client.m_Country = pInfo->m_Country;
|
Client.m_Country = pInfo->m_Country;
|
||||||
|
|
||||||
ApplySkin7InfoFromSnapObj(pInfo, ClientId);
|
ApplySkin7InfoFromSnapObj(pInfo, ClientId, Conn);
|
||||||
}
|
}
|
||||||
else if(pItem7->Type() == protocol7::NETOBJTYPE_DE_GAMEINFO)
|
else if(pItem7->Type() == protocol7::NETOBJTYPE_DE_GAMEINFO)
|
||||||
{
|
{
|
||||||
|
@ -524,9 +524,9 @@ int CGameClient::OnDemoRecSnap7(CSnapshot *pFrom, CSnapshot *pTo, int Conn)
|
||||||
|
|
||||||
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
||||||
{
|
{
|
||||||
StrToInts(ClientInfoObj.m_aaSkinPartNames[Part], 6, m_aClients[i].m_Sixup.m_aaSkinPartNames[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.m_aUseCustomColors[Part];
|
ClientInfoObj.m_aUseCustomColors[Part] = m_aClients[i].m_Sixup[Conn].m_aUseCustomColors[Part];
|
||||||
ClientInfoObj.m_aSkinPartColors[Part] = m_aClients[i].m_Sixup.m_aSkinPartColors[Part];
|
ClientInfoObj.m_aSkinPartColors[Part] = m_aClients[i].m_Sixup[Conn].m_aSkinPartColors[Part];
|
||||||
}
|
}
|
||||||
|
|
||||||
mem_copy(pItem, &ClientInfoObj, sizeof(protocol7::CNetObj_De_ClientInfo));
|
mem_copy(pItem, &ClientInfoObj, sizeof(protocol7::CNetObj_De_ClientInfo));
|
||||||
|
|
Loading…
Reference in a new issue