- 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.
This commit is contained in:
Christoph Oelckers 2020-01-26 22:22:41 +01:00
parent d73f0c7b8f
commit 6f3bbcba46
6 changed files with 20 additions and 8 deletions

View file

@ -1229,7 +1229,7 @@ RESTART:
goto RESTART; goto RESTART;
} }
UpdateNetworkMenus(); 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); gDemo.SetupPlayback(NULL);
gQuitGame = 0; gQuitGame = 0;
gRestartGame = 0; gRestartGame = 0;
@ -1237,7 +1237,7 @@ RESTART:
{ {
inputState.ClearAllInput(); inputState.ClearAllInput();
} }
else if (gDemo.at1 && !bAddUserMap && !bNoDemo) else if (gDemo.at1 && !bAddUserMap && !bNoDemo && demo_playloop)
gDemo.Playback(); gDemo.Playback();
if (gDemo.at59ef > 0) if (gDemo.at59ef > 0)
M_ClearMenus(); M_ClearMenus();
@ -1388,7 +1388,7 @@ RESTART:
#endif #endif
if (gGameOptions.nGameType != 0) 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(); gDemo.NextDemo();
videoSetViewableArea(0,0,xdim-1,ydim-1); videoSetViewableArea(0,0,xdim-1,ydim-1);
if (!bQuickStart) if (!bQuickStart)

View file

@ -309,6 +309,7 @@ _DEMOPLAYBACK:
while (at1 && !gQuitGame) while (at1 && !gQuitGame)
{ {
handleevents(); handleevents();
D_ProcessEvents();
while (totalclock >= gNetFifoClock && !gQuitGame) while (totalclock >= gNetFifoClock && !gQuitGame)
{ {
if (!v4) if (!v4)
@ -403,6 +404,16 @@ void CDemo::LoadDemoInfo(void)
snprintf(zFN, BMAX_PATH, "%s%s*.dem", M_GetDemoPath().GetChars(), BloodIniPre); snprintf(zFN, BMAX_PATH, "%s%s*.dem", M_GetDemoPath().GetChars(), BloodIniPre);
TArray<FString> demos; TArray<FString> demos;
D_AddWildFile(demos, zFN); 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) for (auto &filename : demos)
{ {
FileReader hFile; FileReader hFile;

View file

@ -113,9 +113,10 @@ CUSTOM_CVARD(Int, cl_autovote, 0, CVAR_ARCHIVE, "enable/disable automatic voting
if (self < 0 || self > 2) self = 0; if (self < 0 || self > 2) self = 0;
} }
// Demos // 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_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_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") 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; 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. // 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_recstat, false, CVAR_NOSET)
CVAR(Int, m_coop, 0, CVAR_NOSET) CVAR(Int, m_coop, 0, CVAR_NOSET)

View file

@ -24,7 +24,7 @@ EXTERN_CVAR(Int, cl_showweapon)
EXTERN_CVAR(Int, cl_weaponswitch) EXTERN_CVAR(Int, cl_weaponswitch)
EXTERN_CVAR(Int, cl_crosshairscale) 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, demorec_seeds_cvar)
EXTERN_CVAR(Bool, demoplay_diffs) EXTERN_CVAR(Bool, demoplay_diffs)
EXTERN_CVAR(Bool, demoplay_showsync) EXTERN_CVAR(Bool, demoplay_showsync)

View file

@ -362,8 +362,8 @@ FString M_GetDemoPath()
FString path; FString path;
// A portable INI means that this storage location should also be portable. // A portable INI means that this storage location should also be portable.
path.Format("%s" GAMENAME "_portable.ini", progdir.GetChars()); FStringf inipath("%s" GAMENAME "_portable.ini", progdir.GetChars());
if (FileExists(path) || !UseKnownFolders()) if (FileExists(inipath) || !UseKnownFolders())
{ {
path << progdir << "Demos/" << LumpFilter << '/'; path << progdir << "Demos/" << LumpFilter << '/';
} }

View file

@ -47,7 +47,6 @@ static int32_t g_demo_soundToggle;
static int32_t demo_hasdiffs, demorec_diffs=1, demorec_difftics = 2*REALGAMETICSPERSEC; static int32_t demo_hasdiffs, demorec_diffs=1, demorec_difftics = 2*REALGAMETICSPERSEC;
int32_t demoplay_diffs=1; int32_t demoplay_diffs=1;
int32_t demorec_diffcompress_cvar=1;
int32_t demorec_seeds_cvar=1; int32_t demorec_seeds_cvar=1;
int32_t demoplay_showsync=1; int32_t demoplay_showsync=1;