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.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
Hollow Knight: Aspid Mother and her young
Mason Chena8a449d945fc
diff --git a/games/hollowknight/src/data.bin b/games/hollowknight/src/data.binindex d5144683..d0672e36 100644Binary files a/games/hollowknight/src/data.bin and b/games/hollowknight/src/data.bin differdiff --git a/games/hollowknight/src/data.h b/games/hollowknight/src/data.hindex fbdfd7a7..90c49822 100644--- a/games/hollowknight/src/data.h+++ b/games/hollowknight/src/data.h@@ -333,41 +333,46 @@#define CLIP_FKHEAD_HEAD_HIT 274#define CLIP_FKHEAD_HEAD_IDLE 275#define CLIP_FKHEAD_HEAD_SPAZ 276-#define CLIP_GFLY_BURST 277-#define CLIP_GFLY_CHARGE 278-#define CLIP_GFLY_CHARGE_ANTIC 279-#define CLIP_GFLY_CHARGE_RECOVER 280-#define CLIP_GFLY_DEATH 281-#define CLIP_GFLY_FALL 282-#define CLIP_GFLY_FLY 283-#define CLIP_GFLY_GURGLE_LOOP 284-#define CLIP_GFLY_GURGLE_ONCE 285-#define CLIP_GFLY_SLAM_DOWN 286-#define CLIP_GFLY_SLAM_END 287-#define CLIP_GFLY_SLAM_UP 288-#define CLIP_GFLY_SLEEP 289-#define CLIP_GFLY_STOP 290-#define CLIP_GFLY_WAKE 291-#define CLIP_GFLY_WIGGLE 292-#define CLIP_BGATE_BG_OPENED 293-#define CLIP_BGATE_BG_CLOSE_1 294-#define CLIP_BGATE_BG_CLOSE_2 295-#define CLIP_BGATE_BG_OPEN 296-#define CLIP_BGATE_BG_CLOSED 297-#define CLIP_BGATE_BONE_GATE_OPENED 298-#define CLIP_BGATE_BONE_GATE_CLOSE 299-#define CLIP_BGATE_BONE_GATE_CLOSED 300-#define CLIP_BGATE_BONE_GATE_OPEN 301-#define CLIP_BULLET_IDLE 302-#define CLIP_BULLET_IMPACT 303-#define CLIP_BULLET_SHOCKWAVE_SPURT 304-#define SPRITE_HERO_LIGHT 1228-#define SPRITE_DIALOGUE_BACKBOARD 1229-#define SPRITE_PROMPT_SHADOW 1230-#define SPRITE_CORPSE_NAIL 1231-#define SPRITE_FK_BARREL 1232-#define SPRITE_FK_STAFF 1233-#define SPRITE_DIGIT0 1420+#define CLIP_HATCHER_DEATH_AIR 277+#define CLIP_HATCHER_DEATH_LAND 278+#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 STYLE_DIALOGUE 0#define STYLE_PROMPT 1#define TEXT_K 1.333333f@@ -388,9 +393,11 @@#define EK_GUARD 14#define EK_FK 15#define EK_FKHEAD 16-#define EK_GFLY 17-#define NUM_KINDS 18-#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_GFLY, {289, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}}+#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 TXT_PROMPT_LISTEN 0#define TXT_PROMPT_REST 1#define TXT_PROMPT_INSPECT 2diff --git a/games/hollowknight/src/enemy.c b/games/hollowknight/src/enemy.cindex 0c227785..89bf3667 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_FK, EF_FKHEAD, EF_GFLY, EF_HATCHER, EF_HATCHLING};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 {@@ -317,6 +317,8 @@ static void death_shake(const Enemy *e) {static void shade_killed(Enemy *e);static void blocker_die(Enemy *e);static void gfly_die(Enemy *e);+static void hatchling_reset(Enemy *e);+static void hatcher_corpse_smash(const Enemy *e);static void enemy_die(Enemy *e, float direction, bool has_direction) {if (FSM(e) == EF_SHADE) {shade_killed(e);@@ -337,7 +339,13 @@ static void enemy_die(Enemy *e, float direction, bool has_direction) {if (d->s1 & EF_BATTLE) arena_enemy_died(); /* (its battleScene's Battle Enemies) */}if (FSM(e) == EF_GFLY) gfly_die(e);- else corpse_start(e, direction, has_direction);+ else if (FSM(e) == EF_HATCHLING) {+ /* (deathReset: back to its cage) */+ death_shake(e);+ FREEZE_MOMENT_1();+ hatchling_reset(e);+ return;+ } else corpse_start(e, direction, has_direction);death_shake(e);FREEZE_MOMENT_1();}@@ -384,19 +392,21 @@ static float hero_x(void) { return g_hero.body.x; }static float hero_y(void) { return g_hero.body.y; }/* FaceDirection (sprite facing left): turns to its velocity, playing a clip, pausing between turns */-static void face_direction(Enemy *e, float *pause, int clip) {+static void face_direction_p(Enemy *e, float *pause, int clip, float pause_time) {if (*pause > 0) {*pause -= DT;return;}float want = e->body.vx > 0 ? -fabsf(e->sx) : fabsf(e->sx);if (e->sx != want) {- *pause = 0.5f;+ *pause = pause_time;set_scale_x(e, want);if (clip >= 0) anim_play_from_frame(&e->anim, clip, 0);}}+static void face_direction(Enemy *e, float *pause, int clip) { face_direction_p(e, pause, clip, 0.5f); }+/* LineOfSightDetector, AlertRange: the hero in the circle, and no terrain between */static void sight_update(Enemy *e) {float cx = g_hero.body.x + g_hero.body.ox, cy = g_hero.body.y + g_hero.body.oy;@@ -919,15 +929,15 @@ static void bouncer_update(Enemy *e) {}/* DistanceFly: keeps a distance from the hero (targeting its height, or its distance in y too) */-static void distance_fly(Enemy *e, float dist, float vmax, float accel, bool height) {+static void distance_fly_at(Enemy *e, float dist, float vmax, float accel, bool height, float hoff) {float vx = e->body.vx, vy = e->body.vy;float dx = e->body.x - hero_x(), dy = e->body.y - hero_y(), d = sqrtf(dx * dx + dy * dy);bool left = e->body.x < hero_x(), below = e->body.y < hero_y();vx += (d > dist) == left ? accel : -accel;if (!height) vy += (d > dist) == below ? accel : -accel;else {- if (e->body.y < hero_y()) vy += accel;- if (e->body.y > hero_y()) vy -= accel;+ if (e->body.y < hero_y() + hoff) vy += accel;+ if (e->body.y > hero_y() + hoff) vy -= accel;}e->body.vx = vx > vmax ? vmax : vx < -vmax ? -vmax : vx;e->body.vy = vy > vmax ? vmax : vy < -vmax ? -vmax : vy;@@ -959,6 +969,10 @@ static Bullet *bullet_new(float x, float y, float vx, float vy, float gravity) {}/* FireAtTarget: from (x, y) at the hero, at a speed */+static void distance_fly(Enemy *e, float dist, float vmax, float accel, bool height) {+ distance_fly_at(e, dist, vmax, accel, height, 0);+}+static void bullet_fire(float x, float y, float speed) {Bullet *b = NULL;for (int i = 0; i < MAX_BULLETS && !b; i++)@@ -3226,6 +3240,137 @@ static void balls_tick(void) {}/* ---------------------------------------------------------------- the room's */+/* ---------------------------------------------------------------- Aspid Mother (Hatcher) and her young (Hatcher Baby+ * Spawner), who wait in their cage till she sends them out, and go back to it as they die */+enum { HT_IDLE, HT_DISTANCE_FLY, HT_FIRE_ANTIC, HT_FIRE };+enum { HL_INERT, HL_CHASE };++/* (her young in the cage: their count; one of them at random, or NULL) */+static Enemy *hatchling_caged(int pick, int *count) {+ int n = 0;+ Enemy *out = NULL;+ for (int i = 0; i < MAX_ENEMIES; i++) {+ Enemy *q = &en[i];+ if (q->mode != EM_ALIVE || FSM(q) != EF_HATCHLING || q->st != HL_INERT) continue;+ if (n++ == pick) out = q;+ }+ if (count) *count = n;+ return out;+}++static void hatchling_spawn(Enemy *q, float x, float y) {+ /* SPAWN: Chase, from where it is put */+ q->body.x = x, q->body.y = y;+ q->st = HL_CHASE, q->t1 = 0, q->tx = 0, q->pause0 = 0;+}++static void hatcher_distance_fly(Enemy *e) {+ anim_play_from_frame(&e->anim, CLIP(e, R_A1), 2);+ e->t0 = rand_range(2, 3);+ e->st = HT_DISTANCE_FLY;+}++static void hatcher_start(Enemy *e, const Ent *d) {+ e->st = HT_IDLE;+ anim_play_from_frame(&e->anim, CLIP(e, R_A1), 2);+ e->start_x = e->body.x, e->start_y = e->body.y;+ e->wait = 0, e->ax = e->ay = 0;+ if (d->s1 & EF_START) hatcher_distance_fly(e); /* (startAlert) */+}++static void hatcher_fixed(Enemy *e) {+ if (e->st == HT_IDLE) idle_buzz(e);+ else if (e->st == HT_DISTANCE_FLY) distance_fly_at(e, 6, 3.5f, 0.1f, true, 3.5f);+}++static void hatcher_update(Enemy *e) {+ switch (e->st) {+ case HT_IDLE:+ /* FaceDirection; ALERT: it sees the Knight in its alert range */+ if (e->sx != (e->body.vx > 0 ? -fabsf(e->sx) : fabsf(e->sx))) set_scale_x(e, -e->sx);+ if (e->can_see && e->in_alert) hatcher_distance_fly(e);+ break;+ case HT_DISTANCE_FLY: {+ /* FaceObject: its clip from the start as it turns */+ float want = hero_x() > e->body.x ? -fabsf(e->sx) : fabsf(e->sx);+ if (hero_x() != e->body.x && e->sx != want) set_scale_x(e, want), anim_play_from_frame(&e->anim, CLIP(e, R_A1), 0);+ if ((e->t0 -= DT) <= 0) {+ /* Hatched Max Check: young left in the cage, or on */+ int n;+ hatchling_caged(-1, &n);+ if (n > 0) {+ e->body.vx = e->body.vy = 0;+ anim_play_from_frame(&e->anim, CLIP(e, R_A2), 0);+ e->st = HT_FIRE_ANTIC, e->t0 = 0.335f;+ } else+ hatcher_distance_fly(e);+ }+ break;+ }+ case HT_FIRE_ANTIC:+ if ((e->t0 -= DT) <= 0) {+ /* Fire: one of her young out below her, downwards */+ int n;+ hatchling_caged(-1, &n);+ Enemy *q = n ? hatchling_caged((int)rand_range(0, (float)n - 0.001f), NULL) : NULL;+ if (!q) {+ hatcher_distance_fly(e); /* (CANCEL) */+ break;+ }+ hatchling_spawn(q, e->body.x, e->body.y - 1);+ q->body.vx = 0, q->body.vy = -5;+ e->st = HT_FIRE;+ }+ break;+ case HT_FIRE:+ if ((e->anim.events & ANIM_DONE) || !e->anim.playing) hatcher_distance_fly(e);+ break;+ }+}++/* (her corpse smashes: two of her young out where it lands) */+static void hatcher_corpse_smash(const Enemy *e) {+ for (int k = 0; k < 2; k++) {+ int n;+ hatchling_caged(-1, &n);+ Enemy *q = n ? hatchling_caged((int)rand_range(0, (float)n - 0.001f), NULL) : NULL;+ if (q) hatchling_spawn(q, e->body.x, e->body.y);+ }+}++static void hatchling_start(Enemy *e) {+ e->st = HL_INERT;+ e->body.vx = e->body.vy = 0;+ anim_play(&e->anim, CLIP(e, R_A1));+}++static void hatchling_fixed(Enemy *e) {+ if (e->st != HL_CHASE) return;+ /* ChaseObject: at the Knight, off by a spread it picks again every 1 to 2 s */+ if (e->t1 >= e->tx) {+ e->qx = rand_range(-1.5f, 1.5f), e->qy = rand_range(-1.5f, 1.5f);+ e->t1 = 0, e->tx = rand_range(1, 2);+ } else+ e->t1 += DT;+ float vx = e->body.vx + (e->body.x < hero_x() + e->qx ? 0.1f : -0.1f);+ float vy = e->body.vy + (e->body.y < hero_y() + e->qy ? 0.1f : -0.1f);+ e->body.vx = vx > 5 ? 5 : vx < -5 ? -5 : vx;+ e->body.vy = vy > 5 ? 5 : vy < -5 ? -5 : vy;+}++static void hatchling_update(Enemy *e) {+ if (e->st == HL_CHASE) face_direction_p(e, &e->pause0, -1, 0.4f); /* (FaceDirection, pausing between turns) */+}++/* (its death: back to the cage, whole again: CENTIPEDE DEATH) */+static void hatchling_reset(Enemy *e) {+ const Ent *d = ent_at(e->ent);+ e->hp = 5, e->damage = 1;+ e->body.x = d->x0, e->body.y = d->y0;+ e->flashing = false;+ hatchling_start(e);+}+/* ---------------------------------------------------------------- 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,@@ -3646,6 +3791,8 @@ static void enemy_fsm_start(Enemy *e, const Ent *d) {else if (FSM(e) == EF_FK) fk_start(e);else if (FSM(e) == EF_FKHEAD) fk_head_start(e);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);}/* ActiveRegion (a 50 by 35 box round the camera) meets its collider: FSMActivator turns its FSMs on */@@ -3829,6 +3976,8 @@ void enemies_fixed(void) {else if (FSM(e) == EF_LEAPER) leaper_fixed(e);else if (FSM(e) == EF_GUARD) guard_fixed(e);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);recoil_fixed(e);body_step(&e->body, DT);} else if (FSM(e) != EF_BLOCKER) {@@ -3847,6 +3996,7 @@ void enemies_fixed(void) {anim_play(&e->anim, kinds[e->kind].clip[R_DEATH_LAND]);e->body.vx = e->body.vy = 0;e->st = CS_DEATH_ANIM;+ if (FSM(e) == EF_HATCHER) hatcher_corpse_smash(e);} else {bounce(&e->body, pvx, pvy, had, cbounce);anim_play(&e->anim, kinds[e->kind].clip[R_DEATH_LAND]);@@ -3894,6 +4044,8 @@ void enemies_update(void) {else if (FSM(e) == EF_GUARD) guard_update(e);else if (FSM(e) == EF_FK) fk_update(e);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);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.pyindex 20523aae..435b91b5 100644--- a/games/hollowknight/tools/actors.py+++ b/games/hollowknight/tools/actors.py@@ -54,6 +54,9 @@ ENEMY_KINDS = ["Stun Open", "Stun Hit", "Stun Recover", "Rage", "Death Fall", "Death Land", "Death Head 1", "Death Head 2","Death Spaz", "Body", "Stun Opened"]),("fkhead", "Health Check", ("sharedassets47.assets", 9), "FKHEAD", {"IDLE": "Head Idle"}, ["Head Hit", "Head Spaz"]),+ # (Aspid Mother and her young)+ ("hatcher", "Hatcher", ("sharedassets57.assets", 79), "HATCHER", {"A1": "Fly", "A2": "Fire"}),+ ("hatchling", "Control", ("resources.assets", 20637), "HATCHLING", {"A1": "Fly"}),# (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",