C cheat drops player one move from the exit, not on it

Instead of teleporting straight onto the exit cell (instant win), the C
cheat now places the player on an open neighbour of the exit, leaving one
valid move onto it. The exit is a normal spanning-tree cell, so at least
one of its up/left/right neighbours has an open passage; pick the first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 21:48:14 +02:00
co-authored by Claude Opus 4.8
parent 9faff1cfba
commit 00b5833bb2
2 changed files with 12 additions and 2 deletions
Binary file not shown.
+12 -2
View File
@@ -1109,9 +1109,19 @@ void main(void)
!IS_KEY_PRESSED(row5, KEY_S) &&
JOY_GET_DIR(g_Joy) == 0 && !IS_JOY_PRESSED(g_Joy, JOY_INPUT_TRIGGER_A));
// C: teleport to exit
// C: teleport to one move away from the exit (the final step is left
// to the player). The exit (g_EX, MAZE_H-1) is a normal maze cell, so
// at least one of its up/left/right neighbours has an open passage to
// it; drop the player on the first such neighbour.
if (IS_KEY_PRESSED(row3, KEY_C)) {
g_MX = g_EX; g_MY = MAZE_H - 1;
u8 ey = MAZE_H - 1;
if (g_DW[g_EX][ey-1] == 0) { // open above -> step down
g_MX = g_EX; g_MY = ey - 1;
} else if (g_EX > 0 && g_RW[g_EX-1][ey] == 0) { // open left -> step right
g_MX = g_EX - 1; g_MY = ey;
} else { // open right -> step left
g_MX = g_EX + 1; g_MY = ey;
}
DrawFull();
row8 = 0xFF;
continue;