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
This commit is contained in:
James R 2024-03-01 07:28:17 -08:00
parent d4d426e64b
commit fff200d174
2 changed files with 3 additions and 2 deletions

View file

@ -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.

View file

@ -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);