From 0c6820b35009a9019ae65a684fc266df74cc36ab Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 23 Jan 2024 00:28:08 -0700 Subject: [PATCH 1/2] "mental sonic" cheat --- src/cvars.cpp | 2 ++ src/d_netcmd.h | 2 ++ src/k_kart.c | 3 +++ src/m_cheat.c | 22 ++++++++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/src/cvars.cpp b/src/cvars.cpp index fd93e79f8..82d0b12f1 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -892,6 +892,8 @@ consvar_t cv_palettenum = PlayerCheat("palettenum", "0").values(CV_Unsigned).onc 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"); + // // Dummy variables used solely in the menu system. // todo: add a way to use non-console variables in the menu diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 21bdc53bd..b3b58de8b 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -98,6 +98,8 @@ extern consvar_t cv_kartdebugstart; extern consvar_t cv_debugrank; extern consvar_t cv_battletest; +extern consvar_t cv_mentalsonic; + typedef enum { CV_CAPSULETEST_OFF, CV_CAPSULETEST_MULTIPLAYER, diff --git a/src/k_kart.c b/src/k_kart.c index 7334567a9..b04135e98 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5983,6 +5983,9 @@ void K_Squish(mobj_t *mo) mo->spriteyscale = FixedDiv(FRACUNIT, mo->spritexscale); + + if (cv_mentalsonic.value && mo->type == MT_PLAYER) + mo->spriteyscale *= 2; } static mobj_t *K_FindLastTrailMobj(player_t *player) diff --git a/src/m_cheat.c b/src/m_cheat.c index f6bdda6bf..12b921d56 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -162,6 +162,21 @@ static UINT8 cheatf_savetheframes(void) return 1; } +static UINT8 cheatf_mentalsonic(void) +{ + cv_mentalsonic.value = !(cv_mentalsonic.value); + if (cv_mentalsonic.value) + { + S_StartSound(NULL, sfx_gshbb); + } + else + { + S_StartSound(NULL, sfx_kc46); + } + + return 1; +} + #ifdef DEVELOP static UINT8 cheatf_devmode(void) { @@ -235,6 +250,12 @@ static cheatseq_t cheat_savetheframes = { (UINT8[]){ SCRAMBLE('s'), SCRAMBLE('a'), SCRAMBLE('v'), SCRAMBLE('e'), SCRAMBLE('t'), SCRAMBLE('h'), SCRAMBLE('e'), SCRAMBLE('f'), SCRAMBLE('r'), SCRAMBLE('a'), SCRAMBLE('m'), SCRAMBLE('e'), SCRAMBLE('s'), 0xff } }; +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 } +}; + + #ifdef DEVELOP static cheatseq_t cheat_devmode = { NULL, cheatf_devmode, @@ -253,6 +274,7 @@ cheatseq_t *cheatseqlist[] = &cheat_wrongwarp, &cheat_savetheanimals, &cheat_savetheframes, + &cheat_mentalsonic, #ifdef DEVELOP &cheat_devmode, &cheat_skipgoner, From 4b245b7a857b0680144749c3b76acc5b7d308dc2 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 23 Jan 2024 04:55:32 -0700 Subject: [PATCH 2/2] Allow mentalsonic to affect things targeting players --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index b04135e98..2447db8b6 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5984,7 +5984,7 @@ void K_Squish(mobj_t *mo) mo->spriteyscale = FixedDiv(FRACUNIT, mo->spritexscale); - if (cv_mentalsonic.value && mo->type == MT_PLAYER) + if (cv_mentalsonic.value && (mo->type == MT_PLAYER || (!P_MobjWasRemoved(mo->target) && mo->target->type == MT_PLAYER))) mo->spriteyscale *= 2; }