From 8586c7657ae804d845bf03a8b577068658b1ee05 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 18 May 2020 17:51:53 +0100 Subject: [PATCH] Added "Exit course at any time", "Huge Mario" and "Tiny Mario" cheats The exit course at any time cheat clears up one of the TODO items while keeping purists happy since it's optional :) --- include/text_strings.h.in | 4 +++- src/game/ingame_menu.c | 6 ++++-- src/game/mario.c | 17 ++++++++++++++++- src/game/options_menu.c | 6 ++++++ src/pc/cheats.h | 3 +++ 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/include/text_strings.h.in b/include/text_strings.h.in index 06173692..50c47785 100644 --- a/include/text_strings.h.in +++ b/include/text_strings.h.in @@ -53,7 +53,9 @@ #define TEXT_OPT_CHEAT4 _("Infinite lives") #define TEXT_OPT_CHEAT5 _("Super speed") #define TEXT_OPT_CHEAT6 _("Super responsive controls") - +#define TEXT_OPT_CHEAT7 _("Exit course at any time") +#define TEXT_OPT_CHEAT8 _("Huge Mario") +#define TEXT_OPT_CHEAT9 _("Tiny Mario") /** * Global Symbols */ diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index baaeaf71..4ef6ecf8 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -19,6 +19,7 @@ #include "print.h" #include "engine/math_util.h" #include "course_table.h" +#include "pc/cheats.h" #ifdef BETTERCAMERA #include "bettercamera.h" #endif @@ -2629,8 +2630,9 @@ s16 render_pause_courses_and_castle(void) { shade_screen(); render_pause_my_score_coins(); render_pause_red_coins(); - - if (gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT) { + +/* Added support for the "Exit course at any time" cheat */ + if ((gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT) || (Cheats.EnableCheats && Cheats.ExitAnywhere)) { render_pause_course_options(99, 93, &gDialogLineNum, 15); } diff --git a/src/game/mario.c b/src/game/mario.c index afeab9ae..e00d6e60 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -1215,8 +1215,23 @@ u8 sSquishScaleOverTime[16] = { 0x46, 0x32, 0x32, 0x3C, 0x46, 0x50, 0x50, 0x3C, void squish_mario_model(struct MarioState *m) { if (m->squishTimer != 0xFF) { // If no longer squished, scale back to default. + // Also handles the Tiny Mario and Huge Mario cheats. if (m->squishTimer == 0) { - vec3f_set(m->marioObj->header.gfx.scale, 1.0f, 1.0f, 1.0f); + if (Cheats.EnableCheats) { + if (Cheats.HugeMario) { + vec3f_set(m->marioObj->header.gfx.scale, 2.5f, 2.5f, 2.5f); + } + else if (Cheats.TinyMario) { + vec3f_set(m->marioObj->header.gfx.scale, 0.2f, 0.2f, 0.2f); + } + else { + vec3f_set(m->marioObj->header.gfx.scale, 1.0f, 1.0f, 1.0f); + } + } + else { + vec3f_set(m->marioObj->header.gfx.scale, 1.0f, 1.0f, 1.0f); + } + } // If timer is less than 16, rubber-band Mario's size scale up and down. else if (m->squishTimer <= 16) { diff --git a/src/game/options_menu.c b/src/game/options_menu.c index b9033bee..f8c2af3a 100644 --- a/src/game/options_menu.c +++ b/src/game/options_menu.c @@ -86,6 +86,9 @@ static const u8 optsCheatsStr[][64] = { { TEXT_OPT_CHEAT4 }, { TEXT_OPT_CHEAT5 }, { TEXT_OPT_CHEAT6 }, + { TEXT_OPT_CHEAT7 }, + { TEXT_OPT_CHEAT8 }, + { TEXT_OPT_CHEAT9 }, }; static const u8 bindStr[][32] = { @@ -232,6 +235,9 @@ static struct Option optsCheats[] = { DEF_OPT_TOGGLE( optsCheatsStr[3], &Cheats.InfiniteLives ), DEF_OPT_TOGGLE( optsCheatsStr[4], &Cheats.SuperSpeed), DEF_OPT_TOGGLE( optsCheatsStr[5], &Cheats.Responsive), + DEF_OPT_TOGGLE( optsCheatsStr[6], &Cheats.ExitAnywhere), + DEF_OPT_TOGGLE( optsCheatsStr[7], &Cheats.HugeMario), + DEF_OPT_TOGGLE( optsCheatsStr[8], &Cheats.TinyMario), }; diff --git a/src/pc/cheats.h b/src/pc/cheats.h index 01a7264b..4941a465 100644 --- a/src/pc/cheats.h +++ b/src/pc/cheats.h @@ -8,6 +8,9 @@ struct CheatList bool InfiniteLives; bool SuperSpeed; bool Responsive; + bool ExitAnywhere; + bool HugeMario; + bool TinyMario; }; extern struct CheatList Cheats;