Merge pull request #7046 from infclass/kaffeine/drop-rendering-paused-by-default

Remove cl_video_pause_on_start; reset the pause option on popup opened
This commit is contained in:
Robert Müller 2023-08-19 11:42:54 +00:00 committed by GitHub
commit 7c1a667486
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 8 deletions

View file

@ -165,7 +165,7 @@ public:
virtual void Quit() = 0;
virtual const char *DemoPlayer_Play(const char *pFilename, int StorageType) = 0;
#if defined(CONF_VIDEORECORDER)
virtual const char *DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName, int SpeedIndex) = 0;
virtual const char *DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName, int SpeedIndex, bool StartPaused = false) = 0;
#endif
virtual void DemoRecorder_Start(const char *pFilename, bool WithTimestamp, int Recorder) = 0;
virtual void DemoRecorder_HandleAutoStart() = 0;

View file

@ -3910,7 +3910,7 @@ const char *CClient::DemoPlayer_Play(const char *pFilename, int StorageType)
}
#if defined(CONF_VIDEORECORDER)
const char *CClient::DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName, int SpeedIndex)
const char *CClient::DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName, int SpeedIndex, bool StartPaused)
{
const char *pError = DemoPlayer_Play(pFilename, StorageType);
if(pError)
@ -3920,7 +3920,7 @@ const char *CClient::DemoPlayer_Render(const char *pFilename, int StorageType, c
this->CClient::StartVideo(NULL, this, pVideoName);
m_DemoPlayer.Play();
m_DemoPlayer.SetSpeedIndex(SpeedIndex);
if(Config()->m_ClVideoPauseOnStart)
if(StartPaused)
{
m_DemoPlayer.Pause();
}

View file

@ -448,7 +448,7 @@ public:
static void StartVideo(IConsole::IResult *pResult, void *pUserData, const char *pVideoName);
static void Con_StartVideo(IConsole::IResult *pResult, void *pUserData);
static void Con_StopVideo(IConsole::IResult *pResult, void *pUserData);
const char *DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName, int SpeedIndex) override;
const char *DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName, int SpeedIndex, bool StartPaused = false) override;
#endif
static void Con_Rcon(IConsole::IResult *pResult, void *pUserData);

View file

@ -1635,7 +1635,7 @@ int CMenus::Render()
Part.VSplitLeft(ButtonSize, &Button, &Part);
static CButtonContainer s_PausedButton;
if(DoButton_FontIcon(&s_PausedButton, FONT_ICON_PAUSE, 0, &Button, IGraphics::CORNER_ALL))
g_Config.m_ClVideoPauseOnStart ^= 1;
m_StartPaused ^= 1;
// fastforward
Part.VSplitLeft(5.0f, 0, &Part);
@ -1647,7 +1647,7 @@ int CMenus::Render()
// speed meter
Part.VSplitLeft(8.0f, 0, &Part);
char aBuffer[128];
const char *pPaused = g_Config.m_ClVideoPauseOnStart ? Localize("(paused)") : "";
const char *pPaused = m_StartPaused ? Localize("(paused)") : "";
str_format(aBuffer, sizeof(aBuffer), "%s: ×%g %s", Localize("Speed"), g_aSpeeds[m_Speed], pPaused);
UI()->DoLabel(&Part, aBuffer, 12.8f, TEXTALIGN_ML);
@ -1798,8 +1798,9 @@ void CMenus::PopupConfirmDemoReplaceVideo()
str_copy(aVideoName, m_DemoRenderInput.GetString());
if(!str_endswith(aVideoName, ".mp4"))
str_append(aVideoName, ".mp4");
const char *pError = Client()->DemoPlayer_Render(aBuf, m_vDemos[m_DemolistSelectedIndex].m_StorageType, aVideoName, m_Speed);
const char *pError = Client()->DemoPlayer_Render(aBuf, m_vDemos[m_DemolistSelectedIndex].m_StorageType, aVideoName, m_Speed, m_StartPaused);
m_Speed = 4;
m_StartPaused = false;
if(pError)
PopupMessage(Localize("Error"), str_comp(pError, "error loading demo") ? pError : Localize("Error loading demo"), Localize("Ok"));
}

View file

@ -330,6 +330,7 @@ protected:
int m_DemolistStorageType;
bool m_DemolistMultipleStorages = false;
int m_Speed = 4;
bool m_StartPaused = false;
std::chrono::nanoseconds m_DemoPopulateStartTime{0};

View file

@ -1329,6 +1329,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
if(DoButton_Menu(&s_RenderButton, Localize("Render"), 0, &RenderRect) || (Input()->KeyPress(KEY_R) && m_pClient->m_GameConsole.IsClosed()))
{
m_Popup = POPUP_RENDER_DEMO;
m_StartPaused = false;
char aNameWithoutExt[IO_MAX_PATH_LENGTH];
fs_split_file_extension(m_vDemos[m_DemolistSelectedIndex].m_aFilename, aNameWithoutExt, sizeof(aNameWithoutExt));
m_DemoRenderInput.Set(aNameWithoutExt);

View file

@ -212,7 +212,6 @@ MACRO_CONFIG_INT(ClVideoPauseWithDemo, cl_video_pausewithdemo, 1, 0, 1, CFGFLAG_
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")
MACRO_CONFIG_INT(ClVideoPauseOnStart, cl_video_pause_on_start, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Pause video rendering on start")
MACRO_CONFIG_INT(ClVideoShowHookCollOther, cl_video_show_hook_coll_other, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show other players' hook collision lines when rendering video")
MACRO_CONFIG_INT(ClVideoShowDirection, cl_video_show_direction, 0, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show players' key presses when rendering video (1 = other players', 2 = also your own)")
MACRO_CONFIG_INT(ClVideoX264Crf, cl_video_crf, 18, 0, 51, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Set crf when encode video with libx264 (0 for highest quality, 51 for lowest)")