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: Hornet arena camera zones gone once the cloak is had or the Knight leaves by the left; scripted camera zones follow their objects

Mason Chen03ffed17353a
diff --git a/games/hollowknight/src/camera.c b/games/hollowknight/src/camera.c
index f0d00d53..4118688a 100644
--- a/games/hollowknight/src/camera.c
+++ b/games/hollowknight/src/camera.c
@@ -353,5 +353,11 @@ void cam_debug(void) {
printf("cam %.2f,%.2f target %.2f,%.2f mode %d tmode %d locks %d:", c.cx, c.cy, c.tx, c.ty, c.mode, c.tmode, c.nlocks);
for (int i = 0; i < c.nlocks; i++) printf(" %d", c.locks[i]);
printf("\n");
+ int n;
+ const Ent *es = room_ents(&n);
+ for (int i = 0; i < n && i < MAX_ENTS; i++)
+ if (es[i].type == ENT_CAMLOCK)
+ printf(" camlock %d box %.1f,%.1f-%.1f,%.1f lim %.2f,%.2f,%.2f,%.2f obj %d\n", i, es[i].x0, es[i].y0, es[i].x1, es[i].y1,
+ es[i].p0, es[i].p1, es[i].p2, es[i].p3, es[i].a);
}
#endif
diff --git a/games/hollowknight/src/data.bin b/games/hollowknight/src/data.bin
index 7c794f06..91accf48 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 be3504c2..2b1593ca 100644
--- a/games/hollowknight/src/data.h
+++ b/games/hollowknight/src/data.h
@@ -925,10 +925,10 @@
#define VMEV_FIRST_MAP_DOWN 45
#define VMEV_FK_RAGE_COMPLETE 46
#define VMSTR_NPC_TITLE 14
-#define VMSTR_VISITED 682
-#define VMSTR_DISPLAY_RIGHT 683
+#define VMSTR_VISITED 686
+#define VMSTR_DISPLAY_RIGHT 687
#define VMSTR_HORNET_SAVER 201
-#define VMSTR_ITEM 570
+#define VMSTR_ITEM 571
#define STR_ATTACK_RANGE 24
#define STR_EVADE_RANGE 50
#define STR_SPIT_RANGE 51
diff --git a/games/hollowknight/src/vm.c b/games/hollowknight/src/vm.c
index 17fc0635..7851e942 100644
--- a/games/hollowknight/src/vm.c
+++ b/games/hollowknight/src/vm.c
@@ -13,8 +13,8 @@
#define DT 0.02f
#define MAX_VM_OBJS 48
#define MAX_VM_ANIMS 20 /* (its objects that animate: an animator, a wave, a fade) */ /* (tools/vm.py: MAX_OBJS, MAX_FSMS, MAX_VARS) */
-#define MAX_VM_FSMS 27
-#define MAX_VM_VARS 256
+#define MAX_VM_FSMS 29
+#define MAX_VM_VARS 232
#define MAX_MOVERS 4
#define NONE 0xFFFF
#define OWNER 0xFF0F
@@ -380,6 +380,12 @@ static void anims_start(void) {
/* (the colliders objects have: on as they are) */
static void obj_colliders(void) {
+ /* (a camera lock area among its objects: there as that is on, CameraLockArea's OnDisable) */
+ int n;
+ const Ent *es = room_ents(&n);
+ for (int i = 0; i < n && i < MAX_ENTS; i++)
+ if (es[i].type == ENT_CAMLOCK && es[i].a > 0 && es[i].a <= vm.nobjs)
+ ent_set_enabled(i, obj_active(es[i].a - 1) && !(vm.objs[es[i].a - 1].flags & OF_COND_OFF));
/* (on with it, and as SetCollider leaves it) */
for (int i = 0; i < vm.nobjs; i++)
if (vm.rec[i].ncol && !(vm.objs[i].flags & OF_COND_OFF))
diff --git a/games/hollowknight/tools/ents.py b/games/hollowknight/tools/ents.py
index 97d4172e..54c937d0 100644
--- a/games/hollowknight/tools/ents.py
+++ b/games/hollowknight/tools/ents.py
@@ -1138,8 +1138,12 @@ def room(d, rooms, strings, persist, name, sprites=None, owners=None, rec_base=0
# (its name, if scripts find it: FindGameObject)
import vm
nm = vm.STR.id(o["name"]) if o["name"] in _found_names(d) else 0xFFFF
+ # (one the scripts hold: its object's number + 1, there as that is on; CameraLockArea's OnDisable)
+ rmv = vm.BUILT.get(name)
+ vo = rmv.obj_index.get(o["id"]) if rmv is not None else None
+ vo = vo if vo is not None and rmv.objs[vo]["path"] == o["path"] and rmv.objs[vo].get("_scene") == name else None
recs.append(rec(ENT_CAMLOCK, fl, box, (v["cameraXMin"], v["cameraYMin"], v["cameraXMax"], v["cameraYMax"]),
- s1=nm))
+ a=vo + 1 if vo is not None else 0, s1=nm))
recs += _more_boxes(o)
elif cls == "TransitionPoint":
box, entry_only = _trigger(o), 0
diff --git a/games/hollowknight/tools/vm.py b/games/hollowknight/tools/vm.py
index 60d8f3bf..31bd1b55 100644
--- a/games/hollowknight/tools/vm.py
+++ b/games/hollowknight/tools/vm.py
@@ -21,7 +21,7 @@ ROOMS = {
"Room_ruinhouse": ["Sly Dazed"],
"Crossroads_06": ["Set NPC Leave", "_Scenery/Raising Pillar", "_Props/Gate Switch"],
"Fungus1_04": ["Hornet Infected Knight Encounter", "Hornet Saver", "Cloak Corpse", "Dream Scene Activate",
- "Dreamer Scene 1", "Break Floor 1"],
+ "Dreamer Scene 1", "Break Floor 1", "Camera Locks Boss"],
"Crossroads_ShamanTemple": ["_Props/Shaman Meeting", "_Props/Shaman Trapped", "_Props/Shaman Killed Blocker",
"_Props/Knight Get Fireball", "Battle Scene/Reminder Cast", "Shiny Item", "Soul Totem 2",
"Bone Gate", "Reminder Cast (1)",
@@ -168,7 +168,7 @@ SKIP_NAMES = {"Dream Dialogue", "Dream Dialogue Flower", "Flower", "Flower Give"
# (the Mender House's door: its inspect region, for a key there is none of, never on; the False Knight's arena wall's
# battle gate: src/obj.c's, which FindChild finds)
SKIP_PATHS = {("Crossroads_04", "_Transition Gates/Mender Door/Inspect"), ("Crossroads_10", "Fk Break Wall/Battle Gate 1")}
-MAX_OBJS, MAX_FSMS, MAX_VARS, MAX_ANIMS = 48, 27, 256, 20 # (src/vm.c)
+MAX_OBJS, MAX_FSMS, MAX_VARS, MAX_ANIMS = 48, 29, 232, 20 # (src/vm.c)
# map pieces of their own a script marks visited (AddToScenesVisited), as their room's (src/map.c: after the rooms)
MAP_SCENES = {"Crossroads_21_b": "Crossroads_21"}
# the grubs in this part of the game (Crossroads_03, Fungus1_21): the Grubfather's rewards past them never come