New command: pausedemo. Can pause the current recording of a demo.

This commit is contained in:
eukos 2015-08-24 02:15:33 +02:00
parent b0c1d1ce20
commit bc0b6bf950
3 changed files with 30 additions and 2 deletions

View file

@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "globaldef.h"
void CL_FinishTimeDemo (void);
int CL_DemoPaused = 0;
/*
==============================================================================
@ -56,6 +56,26 @@ void CL_StopPlayback (void)
CL_FinishTimeDemo ();
}
/*
==============
CL_DemoPause_f
Pauses the recording of an ongoing demo.
==============
*/
void CL_DemoPause_f (void)
{
if (!cls.demorecording)
{
Con_Printf ("Not recording a demo.\n");
return;
}
CL_DemoPaused = 1 - CL_DemoPaused;
Con_Printf(CL_DemoPaused == 1 ? "Recording Paused\n" : "Recording Resumed\n");
}
/*
====================
CL_WriteDemoMessage
@ -65,6 +85,9 @@ Dumps the current net message, prefixed by the length and view angles
*/
void CL_WriteDemoMessage (void)
{
if(CL_DemoPaused)
return;
int len;
int i;
float f;
@ -181,6 +204,8 @@ void CL_Stop_f (void)
return;
}
CL_DemoPaused = 0;
// write a disconnect message to the demo file
SZ_Clear (&net_message);
MSG_WriteByte (&net_message, svc_disconnect);
@ -262,6 +287,7 @@ void CL_Record_f (void)
fprintf (cls.demofile, "%i\n", cls.forcetrack);
cls.demorecording = true;
CL_DemoPaused = 0;
}
@ -291,7 +317,7 @@ void CL_PlayDemo_f (void)
// disconnect from server
//
CL_Disconnect ();
CL_DemoPaused = 0;
//
// open the demo file
//

View file

@ -1287,6 +1287,7 @@ void CL_Init (void)
Cmd_AddCommand ("entities", CL_PrintEntities_f);
Cmd_AddCommand ("disconnect", CL_Disconnect_f);
Cmd_AddCommand ("record", CL_Record_f);
Cmd_AddCommand ("pausedemo", CL_DemoPause_f);
Cmd_AddCommand ("stop", CL_Stop_f);
Cmd_AddCommand ("playdemo", CL_PlayDemo_f);
Cmd_AddCommand ("timedemo", CL_TimeDemo_f);

View file

@ -503,6 +503,7 @@ void CL_StopPlayback (void);
int CL_GetMessage (void);
void CL_Stop_f (void);
void CL_DemoPause_f (void);
void CL_Record_f (void);
void CL_PlayDemo_f (void);
void CL_TimeDemo_f (void);