From 6f3bbcba465dc11a467d41fa905dce8a0513e5a1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Jan 2020 22:22:41 +0100 Subject: [PATCH] - fixed the demo setup for Blood. This failed to read the demos in the game directory. For those who find demos annoying there's now a demo_playloop CVAR. Currently this is only active in Blood because the other games have demos disabled because they are non-functional. --- source/blood/src/blood.cpp | 6 +++--- source/blood/src/demo.cpp | 11 +++++++++++ source/common/gamecvars.cpp | 4 +++- source/common/gamecvars.h | 2 +- source/platform/win32/i_specialpaths.cpp | 4 ++-- source/rr/src/demo.cpp | 1 - 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 6dc2050be..cbc374bd6 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -1229,7 +1229,7 @@ RESTART: goto RESTART; } UpdateNetworkMenus(); - if (!gDemo.at0 && gDemo.at59ef > 0 && gGameOptions.nGameType == 0 && !bNoDemo) + if (!gDemo.at0 && gDemo.at59ef > 0 && gGameOptions.nGameType == 0 && !bNoDemo && demo_playloop) gDemo.SetupPlayback(NULL); gQuitGame = 0; gRestartGame = 0; @@ -1237,7 +1237,7 @@ RESTART: { inputState.ClearAllInput(); } - else if (gDemo.at1 && !bAddUserMap && !bNoDemo) + else if (gDemo.at1 && !bAddUserMap && !bNoDemo && demo_playloop) gDemo.Playback(); if (gDemo.at59ef > 0) M_ClearMenus(); @@ -1388,7 +1388,7 @@ RESTART: #endif if (gGameOptions.nGameType != 0) { - if (!gDemo.at0 && gDemo.at59ef > 0 && gGameOptions.nGameType == 0 && !bNoDemo) + if (!gDemo.at0 && gDemo.at59ef > 0 && gGameOptions.nGameType == 0 && !bNoDemo && demo_playloop) gDemo.NextDemo(); videoSetViewableArea(0,0,xdim-1,ydim-1); if (!bQuickStart) diff --git a/source/blood/src/demo.cpp b/source/blood/src/demo.cpp index 0848561bd..e7e95f732 100644 --- a/source/blood/src/demo.cpp +++ b/source/blood/src/demo.cpp @@ -309,6 +309,7 @@ _DEMOPLAYBACK: while (at1 && !gQuitGame) { handleevents(); + D_ProcessEvents(); while (totalclock >= gNetFifoClock && !gQuitGame) { if (!v4) @@ -403,6 +404,16 @@ void CDemo::LoadDemoInfo(void) snprintf(zFN, BMAX_PATH, "%s%s*.dem", M_GetDemoPath().GetChars(), BloodIniPre); TArray demos; D_AddWildFile(demos, zFN); + + FStringf ini("%s.ini", BloodIniPre); + int lump = fileSystem.FindFile(ini); + if (lump >= 0) + { + auto path = fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(lump)); + ini.Format("%s*.dem", path); + D_AddWildFile(demos, ini); + } + for (auto &filename : demos) { FileReader hFile; diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index 68edf8efa..118ae4d85 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -113,9 +113,10 @@ CUSTOM_CVARD(Int, cl_autovote, 0, CVAR_ARCHIVE, "enable/disable automatic voting if (self < 0 || self > 2) self = 0; } + // Demos -CVARD_NAMED(Bool, demorec_diffcompress, demorec_diffcompress_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "Compression for diffs") +CVAR(Bool, demo_playloop, true, CVAR_ARCHIVE) // only active in Blood, because none of the other games can play demos right now. CVARD_NAMED(Bool, demorec_seeds, demorec_seeds_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable recording of random seed for later sync checking") CVARD_NAMED(Bool, demorec_diffs, demorec_diffs_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable diff recording in demos") CVARD_NAMED(Bool, demorec_force, demorec_force_cvar, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable forced demo recording") @@ -534,6 +535,7 @@ CUSTOM_CVAR(Int, playergender, 0, CVAR_USERINFO|CVAR_ARCHIVE) if (self < 0 || self > 3) self = 0; } + // Internal settings for demo recording and the multiplayer menu. These won't get saved and only are CVARs so that the menu code can use them. CVAR(Int, m_recstat, false, CVAR_NOSET) CVAR(Int, m_coop, 0, CVAR_NOSET) diff --git a/source/common/gamecvars.h b/source/common/gamecvars.h index 0c32c14cf..855223d91 100644 --- a/source/common/gamecvars.h +++ b/source/common/gamecvars.h @@ -24,7 +24,7 @@ EXTERN_CVAR(Int, cl_showweapon) EXTERN_CVAR(Int, cl_weaponswitch) EXTERN_CVAR(Int, cl_crosshairscale) -EXTERN_CVAR(Bool, demorec_diffcompress_cvar) +EXTERN_CVAR(Bool, demo_playloop) EXTERN_CVAR(Bool, demorec_seeds_cvar) EXTERN_CVAR(Bool, demoplay_diffs) EXTERN_CVAR(Bool, demoplay_showsync) diff --git a/source/platform/win32/i_specialpaths.cpp b/source/platform/win32/i_specialpaths.cpp index f51e6b322..3141b096b 100644 --- a/source/platform/win32/i_specialpaths.cpp +++ b/source/platform/win32/i_specialpaths.cpp @@ -362,8 +362,8 @@ FString M_GetDemoPath() FString path; // A portable INI means that this storage location should also be portable. - path.Format("%s" GAMENAME "_portable.ini", progdir.GetChars()); - if (FileExists(path) || !UseKnownFolders()) + FStringf inipath("%s" GAMENAME "_portable.ini", progdir.GetChars()); + if (FileExists(inipath) || !UseKnownFolders()) { path << progdir << "Demos/" << LumpFilter << '/'; } diff --git a/source/rr/src/demo.cpp b/source/rr/src/demo.cpp index 24cb83719..ab4df0cd0 100644 --- a/source/rr/src/demo.cpp +++ b/source/rr/src/demo.cpp @@ -47,7 +47,6 @@ static int32_t g_demo_soundToggle; static int32_t demo_hasdiffs, demorec_diffs=1, demorec_difftics = 2*REALGAMETICSPERSEC; int32_t demoplay_diffs=1; -int32_t demorec_diffcompress_cvar=1; int32_t demorec_seeds_cvar=1; int32_t demoplay_showsync=1;