Skip to content

Commit

Permalink
engine: add argument -timedemo that makes engine run timedemo and exit
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Oct 27, 2023
1 parent 4cb425d commit 6f6ddbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion engine/client/cl_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,10 @@ void CL_FinishTimeDemo( void )
time = host.realtime - cls.td_starttime;
if( !time ) time = 1.0;

Con_Printf( "%i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );
Con_Printf( "timedemo result: %i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );

if( Sys_CheckParm( "-timedemo" ))
CL_Quit_f();
}

/*
Expand Down
5 changes: 5 additions & 0 deletions engine/common/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ void Sys_PrintUsage( void )
O("-noenginejoy ", "disable engine builtin joystick support")
O("-noenginemouse ", "disable engine builtin mouse support")
O("-nosound ", "disable sound output")
O("-timedemo ", "run timedemo and exit")
#endif

"\nPlatform-specific options:\n"
Expand Down Expand Up @@ -1158,6 +1159,7 @@ Host_Main
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func )
{
static double oldtime, newtime;
string demoname;

host.starttime = Sys_DoubleTime();

Expand Down Expand Up @@ -1254,6 +1256,9 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
Cbuf_ExecStuffCmds(); // execute stuffcmds (commandline)
SCR_CheckStartupVids(); // must be last

if( Sys_GetParmFromCmdLine( "-timedemo", demoname ))
Cbuf_AddTextf( "timedemo %s\n", demoname );

oldtime = Sys_DoubleTime() - 0.1;

if( Host_IsDedicated( ))
Expand Down

0 comments on commit 6f6ddbc

Please sign in to comment.