From d4d426e64b97d4072e51af6aaf38ef04613743e2 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Thu, 29 Feb 2024 17:43:07 -0700 Subject: [PATCH 1/3] Add "let's get fired up!" cheat (4th Gear) --- src/cvars.cpp | 1 + src/d_netcmd.h | 2 +- src/k_kart.c | 4 ++++ src/m_cheat.c | 24 ++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/cvars.cpp b/src/cvars.cpp index 2b439d89e..88847ce6f 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -903,6 +903,7 @@ 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/d_netcmd.h b/src/d_netcmd.h index d1d0fa643..2d0a19c52 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -98,7 +98,7 @@ extern consvar_t cv_kartdebugstart; extern consvar_t cv_debugrank; extern consvar_t cv_battletest; -extern consvar_t cv_mentalsonic; +extern consvar_t cv_mentalsonic, cv_4thgear; typedef enum { CV_CAPSULETEST_OFF, diff --git a/src/k_kart.c b/src/k_kart.c index 0444d3c11..8ae672d86 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -422,6 +422,10 @@ fixed_t K_GetKartGameSpeedScalar(SINT8 value) // Normal = 100% // Hard = 118.75% // Nightmare = 137.5% ?!?! + + if (cv_4thgear.value && !netgame && (!demo.playback || !demo.netgame) && !modeattacking) + value = 3; + return ((13 + (3*value)) << FRACBITS) / 16; } diff --git a/src/m_cheat.c b/src/m_cheat.c index 4564fe9bb..1ad272ab0 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -177,6 +177,22 @@ static UINT8 cheatf_mentalsonic(void) return 1; } +static UINT8 cheatf_4thgear(void) +{ + cv_4thgear.value = !(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); + S_StartSound(NULL, sfx_gshc4); + } + else + { + S_StartSound(NULL, sfx_kc46); + } + + return 1; +} + #ifdef DEVELOP static UINT8 cheatf_devmode(void) { @@ -254,6 +270,13 @@ static cheatseq_t cheat_mentalsonic = { NULL, cheatf_mentalsonic, (UINT8[]){ SCRAMBLE('m'), SCRAMBLE('e'), SCRAMBLE('n'), SCRAMBLE('t'), SCRAMBLE('a'), SCRAMBLE('l'), SCRAMBLE(' '), SCRAMBLE('s'), SCRAMBLE('o'), SCRAMBLE('n'), SCRAMBLE('i'), SCRAMBLE('c'), 0xff } }; +static cheatseq_t cheat_4thgear = { + NULL, cheatf_4thgear, + (UINT8[]){ SCRAMBLE('l'), SCRAMBLE('e'), SCRAMBLE('t'), SCRAMBLE('\''), SCRAMBLE('s'), SCRAMBLE(' '), + SCRAMBLE('g'), SCRAMBLE('e'), SCRAMBLE('t'), SCRAMBLE(' '), + SCRAMBLE('f'), SCRAMBLE('i'), SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE(' '), + SCRAMBLE('u'), SCRAMBLE('p'), SCRAMBLE('!'), 0xff } +}; #ifdef DEVELOP @@ -275,6 +298,7 @@ cheatseq_t *cheatseqlist[] = &cheat_savetheanimals, &cheat_savetheframes, &cheat_mentalsonic, + &cheat_4thgear, #ifdef DEVELOP &cheat_devmode, &cheat_skipgoner, From fff200d174161f71617a332b38d211d20f4dc967 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 1 Mar 2024 07:28:17 -0800 Subject: [PATCH 2/3] 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); From b3ff71ad0f9ed5c5ef56f4d06c7438af1e8cf41e Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 1 Mar 2024 07:31:44 -0800 Subject: [PATCH 3/3] Fix cv_mentalsonic too --- src/m_cheat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 9c826b369..150ce22d4 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -164,7 +164,7 @@ static UINT8 cheatf_savetheframes(void) static UINT8 cheatf_mentalsonic(void) { - cv_mentalsonic.value = !(cv_mentalsonic.value); + CV_SetValue(&cv_mentalsonic, !cv_mentalsonic.value); if (cv_mentalsonic.value) { S_StartSound(NULL, sfx_gshbb);