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.

NumBlocks: snow evenly lit, no darker grid

Mason Chen0bc08a1ef2b9
diff --git a/games/numblocks/src/world.c b/games/numblocks/src/world.c
index e7ee9cb3..b16b67a1 100644
--- a/games/numblocks/src/world.c
+++ b/games/numblocks/src/world.c
@@ -162,8 +162,12 @@ static void fill_chunk(int cx, int cz, const bool *keep, int oy, int ylo, int yh
}
if (!old_col) {
vbiome[col] = (uint8_t)gen_biome(cx * 16 + x, cz * 16 + z);
- int gt = gen_top(cx * 16 + x, cz * 16 + z), t = edits_top(cx * 16 + x, cz * 16 + z, gt + 1);
+ int gt = gen_top(cx * 16 + x, cz * 16 + z), lt = gt;
vgtop[col] = (uint8_t)gt;
+ /* the sky light's top is the highest block that stops light: snow layers, flowers, tall
+ * grass on top let it all through (else they and what they stand on were lit too dark) */
+ for (int ly = gt - vc_y0; ly >= 0 && ly < VCY && opacity(vc[VC_I(lx, ly, lz)]) == 0; ly--) lt--;
+ int t = edits_top(cx * 16 + x, cz * 16 + z, lt + 1);
vtop[col] = (uint8_t)(t < 0 ? 0 : t > 255 ? 255 : t);
}
}