]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_demo.c
Added taskqueue.[ch].
[xonotic/darkplaces.git] / cl_demo.c
index 5ca4780ee4cdc8ac950572290db37f7b58c07e54..595cad5322669b918b0ea0dba3371d64654b2474 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -20,7 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 
+#ifdef CONFIG_VIDEO_CAPTURE
 extern cvar_t cl_capturevideo;
+extern cvar_t cl_capturevideo_demo_stop;
+#endif
 int old_vsync = 0;
 
 static void CL_FinishTimeDemo (void);
@@ -75,9 +78,14 @@ CL_StopPlayback
 Called when a demo file runs out, or the user starts a game
 ==============
 */
-// LordHavoc: now called only by CL_Disconnect
+// LadyHavoc: now called only by CL_Disconnect
 void CL_StopPlayback (void)
 {
+#ifdef CONFIG_VIDEO_CAPTURE
+       if (cl_capturevideo_demo_stop.integer)
+               Cvar_Set("cl_capturevideo", "0");
+#endif
+
        if (!cls.demoplayback)
                return;
 
@@ -107,7 +115,7 @@ void CL_WriteDemoMessage (sizebuf_t *message)
        int             i;
        float   f;
 
-       if (cls.demopaused) // LordHavoc: pausedemo
+       if (cls.demopaused) // LadyHavoc: pausedemo
                return;
 
        len = LittleLong (message->cursize);
@@ -186,7 +194,7 @@ void CL_ReadDemoMessage(void)
        if (!cls.demoplayback)
                return;
 
-       // LordHavoc: pausedemo
+       // LadyHavoc: pausedemo
        if (cls.demopaused)
                return;
 
@@ -231,7 +239,7 @@ void CL_ReadDemoMessage(void)
                                        cls.td_onesecondnexttime++;
                                }
                        }
-                       else if (cl.time <= cl.mtime[0])
+                       else if (cl.time < cl.mtime[0])
                        {
                                // don't need another message yet
                                return;
@@ -304,7 +312,7 @@ void CL_Stop_f (void)
        }
 
 // write a disconnect message to the demo file
-       // LordHavoc: don't replace the cl_message when doing this
+       // LadyHavoc: don't replace the cl_message when doing this
        buf.data = bufdata;
        buf.maxsize = sizeof(bufdata);
        SZ_Clear(&buf);
@@ -499,7 +507,7 @@ static void CL_FinishTimeDemo (void)
        fpsmin = cls.td_onesecondminfps;
        fpsavg = cls.td_onesecondavgcount ? cls.td_onesecondavgfps / cls.td_onesecondavgcount : 0;
        fpsmax = cls.td_onesecondmaxfps;
-       // LordHavoc: timedemo now prints out 7 digits of fraction, and min/avg/max
+       // LadyHavoc: timedemo now prints out 7 digits of fraction, and min/avg/max
        Con_Printf("%i frames %5.7f seconds %5.7f fps, one-second fps min/avg/max: %.0f %.0f %.0f (%i seconds)\n", frames, time, totalfpsavg, fpsmin, fpsavg, fpsmax, cls.td_onesecondavgcount);
        Log_Printf("benchmark.log", "date %s | enginedate %s | demo %s | commandline %s | run %d | result %i frames %5.7f seconds %5.7f fps, one-second fps min/avg/max: %.0f %.0f %.0f (%i seconds)\n", Sys_TimeString("%Y-%m-%d %H:%M:%S"), buildstring, cls.demoname, cmdline.string, benchmark_runs + 1, frames, time, totalfpsavg, fpsmin, fpsavg, fpsmax, cls.td_onesecondavgcount);
        if (COM_CheckParm("-benchmark"))
@@ -510,7 +518,7 @@ static void CL_FinishTimeDemo (void)
                {
                        static benchmarkhistory_t *history = NULL;
                        if(!history)
-                               history = Z_Malloc(sizeof(*history) * atoi(com_argv[i + 1]));
+                               history = (benchmarkhistory_t *)Z_Malloc(sizeof(*history) * atoi(com_argv[i + 1]));
 
                        history[benchmark_runs - 1].frames = frames;
                        history[benchmark_runs - 1].time = time;
@@ -609,6 +617,5 @@ void CL_TimeDemo_f (void)
        cls.timedemo = true;
        cls.td_frames = -2;             // skip the first frame
        cls.demonum = -1;               // stop demo loop
-       cls.demonum = -1;               // stop demo loop
 }