[nq,qw] Get demo capture working again

It turns it it had been broken for some time: it was attempting to write
the files to the wrong place.
This commit is contained in:
Bill Currie 2022-04-01 00:58:14 +09:00
parent 86e95fc1d0
commit 0880fab909
4 changed files with 34 additions and 24 deletions

View file

@ -103,7 +103,7 @@ typedef struct {
QFile *demofile;
qboolean demorecording;
qboolean demo_capture;
int demo_capture;
qboolean demoplayback;
int forcetrack; // -1 = use normal cd track
qboolean timedemo;

View file

@ -633,6 +633,19 @@ Host_ClientFrame (void)
}
}
static void
write_capture (tex_t *tex, void *data)
{
QFile *file = QFS_Open (va (0, "%s/qfmv%06d.png",
qfs_gamedir->dir.shots,
cls.demo_capture++), "wb");
if (file) {
WritePNG (file, tex);
Qclose (file);
}
free (tex);
}
/*
Host_Frame
@ -699,19 +712,11 @@ _Host_Frame (float time)
Host_ClientFrame ();
else
host_time += host_frametime; //FIXME is this needed? vcr stuff
#if 0
if (cls.demo_capture) {
tex_t *tex = r_funcs->SCR_CaptureBGR ();
QFile *file = Qopen (va (0, "%s/qfmv%06d.png",
qfs_gamedir->dir.shots,
cls.demo_capture++), "wb");
if (file) {
WritePNG (file, tex->data, tex->width, tex->height);
Qclose (file);
}
free (tex);
r_funcs->capture_screen (write_capture, 0);
}
#endif
host_framecount++;
fps_count++;
}

View file

@ -136,7 +136,7 @@ typedef struct {
QFile *demofile;
qboolean demorecording;
qboolean demo_capture;
int demo_capture;
qboolean demoplayback;
qboolean demoplayback2;
qboolean findtrack;

View file

@ -1617,6 +1617,19 @@ Host_SimulationTime (float time)
return 0;
}
static void
write_capture (tex_t *tex, void *data)
{
QFile *file = QFS_Open (va (0, "%s/qfmv%06d.png",
qfs_gamedir->dir.shots,
cls.demo_capture++), "wb");
if (file) {
WritePNG (file, tex);
Qclose (file);
}
free (tex);
}
int nopacketcount;
/*
@ -1749,19 +1762,11 @@ Host_Frame (float time)
Sys_Printf ("%3i tot %3i server %3i gfx %3i snd\n",
pass1 + pass2 + pass3, pass1, pass2, pass3);
}
#if 0
if (cls.demo_capture) {
tex_t *tex = r_funcs->SCR_CaptureBGR ();
QFile *file = Qopen (va (0, "%s/qfmv%06d.png",
qfs_gamedir->dir.shots, cls.demo_capture++),
"wb");
if (file) {
WritePNG (file, tex->data, tex->width, tex->height);
Qclose (file);
}
free (tex);
r_funcs->capture_screen (write_capture, 0);
}
#endif
host_framecount++;
fps_count++;
}