From: Reki Date: Tue, 25 May 2021 19:12:42 +0000 (-0400) Subject: Autodemo : stopped auto demos from trampling manual ones X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=199def66098659479e0424a14d54db376a0b850f;p=xonotic%2Fdarkplaces.git Autodemo : stopped auto demos from trampling manual ones --- diff --git a/cl_demo.c b/cl_demo.c index a3be2148..8f65fd21 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -395,7 +395,8 @@ void CL_Record_f(cmd_state_t *cmd) cls.forcetrack = track; FS_Printf(cls.demofile, "%i\n", cls.forcetrack); - + + cls.demorecording_isauto = false; cls.demorecording = true; cls.demo_lastcsprogssize = -1; cls.demo_lastcsprogscrc = -1; diff --git a/cl_parse.c b/cl_parse.c index 5707a323..2703c677 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1910,42 +1910,58 @@ static void CL_ParseServerInfo (void) // check memory integrity Mem_CheckSentinelsGlobal(); - + + // Reki 5-25-21: the comment below this is a lie in default DP // if cl_autodemo is set, automatically start recording a demo if one isn't being recorded already if (cl_autodemo.integer && cls.netcon && cls.protocol != PROTOCOL_QUAKEWORLD) { - char demofile[MAX_OSPATH]; - + int record_autodemo = false; + if (cls.demorecording) { - // finish the previous level's demo file - CL_Stop_f(cmd_client); + if (cls.demorecording_isauto) + { + // Reki 5-25-21: we only do this if it's an autodemo + // finish the previous level's demo file + CL_Stop_f(cmd_client); + record_autodemo = true; + } + } + else + { + record_autodemo = true; } + + if (record_autodemo) + { + char demofile[MAX_OSPATH]; - // start a new demo file - dpsnprintf (demofile, sizeof(demofile), "%s_%s.dem", Sys_TimeString (cl_autodemo_nameformat.string), cl.worldbasename); + // start a new demo file + dpsnprintf (demofile, sizeof(demofile), "%s_%s.dem", Sys_TimeString (cl_autodemo_nameformat.string), cl.worldbasename); - Con_Printf ("Auto-recording to %s.\n", demofile); + Con_Printf ("Auto-recording to %s.\n", demofile); - // Reset bit 0 for every new demo - Cvar_SetValueQuick(&cl_autodemo_delete, - (cl_autodemo_delete.integer & ~0x1) - | - ((cl_autodemo_delete.integer & 0x2) ? 0x1 : 0) - ); + // Reset bit 0 for every new demo + Cvar_SetValueQuick(&cl_autodemo_delete, + (cl_autodemo_delete.integer & ~0x1) + | + ((cl_autodemo_delete.integer & 0x2) ? 0x1 : 0) + ); - cls.demofile = FS_OpenRealFile(demofile, "wb", false); - if (cls.demofile) - { - cls.forcetrack = -1; - FS_Printf (cls.demofile, "%i\n", cls.forcetrack); - cls.demorecording = true; - strlcpy(cls.demoname, demofile, sizeof(cls.demoname)); - cls.demo_lastcsprogssize = -1; - cls.demo_lastcsprogscrc = -1; + cls.demofile = FS_OpenRealFile(demofile, "wb", false); + if (cls.demofile) + { + cls.forcetrack = -1; + FS_Printf (cls.demofile, "%i\n", cls.forcetrack); + cls.demorecording = true; + cls.demorecording_isauto = true; + strlcpy(cls.demoname, demofile, sizeof(cls.demoname)); + cls.demo_lastcsprogssize = -1; + cls.demo_lastcsprogscrc = -1; + } + else + Con_Print(CON_ERROR "ERROR: couldn't open.\n"); } - else - Con_Print(CON_ERROR "ERROR: couldn't open.\n"); } } cl.islocalgame = NetConn_IsLocalGame(); diff --git a/client.h b/client.h index b4e8eb7a..c0e5cd82 100644 --- a/client.h +++ b/client.h @@ -583,6 +583,7 @@ typedef struct client_static_s // demo recording info must be here, because record is started before // entering a map (and clearing client_state_t) qbool demorecording; + qbool demorecording_isauto; fs_offset_t demo_lastcsprogssize; int demo_lastcsprogscrc; qbool demoplayback;