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 Snail Shaman hears of the Elder Baldur's death

Mason363fafec0927905
diff --git a/games/hollowknight/src/data.h b/games/hollowknight/src/data.h
index 8a305d57..98d6b7ac 100644
--- a/games/hollowknight/src/data.h
+++ b/games/hollowknight/src/data.h
@@ -926,6 +926,7 @@
#define VMEV_FIRST_MAP_UP 44
#define VMEV_FIRST_MAP_DOWN 45
#define VMEV_FK_RAGE_COMPLETE 46
+#define VMEV_UPDATE_SHAMAN {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 79, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}
#define VMSTR_NPC_TITLE 14
#define VMSTR_VISITED 691
#define VMSTR_DISPLAY_RIGHT 692
diff --git a/games/hollowknight/src/enemy.c b/games/hollowknight/src/enemy.c
index 173ade62..179abb8d 100644
--- a/games/hollowknight/src/enemy.c
+++ b/games/hollowknight/src/enemy.c
@@ -1546,9 +1546,12 @@ static void blocker_die(Enemy *e) {
if (e->ent != NO_ENT) persist_set(ent_at(e->ent)->persist), enemy_terrain_off(ent_at(e->ent));
death_shake(e);
FREEZE_MOMENT_1();
- /* (the Snail Shaman hears of it) */
- if (g_pd.shaman == 3) g_pd.shaman = 4;
- else if (g_pd.shaman == 2) g_pd.shaman = 5;
+ /* (its corpse's Shaman Update: the Snail Shaman hears of it, behind his gate) */
+ if (g_pd.shaman == 2 || g_pd.shaman == 3) {
+ static const uint8_t update[NUM_ROOMS] = VMEV_UPDATE_SHAMAN;
+ g_pd.shaman = g_pd.shaman == 3 ? 4 : 5;
+ if (update[g_room.id] != 255) vm_broadcast(update[g_room.id]);
+ }
e->mode = EM_CORPSE, e->st = 0, e->t0 = 0;
e->body.vx = e->body.vy = 0, e->body.gravity_scale = 0, e->body.mask = 0;
anim_play(&e->anim, CLIP(e, R_A8));
diff --git a/games/hollowknight/tools/pack.py b/games/hollowknight/tools/pack.py
index 19ef4df6..7dfd4e50 100644
--- a/games/hollowknight/tools/pack.py
+++ b/games/hollowknight/tools/pack.py
@@ -811,6 +811,9 @@ def main():
f.write("#define VMOP_%s %d\n" % (name.upper(), code))
for i, e in enumerate(vm.EVENTS.list[:vm.FIXED_EVENTS]):
f.write("#define VMEV_%s %d\n" % (e.upper().replace(" ", "_"), i))
+ for e in vm.NAMED_EVENTS: # (each room's number for it; 255: its scripts don't know it)
+ ids = [vm.BUILT[r].named_events.get(e, 255) if r in vm.BUILT else 255 for r in ROOMS]
+ f.write("#define VMEV_%s {%s}\n" % (e.upper().replace(" ", "_"), ", ".join(str(i) for i in ids)))
for name in ("NPC Title", "Visited", "Display Right", "Hornet Saver", "Item"):
f.write("#define VMSTR_%s %d\n" % (name.upper().replace(" ", "_"), vm.STR.index[name]))
for name, i in str_ids.items():
diff --git a/games/hollowknight/tools/vm.py b/games/hollowknight/tools/vm.py
index b0a43ec1..3d4e546d 100644
--- a/games/hollowknight/tools/vm.py
+++ b/games/hollowknight/tools/vm.py
@@ -251,6 +251,9 @@ for e in ("FINISHED", "CONVO_FINISH", "CONVO START", "CONVO END", "BIG TITLE STA
"FK RAGE COMPLETE"):
EVENTS.id(e)
FIXED_EVENTS = len(EVENTS.list) # (src/data.h: VMEV_*)
+# events the game's code sends that only some rooms' scripts know, numbered as each room numbers its own (src/data.h:
+# VMEV_*, by room): the Elder Baldur's corpse's
+NAMED_EVENTS = ("UPDATE SHAMAN",)
# ---------------------------------------------------------------- the actions it runs: name -> (opcode, operands)
# operand kinds: f i b s o value slots (u16), F I B S O V output variables (u8: 255 none), e event (u8), t event target,
@@ -1650,6 +1653,7 @@ def prepare(rooms, sprites, texts):
any(c.get("class") in ("WaveEffectControl", "SimpleSpriteFade") for c in o["c"]))
assert len(rm.objs) <= MAX_OBJS and len(rm.fsms) <= MAX_FSMS and nvars <= MAX_VARS and nanims <= MAX_ANIMS, \
(name, len(rm.objs), len(rm.fsms), nvars, nanims)
+ rm.named_events = {e: EVENTS.index[e] for e in NAMED_EVENTS if e in EVENTS.index}
BUILT[name] = rm
# Unity Animators (a sprite swapped each frame): their clips as actors'
for rm in BUILT.values():