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: after 7A's ascents Madeline lands in the next section, as in the game

Mason Chenaf1667a03ee4
diff --git a/games/celeste/src/player.c b/games/celeste/src/player.c
index 8a8cdf47..919c3515 100644
--- a/games/celeste/src/player.c
+++ b/games/celeste/src/player.c
@@ -2095,13 +2095,21 @@ static float co_intro_walk(void) {
return -1;
}
}
+static bool intro_summit; /* the jump into a room after a summit launch (7A's ascents: PreviousState StSummitLaunch) */
static float co_intro_jump(void) {
switch (P->co_step) {
case 0:
intro_start = v2(E->x, E->y);
+ intro_summit = P->prev_state == ST_SUMMITLAUNCH;
E->depth = D_TOP;
ents_mark_unsorted();
P->facing = 1;
+ if (intro_summit) { /* up from the room's bottom to 24 px above it, on the 8 px grid */
+ intro_start.y = g_level.room->y + g_level.room->h - 24.f;
+ actor_move_to_x(E, roundf(E->x / 8) * 8, NULL);
+ P->co_step = 2;
+ goto rise;
+ }
E->y = g_level.room->y + g_level.room->h + 16.f;
P->co_step = 1;
return .5f;
@@ -2110,10 +2118,12 @@ static float co_intro_jump(void) {
P->co_step = 2;
/* fall through */
case 2:
+ rise:
if (E->y > intro_start.y - 8) {
E->y += -120 * DT;
return 0;
}
+ E->y = roundf(E->y);
P->speed.y = -100;
P->co_step = 3;
/* fall through */
@@ -2123,10 +2133,18 @@ static float co_intro_jump(void) {
return 0;
}
P->speed.y = 0;
+ if (intro_summit) {
+ P->co_step = 30;
+ return .2f;
+ }
+ P->co_step = 4;
+ return .1f;
+ case 30: /* (the area start sound is not played) */
+ play(A_player_launchRecover);
P->co_step = 4;
return .1f;
case 4:
- play(A_player_fallSlow);
+ if (!intro_summit) play(A_player_fallSlow);
P->co_step = 5;
/* fall through */
case 5:
@@ -2134,10 +2152,22 @@ static float co_intro_jump(void) {
P->speed.y += DT * 800;
return 0;
}
- E->x = intro_start.x, E->y = intro_start.y;
+ if (!intro_summit) E->x = intro_start.x, E->y = intro_start.y;
E->depth = D_PLAYER;
ents_mark_unsorted();
level_dir_shake(v2(0, 1), .3f);
+ if (intro_summit) {
+ V2 at = v2(E->x, E->y);
+ particles_emit(PL_MID, &P_Player_P_SummitLandA, 12, at, v2(3, 0), -PI_F / 2);
+ particles_emit(PL_MID, &P_Player_P_SummitLandB, 8, v2(at.x - 2, at.y), v2(2, 0), 3.403392f);
+ particles_emit(PL_MID, &P_Player_P_SummitLandB, 8, v2(at.x + 2, at.y), v2(2, 0), -PI_F / 12);
+ particles_emit(PL_BG, &P_Player_P_SummitLandC, 30, at, v2(5, 0), P_Player_P_SummitLandC.direction);
+ P->co_step = 6;
+ return .35f;
+ }
+ SET(ST_NORMAL);
+ return -1;
+ case 6: /* (the hair settles by itself) */
SET(ST_NORMAL);
return -1;
}
diff --git a/games/celeste/tests/check.py b/games/celeste/tests/check.py
index 1007ff77..8f9f60f9 100644
--- a/games/celeste/tests/check.py
+++ b/games/celeste/tests/check.py
@@ -5,6 +5,7 @@ AddressSanitizer and UBSan, through the menus, the saves and every room.
python3 tests/check.py build/play src/data.bin [--quick]
--quick skips playing every room (the longest part)."""
+import math
import os
import re
import shutil
@@ -126,6 +127,28 @@ out = run(["--chapter", "16", "--room", "boss-00", "--nowipe", "--at", "352,144"
what="6A's boss-00")
check("room boss-01 " in out, f"6A's boss-00: Badeline didn't break the floor: {out[-160:]}")
+# 7A's ascents: Badeline's boosts up each section's last room (the player put at each of her places, kept at the next
+# while she flies there), her last one the summit launch, its cutscene (OK pressed through), the player up and out
+# the top, landing in the next section's first room (e-13: her 9 places, the most)
+ASCENTS = {"a-06": ("b-00", [(152, 696), (256, 576), (48, 520), (160, 408)]),
+ "b-09": ("c-00", [(272, 1072), (88, 1048), (160, 664)]),
+ "c-09": ("d-00", [(264, 888), (32, 768), (160, 616)]),
+ "d-11": ("e-00b", [(160, 976), (160, 760), (40, 728), (280, 720), (160, 648)]),
+ "e-13": ("f-00", [(272, 1352), (296, 1216), (56, 1208), (24, 1104), (288, 1000), (264, 848), (48, 840),
+ (64, 704), (160, 624)]),
+ "f-11": ("g-00", [(80, 1672), (264, 1616), (264, 1320), (160, 528)])}
+for room, (above, places) in ASCENTS.items():
+ t, args = 30, ["--chapter", "19", "--room", room, "--nowipe"]
+ for k, (x, y) in enumerate(places):
+ args += ["--tp", f"{t}:{x},{y + 4}"]
+ if k + 1 < len(places):
+ arrive = t + 30 + math.ceil(min(3, math.dist(places[k], places[k + 1]) / 320) * 60)
+ args += ["--tp", f"{t + 40}-{arrive}:{places[k + 1][0]},{places[k + 1][1] + 4}"]
+ t = arrive
+ out = run(args, t + 2400, ",".join(f"{f}-{f + 2}:o" for f in range(t + 60, t + 2200, 12)), what=f"7A's {room} ascent")
+ check(f"room {above} " in out and " deaths 0 " in out and "state 0 " in out,
+ f"7A's {room}: the ascent didn't land in {above}: {out[-160:]}")
+
# a chapter's end: its screen, then the chapter select
out = run(["--chapter", "1", "--room", "1"], 500, "400-401:o", env={"COMPLETE_AT": "60"}, what="a chapter's end")
diff --git a/games/celeste/tests/play.c b/games/celeste/tests/play.c
index da9d28dd..e4d53669 100644
--- a/games/celeste/tests/play.c
+++ b/games/celeste/tests/play.c
@@ -1,6 +1,6 @@
/* Host runner: plays the game with scripted keys and saves screenshots.
* play DATA.bin [--frames N] [--keys "F0-F1:keys,..."] [--shot F:path ...] [--room NAME] [--chapter N]
- * [--tp F:X,Y] (the player moved there at frame F)
+ * [--tp F:X,Y or F0-F1:X,Y ...] (the player moved there at frame F, or kept there from F0 to F1)
* [--draw N: draw every N frames (else only for shots and the last frame)]
* [--load F:ROOM:INTRO:FX:FY: at frame F, LoadLevel(INTRO) into ROOM at the spawn nearest (FX, FY) of it]
* [--record A-B:DIR: every frame from A to B as DIR/NNNNN.ppm (for the README's GIFs)]
@@ -53,8 +53,8 @@ int main(int argc, char **argv) {
fread(data, 1, n, f);
fclose(f);
cel_bin = data;
- int tp_at = -1;
- float tp_x = 0, tp_y = 0;
+ int tp_at[64], tp_to[64], ntp = 0;
+ float tp_x[64], tp_y[64];
int frames = 120, chapter = -1, area = -1, checkpoint = -1, at_set = 0, dash_code = 0, list = 0, draw = 0, load_at = -1, load_intro = 0,
nowipe = 0;
const char *load_room = NULL, *rec_dir = NULL;
@@ -94,7 +94,12 @@ int main(int argc, char **argv) {
}
else if (!strcmp(argv[i], "--list")) list = 1;
else if (!strcmp(argv[i], "--at")) sscanf(argv[++i], "%f,%f", &at_x, &at_y), at_set = 1;
- else if (!strcmp(argv[i], "--tp")) sscanf(argv[++i], "%d:%f,%f", &tp_at, &tp_x, &tp_y);
+ else if (!strcmp(argv[i], "--tp") && ntp < 64) {
+ const char *a = argv[++i];
+ if (sscanf(a, "%d-%d:%f,%f", &tp_at[ntp], &tp_to[ntp], &tp_x[ntp], &tp_y[ntp]) != 4)
+ sscanf(a, "%d:%f,%f", &tp_at[ntp], &tp_x[ntp], &tp_y[ntp]), tp_to[ntp] = tp_at[ntp];
+ ntp++;
+ }
else if (!strcmp(argv[i], "--shot")) {
char *s = argv[++i], *c = strchr(s, ':');
shot_at[nshots] = atoi(s);
@@ -143,10 +148,11 @@ int main(int argc, char **argv) {
static const float d[6][2] = {{0, -1}, {-1, 0}, {0.7071f, 0.7071f}, {0.7071f, -0.7071f}, {-1, 0}, {-0.7071f, -0.7071f}};
level_dash_listeners(v2(d[fr - 120][0], d[fr - 120][1]));
}
- if (fr == tp_at && g_player.ent && g_level.room) { /* --tp F:X,Y: at frame F, the player there (in the room), still */
- g_player.ent->x = g_level.room->x + tp_x, g_player.ent->y = g_level.room->y + tp_y;
- g_player.speed = v2(0, 0);
- }
+ for (int k = 0; k < ntp; k++) /* --tp F:X,Y or F0-F1:X,Y (up to 64): at frame F, the player there (in the room), still */
+ if (fr >= tp_at[k] && fr <= tp_to[k] && g_player.ent && g_level.room) {
+ g_player.ent->x = g_level.room->x + tp_x[k], g_player.ent->y = g_level.room->y + tp_y[k];
+ g_player.speed = v2(0, 0);
+ }
if (fr == load_at) level_load_room_near(chapter_find_room(g_session.chapter, load_room), load_intro, load_fx, load_fy);
game_frame();
if (getenv("DUSTDBG") && fr % 30 == 0) {