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.

Deltarune: read chains of three and more conditions right

Mason36332d6e215eb41
diff --git a/games/deltarune/README.md b/games/deltarune/README.md
index 11171e2d..c91cb7ac 100644
--- a/games/deltarune/README.md
+++ b/games/deltarune/README.md
@@ -51,7 +51,7 @@ Name the vessel, then walk and talk your way from Kris's room into the Dark Worl
## Good to know
-* The chapter goes as far as the Field so far: the Great Board, the Forest and the Card Castle come next.
+* The chapter goes as far as the Field's first rooms so far. Ralsei's lessons with the Dummy, the Field's puzzles, shops, the Great Board, the Forest and the Card Castle come next.
* The battle's menus and numbers are drawn at half the original's size, as the Dark World is; the enemies' bubbles keep their size, so their words stay readable.
* No music or sound: the calculator has no speaker.
diff --git a/games/deltarune/src/gmtexts.c b/games/deltarune/src/gmtexts.c
index c92b904c..a1d53390 100644
--- a/games/deltarune/src/gmtexts.c
+++ b/games/deltarune/src/gmtexts.c
@@ -289,7 +289,7 @@ L5656:;
c->msc = 360;
/* gml: scr_text(global.msc) */
L5708:;
- if (!((g_room == room_dark3) || (g_room == room_dark7))) goto L5812;
+ if (!((g_room == room_dark2) || ((g_room == room_dark3) || (g_room == room_dark7)))) goto L5812;
MSG(0, obj_readable_room1_slash_Other_10_gml_400_0);
L5812:;
if (!(g_room == room_dark3a)) goto L5864;
@@ -334,7 +334,7 @@ L6520:;
MSG(0, obj_readable_room1_slash_Other_10_gml_457_0);
MSG(1, obj_readable_room1_slash_Other_10_gml_458_0);
L6612:;
- if (!((g_room == room_field_checkers4) || (g_room == room_field_checkers6))) goto L6716;
+ if (!((g_room == room_field_checkers1) || ((g_room == room_field_checkers4) || (g_room == room_field_checkers6)))) goto L6716;
MSG(0, obj_readable_room1_slash_Other_10_gml_465_0);
L6716:;
if (!(g_room == room_field_puzzletutorial)) goto L6768;
@@ -1079,7 +1079,7 @@ L1288:;
if (!(g_room == room_castle_tutorial)) goto L1364;
c->spr = spr_dummynpc;
L1364:;
- if (!((g_room == room_field_puzzle1) || (g_room == room_field4))) goto L1444;
+ if (!((g_room == room_field2A) || ((g_room == room_field_puzzle1) || (g_room == room_field4)))) goto L1444;
c->spr = spr_candytree;
L1444:;
if (!(g_room == room_field_topchef)) goto L1528;
@@ -1599,7 +1599,7 @@ L6528:;
MSG(2, obj_npc_room_slash_Other_10_gml_399_0);
sv.flag[233] = 1;
L6684:;
- goto L6848; /* gml: if !((scr_weaponcheck_inventory(9) == 0) && (global.charweapon[3] != 9)) goto L6848 */
+ goto L6848; /* gml: if !((global.flag[108] == 1) && ((scr_weaponcheck_inventory(9) == 0) && (global.charweapon[3] != 9))) goto L6848 */
MSG(0, obj_npc_room_slash_Other_10_gml_406_0);
MSG(1, obj_npc_room_slash_Other_10_gml_407_0);
L6848:;
@@ -4943,7 +4943,7 @@ L38568:;
MSG(0, scr_text_slash_scr_text_gml_1795_0);
goto L39332; /* gml: if !(global.choice == 0) goto L39332 */
/* gml: which = 0 */
- if (!(gm_keyitemcheck(6) && gm_keyitemcheck(7))) goto L38728;
+ if (!(gm_keyitemcheck(4) && (gm_keyitemcheck(6) && gm_keyitemcheck(7)))) goto L38728;
/* gml: which = 3 */
L38728:;
goto L38844; /* gml: if !(scr_keyitemcheck(3) && (which == 0)) goto L38844 */
diff --git a/games/deltarune/tools/gm.py b/games/deltarune/tools/gm.py
index da753cd7..efd760b4 100644
--- a/games/deltarune/tools/gm.py
+++ b/games/deltarune/tools/gm.py
@@ -497,14 +497,16 @@ class Decompiler:
ins = prog[k]
a = ins["a"]
if k in logic:
+ # (a chain, a && b && c, has a jump for each term to the same end)
x = stack.pop() if stack else "?"
- pend[logic[k][0]] = (x, logic[k][1])
+ pend.setdefault(logic[k][0], []).append((x, logic[k][1]))
k += 1
continue
if k in pend:
- x, op_ = pend.pop(k)
y = stack.pop() if stack else "?"
- stack.append("(%s %s %s)" % (x, op_, y))
+ for x, op_ in reversed(pend.pop(k)):
+ y = "(%s %s %s)" % (x, op_, y)
+ stack.append(y)
k = at[skip_to[k]]
continue
k += 1