From 1c060fe90e4bac1e6d8eefe4841113f9b3e4adc3 Mon Sep 17 00:00:00 2001 From: Daniel Stelzer Date: Sat, 29 Aug 2026 13:17:57 -0500 Subject: [PATCH 1/2] fix problem with styled spans inside (collect words) --- src/runtime_z.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/runtime_z.c b/src/runtime_z.c index 43dd094f..20d4ad62 100644 --- a/src/runtime_z.c +++ b/src/runtime_z.c @@ -767,6 +767,8 @@ struct rtroutine rtroutines[] = { // 0 (param): styles to set for this box class // 1 (param): styles to unset for this box class (struct zinstr []) { + {Z_JNZ, {VALUE(REG_FORWORDS)}, 0, RFALSE}, + {Z_CALL2N, {ROUTINE(R_AUX_PUSH1), VALUE(REG_STYLE)}}, // Save the previous value of REG_STYLE {Z_JE, {VALUE(REG_STYLE), SMALL(STYLE_INVISIBLE)}, 0, RFALSE}, // Then if we're currently in an invisible box, don't save anything, the style should remain invisible until we exit the original invisible box @@ -794,6 +796,8 @@ struct rtroutine rtroutines[] = { 1, // 0: previous value of REG_STYLE for checking things (struct zinstr []) { + {Z_JNZ, {VALUE(REG_FORWORDS)}, 0, RFALSE}, + {Z_STORE, {SMALL(REG_LOCAL+0), VALUE(REG_STYLE)}}, // Save the current value of REG_STYLE to check something {Z_DEC, {SMALL(REG_COLL)}}, // Pull the previous value of REG_STYLE back off the stack {Z_LOADW, {VALUE(REG_AUXBASE), VALUE(REG_COLL)}, REG_STYLE}, @@ -813,6 +817,8 @@ struct rtroutine rtroutines[] = { // 0 (param): foreground color to use // 1 (param): background color to use (struct zinstr []) { + {Z_JNZ, {VALUE(REG_FORWORDS)}, 0, RFALSE}, + // Push BGCOLOR, then FGCOLOR {Z_CALL2N, {ROUTINE(R_AUX_PUSH1), VALUE(REG_BGCOLOR)}}, {Z_CALL2N, {ROUTINE(R_AUX_PUSH1), VALUE(REG_FGCOLOR)}}, @@ -837,6 +843,7 @@ struct rtroutine rtroutines[] = { // We don't have to do this for styles because that's handled within BEGIN_ and END_ for the boxes and spans, but the Dialog assembler can't pass more than three arguments to a routine (it doesn't support Z_CALLVN2), so we just assemble a separate routine call instead 0, (struct zinstr []) { + {Z_JNZ, {VALUE(REG_FORWORDS)}, 0, RFALSE}, // Pull FGCOLOR, then BGCOLOR {Z_DEC, {SMALL(REG_COLL)}}, {Z_LOADW, {VALUE(REG_AUXBASE), VALUE(REG_COLL)}, REG_FGCOLOR}, From 2bfcc808440b5b9cf16ca4d7f66afc25f1c45b3d Mon Sep 17 00:00:00 2001 From: Daniel Stelzer Date: Sat, 29 Aug 2026 13:19:39 -0500 Subject: [PATCH 2/2] readme --- readme.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.txt b/readme.txt index 3e9c5f76..c5469924 100644 --- a/readme.txt +++ b/readme.txt @@ -49,6 +49,9 @@ Release notes: The problem isn't really fixed, but it will no longer corrupt your game text. + Backend: colored spans inside (collect words) no longer corrupt + the stack on Z-machine. + Unit test runner: (game over) and (game over $) are now overridden in unit.dg, to enable testing of win conditions.