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: the view takes a lock area at once only in a room's first half second, as CameraController's startLockedTimer counts down; after that it glides there (no more jumping a screen up when climbing back in King's Pass); the walks check the view never jumps

Mason363fd2262e342b7
diff --git a/games/hollowknight/src/camera.c b/games/hollowknight/src/camera.c
index 4118688a..8ca3af3e 100644
--- a/games/hollowknight/src/camera.c
+++ b/games/hollowknight/src/camera.c
@@ -317,6 +317,8 @@ static void controller_late_update(void) {
c.cx = nx, c.cy = ny;
}
keep_in_scene(&c.cx, &c.cy);
+ /* (only the first half second in a room does a lock area take the view at once) */
+ if (c.start_locked_timer > 0) c.start_locked_timer -= DT;
}
void cam_tick(void) {
diff --git a/games/hollowknight/tests/check.py b/games/hollowknight/tests/check.py
index 0a1654c9..38eb27d8 100644
--- a/games/hollowknight/tests/check.py
+++ b/games/hollowknight/tests/check.py
@@ -8,7 +8,7 @@
- every arena won: its fight over and the room's battle gates open, also as the Knight comes back and after a save and
a load
- 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
+ out of the view, and the view never jumping
- a bench: sat on, the inventory opened, a charm equipped, then up again (atBench off)
- every room played with its enemies hit, in a new game and after the bosses, drawn whole and fast (as a slow
calculator draws it): the sanitizers stop on any fault
diff --git a/games/hollowknight/tests/play.c b/games/hollowknight/tests/play.c
index 6fde74fa..5b022ad0 100644
--- a/games/hollowknight/tests/play.c
+++ b/games/hollowknight/tests/play.c
@@ -138,6 +138,16 @@ static int wander_test(const char *which, int seed, int ticks) {
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++;
}
+ /* (and the view moves smoothly: no jump across the screen in a step) */
+ static float lcx, lcy;
+ static int calm;
+ float jump = fabsf(g_cam_x - lcx) + fabsf(g_cam_y - lcy);
+ if (t == 0) calm = 0;
+ if (calm > 25 && jump > 3)
+ printf("FAIL wander %s (seed %d) tick %d: the view jumped %.2f in a step in %s at %.2f,%.2f\n", start, seed, t, jump,
+ room_name(g_room.id), x, y), fails++, reports++;
+ calm = busy || h->cs.hazard_respawning || h->respawning || t == 0 ? 0 : calm + 1;
+ lcx = g_cam_x, lcy = g_cam_y;
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