Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

Undertale: Quit game in SETUP

Mason3633a1ce96a4fdd
diff --git a/docs/play.md b/docs/play.md
index 9d35cc88..aaa80a12 100644
--- a/docs/play.md
+++ b/docs/play.md
@@ -271,7 +271,7 @@ Every sport shows its rules and keys before it starts. Your progress is also cop
| **Arrows** (or 4, 6, 8, 2) | Walk, move your SOUL, choose |
| **OK**, **EXE** or 5 | Talk, read, confirm (Z in the game) |
| **Back** or **⌫** | Cancel, show the whole text at once (X in the game) |
-| **toolbox**, **shift** or **var** | The menu: ITEM, STAT, CELL (C in the game) |
+| **toolbox**, **shift** or **var** | The menu: ITEM, STAT, CELL (C in the game), SETUP (Quit game is there) |
| **Home** | Keep the moment and quit |
Name the fallen human, then walk and talk your way through the Ruins, Snowdin, Waterfall, Hotland, the MTT Resort, the CORE and New Home. In a battle, FIGHT attacks (press **OK** when the bar crosses the middle), ACT checks a monster or does something to it, ITEM eats, and MERCY spares a monster that no longer wants to fight, or flees. Then move your SOUL to dodge; when it turns blue, it falls, and **Up** jumps; when it turns green, it stays put, and the arrows turn its shield to block. On ice you slide until something stops you. In Snowdin Town, walk into the shop to buy, and into the inn to rest. In Waterfall, walk into a bridge seed to push it into the water, where it blooms into a flower you can walk on; the bell calls the seeds back. A green bullet heals you. Walk up to a star and press **OK** to SAVE. Home keeps the moment you were at, and the next start is back there. Your save is also copied into `undertale_saves.py`, so installing the app again doesn't erase it. The Tem Shop in Temmie Village also buys what you carry. In Hotland, steam vents throw you over the lava, orange lasers hit you if you stand still and blue ones if you move, and in a shooting puzzle the arrows push the dark blocks and Z shoots. On the second floor, press the switches as the top conveyor belt carries you past them, and in Mettaton's news report, touch each bomb and defuse it while it's in the DEFUSE ZONE. When Muffet turns your SOUL purple, it keeps to three strings: **Up** and **Down** hop between them. In the tile puzzle, red tiles are walls, yellow ones shock you back, orange makes you smell of oranges (and blue water's piranhas bite then), and purple soap slides you on and smells of lemons. When your SOUL turns yellow, **OK** shoots. At the MTT Resort, the desk rents you a room and the hotel's doors want room service. On the CORE's laser bridge, walk while the power is off and freeze when it comes back on. Mettaton EX's show is won on its ratings: Boast, Pose, a Heel Turn and his brand's food raise them. In New Home, find both keys to unchain the stairs. Asgore breaks MERCY, so you'll have to fight him. Against Omega Flowey, dodge, and reach the ACT button that comes down among a SOUL's attack; once all six SOULs are on your side, reach FIGHT. The game ends at the neutral ending.
diff --git a/games/undertale/README.md b/games/undertale/README.md
index 63c75a6e..8bf73d46 100644
--- a/games/undertale/README.md
+++ b/games/undertale/README.md
@@ -188,7 +188,7 @@ Walk up to a star and press OK to SAVE and fill your HP. The C menu (toolbox) sh
| Arrows (or 4, 6, 8, 2) | Walk, move your SOUL, choose |
| OK, EXE or 5 | Talk, read, confirm (Z in the game) |
| Back or ⌫ | Cancel, show the whole text at once (X in the game) |
-| Toolbox, Shift or Var | The menu: ITEM, STAT, CELL (C in the game), SETUP |
+| Toolbox, Shift or Var | The menu: ITEM, STAT, CELL (C in the game), SETUP (Quit game is there) |
| Home | Keep the moment and quit: the next start is back there |
## Good to know
diff --git a/games/undertale/src/menu.c b/games/undertale/src/menu.c
index 092aac19..ad1df367 100644
--- a/games/undertale/src/menu.c
+++ b/games/undertale/src/menu.c
@@ -58,16 +58,30 @@ static void title_open(void) {
}
/* ---------------------------------------------------------------- settings (the title's, and the C menu's) */
-static int set_sel, set_back; /* EXIT or WALK; the screen to go back to */
-static void settings_open(int back) { set_sel = 1, set_back = back; }
+static int set_sel, set_back; /* EXIT, WALK or (in a game) QUIT GAME; the screen to go back to */
+static bool set_game, set_ask; /* opened in a game: QUIT GAME too; asked: YES (set_yes) or NO */
+static int set_yes;
+static void settings_open(int back) { set_sel = 1, set_back = back, set_game = false, set_ask = false; }
/* true when it closes */
static bool settings_input(uint32_t pressed) {
- if (pressed & (K_UP | K_DOWN)) set_sel ^= 1;
+ if (set_ask) {
+ if (pressed & (K_LEFT | K_RIGHT)) set_yes ^= 1;
+ if (pressed & K_X || (pressed & K_Z && !set_yes)) set_ask = false;
+ else if (pressed & K_Z) game_quit_save(), g_running = false;
+ return false;
+ }
+ int n = set_game ? 3 : 2;
+ if (pressed & K_UP) set_sel = (set_sel + n - 1) % n;
+ if (pressed & K_DOWN) set_sel = (set_sel + 1) % n;
if (set_sel == 1 && (pressed & (K_Z | K_LEFT | K_RIGHT))) {
g_walk_fast ^= 1;
config_save();
return false;
}
+ if (set_sel == 2 && (pressed & K_Z)) {
+ set_ask = true, set_yes = 0;
+ return false;
+ }
return (pressed & K_X) || (set_sel == 0 && (pressed & K_Z));
}
static void settings_draw(int x, int y) {
@@ -76,7 +90,15 @@ static void settings_draw(int x, int y) {
gfx_text(FONT_MENU, x + 14, y + 46, "WALK", set_sel == 1 ? C_YELLOW : C_WHITE, 255);
gfx_text(FONT_MENU, x + 74, y + 46, g_walk_fast ? "FAST" : "NORMAL", set_sel == 1 ? C_YELLOW : C_WHITE, 255);
gfx_text(FONT_SMALL, x + 14, y + 66, g_walk_fast ? "Twice as fast." : "As in the game.", rgb565(0x808080), 255);
- gfx_sprite(SPR_HEART, 0, x + 4, y + 32 + 20 * set_sel, 0, 255);
+ if (set_game && set_ask) {
+ gfx_text(FONT_MENU, x + 14, y + 86, "QUIT?", C_YELLOW, 255);
+ gfx_text(FONT_MENU, x + 84, y + 86, "YES", set_yes ? C_YELLOW : C_WHITE, 255);
+ gfx_text(FONT_MENU, x + 124, y + 86, "NO", set_yes ? C_WHITE : C_YELLOW, 255);
+ gfx_sprite(SPR_HEART, 0, set_yes ? x + 74 : x + 114, y + 92, 0, 255);
+ return;
+ }
+ if (set_game) gfx_text(FONT_MENU, x + 14, y + 86, "QUIT GAME", set_sel == 2 ? C_YELLOW : C_WHITE, 255);
+ gfx_sprite(SPR_HEART, 0, x + 4, set_sel == 2 ? y + 92 : y + 32 + 20 * set_sel, 0, 255);
}
/* ---------------------------------------------------------------- naming */
@@ -215,7 +237,7 @@ static void c_menu_input(uint32_t pressed) {
if (pressed & K_Z) {
if (sel == 0 && item_count()) st = M_ITEMS, item_sel = 0;
else if (sel == 1) st = M_STAT;
- else if (sel == n - 1) st = M_SETTINGS, settings_open(M_MAIN);
+ else if (sel == n - 1) st = M_SETTINGS, settings_open(M_MAIN), set_game = true;
else if (sel == 2) st = M_CELL, sub = 0;
}
break;
@@ -347,7 +369,7 @@ static void draw_c_menu(void) {
}
}
if (st == M_SETTINGS) {
- panel(94, 26, 173, 104);
+ panel(94, 26, 173, 124);
settings_draw(108, 38);
}
if (st == M_CELL) {