add option to pause video rendering when demo playing pause

This commit is contained in:
sirius 2020-02-27 18:50:18 +08:00
parent b704ef299c
commit b5c931279f
5 changed files with 13 additions and 0 deletions

View file

@ -167,6 +167,12 @@ void CVideo::start()
m_vframe = 0;
}
void CVideo::pause()
{
if(ms_pCurrentVideo)
m_Recording ^= true;
}
void CVideo::stop()
{
m_Recording = false;

View file

@ -59,6 +59,7 @@ public:
virtual void start();
virtual void stop();
virtual void pause();
virtual void nextVideoFrame();
virtual void nextVideoFrame_thread();

View file

@ -677,6 +677,8 @@ void CDemoPlayer::DoTick()
void CDemoPlayer::Pause()
{
m_Info.m_Info.m_Paused = 1;
if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo)
IVideo::Current()->pause();
}
void CDemoPlayer::Unpause()
@ -687,6 +689,8 @@ void CDemoPlayer::Unpause()
m_Info.start_time = time_get();*/
m_Info.m_Info.m_Paused = 0;
}
if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo)
IVideo::Current()->pause();
}
int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const char *pFilename, int StorageType)

View file

@ -10,6 +10,7 @@ public:
virtual void start() = 0;
virtual void stop() = 0;
virtual void pause() = 0;
virtual void nextVideoFrame() = 0;
virtual bool frameRendered() = 0;

View file

@ -165,6 +165,7 @@ MACRO_CONFIG_INT(SvRescue, sv_rescue, 0, 0, 1, CFGFLAG_SERVER, "Allow /rescue co
MACRO_CONFIG_INT(SvRescueDelay, sv_rescue_delay, 5, 0, 1000, CFGFLAG_SERVER, "Number of seconds between two rescues")
#if defined(CONF_VIDEORECORDER)
MACRO_CONFIG_INT(ClVideoPauseWithDemo, cl_video_pausewithdemo, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Pause video rendering when demo playing pause")
MACRO_CONFIG_INT(ClVideoShowhud, cl_video_showhud, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame HUD when rendering video")
MACRO_CONFIG_INT(ClVideoShowChat, cl_video_showchat, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show chat when rendering video")
MACRO_CONFIG_INT(ClVideoSndEnable, cl_video_sound_enable, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Use sound when rendering video")