From fff200d174161f71617a332b38d211d20f4dc967 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 1 Mar 2024 07:28:17 -0800 Subject: [PATCH] Save 4thgear cheat in replays For a cvar cheat to save in replays do this: - Make sure it's a netvar - Only netvars are saved in replays - Use OnlineCheat - Make sure it's not CV_HIDDEN - CV_HIDDEN cvars are not added to the linked list, so replays cannot find them - Use CV_NOSHOWHELP instead, to prevent people from modifying it in console - Use CV_Set or CV_SetValue to change a cvar's value - Setting cvar_t.value directly will not change its string value - The string value is used to determine how it should be saved in replays --- src/cvars.cpp | 3 ++- src/m_cheat.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cvars.cpp b/src/cvars.cpp index 88847ce6f..9b077c58c 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -787,6 +787,8 @@ consvar_t cv_votetime = UnsavedNetVar("votetime", "20").min_max(10, 3600); // Cheats don't save... // +consvar_t cv_4thgear = OnlineCheat("4thgear", "Off").values(CV_OnOff).flags(CV_NOSHOWHELP).description("Surpassing your limits!"); + consvar_t cv_barriertime = OnlineCheat("barriertime", "30").values(CV_Natural).description("How long it takes for the Barrier to shrink in Battle Overtime"); consvar_t cv_battlespawn = OnlineCheat("battlespawn", "0").values(CV_Unsigned).description("Spawn every player at the same spawnpoint in Battle (0 = random spawns)"); consvar_t cv_battletest = OnlineCheat("battletest", "Off").on_off().description("Free Play goes to Battle instead of Prisons"); @@ -903,7 +905,6 @@ extern CV_PossibleValue_t renderhitbox_cons_t[]; consvar_t cv_renderhitbox = PlayerCheat("renderhitbox", "Off").values(renderhitbox_cons_t).description("Show hitboxes around objects"); consvar_t cv_mentalsonic = PlayerCheat("mentalsonic", "Off").values(CV_OnOff).flags(CV_HIDDEN).description("Works out at the library"); -consvar_t cv_4thgear = PlayerCheat("4thgear", "Off").values(CV_OnOff).flags(CV_HIDDEN).description("Surpassing your limits!"); // // Dummy variables used solely in the menu system. diff --git a/src/m_cheat.c b/src/m_cheat.c index 1ad272ab0..9c826b369 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -179,7 +179,7 @@ static UINT8 cheatf_mentalsonic(void) static UINT8 cheatf_4thgear(void) { - cv_4thgear.value = !(cv_4thgear.value); + CV_SetValue(&cv_4thgear, !cv_4thgear.value); if (cv_4thgear.value) { M_StartMessage("Restraint device compromised!", "Local play sped up to ""\x85""4th Gear!""\x80""\nLet's see what you're made of!\n\n""\x86""No effect in netplay and attack modes.", NULL, MM_NOTHING, NULL, NULL);