#include "quakedef.h"
+extern cvar_t cl_capturevideo;
int old_vsync = 0;
void CL_FinishTimeDemo (void);
if (cls.timedemo)
CL_FinishTimeDemo ();
- if (COM_CheckParm("-demo"))
+ if (COM_CheckParm("-demo") || COM_CheckParm("-capturedemo"))
Host_Quit_f();
}
if (cls.demopaused)
return;
- while (1)
+ for (;;)
{
// decide if it is time to grab the next message
// always grab until fully connected
{
if (cls.timedemo)
{
- if (host_framecount == cls.td_lastframe)
- {
- // already read this frame's message
- return;
- }
- if (cls.td_lastframe == -1)
- {
- // render a couple frames before we start counting
- cls.td_startframe = host_framecount + 3;
- }
- cls.td_lastframe = host_framecount;
+ cls.td_frames++;
cls.td_onesecondframes++;
- // don't read any new messages during the warm-up period
- if (host_framecount < cls.td_startframe)
- return;
// if this is the first official frame we can now grab the real
// td_starttime so the bogus time on the first frame doesn't
// count against the final report
- if (host_framecount == cls.td_startframe)
+ if (cls.td_frames == 0)
{
cls.td_starttime = realtime;
- cls.td_onesecondnexttime = realtime + 1;
+ cls.td_onesecondnexttime = cl.time + 1;
cls.td_onesecondframes = 0;
cls.td_onesecondminframes = 0;
cls.td_onesecondmaxframes = 0;
cls.td_onesecondavgframes = 0;
cls.td_onesecondavgcount = 0;
}
- if (realtime >= cls.td_onesecondnexttime)
+ if (cl.time >= cls.td_onesecondnexttime)
{
if (cls.td_onesecondavgcount == 0)
{
// get the next message
FS_Read(cls.demofile, &net_message.cursize, 4);
net_message.cursize = LittleLong(net_message.cursize);
+ if(net_message.cursize & DEMOMSG_CLIENT_TO_SERVER) // This is a client->server message! Ignore for now!
+ {
+ // skip over demo packet
+ FS_Seek(cls.demofile, 12 + (net_message.cursize & (~DEMOMSG_CLIENT_TO_SERVER)), SEEK_CUR);
+ continue;
+ }
if (net_message.cursize > net_message.maxsize)
Host_Error("Demo message (%i) > net_message.maxsize (%i)", net_message.cursize, net_message.maxsize);
VectorCopy(cl.mviewangles[0], cl.mviewangles[1]);
// In case the demo contains a "svc_disconnect" message
if (!cls.demoplayback)
return;
+
+ if (cls.timedemo)
+ return;
}
else
{
cls.timedemo = false;
-// the first frame didn't count
- frames = (host_framecount - cls.td_startframe) - 1;
+ frames = cls.td_frames;
time = realtime - cls.td_starttime;
totalfpsavg = time > 0 ? frames / time : 0;
fpsmin = cls.td_onesecondminframes;
scr_con_current = 0;
cls.timedemo = true;
- // get first message this frame
- cls.td_lastframe = -1;
+ cls.td_frames = -2; // skip the first frame
+ cls.demonum = -1; // stop demo loop
+ cls.demonum = -1; // stop demo loop
}