mirror of https://github.com/ddnet/ddnet.git
Render skins in 0.7 demos
This commit is contained in:
parent
10fbd085fc
commit
9b77dc872e
|
@ -14,7 +14,6 @@
|
|||
#include <game/generated/protocol7.h>
|
||||
|
||||
#include <engine/friends.h>
|
||||
#include <engine/shared/snapshot.h>
|
||||
#include <functional>
|
||||
|
||||
#include <engine/client/enums.h>
|
||||
|
@ -356,9 +355,11 @@ public:
|
|||
virtual protocol7::CNetObjHandler *GetNetObjHandler7() = 0;
|
||||
|
||||
virtual int ClientVersion7() const = 0;
|
||||
|
||||
virtual void ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId) = 0;
|
||||
};
|
||||
|
||||
void SnapshotRemoveExtraProjectileInfo(CSnapshot *pSnap);
|
||||
void SnapshotRemoveExtraProjectileInfo(class CSnapshot *pSnap);
|
||||
|
||||
extern IGameClient *CreateGameClient();
|
||||
#endif
|
||||
|
|
|
@ -1989,7 +1989,8 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
|||
Conn,
|
||||
Dummy,
|
||||
GameClient()->GetNetObjHandler7(),
|
||||
GameClient()->GetNetObjHandler());
|
||||
GameClient()->GetNetObjHandler(),
|
||||
GameClient());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2517,7 +2518,7 @@ void CClient::OnDemoPlayerSnapshot(void *pData, int Size)
|
|||
if(IsSixup())
|
||||
{
|
||||
pTmpTranslateBuffer = (CSnapshot *)aTmpTranslateBuffer;
|
||||
TranslatedSize = ((CSnapshot *)pData)->TranslateSevenToSix(pTmpTranslateBuffer, m_TranslationContext, LocalTime(), GameTick(g_Config.m_ClDummy), CONN_MAIN, false, GameClient()->GetNetObjHandler7(), GameClient()->GetNetObjHandler());
|
||||
TranslatedSize = ((CSnapshot *)pData)->TranslateSevenToSix(pTmpTranslateBuffer, m_TranslationContext, LocalTime(), GameTick(g_Config.m_ClDummy), CONN_MAIN, false, GameClient()->GetNetObjHandler7(), GameClient()->GetNetObjHandler(), GameClient());
|
||||
if(TranslatedSize < 0)
|
||||
{
|
||||
dbg_msg("sixup", "failed to translate snapshot. error=%d", TranslatedSize);
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
#include "compression.h"
|
||||
#include "snapshot.h"
|
||||
#include "uuid_manager.h"
|
||||
|
||||
#include <climits>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <base/math.h>
|
||||
#include <base/system.h>
|
||||
|
||||
#include <engine/client.h>
|
||||
#include <engine/shared/protocolglue.h>
|
||||
#include <engine/shared/translation_context.h>
|
||||
|
||||
#include <game/gamecore.h>
|
||||
#include <game/generated/protocol.h>
|
||||
#include <game/generated/protocol7.h>
|
||||
#include <game/generated/protocolglue.h>
|
||||
|
||||
#include <game/gamecore.h>
|
||||
#include "snapshot.h"
|
||||
#include "uuid_manager.h"
|
||||
|
||||
int CSnapshot::TranslateSevenToSix(
|
||||
CSnapshot *pSixSnapDest,
|
||||
|
@ -25,7 +19,8 @@ int CSnapshot::TranslateSevenToSix(
|
|||
int Conn,
|
||||
bool Dummy,
|
||||
protocol7::CNetObjHandler *pNetObjHandler,
|
||||
CNetObjHandler *pNetObjHandler6)
|
||||
CNetObjHandler *pNetObjHandler6,
|
||||
IGameClient *pGameClient)
|
||||
{
|
||||
CSnapshotBuilder Builder;
|
||||
Builder.Init();
|
||||
|
@ -482,8 +477,7 @@ int CSnapshot::TranslateSevenToSix(
|
|||
IntsToStr(pInfo->m_aClan, 3, Client.m_aClan, std::size(Client.m_aClan));
|
||||
Client.m_Country = pInfo->m_Country;
|
||||
|
||||
// TODO: get this method into scope
|
||||
// ApplySkin7InfoFromGameMsg(pInfo, ClientId);
|
||||
pGameClient->ApplySkin7InfoFromSnapObj(pInfo, ClientId);
|
||||
}
|
||||
else if(pItem7->Type() == protocol7::NETOBJTYPE_DE_GAMEINFO)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <engine/client.h>
|
||||
|
||||
#include <game/generated/protocol.h>
|
||||
#include <game/generated/protocol7.h>
|
||||
|
@ -71,7 +72,8 @@ public:
|
|||
int Conn,
|
||||
bool Dummy,
|
||||
protocol7::CNetObjHandler *pNetObjHandler,
|
||||
CNetObjHandler *pNetObjHandler6);
|
||||
CNetObjHandler *pNetObjHandler6,
|
||||
IGameClient *pGameClient);
|
||||
bool IsValid(size_t ActualSize) const;
|
||||
|
||||
static const CSnapshot *EmptySnapshot() { return &ms_EmptySnapshot; }
|
||||
|
|
|
@ -493,6 +493,7 @@ public:
|
|||
void OnStateChange(int NewState, int OldState) override;
|
||||
template<typename T>
|
||||
void ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId);
|
||||
void ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId) override;
|
||||
void *TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn);
|
||||
void OnMessage(int MsgId, CUnpacker *pUnpacker, int Conn, bool Dummy) override;
|
||||
void InvalidateSnapshot() override;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include <base/system.h>
|
||||
#include <engine/shared/protocol7.h>
|
||||
#include <game/gamecore.h>
|
||||
#include <game/generated/protocol7.h>
|
||||
#include <game/localization.h>
|
||||
|
||||
#include <game/client/gameclient.h>
|
||||
|
@ -120,6 +124,21 @@ void CGameClient::ApplySkin7InfoFromGameMsg(const T *pMsg, int ClientId)
|
|||
}
|
||||
}
|
||||
|
||||
void CGameClient::ApplySkin7InfoFromSnapObj(const protocol7::CNetObj_De_ClientInfo *pObj, int ClientId)
|
||||
{
|
||||
char aSkinPartNames[protocol7::NUM_SKINPARTS][protocol7::MAX_SKIN_ARRAY_SIZE];
|
||||
protocol7::CNetMsg_Sv_SkinChange Msg;
|
||||
Msg.m_ClientId = ClientId;
|
||||
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
||||
{
|
||||
IntsToStr(pObj->m_aaSkinPartNames[Part], 6, aSkinPartNames[Part], std::size(aSkinPartNames[Part]));
|
||||
Msg.m_apSkinPartNames[Part] = aSkinPartNames[Part];
|
||||
Msg.m_aUseCustomColors[Part] = pObj->m_aUseCustomColors[Part];
|
||||
Msg.m_aSkinPartColors[Part] = pObj->m_aSkinPartColors[Part];
|
||||
}
|
||||
ApplySkin7InfoFromGameMsg(&Msg, ClientId);
|
||||
}
|
||||
|
||||
void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn)
|
||||
{
|
||||
if(!m_pClient->IsSixup())
|
||||
|
|
Loading…
Reference in New Issue