Skip to content

Commit 48f2dbd

Browse files
committed
add a cvar for skipping demo cvars
.dem files have some cvars written to their first tick in WriteDemoCvars this is done for consistency with the player's view for analysis, however in many cases customers would like to just view a demo without having it change their client's settings for these purposes, we can skip all console commands which were recorded on the initial tick of the demo from being inserted into the command buffer
1 parent 5493a0b commit 48f2dbd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/engine/cl_demo.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "tier0/memdbgon.h"
4242

4343
static ConVar demo_recordcommands( "demo_recordcommands", "1", FCVAR_CHEAT, "Record commands typed at console into .dem files." );
44+
static ConVar demo_readinitialcommands( "demo_readinitialcommands", "1", 0, "Apply commands from the initial tick of .dem files. These are typically demo cvars." );
4445
static ConVar demo_quitafterplayback( "demo_quitafterplayback", "0", 0, "Quits game after demo playback." );
4546
static ConVar demo_debug( "demo_debug", "0", 0, "Demo debug info." );
4647
static ConVar demo_interpolateview( "demo_interpolateview", "1", 0, "Do view interpolation during dem playback." );
@@ -1222,8 +1223,11 @@ netpacket_t *CDemoPlayer::ReadPacket( void )
12221223
Msg( "%d dem_consolecmd [%s]\n", tick, command );
12231224
}
12241225

1225-
Cbuf_AddText( command );
1226-
Cbuf_Execute();
1226+
if ( tick != 0 || demo_readinitialcommands.GetBool() )
1227+
{
1228+
Cbuf_AddText( command );
1229+
Cbuf_Execute();
1230+
}
12271231
}
12281232
break;
12291233
case dem_datatables:

0 commit comments

Comments
 (0)