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.

Celeste: Mirror Temple's gates open once their touch switches are on (5A's c-10)

Mason Chenaba9ed21d267
diff --git a/games/celeste/src/ch2.c b/games/celeste/src/ch2.c
index 49fc4efa..2a7f0872 100644
--- a/games/celeste/src/ch2.c
+++ b/games/celeste/src/ch2.c
@@ -716,8 +716,8 @@ static bool switches_finished_check(void) {
if (g_ents[i].cls == &TOUCHSWITCH && g_ents[i].dead != 1) touch_finish(&g_ents[i]);
return true;
}
-/* Switch.Check: the first switch is finished */
-static bool switch_check(void) {
+/* Switch.Check: the first switch is finished (the switch gates', and Mirror Temple's TouchSwitches gates': ch5.c) */
+bool level_switch_check(void) {
for (int i = 0; i < g_nents; i++)
if (g_ents[i].cls == &TOUCHSWITCH && g_ents[i].dead != 1) return ST(&g_ents[i], Touch)->finished;
return false;
@@ -853,7 +853,7 @@ static void gate_update(Ent *e) {
if (g->wait > 0) g->wait -= DT;
else switch (g->step) {
case 0: /* while (!Switch.Check) */
- if (!switch_check()) break;
+ if (!level_switch_check()) break;
if (g->persistent) {
char f[48];
switch_flag_name(f, room_of(e));
diff --git a/games/celeste/src/ch5.c b/games/celeste/src/ch5.c
index 557ccdd0..b5e3b20d 100644
--- a/games/celeste/src/ch5.c
+++ b/games/celeste/src/ch5.c
@@ -512,8 +512,7 @@ static bool gate_theo_nearby(Ent *e) {
if (!t || t->x > e->x + 10) return true;
return dist2(g->hold_from, theo_center(t)) < (g->open ? 6400 : 4096);
}
-/* Switch.Check: the touch switches (another chapter's file) say whether they are all on */
-__attribute__((weak)) bool level_switch_check(void) { return false; }
+bool level_switch_check(void); /* Switch.Check: the touch switches (ch2.c) are all on */
static void gate_update(Ent *e) {
Gate *g = ST(e, Gate);
plat_update(e);
diff --git a/games/celeste/tests/check.py b/games/celeste/tests/check.py
index 82b8fb77..db7ed32b 100644
--- a/games/celeste/tests/check.py
+++ b/games/celeste/tests/check.py
@@ -112,6 +112,13 @@ out = run(["--chapter", "7", "--room", "s3", "--nowipe"], 780,
"250-300:l,264-265:x,302-330:u,332-344:j,332-346:l,400-415:l,440-760:r,523-535:j", what="3A's key and locked door")
check("room 0x-a " in out and " deaths 0 " in out, f"3A's start room was not crossed with its key: {out[-160:]}")
+# 5A's c-10: its two touch switches (below the middle cracked block, on top of it) open the temple gate (TouchSwitches)
+# up on the right, the way to c-12
+out = run(["--chapter", "13", "--room", "c-10", "--nowipe"], 520,
+ "10-90:r,18-24:j,110-124:j,126-130:u,126-127:x,136-158:r,180-183:l,190-204:j,206-210:u,206-207:x,216-235:r,"
+ "300-500:r,306-316:j,314-315:x,314-460:g,330-460:u", what="5A's c-10")
+check("room c-12 " in out and " deaths 0 " in out, f"5A's c-10 was not crossed (its touch switches' gate): {out[-160:]}")
+
# a chapter's end: its screen, then the chapter select
out = run(["--chapter", "1", "--room", "1"], 500, "400-401:o", env={"COMPLETE_AT": "60"}, what="a chapter's end")