mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-02 22:11:22 +00:00
Support pausing demo playback.
This is done by adding an extra 'demopaused' flag to client_static_t, separate from cl.paused because we don't want a svc_setpause inside the demo (caused by the player pausing during recording) to actually pause demo playback. The only potential failure case is, if the demo contains a svc_stufftext of the command "pause", the demo will pause itself when being played. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1147 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
e26923ec8a
commit
171b08cf39
4 changed files with 18 additions and 0 deletions
|
@ -54,6 +54,7 @@ void CL_StopPlayback (void)
|
|||
|
||||
fclose (cls.demofile);
|
||||
cls.demoplayback = false;
|
||||
cls.demopaused = false;
|
||||
cls.demofile = NULL;
|
||||
cls.state = ca_disconnected;
|
||||
|
||||
|
@ -90,6 +91,9 @@ static int CL_GetDemoMessage (void)
|
|||
int r, i;
|
||||
float f;
|
||||
|
||||
if (cls.demopaused)
|
||||
return 0;
|
||||
|
||||
// decide if it is time to grab the next message
|
||||
if (cls.signon == SIGNONS) // always grab until fully connected
|
||||
{
|
||||
|
@ -436,6 +440,7 @@ void CL_PlayDemo_f (void)
|
|||
cls.forcetrack = -cls.forcetrack;
|
||||
|
||||
cls.demoplayback = true;
|
||||
cls.demopaused = false;
|
||||
cls.state = ca_connected;
|
||||
|
||||
// get rid of the menu and/or console
|
||||
|
|
|
@ -142,6 +142,7 @@ void CL_Disconnect (void)
|
|||
}
|
||||
|
||||
cls.demoplayback = cls.timedemo = false;
|
||||
cls.demopaused = false;
|
||||
cls.signon = 0;
|
||||
cl.intermission = 0;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,11 @@ typedef struct
|
|||
// entering a map (and clearing client_state_t)
|
||||
qboolean demorecording;
|
||||
qboolean demoplayback;
|
||||
|
||||
// did the user pause demo playback? (separate from cl.paused because we don't
|
||||
// want a svc_setpause inside the demo to actually pause demo playback).
|
||||
qboolean demopaused;
|
||||
|
||||
qboolean timedemo;
|
||||
int forcetrack; // -1 = use normal cd track
|
||||
FILE *demofile;
|
||||
|
|
|
@ -1408,6 +1408,13 @@ Host_Pause_f
|
|||
*/
|
||||
void Host_Pause_f (void)
|
||||
{
|
||||
//ericw -- demo pause support (inspired by MarkV)
|
||||
if (cls.demoplayback && cls.demonum == -1) // Don't allow startdemos to be paused
|
||||
{
|
||||
cls.demopaused = !cls.demopaused;
|
||||
cl.paused = cls.demopaused;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd_source == src_command)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue