From 1590976046b89db2ef54ddee3293d48d3ee454e9 Mon Sep 17 00:00:00 2001 From: Leon422 Date: Tue, 19 May 2020 18:31:01 +0100 Subject: [PATCH 1/2] Cheats can be enabled by pressing the L trigger 3 times while in the options menu. Also plays a sound to confirm the user that it worked. --- src/game/options_menu.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/game/options_menu.c b/src/game/options_menu.c index de0e04f4..61d8978d 100644 --- a/src/game/options_menu.c +++ b/src/game/options_menu.c @@ -30,6 +30,9 @@ u8 optmenu_open = 0; static u8 optmenu_binding = 0; static u8 optmenu_bind_idx = 0; +/* Keeps track of how many times the user has pressed L while in the options menu, so cheats can be unlocked */ +static s32 l_counter = 0; + // How to add stuff: // strings: add them to include/text_strings.h.in // and to menuStr[] / opts*Str[] @@ -481,6 +484,9 @@ void optmenu_toggle(void) { currentMenu = &menuMain; optmenu_open = 1; + + /* Resets l_counter to 0 every time the options menu is open */ + l_counter = 0; } else { #ifndef nosound play_sound(SOUND_MENU_MARIO_CASTLE_WARP2, gDefaultSoundArgs); @@ -510,7 +516,19 @@ void optmenu_check_buttons(void) { if (gPlayer1Controller->buttonPressed & R_TRIG) optmenu_toggle(); - + + /* Enables cheats if the user press the L trigger 3 times while in the options menu. Also plays a sound. */ + + if (gPlayer1Controller->buttonPressed & L_TRIG && !Cheats.EnableCheats){ + if (l_counter == 2){ + Cheats.EnableCheats = true; + play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + l_counter = 0; + } else { + l_counter++; + } + } + if (!optmenu_open) return; u8 allowInput = 0; From c0a79af79cc6b889ca0a957029ef38a61c671cd6 Mon Sep 17 00:00:00 2001 From: Leon422 Date: Tue, 19 May 2020 19:15:20 +0100 Subject: [PATCH 2/2] Fixed spacing, added brackets. Ready to merge --- src/game/options_menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/options_menu.c b/src/game/options_menu.c index 61d8978d..6c9c1a1c 100644 --- a/src/game/options_menu.c +++ b/src/game/options_menu.c @@ -519,8 +519,8 @@ void optmenu_check_buttons(void) { /* Enables cheats if the user press the L trigger 3 times while in the options menu. Also plays a sound. */ - if (gPlayer1Controller->buttonPressed & L_TRIG && !Cheats.EnableCheats){ - if (l_counter == 2){ + if ((gPlayer1Controller->buttonPressed & L_TRIG) && !Cheats.EnableCheats) { + if (l_counter == 2) { Cheats.EnableCheats = true; play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); l_counter = 0;