From ab72f3e1b4e22dce6d82ebef28175df9c65e0d31 Mon Sep 17 00:00:00 2001 From: GateGuy <57763469+GateGuy@users.noreply.github.com> Date: Wed, 20 May 2020 00:39:12 -0400 Subject: [PATCH 1/6] Added cheat: Stay in level after star Added a cheat that makes you stay in a level after collecting a star. You can hold L while collecting a star to temporarily disable this effect. This cheat has no effect on Bowser keys, or stars that already make you stay in the level in the base game. Also, if you have a better name than "Stay in level after star", be my guest. "Stay in level after getting a star (hold L to cancel)" doesn't fit in the cheat description. --- include/text_strings.h.in | 1 + src/game/interaction.c | 5 +++++ src/game/options_menu.c | 2 ++ src/pc/cheats.h | 1 + 4 files changed, 9 insertions(+) diff --git a/include/text_strings.h.in b/include/text_strings.h.in index d4ec173aa..f67666034 100644 --- a/include/text_strings.h.in +++ b/include/text_strings.h.in @@ -59,6 +59,7 @@ #define TEXT_OPT_CHEAT7 _("Exit course at any time") #define TEXT_OPT_CHEAT8 _("Huge Mario") #define TEXT_OPT_CHEAT9 _("Tiny Mario") +#define TEXT_OPT_CHEAT10 _("Stay in level after star") /** * Global Symbols */ diff --git a/src/game/interaction.c b/src/game/interaction.c index b8f3f881e..52f5ea1e9 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -21,6 +21,7 @@ #include "seq_ids.h" #include "course_table.h" #include "thread6.h" +#include "pc/cheats.h" #define INT_GROUND_POUND_OR_TWIRL (1 << 0) // 0x01 #define INT_PUNCH (1 << 1) // 0x02 @@ -766,6 +767,10 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O u32 starIndex; u32 starGrabAction = ACT_STAR_DANCE_EXIT; u32 noExit = (o->oInteractionSubtype & INT_SUBTYPE_NO_EXIT) != 0; + if (Cheats.StayInLevel == TRUE && Cheats.EnableCheats == TRUE && !(m->controller->buttonDown & L_TRIG) && + !(gCurrLevelNum == LEVEL_BOWSER_1 || gCurrLevelNum == LEVEL_BOWSER_2 || gCurrLevelNum == LEVEL_BOWSER_3)) { + noExit = TRUE; + } u32 grandStar = (o->oInteractionSubtype & INT_SUBTYPE_GRAND_STAR) != 0; if (m->health >= 0x100) { diff --git a/src/game/options_menu.c b/src/game/options_menu.c index 6c9c1a1c9..b93724b6c 100644 --- a/src/game/options_menu.c +++ b/src/game/options_menu.c @@ -96,6 +96,7 @@ static const u8 optsCheatsStr[][64] = { { TEXT_OPT_CHEAT7 }, { TEXT_OPT_CHEAT8 }, { TEXT_OPT_CHEAT9 }, + { TEXT_OPT_CHEAT10 }, }; static const u8 bindStr[][32] = { @@ -257,6 +258,7 @@ static struct Option optsCheats[] = { DEF_OPT_TOGGLE( optsCheatsStr[6], &Cheats.ExitAnywhere ), DEF_OPT_TOGGLE( optsCheatsStr[7], &Cheats.HugeMario ), DEF_OPT_TOGGLE( optsCheatsStr[8], &Cheats.TinyMario ), + DEF_OPT_TOGGLE( optsCheatsStr[9], &Cheats.StayInLevel ), }; diff --git a/src/pc/cheats.h b/src/pc/cheats.h index eaf71ab4b..0a06034e2 100644 --- a/src/pc/cheats.h +++ b/src/pc/cheats.h @@ -13,6 +13,7 @@ struct CheatList { bool ExitAnywhere; bool HugeMario; bool TinyMario; + bool StayInLevel; }; extern struct CheatList Cheats; From 95f70457a18a980574a9f53ca16144f1539fd566 Mon Sep 17 00:00:00 2001 From: GateGuy Date: Fri, 22 May 2020 18:17:33 -0400 Subject: [PATCH 2/6] Resolved merge conflict with new separate options file --- include/text_options_strings.h.in | 139 ++++++++++++++++++++++++++++++ include/text_strings.h.in | 67 ++------------ 2 files changed, 146 insertions(+), 60 deletions(-) create mode 100644 include/text_options_strings.h.in diff --git a/include/text_options_strings.h.in b/include/text_options_strings.h.in new file mode 100644 index 000000000..5151f1a56 --- /dev/null +++ b/include/text_options_strings.h.in @@ -0,0 +1,139 @@ +#ifndef TEXT_OPTIONS_STRINGS_H +#define TEXT_OPTIONS_STRINGS_H + +/* Extended options menu text */ + +// Menu title strings + +#define TEXT_OPT_OPTIONS _("OPTIONS") +#define TEXT_OPT_CAMERA _("CAMERA") +#define TEXT_OPT_CONTROLS _("CONTROLS") +#define TEXT_OPT_VIDEO _("DISPLAY") +#define TEXT_OPT_AUDIO _("SOUND") +#define TEXT_OPT_CHEATS _("CHEATS") + +// Markers + +#define TEXT_OPT_HIGHLIGHT _("O") +#define TEXT_OPT_UNBOUND _("NONE") + +// Language specific strings + +#if defined(VERSION_JP) || defined(VERSION_SH) + +// TODO: Actually translate this to JP + +// No . in JP + +#define TEXT_OPT_PRESSKEY _("・・・") + +// Option strings + +#define TEXT_OPT_BUTTON1 _("R OPTIONS") +#define TEXT_OPT_BUTTON2 _("R RETURN") +#define TEXT_OPT_ENABLED _("ENABLED") +#define TEXT_OPT_DISABLED _("DISABLED") +#define TEXT_OPT_CAMX _("CAMERA X SENSITIVITY") +#define TEXT_OPT_CAMY _("CAMERA Y SENSITIVITY") +#define TEXT_OPT_INVERTX _("INVERT X AXIS") +#define TEXT_OPT_INVERTY _("INVERT Y AXIS") +#define TEXT_OPT_CAMC _("CAMERA CENTRE AGGRESSION") +#define TEXT_OPT_CAMP _("CAMERA PAN LEVEL") +#define TEXT_OPT_CAMD _("CAMERA DECELERATION") +#define TEXT_OPT_ANALOGUE _("ANALOGUE CAMERA") +#define TEXT_OPT_MOUSE _("MOUSE LOOK") +#define TEXT_OPT_TEXFILTER _("TEXTURE FILTERING") +#define TEXT_OPT_FSCREEN _("FULLSCREEN") +#define TEXT_OPT_NEAREST _("NEAREST") +#define TEXT_OPT_LINEAR _("LINEAR") +#define TEXT_OPT_MVOLUME _("MASTER VOLUME") +#define TEXT_OPT_VSYNC _("VERTICAL SYNC") +#define TEXT_OPT_DOUBLE _("DOUBLE") +#define TEXT_RESET_WINDOW _("RESET WINDOW") +#define TEXT_OPT_HUD _("HUD") + +#define TEXT_BIND_A _("A BUTTON") +#define TEXT_BIND_B _("B BUTTON") +#define TEXT_BIND_START _("START BUTTON") +#define TEXT_BIND_L _("L TRIGGER") +#define TEXT_BIND_R _("R TRIGGER") +#define TEXT_BIND_Z _("Z TRIGGER") +#define TEXT_BIND_C_UP _("C-UP") +#define TEXT_BIND_C_DOWN _("C-DOWN") +#define TEXT_BIND_C_LEFT _("C-LEFT") +#define TEXT_BIND_C_RIGHT _("C-RIGHT") +#define TEXT_BIND_UP _("STICK UP") +#define TEXT_BIND_DOWN _("STICK DOWN") +#define TEXT_BIND_LEFT _("STICK LEFT") +#define TEXT_BIND_RIGHT _("STICK RIGHT") + +#define TEXT_OPT_CHEAT1 _("ENABLE CHEATS") +#define TEXT_OPT_CHEAT2 _("MOONJUMP (PRESS L)") +#define TEXT_OPT_CHEAT3 _("INVINCIBLE MARIO") +#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") +#define TEXT_OPT_CHEAT10 _("Stay in level after star") + +#else // VERSION + +// Markers + +#define TEXT_OPT_PRESSKEY _("...") + +// Option strings + +#define TEXT_OPT_BUTTON1 _("[R] Options") +#define TEXT_OPT_BUTTON2 _("[R] Return") +#define TEXT_OPT_ENABLED _("Enabled") +#define TEXT_OPT_DISABLED _("Disabled") +#define TEXT_OPT_CAMX _("Camera X Sensitivity") +#define TEXT_OPT_CAMY _("Camera Y Sensitivity") +#define TEXT_OPT_INVERTX _("Invert X Axis") +#define TEXT_OPT_INVERTY _("Invert Y Axis") +#define TEXT_OPT_CAMC _("Camera Centre Aggression") +#define TEXT_OPT_CAMP _("Camera Pan Level") +#define TEXT_OPT_CAMD _("Camera Deceleration") +#define TEXT_OPT_ANALOGUE _("Analogue Camera") +#define TEXT_OPT_MOUSE _("Mouse Look") +#define TEXT_OPT_TEXFILTER _("Texture Filtering") +#define TEXT_OPT_FSCREEN _("Fullscreen") +#define TEXT_OPT_NEAREST _("Nearest") +#define TEXT_OPT_LINEAR _("Linear") +#define TEXT_OPT_MVOLUME _("Master Volume") +#define TEXT_OPT_VSYNC _("Vertical Sync") +#define TEXT_OPT_DOUBLE _("Double") +#define TEXT_RESET_WINDOW _("Reset Window") +#define TEXT_OPT_HUD _("HUD") + +#define TEXT_BIND_A _("A Button") +#define TEXT_BIND_B _("B Button") +#define TEXT_BIND_START _("Start Button") +#define TEXT_BIND_L _("L Trigger") +#define TEXT_BIND_R _("R Trigger") +#define TEXT_BIND_Z _("Z Trigger") +#define TEXT_BIND_C_UP _("C-Up") +#define TEXT_BIND_C_DOWN _("C-Down") +#define TEXT_BIND_C_LEFT _("C-Left") +#define TEXT_BIND_C_RIGHT _("C-Right") +#define TEXT_BIND_UP _("Stick Up") +#define TEXT_BIND_DOWN _("Stick Down") +#define TEXT_BIND_LEFT _("Stick Left") +#define TEXT_BIND_RIGHT _("Stick Right") + +#define TEXT_OPT_CHEAT1 _("Enable cheats") +#define TEXT_OPT_CHEAT2 _("Moonjump (Press L)") +#define TEXT_OPT_CHEAT3 _("Invincible Mario") +#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") + +#endif // VERSION + +#endif // TEXT_OPTIONS_STRINGS_H \ No newline at end of file diff --git a/include/text_strings.h.in b/include/text_strings.h.in index f67666034..a259af223 100644 --- a/include/text_strings.h.in +++ b/include/text_strings.h.in @@ -1,65 +1,12 @@ - #ifndef TEXT_STRINGS_H +#ifndef TEXT_STRINGS_H #define TEXT_STRINGS_H #include "text_menu_strings.h" -#define TEXT_OPT_CAMX _("Camera X Sensitivity") -#define TEXT_OPT_CAMY _("Camera Y Sensitivity") -#define TEXT_OPT_INVERTX _("Invert X Axis") -#define TEXT_OPT_INVERTY _("Invert Y Axis") -#define TEXT_OPT_CAMC _("Camera Centre Aggression") -#define TEXT_OPT_CAMP _("Camera Pan Level") -#define TEXT_OPT_CAMD _("Camera Deceleration") -#define TEXT_OPT_ENABLED _("Enabled") -#define TEXT_OPT_DISABLED _("Disabled") -#define TEXT_OPT_BUTTON1 _("[R]: Options") -#define TEXT_OPT_BUTTON2 _("[R]: Return") -#define TEXT_OPT_OPTIONS _("OPTIONS") -#define TEXT_OPT_CAMERA _("CAMERA") -#define TEXT_OPT_CONTROLS _("CONTROLS") -#define TEXT_OPT_VIDEO _("DISPLAY") -#define TEXT_OPT_AUDIO _("SOUND") -#define TEXT_OPT_HIGHLIGHT _("O") -#define TEXT_OPT_ANALOGUE _("Analogue Camera") -#define TEXT_OPT_MOUSE _("Mouse Look") -#define TEXT_OPT_TEXFILTER _("Texture Filtering") -#define TEXT_OPT_FSCREEN _("Fullscreen") -#define TEXT_OPT_NEAREST _("Nearest") -#define TEXT_OPT_LINEAR _("Linear") -#define TEXT_OPT_MVOLUME _("Master Volume") -#define TEXT_OPT_VSYNC _("Vertical Sync") -#define TEXT_OPT_DOUBLE _("Double") -#define TEXT_RESET_WINDOW _("Reset Window") -#define TEXT_OPT_HUD _("HUD") - -#define TEXT_OPT_UNBOUND _("NONE") -#define TEXT_OPT_PRESSKEY _("...") -#define TEXT_BIND_A _("A Button") -#define TEXT_BIND_B _("B Button") -#define TEXT_BIND_START _("Start Button") -#define TEXT_BIND_L _("L Trigger") -#define TEXT_BIND_R _("R Trigger") -#define TEXT_BIND_Z _("Z Trigger") -#define TEXT_BIND_C_UP _("C-Up") -#define TEXT_BIND_C_DOWN _("C-Down") -#define TEXT_BIND_C_LEFT _("C-Left") -#define TEXT_BIND_C_RIGHT _("C-Right") -#define TEXT_BIND_UP _("Stick Up") -#define TEXT_BIND_DOWN _("Stick Down") -#define TEXT_BIND_LEFT _("Stick Left") -#define TEXT_BIND_RIGHT _("Stick Right") - -#define TEXT_OPT_CHEATS _("CHEATS") -#define TEXT_OPT_CHEAT1 _("Enable cheats") -#define TEXT_OPT_CHEAT2 _("Moonjump (Press L)") -#define TEXT_OPT_CHEAT3 _("Invincible Mario") -#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") -#define TEXT_OPT_CHEAT10 _("Stay in level after star") +#ifdef EXT_OPTIONS_MENU +#include "text_options_strings.h" +#endif + /** * Global Symbols */ @@ -147,7 +94,7 @@ #define TEXT_COURSE _("コース") #define TEXT_MYSCORE _("マイスコア") #define TEXT_CONTINUE _("つづけて マリオする?") -#define TEXT_EXIT_GAME _("ゲームをしゅうりょうする?") +#define TEXT_EXIT_GAME _("ゲームをしゅうりょうする") #define TEXT_EXIT_COURSE _("コースからでる?") #define TEXT_CAMERA_ANGLE_R _("Rボタンのカメラきりかえ") @@ -537,4 +484,4 @@ #define TEXT_MENU_STARS_DE _(" GEHEIME STERNE") #endif -#endif +#endif \ No newline at end of file From a2100239433c2d770e153b6fab077b5431870e5c Mon Sep 17 00:00:00 2001 From: GateGuy <57763469+GateGuy@users.noreply.github.com> Date: Sat, 30 May 2020 13:23:02 -0400 Subject: [PATCH 3/6] Fixed underwater camera bug Also re-added an option line that was removed earlier due to merging. --- include/text_options_strings.h.in | 1 + src/game/mario_actions_cutscene.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/text_options_strings.h.in b/include/text_options_strings.h.in index f79dd6b9a..d5a87507c 100644 --- a/include/text_options_strings.h.in +++ b/include/text_options_strings.h.in @@ -133,6 +133,7 @@ #define TEXT_OPT_CHEAT7 _("Exit course at any time") #define TEXT_OPT_CHEAT8 _("Huge Mario") #define TEXT_OPT_CHEAT9 _("Tiny Mario") +#define TEXT_OPT_CHEAT10 _("Stay in level after star") #endif // VERSION diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index ef413cd98..f22eec559 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -29,6 +29,7 @@ #include "thread6.h" #include "../../include/libc/stdlib.h" #include "../pc/pc_main.h" +#include "pc/cheats.h" // TODO: put this elsewhere enum SaveOption { SAVE_OPT_SAVE_AND_CONTINUE = 1, SAVE_OPT_SAVE_AND_QUIT, SAVE_OPT_SAVE_EXIT_GAME, SAVE_OPT_CONTINUE_DONT_SAVE }; @@ -645,6 +646,11 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) { set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, dialogID); } else { set_mario_action(m, isInWater ? ACT_WATER_IDLE : ACT_IDLE, 0); + // fix camera bug when getting a star underwater with StayInLevel cheat enabled + if (isInWater && Cheats.StayInLevel == TRUE && Cheats.EnableCheats == TRUE) { + cutscene_exit_painting_end(m->area->camera); + set_fov_function(CAM_FOV_DEFAULT); + } } } } From a3e12d2fe0d9196b2e73ace52c01a38562eab21a Mon Sep 17 00:00:00 2001 From: GateGuy <57763469+GateGuy@users.noreply.github.com> Date: Sat, 30 May 2020 13:24:10 -0400 Subject: [PATCH 4/6] Fixed text not being all caps --- include/text_options_strings.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/text_options_strings.h.in b/include/text_options_strings.h.in index d5a87507c..42b1221d5 100644 --- a/include/text_options_strings.h.in +++ b/include/text_options_strings.h.in @@ -76,7 +76,7 @@ #define TEXT_OPT_CHEAT7 _("EXIT COURSE AT ANY TIME") #define TEXT_OPT_CHEAT8 _("HUGE MARIO") #define TEXT_OPT_CHEAT9 _("TINY MARIO") -#define TEXT_OPT_CHEAT10 _("Stay in level after star") +#define TEXT_OPT_CHEAT10 _("STAY IN LEVEL AFTER STAR") #else // VERSION From 3548d1cb507a1c2d04d9efe966d0917e0839eda3 Mon Sep 17 00:00:00 2001 From: GateGuy <57763469+GateGuy@users.noreply.github.com> Date: Sat, 30 May 2020 13:30:55 -0400 Subject: [PATCH 5/6] Adjusted fov behavior --- src/game/mario_actions_cutscene.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index f22eec559..50f8c9180 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -646,10 +646,12 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) { set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, dialogID); } else { set_mario_action(m, isInWater ? ACT_WATER_IDLE : ACT_IDLE, 0); - // fix camera bug when getting a star underwater with StayInLevel cheat enabled - if (isInWater && Cheats.StayInLevel == TRUE && Cheats.EnableCheats == TRUE) { - cutscene_exit_painting_end(m->area->camera); + if (Cheats.StayInLevel == TRUE && Cheats.EnableCheats == TRUE) { set_fov_function(CAM_FOV_DEFAULT); + // fix camera bug when getting a star underwater with StayInLevel cheat enabled + if (isInWater) { + cutscene_exit_painting_end(m->area->camera); + } } } } From aa469e2e7e3fc53673097ac1ada0751a854c747f Mon Sep 17 00:00:00 2001 From: GateGuy <57763469+GateGuy@users.noreply.github.com> Date: Wed, 3 Jun 2020 19:20:26 -0400 Subject: [PATCH 6/6] Added Non-Stop mode In this mode, getting a star autosaves and does not activate any animation or dialog box; there's no interruption. --- include/text_options_strings.h.in | 8 ++++++++ src/game/interaction.c | 11 ++++++++--- src/game/mario_actions_cutscene.c | 2 +- src/game/options_menu.c | 14 +++++++++++++- src/pc/cheats.h | 2 +- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/include/text_options_strings.h.in b/include/text_options_strings.h.in index f051296a5..268da4a17 100644 --- a/include/text_options_strings.h.in +++ b/include/text_options_strings.h.in @@ -79,6 +79,10 @@ #define TEXT_OPT_CHEAT9 _("TINY MARIO") #define TEXT_OPT_CHEAT10 _("STAY IN LEVEL AFTER STAR") +#define TEXT_CHEAT_STAY1 _("DISABLED") +#define TEXT_CHEAT_STAY2 _("ENABLED (NORMAL)") +#define TEXT_CHEAT_STAY3 _("ENABLED (NON-STOP)") + #else // VERSION // Markers @@ -137,6 +141,10 @@ #define TEXT_OPT_CHEAT9 _("Tiny Mario") #define TEXT_OPT_CHEAT10 _("Stay in level after star") +#define TEXT_CHEAT_STAY1 _("Disabled") +#define TEXT_CHEAT_STAY2 _("Enabled (Normal)") +#define TEXT_CHEAT_STAY3 _("Enabled (Non-Stop)") + #endif // VERSION #endif // TEXT_OPTIONS_STRINGS_H diff --git a/src/game/interaction.c b/src/game/interaction.c index 52f5ea1e9..16e078623 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -767,8 +767,9 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O u32 starIndex; u32 starGrabAction = ACT_STAR_DANCE_EXIT; u32 noExit = (o->oInteractionSubtype & INT_SUBTYPE_NO_EXIT) != 0; - if (Cheats.StayInLevel == TRUE && Cheats.EnableCheats == TRUE && !(m->controller->buttonDown & L_TRIG) && - !(gCurrLevelNum == LEVEL_BOWSER_1 || gCurrLevelNum == LEVEL_BOWSER_2 || gCurrLevelNum == LEVEL_BOWSER_3)) { + u8 stayInLevelCommon = (Cheats.StayInLevel > 0 && Cheats.EnableCheats == TRUE && !(m->controller->buttonDown & L_TRIG) && + !(gCurrLevelNum == LEVEL_BOWSER_1 || gCurrLevelNum == LEVEL_BOWSER_2 || gCurrLevelNum == LEVEL_BOWSER_3)); + if (Cheats.StayInLevel > 0 && stayInLevelCommon == TRUE) { noExit = TRUE; } u32 grandStar = (o->oInteractionSubtype & INT_SUBTYPE_GRAND_STAR) != 0; @@ -830,7 +831,11 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O return set_mario_action(m, ACT_JUMBO_STAR_CUTSCENE, 0); } - return set_mario_action(m, starGrabAction, noExit + 2 * grandStar); + if (Cheats.StayInLevel != 2 || stayInLevelCommon == FALSE) { + return set_mario_action(m, starGrabAction, noExit + 2 * grandStar); + } + //If nonstop StayInLevel is enabled, autosave + save_file_do_save(gCurrSaveFileNum - 1); } return FALSE; diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 50f8c9180..b071e7c02 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -646,7 +646,7 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) { set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, dialogID); } else { set_mario_action(m, isInWater ? ACT_WATER_IDLE : ACT_IDLE, 0); - if (Cheats.StayInLevel == TRUE && Cheats.EnableCheats == TRUE) { + if (Cheats.StayInLevel > 0 && Cheats.EnableCheats == TRUE) { set_fov_function(CAM_FOV_DEFAULT); // fix camera bug when getting a star underwater with StayInLevel cheat enabled if (isInWater) { diff --git a/src/game/options_menu.c b/src/game/options_menu.c index 048d68c29..0b04c5822 100644 --- a/src/game/options_menu.c +++ b/src/game/options_menu.c @@ -99,6 +99,12 @@ static const u8 optsCheatsStr[][64] = { { TEXT_OPT_CHEAT10 }, }; +static const u8 optsStayInLevelStr[][32] = { + { TEXT_CHEAT_STAY1 }, + { TEXT_CHEAT_STAY2 }, + { TEXT_CHEAT_STAY3 }, +}; + static const u8 bindStr[][32] = { { TEXT_OPT_UNBOUND }, { TEXT_OPT_PRESSKEY }, @@ -130,6 +136,12 @@ static const u8 *vsyncChoices[] = { optsVideoStr[6], }; +static const u8 *stayInLevelChoices[] = { + optsStayInLevelStr[0], + optsStayInLevelStr[1], + optsStayInLevelStr[2], +}; + enum OptType { OPT_INVALID = 0, OPT_TOGGLE, @@ -262,7 +274,7 @@ static struct Option optsCheats[] = { DEF_OPT_TOGGLE( optsCheatsStr[6], &Cheats.ExitAnywhere ), DEF_OPT_TOGGLE( optsCheatsStr[7], &Cheats.HugeMario ), DEF_OPT_TOGGLE( optsCheatsStr[8], &Cheats.TinyMario ), - DEF_OPT_TOGGLE( optsCheatsStr[9], &Cheats.StayInLevel ), + DEF_OPT_CHOICE( optsCheatsStr[9], &Cheats.StayInLevel, stayInLevelChoices ), }; diff --git a/src/pc/cheats.h b/src/pc/cheats.h index 0a06034e2..321b8ee7e 100644 --- a/src/pc/cheats.h +++ b/src/pc/cheats.h @@ -13,7 +13,7 @@ struct CheatList { bool ExitAnywhere; bool HugeMario; bool TinyMario; - bool StayInLevel; + unsigned int StayInLevel; }; extern struct CheatList Cheats;