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.

Undertale: Waterfall's signs in reach, the statue's song, Monster Kid's way, the Annoying Dogs and the save's time

Mason363e2797475bd9c
diff --git a/games/undertale/src/data.bin b/games/undertale/src/data.bin
index c98b920f..f5abae8c 100644
Binary files a/games/undertale/src/data.bin and b/games/undertale/src/data.bin differ
diff --git a/games/undertale/src/data.h b/games/undertale/src/data.h
index 65daed26..a4e6cfe9 100644
--- a/games/undertale/src/data.h
+++ b/games/undertale/src/data.h
@@ -252,107 +252,108 @@
#define SPR_TUTU 237
#define SPR_ARTIFACT 238
#define SPR_ECHO_OW 239
-#define SPR_ALPHYS_OW 240
-#define SPR_MTT_OW 241
-#define SPR_MTT_B 242
-#define SPR_RGUARDS_OW 243
-#define SPR_VENT_D 244
-#define SPR_VENT_U 245
-#define SPR_VENT_L 246
-#define SPR_VENT_R 247
-#define SPR_BURNTPAN 248
-#define SPR_VULKIN_B 249
-#define SPR_VULKIN_HURT 250
-#define SPR_TSUNDER_B 251
-#define SPR_PYROPE_B 252
-#define SPR_PYROPE_HURT 253
-#define SPR_RG01_OW 254
-#define SPR_RG02_OW 255
-#define SPR_RG01_B 256
-#define SPR_RG02_B 257
-#define SPR_MTT_NEWS 258
-#define SPR_BOMB_BALL 259
-#define SPR_BOMB_DOG 260
-#define SPR_BOMB_PRESENT 261
-#define SPR_BOMB_WATER 262
-#define SPR_BOMB_SCRIPT 263
-#define SPR_BOMB_GAME 264
-#define SPR_NEWS_SCRIPT 265
-#define SPR_APRON 266
-#define SPR_MUFFET_OW 267
-#define SPR_MUFFET_B 268
-#define SPR_MUFFET_HURT 269
-#define SPR_MUFFET_PET 270
-#define SPR_SPIDER_B 271
-#define SPR_DIAMOND1 272
-#define SPR_DIAMOND2 273
-#define SPR_BOMB_B 274
-#define SPR_DOGBOMB_B 275
-#define SPR_WATER_B 276
-#define SPR_UNDYNE_FALLEN 277
-#define SPR_SPEAR 278
-#define SPR_ARROW 279
-#define SPR_PLANE 280
-#define SPR_BOMB 281
-#define SPR_CLOUD 282
-#define SPR_BOLT 283
-#define SPR_UNDYNE_B 284
-#define SPR_NOTE 285
-#define SPR_DROP 286
-#define SPR_ARM 287
-#define SPR_DEBRIS 288
-#define SPR_STAR 289
-#define SPR_CROISSANT 290
-#define SPR_DONUT 291
-#define SPR_MTTMINI 292
-#define SPR_AARON_B 293
-#define SPR_AARON_HURT 294
-#define SPR_WOSHUA_B 295
-#define SPR_WOSHUA_HURT 296
-#define SPR_MOLDBYGG_B 297
-#define SPR_SHYREN_B 298
-#define SPR_SHYREN_TURNED 299
-#define SPR_INTROIMAGE 300
-#define SPR_INTROLAST 301
-#define SPR_UNDERTALETITLE 302
-#define SPR_GAMEOVERBG 303
-#define SPR_FACE_TORIELTALK 304
-#define SPR_FACE_TORIELTALKSIDE 305
-#define SPR_FACE_TORIELHAPPYTALK 306
-#define SPR_FACE_TORIELWHAT 307
-#define SPR_FACE_TORIELWHATSIDE 308
-#define SPR_FACE_TORIELMAD 309
-#define SPR_FACE_TORIELCOLD 310
-#define SPR_FACE_TORIELSURPRISED 311
-#define SPR_FACE_TORIELEMBARRASSED 312
-#define SPR_FACE_TORIELGLASSES 313
-#define SPR_FACE_TORIELREVENGETALK 314
-#define SPR_FACE_TORIELSCARED 315
-#define SPR_FACE_TORIELBLINK 316
-#define SPR_FACE_TORIELHAPPYBLINK 317
-#define SPR_FACE_TORIELBODY 318
-#define SPR_FACE_SANS 319
-#define SPR_FACE_SANSCHUCKLE 320
-#define SPR_FACE_SANSWINK 321
-#define SPR_FACE_PAPYRUS 322
-#define SPR_FACE_PAPYRUSEVIL 323
-#define SPR_FACE_PAPYRUSLAUGH 324
-#define SPR_FACE_PAPYRUSMAD 325
-#define SPR_FACE_PAPYRUSSIDE 326
-#define SPR_FACE_ALPHYS 327
-#define SPR_FLOWEYNICE 328
-#define SPR_FLOWEYNICESIDE 329
-#define SPR_FLOWEYSASSY 330
-#define SPR_FLOWEYEVIL 331
-#define SPR_FLOWEYGRIN 332
-#define SPR_FLOWEYPLAIN 333
-#define SPR_FLOWEYPISSED 334
-#define SPR_FLOWEYWINK 335
-#define SPR_FLOWEYLAUGH 336
-#define SPR_FLOWEYHURT 337
-#define SPR_FLOWEYTORIEL 338
-#define SPR_FLOWEYTORIEL2 339
-#define SPR_FLOWEYSIDESHOCK 340
+#define SPR_MELODY 240
+#define SPR_ALPHYS_OW 241
+#define SPR_MTT_OW 242
+#define SPR_MTT_B 243
+#define SPR_RGUARDS_OW 244
+#define SPR_VENT_D 245
+#define SPR_VENT_U 246
+#define SPR_VENT_L 247
+#define SPR_VENT_R 248
+#define SPR_BURNTPAN 249
+#define SPR_VULKIN_B 250
+#define SPR_VULKIN_HURT 251
+#define SPR_TSUNDER_B 252
+#define SPR_PYROPE_B 253
+#define SPR_PYROPE_HURT 254
+#define SPR_RG01_OW 255
+#define SPR_RG02_OW 256
+#define SPR_RG01_B 257
+#define SPR_RG02_B 258
+#define SPR_MTT_NEWS 259
+#define SPR_BOMB_BALL 260
+#define SPR_BOMB_DOG 261
+#define SPR_BOMB_PRESENT 262
+#define SPR_BOMB_WATER 263
+#define SPR_BOMB_SCRIPT 264
+#define SPR_BOMB_GAME 265
+#define SPR_NEWS_SCRIPT 266
+#define SPR_APRON 267
+#define SPR_MUFFET_OW 268
+#define SPR_MUFFET_B 269
+#define SPR_MUFFET_HURT 270
+#define SPR_MUFFET_PET 271
+#define SPR_SPIDER_B 272
+#define SPR_DIAMOND1 273
+#define SPR_DIAMOND2 274
+#define SPR_BOMB_B 275
+#define SPR_DOGBOMB_B 276
+#define SPR_WATER_B 277
+#define SPR_UNDYNE_FALLEN 278
+#define SPR_SPEAR 279
+#define SPR_ARROW 280
+#define SPR_PLANE 281
+#define SPR_BOMB 282
+#define SPR_CLOUD 283
+#define SPR_BOLT 284
+#define SPR_UNDYNE_B 285
+#define SPR_NOTE 286
+#define SPR_DROP 287
+#define SPR_ARM 288
+#define SPR_DEBRIS 289
+#define SPR_STAR 290
+#define SPR_CROISSANT 291
+#define SPR_DONUT 292
+#define SPR_MTTMINI 293
+#define SPR_AARON_B 294
+#define SPR_AARON_HURT 295
+#define SPR_WOSHUA_B 296
+#define SPR_WOSHUA_HURT 297
+#define SPR_MOLDBYGG_B 298
+#define SPR_SHYREN_B 299
+#define SPR_SHYREN_TURNED 300
+#define SPR_INTROIMAGE 301
+#define SPR_INTROLAST 302
+#define SPR_UNDERTALETITLE 303
+#define SPR_GAMEOVERBG 304
+#define SPR_FACE_TORIELTALK 305
+#define SPR_FACE_TORIELTALKSIDE 306
+#define SPR_FACE_TORIELHAPPYTALK 307
+#define SPR_FACE_TORIELWHAT 308
+#define SPR_FACE_TORIELWHATSIDE 309
+#define SPR_FACE_TORIELMAD 310
+#define SPR_FACE_TORIELCOLD 311
+#define SPR_FACE_TORIELSURPRISED 312
+#define SPR_FACE_TORIELEMBARRASSED 313
+#define SPR_FACE_TORIELGLASSES 314
+#define SPR_FACE_TORIELREVENGETALK 315
+#define SPR_FACE_TORIELSCARED 316
+#define SPR_FACE_TORIELBLINK 317
+#define SPR_FACE_TORIELHAPPYBLINK 318
+#define SPR_FACE_TORIELBODY 319
+#define SPR_FACE_SANS 320
+#define SPR_FACE_SANSCHUCKLE 321
+#define SPR_FACE_SANSWINK 322
+#define SPR_FACE_PAPYRUS 323
+#define SPR_FACE_PAPYRUSEVIL 324
+#define SPR_FACE_PAPYRUSLAUGH 325
+#define SPR_FACE_PAPYRUSMAD 326
+#define SPR_FACE_PAPYRUSSIDE 327
+#define SPR_FACE_ALPHYS 328
+#define SPR_FLOWEYNICE 329
+#define SPR_FLOWEYNICESIDE 330
+#define SPR_FLOWEYSASSY 331
+#define SPR_FLOWEYEVIL 332
+#define SPR_FLOWEYGRIN 333
+#define SPR_FLOWEYPLAIN 334
+#define SPR_FLOWEYPISSED 335
+#define SPR_FLOWEYWINK 336
+#define SPR_FLOWEYLAUGH 337
+#define SPR_FLOWEYHURT 338
+#define SPR_FLOWEYTORIEL 339
+#define SPR_FLOWEYTORIEL2 340
+#define SPR_FLOWEYSIDESHOCK 341
#define AREA_RUINS 0
#define AREA_SNOWDIN 1
#define AREA_SNOWTOWN 2
@@ -549,7 +550,7 @@
#define FONT_MAIN 0
#define FONT_MENU 1
#define FONT_SMALL 2
-#define NUM_SPRITES 341
+#define NUM_SPRITES 342
#define NUM_ROOMS 185
#define NUM_FONTS 3
#endif
diff --git a/games/undertale/src/events.h b/games/undertale/src/events.h
index cbfbf5a2..039758c4 100644
--- a/games/undertale/src/events.h
+++ b/games/undertale/src/events.h
@@ -41,7 +41,8 @@ enum {
EV_SHOP, EV_INN, EV_GRILLBYS, EV_PAP_FIGHT, EV_PAP_HOUSE, EV_PAP_DATE, EV_TOWN_DOOR, EV_COUCH,
/* wf1.c */
EV_WF_MK, EV_WF_ITEM, EV_WF_STREAM_FALL, EV_WF_UNDYNE1, EV_BELL, EV_WF_GRASS, EV_WF_TELESCOPE, EV_WF_BIRD,
- EV_WF_ONION, EV_PIANO, EV_SHYREN, EV_STATUE, EV_UMBRELLA, EV_MK_RAIN, EV_MK_TALK, EV_WF_BRIDGE_END,
+ EV_WF_ONION, EV_PIANO, EV_SHYREN, EV_STATUE, EV_UMBRELLA, EV_MK_RAIN, EV_MK_TALK, EV_WF_BRIDGE_END, EV_WF_ARTIFACT,
+ EV_WF_DOG,
/* wf2.c */
EV_DUMP_WAKE, EV_COOLER, EV_MAD_DUMMY, EV_NAPSTA_ROOM, EV_LOCKED_HOUSE, EV_SNAILS, EV_GERSON, EV_TEM_SHOP, EV_TEMMIE,
/* wf3.c */
diff --git a/games/undertale/src/items.c b/games/undertale/src/items.c
index c3df682a..a329e632 100644
--- a/games/undertale/src/items.c
+++ b/games/undertale/src/items.c
@@ -77,12 +77,30 @@ static const ItemInfo items[ITEM_COUNT] = {
"* You eat the Hush Puppy.\n* Dog-magic is neutralized.", 150},
[ITEM_WORN_DAGGER] = {"Worn Dagger", "WornDG", IT_WEAPON, 0, 15, 0, "Good for cutting plants and\n vines.", "", 250},
[ITEM_HEART_LOCKET] = {"Heart Locket", "H.Locket", IT_ARMOR, 0, 0, 15, "It says \"Best Friends\n Forever.\"", "", 250},
+ [ITEM_ANNOYING_DOG] = {"Annoying Dog", "Annoy Dog", IT_SPECIAL, 0, 0, 0, "A little white dog.\n* It's fast asleep...",
+ "* You deployed the dog.", 999},
+ [ITEM_DOG_RESIDUE] = {"Dog Residue", "DogResidu", IT_SPECIAL, 0, 0, 0, "Shiny trail left behind by\n a dog.",
+ "* You used the Dog Residue.", 1},
+ [ITEM_DOG_SALAD] = {"Dog Salad", "Dog Salad", IT_FOOD, 0, 0, 0, "Recovers HP. (Hit Poodles.)", "* You ate the Dog Salad.", 8},
};
+/* the Dog Residue's other looks (the game's six kinds of it) */
+static const char *const residue[] = {"Shiny trail left behind by\n a dog.", "Dog-shaped husk shed from\n a dog's carapace.",
+ "Dirty dishes left unwashed\n by a dog.", "Glowing crystals secreted\n by a dog.",
+ "Jigsaw puzzle left\n unfinished by a dog.", "Web spun by a dog to\n ensnare prey."};
+
const ItemInfo *item_info(int id) { return &items[id >= 0 && id < ITEM_COUNT ? id : 0]; }
void item_info_text(int id, char *out, int cap) {
const ItemInfo *it = item_info(id);
+ if (id == ITEM_DOG_RESIDUE) {
+ snprintf(out, (size_t)cap, "* \"%s\"\n* %s", it->name, residue[rnd_n(6)]);
+ return;
+ }
+ if (id == ITEM_DOG_SALAD) {
+ snprintf(out, (size_t)cap, "* \"%s\" - Heals ?? HP\n* %s", it->name, it->info);
+ return;
+ }
switch (it->type) {
case IT_WEAPON: snprintf(out, (size_t)cap, "* \"%s\" - Weapon AT %d\n* %s", it->name, it->at, it->info); break;
case IT_ARMOR:
@@ -137,6 +155,15 @@ void item_use(int slot, char *out, int cap, int in_battle) {
return;
}
case IT_SPECIAL: /* looked at, kept */
+ if (id == ITEM_DOG_RESIDUE) {
+ /* the rest of the inventory fills up with it (now and then a Dog Salad) */
+ int n = 0;
+ for (int i = 0; i < NUM_ITEMS; i++)
+ if (!sv.items[i]) sv.items[i] = (uint8_t)(rnd_n(7) ? ITEM_DOG_RESIDUE : ITEM_DOG_SALAD), n++;
+ if (n) snprintf(out, (size_t)cap, "%s\n* The rest of your inventory\n filled up with Dog Residue.", it->use);
+ else snprintf(out, (size_t)cap, "%s|* ...|* You finished using it.\n* An uneasy atmosphere fills\n the room.", it->use);
+ return;
+ }
snprintf(out, (size_t)cap, "%s", it->use);
return;
default: {
@@ -149,6 +176,20 @@ void item_use(int slot, char *out, int cap, int in_battle) {
/* half a Bisicle is a Unisicle */
if (id == ITEM_BISICLE) sv.items[slot] = ITEM_UNISICLE;
else item_remove_at(slot);
+ if (id == ITEM_DOG_SALAD) { /* what it turns out to be, and so what it heals */
+ static const char *const what[] = {"Oh. There are bones...", "Oh. Fried tennis ball...", "Oh. Tastes yappy...",
+ "It's literally garbage???"};
+ static const int16_t heals[] = {2, 10, 30, 999};
+ int k = rnd_n(4);
+ n += snprintf(out + n, (size_t)(cap - n), "\n* %s", what[k]);
+ if (heals[k] >= 999) {
+ sv.hp = sv.maxhp;
+ snprintf(out + n, (size_t)(cap - n), "\n* Your HP was maxed out.");
+ } else {
+ heal(heals[k] + (sv.weapon == ITEM_BURNT_PAN ? 4 : 0), out + n, cap - n);
+ }
+ return;
+ }
if (it->heal >= 999) {
sv.hp = sv.maxhp;
snprintf(out + n, (size_t)(cap - n), "\n* Your HP was maxed out.");
diff --git a/games/undertale/src/items.h b/games/undertale/src/items.h
index bbf04478..691f6e69 100644
--- a/games/undertale/src/items.h
+++ b/games/undertale/src/items.h
@@ -52,6 +52,10 @@ enum {
/* New Home */
ITEM_WORN_DAGGER,
ITEM_HEART_LOCKET,
+ /* the artifact's room, in Waterfall */
+ ITEM_ANNOYING_DOG,
+ ITEM_DOG_RESIDUE,
+ ITEM_DOG_SALAD,
ITEM_COUNT
};
enum { IT_FOOD, IT_WEAPON, IT_ARMOR, IT_SPECIAL };
diff --git a/games/undertale/src/menu.c b/games/undertale/src/menu.c
index afc78251..092aac19 100644
--- a/games/undertale/src/menu.c
+++ b/games/undertale/src/menu.c
@@ -236,7 +236,12 @@ static void c_menu_input(uint32_t pressed) {
if (pressed & K_RIGHT) item_act = (item_act + 1) % 3;
if (pressed & K_X) st = M_ITEMS;
if (pressed & K_Z) {
- if (item_act == 0) {
+ if (item_act != 1 && sv.items[item_sel] == ITEM_ANNOYING_DOG) {
+ /* used or dropped, the dog is deployed (wf1.c) */
+ menu_close();
+ event_start(EV_WF_DOG, NULL);
+ event_cur_arg(item_sel);
+ } else if (item_act == 0) {
item_use(item_sel, buf, sizeof buf, 0);
menu_say(buf);
} else if (item_act == 1) {
@@ -372,7 +377,8 @@ static void draw_save(void) {
gfx_text(FONT_MENU, 136, 68, s, c, 255);
unsigned secs = shown->time / 30;
snprintf(s, sizeof s, "%u:%02u", secs / 60, secs % 60);
- gfx_text(FONT_MENU, 222, 68, s, c, 255);
+ /* (100 minutes and more: the time moves left, to stay in the box) */
+ gfx_text(FONT_MENU, min_i(222, 54 + 212 - 7 - gfx_text_width(FONT_MENU, s, (int)strlen(s))), 68, s, c, 255);
RoomInfo ri;
room_info(g_room, &ri);
gfx_text(FONT_MENU, 68, 88, str(ri.name), c, 255);
diff --git a/games/undertale/src/snowtown.c b/games/undertale/src/snowtown.c
index 5caab78c..522d94c4 100644
--- a/games/undertale/src/snowtown.c
+++ b/games/undertale/src/snowtown.c
@@ -22,6 +22,8 @@ static void folk(int x, int y, const char *text) {
Obj *o = obj_sign(x - 12, y - 18, 24, 26, text);
(void)o;
}
+/* (one behind a table or a counter: talked to across it) */
+static void folk_across(int x, int y, int reach, const char *text) { obj_sign(x - 12, y - 18, 24, 26 + reach, text); }
void town_setup(int room, int from) {
(void)from;
@@ -75,7 +77,7 @@ void town_setup(int room, int from) {
folk(1246, 770, "* (Grillby is silently cleaning a glass.)");
folk(1214, 792, "* Cheep cheep!\n* (The dogs here are the Royal Guard's Snowdin squad.)");
folk(1194, 786, "* I'm fishing for a date.\n* Literally.");
- folk(1156, 782, "* (Lesser Dog is playing poker against itself.)");
+ folk_across(1156, 782, 24, "* (Lesser Dog is playing poker against itself.)");
folk(1174, 834, "* (Bark!)");
folk(1134, 860, "* I'm thinking of getting a collar...\n* Then maybe someone would take me for a walk.");
folk(1316, 903, "* I want new drinks...\n* And hot guys!");
@@ -93,7 +95,8 @@ void town_setup(int room, int from) {
obj_sign(1962, 506, 30, 40, "* (A book about magic and the SOUL.)|* (A monster who won't fight\n grows weaker...)|* (...and cruel intent hurts\n them most.)\n* (The chapter stops there.)");
obj_sign(2006, 506, 30, 40, "* (A history book. Monsters left their first city and crossed cold, swamp and heat.)|* (They named the new capital \"New Home.\" The book sighs about the King's naming.)");
obj_sign(2050, 506, 30, 40, "* (A book on what a SOUL is made of.)|* (Nobody knows for sure.)");
- folk(1896, 640, "* Yes, the sign outside says \"Librarby.\"\n* We made a typo when we were making it.");
+ /* (behind the counter: talked to from its end) */
+ obj_sign(1884, 622, 40, 26, "* Yes, the sign outside says \"Librarby.\"\n* We made a typo when we were making it.");
folk(2031, 655, flag(F_WORDSEARCH) == 2 ? "* I can see it in your eyes...\n* You think Junior Jumble is harder." : "* I can see it in your eyes...\n* You think crosswords are harder.");
folk(2002, 589, "* There's no news around here, so the newspaper is mostly comics and puzzles.");
folk(2044, 590, "* I make the word searches.\n* Number one in the underground!");
diff --git a/games/undertale/src/wf1.c b/games/undertale/src/wf1.c
index d83affbe..ce7da03e 100644
--- a/games/undertale/src/wf1.c
+++ b/games/undertale/src/wf1.c
@@ -38,6 +38,9 @@ static void pickup(int x, int y, int w, int h, int item, int fl, uint16_t spr) {
if (o) o->flags = OF_TALK | OF_BACK, o->arg = (int16_t)item, o->arg2 = (int16_t)fl, o->spr[0] = spr;
}
+/* the Legendary Artifact still on its pedestal (F_WF_ARTIFACT: 1 taken, 2 the dogs came, 3 a dog absorbed it) */
+static bool artifact_there(void) { return flag(F_WF_ARTIFACT) == 0 || flag(F_WF_ARTIFACT) == 2; }
+
/* ---------------------------------------------------------------- the bridge seeds */
/* each puzzle: where its water is (the seeds bloom on it) and where its seeds start; solved, the blooms that
* stay */
@@ -192,15 +195,16 @@ static void spears_update(void) {
if (u && g_room == ROOM_WF_CHASE1 && pl.x >= ch->from_x) u->x = (int16_t)(pl.x - 40);
return;
}
- /* she keeps up along the ledge above */
+ /* she keeps up along the ledge above (as fast as Frisk walks: twice, walking fast) */
if (u && g_room == ROOM_WF_CHASE1) {
- int want = pl.x - 40;
- u->x = (int16_t)(u->x + (want > u->x ? min_i(3, want - u->x) : -min_i(3, u->x - want)));
+ int want = pl.x - 40, sp = 3 * (1 + g_walk_fast);
+ u->x = (int16_t)(u->x + (want > u->x ? min_i(sp, want - u->x) : -min_i(sp, u->x - want)));
}
if (hurt_t) hurt_t--;
int every = g_room == ROOM_WF_BRIDGE ? 26 : 40;
if (++spear_t % every == 0) {
- int lead = pl.moving ? (pl.dir == DIR_RIGHT ? 30 : pl.dir == DIR_LEFT ? -30 : 0) : 0;
+ /* (where he'll be when it's out: twice as far ahead, walking fast) */
+ int lead = pl.moving ? (pl.dir == DIR_RIGHT ? 30 : pl.dir == DIR_LEFT ? -30 : 0) * (1 + g_walk_fast) : 0;
Obj *s = obj_deco(SPR_SPEAR, pl.x + 10 + lead, pl.y + 34, false);
if (s) s->name = ACTOR_SPEAR, s->arg = 0, s->alpha = 90, obj_set_box(s, -3, -36, 6, 34);
}
@@ -236,7 +240,8 @@ static void mk_update(void) {
trail_at++;
}
if (trail_at < TRAIL) return;
- const int16_t *p = trail[(trail_at - TRAIL + 4) % TRAIL];
+ /* (as far behind walking fast: half as many of Frisk's steps back) */
+ const int16_t *p = trail[(trail_at - ((TRAIL - 4) >> g_walk_fast)) % TRAIL];
int nx = p[0] + 10, ny = p[1] + 29;
mk->dir = (uint8_t)(nx < mk->x ? DIR_LEFT : nx > mk->x ? DIR_RIGHT : mk->dir);
mk->x = (int16_t)nx, mk->y = (int16_t)ny;
@@ -247,14 +252,27 @@ static void onion_update(void) {
if (g_room != ROOM_WF_ONION || flag(F_WF_ONION) != 1) return;
Obj *o = obj_find(ACTOR_ONION);
if (o && !event_running()) {
+ /* (alongside, as fast as Frisk walks) */
int want = pl.x + 60;
- if (o->x < want) o->x = (int16_t)(o->x + 1);
+ if (o->x < want) o->x = (int16_t)(o->x + min_i(3 * (1 + g_walk_fast), want - o->x));
}
if (!event_running() && pl.x > 9500) event_start(EV_WF_ONION, NULL);
}
+/* ---------------------------------------------------------------- the statue's song */
+/* under the umbrella, its music box plays; a while later the song shows over it (the piano's answer) */
+static int statue_t;
+static void statue_update(void) {
+ if (g_room != ROOM_WF_STATUE || flag(F_UMBRELLA) < 2 || statue_t > 90) return;
+ if (++statue_t == 90) {
+ Obj *o = obj_deco(SPR_MELODY, 10705, 554, false);
+ if (o) o->flags |= OF_FRONT;
+ }
+}
+
void wf1_update(void) {
if (world_room_info()->area != AREA_WATERFALL) return;
+ statue_update();
seeds_watch();
stream_update();
spears_update();
@@ -273,8 +291,12 @@ static void echo(int x, int y, const char *says) {
void wf1_setup(int room, int from) {
(void)from;
+ /* the Annoying Dogs keep to the artifact's room */
+ if (room != ROOM_WF_PIANO)
+ for (int i = NUM_ITEMS - 1; i >= 0; i--)
+ if (sv.items[i] == ITEM_ANNOYING_DOG) item_remove_at(i);
if (room < ROOM_WF1 || room > ROOM_WF_BRIDGE) return;
- mk_follows = false, trail_at = 0, spear_t = 0, hurt_t = 0;
+ mk_follows = false, trail_at = 0, spear_t = 0, hurt_t = 0, statue_t = 0;
switch (room) {
case ROOM_WF1:
set_flag(F_SNOW_EXIT, 1); /* (out of Snowdin) */
@@ -313,7 +335,8 @@ void wf1_setup(int room, int from) {
seeds_setup(&seed_puzzles[0]);
break;
case ROOM_WF_SEEDS2:
- obj_sign(2840, 1540, 20, 22, "* (Ring the bell to call the seeds back.)");
+ /* (below the planks' end, read from them) */
+ obj_sign(2840, 1522, 20, 40, "* (Ring the bell to call the seeds back.)");
{
Obj *b = obj_trigger(3018, 1188, 24, 26, EV_BELL, ACTOR_ITEM);
if (b) b->flags = OF_TALK | OF_SOLID;
@@ -400,7 +423,11 @@ void wf1_setup(int room, int from) {
Obj *d = obj_trigger(10118, 330, 64, 50, 0, ACTOR_BLOCK);
if (d) d->flags = OF_SOLID;
}
- pickup(10156, 150, 12, 30, ITEM_ARTIFACT, F_WF_ARTIFACT, SPR_ARTIFACT);
+ {
+ /* the Legendary Artifact on its pedestal */
+ Obj *a = obj_trigger(10156, 150, 12, 30, EV_WF_ARTIFACT, ACTOR_ORB);
+ if (a) a->flags = OF_TALK | OF_BACK, a->spr[0] = artifact_there() ? SPR_ARTIFACT : 0;
+ }
obj_sign(10194, 572, 30, 16, "* (Monsters fear humans... yet some wish to meet one.)");
obj_sign(10374, 610, 30, 22, "* (The barrier can't be crossed by anything with a SOUL... except a human.)");
obj_sign(10484, 610, 30, 22, "* (A human SOUL and a monster SOUL together: that would be enough.)");
@@ -617,6 +644,58 @@ static int ev_wf_onion(Ev *c) {
EV_END;
}
+/* the Legendary Artifact: the first try fills the inventory with Annoying Dogs, and none can be taken while they're
+ * carried (they stay in the room: out of it, they're gone, and the artifact can be taken). One of them, used or
+ * dropped, runs in, absorbs the artifact and runs off through the wall, and leaves Dog Residue behind */
+static bool dogs_carried(void) {
+ for (int i = 0; i < NUM_ITEMS; i++)
+ if (sv.items[i] == ITEM_ANNOYING_DOG) return true;
+ return false;
+}
+static int ev_wf_artifact(Ev *c) {
+ EV_BEGIN;
+ if (!artifact_there()) return 1;
+ if (!dogs_carried()) {
+ if (item_count() == NUM_ITEMS) {
+ NARRATE("* (You're carrying too much.)");
+ return 1;
+ }
+ if (flag(F_WF_ARTIFACT) == 2) {
+ item_add(ITEM_ARTIFACT);
+ set_flag(F_WF_ARTIFACT, 1);
+ if (c->self) c->self->spr[0] = 0;
+ NARRATE("* (You got the Legendary Artifact.)");
+ return 1;
+ }
+ while (item_add(ITEM_ANNOYING_DOG)) {}
+ set_flag(F_WF_ARTIFACT, 2);
+ }
+ NARRATE("* (You're carrying too many dogs.)");
+ EV_END;
+}
+static int ev_wf_dog(Ev *c) { /* (v[0]: the dog's slot) */
+ Obj *d = obj_find(ACTOR_DOG), *a = obj_find(ACTOR_ORB);
+ EV_BEGIN;
+ NARRATE("* You deployed the dog.");
+ if (!a || !artifact_there()) return 1; /* (anywhere else, nothing happens) */
+ {
+ static const uint16_t s[4] = {SPR_DOG_OW, SPR_DOG_OW, SPR_DOG_OW, SPR_DOG_OW};
+ d = obj_npc(ACTOR_DOG, s, cam_x - 10, 174, DIR_RIGHT, 0);
+ if (!d) return 1;
+ d->flags = (uint16_t)(d->flags & ~OF_SOLID);
+ }
+ WALK(d, a->x + 6, 174, 3);
+ a->spr[0] = 0;
+ set_flag(F_WF_ARTIFACT, 3);
+ WAIT(30);
+ WALK(d, cam_x + 340, 174, 3);
+ gone(d);
+ if (sv.items[c->v[0]] == ITEM_ANNOYING_DOG) sv.items[c->v[0]] = ITEM_DOG_RESIDUE;
+ for (int i = NUM_ITEMS - 1; i >= 0; i--)
+ if (sv.items[i] == ITEM_ANNOYING_DOG) item_remove_at(i);
+ EV_END;
+}
+
/* the piano: the rain's song (on the statue's sign: middle, up, right, middle, down, down, right) */
static const char *const notes[] = {"Up", "Down", "Left", "Right", "Middle", "Stop"};
static const uint8_t song[7] = {4, 0, 3, 4, 1, 1, 3};
@@ -755,6 +834,8 @@ int wf1_event(Ev *c) {
case EV_MK_RAIN: return ev_mk_rain(c);
case EV_MK_TALK: return ev_mk_talk(c);
case EV_WF_BRIDGE_END: return ev_bridge_end(c);
+ case EV_WF_ARTIFACT: return ev_wf_artifact(c);
+ case EV_WF_DOG: return ev_wf_dog(c);
}
return -1;
}
diff --git a/games/undertale/src/wf3.c b/games/undertale/src/wf3.c
index 29b90bf4..2ac07f7d 100644
--- a/games/undertale/src/wf3.c
+++ b/games/undertale/src/wf3.c
@@ -32,8 +32,9 @@ static void chase_update(void) {
stun_t--;
return;
}
- int dx = pl.x + 10 - u->x, dy = pl.y + 29 - u->y;
- u->x = (int16_t)(u->x + clamp_i(dx, -2, 2)), u->y = (int16_t)(u->y + clamp_i(dy, -2, 2));
+ /* (two thirds of Frisk's speed, walking fast too) */
+ int dx = pl.x + 10 - u->x, dy = pl.y + 29 - u->y, sp = 2 * (1 + g_walk_fast);
+ u->x = (int16_t)(u->x + clamp_i(dx, -sp, sp)), u->y = (int16_t)(u->y + clamp_i(dy, -sp, sp));
if (abs_i(dx) < 14 && abs_i(dy) < 12) event_start(EV_UNDYNE_CATCH, u);
}
/* she comes in after Frisk, from the way Frisk came */
diff --git a/games/undertale/src/world.c b/games/undertale/src/world.c
index 3a3a519a..b7e9f2c5 100644
--- a/games/undertale/src/world.c
+++ b/games/undertale/src/world.c
@@ -401,17 +401,20 @@ void world_reach(int *x, int *y, int *w, int *h) {
*h += *y - top, *y = top;
}
-static void interact(void) {
+Obj *world_talk_target(void) {
int x, y, w, h;
world_reach(&x, &y, &w, &h);
for (int i = 0; i < MAX_OBJS; i++) {
Obj *o = &objs[i];
if (o->kind == OBJ_NONE || !(o->flags & OF_TALK)) continue;
- if (boxes_meet(x, y, w, h, o->x + o->bx, o->y + o->by, o->bw, o->bh)) {
- event_start(o->event, o);
- return;
- }
+ if (boxes_meet(x, y, w, h, o->x + o->bx, o->y + o->by, o->bw, o->bh)) return o;
}
+ return NULL;
+}
+
+static void interact(void) {
+ Obj *o = world_talk_target();
+ if (o) event_start(o->event, o);
}
static void touches(void) {
diff --git a/games/undertale/src/world.h b/games/undertale/src/world.h
index ebcb8019..45dc0b26 100644
--- a/games/undertale/src/world.h
+++ b/games/undertale/src/world.h
@@ -69,6 +69,7 @@ void world_draw(void);
#define WALK_FLOOR_ONLY (-2) /* (world_walkable's ignore: the floor alone, nothing solid standing on it) */
bool world_walkable(int x, int y, int w, int h, int ignore); /* a box on the map, objects too (not `ignore`) */
void world_reach(int *x, int *y, int *w, int *h); /* the box Z reaches, in front of Frisk */
+Obj *world_talk_target(void); /* what Z there would talk to, NULL nothing */
void world_camera(void); /* follows Frisk, inside the room */
Obj *obj_new(int kind, int x, int y);
Obj *obj_find(int name);
diff --git a/games/undertale/tests/check.py b/games/undertale/tests/check.py
index 67356fd5..133dfb3d 100644
--- a/games/undertale/tests/check.py
+++ b/games/undertale/tests/check.py
@@ -40,6 +40,7 @@ ITEM_BURNT_PAN, ITEM_INSTANT_NOODLES, ITEM_HOT_DOG, ITEM_STAINED_APRON = 28, 29,
ITEM_NICE_CREAM = 13
ITEM_STARFAIT, ITEM_GLAMBURGER = 32, 33
ITEM_WORN_DAGGER, ITEM_HEART_LOCKET = 41, 42
+ITEM_ANNOYING_DOG, ITEM_DOG_RESIDUE = 43, 44
def run(args, frames, saves=None, what=""):
@@ -222,15 +223,39 @@ if not QUICK:
if s:
for name, v in (("WF_MK", 1), ("GRILLBYS", 1), ("WF_TUTU", 1), ("WF_UNDYNE1", 1), ("SEEDS1", 1), ("SEEDS2", 1),
("SEEDS3", 1), ("WF_QUICHE", 1), ("CHASE1", 1), ("WF_TELESCOPE", 1), ("WF_PUNCH", 1), ("WF_BALLET", 1),
- ("WF_ONION", 2), ("PIANO", 1), ("WF_ARTIFACT", 1), ("SHYREN", 1),
+ ("WF_ONION", 2), ("PIANO", 1), ("WF_ARTIFACT", 3), ("SHYREN", 1),
("UMBRELLA", 3), ("MK_RAIN", 2), ("WF_BRIDGE", 1), ("WF_DUMP", 1), ("WF_COOLER", 2),
("MAD_DUMMY", 1), ("NAPSTA_HOME", 2), ("TEM_VILLAGE", 1), ("DEADEND", 1), ("MK_CHASM", 2),
("UNDYNE", 4), ("WATER_CUP", 2), ("PAP_NEON", 1)):
check(flag(s, name) == v, f"Waterfall: F_{name} is {flag(s, name)}, not {v}")
check(s["kills"] == 0, f"Waterfall: {s['kills']} killed on the friendly way")
- for item in (ITEM_OLD_TUTU, ITEM_BALLET_SHOES, ITEM_QUICHE, ITEM_PUNCH_CARD, ITEM_ARTIFACT, ITEM_ASTRONAUT_FOOD):
+ for item in (ITEM_OLD_TUTU, ITEM_BALLET_SHOES, ITEM_QUICHE, ITEM_PUNCH_CARD, ITEM_DOG_RESIDUE, ITEM_ASTRONAUT_FOOD):
check(item in s["items"], f"Waterfall: item {item} not picked up: {s['items']}")
+# the Legendary Artifact (issue #216): the first try fills the inventory with Annoying Dogs; one deployed there absorbs
+# the artifact and leaves Dog Residue; with the dogs gone (out of the room), the artifact is taken
+art = ["--name", "Frisk", "--noenc", "--god", "--room", str(ROOMS["WF_PIANO"]), "--at", "10140,240",
+ "--flag", "%d=1" % FLAGS["F_PIANO"]]
+s = run(art + ["--path", "go:10150,162;u;z;talk"], 1500, what="the artifact, the first try")
+check(s and s["items"] == [ITEM_ANNOYING_DOG] * 8 and flag(s, "WF_ARTIFACT") == 2, f"the artifact: no dogs: {s and s['items']}")
+s = run(art + ["--path", "go:10150,162;u;z;talk;c;z;z;z;talk;u;z;talk"], 2500, what="the artifact, a dog deployed")
+check(s and s["items"] == [ITEM_DOG_RESIDUE] + [0] * 7 and flag(s, "WF_ARTIFACT") == 3,
+ f"the artifact: the dog did not absorb it: {s and s['items']}")
+s = run(art + ["--flag", "%d=2" % FLAGS["F_WF_ARTIFACT"], "--path", "go:10150,162;u;z;talk"], 1500,
+ what="the artifact, the dogs gone")
+check(s and s["items"][0] == ITEM_ARTIFACT and flag(s, "WF_ARTIFACT") == 1, f"the artifact not taken: {s and s['items']}")
+
+# every room: all there is to talk to (signs, glyphs on the walls, the townsfolk) reached from a floor Frisk walks on,
+# facing it (issue #216: Waterfall's lore panels and signs out of reach)
+with tempfile.NamedTemporaryFile("w", suffix=".txt", delete=False) as f:
+ f.write("".join("room %d\n" % r for r in sorted(ROOMS.values())))
+p = subprocess.run([PLAY, "--saves", tempfile.mkdtemp(prefix="undertale_check_"), "--name", "Frisk", "--rooms", f.name],
+ capture_output=True, text=True, env=ENV, timeout=900)
+os.remove(f.name)
+m = re.search(r"ROOMS (\d+) checked, (\d+) failed", p.stdout)
+check(m and int(m.group(1)) == len(ROOMS) and m.group(2) == "0",
+ "rooms: " + "\n".join(l for l in p.stdout.splitlines() if l.startswith("ROOMS")) + p.stderr[-1000:])
+
# Hotland's first floor: Alphys and the quiz, the noodles, the belts, the vents, the lasers, both shooting puzzles, the
# cooking show, up the elevator to the second floor
if not QUICK:
diff --git a/games/undertale/tests/play.c b/games/undertale/tests/play.c
index 4dca02f2..e91bb75b 100644
--- a/games/undertale/tests/play.c
+++ b/games/undertale/tests/play.c
@@ -8,7 +8,16 @@
* keys don't hold anything.
* Keys: left right up down z x c home. "a-b:key" holds the key from frame a to b, "a:key" for one frame.
* --room starts a new game in room N (its ROOM_* number) with Frisk's top-left at (X, Y), past the title.
- * Screenshots are DIR/shot_<frame>.ppm. */
+ * Screenshots are DIR/shot_<frame>.ppm.
+ * --rooms FILE checks rooms: for each "room N" line, the floor Frisk walks to from its first "floor X,Y" line (his
+ * feet), each "floor X,Y" reached and each "wall X,Y" not walked on (points from the original game), and all there is
+ * to talk to reached from a floor, facing it. A room with no points: its whole floor, and what there is to talk to.
+ *
+ * --rooms FILE checks rooms against the original's maps (tests/check.py writes FILE from tests/waterfall.rooms): for each
+ * "room N" (and its "flag F=V"s, a new game each), every "floor X,Y" (where the original's floor is: Frisk's feet
+ * there) is walked to from the first, every "wall X,Y" (the original's wall) can't be walked on, and everything
+ * there is to talk to (a sign, a SAVE Point, an echo flower...) is talked to from somewhere Frisk can walk to.
+ * It prints "ROOMS FAIL ..." for each that isn't so, then "ROOMS n checked". */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@@ -335,6 +344,135 @@ static uint32_t path_keys(int f) {
return k;
}
+/* ---------------------------------------------------------------- --rooms: the rooms against the original */
+#define RC_STEP 2 /* Frisk's top-left on a 2-pixel grid */
+static int rooms_failed;
+static void room_fail(int room, const char *what, int x, int y) {
+ printf("ROOMS FAIL room %d: %s at %d,%d\n", room, what, x, y);
+ rooms_failed++;
+}
+typedef struct { int kind, x, y; } Probe; /* kind: 'f' floor, 'w' wall */
+
+static void room_check(int room, const int (*fl)[2], int nfl, const Probe *pr, int npr) {
+ game_new("Frisk");
+ for (int i = 0; i < nfl; i++) set_flag(fl[i][0], fl[i][1]);
+ int sx = -1, sy = -1;
+ for (int i = 0; i < npr && sx < 0; i++)
+ if (pr[i].kind == 'f') sx = pr[i].x - 10, sy = pr[i].y - 24; /* (feet's middle -> top-left) */
+ RoomInfo ri;
+ room_info(room, &ri);
+ if (sx >= 0) world_enter(room, sx, sy, DIR_DOWN);
+ else {
+ /* (no floor given: the room's own floor nearest its middle) */
+ world_enter(room, ri.x + ri.w / 2 - 10, ri.y + ri.h / 2 - 24, DIR_DOWN);
+ for (int r = 0; sx < 0 && r < (ri.w > ri.h ? ri.w : ri.h); r += RC_STEP)
+ for (int y = ri.y + ri.h / 2 - r; sx < 0 && y <= ri.y + ri.h / 2 + r; y += RC_STEP)
+ for (int x = ri.x + ri.w / 2 - r; sx < 0 && x <= ri.x + ri.w / 2 + r; x += RC_STEP)
+ if (world_walkable(x - 7, y - 4, 14, 9, WALK_FLOOR_ONLY)) sx = x - 10, sy = y - 24;
+ if (sx < 0) {
+ room_fail(room, "no floor to start on", 0, 0);
+ return;
+ }
+ pl.x = (int16_t)sx, pl.y = (int16_t)sy;
+ }
+ /* every place Frisk walks to from the first floor point (the floor alone: what stands about can move), his feet
+ * in the room */
+ int x0 = ri.x - 24, y0 = ri.y - 32, gw = (ri.w + 48) / RC_STEP + 1, gh = (ri.h + 48) / RC_STEP + 1;
+ uint8_t *seen = calloc((size_t)gw * (size_t)gh, 1);
+ int *queue = malloc(sizeof(int) * (size_t)gw * (size_t)gh);
+ int qh = 0, qt = 0;
+ int s0 = ((pl.y - y0) / RC_STEP) * gw + (pl.x - x0) / RC_STEP;
+ if (s0 >= 0 && s0 < gw * gh) seen[s0] = 1, queue[qt++] = s0;
+ if (!npr) /* (no floor given: every floor of the room) */
+ for (int c = 0; c < gw * gh; c++) {
+ int px = x0 + c % gw * RC_STEP, py = y0 + c / gw * RC_STEP, fx = px + 10, fy = py + 24;
+ if (seen[c] || fx < ri.x || fy < ri.y || fx >= ri.x + ri.w || fy >= ri.y + ri.h) continue;
+ if (world_walkable(px + 3, py + 20, 14, 9, WALK_FLOOR_ONLY)) seen[c] = 1, queue[qt++] = c;
+ }
+ while (qh < qt) {
+ int c = queue[qh++], cx = c % gw, cy = c / gw;
+ static const int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};
+ for (int k = 0; k < 4; k++) {
+ int nx = cx + dx[k], ny = cy + dy[k];
+ if (nx < 0 || ny < 0 || nx >= gw || ny >= gh || seen[ny * gw + nx]) continue;
+ int px = x0 + nx * RC_STEP, py = y0 + ny * RC_STEP, fx = px + 10, fy = py + 24;
+ if (fx < ri.x || fy < ri.y || fx >= ri.x + ri.w || fy >= ri.y + ri.h) continue;
+ if (!world_walkable(px + 3, py + 20, 14, 9, WALK_FLOOR_ONLY)) continue;
+ seen[ny * gw + nx] = 1, queue[qt++] = ny * gw + nx;
+ }
+ }
+ for (int i = 0; i < npr; i++) {
+ if (pr[i].kind == 'w') {
+ if (world_walkable(pr[i].x, pr[i].y, 1, 1, WALK_FLOOR_ONLY)) room_fail(room, "the original's wall is walked on", pr[i].x, pr[i].y);
+ continue;
+ }
+ if (!world_walkable(pr[i].x - 7, pr[i].y - 4, 14, 9, WALK_FLOOR_ONLY)) {
+ room_fail(room, "the original's floor can't be stood on", pr[i].x, pr[i].y);
+ continue;
+ }
+ /* reached: a place walked to within a step of it */
+ bool ok = false;
+ for (int j = 0; j < qt && !ok; j++) {
+ int px = x0 + queue[j] % gw * RC_STEP, py = y0 + queue[j] / gw * RC_STEP;
+ ok = abs(px + 10 - pr[i].x) <= RC_STEP && abs(py + 24 - pr[i].y) <= RC_STEP;
+ }
+ if (!ok) room_fail(room, "the original's floor isn't reached", pr[i].x, pr[i].y);
+ }
+ /* everything to talk to: from a place walked to (with nothing solid on it), facing some way, Z talks to it */
+ int16_t px0 = pl.x, py0 = pl.y;
+ uint8_t d0 = pl.dir;
+ for (int i = 0; i < MAX_OBJS; i++) {
+ Obj *o = &objs[i];
+ if (o->kind == OBJ_NONE || !(o->flags & OF_TALK)) continue;
+ bool ok = false;
+ for (int j = 0; j < qt && !ok; j++) {
+ int px = x0 + queue[j] % gw * RC_STEP, py = y0 + queue[j] / gw * RC_STEP;
+ if (abs(px + 10 - (o->x + o->bx + o->bw / 2)) > o->bw / 2 + 80 || abs(py + 24 - (o->y + o->by + o->bh / 2)) > o->bh / 2 + 80)
+ continue;
+ if (!world_walkable(px + 3, py + 20, 14, 9, -1)) continue;
+ pl.x = (int16_t)px, pl.y = (int16_t)py;
+ for (int d = 0; d < 4 && !ok; d++) {
+ pl.dir = (uint8_t)d;
+ ok = world_talk_target() == o;
+ }
+ }
+ if (!ok) {
+ char what[96];
+ snprintf(what, sizeof what, "nothing reaches the thing to talk to (event %d, %dx%d)", o->event, o->bw, o->bh);
+ room_fail(room, what, o->x + o->bx, o->y + o->by);
+ }
+ }
+ pl.x = px0, pl.y = py0, pl.dir = d0;
+ free(seen);
+ free(queue);
+}
+
+static int rooms_check(const char *path) {
+ FILE *f = fopen(path, "r");
+ if (!f) fprintf(stderr, "no %s\n", path), exit(2);
+ static Probe pr[512];
+ int fl[32][2], nfl = 0, npr = 0, room = -1, nrooms = 0;
+ char line[256];
+ for (;;) {
+ bool eof = !fgets(line, sizeof line, f);
+ int a, b;
+ if (eof || sscanf(line, "room %d", &a) == 1) {
+ if (room >= 0) room_check(room, (const int (*)[2])fl, nfl, pr, npr), nrooms++;
+ if (eof) break;
+ room = a, nfl = 0, npr = 0;
+ } else if (sscanf(line, "flag %d=%d", &a, &b) == 2 && nfl < 32) {
+ fl[nfl][0] = a, fl[nfl][1] = b, nfl++;
+ } else if (sscanf(line, "floor %d,%d", &a, &b) == 2 && npr < 512) {
+ pr[npr++] = (Probe){'f', a, b};
+ } else if (sscanf(line, "wall %d,%d", &a, &b) == 2 && npr < 512) {
+ pr[npr++] = (Probe){'w', a, b};
+ }
+ }
+ fclose(f);
+ printf("ROOMS %d checked, %d failed\n", nrooms, rooms_failed);
+ return 0;
+}
+
static uint32_t key_bit(const char *s) {
static const struct { const char *n; uint32_t k; } keys[] = {
{"left", K_LEFT}, {"right", K_RIGHT}, {"up", K_UP}, {"down", K_DOWN}, {"z", K_Z}, {"x", K_X}, {"c", K_C},
@@ -363,6 +501,7 @@ int main(int argc, char **argv) {
const char *name = NULL;
int nflags = 0, fl[64][2], gold = -1, nitems_ = 0, items_[8];
bool trace = false, coll = false, god = false;
+ const char *rooms_file = NULL;
for (int i = 1; i < argc; i++) {
if (!strcmp(argv[i], "--frames") && i + 1 < argc) frames = atoi(argv[++i]);
else if (!strcmp(argv[i], "--keys") && i + 1 < argc) parse_keys(argv[++i]);
@@ -401,6 +540,7 @@ int main(int argc, char **argv) {
else if (!strcmp(argv[i], "--gold") && i + 1 < argc) gold = atoi(argv[++i]);
else if (!strcmp(argv[i], "--item") && i + 1 < argc && nitems_ < 8) items_[nitems_++] = atoi(argv[++i]);
else if (!strcmp(argv[i], "--coll")) coll = true;
+ else if (!strcmp(argv[i], "--rooms") && i + 1 < argc) rooms_file = argv[++i];
else fprintf(stderr, "unknown option %s\n", argv[i]), exit(2);
}
mkdir(out, 0755);
@@ -411,6 +551,7 @@ int main(int argc, char **argv) {
host_save_dir(saves);
ut_bin = ut_data;
game_init();
+ if (rooms_file) return rooms_check(rooms_file);
if (room >= 0 || name || battle >= 0) {
game_new(name ? name : "Frisk");
for (int i = 0; i < nflags; i++) set_flag(fl[i][0], fl[i][1]); /* (before the room is set up) */
diff --git a/games/undertale/tests/waterfall.path b/games/undertale/tests/waterfall.path
index 8b47070f..c0e61e26 100644
--- a/games/undertale/tests/waterfall.path
+++ b/games/undertale/tests/waterfall.path
@@ -181,6 +181,13 @@ go:10150,162
u
z
talk
+# (too many dogs: one deployed, the last in the list, gets the artifact)
+c
+z
+u
+z
+z
+talk
go:10150,264
10150,300
go:10137,612
diff --git a/games/undertale/tools/rooms.py b/games/undertale/tools/rooms.py
index 78978624..4fa79934 100644
--- a/games/undertale/tools/rooms.py
+++ b/games/undertale/tools/rooms.py
@@ -149,6 +149,8 @@ AREAS.append(dict(name="waterfall", map="Waterfall_map.png", floor=WF_FLOOR, mar
("erase", 8466, 578, 15, 19, [(27, 33, 90), (27, 21, 72), (23, 13, 43)]),
("erase", 1240, 1240, 22, 10, [(23, 13, 43), (27, 21, 72), (27, 33, 90)]),
("erase", 10156, 150, 12, 7, [(27, 21, 72), (27, 33, 90), (54, 47, 121)]),
+ # the song over the statue in the rain shows only once it has an umbrella (an object, as in the game)
+ ("erase", 10705, 554, 158, 18, [(0, 0, 0), (48, 48, 48), (10, 5, 23), (55, 52, 65), (30, 25, 73), (73, 68, 128)]),
("fill", 10156, 157, 12, 1, (0, 0, 0)), ("fill", 10156, 158, 12, 3, (99, 102, 135)),
("erase", 2380, 1500, 80, 20, "ring"), ("erase", 2850, 1240, 30, 80, "ring"), ("erase", 3040, 1540, 80, 20, "ring"),
]))
diff --git a/games/undertale/tools/sprites.py b/games/undertale/tools/sprites.py
index bf3a3fcb..a5549fbd 100644
--- a/games/undertale/tools/sprites.py
+++ b/games/undertale/tools/sprites.py
@@ -538,6 +538,7 @@ SPRITES = [
("artifact", "map:Waterfall_map.png:10156,150,12,11",
{"keep": True, "clear": [(27, 21, 72), (27, 33, 90), (54, 47, 121), (99, 102, 135)]}),
("echo_ow", "wiki:Echo_Flower_overworld.png", {"feet": True}),
+ ("melody", "map:Waterfall_map.png:10705,554,158,18", {"keep": True, "only": [(255, 255, 255)]}),
# Hotland: Alphys, Mettaton (his box), the Royal Guards at the elevator (cut from the map), the steam vents'
# grates each way (cut from the map: the turning ones are drawn over theirs), the burnt pan; its monsters
("alphys_ow", "wiki:Alphys_overworld.png", {"feet": True}),