From 679f666f6ac551c54b32b471b410353cb993f1f6 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Tue, 30 Apr 2024 17:16:33 +1000 Subject: [PATCH] demos: Add cvar cl_startdemos, allow longer startdemos arguments Signed-off-by: bones_was_here --- cl_demo.c | 11 +++++++++++ cl_main.c | 1 + client.h | 1 + menu.c | 2 ++ qdefs.h | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cl_demo.c b/cl_demo.c index a11d63b5..f44e539f 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -674,6 +674,16 @@ static void CL_Startdemos_f(cmd_state_t *cmd) if (!sv.active && cls.demonum != -1 && !cls.demoplayback) { + if (!cl_startdemos.integer) + { + cls.demonum = -1; +#ifdef CONFIG_MENU + // make the menu appear after a gamedir change + if(MR_ToggleMenu) + MR_ToggleMenu(1); +#endif + return; + } cls.demonum = 0; CL_NextDemo (); } @@ -737,4 +747,5 @@ void CL_Demo_Init(void) Cvar_RegisterVariable (&cl_autodemo); Cvar_RegisterVariable (&cl_autodemo_nameformat); Cvar_RegisterVariable (&cl_autodemo_delete); + Cvar_RegisterVariable (&cl_startdemos); } diff --git a/cl_main.c b/cl_main.c index 7a40ad45..dd961172 100644 --- a/cl_main.c +++ b/cl_main.c @@ -61,6 +61,7 @@ cvar_t freelook = {CF_CLIENT | CF_ARCHIVE, "freelook", "1","mouse controls pitch cvar_t cl_autodemo = {CF_CLIENT | CF_ARCHIVE, "cl_autodemo", "0", "records every game played, using the date/time and map name to name the demo file" }; cvar_t cl_autodemo_nameformat = {CF_CLIENT | CF_ARCHIVE, "cl_autodemo_nameformat", "autodemos/%Y-%m-%d_%H-%M", "The format of the cl_autodemo filename, followed by the map name (the date is encoded using strftime escapes)" }; cvar_t cl_autodemo_delete = {CF_CLIENT, "cl_autodemo_delete", "0", "Delete demos after recording. This is a bitmask, bit 1 gives the default, bit 0 the value for the current demo. Thus, the values are: 0 = disabled; 1 = delete current demo only; 2 = delete all demos except the current demo; 3 = delete all demos from now on" }; +cvar_t cl_startdemos = {CF_CLIENT | CF_ARCHIVE, "cl_startdemos", "1", "1 enables the `startdemos` loop used in Quake and some mods, 0 goes straight to the menu"}; cvar_t r_draweffects = {CF_CLIENT, "r_draweffects", "1","renders temporary sprite effects"}; diff --git a/client.h b/client.h index 9523196d..3cfaf5bf 100644 --- a/client.h +++ b/client.h @@ -1189,6 +1189,7 @@ extern cvar_t m_side; extern cvar_t cl_autodemo; extern cvar_t cl_autodemo_nameformat; extern cvar_t cl_autodemo_delete; +extern cvar_t cl_startdemos; extern cvar_t r_draweffects; diff --git a/menu.c b/menu.c index 2c93c36b..6519feca 100644 --- a/menu.c +++ b/menu.c @@ -497,6 +497,8 @@ static void M_Main_Key(cmd_state_t *cmd, int key, int ascii) key_dest = key_game; m_state = m_none; //cls.demonum = m_save_demonum; + //if(!cl_startdemos.integer) + // break; //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected) // CL_NextDemo (); break; diff --git a/qdefs.h b/qdefs.h index a79230db..92770227 100644 --- a/qdefs.h +++ b/qdefs.h @@ -116,7 +116,7 @@ #define CVAR_HASHSIZE 65536 ///< number of hash buckets for accelerating cvar name lookups #define M_MAX_EDICTS 32768 ///< max objects in menu vm #define MAX_DEMOS 8 ///< max demos provided to demos command -#define MAX_DEMONAME 16 ///< max demo name length for demos command +#define MAX_DEMONAME 32 ///< max demo name length for demos command #define MAX_SAVEGAMES 12 ///< max savegames listed in savegame menu #define SAVEGAME_COMMENT_LENGTH 39 ///< max comment length of savegame in menu #define MAX_CLIENTNETWORKEYES 16 ///< max number of locations that can be added to pvs when culling network entities (must be at least 2 for prediction) -- 2.39.2