mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Clean up the demo api a little.
This way, I can be more assured of what might be called from outside cl_demo.c.
This commit is contained in:
parent
82038bb504
commit
2ecdec91a8
3 changed files with 47 additions and 44 deletions
|
@ -326,12 +326,8 @@ float CL_KeyState (kbutton_t *key);
|
|||
|
||||
// cl_demo.c
|
||||
void CL_StopPlayback (void);
|
||||
void CL_StopRecording (void);
|
||||
int CL_GetMessage (void);
|
||||
|
||||
void CL_Stop_f (void);
|
||||
void CL_Record_f (void);
|
||||
void CL_PlayDemo_f (void);
|
||||
void CL_TimeDemo_f (void);
|
||||
void CL_Demo_Init (void);
|
||||
|
||||
extern struct cvar_s *demo_gzip;
|
||||
|
|
|
@ -79,26 +79,6 @@ read from the demo file.
|
|||
*/
|
||||
|
||||
|
||||
/*
|
||||
CL_StopPlayback
|
||||
|
||||
Called when a demo file runs out, or the user starts a game
|
||||
*/
|
||||
void
|
||||
CL_StopPlayback (void)
|
||||
{
|
||||
if (!cls.demoplayback)
|
||||
return;
|
||||
|
||||
Qclose (cls.demofile);
|
||||
cls.demoplayback = false;
|
||||
cls.demofile = NULL;
|
||||
CL_SetState (ca_disconnected);
|
||||
|
||||
if (cls.timedemo)
|
||||
CL_FinishTimeDemo ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_WriteDemoMessage
|
||||
|
@ -123,6 +103,42 @@ CL_WriteDemoMessage (void)
|
|||
Qflush (cls.demofile);
|
||||
}
|
||||
|
||||
/*
|
||||
CL_StopPlayback
|
||||
|
||||
Called when a demo file runs out, or the user starts a game
|
||||
*/
|
||||
void
|
||||
CL_StopPlayback (void)
|
||||
{
|
||||
if (!cls.demoplayback)
|
||||
return;
|
||||
|
||||
Qclose (cls.demofile);
|
||||
cls.demoplayback = false;
|
||||
cls.demofile = NULL;
|
||||
CL_SetState (ca_disconnected);
|
||||
|
||||
if (cls.timedemo)
|
||||
CL_FinishTimeDemo ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_StopRecording (void)
|
||||
{
|
||||
// write a disconnect message to the demo file
|
||||
SZ_Clear (net_message->message);
|
||||
MSG_WriteByte (net_message->message, svc_disconnect);
|
||||
CL_WriteDemoMessage ();
|
||||
|
||||
// finish up
|
||||
Qclose (cls.demofile);
|
||||
cls.demofile = NULL;
|
||||
cls.demorecording = false;
|
||||
Sys_Printf ("Completed demo\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_GetMessage
|
||||
|
@ -198,7 +214,7 @@ CL_GetMessage (void)
|
|||
|
||||
stop recording a demo
|
||||
*/
|
||||
void
|
||||
static void
|
||||
CL_Stop_f (void)
|
||||
{
|
||||
if (cmd_source != src_command)
|
||||
|
@ -208,16 +224,7 @@ CL_Stop_f (void)
|
|||
Sys_Printf ("Not recording a demo.\n");
|
||||
return;
|
||||
}
|
||||
// write a disconnect message to the demo file
|
||||
SZ_Clear (net_message->message);
|
||||
MSG_WriteByte (net_message->message, svc_disconnect);
|
||||
CL_WriteDemoMessage ();
|
||||
|
||||
// finish up
|
||||
Qclose (cls.demofile);
|
||||
cls.demofile = NULL;
|
||||
cls.demorecording = false;
|
||||
Sys_Printf ("Completed demo\n");
|
||||
CL_StopRecording ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -226,7 +233,7 @@ CL_Stop_f (void)
|
|||
|
||||
record <demoname> <map> [cd track]
|
||||
*/
|
||||
void
|
||||
static void
|
||||
CL_Record_f (void)
|
||||
{
|
||||
int c;
|
||||
|
@ -339,7 +346,7 @@ CL_StartDemo (void)
|
|||
|
||||
play [demoname]
|
||||
*/
|
||||
void
|
||||
static void
|
||||
CL_PlayDemo_f (void)
|
||||
{
|
||||
if (cmd_source != src_command)
|
||||
|
@ -431,7 +438,7 @@ CL_FinishTimeDemo (void)
|
|||
|
||||
timedemo [demoname]
|
||||
*/
|
||||
void
|
||||
static void
|
||||
CL_TimeDemo_f (void)
|
||||
{
|
||||
if (cmd_source != src_command)
|
||||
|
@ -468,4 +475,8 @@ CL_Demo_Init (void)
|
|||
"< 1 slow-mo, > 1 timelapse");
|
||||
demo_quit = Cvar_Get ("demo_quit", "0", CVAR_NONE, NULL,
|
||||
"automaticly quit after a timedemo has finished");
|
||||
Cmd_AddCommand ("record", CL_Record_f, "No Description");
|
||||
Cmd_AddCommand ("stop", CL_Stop_f, "No Description");
|
||||
Cmd_AddCommand ("playdemo", CL_PlayDemo_f, "No Description");
|
||||
Cmd_AddCommand ("timedemo", CL_TimeDemo_f, "No Description");
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ CL_Disconnect (void)
|
|||
CL_StopPlayback ();
|
||||
else if (cls.state == ca_connected) {
|
||||
if (cls.demorecording)
|
||||
CL_Stop_f ();
|
||||
CL_StopRecording ();
|
||||
|
||||
Sys_MaskPrintf (SYS_DEV, "Sending clc_disconnect\n");
|
||||
SZ_Clear (&cls.message);
|
||||
|
@ -771,10 +771,6 @@ CL_Init (void)
|
|||
|
||||
Cmd_AddCommand ("entities", CL_PrintEntities_f, "No Description");
|
||||
Cmd_AddCommand ("disconnect", CL_Disconnect_f, "No Description");
|
||||
Cmd_AddCommand ("record", CL_Record_f, "No Description");
|
||||
Cmd_AddCommand ("stop", CL_Stop_f, "No Description");
|
||||
Cmd_AddCommand ("playdemo", CL_PlayDemo_f, "No Description");
|
||||
Cmd_AddCommand ("timedemo", CL_TimeDemo_f, "No Description");
|
||||
Cmd_AddCommand ("maplist", Con_Maplist_f, "List available maps");
|
||||
Cmd_AddCommand ("skyboxlist", Con_Skyboxlist_f, "List skyboxes available");
|
||||
Cmd_AddCommand ("demolist", Con_Demolist_DEM_f, "List available demos");
|
||||
|
|
Loading…
Reference in a new issue