Skip to content

Commit 0803e4f

Browse files
committed
Fix TVD seek when paused
1 parent e7264e6 commit 0803e4f

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

code/client/cl_tv.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,16 @@ void CL_TV_Seek( int targetTime ) {
10451045
tvPlay.seeking = qfalse;
10461046
}
10471047

1048+
// Inject sync command BEFORE building snapshots so both include it
1049+
{
1050+
char syncCmd[MAX_STRING_CHARS];
1051+
Com_sprintf( syncCmd, sizeof( syncCmd ), "tv_seek_sync %i",
1052+
tvPlay.viewpoint );
1053+
CL_TV_WriteCommand( syncCmd );
1054+
}
1055+
10481056
// Build both snapshots into standard ring buffer
1057+
// (both will have serverCommandNum including tv_seek_sync)
10491058
CL_TV_BuildSnapshot();
10501059

10511060
if ( !tvPlay.atEnd ) {
@@ -1056,18 +1065,6 @@ void CL_TV_Seek( int targetTime ) {
10561065
CL_TV_BuildSnapshot();
10571066
}
10581067

1059-
// Inject sync command so cgame re-fetches gamestate
1060-
{
1061-
char syncCmd[MAX_STRING_CHARS];
1062-
Com_sprintf( syncCmd, sizeof( syncCmd ), "tv_seek_sync %i",
1063-
tvPlay.viewpoint );
1064-
CL_TV_WriteCommand( syncCmd );
1065-
}
1066-
1067-
// Update the latest snapshot's serverCommandNum to include the sync command
1068-
cl.snapshots[clc.serverMessageSequence & PACKET_MASK].serverCommandNum =
1069-
clc.serverCommandSequence;
1070-
10711068
// Update client state
10721069
cl.snap = cl.snapshots[clc.serverMessageSequence & PACKET_MASK];
10731070
cl.newSnapshots = qtrue;
@@ -1085,6 +1082,11 @@ void CL_TV_Seek( int targetTime ) {
10851082

10861083
Cvar_SetIntegerValue( "cl_tvTime",
10871084
tvPlay.serverTime - tvPlay.firstServerTime );
1085+
1086+
// Snap cl.serverTime to the seek target so the view updates immediately,
1087+
// even when paused (timescale 0) — the frozen branch of CL_SetCGameTime
1088+
// never recomputes cl.serverTime, so without this it would stay stale.
1089+
cl.serverTime = cl.snap.serverTime;
10881090
}
10891091

10901092

0 commit comments

Comments
 (0)