Merge pull request #8312 from ChillerDragon/pr_fix_misleading_demo_snap_var_names

Make demo snap variable names more obvious
This commit is contained in:
Robert Müller 2024-05-05 09:18:38 +00:00 committed by GitHub
commit bf2343d60b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 11 deletions

View file

@ -665,7 +665,7 @@ void CDemoPlayer::DoTick()
break;
}
DataSize = CVariableInt::Decompress(m_aDecompressedSnapshotData, DataSize, m_aCurrentSnapshotData, sizeof(m_aCurrentSnapshotData));
DataSize = CVariableInt::Decompress(m_aDecompressedSnapshotData, DataSize, m_aChunkData, sizeof(m_aChunkData));
if(DataSize < 0)
{
Stop("Error during intpack decompression");
@ -676,8 +676,8 @@ void CDemoPlayer::DoTick()
if(ChunkType == CHUNKTYPE_DELTA)
{
// process delta snapshot
CSnapshot *pNewsnap = (CSnapshot *)m_aDeltaSnapshotData;
DataSize = m_pSnapshotDelta->UnpackDelta((CSnapshot *)m_aLastSnapshotData, pNewsnap, m_aCurrentSnapshotData, DataSize);
CSnapshot *pNewsnap = (CSnapshot *)m_aSnapshot;
DataSize = m_pSnapshotDelta->UnpackDelta((CSnapshot *)m_aLastSnapshotData, pNewsnap, m_aChunkData, DataSize);
if(DataSize < 0)
{
@ -700,17 +700,17 @@ void CDemoPlayer::DoTick()
else
{
if(m_pListener)
m_pListener->OnDemoPlayerSnapshot(m_aDeltaSnapshotData, DataSize);
m_pListener->OnDemoPlayerSnapshot(m_aSnapshot, DataSize);
m_LastSnapshotDataSize = DataSize;
mem_copy(m_aLastSnapshotData, m_aDeltaSnapshotData, DataSize);
mem_copy(m_aLastSnapshotData, m_aSnapshot, DataSize);
GotSnapshot = true;
}
}
else if(ChunkType == CHUNKTYPE_SNAPSHOT)
{
// process full snapshot
CSnapshot *pSnap = (CSnapshot *)m_aCurrentSnapshotData;
CSnapshot *pSnap = (CSnapshot *)m_aChunkData;
if(!pSnap->IsValid(DataSize))
{
if(m_pConsole)
@ -725,9 +725,9 @@ void CDemoPlayer::DoTick()
GotSnapshot = true;
m_LastSnapshotDataSize = DataSize;
mem_copy(m_aLastSnapshotData, m_aCurrentSnapshotData, DataSize);
mem_copy(m_aLastSnapshotData, m_aChunkData, DataSize);
if(m_pListener)
m_pListener->OnDemoPlayerSnapshot(m_aCurrentSnapshotData, DataSize);
m_pListener->OnDemoPlayerSnapshot(m_aChunkData, DataSize);
}
}
else
@ -748,7 +748,7 @@ void CDemoPlayer::DoTick()
else if(ChunkType == CHUNKTYPE_MESSAGE)
{
if(m_pListener)
m_pListener->OnDemoPlayerMessage(m_aCurrentSnapshotData, DataSize);
m_pListener->OnDemoPlayerMessage(m_aChunkData, DataSize);
}
}
}

View file

@ -118,8 +118,13 @@ private:
CPlaybackInfo m_Info;
unsigned char m_aCompressedSnapshotData[CSnapshot::MAX_SIZE];
unsigned char m_aDecompressedSnapshotData[CSnapshot::MAX_SIZE];
unsigned char m_aCurrentSnapshotData[CSnapshot::MAX_SIZE];
unsigned char m_aDeltaSnapshotData[CSnapshot::MAX_SIZE];
// Depending on the chunk header
// this is either a full CSnapshot or a CSnapshotDelta.
unsigned char m_aChunkData[CSnapshot::MAX_SIZE];
// Storage for the full snapshot
// where the delta gets unpacked into.
unsigned char m_aSnapshot[CSnapshot::MAX_SIZE];
unsigned char m_aLastSnapshotData[CSnapshot::MAX_SIZE];
int m_LastSnapshotDataSize;
class CSnapshotDelta *m_pSnapshotDelta;