mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
and nq too, but it doesn't work well
This commit is contained in:
parent
3c4e094493
commit
fe8e3eaf56
1 changed files with 46 additions and 26 deletions
|
@ -49,6 +49,9 @@ static const char rcsid[] =
|
||||||
#include "QF/cmd.h"
|
#include "QF/cmd.h"
|
||||||
#include "QF/keys.h"
|
#include "QF/keys.h"
|
||||||
|
|
||||||
|
char demoname[1024];
|
||||||
|
int timedemo_count;
|
||||||
|
|
||||||
void CL_FinishTimeDemo (void);
|
void CL_FinishTimeDemo (void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -269,33 +272,20 @@ CL_Record_f (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
CL_PlayDemo_f
|
|
||||||
|
|
||||||
play [demoname]
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
CL_PlayDemo_f (void)
|
CL_StartDemo (void)
|
||||||
{
|
{
|
||||||
char name[256];
|
char name[256];
|
||||||
int c;
|
int c;
|
||||||
qboolean neg = false;
|
qboolean neg = false;
|
||||||
|
|
||||||
if (cmd_source != src_command)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (Cmd_Argc () != 2) {
|
|
||||||
Con_Printf ("play <demoname> : plays a demo\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// disconnect from server
|
// disconnect from server
|
||||||
//
|
//
|
||||||
CL_Disconnect ();
|
CL_Disconnect ();
|
||||||
|
|
||||||
// open the demo file
|
// open the demo file
|
||||||
//
|
//
|
||||||
strcpy (name, Cmd_Argv (1));
|
strncpy (name, demoname, sizeof (name));
|
||||||
COM_DefaultExtension (name, ".dem");
|
COM_DefaultExtension (name, ".dem");
|
||||||
|
|
||||||
Con_Printf ("Playing demo from %s.\n", name);
|
Con_Printf ("Playing demo from %s.\n", name);
|
||||||
|
@ -323,7 +313,37 @@ CL_PlayDemo_f (void)
|
||||||
// ZOID, fscanf is evil
|
// ZOID, fscanf is evil
|
||||||
// fscanf (cls.demofile, "%i\n", &cls.forcetrack);
|
// fscanf (cls.demofile, "%i\n", &cls.forcetrack);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
CL_PlayDemo_f
|
||||||
|
|
||||||
|
play [demoname]
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
CL_PlayDemo_f (void)
|
||||||
|
{
|
||||||
|
if (cmd_source != src_command)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Cmd_Argc () != 2) {
|
||||||
|
Con_Printf ("play <demoname> : plays a demo\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
strncpy (demoname, Cmd_Argv (1), sizeof (demoname));
|
||||||
|
CL_StartDemo ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CL_StartTimeDemo (void)
|
||||||
|
{
|
||||||
|
CL_StartDemo ();
|
||||||
|
|
||||||
|
// cls.td_starttime will be grabbed at the second frame of the demo, so
|
||||||
|
// all the loading time doesn't get counted
|
||||||
|
|
||||||
|
cls.timedemo = true;
|
||||||
|
cls.td_startframe = host_framecount;
|
||||||
|
cls.td_lastframe = -1; // get a new message this frame
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_FinishTimeDemo (void)
|
CL_FinishTimeDemo (void)
|
||||||
|
@ -340,6 +360,8 @@ CL_FinishTimeDemo (void)
|
||||||
time = 1;
|
time = 1;
|
||||||
Con_Printf ("%i frames %5.2f seconds %5.2f fps\n", frames, time,
|
Con_Printf ("%i frames %5.2f seconds %5.2f fps\n", frames, time,
|
||||||
frames / time);
|
frames / time);
|
||||||
|
if (--timedemo_count > 0)
|
||||||
|
CL_StartTimeDemo ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -354,17 +376,15 @@ CL_TimeDemo_f (void)
|
||||||
if (cmd_source != src_command)
|
if (cmd_source != src_command)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Cmd_Argc () != 2) {
|
if (Cmd_Argc () < 2 || Cmd_Argc () > 3) {
|
||||||
Con_Printf ("timedemo <demoname> : gets demo speeds\n");
|
Con_Printf ("timedemo <demoname> [count]: gets demo speeds\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Cmd_Argc () == 3) {
|
||||||
CL_PlayDemo_f ();
|
timedemo_count = atoi (Cmd_Argv (2));
|
||||||
|
} else {
|
||||||
// cls.td_starttime will be grabbed at the second frame of the demo, so
|
timedemo_count = 1;
|
||||||
// all the loading time doesn't get counted
|
}
|
||||||
|
strncpy (demoname, Cmd_Argv (1), sizeof (demoname));
|
||||||
cls.timedemo = true;
|
CL_StartTimeDemo ();
|
||||||
cls.td_startframe = host_framecount;
|
|
||||||
cls.td_lastframe = -1; // get a new message this frame
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue