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: maggots in the False Knight's prayer room

Mason Chenab009a039959
diff --git a/games/hollowknight/src/data.bin b/games/hollowknight/src/data.bin
index d0672e36..7de44ca8 100644
Binary files a/games/hollowknight/src/data.bin and b/games/hollowknight/src/data.bin differ
diff --git a/games/hollowknight/src/data.h b/games/hollowknight/src/data.h
index 90c49822..2ef3fa97 100644
--- a/games/hollowknight/src/data.h
+++ b/games/hollowknight/src/data.h
@@ -338,41 +338,49 @@
#define CLIP_HATCHER_FIRE 279
#define CLIP_HATCHER_FLY 280
#define CLIP_HATCHLING_FLY 281
-#define CLIP_GFLY_BURST 282
-#define CLIP_GFLY_CHARGE 283
-#define CLIP_GFLY_CHARGE_ANTIC 284
-#define CLIP_GFLY_CHARGE_RECOVER 285
-#define CLIP_GFLY_DEATH 286
-#define CLIP_GFLY_FALL 287
-#define CLIP_GFLY_FLY 288
-#define CLIP_GFLY_GURGLE_LOOP 289
-#define CLIP_GFLY_GURGLE_ONCE 290
-#define CLIP_GFLY_SLAM_DOWN 291
-#define CLIP_GFLY_SLAM_END 292
-#define CLIP_GFLY_SLAM_UP 293
-#define CLIP_GFLY_SLEEP 294
-#define CLIP_GFLY_STOP 295
-#define CLIP_GFLY_WAKE 296
-#define CLIP_GFLY_WIGGLE 297
-#define CLIP_BGATE_BG_OPENED 298
-#define CLIP_BGATE_BG_CLOSE_1 299
-#define CLIP_BGATE_BG_CLOSE_2 300
-#define CLIP_BGATE_BG_OPEN 301
-#define CLIP_BGATE_BG_CLOSED 302
-#define CLIP_BGATE_BONE_GATE_OPENED 303
-#define CLIP_BGATE_BONE_GATE_CLOSE 304
-#define CLIP_BGATE_BONE_GATE_CLOSED 305
-#define CLIP_BGATE_BONE_GATE_OPEN 306
-#define CLIP_BULLET_IDLE 307
-#define CLIP_BULLET_IMPACT 308
-#define CLIP_BULLET_SHOCKWAVE_SPURT 309
-#define SPRITE_HERO_LIGHT 1257
-#define SPRITE_DIALOGUE_BACKBOARD 1258
-#define SPRITE_PROMPT_SHADOW 1259
-#define SPRITE_CORPSE_NAIL 1260
-#define SPRITE_FK_BARREL 1261
-#define SPRITE_FK_STAFF 1262
-#define SPRITE_DIGIT0 1449
+#define CLIP_SLUG_BOUNCE 282
+#define CLIP_SLUG_DEATH_AIR 283
+#define CLIP_SLUG_DEATH_LAND 284
+#define CLIP_SLUG_IDLE_TODOWN 285
+#define CLIP_SLUG_IDLE_TOUP 286
+#define CLIP_SLUG_IDLE_UP 287
+#define CLIP_SLUG_RUN 288
+#define CLIP_SLUG_STARTLE 289
+#define CLIP_GFLY_BURST 290
+#define CLIP_GFLY_CHARGE 291
+#define CLIP_GFLY_CHARGE_ANTIC 292
+#define CLIP_GFLY_CHARGE_RECOVER 293
+#define CLIP_GFLY_DEATH 294
+#define CLIP_GFLY_FALL 295
+#define CLIP_GFLY_FLY 296
+#define CLIP_GFLY_GURGLE_LOOP 297
+#define CLIP_GFLY_GURGLE_ONCE 298
+#define CLIP_GFLY_SLAM_DOWN 299
+#define CLIP_GFLY_SLAM_END 300
+#define CLIP_GFLY_SLAM_UP 301
+#define CLIP_GFLY_SLEEP 302
+#define CLIP_GFLY_STOP 303
+#define CLIP_GFLY_WAKE 304
+#define CLIP_GFLY_WIGGLE 305
+#define CLIP_BGATE_BG_OPENED 306
+#define CLIP_BGATE_BG_CLOSE_1 307
+#define CLIP_BGATE_BG_CLOSE_2 308
+#define CLIP_BGATE_BG_OPEN 309
+#define CLIP_BGATE_BG_CLOSED 310
+#define CLIP_BGATE_BONE_GATE_OPENED 311
+#define CLIP_BGATE_BONE_GATE_CLOSE 312
+#define CLIP_BGATE_BONE_GATE_CLOSED 313
+#define CLIP_BGATE_BONE_GATE_OPEN 314
+#define CLIP_BULLET_IDLE 315
+#define CLIP_BULLET_IMPACT 316
+#define CLIP_BULLET_SHOCKWAVE_SPURT 317
+#define SPRITE_HERO_LIGHT 1286
+#define SPRITE_DIALOGUE_BACKBOARD 1287
+#define SPRITE_PROMPT_SHADOW 1288
+#define SPRITE_CORPSE_NAIL 1289
+#define SPRITE_FK_BARREL 1290
+#define SPRITE_FK_STAFF 1291
+#define SPRITE_DIGIT0 1478
#define STYLE_DIALOGUE 0
#define STYLE_PROMPT 1
#define TEXT_K 1.333333f
@@ -395,9 +403,10 @@
#define EK_FKHEAD 16
#define EK_HATCHER 17
#define EK_HATCHLING 18
-#define EK_GFLY 19
-#define NUM_KINDS 20
-#define KIND_TABLE {{0}, {EF_CRAWLER, {-1, 150, 149, -1, -1, -1, -1, -1, -1, -1, -1, 152, 153}}, {EF_BUZZER, {155, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, 158}}, {EF_SHADE, {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, {EF_CLIMBER, {-1, -1, 165, 164, -1, -1, -1, -1, -1, -1, -1, 162, 163}}, {EF_BOUNCER, {-1, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, 166, 167}}, {EF_SPITTER, {-1, -1, -1, 171, 172, 170, -1, -1, -1, -1, -1, 169, -1}}, {EF_ROLLER, {175, -1, -1, 177, 176, 178, -1, -1, -1, -1, -1, 173, 174}}, {EF_BLOCKER, {185, -1, -1, 181, 186, 179, 180, 187, 188, 184, 183, -1, 182}}, {EF_HUSK, {194, 195, 196, 189, 191, 190, -1, -1, -1, -1, -1, 192, 193}}, {EF_HUSK, {202, 203, 204, 197, 199, 198, -1, -1, -1, -1, -1, 200, 201}}, {EF_HUSK, {210, 211, 212, 205, 207, 206, -1, -1, -1, -1, -1, 208, 209}}, {EF_HUSK, {218, 219, 220, 213, 215, 214, -1, -1, -1, -1, -1, 216, 217}}, {EF_LEAPER, {224, 226, 227, 221, 225, -1, -1, -1, -1, -1, -1, 222, 223}}, {EF_GUARD, {233, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, 231}}, {EF_FK, {255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 253}}, {EF_FKHEAD, {275, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 273}}, {EF_HATCHER, {-1, -1, -1, 280, 279, -1, -1, -1, -1, -1, -1, 277, 278}}, {EF_HATCHLING, {-1, -1, -1, 281, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, {EF_GFLY, {294, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}}
+#define EK_SLUG 19
+#define EK_GFLY 20
+#define NUM_KINDS 21
+#define KIND_TABLE {{0}, {EF_CRAWLER, {-1, 150, 149, -1, -1, -1, -1, -1, -1, -1, -1, 152, 153}}, {EF_BUZZER, {155, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, 158}}, {EF_SHADE, {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, {EF_CLIMBER, {-1, -1, 165, 164, -1, -1, -1, -1, -1, -1, -1, 162, 163}}, {EF_BOUNCER, {-1, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, 166, 167}}, {EF_SPITTER, {-1, -1, -1, 171, 172, 170, -1, -1, -1, -1, -1, 169, -1}}, {EF_ROLLER, {175, -1, -1, 177, 176, 178, -1, -1, -1, -1, -1, 173, 174}}, {EF_BLOCKER, {185, -1, -1, 181, 186, 179, 180, 187, 188, 184, 183, -1, 182}}, {EF_HUSK, {194, 195, 196, 189, 191, 190, -1, -1, -1, -1, -1, 192, 193}}, {EF_HUSK, {202, 203, 204, 197, 199, 198, -1, -1, -1, -1, -1, 200, 201}}, {EF_HUSK, {210, 211, 212, 205, 207, 206, -1, -1, -1, -1, -1, 208, 209}}, {EF_HUSK, {218, 219, 220, 213, 215, 214, -1, -1, -1, -1, -1, 216, 217}}, {EF_LEAPER, {224, 226, 227, 221, 225, -1, -1, -1, -1, -1, -1, 222, 223}}, {EF_GUARD, {233, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, 231}}, {EF_FK, {255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 253}}, {EF_FKHEAD, {275, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 273}}, {EF_HATCHER, {-1, -1, -1, 280, 279, -1, -1, -1, -1, -1, -1, 277, 278}}, {EF_HATCHLING, {-1, -1, -1, 281, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, {EF_SLUG, {287, -1, -1, 285, 286, 289, 288, 282, -1, -1, -1, 283, 284}}, {EF_GFLY, {302, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}}
#define TXT_PROMPT_LISTEN 0
#define TXT_PROMPT_REST 1
#define TXT_PROMPT_INSPECT 2
diff --git a/games/hollowknight/src/enemy.c b/games/hollowknight/src/enemy.c
index 89bf3667..fb7f4ea3 100644
--- a/games/hollowknight/src/enemy.c
+++ b/games/hollowknight/src/enemy.c
@@ -16,7 +16,7 @@
/* (data.h: EK_* each kind, KIND_TABLE: the FSM each runs and the clips its roles play) */
enum {
EF_CRAWLER = 1, EF_BUZZER, EF_SHADE, EF_HUSK, EF_CLIMBER, EF_BOUNCER, EF_SPITTER, EF_ROLLER, EF_BLOCKER, EF_LEAPER, EF_GUARD,
- EF_FK, EF_FKHEAD, EF_GFLY, EF_HATCHER, EF_HATCHLING
+ EF_FK, EF_FKHEAD, EF_GFLY, EF_HATCHER, EF_HATCHLING, EF_SLUG
};
enum { R_IDLE, R_TURN, R_WALK, R_A1, R_A2, R_A3, R_A4, R_A5, R_A6, R_A7, R_A8, R_DEATH_AIR, R_DEATH_LAND, NUM_ROLES };
typedef struct {
@@ -3371,6 +3371,75 @@ static void hatchling_reset(Enemy *e) {
hatchling_start(e);
}
+/* ---------------------------------------------------------------- maggots (Prayer Slug: Control): praying, then off
+ * away from the Knight as he comes near (its Wake Region) */
+enum { SL_IDLE_UP, SL_TO_DOWN, SL_TO_UP, SL_STARTLE, SL_RUN_R, SL_RUN_L, SL_BUMP_R, SL_BUMP_L };
+#define SL_ACCEL (0.3f * 1.2f) /* (0.3 a frame of the game's 60 a second) */
+
+static void slug_pray(Enemy *e, int st) {
+ static const float wait[3][2] = {{0, 2}, {1.5f, 3}, {1.5f, 3}};
+ anim_play(&e->anim, st == SL_IDLE_UP ? CLIP(e, R_IDLE) : st == SL_TO_DOWN ? CLIP(e, R_A1) : CLIP(e, R_A2));
+ e->t0 = rand_range(wait[st][0], wait[st][1]);
+ e->st = (uint8_t)st;
+}
+
+static void slug_start(Enemy *e) {
+ slug_pray(e, SL_IDLE_UP);
+ e->b0 = false;
+}
+
+static void slug_run(Enemy *e, bool right) {
+ set_scale_x(e, right ? 1 : -1);
+ if (right) e->qx = rand_range(3.5f, 5.5f); /* (Max Speed R) */
+ else e->qy = rand_range(-5.5f, -3.5f); /* (Max Speed L) */
+ anim_play(&e->anim, CLIP(e, R_A4));
+ e->st = right ? SL_RUN_R : SL_RUN_L;
+}
+
+static void slug_update(Enemy *e) {
+ /* (its Wake Region: WAKE as the Knight comes in) */
+ const Ent *r = enemy_rec(e, ET_RANGE);
+ bool in = r && hero_in_box(e, r->x0, r->y0, r->x1, r->y1), wake = in && !e->b0;
+ e->b0 = in;
+ bool done = (e->anim.events & ANIM_DONE) != 0;
+ switch (e->st) {
+ case SL_IDLE_UP:
+ case SL_TO_DOWN:
+ case SL_TO_UP:
+ if (wake) {
+ anim_play_from_frame(&e->anim, CLIP(e, R_A3), 0);
+ set_scale_x(e, hero_x() > e->body.x ? 1 : -1); /* (FaceObject, sprite facing right) */
+ e->st = SL_STARTLE;
+ } else if ((e->t0 -= DT) <= 0)
+ slug_pray(e, e->st == SL_TO_DOWN ? SL_TO_UP : SL_TO_DOWN);
+ break;
+ case SL_STARTLE:
+ if (done) e->qx = 4.5f, e->qy = -4.5f, slug_run(e, hero_x() <= e->body.x); /* (Direction: away) */
+ break;
+ case SL_BUMP_R:
+ case SL_BUMP_L:
+ if (done) slug_run(e, e->st == SL_BUMP_R);
+ break;
+ }
+}
+
+static void slug_fixed(Enemy *e) {
+ if (e->st != SL_RUN_R && e->st != SL_RUN_L) return;
+ bool right = e->st == SL_RUN_R;
+ float v = e->body.vx + (right ? SL_ACCEL : -SL_ACCEL);
+ e->body.vx = v < e->qy ? e->qy : v > e->qx ? e->qx : v;
+ if (right ? hero_x() > e->body.x : hero_x() < e->body.x) {
+ slug_run(e, !right); /* (the Knight that way: the other) */
+ return;
+ }
+ if (e->body.ncontacts && side_hit(e, right ? 0 : 2)) {
+ /* Bump: up and back off the wall */
+ e->body.vx = right ? rand_range(-5, -2.5f) : rand_range(2.5f, 5), e->body.vy = 10;
+ anim_play_from_frame(&e->anim, CLIP(e, R_A5), 0);
+ e->st = right ? SL_BUMP_R : SL_BUMP_L;
+ }
+}
+
/* ---------------------------------------------------------------- Gruz Mother: Big Fly Control (with her bouncer_control);
* her corpse (corpse) and its burster (burster), which brings out her young */
enum { GF_INVINCIBLE, GF_SLEEP, GF_WAKE, GF_FLY, GF_BUZZ, GF_CHARGE_ANTIC, GF_CHARGE, GF_CHARGE_RECOVER, GF_SUPER_END,
@@ -3793,6 +3862,7 @@ static void enemy_fsm_start(Enemy *e, const Ent *d) {
else if (FSM(e) == EF_GFLY) gfly_start(e);
else if (FSM(e) == EF_HATCHER) hatcher_start(e, d);
else if (FSM(e) == EF_HATCHLING) hatchling_start(e);
+ else if (FSM(e) == EF_SLUG) slug_start(e);
}
/* ActiveRegion (a 50 by 35 box round the camera) meets its collider: FSMActivator turns its FSMs on */
@@ -3978,6 +4048,7 @@ void enemies_fixed(void) {
else if (FSM(e) == EF_GFLY) gfly_fixed(e);
else if (FSM(e) == EF_HATCHER) hatcher_fixed(e);
else if (FSM(e) == EF_HATCHLING) hatchling_fixed(e);
+ else if (FSM(e) == EF_SLUG) slug_fixed(e);
recoil_fixed(e);
body_step(&e->body, DT);
} else if (FSM(e) != EF_BLOCKER) {
@@ -4046,6 +4117,7 @@ void enemies_update(void) {
else if (FSM(e) == EF_GFLY) gfly_update(e);
else if (FSM(e) == EF_HATCHER) hatcher_update(e);
else if (FSM(e) == EF_HATCHLING) hatchling_update(e);
+ else if (FSM(e) == EF_SLUG) slug_update(e);
if (FSM(e) == EF_FK) {
/* (its Hitter: on till its FSM turns it off) */
e->sub.events = 0;
diff --git a/games/hollowknight/tools/actors.py b/games/hollowknight/tools/actors.py
index 435b91b5..48d6ab2e 100644
--- a/games/hollowknight/tools/actors.py
+++ b/games/hollowknight/tools/actors.py
@@ -57,6 +57,8 @@ ENEMY_KINDS = [
# (Aspid Mother and her young)
("hatcher", "Hatcher", ("sharedassets57.assets", 79), "HATCHER", {"A1": "Fly", "A2": "Fire"}),
("hatchling", "Control", ("resources.assets", 20637), "HATCHLING", {"A1": "Fly"}),
+ ("slug", "Control", ("sharedassets46.assets", 58), "SLUG",
+ {"IDLE": "Idle Up", "A1": "Idle ToDown", "A2": "Idle ToUp", "A3": "Startle", "A4": "Run", "A5": "Bounce"}),
# (Gruz Mother; her corpse's and its burster's clips are hers too)
("gfly", "Big Fly Control", ("sharedassets32.assets", 765), "GFLY", {"IDLE": "Sleep"},
["Wake", "Fly", "Charge Antic", "Charge", "Charge Recover", "Slam Down", "Slam Up", "Slam End", "Death", "Fall",
diff --git a/games/hollowknight/tools/ents.py b/games/hollowknight/tools/ents.py
index e1f852c9..4a281dd1 100644
--- a/games/hollowknight/tools/ents.py
+++ b/games/hollowknight/tools/ents.py
@@ -394,7 +394,8 @@ def _enemy(o, by_id, persist, name, d=None, strings=None, owners=None):
# its alert ranges (children with AlertRange): "Alert Range New" the main one, others by name
for ch in o.get("children", []):
q = by_id[ch]
- if not any(c.get("class") == "AlertRange" for c in q["c"]) and q["name"] not in ("Alert Range New", "Unalert Range"):
+ if not any(c.get("class") == "AlertRange" for c in q["c"]) and \
+ q["name"] not in ("Alert Range New", "Unalert Range", "Wake Region"):
continue
r = _alert_range(q)
if r is None: