Reset playback delta state on map_restart marker

The recording resets its delta state on map_restart (writes from
zero baseline). The playback must do the same, otherwise the
delta decoder uses stale pre-restart state as baseline, producing
corrupt entity data and preventing EF_TELEPORT_BIT from being
decoded correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
serge_shubin 2026-03-23 06:11:08 +08:00
parent 5a18130ba0
commit 595cf9864b

View file

@ -660,9 +660,12 @@ static qboolean SVD_ReadFrame( fileHandle_t f ) {
FS_Read( &frameFlags, 1, f );
if ( frameFlags & 1 ) {
int j;
// map was restarted — toggle server bit and force all
// clients to receive a full (non-delta) snapshot so the
// client clears old entity state and doesn't interpolate
// map was restarted — reset playback delta state to match
// the recording's reset (both now decode from zero baseline).
// Also toggle server bit and force non-delta snapshot so the
// client clears old entity state and doesn't interpolate.
Com_Memset( demo.playPrevEntities, 0, sizeof(demo.playPrevEntities) );
Com_Memset( demo.playPrevPlayers, 0, sizeof(demo.playPrevPlayers) );
svs.snapFlagServerBit ^= SNAPFLAG_SERVERCOUNT;
for ( j = 0; j < sv_maxclients->integer; j++ ) {
if ( svs.clients[j].state >= CS_PRIMED ) {