From 29688fb499135675e317057ba0b8ca7c79a633f8 Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Sat, 19 Aug 2023 13:37:41 +0300 Subject: [PATCH] Remove cl_video_pause_on_start; reset the pause option on popup opened --- src/engine/client.h | 2 +- src/engine/client/client.cpp | 4 ++-- src/engine/client/client.h | 2 +- src/game/client/components/menus.cpp | 7 ++++--- src/game/client/components/menus.h | 1 + src/game/client/components/menus_demo.cpp | 1 + src/game/variables.h | 1 - 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/engine/client.h b/src/engine/client.h index b98ba9b80..33a8d2cc4 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -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; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 9391c141b..eaac7b945 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -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(); } diff --git a/src/engine/client/client.h b/src/engine/client/client.h index c46a69f64..a57dd5fce 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -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); diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 23a48932a..20370348d 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -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")); } diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 497437957..d5b2cc71a 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -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}; diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index a19e9eeb5..4f32c79fc 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -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); diff --git a/src/game/variables.h b/src/game/variables.h index f2285da79..4cefb6bc6 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -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)")