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: the CE version's wires, campfires, checkpoints and memorial

Mason363a36b53eb4a0e
diff --git a/games/celeste/ce/data/CEL10.bin b/games/celeste/ce/data/CEL10.bin
index 1116f129..2e4513e9 100644
Binary files a/games/celeste/ce/data/CEL10.bin and b/games/celeste/ce/data/CEL10.bin differ
diff --git a/games/celeste/ce/data/CEL11.bin b/games/celeste/ce/data/CEL11.bin
index 84a3ed60..289b7139 100644
Binary files a/games/celeste/ce/data/CEL11.bin and b/games/celeste/ce/data/CEL11.bin differ
diff --git a/games/celeste/ce/data/CEL12.bin b/games/celeste/ce/data/CEL12.bin
index 6d55eb60..54dd4f4b 100644
Binary files a/games/celeste/ce/data/CEL12.bin and b/games/celeste/ce/data/CEL12.bin differ
diff --git a/games/celeste/ce/data/CEL13.bin b/games/celeste/ce/data/CEL13.bin
index 7ec12add..1599fc45 100644
Binary files a/games/celeste/ce/data/CEL13.bin and b/games/celeste/ce/data/CEL13.bin differ
diff --git a/games/celeste/ce/data/CEL14.bin b/games/celeste/ce/data/CEL14.bin
index 58f426d8..dd1bb8c9 100644
Binary files a/games/celeste/ce/data/CEL14.bin and b/games/celeste/ce/data/CEL14.bin differ
diff --git a/games/celeste/ce/data/CELG0.bin b/games/celeste/ce/data/CELG0.bin
index a785e203..c328264a 100644
Binary files a/games/celeste/ce/data/CELG0.bin and b/games/celeste/ce/data/CELG0.bin differ
diff --git a/games/celeste/ce/data/CELG1.bin b/games/celeste/ce/data/CELG1.bin
index 5b85053e..4b02de76 100644
Binary files a/games/celeste/ce/data/CELG1.bin and b/games/celeste/ce/data/CELG1.bin differ
diff --git a/games/celeste/ce/src/ents.c b/games/celeste/ce/src/ents.c
index 21340f4b..fe58da66 100644
--- a/games/celeste/ce/src/ents.c
+++ b/games/celeste/ce/src/ents.c
@@ -690,6 +690,32 @@ static void zip_render(Ent *e) {
}
draw_sprite(csprite(rec_val(e->rec, 1) + e->a0), x + w / 2 - 4, y, 0);
}
+/* ---------------------------------------------------------------- pictures: checkpoint, memorial, bonfire */
+/* a picture with its bottom middle at the place, or its frames in turn (values: first sprite, frames, time a frame) */
+static void picture_render(Ent *e) {
+ int n = rec_val(e->rec, 1), f = n > 1 ? (int)(g_level.frame * DTU / (unsigned)rec_val(e->rec, 2) % (unsigned)n) : 0;
+ const uint8_t *sp = csprite(rec_val(e->rec, 0) + f);
+ draw_sprite(sp, e->x - sp[0] / 2, e->y - sp[1], 0);
+}
+
+/* ---------------------------------------------------------------- wire */
+/* Wire: a curve from its place to its node sagging 24 px in the middle (SimpleCurve, its control point there: no wind
+ * in this chapter), drawn as 16 lines in its colour (WIRE: 595866) */
+static void wire_render(Ent *e) {
+ Room *rm = &g_level.rooms[e->room];
+ const uint8_t *n = rec_node(e->rec, 0);
+ int bx = rm->x + REC_X(e->rec), by = rm->y + REC_Y(e->rec), ex = rm->x + S16(n), ey = rm->y + S16(n + 2);
+ int cx = bx + ex, cy = by + ey + 48; /* (the control point in half pixels) */
+ int px = bx, py = by;
+ for (int i = 1; i <= 16; i++) { /* (1 - t)^2 b + 2 (1 - t) t c + t^2 e, t = i / 16, in 1/512 px */
+ int u = 16 - i;
+ int qx = (u * u * 2 * bx + 2 * u * i * cx + i * i * 2 * ex + 256) >> 9;
+ int qy = (u * u * 2 * by + 2 * u * i * cy + i * i * 2 * ey + 256) >> 9;
+ draw_line(px, py, qx, qy, (uint8_t)e->a0);
+ px = qx, py = qy;
+ }
+}
+
/* ZipMoverPathRenderer (depth 5000): the two ropes with their teeth moving along them, a cog at each end turning a
* full turn as it goes; all once more in black a pixel lower first, and a black frame round the block after */
static void zippath_lines(Ent *path, Ent *z, int fx, int fy, int tx, int ty, int off, bool black) {
@@ -838,6 +864,19 @@ static Ent *spawn(const uint8_t *r, int slot, bool trigger) {
case ET_dashBlock: box(e, w, h, 0, 0), e->flags |= EF_SOLID, e->depth = -12999; break;
case ET_fakeWall: box(e, w, h, 0, 0), e->flags &= ~EF_COLLIDABLE, e->depth = -13000, e->t0 = 256; break;
case ET_coverupWall: box(e, w, h, 0, 0), e->flags &= ~EF_COLLIDABLE, e->depth = -13000, e->t0 = 256; break;
+ case ET_checkpoint: case ET_memorial: case ET_bonfire: { /* (Checkpoint 9990, Memorial 100, the campfire -5) */
+ const uint8_t *sp = csprite(rec_val(r, 0));
+ e->flags = EF_VISIBLE, e->depth = type == ET_checkpoint ? 9990 : type == ET_memorial ? 100 : -5;
+ box(e, sp[0], sp[1], -sp[0] / 2, -sp[1]);
+ break;
+ }
+ case ET_wire: { /* (its box round the curve: both ends, and the sag) */
+ const uint8_t *n = rec_node(r, 0);
+ int ex = rm->x + S16(n), ey = rm->y + S16(n + 2);
+ e->flags = EF_VISIBLE, e->depth = (fl & 1) ? -8500 : 2000, e->a0 = WIRE;
+ box(e, iabs(ex - x) + 1, iabs(ey - y) + 26, imin(ex, x) - x, imin(ey, y) - y);
+ break;
+ }
case ET_zipMover: {
box(e, w, h, 0, 0), e->flags |= EF_SOLID, e->depth = -9999, e->a0 = 1;
Ent *p = ent_new(ZIP_PATH, x, y); /* (its box round both ends, for leaving it out when far) */
@@ -963,6 +1002,8 @@ static void ent_draw(Ent *e) {
case ET_fakeWall: case ET_coverupWall: fakewall_render(e); break;
case ET_zipMover: zip_render(e); break;
case ZIP_PATH: zippath_render(e); break;
+ case ET_wire: wire_render(e); break;
+ case ET_checkpoint: case ET_memorial: case ET_bonfire: picture_render(e); break;
case 200: {
const uint8_t *s = sprite(anim_sprite(e));
draw_sprite(s, e->x - s[0] / 2, e->y - s[1] / 2, 0);
@@ -1019,7 +1060,8 @@ void ents_render(int dmax, int dmin) {
static bool ent_static(const Ent *e) { /* what never changes how it looks (until it goes) */
switch (e->type) {
case ET_spikesUp: case ET_spikesDown: case ET_spikesLeft: case ET_spikesRight: return !e->ptr;
- case ET_jumpThru: case ET_dashBlock: return true;
+ case ET_jumpThru: case ET_dashBlock: case ET_wire: return true;
+ case ET_checkpoint: case ET_memorial: case ET_bonfire: return rec_val(e->rec, 1) <= 1;
}
return false;
}
diff --git a/games/celeste/ce/src/gen.h b/games/celeste/ce/src/gen.h
index 1db871e1..7a20d57c 100644
--- a/games/celeste/ce/src/gen.h
+++ b/games/celeste/ce/src/gen.h
@@ -525,6 +525,7 @@
#define BLACK 4
#define ROPE 5
#define ROPE_LIGHT 6
+#define WIRE 7
#define ET_player 0
#define ET_spikesUp 1
#define ET_spikesDown 2
diff --git a/games/celeste/ce/tools/pack_ce.py b/games/celeste/ce/tools/pack_ce.py
index cc55a670..87450526 100644
--- a/games/celeste/ce/tools/pack_ce.py
+++ b/games/celeste/ce/tools/pack_ce.py
@@ -31,7 +31,7 @@ GEN_H = os.path.join(HERE, "..", "src", "gen.h")
PART_MAX = 65000 # bytes of an appvar
COMMON = 96 # colours every chapter shares (indices 0 .. COMMON - 1)
HAIR, HAIR_DARK, WHITE, BLACK = 1, 2, 3, 4 # fixed colours (HAIR and HAIR_DARK change as Madeline's hair does)
-ROPE, ROPE_LIGHT = 5, 6 # ZipMover's ropes (663931) and their teeth (9b6157), drawn as lines
+ROPE, ROPE_LIGHT, WIRE = 5, 6, 7 # ZipMover's ropes (663931) and their teeth (9b6157), Wire (595866): lines
MARGIN = 4 # tiles kept around each room (transitions show the next one's edges)
FORMAT = 2 # bumped when the layout changes (the game checks it)
@@ -586,7 +586,8 @@ class Common:
for k, img in self.images.items():
count_colors(img, gui if k.startswith("gui/") else counts)
fixed = [0, 0x5466, 0x2C33, 0x7FFF, 0x0000, # 0 black, HAIR, HAIR_DARK, white, black for the art
- int(c15(np.array([0x66, 0x39, 0x31]))), int(c15(np.array([0x9B, 0x61, 0x57])))] # ROPE, ROPE_LIGHT
+ int(c15(np.array([0x66, 0x39, 0x31]))), int(c15(np.array([0x9B, 0x61, 0x57]))), # ROPE, ROPE_LIGHT
+ int(c15(np.array([0x59, 0x58, 0x66])))] # WIRE
game = kmeans(counts, set(fixed), COMMON - len(fixed) - 16) # (the game's own exact, the menus' after)
extra = game + kmeans(gui, set(fixed + game), COMMON - len(fixed) - len(game))
counts.update(gui)
@@ -637,7 +638,7 @@ class Common:
h.ref(f)
H.append(f"#define COMMON {COMMON}")
H.append(f"#define HAIR {HAIR}\n#define HAIR_DARK {HAIR_DARK}\n#define WHITE {WHITE}\n#define BLACK {BLACK}")
- H.append(f"#define ROPE {ROPE}\n#define ROPE_LIGHT {ROPE_LIGHT}")
+ H.append(f"#define ROPE {ROPE}\n#define ROPE_LIGHT {ROPE_LIGHT}\n#define WIRE {WIRE}")
return self.blob.write()
@@ -981,7 +982,8 @@ class Chapter:
out = []
for d in ("up", "down", "left", "right"):
out += [s.path for s in family("danger/spikes/%s_%s" % (st["spike"], d))]
- out += ["objects/zipmover/block", "objects/zipmover/cog"]
+ out += ["objects/zipmover/block", "objects/zipmover/cog", "objects/checkpoint/bg/%d" % self.number,
+ "scenery/memorial/memorial"] + [s.path for s in family("objects/campfire/fire")]
out += [s.path for s in family("objects/zipmover/light") + family("objects/zipmover/innercog")]
return out
@@ -1233,6 +1235,23 @@ class Chapter:
vals += self.block_tiles(r, x, y, w, h, c, blend)
elif n == "zipMover":
vals += self.zip_ids
+ elif n == "wire":
+ flags |= 1 if a("above", False) else 0
+ elif n in ("checkpoint", "memorial", "bonfire"):
+ # a picture (its bottom middle at the place), or frames of one: [first sprite, frames, time a frame (1/600 s)]
+ if n == "checkpoint":
+ paths, delay = ["objects/checkpoint/bg/" + (a("bg", "") or str(self.number))], 0
+ elif n == "memorial":
+ paths, delay = ["scenery/memorial/memorial"], 0
+ else: # Bonfire: the campfire's idle, or its burn loop (fire 7-15, 0.09 s)
+ fire = [s.path for s in family("objects/campfire/fire")]
+ paths, delay = (fire[7:16], 54) if str(a("mode", "unlit")).lower() == "lit" else (fire[:1], 0)
+ first = None
+ for k, path in enumerate(paths):
+ i = self.sprites.add(path, self.pal.map(self.image(path)))
+ first = i if first is None else first
+ assert i == first + k
+ vals += [first, len(paths), delay]
elif n in ("strawberry", "goldenBerry"):
flags |= 1 if a("winged", False) else 0
flags |= 2 if a("moon", False) else 0
@@ -1252,10 +1271,6 @@ class Chapter:
flags |= (1 if a("xOnly", False) else 0) | (2 if a("yOnly", False) else 0)
elif n == "eventTrigger":
vals += [EVENTS.setdefault(a("event", ""), len(EVENTS))]
- elif n == "bonfire":
- flags |= {"unlit": 0, "lit": 1, "smoking": 2}.get(str(a("mode", "unlit")).lower(), 0)
- elif n == "wire":
- flags |= 1 if a("above", False) else 0
rec = bytearray(struct.pack("<BBhhHHH", t, 0, x, y, w, h, int(e.get("id", 0)) & 0xFFFF))
rec.append(len(nodes))
for nx, ny in nodes: