]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_demo.c
Added vid_vsync cvar and also to put it in the video options menu.
[xonotic/darkplaces.git] / cl_demo.c
index c6402413e5239946dc832227a7cfc798694d4c8e..be9bf40dd47de9f1935475db9e5ca4589244047b 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -42,6 +42,7 @@ CL_NextDemo
 Called to play the next demo in the demo loop
 =====================
 */
+extern void Call_MR_ToggleMenu_f (void);
 void CL_NextDemo (void)
 {
        char    str[1024];
@@ -56,6 +57,9 @@ void CL_NextDemo (void)
                {
                        Con_Print("No demos listed with startdemos\n");
                        cls.demonum = -1;
+                       // put up menu instead of staring at console
+                       if (key_dest != key_menu)
+                               Call_MR_ToggleMenu_f();
                        return;
                }
        }
@@ -188,6 +192,10 @@ void CL_ReadDemoMessage(void)
                {
                        MSG_BeginReading();
                        CL_ParseServerMessage();
+
+                       // In case the demo contains a "svc_disconnect" message
+                       if (!cls.demoplayback)
+                               return;
                }
                else
                {
@@ -319,6 +327,7 @@ void CL_PlayDemo_f (void)
 
        // disconnect from server
        CL_Disconnect ();
+       Host_ShutdownServer (false);
 
        // update networking ports (this is mainly just needed at startup)
        NetConn_ClientFrame();
@@ -338,6 +347,7 @@ void CL_PlayDemo_f (void)
 
        SCR_BeginLoadingPlaque ();
 
+       strlcpy(cls.demoname, name, sizeof(cls.demoname));
        cls.demoplayback = true;
        cls.state = ca_connected;
        cls.forcetrack = 0;
@@ -374,6 +384,9 @@ void CL_FinishTimeDemo (void)
        fpsmax = cls.td_minframetime > 0 ? 1.0 / cls.td_minframetime : 0;
        // LordHavoc: timedemo now prints out 7 digits of fraction, and min/avg/max
        Con_Printf("%i frames %5.7f seconds %5.7f fps\nmin/avg/max: %5.7f/%5.7f/%5.7f\n", frames, time, fpsavg, fpsmin, fpsavg, fpsmax);
+       Log_Printf("benchmark.log", "date %s | enginedate %s | demo %s | commandline %s | result %i frames %5.7f seconds %5.7f fps min/avg/max: %5.7f/%5.7f/%5.7f\n", Sys_TimeString("%Y-%m-%d %H:%M:%S"), buildstring, cls.demoname, cmdline.string, frames, time, fpsavg, fpsmin, fpsavg, fpsmax);
+       if (COM_CheckParm("-benchmark"))
+               Host_Quit_f();
 }
 
 /*