mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #8186 from ChillerDragon/pr_optimize_demo_snap
Remove demo snap buffer and mem copy
This commit is contained in:
commit
c20baa5035
|
@ -11,6 +11,7 @@
|
||||||
#include <game/generated/protocol.h>
|
#include <game/generated/protocol.h>
|
||||||
|
|
||||||
#include <engine/friends.h>
|
#include <engine/friends.h>
|
||||||
|
#include <engine/shared/snapshot.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
struct SWarning;
|
struct SWarning;
|
||||||
|
@ -346,7 +347,7 @@ public:
|
||||||
virtual CNetObjHandler *GetNetObjHandler() = 0;
|
virtual CNetObjHandler *GetNetObjHandler() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void SnapshotRemoveExtraProjectileInfo(unsigned char *pData);
|
void SnapshotRemoveExtraProjectileInfo(CSnapshot *pSnap);
|
||||||
|
|
||||||
extern IGameClient *CreateGameClient();
|
extern IGameClient *CreateGameClient();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1821,9 +1821,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
||||||
if(!Dummy)
|
if(!Dummy)
|
||||||
{
|
{
|
||||||
// for antiping: if the projectile netobjects from the server contains extra data, this is removed and the original content restored before recording demo
|
// for antiping: if the projectile netobjects from the server contains extra data, this is removed and the original content restored before recording demo
|
||||||
unsigned char aExtraInfoRemoved[CSnapshot::MAX_SIZE];
|
SnapshotRemoveExtraProjectileInfo(pTmpBuffer3);
|
||||||
mem_copy(aExtraInfoRemoved, pTmpBuffer3, SnapSize);
|
|
||||||
SnapshotRemoveExtraProjectileInfo(aExtraInfoRemoved);
|
|
||||||
|
|
||||||
// add snapshot to demo
|
// add snapshot to demo
|
||||||
for(auto &DemoRecorder : m_aDemoRecorder)
|
for(auto &DemoRecorder : m_aDemoRecorder)
|
||||||
|
@ -1831,7 +1829,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
||||||
if(DemoRecorder.IsRecording())
|
if(DemoRecorder.IsRecording())
|
||||||
{
|
{
|
||||||
// write snapshot
|
// write snapshot
|
||||||
DemoRecorder.RecordSnapshot(GameTick, aExtraInfoRemoved, SnapSize);
|
DemoRecorder.RecordSnapshot(GameTick, pTmpBuffer3, SnapSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,9 +104,8 @@ CProjectileData ExtractProjectileInfoDDNet(const CNetObj_DDNetProjectile *pProj)
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapshotRemoveExtraProjectileInfo(unsigned char *pData)
|
void SnapshotRemoveExtraProjectileInfo(CSnapshot *pSnap)
|
||||||
{
|
{
|
||||||
CSnapshot *pSnap = (CSnapshot *)pData;
|
|
||||||
for(int Index = 0; Index < pSnap->NumItems(); Index++)
|
for(int Index = 0; Index < pSnap->NumItems(); Index++)
|
||||||
{
|
{
|
||||||
const CSnapshotItem *pItem = pSnap->GetItem(Index);
|
const CSnapshotItem *pItem = pSnap->GetItem(Index);
|
||||||
|
|
Loading…
Reference in a new issue