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.

Hollow Knight: make test (tests/check.py): every hazard respawn point; every gate, the Knight arriving in control, on the ground and able to move, and spikes there sending him back to a good place; a long walk of made up keys from every room, the Knight never out of the room, without control, wedged, undrawn or out of the view; every room played with its enemies hit, in a new game and after the bosses, under the sanitizers

Mason Chen62e8d8b35f9a
diff --git a/games/hollowknight/tests/check.py b/games/hollowknight/tests/check.py
new file mode 100644
index 00000000..03578784
--- /dev/null
+++ b/games/hollowknight/tests/check.py
@@ -0,0 +1,68 @@
+"""The host build's checks (make test): check.py build/play src/data.bin
+
+- every room's hazard respawn points: ground under them, in the room
+- every gate: the Knight arrives in the next room, in control, on the ground, and can move; and spikes there send him
+ back to a good place
+- a long walk of made up keys from every room: the Knight never out of the room, without control, wedged, undrawn or
+ out of the view
+- every room played with its enemies hit, in a new game and after the bosses: the sanitizers stop on any fault
+"""
+import os
+import subprocess
+import sys
+from concurrent.futures import ThreadPoolExecutor
+
+PLAY, DATA = sys.argv[1], sys.argv[2]
+WALKS = [(seed, 4000) for seed in range(1, 5)] # (seed, ticks of 20 ms)
+SWEEP_KEYS = "_*30,R*120,A*3,J*25,L*200,A*4,_*60,R*60,J*30,A*3,_*900"
+WORLDS = ("", "7,11") # PlayerData bools on, by number: none, then the False Knight and Hornet beaten
+JOBS = os.cpu_count() or 2
+
+
+def play(*args, env=None):
+ p = subprocess.run([PLAY, DATA] + list(args), capture_output=True, text=True, env=dict(os.environ, **(env or {})))
+ return p.returncode, p.stdout + p.stderr
+
+
+def faults(out):
+ return [l for l in out.splitlines() if "AddressSanitizer" in l or "runtime error" in l or l.startswith("SUMMARY")]
+
+
+def report(name, rc, out, bad_prefixes):
+ bad = [l for l in out.splitlines() if l.startswith(bad_prefixes)] + faults(out)
+ ok = rc == 0 and not bad
+ print("%s %s" % ("ok " if ok else "FAIL", name))
+ for l in bad[:20]:
+ print(" " + l)
+ return ok
+
+
+def main():
+ results = []
+ rc, out = play("--gates", "markers")
+ results.append(report("hazard respawn points", rc, out, ("BAD",)))
+ rc, out = play("--gates", "all")
+ results.append(report("gates", rc, out, ("FAIL",)))
+ with ThreadPoolExecutor(JOBS) as pool:
+ walks = list(pool.map(lambda w: play("--gates", "wander:all:%d:%d" % w), WALKS))
+ for (seed, ticks), (rc, out) in zip(WALKS, walks):
+ results.append(report("walk %d (%d s from every room)" % (seed, ticks // 50), rc, out, ("FAIL",)))
+ rc, out = play("--list")
+ rooms = out.split()
+ runs = [(r, w) for r in rooms for w in WORLDS]
+ env = {"HKGOD": "1", "HKHIT": "50", "HKHITN": "20", "HKHITD": "10"}
+ with ThreadPoolExecutor(JOBS) as pool:
+ played = list(pool.map(lambda rw: play("--room", rw[0], "--play", SWEEP_KEYS, env=dict(env, HKFLAGS=rw[1])), runs))
+ bad = [(r, w, rc, out) for (r, w), (rc, out) in zip(runs, played) if rc != 0 or faults(out)]
+ print("%s every room played (%d runs)" % ("FAIL" if bad else "ok ", len(runs)))
+ for r, w, rc, out in bad:
+ print(" %s [%s] exit %d" % (r, w, rc))
+ for l in faults(out)[:3]:
+ print(" " + l)
+ results.append(not bad)
+ print("%d of %d checks failing" % (results.count(False), len(results)))
+ return 0 if all(results) else 1
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/games/hollowknight/tests/play.c b/games/hollowknight/tests/play.c
index 349f1f16..0e498a40 100644
--- a/games/hollowknight/tests/play.c
+++ b/games/hollowknight/tests/play.c
@@ -3,12 +3,283 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <math.h>
#include <time.h>
#include "../src/game.h"
extern uint32_t host_keys, host_time;
void host_shot(const char *path);
+/* every way into every room (each gate or door of every room, to where it leads), as the game goes through it: the
+ * Knight must come in seen, in the room, free, and able to move (--gates all, or the rooms one leads from) */
+static int gate_kind_of(const Ent *e) {
+ if (e->flags & G_DOOR) return GATE_DOOR;
+ const char *n = str_at(e->s0);
+ return strstr(n, "top") ? GATE_TOP : strstr(n, "right") ? GATE_RIGHT : strstr(n, "left") ? GATE_LEFT
+ : strstr(n, "bot") ? GATE_BOTTOM : GATE_DOOR;
+}
+static bool shielded; /* (the enemies can't hurt the Knight: what is checked is the way, not the fights) */
+static void run_ticks(int n, uint32_t keys) {
+ for (int i = 0; i < n; i++) {
+ if (shielded) g_hero.cs.invulnerable = true;
+ game_tick(stag_tick(shop_tick(inv_tick(keys))));
+ if (getenv("HKGATETRACE"))
+ printf(" %s pos %.3f,%.3f v %.2f,%.2f state %d ts %d ground %d hidden %d\n", room_name(g_room.id), g_hero.body.x,
+ g_hero.body.y, g_hero.body.vx, g_hero.body.vy, g_hero.state, g_hero.transition_state, g_hero.cs.on_ground,
+ g_hero.hidden);
+ }
+}
+/* every hazard respawn point of every room (the gates' and the hazard triggers'): ground under it, in the room; and
+ * whether the room has hazards at all */
+static int markers_test(void) {
+ int bad = 0;
+ for (int r = 0; r < NUM_ROOMS; r++) {
+ if (!room_load(r)) continue;
+ int n;
+ const Ent *es = room_ents(&n);
+ int hazards = 0;
+ for (int i = 0; i < n; i++)
+ if (es[i].type == ENT_DAMAGE && (int)es[i].p0 >= HAZ_SPIKES) hazards++;
+ for (int i = 0; i < n; i++) {
+ int m = -1;
+ if (es[i].type == ENT_GATE && es[i].p3 > 0) m = (int)es[i].p3 - 1;
+ if (es[i].type == ENT_HAZARD_TRIGGER) m = es[i].a;
+ if (m < 0) continue;
+ if (m >= n || es[m].type != ENT_HAZARD_MARKER) {
+ printf("BAD %s ent %d: marker %d is not a hazard marker\n", room_name(r), i, m);
+ bad++;
+ continue;
+ }
+ PhysHit hit;
+ float x = es[m].x0, y = es[m].y0;
+ bool ground = phys_ray(x, y, 0, -1, 50, CF_TERRAIN, &hit);
+ bool in = x > 0 && x < g_room.h->w && y > 0 && y < g_room.h->h;
+ if (!ground || !in || (ground && hit.dist > 15))
+ printf("%s %s ent %d (%s) marker %d at %.2f,%.2f: %s%s (hazards in the room: %d)\n", hazards ? "BAD " : "note", room_name(r), i,
+ es[i].type == ENT_GATE ? str_at(es[i].s0) : "trigger", m, x, y, ground ? "" : "no ground below", in ? "" : " outside the room", hazards);
+ bad += hazards && (!ground || !in);
+ }
+ }
+ printf("markers: %d bad\n", bad);
+ return bad ? 1 : 0;
+}
+
+/* from a room, a long walk of made up keys (runs, jumps, dashes, slashes, as a player might), following the Knight
+ * from room to room: he must never leave the room's bounds, be without control long, or be wedged in place */
+static uint32_t wander_rng = 1;
+static uint32_t wander_rand(void) { return wander_rng = wander_rng * 1103515245u + 12345u, wander_rng >> 16; }
+static int wander_test(const char *which, int seed, int ticks) {
+ int fails = 0;
+ for (int r = 0; r < NUM_ROOMS; r++) {
+ if (strcmp(which, "all") && strcmp(which, room_name(r))) continue;
+ game_new();
+ g_pd.can_dash = true, g_pd.has_dash = true;
+ if (!room_load(r)) continue;
+ /* (in at its first gate that leads somewhere, else its middle) */
+ int n;
+ const Ent *es = room_ents(&n);
+ float sx = g_room.h->w / 2, sy = g_room.h->h / 2;
+ for (int i = 0; i < n; i++)
+ if (es[i].type == ENT_GATE && !(es[i].flags & G_DOOR)) {
+ sx = (es[i].x0 + es[i].x1) / 2, sy = (es[i].y0 + es[i].y1) / 2;
+ sx = sx < 3 ? 3 : sx > g_room.h->w - 3 ? g_room.h->w - 3 : sx;
+ sy = sy < 3 ? 3 : sy > g_room.h->h - 3 ? g_room.h->h - 3 : sy;
+ break;
+ }
+ char start[64];
+ snprintf(start, sizeof start, "%s", room_name(r));
+ if (!game_enter(r, sx, sy, true)) continue;
+ g_hero.body.y = hero_ground_y(sx, sy);
+ wander_rng = (uint32_t)(seed * 7919 + r * 104729 + 1);
+ uint32_t keys = 0;
+ int left = 0, no_input = 0, out = 0, still = 0, unseen = 0, reports = 0;
+ float lx = g_hero.body.x, ly = g_hero.body.y;
+ const Hero *h = &g_hero;
+ for (int t = 0; t < ticks && reports < 3; t++) {
+ if (--left <= 0) {
+ uint32_t q = wander_rand();
+ keys = (q & 3) == 0 ? 0 : (q & 3) == 1 ? K_LEFT : K_RIGHT;
+ if (q >> 2 & 1) keys |= K_JUMP;
+ if ((q >> 3 & 7) == 0) keys |= K_DASH;
+ if ((q >> 6 & 3) == 0) keys |= K_ATTACK;
+ if ((q >> 8 & 15) == 0) keys |= K_DOWN;
+ if ((q >> 12 & 15) == 0) keys |= K_UP;
+ left = 5 + (int)(wander_rand() % 60);
+ }
+ uint32_t k = keys;
+ if ((keys & (K_JUMP | K_ATTACK | K_DASH)) && (t & 15) > 11) k &= ~(K_JUMP | K_ATTACK | K_DASH); /* (pressed again) */
+ game_tick(stag_tick(shop_tick(inv_tick(k))));
+ if (getenv("HKWANDERTRACE") && t >= atoi(getenv("HKWANDERTRACE")) - 60 && t <= atoi(getenv("HKWANDERTRACE")) + 20)
+ printf(" %d %s keys %02x pos %.3f,%.3f v %.2f,%.2f state %d ground %d wall %d\n", t, room_name(g_room.id), k, h->body.x,
+ h->body.y, h->body.vx, h->body.vy, h->state, h->cs.on_ground, h->cs.touching_wall);
+ bool busy = h->cs.transitioning || h->cs.dead || h->cs.hazard_death || h->cs.hazard_respawning || game_changing_room() ||
+ h->hidden;
+ float w = g_room.h->w, hh = g_room.h->h, x = h->body.x, y = h->body.y;
+ if (!busy && (x < -3 || x > w + 3 || y < -3 || y > hh + 3)) {
+ if (++out == 25) printf("FAIL wander %s (seed %d) tick %d: out of %s at %.2f,%.2f\n", start, seed, t, room_name(g_room.id), x, y), fails++, reports++;
+ } else
+ out = 0;
+ if (!busy && h->state == HS_NO_INPUT && !h->control_relinquished) {
+ if (++no_input == 500) printf("FAIL wander %s (seed %d) tick %d: no control for 10 s in %s at %.2f,%.2f\n", start, seed, t, room_name(g_room.id), x, y), fails++, reports++;
+ } else
+ no_input = 0;
+ if (!busy && fabsf(x - lx) < 0.01f && fabsf(y - ly) < 0.01f && (k & (K_LEFT | K_RIGHT | K_JUMP))) {
+ if (still == 399 && getenv("HKWANDERWHO")) {
+ printf(" (shop %d inv %d msg %d dialogue %d map %d collect %d accepting %d relinq %d)\n", shop_open(), inv_open(), msg_shown(),
+ dialogue_box_shown(), map_shown(), collect_active(), h->accepting_input, h->control_relinquished);
+ }
+ if (++still == 400) printf("note wander %s (seed %d) tick %d: in place 8 s, keys moving, in %s at %.2f,%.2f state %d\n", start, seed, t, room_name(g_room.id), x, y, h->state), reports++;
+ } else
+ still = 0;
+ /* (and seen: drawn every so often, inside the view) */
+ if (!busy && t % 10 == 0) {
+ extern uint32_t g_hero_undrawn;
+ uint32_t before = g_hero_undrawn;
+ game_draw();
+ if (g_hero_undrawn != before) printf("FAIL wander %s (seed %d) tick %d: not drawn in %s at %.2f,%.2f\n", start, seed, t, room_name(g_room.id), x, y), fails++, reports++;
+ }
+ if (!busy && (fabsf(x - g_cam_x) > (VIEW_W / 2) / FOCAL * -CAM_Z || fabsf(y - g_cam_y) > (VIEW_H / 2) / FOCAL * -CAM_Z)) {
+ if (++unseen == 100) printf("FAIL wander %s (seed %d) tick %d: out of view 2 s in %s at %.2f,%.2f, view at %.2f,%.2f\n", start, seed, t, room_name(g_room.id), x, y, g_cam_x, g_cam_y), fails++, reports++;
+ } else
+ unseen = 0;
+ lx = x, ly = y;
+ }
+ if (getenv("HKWANDERLOG")) printf(" %s: ended in %s at %.2f,%.2f\n", start, room_name(g_room.id), h->body.x, h->body.y);
+ }
+ printf("wander: %d failing\n", fails);
+ return fails ? 1 : 0;
+}
+
+static int gates_test(const char *which) {
+ if (!strcmp(which, "markers")) return markers_test();
+ if (!strncmp(which, "wander:", 7)) { /* (wander:ROOM|all:seed:ticks) */
+ char room[64];
+ int seed = 1, ticks = 6000;
+ sscanf(which + 7, "%63[^:]:%d:%d", room, &seed, &ticks);
+ return wander_test(room, seed, ticks);
+ }
+ int fails = 0, total = 0;
+ for (int from = 0; from < NUM_ROOMS; from++) {
+ if (strcmp(which, "all") && strcmp(which, room_name(from))) continue;
+ if (!room_load(from)) continue;
+ int n;
+ const Ent *es = room_ents(&n);
+ struct { int ent, kind, to; uint16_t entry; float delay, x, y; } ways[64];
+ int nw = 0;
+ for (int i = 0; i < n && nw < 64; i++) {
+ if (es[i].type != ENT_GATE || (es[i].flags & G_ENTRY_ONLY)) continue;
+ int to = es[i].a;
+ uint16_t entry = es[i].s1;
+ float delay = es[i].p0;
+ if (es[i].flags & G_DOOR) { /* (a door's record: the box flagged 4 after it) */
+ to = 0xFFFF;
+ for (int j = i + 1; j < n && es[j].type == ENT_BOX; j++)
+ if (es[j].flags == 4) to = es[j].a, entry = es[j].s1, delay = es[j].p0;
+ }
+ if (to == 0xFFFF || to >= NUM_ROOMS) continue;
+ ways[nw].ent = i, ways[nw].kind = gate_kind_of(&es[i]), ways[nw].to = to, ways[nw].entry = entry;
+ ways[nw].delay = delay, ways[nw].x = (es[i].x0 + es[i].x1) / 2, ways[nw].y = (es[i].y0 + es[i].y1) / 2;
+ nw++;
+ }
+ char from_name[64];
+ snprintf(from_name, sizeof from_name, "%s", room_name(from));
+ for (int w = 0; w < nw; w++) {
+ game_new();
+ if (!game_enter(from, ways[w].x, ways[w].y, true)) continue;
+ /* (a side gate behind a collider of its own room, not the ground: walled off until something opens it, as
+ * Crossroads_33's to the pillar) */
+ bool walled = false;
+ if (ways[w].kind == GATE_LEFT || ways[w].kind == GATE_RIGHT) {
+ PhysHit hit;
+ float dir = ways[w].kind == GATE_LEFT ? 1 : -1;
+ walled = phys_ray(ways[w].x, hero_ground_y(ways[w].x, ways[w].y) + 0.5f, dir, 0, 8, 0xFF, &hit) && hit.col > 0;
+ }
+ char gate_name[64];
+ snprintf(gate_name, sizeof gate_name, "%s", str_at(room_ents(&n)[ways[w].ent].s0));
+ shielded = true;
+ run_ticks(5, 0);
+ game_transition(ways[w].to, ways[w].entry, ways[w].kind, ways[w].delay, false);
+ run_ticks(400, 0); /* (the fade, the room, the Knight walking, dropping or jumping in, landing) */
+ total++;
+ const Hero *h = &g_hero;
+ char why[256] = "";
+ if (g_room.id != ways[w].to) snprintf(why + strlen(why), sizeof why - strlen(why), " in %s, not there", room_name(g_room.id));
+ if (h->hidden) strcat(why, " hidden");
+ if (h->cs.transitioning) strcat(why, " still entering");
+ if (!h->accepting_input) strcat(why, " no input");
+ if (h->state == HS_NO_INPUT) strcat(why, " no-input state");
+ if (h->cs.dead || h->cs.hazard_death) strcat(why, " dead");
+ if (h->body.x < 0 || h->body.x > g_room.h->w || h->body.y < 0 || h->body.y > g_room.h->h) strcat(why, " out of the room");
+ if (!h->cs.on_ground) strcat(why, " not on the ground");
+ float x0 = h->body.x, y0 = h->body.y;
+ int room0 = g_room.id;
+ if (getenv("HKGATETRACE")) {
+ printf(" arrived in %s by entry %s\n", room_name(g_room.id), str_at(ways[w].entry));
+ int ne;
+ const Ent *e2 = room_ents(&ne);
+ for (int i = 0; i < ne; i++)
+ if (e2[i].type == ENT_GATE || (e2[i].x0 < 8 && e2[i].x1 > -4))
+ printf(" ent %d type %d flags %d %s box %.2f,%.2f..%.2f,%.2f a %d p %.2f %.2f %.2f %.2f\n", i, e2[i].type, e2[i].flags,
+ e2[i].type == ENT_GATE ? str_at(e2[i].s0) : "", e2[i].x0, e2[i].y0, e2[i].x1, e2[i].y1, e2[i].a, e2[i].p0,
+ e2[i].p1, e2[i].p2, e2[i].p3);
+ PhysHit hit;
+ for (float yy = 3; yy < 7; yy += 0.5f)
+ if (phys_ray(-3, yy, 1, 0, 10, 0xFF, &hit)) printf(" ray right from -3,%.1f: hit %.2f,%.2f col %d flags %d\n", yy, hit.x, hit.y, hit.col, phys_col_flags(hit.col));
+ for (float xx = -2; xx < 4; xx += 0.5f)
+ if (phys_ray(xx, 6, 0, -1, 10, 0xFF, &hit)) printf(" ray down from %.1f,6: hit %.2f,%.2f col %d flags %d\n", xx, hit.x, hit.y, hit.col, phys_col_flags(hit.col));
+ }
+ /* (then spikes, where the room has some: back at the room's hazard respawn point, seen, free, on the ground) */
+ int ne, hazards = 0;
+ const Ent *e1 = room_ents(&ne);
+ for (int i = 0; i < ne; i++)
+ if (e1[i].type == ENT_DAMAGE && (int)e1[i].p0 >= HAZ_SPIKES) hazards++;
+ if (g_room.id == room0 && !why[0] && hazards) {
+ run_ticks(10, 0);
+ hero_take_damage(SIDE_LEFT, 1, HAZ_SPIKES);
+ if (getenv("HKSPIKETRACE")) setenv("HKGATETRACE", "1", 1);
+ run_ticks(300, 0);
+ if (getenv("HKSPIKETRACE")) unsetenv("HKGATETRACE");
+ if (g_room.id != room0) strcat(why, " spikes: another room");
+ if (h->hidden) strcat(why, " spikes: hidden");
+ if (!h->accepting_input || h->state == HS_NO_INPUT) strcat(why, " spikes: no input");
+ if (h->cs.dead || h->cs.hazard_death) strcat(why, " spikes: dead");
+ if (h->body.x < 0 || h->body.x > g_room.h->w || h->body.y < 0 || h->body.y > g_room.h->h) strcat(why, " spikes: out of the room");
+ if (!h->cs.on_ground) strcat(why, " spikes: not on the ground");
+ if (why[0]) snprintf(why + strlen(why), sizeof why - strlen(why), " (respawn %.2f,%.2f)", h->body.x, h->body.y);
+ if (why[0] && getenv("HKGATETRACE")) {
+ room_load(room0);
+ int ne;
+ const Ent *e2 = room_ents(&ne);
+ for (int i = 0; i < ne; i++)
+ if (e2[i].type == ENT_GATE && e2[i].p3 > 0) {
+ const Ent *m = &e2[(int)e2[i].p3 - 1];
+ printf(" gate %s marker %d type %d at %.2f,%.2f\n", str_at(e2[i].s0), (int)e2[i].p3 - 1, m->type, m->x0, m->y0);
+ }
+ }
+ }
+ /* (then: can he move? right, left, a jump) */
+ run_ticks(30, K_RIGHT);
+ float xr = h->body.x;
+ run_ticks(60, K_LEFT);
+ float xl = h->body.x;
+ run_ticks(1, 0);
+ run_ticks(15, K_JUMP);
+ float yj = h->body.y;
+ if (g_room.id == room0 && fabsf(xr - x0) < 0.05f && fabsf(xl - xr) < 0.05f) strcat(why, " can't walk");
+ if (g_room.id == room0 && fabsf(yj - y0) < 0.05f && fabsf(xl - x0) < 0.05f) strcat(why, " can't jump");
+ shielded = false;
+ bool bad = why[0] != 0 && !walled;
+ fails += bad;
+ printf("%s %s %s -> %s: at %.2f,%.2f%s%s\n", bad ? "FAIL" : why[0] ? "note" : "ok ", from_name, gate_name, room_name(ways[w].to),
+ x0, y0, why, bad || !why[0] ? "" : " (the gate is walled off in a new game)");
+ room_load(from);
+ es = room_ents(&n);
+ }
+ }
+ printf("gates: %d ways, %d failing\n", total, fails);
+ return fails ? 1 : 0;
+}
+
int main(int argc, char **argv) {
if (argc < 2) return 1;
FILE *f = fopen(argv[1], "rb");
@@ -27,6 +298,7 @@ int main(int argc, char **argv) {
const char *items_out = NULL, *play = NULL, *shots = NULL;
float px = 20, py = 20;
int shot_every = 0, trace = 0;
+ const char *gates = NULL;
float dx = 0.15f;
for (int i = 2; i < argc; i++) {
if (!strcmp(argv[i], "--room")) room = argv[++i];
@@ -41,7 +313,13 @@ int main(int argc, char **argv) {
else if (!strcmp(argv[i], "--at")) sscanf(argv[++i], "%f,%f", &px, &py);
else if (!strcmp(argv[i], "--shots")) shots = argv[++i], shot_every = atoi(argv[++i]);
else if (!strcmp(argv[i], "--trace")) trace = 1;
+ else if (!strcmp(argv[i], "--gates")) gates = argv[++i];
+ else if (!strcmp(argv[i], "--list")) { /* (the rooms' names) */
+ for (int r = 0; r < NUM_ROOMS; r++) printf("%s\n", room_name(r));
+ return 0;
+ }
}
+ if (gates) return gates_test(gates);
int id = -1;
for (int i = 0; i < NUM_ROOMS; i++)
if (!strcmp(room_name(i), room)) id = i;
@@ -113,10 +391,12 @@ int main(int argc, char **argv) {
if (getenv("HKKILL") && atoi(getenv("HKKILL")) == tick) hero_take_damage(SIDE_LEFT, 99, HAZ_NORMAL);
/* (HKFLING=tick: geo flung up, a way to the Knight's right) */
if (getenv("HKFLING") && atoi(getenv("HKFLING")) == tick)
- geo_fling_at(1, 4, g_hero.body.x + 6, g_hero.body.y + 1, 8, 12, 60, 120, 0);
+ geo_fling_at(1, getenv("HKFLINGN") ? atoi(getenv("HKFLINGN")) : 4, g_hero.body.x + 6, g_hero.body.y + 1, 8, 12, 60, 120, 0);
/* (HKHURT=tick[:damage]) */
if (getenv("HKHURT") && atoi(getenv("HKHURT")) == tick)
hero_take_damage(SIDE_LEFT, strchr(getenv("HKHURT"), ':') ? atoi(strchr(getenv("HKHURT"), ':') + 1) : 1, HAZ_NORMAL);
+ /* (HKSPIKES=tick: spikes then) */
+ if (getenv("HKSPIKES") && atoi(getenv("HKSPIKES")) == tick) hero_take_damage(SIDE_LEFT, 1, HAZ_SPIKES);
/* (HKREENTER=tick: the room entered again then, as it was left) */
if (getenv("HKREENTER") && atoi(getenv("HKREENTER")) == tick) game_enter(id, px, py, true);
if (getenv("HKGOD")) g_pd.health = g_pd.max_health;
@@ -153,6 +433,11 @@ int main(int argc, char **argv) {
}
}
}
+ if (getenv("HKACTORS")) {
+ extern uint32_t g_actors_dropped, g_actors_peak, g_items_dropped_total, g_items_peak, g_hero_undrawn;
+ printf("actors: peak %u, dropped %u; items: peak %u, dropped %u; the Knight not drawn in %u frames\n", g_actors_peak,
+ g_actors_dropped, g_items_peak, g_items_dropped_total, g_hero_undrawn);
+ }
if (shot) {
int nf = getenv("NF") ? atoi(getenv("NF")) : 3;
for (int i = 0; i < nf; i++) { /* (the tile cache warm, as while playing) */