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.

Celeste: the Summit's last climb gets all its camera triggers too

Mason Chende6a3855d734
diff --git a/games/celeste/src/ent.c b/games/celeste/src/ent.c
index a1c84ac0..9a83be3f 100644
--- a/games/celeste/src/ent.c
+++ b/games/celeste/src/ent.c
@@ -188,10 +188,14 @@ void ents_clear(bool keep_persistent) {
arena_compact();
}
-void ents_remove_room(int room) {
+void ents_remove_room(int room) { ents_remove_room_kind(room, 0); }
+/* kind 0: all of the room's (but the persistent and global ones); else only those of that kind that do nothing between
+ * rooms (not TransitionUpdate) */
+void ents_remove_room_kind(int room, uint16_t kind) {
+ uint16_t keep = TAG_PERSISTENT | TAG_GLOBAL | (kind ? TAG_TRANSITION_UPDATE : 0);
for (int i = 0; i < g_nents; i++) {
Ent *e = &g_ents[i];
- if (e->cls && e->room == room && !(e->tags & (TAG_PERSISTENT | TAG_GLOBAL))) {
+ if (e->cls && e->room == room && (!kind || (e->kind & kind)) && !(e->tags & keep)) {
if (e->cls->removed) e->cls->removed(e);
e->cls = NULL;
}
diff --git a/games/celeste/src/ent.h b/games/celeste/src/ent.h
index a201f194..ef7bd4a3 100644
--- a/games/celeste/src/ent.h
+++ b/games/celeste/src/ent.h
@@ -118,6 +118,7 @@ void ents_flush_removed(void);
void ents_awake_new(void);
void ents_clear(bool keep_persistent);
void ents_remove_room(int room);
+void ents_remove_room_kind(int room, uint16_t kind); /* (the room's entities of a kind) */
void ents_mark_unsorted(void);
/* the collider's bounds (a circle's: its center, radius cw) */
diff --git a/games/celeste/src/level.c b/games/celeste/src/level.c
index b551cce0..02d4d21c 100644
--- a/games/celeste/src/level.c
+++ b/games/celeste/src/level.c
@@ -571,6 +571,15 @@ void level_reload(void) {
static void transition_to(int index, V2 dir) {
int slot = g_level.room_slot ^ 1;
ents_remove_room(slot);
+ /* Player.CleanUpTriggers: the triggers the player is in are left; the room's triggers do nothing more (they go at the
+ * transition's end in the game): they go now, which leaves their entity slots to the next room's (7A g-01 needs them) */
+ for (int i = 0; i < g_nents; i++) {
+ Ent *t = &g_ents[i];
+ if (!t->cls || !(t->kind & KIND_TRIGGER) || !t->triggered) continue;
+ t->triggered = 0;
+ if (MORE(t->cls)->on_leave) MORE(t->cls)->on_leave(t, &g_player);
+ }
+ ents_remove_room_kind(g_level.room_slot, KIND_TRIGGER);
uint8_t first = g_session.first_level;
uint32_t deaths = g_session.deaths_in_current_level;
g_session.first_level = 0;