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, from Snowdin to the bridge Undyne cuts

Mason Chen2cf6bca5c358
diff --git a/README.md b/README.md
index 437d185a..32cf907f 100644
--- a/README.md
+++ b/README.md
@@ -79,7 +79,7 @@ These are too big to fit next to NumPlay, so each one is its own app. Install it
<tr>
<td align="center"><a href="games/celeste/README.md"><img src="docs/media/thumb_celeste.png" width="200" alt="Celeste"><br><b>Celeste</b></a><br><sub>The whole climb, with every B-side and C-side</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/Celeste.nwa">Download</a></td>
<td align="center"><a href="games/championisland/README.md"><img src="docs/media/thumb_championisland.png" width="200" alt="Champion Island"><br><b>Champion Island</b></a><br><sub>The whole island and its seven sports</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/ChampionIsland.nwa">Download</a></td>
- <td align="center"><a href="games/undertale/README.md"><img src="docs/media/thumb_undertale.png" width="200" alt="Undertale"><br><b>Undertale</b></a><br><sub>The Ruins and Snowdin, from the golden flowers to the edge of Waterfall</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/Undertale.nwa">Download</a></td>
+ <td align="center"><a href="games/undertale/README.md"><img src="docs/media/thumb_undertale.png" width="200" alt="Undertale"><br><b>Undertale</b></a><br><sub>The Ruins, Snowdin and half of Waterfall, from the golden flowers to the bridge Undyne cuts</sub><br><a href="https://github.com/Mason363/NumPlay/releases/latest/download/Undertale.nwa">Download</a></td>
</tr>
<tr>
<td align="center"><a href="#roadmap"><b>More on the way</b></a><br><sub>The rest of Undertale, The Binding of Isaac, Plants vs. Zombies, Doom and more: see the roadmap</sub></td>
@@ -174,7 +174,7 @@ Filmed on my own calculator, no emulator.
- [x] The Final Earth 2
- [x] The Powder Toy (NumPowder)
- [x] Block Blast
-- [ ] Undertale: the Ruins and Snowdin are out, Waterfall, Hotland and New Home are next
+- [ ] Undertale: the Ruins, Snowdin and half of Waterfall are out, the rest of Waterfall, Hotland and New Home are next
- [ ] The Binding of Isaac
- [ ] Plants vs. Zombies
- [ ] Doom
diff --git a/docs/play.md b/docs/play.md
index ef4dfbcb..1774ce4e 100644
--- a/docs/play.md
+++ b/docs/play.md
@@ -268,7 +268,7 @@ Undertale comes as its own app, `Undertale.nwa`: it is too big to share the calc
| **toolbox**, **shift** or **var** | The menu: ITEM, STAT, CELL (C in the game) |
| **Home** | Keep the moment and quit |
-Name the fallen human, then walk and talk your way through the Ruins and Snowdin. In a battle, FIGHT attacks (press **OK** when the bar crosses the middle), ACT checks a monster or does something to it, ITEM eats, and MERCY spares a monster that no longer wants to fight, or flees. Then move your SOUL to dodge; when it turns blue, it falls, and **Up** jumps. On ice you slide until something stops you. In Snowdin Town, walk into the shop to buy, and into the inn to rest. Walk up to a star and press **OK** to SAVE. Home keeps the moment you were at, and the next start is back there. Your save is also copied into `undertale_saves.py`, so installing the app again doesn't erase it. For now the game ends on the way out of Snowdin, at the edge of Waterfall.
+Name the fallen human, then walk and talk your way through the Ruins, Snowdin and Waterfall. In a battle, FIGHT attacks (press **OK** when the bar crosses the middle), ACT checks a monster or does something to it, ITEM eats, and MERCY spares a monster that no longer wants to fight, or flees. Then move your SOUL to dodge; when it turns blue, it falls, and **Up** jumps. On ice you slide until something stops you. In Snowdin Town, walk into the shop to buy, and into the inn to rest. In Waterfall, walk into a bridge seed to push it into the water, where it blooms into a flower you can walk on; the bell calls the seeds back. A green bullet heals you. Walk up to a star and press **OK** to SAVE. Home keeps the moment you were at, and the next start is back there. Your save is also copied into `undertale_saves.py`, so installing the app again doesn't erase it. For now the game ends halfway through Waterfall, where Undyne cuts the bridge.
<br clear="right">
diff --git a/games/undertale/README.md b/games/undertale/README.md
index e690080b..0160f77e 100644
--- a/games/undertale/README.md
+++ b/games/undertale/README.md
@@ -8,7 +8,7 @@
<p align="center">
<b>Fall into the Underground as a human child, on the NumWorks calculator.</b><br>
- The Ruins and Snowdin, from the bed of golden flowers to the edge of Waterfall. The rest of the Underground is on the way.
+ The Ruins, Snowdin and the first half of Waterfall, from the bed of golden flowers to the bridge Undyne cuts. The rest of the Underground is on the way.
</p>
<p align="center">
@@ -24,8 +24,9 @@
* **The whole Ruins:** every room, from the golden flowers through Toriel's puzzles, the falling leaves, the spikes, the rocks, the cracked floors and the switches, to Toriel's home and the long corridor under it.
* **Its people, with all they have to say:** Flowey, Toriel and her phone calls, Napstablook, the talking rock, the Froggits who give advice, the spider bake sale, the snail facts, and every sign, bookshelf and mirror.
-* **Snowdin:** Sans and Papyrus, and every one of Papyrus's puzzles: the invisible electricity maze, the X and O tiles, the one on ice, the multicolor tiles and the Gauntlet. Then Snowdin Town, with its shop, inn, Grillby's, library and Papyrus's house.
-* **Battles like in the game:** FIGHT with the timing bar, ACT, ITEM and MERCY, and your SOUL dodging each monster's own attacks in the box: Froggit, Whimsun, Moldsmal, Loox, Vegetoid, Migosp, Napstablook and Toriel in the Ruins; Snowdrake, Ice Cap, Gyftrot, Jerry, Chilldrake, Glyde, Doggo, Lesser Dog, Dogamy and Dogaressa, Greater Dog and Papyrus, whose blue attack makes your SOUL fall, in Snowdin.
+* **Snowdin:** Sans and Papyrus, and every one of Papyrus's puzzles: the invisible electricity maze, the X and O tiles, the one on ice, the multicolor tiles and the Gauntlet. Then Snowdin Town, with its shop, inn, library and Papyrus's house.
+* **Waterfall's first half:** Monster Kid, Grillby's with Sans, the echo flowers, the bridge seeds (and the secret bridge to the quiche), the wishing room, Undyne chasing you with her spears, Sans's telescope, the bird over the gap, Onionsan, the piano's secret song, the statue in the rain and Monster Kid under your umbrella.
+* **Battles like in the game:** FIGHT with the timing bar, ACT, ITEM and MERCY, and your SOUL dodging each monster's own attacks in the box: Froggit, Whimsun, Moldsmal, Loox, Vegetoid, Migosp, Napstablook and Toriel in the Ruins; Snowdrake, Ice Cap, Gyftrot, Jerry, Chilldrake, Glyde, Doggo, Lesser Dog, Dogamy and Dogaressa, Greater Dog and Papyrus, whose blue attack makes your SOUL fall, in Snowdin; Aaron, Woshua, Moldbygg and Shyren in Waterfall.
* **Spare or fight:** every monster can be spared, and Flowey at the door remembers what you did. Lose to Papyrus and he only locks you in his shed.
* **Saved like in the game:** SAVE at the stars, with the room and the time played. The C menu has your ITEM, STAT and CELL. Home keeps the moment you were at, and your save is also copied into `undertale_saves.py`, so installing the app again doesn't erase it.
@@ -62,6 +63,22 @@
<td align="center"><img src="docs/papyrus.png" width="390" alt="Papyrus's blue attack"><br><sub>Papyrus's blue attack</sub></td>
<td align="center"><img src="docs/date.png" width="390" alt="Papyrus's room"><br><sub>Hanging out with Papyrus</sub></td>
</tr>
+ <tr>
+ <td align="center"><img src="docs/echo.png" width="390" alt="Monster Kid by an echo flower"><br><sub>Monster Kid, by the first echo flower</sub></td>
+ <td align="center"><img src="docs/seeds.png" width="390" alt="The bridge seeds"><br><sub>Bridge seeds bloom in the water</sub></td>
+ </tr>
+ <tr>
+ <td align="center"><img src="docs/spears.png" width="390" alt="Undyne's spears"><br><sub>Undyne's spears on the boardwalk</sub></td>
+ <td align="center"><img src="docs/onionsan.png" width="390" alt="Onionsan"><br><sub>Onionsan says hi</sub></td>
+ </tr>
+ <tr>
+ <td align="center"><img src="docs/statue.png" width="390" alt="The statue in the rain"><br><sub>The statue in the rain</sub></td>
+ <td align="center"><img src="docs/castle.png" width="390" alt="The castle far away"><br><sub>Monster Kid and the castle, far away</sub></td>
+ </tr>
+ <tr>
+ <td align="center"><img src="docs/woshua.png" width="390" alt="Woshua's green drop"><br><sub>Woshua's green drop heals</sub></td>
+ <td align="center"><img src="docs/shyren.png" width="390" alt="Shyren's notes"><br><sub>Shyren sings when you hum along</sub></td>
+ </tr>
</table>
## How to play
@@ -72,6 +89,8 @@ Monsters jump out as you walk. In a battle, choose FIGHT to attack (press OK whe
Snowdin brings new things: when Papyrus turns your SOUL blue, it falls to the bottom of the box, and Up jumps over his bones. On ice you slide until something stops you. Snowdin Town's shop sells food and gear, and its inn gives you a night's rest.
+In Waterfall, walk into a bridge seed to push it: in the water it blooms into a flower you can walk on, and the bell calls the seeds back. A green bullet heals you instead of hurting. Talk to the piano to play it, and keep an umbrella for the rain.
+
Walk up to a star and press OK to SAVE and fill your HP. The C menu (toolbox) shows your items, your STAT and the phone numbers you have.
## Controls
@@ -87,15 +106,15 @@ Walk up to a star and press OK to SAVE and fill your HP. The C menu (toolbox) sh
## Good to know
* **One app at a time:** Undertale is too big to sit next to NumPlay or the other big games. Installing it from the NumWorks website swaps them out, and installing them again swaps it out. Your saves in each one are kept.
-* **The Ruins and Snowdin, for now:** the way out of Snowdin ends the game, on a screen that says the rest of the Underground is still to come. Waterfall, Hotland and New Home come next, one at a time.
+* **The Ruins, Snowdin and half of Waterfall, for now:** the bridge Undyne cuts ends the game, on a screen that says the rest of the Underground is still to come. The rest of Waterfall, Hotland and New Home come next, one at a time.
* **No music or sound:** the calculator has no speaker.
-* **The same Underground:** the rooms, pictures and words are the game's, and the puzzles and battles follow how the game plays them, at its 30 frames a second.
+* **The same Underground:** the rooms and pictures are the game's, everyone says what they say in the game (the longer speeches in shorter words of our own), and the puzzles and battles follow how the game plays them, at its 30 frames a second.
## Credits
Inspired by Undertale by Toby Fox, not affiliated with him.
-* The maps, pictures and texts come from the [Undertale Wiki](https://undertale.fandom.com) and the game's free demo.
+* The maps and pictures come from the [Undertale Wiki](https://undertale.fandom.com) and the game's free demo, and what's said follows them.
* The **Pixel Operator** fonts are by Jayvee Enaguas, released into the public domain (CC0).
* The LZMA decoder in `src/lzma` is by Igor Pavlov, in the public domain.
diff --git a/games/undertale/docs/castle.png b/games/undertale/docs/castle.png
new file mode 100644
index 00000000..7585aea4
Binary files /dev/null and b/games/undertale/docs/castle.png differ
diff --git a/games/undertale/docs/echo.png b/games/undertale/docs/echo.png
new file mode 100644
index 00000000..75e91d70
Binary files /dev/null and b/games/undertale/docs/echo.png differ
diff --git a/games/undertale/docs/onionsan.png b/games/undertale/docs/onionsan.png
new file mode 100644
index 00000000..231095d6
Binary files /dev/null and b/games/undertale/docs/onionsan.png differ
diff --git a/games/undertale/docs/seeds.png b/games/undertale/docs/seeds.png
new file mode 100644
index 00000000..4bf52b5d
Binary files /dev/null and b/games/undertale/docs/seeds.png differ
diff --git a/games/undertale/docs/shyren.png b/games/undertale/docs/shyren.png
new file mode 100644
index 00000000..e8ba6cee
Binary files /dev/null and b/games/undertale/docs/shyren.png differ
diff --git a/games/undertale/docs/spears.png b/games/undertale/docs/spears.png
new file mode 100644
index 00000000..3c45dddc
Binary files /dev/null and b/games/undertale/docs/spears.png differ
diff --git a/games/undertale/docs/statue.png b/games/undertale/docs/statue.png
new file mode 100644
index 00000000..06e9c249
Binary files /dev/null and b/games/undertale/docs/statue.png differ
diff --git a/games/undertale/docs/woshua.png b/games/undertale/docs/woshua.png
new file mode 100644
index 00000000..965bdcca
Binary files /dev/null and b/games/undertale/docs/woshua.png differ
diff --git a/games/undertale/src/battle.h b/games/undertale/src/battle.h
index 05a57dcc..75e8ff34 100644
--- a/games/undertale/src/battle.h
+++ b/games/undertale/src/battle.h
@@ -109,6 +109,7 @@ typedef struct Battle {
int phase, t;
Monster mon[MAX_MON];
int nmon;
+ int greens; /* green (healing) bullets the SOUL caught this battle */
int button, target, act, item, mercy, page;
Writer w; /* the box's text */
char text[600];
diff --git a/games/undertale/src/bullets.c b/games/undertale/src/bullets.c
index a34f7f5f..489b926a 100644
--- a/games/undertale/src/bullets.c
+++ b/games/undertale/src/bullets.c
@@ -177,6 +177,7 @@ bool soul_hit_test(void) {
if (b->color == BC_GREEN) {
sv.hp = (int16_t)min_i(sv.maxhp, sv.hp + (b->dmg ? b->dmg : 1));
b->kind = BK_NONE;
+ bt.greens++;
continue;
}
if (bt.inv) continue;
diff --git a/games/undertale/src/data.bin b/games/undertale/src/data.bin
index 2833d11a..0d14c6e7 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 3080f83f..31099127 100644
--- a/games/undertale/src/data.h
+++ b/games/undertale/src/data.h
@@ -184,49 +184,75 @@
#define SPR_PAPYRUS_B 170
#define SPR_PAPYRUS_HURT 171
#define SPR_PAPYRUS_CONFUSED 172
-#define SPR_INTROIMAGE 173
-#define SPR_INTROLAST 174
-#define SPR_UNDERTALETITLE 175
-#define SPR_GAMEOVERBG 176
-#define SPR_FACE_TORIELTALK 177
-#define SPR_FACE_TORIELTALKSIDE 178
-#define SPR_FACE_TORIELHAPPYTALK 179
-#define SPR_FACE_TORIELWHAT 180
-#define SPR_FACE_TORIELWHATSIDE 181
-#define SPR_FACE_TORIELMAD 182
-#define SPR_FACE_TORIELCOLD 183
-#define SPR_FACE_TORIELSURPRISED 184
-#define SPR_FACE_TORIELEMBARRASSED 185
-#define SPR_FACE_TORIELGLASSES 186
-#define SPR_FACE_TORIELREVENGETALK 187
-#define SPR_FACE_TORIELSCARED 188
-#define SPR_FACE_TORIELBLINK 189
-#define SPR_FACE_TORIELHAPPYBLINK 190
-#define SPR_FACE_TORIELBODY 191
-#define SPR_FACE_SANS 192
-#define SPR_FACE_SANSCHUCKLE 193
-#define SPR_FACE_SANSWINK 194
-#define SPR_FACE_PAPYRUS 195
-#define SPR_FACE_PAPYRUSEVIL 196
-#define SPR_FACE_PAPYRUSLAUGH 197
-#define SPR_FACE_PAPYRUSMAD 198
-#define SPR_FACE_PAPYRUSSIDE 199
-#define SPR_FLOWEYNICE 200
-#define SPR_FLOWEYNICESIDE 201
-#define SPR_FLOWEYSASSY 202
-#define SPR_FLOWEYEVIL 203
-#define SPR_FLOWEYGRIN 204
-#define SPR_FLOWEYPLAIN 205
-#define SPR_FLOWEYPISSED 206
-#define SPR_FLOWEYWINK 207
-#define SPR_FLOWEYLAUGH 208
-#define SPR_FLOWEYHURT 209
-#define SPR_FLOWEYTORIEL 210
-#define SPR_FLOWEYTORIEL2 211
-#define SPR_FLOWEYSIDESHOCK 212
+#define SPR_MK_OW 173
+#define SPR_MK_OW_L 174
+#define SPR_UNDYNE_OW 175
+#define SPR_UNDYNE_THROW 176
+#define SPR_ONIONSAN 177
+#define SPR_ONIONSAN_UP 178
+#define SPR_SHYREN_OW 179
+#define SPR_AARON_OW 180
+#define SPR_WOSHUA_OW 181
+#define SPR_SEED 182
+#define SPR_BLOOM 183
+#define SPR_TUTU 184
+#define SPR_ARTIFACT 185
+#define SPR_SPEAR 186
+#define SPR_NOTE 187
+#define SPR_DROP 188
+#define SPR_ARM 189
+#define SPR_DEBRIS 190
+#define SPR_AARON_B 191
+#define SPR_AARON_HURT 192
+#define SPR_WOSHUA_B 193
+#define SPR_WOSHUA_HURT 194
+#define SPR_MOLDBYGG_B 195
+#define SPR_SHYREN_B 196
+#define SPR_SHYREN_TURNED 197
+#define SPR_INTROIMAGE 198
+#define SPR_INTROLAST 199
+#define SPR_UNDERTALETITLE 200
+#define SPR_GAMEOVERBG 201
+#define SPR_FACE_TORIELTALK 202
+#define SPR_FACE_TORIELTALKSIDE 203
+#define SPR_FACE_TORIELHAPPYTALK 204
+#define SPR_FACE_TORIELWHAT 205
+#define SPR_FACE_TORIELWHATSIDE 206
+#define SPR_FACE_TORIELMAD 207
+#define SPR_FACE_TORIELCOLD 208
+#define SPR_FACE_TORIELSURPRISED 209
+#define SPR_FACE_TORIELEMBARRASSED 210
+#define SPR_FACE_TORIELGLASSES 211
+#define SPR_FACE_TORIELREVENGETALK 212
+#define SPR_FACE_TORIELSCARED 213
+#define SPR_FACE_TORIELBLINK 214
+#define SPR_FACE_TORIELHAPPYBLINK 215
+#define SPR_FACE_TORIELBODY 216
+#define SPR_FACE_SANS 217
+#define SPR_FACE_SANSCHUCKLE 218
+#define SPR_FACE_SANSWINK 219
+#define SPR_FACE_PAPYRUS 220
+#define SPR_FACE_PAPYRUSEVIL 221
+#define SPR_FACE_PAPYRUSLAUGH 222
+#define SPR_FACE_PAPYRUSMAD 223
+#define SPR_FACE_PAPYRUSSIDE 224
+#define SPR_FLOWEYNICE 225
+#define SPR_FLOWEYNICESIDE 226
+#define SPR_FLOWEYSASSY 227
+#define SPR_FLOWEYEVIL 228
+#define SPR_FLOWEYGRIN 229
+#define SPR_FLOWEYPLAIN 230
+#define SPR_FLOWEYPISSED 231
+#define SPR_FLOWEYWINK 232
+#define SPR_FLOWEYLAUGH 233
+#define SPR_FLOWEYHURT 234
+#define SPR_FLOWEYTORIEL 235
+#define SPR_FLOWEYTORIEL2 236
+#define SPR_FLOWEYSIDESHOCK 237
#define AREA_RUINS 0
#define AREA_SNOWDIN 1
#define AREA_SNOWTOWN 2
+#define AREA_WATERFALL 3
#define ROOM_AREA1 0
#define ROOM_AREA1_2 1
#define ROOM_RUINS1 2
@@ -312,10 +338,33 @@
#define ROOM_PAPROOM 82
#define ROOM_SANSROOM 83
#define ROOM_SHED 84
+#define ROOM_WF1 85
+#define ROOM_WF_FALLS 86
+#define ROOM_WF_FALLS_LOW 87
+#define ROOM_WF2 88
+#define ROOM_WF_SEEDS1 89
+#define ROOM_WF_SEEDS2 90
+#define ROOM_WF_QUICHE 91
+#define ROOM_WF_WISH 92
+#define ROOM_WF_HIST 93
+#define ROOM_WF_CHASE1 94
+#define ROOM_WF_GRASS1 95
+#define ROOM_WF_SANS2 96
+#define ROOM_WF_MARSH_TOP 97
+#define ROOM_WF_MARSH_MID 98
+#define ROOM_WF_MARSH 99
+#define ROOM_WF_ONION 100
+#define ROOM_WF_PIANO 101
+#define ROOM_WF_STATUE 102
+#define ROOM_WF_RAIN1 103
+#define ROOM_WF_RAIN2 104
+#define ROOM_WF_CASTLE 105
+#define ROOM_WF_AARON 106
+#define ROOM_WF_BRIDGE 107
#define FONT_MAIN 0
#define FONT_MENU 1
#define FONT_SMALL 2
-#define NUM_SPRITES 213
-#define NUM_ROOMS 85
+#define NUM_SPRITES 238
+#define NUM_ROOMS 108
#define NUM_FONTS 3
#endif
diff --git a/games/undertale/src/events.c b/games/undertale/src/events.c
index 1cd5d96d..8f00b765 100644
--- a/games/undertale/src/events.c
+++ b/games/undertale/src/events.c
@@ -8,6 +8,7 @@
#include "menu.h"
#include "ruins.h"
#include "snowdin.h"
+#include "waterfall.h"
static int ev_sign(Ev *c) {
EV_BEGIN;
@@ -87,6 +88,7 @@ static int ev_encounter(Ev *c) {
g_exclaim = 0;
BATTLE(c->v[0]);
snow_battle_done(c->v[0]);
+ wf_battle_done(c->v[0]);
EV_END;
}
@@ -109,5 +111,7 @@ int event_run(Ev *c) {
if (r >= 0) return r;
r = town_event(c);
if (r >= 0) return r;
+ r = wf1_event(c);
+ if (r >= 0) return r;
return 1;
}
diff --git a/games/undertale/src/events.h b/games/undertale/src/events.h
index 5d8c3adc..8bedff15 100644
--- a/games/undertale/src/events.h
+++ b/games/undertale/src/events.h
@@ -8,7 +8,9 @@ enum {
ACTOR_CANDY, ACTOR_TRIGGER, ACTOR_TRIGGER2, ACTOR_ITEM, ACTOR_CHAIR, ACTOR_PIE, ACTOR_ANY,
/* Snowdin */
ACTOR_SANS, ACTOR_PAPYRUS, ACTOR_DOGGO, ACTOR_DOGAMY, ACTOR_DOGARESSA, ACTOR_GREATERDOG, ACTOR_BALL, ACTOR_ORB,
- ACTOR_TILE, ACTOR_DOG, ACTOR_BLOCK, ACTOR_TRIGGER3
+ ACTOR_TILE, ACTOR_DOG, ACTOR_BLOCK, ACTOR_TRIGGER3,
+ /* Waterfall */
+ ACTOR_MK, ACTOR_UNDYNE, ACTOR_SEED, ACTOR_BLOOM, ACTOR_SPEAR, ACTOR_ONION, ACTOR_DEBRIS, ACTOR_SHYREN
};
enum {
@@ -32,7 +34,10 @@ enum {
EV_SNOW_SWITCH, EV_DOGI, EV_XOXO_SWITCH, EV_PAP_XOXO, EV_TILES, EV_XOXO_FALL, EV_TREESLIDE, EV_POFF, EV_GREATERDOG,
EV_GAUNTLET, EV_MYSTERY_DOOR, EV_SNOW_SANS_CLIFF,
/* snowtown.c */
- EV_SHOP, EV_INN, EV_GRILLBYS, EV_PAP_FIGHT, EV_PAP_HOUSE, EV_PAP_DATE, EV_TOWN_DOOR, EV_SNOW_END, EV_COUCH,
+ 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_COUNT
};
/* Toriel's calls on the way (EV_CALL's v[0]) */
diff --git a/games/undertale/src/flags.h b/games/undertale/src/flags.h
index 32cb3e18..7628330c 100644
--- a/games/undertale/src/flags.h
+++ b/games/undertale/src/flags.h
@@ -95,6 +95,22 @@ enum {
F_FISH, /* the fishing rod's note read */
F_SHOP_TALK,
F_SNOWDRAKE_DEAD, /* (then Chilldrake comes instead) */
+ /* Waterfall */
+ F_WF_MK, /* Monster Kid met by the first echo flower */
+ F_WF_GRILLBYS, /* Sans took Frisk to Grillby's from his station */
+ F_WF_TUTU, F_WF_QUICHE, F_WF_BALLET, F_WF_PUNCH, F_WF_ARTIFACT, /* found */
+ F_WF_UNDYNE1, /* Undyne seen from the tall grass */
+ F_SEEDS1, F_SEEDS2, F_SEEDS3, /* the bridges of bridge seeds, made */
+ F_CHASE1, /* Undyne's first chase, over */
+ F_WF_TELESCOPE,
+ F_WF_ONION, /* 1 met, 2 parted */
+ F_PIANO, /* its song played: the door is open */
+ F_UMBRELLA, /* 1 carried, 2 left with the statue */
+ F_MK_RAIN, /* Monster Kid walked with Frisk in the rain */
+ F_SHYREN, /* 1 spared, 2 killed */
+ F_WF_BRIDGE, /* the bridge cut: Frisk fell */
+ F_KILLS_WATERFALL,
+ F_WF_BIRD,
FLAG_COUNT = 256
};
#endif
diff --git a/games/undertale/src/items.c b/games/undertale/src/items.c
index ee0241da..4302e410 100644
--- a/games/undertale/src/items.c
+++ b/games/undertale/src/items.c
@@ -34,6 +34,14 @@ static const ItemInfo items[ITEM_COUNT] = {
"* You ate the Unisicle.", 2},
[ITEM_CINNAMON_BUNNY] = {"Cinnamon Bunny", "CinnaBun", IT_FOOD, 22, 0, 0, "A cinnamon roll in the\n shape of a bunny.",
"* You eat the Cinnamon Bunny.", 8},
+ [ITEM_OLD_TUTU] = {"Old Tutu", "Old Tutu", IT_ARMOR, 0, 0, 10, "A dusty frilly skirt.\n* Still holds up well.", "", 80},
+ [ITEM_BALLET_SHOES] = {"Ballet Shoes", "BallShoes", IT_WEAPON, 0, 7, 0, "Worn dancing shoes.\n* Too big for you.", "", 80},
+ [ITEM_QUICHE] = {"Abandoned Quiche", "Quiche", IT_FOOD, 34, 0, 0, "A quiche someone left\n under a bench.",
+ "* You eat the quiche.", 76},
+ [ITEM_PUNCH_CARD] = {"Punch Card", "PunchCard", IT_SPECIAL, 0, 0, 0, "A card for a game nobody\n plays anymore.",
+ "* You look at the punch card.\n* It makes you want to punch\n something.", 15},
+ [ITEM_ARTIFACT] = {"Legendary Artifact", "Artifact", IT_SPECIAL, 0, 0, 0, "A mysterious orb.\n* It's a little heavy.",
+ "* You hold the orb up.\n* Nothing happens.", 0},
};
const ItemInfo *item_info(int id) { return &items[id >= 0 && id < ITEM_COUNT ? id : 0]; }
@@ -46,6 +54,7 @@ void item_info_text(int id, char *out, int cap) {
if (id == ITEM_BANDAGE) snprintf(out, (size_t)cap, "* \"%s\" - Heals %d HP\n* %s", it->name, it->heal, it->info);
else snprintf(out, (size_t)cap, "* \"%s\" - Armor DF %d\n* %s", it->name, it->df, it->info);
break;
+ case IT_SPECIAL: snprintf(out, (size_t)cap, "* \"%s\"\n* %s", it->name, it->info); break;
default:
if (it->heal >= 998) snprintf(out, (size_t)cap, "* \"%s\" - Heals ALL HP\n* %s", it->name, it->info);
else snprintf(out, (size_t)cap, "* \"%s\" - Heals %d HP\n* %s", it->name, it->heal, it->info);
@@ -92,6 +101,9 @@ void item_use(int slot, char *out, int cap, int in_battle) {
snprintf(out, (size_t)cap, "* You equipped the %s.", it->name);
return;
}
+ case IT_SPECIAL: /* looked at, kept */
+ snprintf(out, (size_t)cap, "%s", it->use);
+ return;
default: {
int n = snprintf(out, (size_t)cap, "%s", it->use);
if (id == ITEM_NICE_CREAM) { /* its wrapper's kind words */
diff --git a/games/undertale/src/items.h b/games/undertale/src/items.h
index 33abf15a..a2fd470e 100644
--- a/games/undertale/src/items.h
+++ b/games/undertale/src/items.h
@@ -22,6 +22,12 @@ enum {
ITEM_BISICLE,
ITEM_UNISICLE,
ITEM_CINNAMON_BUNNY,
+ /* Waterfall */
+ ITEM_OLD_TUTU,
+ ITEM_BALLET_SHOES,
+ ITEM_QUICHE,
+ ITEM_PUNCH_CARD,
+ ITEM_ARTIFACT,
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 01d2f3f7..97c29a61 100644
--- a/games/undertale/src/menu.c
+++ b/games/undertale/src/menu.c
@@ -368,7 +368,7 @@ void menu_gameover_open(void) {
void menu_end_open(void) {
g_mode = MODE_END;
t = 0;
- writer_start(&w, "Snowdin is behind you.|The rest of the underground\nis still to come...", 52, 100, FONT_MAIN);
+ writer_start(&w, "You fall into the dark below\nthe bridge...|The rest of Waterfall,\nand the underground beyond,\nare still to come...", 40, 90, FONT_MAIN);
w.speed = 2;
}
diff --git a/games/undertale/src/menu.h b/games/undertale/src/menu.h
index 08c3e1b7..28da811b 100644
--- a/games/undertale/src/menu.h
+++ b/games/undertale/src/menu.h
@@ -6,7 +6,7 @@ void menu_title_open(void);
void menu_open(void);
void menu_save_open(void);
void menu_gameover_open(void);
-void menu_end_open(void); /* the way out of Snowdin: what comes next isn't made yet */
+void menu_end_open(void); /* the fall from Waterfall's bridge: what comes next isn't made yet */
void menu_update(uint32_t keys, uint32_t pressed);
void menu_draw(void);
void game_new(const char *name);
diff --git a/games/undertale/src/monsters.h b/games/undertale/src/monsters.h
index 7820bf25..755879d1 100644
--- a/games/undertale/src/monsters.h
+++ b/games/undertale/src/monsters.h
@@ -8,7 +8,9 @@ enum {
MON_NAPSTABLOOK, MON_TORIEL, MON_FLOWEY, MON_RUINS_COUNT,
/* Snowdin (snowmon.c, papyrus.c) */
MON_SNOWDRAKE = MON_RUINS_COUNT, MON_ICECAP, MON_GYFTROT, MON_DOGGO, MON_LESSERDOG, MON_DOGAMY, MON_DOGARESSA,
- MON_GREATERDOG, MON_JERRY, MON_CHILLDRAKE, MON_GLYDE, MON_PAPYRUS, MON_COUNT
+ MON_GREATERDOG, MON_JERRY, MON_CHILLDRAKE, MON_GLYDE, MON_PAPYRUS, MON_SNOW_COUNT,
+ /* Waterfall (wfmon.c) */
+ MON_AARON = MON_SNOW_COUNT, MON_WOSHUA, MON_MOLDBYGG, MON_SHYREN, MON_COUNT
};
/* formations: who is fought */
@@ -19,7 +21,10 @@ enum {
/* Snowdin */
FORM_SNOWDRAKE = FORM_RUINS_COUNT, FORM_ICECAP, FORM_LESSERDOG, FORM_CHILLDRAKE, FORM_ICECAP_JERRY,
FORM_ICECAP_JERRY_SNOWDRAKE, FORM_ICECAP_JERRY_CHILLDRAKE, FORM_GYFTROT, FORM_GLYDE, FORM_DOGGO, FORM_DOGI,
- FORM_GREATERDOG, FORM_PAPYRUS, FORM_COUNT
+ FORM_GREATERDOG, FORM_PAPYRUS, FORM_SNOW_COUNT,
+ /* Waterfall */
+ FORM_AARON = FORM_SNOW_COUNT, FORM_WOSHUA, FORM_WOSHUA_AARON, FORM_MOLDBYGG, FORM_MOLDBYGG_MOLDSMAL,
+ FORM_MOLDBYGG_WOSHUA, FORM_SHYREN, FORM_COUNT
};
enum {
@@ -30,7 +35,10 @@ enum {
/* Snowdin */
ATK_DRAKE_ARCS = ATK_RUINS_COUNT, ATK_DRAKE_LINES, ATK_ICECAP_HATS, ATK_ICECAP_WAVES, ATK_GYFT_PRESENTS,
ATK_GYFT_SNOW, ATK_DOGGO_SWORD, ATK_LDOG_JUMP, ATK_LDOG_SPEARS, ATK_DOGI_AXES, ATK_DOGI_HEARTS, ATK_GDOG_SPEAR,
- ATK_GDOG_BARK, ATK_GLYDE_STARS, ATK_PAP_FIRST, ATK_PAP_LAST = ATK_PAP_FIRST + 24, ATK_COUNT
+ ATK_GDOG_BARK, ATK_GLYDE_STARS, ATK_PAP_FIRST, ATK_PAP_LAST = ATK_PAP_FIRST + 24, ATK_SNOW_COUNT,
+ /* Waterfall */
+ ATK_AARON_ARMS = ATK_SNOW_COUNT, ATK_AARON_SWEAT, ATK_WOSHUA_DROPS, ATK_WOSHUA_BUBBLES, ATK_MOLDBYGG_HOPS,
+ ATK_MOLDBYGG_RAIN, ATK_SHYREN_NOTES, ATK_COUNT
};
/* a formation: up to three monsters, and what the first turn says */
@@ -46,4 +54,9 @@ void snow_attack_run(struct Battle *b, int atk, int t);
void snow_attack_draw(struct Battle *b, int atk, int t);
int snow_attack_length(int atk);
int snow_encounter(int room); /* a random encounter's formation there, -1 none */
+const Form *wf_form(int form); /* wfmon.c */
+const struct MonDef *wf_mon_def(int id);
+void wf_attack_run(struct Battle *b, int atk, int t);
+int wf_attack_length(int atk);
+int wf_encounter(int room);
#endif
diff --git a/games/undertale/src/rooms.c b/games/undertale/src/rooms.c
index 2f8cf1f0..46a6c038 100644
--- a/games/undertale/src/rooms.c
+++ b/games/undertale/src/rooms.c
@@ -7,6 +7,7 @@
#include "monsters.h"
#include "ruins.h"
#include "snowdin.h"
+#include "waterfall.h"
#include "world.h"
void room_setup(int room, int from) {
@@ -16,6 +17,7 @@ void room_setup(int room, int from) {
snow1_setup(room, from);
snow2_setup(room, from);
town_setup(room, from);
+ wf1_setup(room, from);
}
/* each frame Frisk can walk: what a room watches (a rock on its switch, a cracked floor) */
@@ -23,6 +25,7 @@ void room_update(void) {
ruins2_update();
snow1_update();
snow2_update();
+ wf1_update();
}
/* what a room draws on its floor, under everything (world.c) */
@@ -31,6 +34,10 @@ void room_draw_floor(void) {
snow2_draw();
}
+/* a pushed rock that may go where Frisk can't (a bridge seed into the water), and what happens once it has */
+bool room_rock_enters(Obj *o, int x, int y) { return wf_seed_enters(o, x, y); }
+void room_rock_moved(Obj *o) { wf_seed_moved(o); }
+
bool room_ice(int x, int y) {
const RoomInfo *ri = world_room_info();
if (!ri || !ri->ice) return false;
@@ -67,8 +74,9 @@ void encounter_step(void) {
const Encounters *e = NULL;
for (unsigned i = 0; i < sizeof enc / sizeof enc[0]; i++)
if (enc[i].room == g_room) e = &enc[i];
- /* Snowdin's are snowmon.c's (who comes depends on what's happened) */
+ /* Snowdin's and Waterfall's are snowmon.c's and wfmon.c's (who comes depends on what's happened) */
int snow = e ? -1 : snow_encounter(g_room);
+ if (!e && snow < 0) snow = wf_encounter(g_room);
if (!e && snow < 0) return;
if (--steps_left > 0) return;
steps_left = 100 + rnd_n(200);
diff --git a/games/undertale/src/snowmon.c b/games/undertale/src/snowmon.c
index 1a7bbc40..f6d7e01c 100644
--- a/games/undertale/src/snowmon.c
+++ b/games/undertale/src/snowmon.c
@@ -510,7 +510,7 @@ static int attack_glyde(Battle *b, Monster *m) { (void)b, (void)m; return ATK_GL
/* ---------------------------------------------------------------- the table */
extern const MonDef papyrus_def; /* papyrus.c */
-static const MonDef snow_defs[MON_COUNT - MON_RUINS_COUNT] = {
+static const MonDef snow_defs[MON_SNOW_COUNT - MON_RUINS_COUNT] = {
[MON_SNOWDRAKE - MON_RUINS_COUNT] = {
.name = "Snowdrake", .spare_gold = 12, .hp = 74, .at = 6, .df = 2, .exp = 22, .gold = 18, .spr_idle = SPR_SNOWDRAKE_B,
.spr_hurt = SPR_SNOWDRAKE_HURT, .idle_speed = 8, .check = "This teen comedian fights to keep a captive audience.",
@@ -595,11 +595,12 @@ static const MonDef snow_defs[MON_COUNT - MON_RUINS_COUNT] = {
.act = act_glyde, .talk = talk_glyde, .attack = attack_glyde},
};
const MonDef *snow_mon_def(int id) {
+ if (id >= MON_SNOW_COUNT) return wf_mon_def(id);
if (id == MON_PAPYRUS) return &papyrus_def;
return &snow_defs[id - MON_RUINS_COUNT];
}
-static const Form snow_forms[FORM_COUNT - FORM_RUINS_COUNT] = {
+static const Form snow_forms[FORM_SNOW_COUNT - FORM_RUINS_COUNT] = {
[FORM_SNOWDRAKE - FORM_RUINS_COUNT] = {{MON_SNOWDRAKE}, 1, "* Snowdrake flutters forth!"},
[FORM_ICECAP - FORM_RUINS_COUNT] = {{MON_ICECAP}, 1, "* Icecap struts into view."},
[FORM_LESSERDOG - FORM_RUINS_COUNT] = {{MON_LESSERDOG}, 1, "* Lesser Dog appears."},
@@ -616,7 +617,7 @@ static const Form snow_forms[FORM_COUNT - FORM_RUINS_COUNT] = {
[FORM_GREATERDOG - FORM_RUINS_COUNT] = {{MON_GREATERDOG}, 1, "* It's the Greater Dog."},
[FORM_PAPYRUS - FORM_RUINS_COUNT] = {{MON_PAPYRUS}, 1, "* Papyrus blocks the way!"},
};
-const Form *snow_form(int form) { return &snow_forms[form - FORM_RUINS_COUNT]; }
+const Form *snow_form(int form) { return form >= FORM_SNOW_COUNT ? wf_form(form) : &snow_forms[form - FORM_RUINS_COUNT]; }
/* random encounters: the wiki's pools (no more of them once Papyrus is spared with no one killed here) */
int snow_encounter(int room) {
@@ -835,7 +836,7 @@ static void atk_glyde_stars(int t) {
}
}
-static const int16_t snow_lengths[ATK_COUNT - ATK_RUINS_COUNT] = {
+static const int16_t snow_lengths[ATK_SNOW_COUNT - ATK_RUINS_COUNT] = {
[ATK_DRAKE_ARCS - ATK_RUINS_COUNT] = 150, [ATK_DRAKE_LINES - ATK_RUINS_COUNT] = 150,
[ATK_ICECAP_HATS - ATK_RUINS_COUNT] = 150, [ATK_ICECAP_WAVES - ATK_RUINS_COUNT] = 180,
[ATK_GYFT_PRESENTS - ATK_RUINS_COUNT] = 170, [ATK_GYFT_SNOW - ATK_RUINS_COUNT] = 160,
@@ -849,6 +850,7 @@ void papyrus_attack(int atk, int t);
void papyrus_attack_draw(int atk, int t);
int snow_attack_length(int atk) {
+ if (atk >= ATK_SNOW_COUNT) return wf_attack_length(atk);
if (atk >= ATK_PAP_FIRST && atk <= ATK_PAP_LAST) return papyrus_attack_length(atk);
int n = snow_lengths[atk - ATK_RUINS_COUNT] ? snow_lengths[atk - ATK_RUINS_COUNT] : 150;
/* Jerry makes attacks 2 seconds longer */
@@ -858,6 +860,10 @@ int snow_attack_length(int atk) {
}
void snow_attack_run(Battle *b, int atk, int t) {
+ if (atk >= ATK_SNOW_COUNT) {
+ wf_attack_run(b, atk, t);
+ return;
+ }
(void)b;
if (t < 0) return;
switch (atk) {
diff --git a/games/undertale/src/snowtown.c b/games/undertale/src/snowtown.c
index ee327ff1..32770352 100644
--- a/games/undertale/src/snowtown.c
+++ b/games/undertale/src/snowtown.c
@@ -50,10 +50,6 @@ void town_setup(int room, int from) {
if (flag(F_PAPYRUS) == 1) {
Obj *p = obj_papyrus(2190, 1100, DIR_DOWN);
if (p) p->event = EV_PAP_HOUSE, p->flags |= OF_TALK;
- if (!flag(F_GRILLBYS)) {
- Obj *s = obj_sans(1290, 1104, DIR_DOWN);
- if (s) s->event = EV_GRILLBYS, s->flags |= OF_TALK;
- }
}
folk(1099, 1093, "* Hey, another kid!|* Someday I'll watch Undyne\n fight. She's the best!");
break;
@@ -125,7 +121,6 @@ void town_setup(int room, int from) {
break;
case ROOM_FOGROOM:
if (!flag(F_PAPYRUS)) obj_trigger(3290, 1030, 30, 150, EV_PAP_FIGHT, ACTOR_TRIGGER);
- obj_trigger(3596, 1040, 24, 140, EV_SNOW_END, ACTOR_TRIGGER2);
break;
}
}
@@ -261,7 +256,12 @@ static int ev_pap_date(Ev *c) {
static int ev_grillbys(Ev *c) {
EV_BEGIN;
- SAY(FACE_SANS, "* hey.\n* thanks for keeping my brother entertained.|* want to grab some lunch?@Sure@Not now");
+ /* (from his station in Waterfall) */
+ if (flag(F_GRILLBYS)) {
+ SAY(FACE_SANS, "* i'm on another break.\n* from my other break.");
+ return 1;
+ }
+ SAY(FACE_SANS, "* hey. i'm on break.\n* want to grab some food at grillby's?@Sure@Not now");
if (CHOICE() == 1) {
SAY(FACE_SANS, "* ok. maybe later.");
return 1;
@@ -271,17 +271,7 @@ static int ev_grillbys(Ev *c) {
SAY(FACE_SANS, "* here's a good seat.|* so, what'll it be?\n`2* fries or burger?@Fries@Burger");
SAY(FACE_SANS, "* nice.|* say... papyrus says a #Yflower#X talks to him sometimes.\n* gives him advice. weird, right?|* if you see a talking flower, tell me, ok?|`1* oh, and thanks for paying.");
set_flag(F_GRILLBYS, 1);
- FADE_TO(ROOM_SNOWTOWN, 1310, 1096, DIR_DOWN);
- EV_END;
-}
-
-static int ev_snow_end(Ev *c) {
- EV_BEGIN;
- /* on to Waterfall: not made yet */
- set_flag(F_SNOW_EXIT, 1);
- sv.room = (int16_t)g_room, sv.x = (int16_t)(pl.x - 20), sv.y = pl.y;
- save_write_auto();
- menu_end_open();
+ FADE_TO(ROOM_WF1, 880, 1458, DIR_DOWN);
EV_END;
}
@@ -306,7 +296,6 @@ int town_event(Ev *c) {
case EV_PAP_HOUSE: return ev_pap_house(c);
case EV_PAP_DATE: return ev_pap_date(c);
case EV_GRILLBYS: return ev_grillbys(c);
- case EV_SNOW_END: return ev_snow_end(c);
case EV_COUCH: return ev_couch(c);
}
return -1;
diff --git a/games/undertale/src/text.c b/games/undertale/src/text.c
index a41ede6e..7d5f91b0 100644
--- a/games/undertale/src/text.c
+++ b/games/undertale/src/text.c
@@ -287,6 +287,7 @@ void text_open_menu(const char *const *opts, int n) {
bool text_active(void) { return box_open; }
int text_choice(void) { return last_choice; }
+int text_menu_cols(void) { return menu_cols; }
int text_menu_sel(void) { return box_open && menu_opts ? menu_sel : box_open && box.choices && box.done ? 100 + box.choice : -1; }
void text_update(uint32_t pressed) {
diff --git a/games/undertale/src/text.h b/games/undertale/src/text.h
index d4c17127..96575db8 100644
--- a/games/undertale/src/text.h
+++ b/games/undertale/src/text.h
@@ -52,8 +52,9 @@ void text_update(uint32_t pressed);
void text_draw(void);
int text_choice(void); /* 0 or 1: the last choice made (a list's: its index, -1 Back) */
void text_open_menu(const char *const *opts, int n); /* a list of options in the box */
-void text_set_top(int top);
+void text_set_top(int top); /* -1: by where Frisk is (the game's way), 0 bottom, 1 top */
void text_wrap_width(int w); /* where the next writer's lines wrap (pixels from its left) */
-int text_menu_sel(void); /* (the tests) a list's selection, 100 + a page's choice, -1 neither open */ /* -1: by where Frisk is (the game's way), 0 bottom, 1 top */
+int text_menu_sel(void); /* (the tests) a list's selection, 100 + a page's choice, -1 neither open */
+int text_menu_cols(void); /* (the list open: its columns) */
extern char g_name[8]; /* the fallen human's name */
#endif
diff --git a/games/undertale/src/waterfall.h b/games/undertale/src/waterfall.h
new file mode 100644
index 00000000..6f50ab71
--- /dev/null
+++ b/games/undertale/src/waterfall.h
@@ -0,0 +1,11 @@
+/* Undertale: Waterfall (wf1.c: from Snowdin to the bridge Undyne cuts), its monsters (wfmon.c). */
+#ifndef UT_WATERFALL_H
+#define UT_WATERFALL_H
+#include "event.h"
+void wf1_setup(int room, int from);
+int wf1_event(Ev *c); /* -1: not one of its */
+void wf1_update(void);
+bool wf_seed_enters(Obj *o, int x, int y); /* a bridge seed pushed into the water */
+void wf_seed_moved(Obj *o);
+void wf_battle_done(int form);
+#endif
diff --git a/games/undertale/src/wf1.c b/games/undertale/src/wf1.c
new file mode 100644
index 00000000..c1565ef6
--- /dev/null
+++ b/games/undertale/src/wf1.c
@@ -0,0 +1,772 @@
+/* Waterfall, the west: from Snowdin to the bridge Undyne cuts. Monster Kid, the echo flowers, the stream's rocks,
+ * Papyrus's report to Undyne, the bridge seeds, the wishing room, Undyne's spears, Sans's telescope, Onionsan, the
+ * piano and its artifact, the statue in the rain, Monster Kid under the umbrella, and the bridge. (As the Undertale
+ * Wiki describes them; what they say is ours, in short.) */
+#include <stdio.h>
+#include <string.h>
+#include "battle.h"
+#include "event.h"
+#include "events.h"
+#include "game.h"
+#include "items.h"
+#include "menu.h"
+#include "monsters.h"
+#include "save.h"
+#include "snowdin.h"
+#include "waterfall.h"
+#include "world.h"
+
+static void gone(Obj *o) { o->kind = OBJ_NONE; }
+
+/* who walks about */
+static Obj *obj_mk(int x, int y, int dir) {
+ static const uint16_t s[4] = {SPR_MK_OW, SPR_MK_OW, SPR_MK_OW_L, SPR_MK_OW};
+ return obj_npc(ACTOR_MK, s, x, y, dir, 0);
+}
+static Obj *obj_undyne(int x, int y) {
+ static const uint16_t s[4] = {SPR_UNDYNE_OW, SPR_UNDYNE_OW, SPR_UNDYNE_OW, SPR_UNDYNE_OW};
+ Obj *o = obj_npc(ACTOR_UNDYNE, s, x, y, DIR_DOWN, 0);
+ if (o) o->flags &= (uint16_t)~OF_SOLID;
+ return o;
+}
+/* a thing to pick up: its item and the flag that says it's taken (and what's drawn of it, at (x, y)) */
+static void pickup(int x, int y, int w, int h, int item, int fl, uint16_t spr) {
+ if (flag(fl)) return;
+ Obj *o = obj_trigger(x, y, w, h, EV_WF_ITEM, ACTOR_ITEM);
+ if (o) o->flags = OF_TALK | OF_BACK, o->arg = (int16_t)item, o->arg2 = (int16_t)fl, o->spr[0] = spr;
+}
+
+/* ---------------------------------------------------------------- the bridge seeds */
+/* each puzzle: where its water is (the seeds bloom on it) and where its seeds start; solved, the blooms that
+ * stay */
+typedef struct {
+ int room;
+ int16_t wx, wy, ww, wh;
+ int16_t seeds[4][2];
+ int16_t blooms[4][2];
+ int fl;
+} Seeds;
+static const Seeds seed_puzzles[] = {
+ {ROOM_WF_SEEDS1, 2380, 1480, 80, 120, {{2300, 1440}, {2280, 1460}, {2300, 1460}, {2300, 1480}},
+ {{2380, 1500}, {2400, 1500}, {2420, 1500}, {2440, 1500}}, F_SEEDS1},
+ {ROOM_WF_SEEDS2, 2820, 1236, 84, 264, {{2960, 1340}, {2960, 1380}, {3000, 1340}, {3000, 1380}},
+ {{2860, 1260}, {2840, 1260}, {2820, 1260}, {2860, 1280}}, F_SEEDS2},
+};
+static const Seeds *seeds_here(void) {
+ for (unsigned i = 0; i < sizeof seed_puzzles / sizeof seed_puzzles[0]; i++)
+ if (seed_puzzles[i].room == g_room) return &seed_puzzles[i];
+ return NULL;
+}
+/* the quiche's secret: the water under the second puzzle's floor */
+#define SECRET_X 3036
+#define SECRET_Y 1536
+#define SECRET_W 84
+#define SECRET_H 24
+
+static Obj *bloom(int x, int y) {
+ Obj *o = obj_deco(SPR_BLOOM, x, y, false);
+ if (o) o->name = ACTOR_BLOOM, o->flags |= OF_FLOOR | OF_BACK, obj_set_box(o, 0, 0, 20, 20);
+ return o;
+}
+static void seeds_setup(const Seeds *s) {
+ for (int i = 0; i < 4; i++) {
+ if (flag(s->fl)) {
+ bloom(s->blooms[i][0], s->blooms[i][1]);
+ continue;
+ }
+ Obj *o = obj_rock(s->seeds[i][0], s->seeds[i][1], ACTOR_SEED, 0);
+ if (o) {
+ o->spr[0] = SPR_SEED;
+ obj_set_box(o, 2, 4, 16, 14);
+ }
+ }
+ if (g_room == ROOM_WF_SEEDS2 && flag(F_SEEDS3))
+ for (int i = 0; i < 4; i++) bloom(3040 + 20 * i, 1540);
+}
+/* water: in the puzzle's (or the secret's) rectangle, where there's no floor */
+static bool in_water(int x, int y, int ignore) {
+ const Seeds *s = seeds_here();
+ if (!s) return false;
+ bool in = (x >= s->wx && x < s->wx + s->ww && y >= s->wy && y < s->wy + s->wh) ||
+ (g_room == ROOM_WF_SEEDS2 && x >= SECRET_X && x < SECRET_X + SECRET_W && y >= SECRET_Y && y < SECRET_Y + SECRET_H);
+ return in && !world_walkable(x, y, 1, 1, ignore);
+}
+bool wf_seed_enters(Obj *o, int x, int y) {
+ if (o->name != ACTOR_SEED) return false;
+ /* the seed's box over water or floor (nothing solid in the way, but the seed itself) */
+ int me = (int)(o - objs), bx = x + o->bx, by = y + o->by;
+ for (int yy = by;; yy += 4) {
+ if (yy > by + o->bh - 1) yy = by + o->bh - 1;
+ for (int xx = bx;; xx += 4) {
+ if (xx > bx + o->bw - 1) xx = bx + o->bw - 1;
+ if (!in_water(xx, yy, me) && !world_walkable(xx, yy, 1, 1, me)) return false;
+ if (xx == bx + o->bw - 1) break;
+ }
+ if (yy == by + o->bh - 1) break;
+ }
+ return true;
+}
+/* pushed along one way, a seed eases onto the 20-pixel grid the other way (a pixel a push, where it's free), so
+ * it stays in line for the next push */
+static void seed_align(Obj *o) {
+ bool across = pl.dir == DIR_LEFT || pl.dir == DIR_RIGHT;
+ int v = across ? o->y : o->x, to = (v + 10) / 20 * 20;
+ if (v == to) return;
+ int nx = o->x + (across ? 0 : (to > v ? 1 : -1)), ny = o->y + (across ? (to > v ? 1 : -1) : 0);
+ if (world_walkable(nx + o->bx, ny + o->by, o->bw, o->bh, (int)(o - objs)) || wf_seed_enters(o, nx, ny))
+ o->x = (int16_t)nx, o->y = (int16_t)ny;
+}
+
+void wf_seed_moved(Obj *o) {
+ if (o->name != ACTOR_SEED) return;
+ seed_align(o);
+ /* mostly over the water (its edges are ragged): it blooms where its middle is, on the 20-pixel grid, and can be
+ * walked on (and pushed over) */
+ int me = (int)(o - objs), wet = 0;
+ for (int j = 0; j < 4; j++)
+ for (int i = 0; i < 4; i++) wet += in_water(o->x + o->bx + 2 + 4 * i, o->y + o->by + 1 + 4 * j, me);
+ if (wet < 9) return;
+ int cx = o->x + o->bx + o->bw / 2, cy = o->y + o->by + o->bh / 2;
+ gone(o);
+ bloom(cx / 20 * 20, cy / 20 * 20);
+}
+/* solved: the first, its four across the path; the second, Frisk on the far side; the secret, at the quiche */
+static void seeds_watch(void) {
+ if (g_room == ROOM_WF_SEEDS1 && !flag(F_SEEDS1)) {
+ int across = 0;
+ for (int i = 0; i < MAX_OBJS; i++)
+ if (objs[i].kind != OBJ_NONE && objs[i].name == ACTOR_BLOOM && objs[i].y >= 1480 && objs[i].y <= 1520) across++;
+ if (across >= 4) set_flag(F_SEEDS1, 1);
+ }
+ if (g_room == ROOM_WF_SEEDS2 && !flag(F_SEEDS2) && pl.x < 2800 && pl.y < 1300) set_flag(F_SEEDS2, 1);
+}
+
+/* ---------------------------------------------------------------- the stream's rocks */
+#define STREAM_X0 1184
+#define STREAM_X1 1336
+#define STREAM_Y0 1446
+#define STREAM_FALL 1622 /* Frisk's feet past it: over the falls */
+static int stream_t;
+static void stream_update(void) {
+ if (g_room != ROOM_WF_FALLS) return;
+ if (++stream_t % 34 == 0) {
+ Obj *d = obj_deco(SPR_DEBRIS, STREAM_X0 + 8 + rnd_n(STREAM_X1 - STREAM_X0 - 16), STREAM_Y0, false);
+ if (d) d->name = ACTOR_DEBRIS, obj_set_box(d, -8, -6, 16, 12);
+ }
+ int fx = pl.x + 3, fy = pl.y + 20;
+ for (int i = 0; i < MAX_OBJS; i++) {
+ Obj *d = &objs[i];
+ if (d->kind == OBJ_NONE || d->name != ACTOR_DEBRIS) continue;
+ d->y = (int16_t)(d->y + 2);
+ if (d->y > 1650) {
+ gone(d);
+ continue;
+ }
+ /* a rock carries Frisk down with it */
+ if (!event_running() && fx < d->x + 8 && fx + 14 > d->x - 8 && fy < d->y + 6 && fy + 9 > d->y - 6) pl.y = (int16_t)(pl.y + 2);
+ }
+ if (!event_running() && pl.y + 29 > STREAM_FALL && pl.x + 10 > STREAM_X0 && pl.x + 10 < STREAM_X1)
+ event_start(EV_WF_STREAM_FALL, NULL);
+}
+
+/* ---------------------------------------------------------------- Undyne's spears */
+/* a spear comes up where Frisk is going: a glint, then the spear; it hurts (never below 1 HP) */
+typedef struct {
+ int room, from_x, to_x; /* where the spears come */
+ int fl;
+} Chase;
+static const Chase chases[] = {{ROOM_WF_CHASE1, 4150, 6460, F_CHASE1}, {ROOM_WF_BRIDGE, 15600, 17380, F_WF_BRIDGE}};
+static int spear_t, hurt_t;
+static const Chase *chase_here(void) {
+ for (unsigned i = 0; i < sizeof chases / sizeof chases[0]; i++)
+ if (chases[i].room == g_room && !flag(chases[i].fl)) return &chases[i];
+ return NULL;
+}
+static void spears_update(void) {
+ const Chase *ch = chase_here();
+ if (!ch) return;
+ Obj *u = obj_find(ACTOR_UNDYNE);
+ if (pl.x < ch->from_x || pl.x > ch->to_x || event_running()) {
+ 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 */
+ 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)));
+ }
+ 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;
+ 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);
+ }
+ for (int i = 0; i < MAX_OBJS; i++) {
+ Obj *s = &objs[i];
+ if (s->kind == OBJ_NONE || s->name != ACTOR_SPEAR) continue;
+ s->arg++;
+ if (s->arg == 18) s->alpha = 255; /* (the glint, then it's out) */
+ if (s->arg > 40) {
+ gone(s);
+ continue;
+ }
+ if (s->arg >= 18 && !hurt_t && pl.x + 3 < s->x + 3 && pl.x + 17 > s->x - 3 && pl.y + 29 > s->y - 36 && pl.y + 20 < s->y) {
+ sv.hp = (int16_t)max_i(1, sv.hp - 3);
+ hurt_t = 40, g_shake = 6;
+ }
+ }
+ if (g_room == ROOM_WF_BRIDGE && pl.x >= ch->to_x - 4) event_start(EV_WF_BRIDGE_END, NULL);
+}
+
+/* ---------------------------------------------------------------- Monster Kid, along under the umbrella */
+#define TRAIL 32
+static int16_t trail[TRAIL][2];
+static int trail_at;
+static bool mk_follows;
+static void mk_update(void) {
+ if (!mk_follows) return;
+ Obj *mk = obj_find(ACTOR_MK);
+ if (!mk) return;
+ mk->flags &= (uint16_t)~OF_SOLID; /* (walking along behind, never in the way) */
+ if (pl.moving || !trail_at) {
+ trail[trail_at % TRAIL][0] = pl.x, trail[trail_at % TRAIL][1] = pl.y;
+ trail_at++;
+ }
+ if (trail_at < TRAIL) return;
+ const int16_t *p = trail[(trail_at - TRAIL + 4) % 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;
+}
+
+/* ---------------------------------------------------------------- Onionsan, along in the water */
+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()) {
+ int want = pl.x + 60;
+ if (o->x < want) o->x = (int16_t)(o->x + 1);
+ }
+ if (!event_running() && pl.x > 9500) event_start(EV_WF_ONION, NULL);
+}
+
+void wf1_update(void) {
+ if (world_room_info()->area != AREA_WATERFALL) return;
+ seeds_watch();
+ stream_update();
+ spears_update();
+ mk_update();
+ onion_update();
+}
+
+/* ---------------------------------------------------------------- the rooms */
+static void echo(int x, int y, const char *says) {
+ static char buf[8][120];
+ static int k;
+ snprintf(buf[k], sizeof buf[k], "* (The echo flower whispers.)|* %s", says);
+ obj_sign(x - 10, y - 14, 20, 40, buf[k]);
+ k = (k + 1) % 8;
+}
+
+void wf1_setup(int room, int from) {
+ (void)from;
+ if (room < ROOM_WF1 || room > ROOM_WF_BRIDGE) return;
+ mk_follows = false, trail_at = 0, spear_t = 0, hurt_t = 0;
+ switch (room) {
+ case ROOM_WF1:
+ set_flag(F_SNOW_EXIT, 1); /* (out of Snowdin) */
+ if (!flag(F_WF_MK)) {
+ obj_mk(731, 1531, DIR_LEFT);
+ obj_trigger(640, 1450, 20, 100, EV_WF_MK, ACTOR_TRIGGER);
+ }
+ obj_sign(718, 1376, 36, 48, "* Echo flowers repeat whatever they heard last.\n* Over and over and over...");
+ echo(769, 1423, "\"...is anybody listening?\"");
+ obj_save(814, 1430, "* (The sound of rushing water fills you with determination.)");
+ {
+ /* (the booth is the map's: talking reaches it from the path below) */
+ Obj *s = obj_trigger(856, 1440, 68, 30, EV_GRILLBYS, ACTOR_SANS);
+ if (s) s->flags = OF_TALK;
+ }
+ obj_sign(1084, 1452, 20, 20, "* (Waterfall ahead.\n* Mind the rocks in the stream.)");
+ {
+ Obj *b = obj_trigger(1112, 1452, 22, 22, EV_BOX, ACTOR_ITEM);
+ if (b) b->flags = OF_TALK | OF_SOLID;
+ }
+ break;
+ case ROOM_WF_FALLS:
+ stream_t = 0;
+ pickup(1240, 1240, 22, 24, ITEM_OLD_TUTU, F_WF_TUTU, SPR_TUTU);
+ break;
+ case ROOM_WF_FALLS_LOW:
+ echo(1450, 1700, "\"Is someone down there?\"");
+ obj_sign(1250, 1652, 20, 18, "* (Something small and shiny is tucked in the planks.\n* A camera?)");
+ break;
+ case ROOM_WF2:
+ obj_save(2035, 1485, "* (The rumbling of the falls fills you with determination.)");
+ if (!flag(F_WF_UNDYNE1)) obj_trigger(1770, 1496, 40, 44, EV_WF_UNDYNE1, ACTOR_TRIGGER);
+ break;
+ case ROOM_WF_SEEDS1:
+ obj_sign(2172, 1452, 20, 20, "* (Bridge seeds bloom when they touch the water.\n* Push them in, one after another.)");
+ seeds_setup(&seed_puzzles[0]);
+ break;
+ case ROOM_WF_SEEDS2:
+ obj_sign(2840, 1540, 20, 22, "* (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;
+ }
+ seeds_setup(&seed_puzzles[1]);
+ break;
+ case ROOM_WF_QUICHE:
+ /* (reached over the secret bridge: it stays, and leads back) */
+ set_flag(F_SEEDS3, 1);
+ for (int i = 0; i < 4; i++) bloom(3040 + 20 * i, 1540);
+ pickup(3262, 1474, 30, 34, ITEM_QUICHE, F_WF_QUICHE, 0);
+ echo(3330, 1463, "\"I'll wait here for a while.\"");
+ break;
+ case ROOM_WF_WISH:
+ obj_sign(2770, 990, 26, 16, "* (Old writing on the wall: people used to come here to wish on the \"stars\" above.)");
+ echo(2690, 1050, "\"I wish I could see the real sky...\"");
+ echo(2838, 1068, "\"Someday we'll all be free.\"");
+ echo(2928, 1050, "\"I hope my wish comes true.\"");
+ echo(2968, 1050, "\"Please, let me find a friend.\"");
+ echo(3288, 1050, "\"...thank you for listening.\"");
+ obj_sign(3122, 1060, 20, 26, "* (A telescope.\n* The \"stars\" are crystals on the cave's ceiling.)");
+ break;
+ case ROOM_WF_HIST:
+ obj_sign(3090, 486, 30, 16, "* (Long ago, humans and monsters lived side by side.)");
+ obj_sign(3170, 486, 30, 16, "* (Then a war broke out between them.\n* The humans won.)");
+ obj_sign(3250, 486, 30, 16, "* (The monsters were sealed under the mountain by a magic barrier.)");
+ obj_sign(3330, 486, 30, 16, "* (Only power as great as seven human SOULs could break it.)");
+ obj_sign(3410, 486, 30, 16, "* (Still, monsters hope.\n* One day, they will see the sky again.)");
+ {
+ static const uint16_t w[4] = {SPR_WOSHUA_OW, SPR_WOSHUA_OW, SPR_WOSHUA_OW, SPR_WOSHUA_OW};
+ Obj *o = obj_npc(ACTOR_ANY, w, 3454, 580, DIR_DOWN, EV_SIGN);
+ if (o) o->text = "* (Woshua is scrubbing the boardwalk.\n* It doesn't look up.)", o->flags |= OF_ANIM, o->anim_speed = 8;
+ }
+ break;
+ case ROOM_WF_CHASE1:
+ if (!flag(F_CHASE1)) obj_undyne(4180, 470);
+ break;
+ case ROOM_WF_GRASS1:
+ if (!flag(F_CHASE1)) obj_trigger(6640, 540, 30, 72, EV_WF_GRASS, ACTOR_TRIGGER);
+ echo(7219, 503, "\"...is it over? Is it gone?\"");
+ obj_save(7250, 540, "* (The crystals glitter. You're filled with determination.)");
+ obj_sign(7172, 500, 26, 24, "* (A mouse hole.\n* Something squeaks inside.)");
+ obj_sign(7490, 512, 24, 48, "* (The door is locked.)");
+ break;
+ case ROOM_WF_SANS2: {
+ /* (the telescope, the Nice Cream cart, the box are the map's: talked to from the floor beside them) */
+ Obj *t = obj_trigger(7843, 520, 62, 36, EV_WF_TELESCOPE, ACTOR_SANS);
+ if (t) t->flags = OF_TALK | OF_SOLID;
+ Obj *n = obj_trigger(7876, 96, 70, 50, EV_NICECREAM, ACTOR_ITEM);
+ if (n) n->flags = OF_TALK | OF_SOLID;
+ Obj *b = obj_trigger(7928, 540, 26, 22, EV_BOX, ACTOR_ITEM);
+ if (b) b->flags = OF_TALK | OF_SOLID;
+ pickup(8048, 118, 24, 42, ITEM_PUNCH_CARD, F_WF_PUNCH, 0);
+ Obj *m = obj_sign(8074, 554, 18, 12, "* (It's gazing up at the glittering ceiling.)\n* (It doesn't notice you.)");
+ if (m) m->flags |= OF_SOLID;
+ break;
+ }
+ case ROOM_WF_MARSH_TOP: {
+ /* the bird at the boardwalk's end, and (unseen) on the far side for the way back */
+ Obj *b = obj_trigger(8462, 574, 22, 26, EV_WF_BIRD, ACTOR_ANY);
+ if (b) b->flags = OF_TALK | OF_SOLID;
+ Obj *r = obj_trigger(8536, 556, 8, 44, EV_WF_BIRD, ACTOR_ANY);
+ if (r) r->flags = OF_TALK, r->arg = 1;
+ break;
+ }
+ case ROOM_WF_MARSH:
+ pickup(7578, 1230, 30, 30, ITEM_BALLET_SHOES, F_WF_BALLET, 0);
+ {
+ Obj *h = obj_sign(8826, 812, 50, 26, "* (The humans were afraid of how strong a monster's SOUL might become.)");
+ if (h) h->flags |= OF_SOLID;
+ }
+ echo(8449, 1098, "\"Splish... splash...\"");
+ echo(8449, 1228, "\"Is the water getting higher?\"");
+ echo(8719, 1177, "\"Hello? Hello?\"");
+ break;
+ case ROOM_WF_ONION:
+ if (flag(F_WF_ONION) < 2) {
+ static const uint16_t o[4] = {SPR_ONIONSAN, SPR_ONIONSAN, SPR_ONIONSAN, SPR_ONIONSAN};
+ Obj *on = obj_npc(ACTOR_ONION, o, 8900, 650, DIR_DOWN, 0);
+ if (on) on->flags = OF_BACK, on->alpha = flag(F_WF_ONION) ? 255 : 0;
+ if (!flag(F_WF_ONION)) obj_trigger(8780, 560, 20, 100, EV_WF_ONION, ACTOR_TRIGGER);
+ }
+ break;
+ case ROOM_WF_PIANO: {
+ Obj *p = obj_trigger(10052, 404, 44, 26, EV_PIANO, ACTOR_ITEM);
+ if (p) p->flags = OF_TALK | OF_SOLID;
+ obj_sign(10194, 374, 30, 16, "* (A sign: \"Play the song of the rain.\")");
+ if (!flag(F_PIANO)) {
+ 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);
+ 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.)");
+ if (!flag(F_SHYREN)) {
+ static const uint16_t s[4] = {SPR_SHYREN_OW, SPR_SHYREN_OW, SPR_SHYREN_OW, SPR_SHYREN_OW};
+ obj_npc(ACTOR_SHYREN, s, 10147, 660, DIR_DOWN, EV_SHYREN);
+ }
+ break;
+ }
+ case ROOM_WF_STATUE: {
+ Obj *st = obj_trigger(10744, 618, 52, 42, EV_STATUE, ACTOR_ITEM);
+ if (st) st->flags = OF_TALK | OF_SOLID;
+ obj_sign(11050, 636, 22, 26, "* (Umbrellas: take one, leave one.)");
+ Obj *u = obj_trigger(11146, 630, 28, 30, EV_UMBRELLA, ACTOR_ITEM);
+ if (u) u->flags = OF_TALK | OF_SOLID;
+ break;
+ }
+ case ROOM_WF_RAIN1:
+ if (!flag(F_MK_RAIN)) {
+ obj_mk(11911, 648, DIR_DOWN);
+ obj_trigger(11880, 660, 60, 80, EV_MK_RAIN, ACTOR_TRIGGER);
+ }
+ break;
+ case ROOM_WF_RAIN2: case ROOM_WF_CASTLE:
+ if (flag(F_MK_RAIN) == 1) {
+ obj_mk(pl.x + 10, pl.y + 29, DIR_DOWN);
+ mk_follows = true;
+ if (room == ROOM_WF_RAIN2) obj_trigger(12740, 1300, 60, 20, EV_MK_TALK, ACTOR_TRIGGER2);
+ else obj_trigger(13600, 1660, 20, 70, EV_MK_TALK, ACTOR_TRIGGER3);
+ }
+ break;
+ case ROOM_WF_AARON:
+ if (flag(F_MK_RAIN) == 1) {
+ obj_mk(pl.x + 10, pl.y + 29, DIR_DOWN);
+ mk_follows = true;
+ obj_trigger(14700, 1660, 20, 70, EV_MK_TALK, ACTOR_TRIGGER);
+ }
+ {
+ static const uint16_t a[4] = {SPR_AARON_OW, SPR_AARON_OW, SPR_AARON_OW, SPR_AARON_OW};
+ Obj *o = obj_npc(ACTOR_ANY, a, 14504, 1682, DIR_DOWN, EV_SIGN);
+ if (o) o->text = "* Hey there, small fry ;)\n* Want to see me flex? ;)";
+ }
+ obj_save(15140, 1640, "* (The bridge ahead looks long.\n* You're filled with determination.)");
+ obj_sign(15070, 1590, 30, 16, "* (A human and a monster may cross the barrier... but none ever has.)");
+ obj_sign(15210, 1590, 30, 16, "* (The king vowed to break the barrier, and set us all free.)");
+ break;
+ case ROOM_WF_BRIDGE:
+ if (!flag(F_WF_BRIDGE)) obj_undyne(15500, 1820);
+ break;
+ }
+}
+
+/* ---------------------------------------------------------------- the events */
+static int ev_wf_mk(Ev *c) {
+ Obj *mk = obj_get(ACTOR_MK);
+ EV_BEGIN;
+ pl.dir = DIR_RIGHT;
+ NARRATE("* Yo! Are you going to see Undyne too?|* She's the head of the Royal Guard!\n* She's SO cool!|* Come on, let's go!");
+ set_flag(F_WF_MK, 1);
+ WALK(mk, 1180, 1496, 4);
+ gone(mk);
+ if (c->self) gone(c->self);
+ EV_END;
+}
+
+static int ev_wf_item(Ev *c) {
+ int item = c->self ? c->self->arg : 0, fl = c->self ? c->self->arg2 : 0;
+ static char buf[120];
+ EV_BEGIN;
+ if (!item_add(item)) {
+ NARRATE("* (You're carrying too much.)");
+ return 1;
+ }
+ set_flag(fl, 1);
+ snprintf(buf, sizeof buf, "* (You got the %s.)", item_info(item)->name);
+ NARRATE(buf);
+ if (c->self) gone(c->self);
+ EV_END;
+}
+
+static int ev_stream_fall(Ev *c) {
+ EV_BEGIN;
+ NARRATE("* (The current sweeps you over the edge!)");
+ FADE_TO(ROOM_WF_FALLS_LOW, 1252, 1640, DIR_DOWN);
+ EV_END;
+}
+
+static int ev_wf_undyne1(Ev *c) {
+ Obj *p = obj_get(ACTOR_PAPYRUS), *u = obj_get(ACTOR_UNDYNE), *mk = obj_get(ACTOR_MK);
+ EV_BEGIN;
+ /* hidden in the tall grass, Frisk hears Papyrus report to Undyne on the ledge above */
+ PL_WALK(1820, 1500, 2);
+ p = obj_papyrus(1770, 1396, DIR_RIGHT);
+ obj_undyne(1822, 1396);
+ WAIT_UNTIL(cam_pan(1640, 1300, 2));
+ WAIT(50);
+ SAY(FACE_PAPYRUS, "`0* H-HI, UNDYNE!\n* I'M HERE WITH MY REPORT!|* THAT HUMAN I TOLD YOU ABOUT...\n* I FOUGHT THEM...|`4* ...AND I, UM, DIDN'T WIN.|`3* WHAT? YOU'LL CAPTURE THEM YOURSELF?|`4* BUT, UNDYNE...|* ...|`0* ...OKAY. I'LL HELP YOU.");
+ WALK(p, 1680, 1396, 2);
+ gone(p);
+ /* she looks down into the grass, right at Frisk */
+ WAIT(40);
+ g_shake = 4;
+ NARRATE("* (Undyne stares into the grass...)");
+ WAIT(40);
+ u = obj_get(ACTOR_UNDYNE);
+ WALK(u, 1900, 1396, 1);
+ gone(u);
+ cam_free();
+ if (flag(F_WF_MK)) {
+ obj_mk(1840, 1530, DIR_LEFT);
+ NARRATE("* Yo! Did you see that?!\n* She was looking right at you!|* That's so awesome!!");
+ mk = obj_get(ACTOR_MK);
+ WALK(mk, 2120, 1520, 4);
+ gone(mk);
+ }
+ set_flag(F_WF_UNDYNE1, 1);
+ if (c->self) gone(c->self);
+ EV_END;
+}
+
+static int ev_bell(Ev *c) {
+ EV_BEGIN;
+ NARRATE("* (Ding!)\n* (The seeds float back where they came from.)");
+ for (int i = 0; i < MAX_OBJS; i++)
+ if (objs[i].kind != OBJ_NONE && (objs[i].name == ACTOR_SEED || objs[i].name == ACTOR_BLOOM)) gone(&objs[i]);
+ set_flag(F_SEEDS2, 0);
+ seeds_setup(&seed_puzzles[1]);
+ EV_END;
+}
+
+static int ev_wf_grass(Ev *c) {
+ Obj *u = obj_get(ACTOR_UNDYNE), *mk = obj_get(ACTOR_MK);
+ EV_BEGIN;
+ /* the end of the first chase: Frisk ducks into the grass; Undyne reaches in... and pulls out Monster Kid */
+ PL_WALK(6700, 560, 3);
+ pl.hidden = true;
+ u = obj_undyne(6580, 520);
+ WALK(u, 6690, 540, 2);
+ WAIT(30);
+ g_shake = 6;
+ NARRATE("* (Undyne reaches into the grass...)");
+ if (flag(F_WF_MK)) {
+ obj_mk(6700, 540, DIR_DOWN);
+ WAIT(30);
+ NARRATE("* (...and pulls out Monster Kid.)");
+ WAIT(20);
+ NARRATE("* (She drops him, and walks away.)");
+ }
+ u = obj_get(ACTOR_UNDYNE);
+ WALK(u, 6560, 520, 2);
+ gone(u);
+ pl.hidden = false;
+ if (flag(F_WF_MK)) {
+ NARRATE("* Yo! She almost got you!\n* ...wait, why WAS she after you?|* Never mind! Let's keep going!");
+ mk = obj_get(ACTOR_MK);
+ WALK(mk, 6900, 580, 4);
+ gone(mk);
+ }
+ set_flag(F_CHASE1, 1);
+ if (c->self) gone(c->self);
+ EV_END;
+}
+
+static int ev_wf_telescope(Ev *c) {
+ EV_BEGIN;
+ if (!flag(F_WF_TELESCOPE)) {
+ SAY(FACE_SANS, "* hey. want to look through my telescope?\n* for you, it's free.@Sure@No thanks");
+ if (CHOICE() == 1) {
+ SAY(FACE_SANS, "* suit yourself.");
+ return 1;
+ }
+ NARRATE("* (You look through the telescope.)\n* (It's very dark...)");
+ set_flag(F_WF_TELESCOPE, 1);
+ SAY(FACE_SANS, "`1* heh. you've got a red ring around your eye now.");
+ } else {
+ SAY(FACE_SANS, "* how was the view?");
+ }
+ EV_END;
+}
+
+static int ev_wf_bird(Ev *c) {
+ EV_BEGIN;
+ c->v[1] = c->self ? c->self->arg : 0;
+ NARRATE(c->v[1] ? "* (The little bird offers to carry you back.)@Yes@No"
+ : "* (A little bird offers to carry you over the gap.)@Yes@No");
+ if (CHOICE() == 0) {
+ if (c->v[1]) FADE_TO(ROOM_WF_MARSH_TOP, 8440, 562, DIR_LEFT);
+ else FADE_TO(ROOM_WF_MARSH_TOP, 8552, 562, DIR_RIGHT);
+ set_flag(F_WF_BIRD, 1);
+ }
+ EV_END;
+}
+
+static int ev_wf_onion(Ev *c) {
+ Obj *o = obj_get(ACTOR_ONION);
+ EV_BEGIN;
+ if (!flag(F_WF_ONION)) {
+ /* up from the water, a huge friendly face */
+ o->x = (int16_t)(pl.x + 60);
+ for (c->v[0] = 0; c->v[0] < 16; c->v[0]++) {
+ o->alpha = (uint8_t)(c->v[0] * 16);
+ WAIT(2);
+ }
+ o->alpha = 255;
+ NARRATE("* Hey there... you're new around here, huh?|* I'm Onionsan!\n* I live in this big, big water.|* Let's walk together a while!");
+ set_flag(F_WF_ONION, 1);
+ if (c->self) gone(c->self);
+ return 1;
+ }
+ NARRATE("* Someday they'll drain all this water...|* Then I'll live somewhere else.\n* Somewhere nice!|* See you!");
+ for (c->v[0] = 16; c->v[0] > 0; c->v[0]--) {
+ o->alpha = (uint8_t)(c->v[0] * 15);
+ WAIT(2);
+ }
+ gone(o);
+ set_flag(F_WF_ONION, 2);
+ 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};
+static uint8_t played[7];
+static int ev_piano(Ev *c) {
+ EV_BEGIN;
+ if (flag(F_PIANO)) {
+ NARRATE("* (The piano rings softly.)");
+ return 1;
+ }
+ NARRATE("* (Play the piano?)@Yes@No");
+ if (CHOICE() == 1) return 1;
+ memset(played, 0xFF, sizeof played);
+ for (;;) {
+ CHOOSE(notes, 6);
+ if (CHOSEN() < 0 || CHOSEN() == 5) break;
+ memmove(played, played + 1, 6);
+ played[6] = (uint8_t)CHOSEN();
+ if (!memcmp(played, song, 7)) {
+ set_flag(F_PIANO, 1);
+ for (int i = 0; i < MAX_OBJS; i++)
+ if (objs[i].kind != OBJ_NONE && objs[i].name == ACTOR_BLOCK) gone(&objs[i]);
+ g_shake = 6;
+ NARRATE("* (Somewhere, a door rumbles open.)");
+ break;
+ }
+ }
+ EV_END;
+}
+
+static int ev_shyren(Ev *c) {
+ EV_BEGIN;
+ NARRATE("* (She's humming to herself... she hasn't noticed you.)");
+ BATTLE(FORM_SHYREN);
+ set_flag(F_SHYREN, bt.mon[0].killed ? 2 : 1);
+ gone(obj_get(ACTOR_SHYREN));
+ EV_END;
+}
+
+/* the umbrella (F_UMBRELLA): 1 carried, 2 left with the statue, 3 left there and another carried */
+static bool carrying_umbrella(void) { return flag(F_UMBRELLA) == 1 || flag(F_UMBRELLA) == 3; }
+
+static int ev_statue(Ev *c) {
+ EV_BEGIN;
+ if (flag(F_UMBRELLA) >= 2) {
+ NARRATE("* (The music box plays a gentle song under the umbrella.)");
+ } else if (flag(F_UMBRELLA) == 1) {
+ NARRATE("* (A statue, out in the rain.)\n* (Give it your umbrella?)@Yes@No");
+ if (CHOICE() == 0) {
+ set_flag(F_UMBRELLA, 2);
+ NARRATE("* (You hold the umbrella over the statue.)|* (A music box inside starts to play.)");
+ }
+ } else {
+ NARRATE("* (A statue, out in the rain.)\n* (It looks lonely.)");
+ }
+ EV_END;
+}
+
+static int ev_umbrella(Ev *c) {
+ EV_BEGIN;
+ if (carrying_umbrella()) {
+ NARRATE("* (Umbrellas.)");
+ } else {
+ set_flag(F_UMBRELLA, flag(F_UMBRELLA) ? 3 : 1);
+ NARRATE("* (You took an umbrella.)");
+ }
+ EV_END;
+}
+
+static int ev_mk_rain(Ev *c) {
+ EV_BEGIN;
+ if (!carrying_umbrella()) {
+ NARRATE("* Yo... it's really pouring.|* If only I had an umbrella...");
+ PL_WALK(pl.x - 20, pl.y, 2);
+ return 1;
+ }
+ NARRATE("* Yo! An umbrella!|* Can I walk under it with you? I don't have arms to hold one.|* Thanks, dude!");
+ set_flag(F_MK_RAIN, 1);
+ mk_follows = true, trail_at = 0;
+ if (c->self) gone(c->self);
+ EV_END;
+}
+
+/* what Monster Kid says on the way: down the slope, the castle, the parting */
+static int ev_mk_talk(Ev *c) {
+ int k = c->self ? c->self->name : 0;
+ EV_BEGIN;
+ if (k == ACTOR_TRIGGER2) {
+ NARRATE("* Undyne's so strong... she beats up the bad guys and never loses!|* Someday I'll be just like her.");
+ } else if (k == ACTOR_TRIGGER3) {
+ NARRATE("* Whoa, look!\n* That's the king's castle, way out there!");
+ } else {
+ NARRATE("* Yo, this is where I live.\n* I gotta go home.|* See you later, dude!");
+ set_flag(F_MK_RAIN, 2);
+ mk_follows = false;
+ {
+ Obj *mk = obj_get(ACTOR_MK);
+ WALK_TO(mk, 14300, 1700, 4);
+ }
+ WAIT(40);
+ gone(obj_get(ACTOR_MK));
+ }
+ if (c->self) gone(c->self);
+ EV_END;
+}
+
+static int ev_bridge_end(Ev *c) {
+ EV_BEGIN;
+ obj_undyne(pl.x - 60, pl.y + 30);
+ NARRATE("* (Undyne raises her spear...)");
+ g_shake = 12;
+ WAIT(30);
+ NARRATE("* (...and cuts the bridge from under you!)");
+ set_flag(F_WF_BRIDGE, 1);
+ sv.room = (int16_t)g_room, sv.x = (int16_t)(pl.x - 40), sv.y = pl.y;
+ save_write_auto();
+ menu_end_open();
+ EV_END;
+}
+
+int wf1_event(Ev *c) {
+ switch (c->id) {
+ case EV_WF_MK: return ev_wf_mk(c);
+ case EV_WF_ITEM: return ev_wf_item(c);
+ case EV_WF_STREAM_FALL: return ev_stream_fall(c);
+ case EV_WF_UNDYNE1: return ev_wf_undyne1(c);
+ case EV_BELL: return ev_bell(c);
+ case EV_WF_GRASS: return ev_wf_grass(c);
+ case EV_WF_TELESCOPE: return ev_wf_telescope(c);
+ case EV_WF_BIRD: return ev_wf_bird(c);
+ case EV_WF_ONION: return ev_wf_onion(c);
+ case EV_PIANO: return ev_piano(c);
+ case EV_SHYREN: return ev_shyren(c);
+ case EV_STATUE: return ev_statue(c);
+ case EV_UMBRELLA: return ev_umbrella(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);
+ }
+ return -1;
+}
+
+void wf_battle_done(int form) {
+ (void)form;
+ for (int i = 0; i < bt.nmon; i++)
+ if (bt.mon[i].killed) set_flag(F_KILLS_WATERFALL, flag(F_KILLS_WATERFALL) + 1);
+}
diff --git a/games/undertale/src/wfmon.c b/games/undertale/src/wfmon.c
new file mode 100644
index 00000000..86b3b28d
--- /dev/null
+++ b/games/undertale/src/wfmon.c
@@ -0,0 +1,284 @@
+/* Waterfall's monsters: stats and ACTs (from the Undertale Wiki's records of the game), their formations, where
+ * they come out and their attacks. Their words are short ones of our own. */
+#include <stdio.h>
+#include <string.h>
+#include "battle.h"
+#include "game.h"
+#include "gfx.h"
+#include "monsters.h"
+#include "res.h"
+#include "world.h"
+
+/* ---------------------------------------------------------------- Aaron: flex three times and he flexes away */
+static void act_aaron(Battle *b, Monster *m, int act, char *t, int cap) {
+ (void)b;
+ if (act == 0) { /* Flex */
+ m->state++;
+ m->at = (int16_t)(m->at + 1);
+ if (m->state == 1) snprintf(t, (size_t)cap, "* You flex at Aaron.\n* He takes it as a challenge and flexes back!");
+ else if (m->state == 2) snprintf(t, (size_t)cap, "* You flex harder.\n* Aaron flexes harder still!");
+ else {
+ snprintf(t, (size_t)cap, "* You flex with everything you've got.\n* Aaron flexes so hard he flexes himself out of the room.");
+ m->gone = true, m->fade = 1, m->spare = true;
+ }
+ } else { /* Shoo */
+ snprintf(t, (size_t)cap, "* You tell Aaron to go away.\n* He just flexes at you.");
+ }
+}
+static const char *talk_aaron(Battle *b, Monster *m) {
+ (void)b;
+ static const char *const lines[] = {"Check out\nthese fins\n;)", "Feeling the\nburn?\n;)", "Don't be\nshy ;)",
+ "Want a\ncloser look?\n;)"};
+ if (m->state == 1) return "Oh, a\ncontest?\n;)";
+ if (m->state == 2) return "You're\ngood...\n;)";
+ return lines[rnd_n(4)];
+}
+static int attack_aaron(Battle *b, Monster *m) { (void)b, (void)m; return rnd_n(2) ? ATK_AARON_ARMS : ATK_AARON_SWEAT; }
+
+/* ---------------------------------------------------------------- Woshua: ask to be cleaned, catch its green */
+static void act_woshua(Battle *b, Monster *m, int act, char *t, int cap) {
+ (void)b;
+ if (act == 0) { /* Clean */
+ snprintf(t, (size_t)cap, "* You ask Woshua to clean you.\n* It gets very excited.");
+ if (!m->state) m->state = 1;
+ } else if (act == 1) { /* Touch */
+ if (m->spare) snprintf(t, (size_t)cap, "* You give Woshua a friendly pat.\n* It wobbles happily.");
+ else snprintf(t, (size_t)cap, "* Woshua won't let you touch it.\n* You're not clean enough!");
+ } else { /* Joke */
+ snprintf(t, (size_t)cap, "* You tell a dirty joke.\n* Woshua is horrified.");
+ }
+}
+static const char *talk_woshua(Battle *b, Monster *m) {
+ (void)b;
+ static const char *const lines[] = {"Scrub\nscrub!", "Germs,\nbegone!", "Wash! Rinse!\nRepeat!", "Too\ndirty!"};
+ if (m->state == 1) return "Hold\nstill!\nWashing!";
+ if (m->state == 2) return "Squeaky\nclean!";
+ return lines[rnd_n(4)];
+}
+static const char *flavor_woshua(Battle *b, Monster *m) {
+ (void)b;
+ if (m->state == 1) return "* Woshua's water looks clean and green.";
+ if (m->state == 2) return "* Woshua is proud of how clean you are.";
+ return NULL;
+}
+static int attack_woshua(Battle *b, Monster *m) {
+ (void)b;
+ if (m->state == 1) m->state2 = (int16_t)b->greens; /* (what it had healed before this one) */
+ return m->state == 1 || rnd_n(2) ? ATK_WOSHUA_DROPS : ATK_WOSHUA_BUBBLES;
+}
+
+/* ---------------------------------------------------------------- Moldbygg: let go of it */
+static void act_moldbygg(Battle *b, Monster *m, int act, char *t, int cap) {
+ if (act == 0) { /* Hug */
+ snprintf(t, (size_t)cap, "* You hug Moldbygg.\n* You're covered in slime...\n* You feel slower.");
+ if (b->speed > FX) b->speed -= FX / 2;
+ m->state = 1;
+ } else if (act == 1) { /* Lie Down */
+ snprintf(t, (size_t)cap, "* You lie down next to Moldbygg.\n* It's surprisingly comfy.");
+ } else { /* Unhug */
+ snprintf(t, (size_t)cap, m->state == 1 ? "* You let go of Moldbygg.\n* It seems relieved." : "* You give Moldbygg some room.\n* It seems relieved.");
+ m->spare = true, m->state = 2;
+ }
+}
+static const char *talk_moldbygg(Battle *b, Monster *m) {
+ (void)b, (void)m;
+ static const char *const lines[] = {"Burble...", "*squish*", "Blub\nblub.", "(wiggle)"};
+ return lines[rnd_n(4)];
+}
+static int attack_moldbygg(Battle *b, Monster *m) { (void)b, (void)m; return rnd_n(2) ? ATK_MOLDBYGG_HOPS : ATK_MOLDBYGG_RAIN; }
+
+/* ---------------------------------------------------------------- Shyren: hum, and she sings */
+static void act_shyren(Battle *b, Monster *m, int act, char *t, int cap) {
+ (void)b;
+ if (act == 1) { /* Hum */
+ m->state++;
+ m->spare = true;
+ if (m->state >= 5) {
+ snprintf(t, (size_t)cap, "* You hum along.\n* Shyren's song fills the whole cave.\n* She swims off, happy.");
+ m->gone = true, m->fade = 1;
+ } else if (m->state == 1) snprintf(t, (size_t)cap, "* You hum a little tune.\n* Shyren hums along, very quietly.");
+ else snprintf(t, (size_t)cap, "* You hum again.\n* Shyren sings a little louder!");
+ } else if (act == 0) { /* Smile */
+ snprintf(t, (size_t)cap, "* You smile at Shyren.\n* She gets even shyer.");
+ } else { /* Conduct */
+ snprintf(t, (size_t)cap, m->state ? "* You conduct.\n* Shyren follows your hands!" : "* You wave your arms about.\n* Shyren doesn't know the tune yet.");
+ }
+}
+static const char *talk_shyren(Battle *b, Monster *m) {
+ (void)b;
+ if (m->state >= 3) return "La la\nLAAA!";
+ if (m->state) return "La...?";
+ static const char *const lines[] = {"...hm...", "(blub)", "..."};
+ return lines[rnd_n(3)];
+}
+static int attack_shyren(Battle *b, Monster *m) { (void)b, (void)m; return ATK_SHYREN_NOTES; }
+
+static const MonDef wf_defs[MON_COUNT - MON_SNOW_COUNT] = {
+ [MON_AARON - MON_SNOW_COUNT] = {
+ .name = "Aaron", .spare_gold = 30, .hp = 98, .at = 7, .df = 2, .exp = 52, .gold = 30, .spr_idle = SPR_AARON_B,
+ .spr_hurt = SPR_AARON_HURT, .check = "All muscle, and he knows it.", .acts = {"Flex", "Shoo"}, .nacts = 2,
+ .neutral = {"* Aaron is flexing.", "* Aaron winks at nobody in particular.", "* Smells like protein powder."},
+ .low_hp = "* Aaron's muscles are tired.", .act = act_aaron, .talk = talk_aaron, .attack = attack_aaron},
+ [MON_WOSHUA - MON_SNOW_COUNT] = {
+ .name = "Woshua", .spare_gold = 25, .hp = 70, .at = 7, .df = 1, .exp = 52, .gold = 25, .spr_idle = SPR_WOSHUA_B,
+ .spr_hurt = SPR_WOSHUA_HURT, .idle_speed = 8, .check = "Can't stand a single speck of dirt.",
+ .acts = {"Clean", "Touch", "Joke"}, .nacts = 3,
+ .neutral = {"* Woshua is scrubbing the air.", "* Woshua hums a washing song.", "* Smells like soap."},
+ .low_hp = "* Woshua's water is running low.", .act = act_woshua, .talk = talk_woshua, .attack = attack_woshua,
+ .flavor = flavor_woshua},
+ [MON_MOLDBYGG - MON_SNOW_COUNT] = {
+ .name = "Moldbygg", .spare_gold = 20, .hp = 70, .at = 7, .df = 4, .exp = 46, .gold = 20, .spr_idle = SPR_MOLDBYGG_B,
+ .spr_hurt = SPR_MOLDBYGG_B, .idle_speed = 8, .check = "Like Moldsmal, only a lot bigger.",
+ .acts = {"Hug", "Lie Down", "Unhug"}, .nacts = 3,
+ .neutral = {"* Moldbygg burbles.", "* Moldbygg wobbles.", "* Smells like a damp basement."},
+ .act = act_moldbygg, .talk = talk_moldbygg, .attack = attack_moldbygg},
+ [MON_SHYREN - MON_SNOW_COUNT] = {
+ .name = "Shyren", .spare_gold = 20, .hp = 66, .at = 7, .df = 2, .exp = 52, .gold = 20, .spr_idle = SPR_SHYREN_B,
+ .spr_hurt = SPR_SHYREN_TURNED, .check = "She'd love to sing, if nobody were watching.",
+ .acts = {"Smile", "Hum", "Conduct"}, .nacts = 3, .neutral = {"* Shyren hides her face.", "* Shyren is humming to herself.", "* Shyren peeks at you."},
+ .act = act_shyren, .talk = talk_shyren, .attack = attack_shyren},
+};
+const MonDef *wf_mon_def(int id) { return &wf_defs[id - MON_SNOW_COUNT]; }
+
+/* Woshua's clean green caught: then it can be spared (battle.c asks each turn, through its flavour) */
+static void woshua_check(Battle *b) {
+ for (int i = 0; i < b->nmon; i++) {
+ Monster *m = &b->mon[i];
+ if (m->def == &wf_defs[MON_WOSHUA - MON_SNOW_COUNT] && m->state == 1 && b->greens > m->state2) m->state = 2, m->spare = true;
+ }
+}
+
+static const Form wf_forms[FORM_COUNT - FORM_SNOW_COUNT] = {
+ [FORM_AARON - FORM_SNOW_COUNT] = {{MON_AARON}, 1, "* Aaron flexes in."},
+ [FORM_WOSHUA - FORM_SNOW_COUNT] = {{MON_WOSHUA}, 1, "* Woshua sloshes up."},
+ [FORM_WOSHUA_AARON - FORM_SNOW_COUNT] = {{MON_WOSHUA, MON_AARON}, 2, "* Woshua and Aaron show up."},
+ [FORM_MOLDBYGG - FORM_SNOW_COUNT] = {{MON_MOLDBYGG}, 1, "* Moldbygg blocks the way."},
+ [FORM_MOLDBYGG_MOLDSMAL - FORM_SNOW_COUNT] = {{MON_MOLDSMAL, MON_MOLDBYGG}, 2, "* Moldbygg and Moldsmal block the way."},
+ [FORM_MOLDBYGG_WOSHUA - FORM_SNOW_COUNT] = {{MON_MOLDBYGG, MON_WOSHUA}, 2, "* Moldbygg and Woshua appear."},
+ [FORM_SHYREN - FORM_SNOW_COUNT] = {{MON_SHYREN}, 1, "* Shyren hums, then hides."},
+};
+const Form *wf_form(int form) { return &wf_forms[form - FORM_SNOW_COUNT]; }
+
+/* random encounters: the wiki's pools, room by room */
+int wf_encounter(int room) {
+ switch (room) {
+ case ROOM_WF_SEEDS2: case ROOM_WF_WISH:
+ return rnd_n(3) == 0 ? FORM_WOSHUA_AARON : rnd_n(2) ? FORM_AARON : FORM_WOSHUA;
+ case ROOM_WF_MARSH: case ROOM_WF_MARSH_MID: {
+ static const uint8_t pool[] = {FORM_WOSHUA, FORM_WOSHUA_AARON, FORM_MOLDBYGG, FORM_MOLDBYGG_MOLDSMAL, FORM_AARON};
+ return pool[rnd_n(5)];
+ }
+ }
+ return -1;
+}
+
+/* ---------------------------------------------------------------- the attacks */
+static int bx0(void) { return bt.x0 + 3; }
+static int bx1(void) { return bt.x1 - 3; }
+static int by0(void) { return bt.y0 + 3; }
+static int by1(void) { return bt.y1 - 3; }
+#define P(v) ((v) * FX)
+static Bullet *shot(uint16_t spr, int x, int y, int vx, int vy) { return bullet_new(spr, P(x), P(y), vx, vy); }
+
+/* Aaron: flexing arms rise up both sides, faster and faster; sweat drips down */
+static void atk_aaron_arms(int t) {
+ if (t < 140 && t % 16 == 0) {
+ int k = t / 16;
+ bool left = k % 2;
+ int x = left ? bx0() + 10 + rnd_n(30) : bx1() - 10 - rnd_n(30);
+ Bullet *b = shot(SPR_ARM, x, by1() + 8, 0, -(P(1) + P(k) / 6));
+ if (b) b->r = 6, b->ay = -1;
+ }
+}
+static void atk_aaron_sweat(int t) {
+ if (t < 140 && t % 7 == 0) {
+ Bullet *b = shot(SPR_DROP, bx0() + 4 + rnd_n(bx1() - bx0() - 8), by0() - 6, 0, P(1));
+ if (b) b->kind = BK_GRAVITY, b->ay = 2, b->r = 3;
+ }
+}
+/* Woshua: drops fall in columns, some green (they heal) once it's cleaning you; bubbles rise and sway */
+static void atk_woshua_drops(int t) {
+ bool clean = false;
+ for (int i = 0; i < bt.nmon; i++)
+ if (bt.mon[i].def == wf_mon_def(MON_WOSHUA) && bt.mon[i].state == 1 && bt.mon[i].alive && !bt.mon[i].gone) clean = true;
+ if (t < 140 && t % 10 == 0) {
+ /* (the green ones fall right over the SOUL: to be caught) */
+ bool green = clean && (t / 10) % 4 == 1;
+ int x = green ? clamp_i(soul_x(), bx0() + 6, bx1() - 6) : bx0() + 6 + rnd_n(bx1() - bx0() - 12);
+ Bullet *b = shot(SPR_DROP, x, by0() - 6, 0, P(2));
+ if (b) {
+ b->r = 3;
+ if (green) b->color = BC_GREEN, b->dmg = 1;
+ }
+ }
+ if (t == 150) woshua_check(&bt);
+}
+static void atk_woshua_bubbles(int t) {
+ if (t < 130 && t % 12 == 0) {
+ Bullet *b = shot(SPR_ORB, bx0() + 8 + rnd_n(bx1() - bx0() - 16), by1() + 6, 0, -P(1));
+ if (b) b->kind = BK_SCRIPT, b->a = (int16_t)(b->x / FX), b->r = 4;
+ }
+ for (int i = 0; i < MAX_BULLETS; i++) {
+ Bullet *b = &bullets[i];
+ if (b->kind != BK_SCRIPT || b->spr != SPR_ORB) continue;
+ b->y -= P(1);
+ b->x = P(b->a) + gfx_sin(b->t * 6) * 12 * FX / 1024;
+ if (b->y < P(by0() - 10)) b->kind = BK_NONE;
+ }
+}
+/* Moldbygg: molds hop across the floor; spores fall */
+static void atk_moldbygg_hops(int t) {
+ if (t < 120 && t % 30 == 0) {
+ bool left = (t / 30) % 2;
+ Bullet *b = shot(SPR_ORB, left ? bx0() : bx1(), by1() - 6, (left ? 1 : -1) * P(2), -P(4));
+ if (b) b->kind = BK_GRAVITY, b->ay = 6, b->r = 5, b->a = 3;
+ }
+ for (int i = 0; i < MAX_BULLETS; i++) {
+ Bullet *b = &bullets[i];
+ if (b->kind != BK_GRAVITY || b->spr != SPR_ORB || b->a <= 0) continue;
+ if (b->y > P(by1() - 5) && b->vy > 0) b->vy = -P(4), b->a--; /* (it bounces a few times) */
+ }
+}
+static void atk_moldbygg_rain(int t) {
+ if (t < 140 && t % 5 == 0) {
+ Bullet *b = shot(SPR_ORB, bx0() + 4 + rnd_n(bx1() - bx0() - 8), by0() - 6, rnd_n(P(1)) - P(1) / 2, P(1));
+ if (b) b->r = 3;
+ }
+}
+/* Shyren: notes swim in from the right on waves, more of them for each hum */
+static void atk_shyren_notes(int t) {
+ int hums = 0;
+ for (int i = 0; i < bt.nmon; i++)
+ if (bt.mon[i].def == wf_mon_def(MON_SHYREN)) hums = bt.mon[i].state;
+ int every = 16 - hums * 2;
+ if (t < 140 && t % every == 0) {
+ Bullet *b = shot(SPR_NOTE, bx1() + 6, by0() + 8 + rnd_n(by1() - by0() - 16), -(P(2) + P(hums) / 2), 0);
+ if (b) b->kind = BK_SCRIPT, b->b = (int16_t)(b->y / FX), b->r = 4;
+ }
+ for (int i = 0; i < MAX_BULLETS; i++) {
+ Bullet *b = &bullets[i];
+ if (b->kind != BK_SCRIPT || b->spr != SPR_NOTE) continue;
+ b->x += b->vx;
+ b->y = P(b->b) + gfx_sin(b->t * 8) * 10 * FX / 1024;
+ if (b->x < P(bx0() - 10)) b->kind = BK_NONE;
+ }
+}
+
+int wf_attack_length(int atk) { (void)atk; return 160; }
+
+void wf_attack_run(Battle *b, int atk, int t) {
+ (void)b;
+ if (t < 0) {
+ board_set(atk == ATK_SHYREN_NOTES ? 160 : 130, 110);
+ return;
+ }
+ switch (atk) {
+ case ATK_AARON_ARMS: atk_aaron_arms(t); break;
+ case ATK_AARON_SWEAT: atk_aaron_sweat(t); break;
+ case ATK_WOSHUA_DROPS: atk_woshua_drops(t); break;
+ case ATK_WOSHUA_BUBBLES: atk_woshua_bubbles(t); break;
+ case ATK_MOLDBYGG_HOPS: atk_moldbygg_hops(t); break;
+ case ATK_MOLDBYGG_RAIN: atk_moldbygg_rain(t); break;
+ case ATK_SHYREN_NOTES: atk_shyren_notes(t); break;
+ }
+}
diff --git a/games/undertale/src/world.c b/games/undertale/src/world.c
index 50073d31..327288f2 100644
--- a/games/undertale/src/world.c
+++ b/games/undertale/src/world.c
@@ -60,17 +60,29 @@ static bool boxes_meet(int ax, int ay, int aw, int ah, int bx, int by, int bw, i
return ax < bx + bw && bx < ax + aw && ay < by + bh && by < ay + ah;
}
+/* a floor object (a bloomed bridge seed) under the point */
+static bool on_floor_obj(int x, int y) {
+ for (int i = 0; i < MAX_OBJS; i++) {
+ const Obj *o = &objs[i];
+ if (o->kind != OBJ_NONE && (o->flags & OF_FLOOR) && x >= o->x + o->bx && x < o->x + o->bx + o->bw &&
+ y >= o->y + o->by && y < o->y + o->by + o->bh)
+ return true;
+ }
+ return false;
+}
+
bool world_walkable(int x, int y, int w, int h, int ignore) {
/* every cell the box covers (its corners and every 4 pixels between) */
for (int yy = y;; yy += 4) {
if (yy > y + h - 1) yy = y + h - 1;
for (int xx = x;; xx += 4) {
if (xx > x + w - 1) xx = x + w - 1;
- if (!cell_walkable(xx, yy)) return false;
+ if (!cell_walkable(xx, yy) && !on_floor_obj(xx, yy)) return false;
if (xx == x + w - 1) break;
}
if (yy == y + h - 1) break;
}
+ if (ignore == WALK_FLOOR_ONLY) return true;
for (int i = 0; i < MAX_OBJS; i++) {
const Obj *o = &objs[i];
if (i == ignore || o->kind == OBJ_NONE || !(o->flags & OF_SOLID)) continue;
@@ -126,18 +138,19 @@ void world_enter(int r, int x, int y, int dir) {
obj_clear_all();
ndoors = room_doors(r, doors, 16);
cam_locked = false;
- /* a door's spot a little off the floor: the nearest that isn't */
- if (!player_free(pl.x, pl.y))
+ room_setup(r, from);
+ /* a door's spot a little off the floor: the nearest that isn't (the floor the room's things make counts: a
+ * bridge of flowers; what stands about doesn't) */
+ if (!world_walkable(pl.x + PBX, pl.y + PBY, PBW, PBH, WALK_FLOOR_ONLY))
for (int d = 1; d <= 24; d++) {
static const int8_t dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};
int k;
- for (k = 0; k < 4 && !player_free(pl.x + dx[k] * d, pl.y + dy[k] * d); k++) {}
+ for (k = 0; k < 4 && !world_walkable(pl.x + dx[k] * d + PBX, pl.y + dy[k] * d + PBY, PBW, PBH, WALK_FLOOR_ONLY); k++) {}
if (k < 4) {
pl.x = (int16_t)(pl.x + dx[k] * d), pl.y = (int16_t)(pl.y + dy[k] * d);
break;
}
}
- room_setup(r, from);
world_camera();
}
@@ -216,9 +229,12 @@ static bool push_rock(int sx, int sy) {
return false;
}
if (pushed_at == g_frame || o->walking) return false;
- if (!world_walkable(o->x + o->bx + sx, o->y + o->by + sy, o->bw, o->bh, i)) return false;
+ if (!world_walkable(o->x + o->bx + sx, o->y + o->by + sy, o->bw, o->bh, i) &&
+ !room_rock_enters(o, o->x + sx, o->y + sy))
+ return false;
pushed_at = g_frame;
o->x = (int16_t)(o->x + sx), o->y = (int16_t)(o->y + sy);
+ room_rock_moved(o);
return player_free(pl.x + sx, pl.y + sy);
}
return false;
diff --git a/games/undertale/src/world.h b/games/undertale/src/world.h
index 3df2f043..a217bfd3 100644
--- a/games/undertale/src/world.h
+++ b/games/undertale/src/world.h
@@ -26,7 +26,8 @@ enum {
OF_FRONT = 64, /* drawn over everything else */
OF_BACK = 128, /* drawn under everything else */
OF_DARK = 256, /* a silhouette */
- OF_FLIP = 512 /* drawn mirrored */
+ OF_FLIP = 512, /* drawn mirrored */
+ OF_FLOOR = 1024 /* its box is floor to walk on (a bloomed bridge seed over water) */
};
#define MAX_OBJS 48
typedef struct {
@@ -65,6 +66,7 @@ const RoomInfo *world_room_info(void);
void world_enter(int room, int x, int y, int dir); /* (x, y) Frisk's top-left; no fade */
void world_update(uint32_t keys, uint32_t pressed);
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_camera(void); /* follows Frisk, inside the room */
Obj *obj_new(int kind, int x, int y);
@@ -84,6 +86,9 @@ Obj *obj_rock(int x, int y, int name, int event); /* pushed by walking into it
void obj_set_box(Obj *o, int bx, int by, int bw, int bh);
bool near_frisk(const Obj *o, int d); /* within d pixels (their feet) */
bool room_ice(int x, int y); /* rooms.c: ice there (Frisk slides) */
+/* rooms.c: a pushed rock that the floor stops (it may go into water, a bridge seed), then where it went */
+bool room_rock_enters(Obj *o, int x, int y);
+void room_rock_moved(Obj *o);
bool pl_sliding(void);
/* the room fades out, then in: room changes in the middle */
void world_fade_to(int room, int x, int y, int dir);
diff --git a/games/undertale/tests/check.py b/games/undertale/tests/check.py
index ee13235c..4c7fd151 100644
--- a/games/undertale/tests/check.py
+++ b/games/undertale/tests/check.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
"""Checks of Undertale on a computer (make test): the host build, with
AddressSanitizer and UBSan, through the menus, every battle, the saves, the
-whole Ruins and the whole of Snowdin.
+whole Ruins, the whole of Snowdin and Waterfall's west half.
python3 tests/check.py build/play [--quick]
---quick skips playing the whole Ruins and Snowdin (the longest parts)."""
+--quick skips playing the whole Ruins, Snowdin and Waterfall (the longest parts)."""
import os
import re
import shutil
@@ -31,6 +31,9 @@ MODE_WORLD, MODE_BATTLE, MODE_END, MODE_SHOP = 2, 3, 8, 9
ROOMS = {m.group(1): int(m.group(2)) for m in
re.finditer(r"#define ROOM_(\w+) (\d+)", open(os.path.join(HERE, "..", "src", "data.h")).read())}
FORM_SNOWDRAKE, FORM_PAPYRUS = 19, 31
+FORM_AARON, FORM_WOSHUA, FORM_WOSHUA_AARON, FORM_MOLDBYGG, FORM_MOLDBYGG_MOLDSMAL, FORM_MOLDBYGG_WOSHUA, FORM_SHYREN = \
+ range(32, 39)
+ITEM_OLD_TUTU, ITEM_BALLET_SHOES, ITEM_QUICHE, ITEM_PUNCH_CARD, ITEM_ARTIFACT = range(17, 22)
def run(args, frames, saves=None, what=""):
@@ -98,6 +101,21 @@ check(s and s["mode"] == MODE_WORLD and s["kills"] == 0, f"Papyrus was not spare
s = run(["--battle", str(FORM_PAPYRUS), "--path", "spare"], 6000, what="Papyrus, captured")
check(s and s["mode"] == MODE_WORLD and s["hp"] == 1, f"Papyrus did not capture Frisk: {s}")
+# Waterfall's battles: fled from, fought, and each spared its own way (Aaron out-flexed, Woshua's green caught after
+# asking to be cleaned, Moldbygg hugged then let go, Shyren hummed along with)
+for form in range(FORM_AARON, FORM_SHYREN + 1):
+ s = run(["--god", "--battle", str(form), "--path", "flee"], 1500, what=f"battle {form}, fleeing")
+ check(s and s["mode"] == MODE_WORLD, f"battle {form}: fleeing did not end it: {s}")
+for form in (FORM_AARON, FORM_WOSHUA, FORM_MOLDBYGG, FORM_SHYREN):
+ s = run(["--god", "--battle", str(form), "--path", "fight"], 4000, what=f"battle {form}, fighting")
+ check(s and s["mode"] == MODE_WORLD and s["kills"] >= 1, f"battle {form}: FIGHT did not win it: {s}")
+for form, seq, gold in ((FORM_AARON, "1,1,1", 30), (FORM_WOSHUA, "1,1,1", 25), (FORM_WOSHUA_AARON, "1,1@2,1@2,1@2", 55),
+ (FORM_MOLDBYGG, "1,3", 20), (FORM_MOLDBYGG_WOSHUA, "1,3,1@2,1@2,1@2", 45),
+ (FORM_SHYREN, "2,2,2,2,2", 20)):
+ s = run(["--god", "--battle", str(form), "--path", "seq:" + seq], 9000, what=f"battle {form}, sparing")
+ check(s and s["mode"] == MODE_WORLD and s["kills"] == 0 and s["gold"] == gold,
+ f"battle {form}: the friendly way did not spare it: {s}")
+
# the shop in Snowdin: a Cinnamon Bunny for 25G; Papyrus's date: his phone number
s = run(["--name", "Frisk", "--noenc", "--room", str(ROOMS["SNOWTOWN"]), "--at", "446,1092", "--gold", "100", "--keys",
"2-24:up,60:z,90:down,100:down,110:down,120:z,140:z,170:x,190:down,200:down,210:down,220:z"], 400, what="the shop")
@@ -140,7 +158,7 @@ if not QUICK:
if not QUICK:
s = run(["--name", "Frisk", "--noenc", "--god", "--room", str(ROOMS["SNOWDIN1"]), "--at", "34,392", "--path-file",
os.path.join(HERE, "snowdin.path")], 30000, what="Snowdin")
- check(s and s["mode"] == MODE_END, f"Snowdin did not end on the way to Waterfall: {s}")
+ check(s and s["mode"] == MODE_WORLD and s["room"] == ROOMS["WF1"], f"Snowdin did not lead on to Waterfall: {s}")
if s:
for name, v in (("BRANCH", 1), ("SANS_MET", 1), ("PAP_SENTRY", 1), ("DOGGO", 1), ("ELECMAZE", 2),
("WORDSEARCH", 1), ("SNOWPUZZLE", 1), ("DOGI", 1), ("XOXO1", 1), ("XOXO2", 1), ("XOXO3", 1),
@@ -149,6 +167,24 @@ if not QUICK:
check(flag(s, name) == v, f"Snowdin: F_{name} is {flag(s, name)}, not {v}")
check(s["kills"] == 0, f"Snowdin: {s['kills']} killed on the friendly way")
+# Waterfall's west half, the friendly way: Monster Kid, Grillby's with Sans, the tutu, Papyrus's report, the bridge
+# seeds (and the secret one to the quiche), the wishing room, Undyne's spears, the telescope, the punch card, the marsh
+# (the ballet shoes), the bird,
+# Onionsan, the piano and the artifact, Shyren, the umbrellas, Monster Kid in the rain, the bridge cut
+if not QUICK:
+ s = run(["--name", "Frisk", "--noenc", "--god", "--room", str(ROOMS["WF1"]), "--at", "30,1480", "--path-file",
+ os.path.join(HERE, "waterfall.path")], 45000, what="Waterfall")
+ check(s and s["mode"] == MODE_END and s["room"] == ROOMS["WF_BRIDGE"], f"Waterfall did not end at the bridge: {s}")
+ 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_BIRD", 1), ("WF_ONION", 2), ("PIANO", 1), ("WF_ARTIFACT", 1), ("SHYREN", 1),
+ ("UMBRELLA", 3), ("MK_RAIN", 2), ("WF_BRIDGE", 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):
+ check(item in s["items"], f"Waterfall: item {item} not picked up: {s['items']}")
+
if failures:
print("\n".join("FAIL " + f for f in failures))
sys.exit(1)
diff --git a/games/undertale/tests/play.c b/games/undertale/tests/play.c
index 80026538..6a7cbe45 100644
--- a/games/undertale/tests/play.c
+++ b/games/undertale/tests/play.c
@@ -125,6 +125,10 @@ static uint32_t path_keys(int f) {
path_at = e ? e + 1 : path_at + strlen(path_at);
return K_Z;
}
+ if (text_menu_sel() < 100 && text_menu_cols() == 2) { /* (two columns: the row, then the column) */
+ if (sel / 2 != n / 2) return sel / 2 < n / 2 ? K_DOWN : K_UP;
+ return sel < n ? K_RIGHT : K_LEFT;
+ }
return sel < n ? (text_menu_sel() >= 100 ? K_RIGHT : K_DOWN) : (text_menu_sel() >= 100 ? K_LEFT : K_UP);
}
/* a text in the way: read on (Z every other frame) */
@@ -167,7 +171,13 @@ static uint32_t path_keys(int f) {
switch (battle_ui()) {
case BUI_MENU: return bt.button < want ? K_RIGHT : bt.button > want ? K_LEFT : K_Z;
case BUI_TARGET:
- if (seq && bt.button == 1) return bt.target < seq_target ? K_DOWN : bt.target > seq_target ? K_UP : K_Z;
+ if (seq && bt.button == 1) {
+ /* (the list holds those still there: "the second" is the last when one has gone) */
+ int here = 0;
+ for (int i = 0; i < bt.nmon; i++) here += bt.mon[i].alive && !bt.mon[i].gone;
+ int want_t = seq_target < here ? seq_target : here - 1;
+ return bt.target < want_t ? K_DOWN : bt.target > want_t ? K_UP : K_Z;
+ }
return K_Z;
case BUI_ACTS: {
int n = seq ? seq_act : atoi(path_at + 4);
@@ -435,6 +445,11 @@ int main(int argc, char **argv) {
}
if (gfx_dropped) printf("dropped %d draw commands\n", gfx_dropped);
if (getenv("BLK_STATS")) fprintf(stderr, "blocks unpacked %u, at most %u in a frame\n", blk_unpacked, blk_most_in_frame);
+ if (getenv("OBJS")) /* (the room's objects at the end: kind, name, where, its box) */
+ for (int i = 0; i < MAX_OBJS; i++)
+ if (objs[i].kind != OBJ_NONE)
+ fprintf(stderr, "obj %d kind %d name %d at %d,%d box %d,%d %dx%d spr %d\n", i, objs[i].kind, objs[i].name, objs[i].x,
+ objs[i].y, objs[i].bx, objs[i].by, objs[i].bw, objs[i].bh, objs[i].spr[0]);
printf("END mode %d room %d at %d,%d hp %d lv %d gold %d kills %d path %s\nFLAGS", g_mode, g_room, pl.x, pl.y, sv.hp,
sv.lv, sv.gold, sv.kills, path_at && *path_at ? "left" : "done");
for (int i = 0; i < FLAG_COUNT; i++)
diff --git a/games/undertale/tests/waterfall.path b/games/undertale/tests/waterfall.path
new file mode 100644
index 00000000..7f133bb1
--- /dev/null
+++ b/games/undertale/tests/waterfall.path
@@ -0,0 +1,235 @@
+# Waterfall's west half from Snowdin's fog (play it with --room 85 --at 30,1480 --name Frisk --noenc --god), the
+# friendly way, as in snowdin.path. Monster Kid, Sans's booth (Grillby's), the echo flowers
+go:600,1480
+talk
+go:880,1458
+u
+z
+talk
+w30
+talk
+# the falls: the tutu up north, the stream's rocks, Papyrus's report to Undyne from the tall grass
+go:1100,1480
+go:1250,1460
+go:1250,1300
+go:1240,1256
+u
+z
+talk
+go:1250,1400
+go:1250,1470
+go:1370,1505
+go:1600,1505
+go:1780,1500
+talk
+w60
+talk
+# the first bridge seeds: four pushed down to the path and on into the water
+go:2240,1485
+go:2280,1425
+2305,1425
+go:2320,1405
+2320,1475
+go:2280,1425
+2280,1475
+go:2280,1465
+2305,1465
+go:2300,1485
+2365,1485
+go:2260,1485
+2385,1485
+go:2300,1425
+2300,1475
+go:2280,1485
+2405,1485
+go:2320,1445
+2320,1475
+go:2300,1485
+2425,1485
+go:2500,1485
+# the second: first the secret bridge to the quiche (all four seeds), then the bell, then three across the channel
+go:2900,1490
+go:3000,1345
+3000,1455
+go:2980,1465
+3025,1465
+go:3040,1445
+3040,1520
+go:3000,1305
+3000,1455
+go:2980,1465
+3045,1465
+go:3060,1445
+3060,1520
+go:2940,1365
+3045,1365
+go:3060,1345
+3060,1517
+go:3040,1515
+3040,1525
+3062,1525
+go:2940,1325
+3045,1325
+go:3060,1305
+3060,1517
+go:3040,1515
+3040,1525
+3082,1525
+3140,1525
+go:3200,1525
+go:3270,1500
+u
+z
+talk
+3190,1500
+3190,1525
+3100,1525
+go:3040,1525
+go:3020,1210
+u
+z
+talk
+go:2960,1345
+2960,1258
+go:2980,1245
+2870,1245
+go:3000,1345
+3000,1258
+go:3020,1245
+2850,1245
+go:2960,1385
+2960,1258
+go:2980,1245
+2830,1245
+go:2780,1245
+go:2729,1240
+2729,1200
+w30
+# the wishing room, the history boardwalk, Undyne's spears to the tall grass
+go:2800,1060
+go:3120,830
+go:3125,700
+go:3460,600
+go:4010,560
+go:4600,560
+go:5200,560
+go:5760,560
+go:6400,560
+go:6700,560
+talk
+w30
+talk
+# the crystals' SAVE, Sans's telescope, the Nice Cream cart and the punch card upstairs, the bird
+go:7248,562
+u
+z
+talk
+go:7880,540
+u
+z
+talk
+go:7975,560
+go:7900,130
+u
+z
+talk
+go:8050,130
+u
+z
+talk
+# down the ladder into the marsh: the ballet shoes in the tall grass, an echo flower, the history sign
+go:8140,560
+go:8140,700
+go:7590,1250
+u
+z
+talk
+go:8445,1132
+u
+z
+talk
+go:8850,840
+u
+z
+talk
+go:8140,700
+go:8140,560
+go:8000,560
+go:8300,560
+go:8440,560
+r
+z
+talk
+w60
+# Onionsan, the piano's song (the artifact), Shyren (hummed along with)
+go:8700,600
+go:8900,600
+talk
+go:9300,600
+go:9600,600
+talk
+go:9850,620
+go:10070,640
+go:10066,412
+u
+z
+pick:0
+pick:4
+pick:0
+pick:3
+pick:4
+pick:1
+pick:1
+pick:3
+talk
+go:10150,330
+go:10150,240
+go:10150,162
+u
+z
+talk
+go:10137,612
+d
+z
+talk
+seq:2,2,2,2,2
+talk
+# the umbrella for the statue, another for Monster Kid, the rain down to the castle's view
+go:10400,640
+go:11150,640
+u
+z
+talk
+go:10760,640
+u
+z
+pick:0
+talk
+go:11150,640
+u
+z
+talk
+go:11400,662
+go:11900,662
+talk
+go:12500,662
+go:12760,900
+talk
+go:12760,1500
+go:12900,1700
+talk
+go:13700,1700
+talk
+go:14300,1700
+go:14720,1700
+talk
+# the last SAVE before the bridge, Undyne's spears from below, the bridge cut
+go:15138,1665
+u
+z
+talk
+go:15400,1700
+go:16000,1700
+go:16800,1700
+go:17400,1700
+talk
diff --git a/games/undertale/tools/fetch.py b/games/undertale/tools/fetch.py
index 657aea85..de4c4741 100644
--- a/games/undertale/tools/fetch.py
+++ b/games/undertale/tools/fetch.py
@@ -46,6 +46,12 @@ PAGES = ["Ruins", "Ruins/Puzzles", "Toriel", "Toriel/In_battle", "Toriel's_Home"
"Rabbit_Lady_and_Cinnamon", "Red_Bird", "Red_Demon", "Scarf_Lady", "Slime_family", "Ugly_Fish",
"Library_Lizard", "Library_Loox", "Knock_lover", "Lady_Garf", "Wrap_Mouse", "Innkeeper's_child",
"Snoring_guests", "Mad_Mew_Mew", "Snowdrake's_mother", "Snowdrake's_father", "Bonetrousle",
+ # Waterfall
+ "Waterfall", "Waterfall/Puzzles", "Aaron", "Woshua", "Moldbygg", "Shyren", "Temmie", "Temmie_Village",
+ "Mad_Dummy", "Undyne", "Undyne/In_battle", "Onionsan", "Gerson", "Echo_Flower", "Bridge_seed",
+ "Undyne's_House", "Napstablook's_house", "Garbage_Dump", "Shyren/In_battle", "Riverman", "Piano_puzzle",
+ "Legendary_Artifact", "Astronaut_Food", "Glamburger", "Hot_Dog...?", "Cloudy_Glasses", "Torn_Notebook",
+ "Stained_Apron", "Burnt_Pan", "Toy_Knife", "Temmie_Flakes", "Tem_Shop", "Small_bird", "Lemon_Bread",
"Tough_Glove", "Manly_Bandanna", "Old_Tutu", "Ballet_Shoes", "Cinnamon_Bunny", "Bisicle", "Unisicle",
"Nice_Cream_(item)", "Snowman_Piece", "Snowman_Piece", "Punch_Card", "Dog_Residue", "Abandoned_Quiche",
"Astronaut_Food", "Hot_Dog...?", "Hot_Cat", "Spaghetti", "Glamburger", "Sea_Tea", "Temmie_Flakes",
diff --git a/games/undertale/tools/pack.py b/games/undertale/tools/pack.py
index 631376fb..60cbd01c 100644
--- a/games/undertale/tools/pack.py
+++ b/games/undertale/tools/pack.py
@@ -484,6 +484,21 @@ def collision(area, r):
big = np.zeros((Y1 - Y0, X1 - X0), bool)
xs0, ys0, xs1, ys1 = max(X0, 0), max(Y0, 0), min(X1, W), min(Y1, H)
big[ys0 - Y0:ys1 - Y0, xs0 - X0:xs1 - X0] = np.isin(area.idx[ys0:ys1, xs0:xs1], list(walk_idx))
+ if r.get("tufts"):
+ # black ground with grass tufts on it, black nothing without: black is floor only within `tufts` pixels of a
+ # tuft (a little blot of another colour with black all around it)
+ win = np.zeros(big.shape, area.idx.dtype)
+ win[ys0 - Y0:ys1 - Y0, xs0 - X0:xs1 - X0] = area.idx[ys0:ys1, xs0:xs1]
+ black = np.isin(win, [i for i, k in enumerate(area.rgb) if k == (0, 0, 0) and i != area.transparent])
+ lab, n = ndimage.label(~black, np.ones((3, 3)))
+ tuft = np.zeros_like(black)
+ for i, sl in enumerate(ndimage.find_objects(lab)):
+ hh, ww = sl[0].stop - sl[0].start, sl[1].stop - sl[1].start
+ if hh <= 12 and ww <= 12:
+ ring = ndimage.binary_dilation(lab[sl] == i + 1, iterations=1) & (lab[sl] != i + 1)
+ if black[sl][ring].all():
+ tuft[sl] |= lab[sl] == i + 1
+ big &= ~black | (ndimage.distance_transform_edt(~tuft) <= r["tufts"])
sub = big[margin:margin + ch * 4, margin:margin + cw * 4]
if r.get("open"): # floors of many colours (a carpet, planks): its floor_rects alone say
sub = np.ones_like(sub)
@@ -516,6 +531,13 @@ def collision(area, r):
cells &= ~near.reshape(ch, 4, cw, 4).any(axis=(1, 3))
piles = pile_big[margin:margin + ch * 4, margin:margin + cw * 4]
cells |= piles.reshape(ch, 4, cw, 4).mean(axis=(1, 3)) >= 0.5
+ if r.get("close", area.spec.get("close")):
+ # a floor's own lines one cell thin (the seams between planks) aren't walls: a cell with floor either side
+ up, down = np.zeros_like(cells), np.zeros_like(cells)
+ up[1:], down[:-1] = cells[:-1], cells[1:]
+ left, right = np.zeros_like(cells), np.zeros_like(cells)
+ left[:, 1:], right[:, :-1] = cells[:, :-1], cells[:, 1:]
+ cells = cells | (up & down) | (left & right)
if r.get("floor_rects"):
keep = np.zeros_like(cells)
for fx, fy, fw, fh in r["floor_rects"]:
diff --git a/games/undertale/tools/rooms.py b/games/undertale/tools/rooms.py
index 31a80b56..1ffe9c1b 100644
--- a/games/undertale/tools/rooms.py
+++ b/games/undertale/tools/rooms.py
@@ -103,6 +103,30 @@ AREAS.append(dict(name="snowtown", map="Snowdin_Town_map.png", floor=SNOW, margi
("erase", 3376, 1036, 30, 66, "ring"), ("erase", 2212, 854, 32, 50, "ring"), ("erase", 2262, 580, 36, 52, "ring"),
]))
+# Waterfall: dark blue floors whose colours its walls share too, so a room's floor is its rectangles
+WF_FLOOR = [(54, 47, 121), (20, 26, 73)]
+WF_WATER = [(27, 33, 90), (27, 21, 72)]
+WF_CYAN = [(123, 251, 254), (47, 234, 255)]
+AREAS.append(dict(name="waterfall", map="Waterfall_map.png", floor=WF_FLOOR, margin=0, close=True, patches=[
+ # the people the game moves about (they're the game's objects here): Monster Kid, the fish by the first
+ # echo flower, Undyne (her black ledges kept black), Woshua, the Goner Kid, Onionsan, Shyren, the grey
+ # figure by the piano, Aaron
+ ("erase", 716, 1498, 28, 36, "ring"), ("erase", 716, 1404, 34, 50, "ring"),
+ ("erase", 1800, 1336, 46, 62, "ring", []), ("copy", 3398, 554, 40, 38, 3438, 554),
+ ("copy", 4042, 541, 24, 32, 4002, 541), ("erase", 4354, 370, 42, 60, "ring", []),
+ ("copy", 9130, 528, 72, 84, 9232, 528), ("copy", 10100, 630, 34, 40, 10134, 630),
+ ("copy", 10130, 682, 32, 58, 10168, 682), ("erase", 11897, 614, 28, 36, "ring"),
+ ("copy", 14530, 1636, 42, 70, 14476, 1636), ("copy", 15806, 1714, 40, 66, 15846, 1714),
+ # the bridge seeds (the game's objects too) and the bridges they make, drawn solved
+ *[("erase", x, y, 20, 20, WF_FLOOR) for x, y in [(2300, 1420), (2280, 1440), (2320, 1440), (2300, 1460),
+ (2960, 1340), (3000, 1340), (2960, 1380), (3000, 1380)]],
+ # the tutu and the artifact (objects, gone once taken)
+ ("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)]),
+ ("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"),
+]))
+
ROOMS = [
# the landing: the bed of golden flowers, a hallway, the Delta Rune arch
dict(name="area1", area="ruins", rect=(0, 5900, 680, 260), title="Ruins", margin=0,
@@ -278,7 +302,8 @@ ROOMS = [
dict(name="townnorth", area="snowtown", rect=(1400, 700, 640, 260), title="Snowdin Town"),
dict(name="towndock", area="snowtown", rect=(1400, 480, 410, 220), title="Snowdin Town"),
dict(name="fogroom", area="snowtown", rect=(3260, 960, 360, 240), title="Snowdin Town",
- fix=[("walk", 3440, 1084, 180, 48)]), # the way on: Waterfall's blue ground
+ fix=[("walk", 3440, 1084, 180, 48)], # the way on: Waterfall's blue ground
+ doors=[((3612, 1080, 8, 56), "wf1", (4, 1480), "right")]),
# the interiors: their floors are many colours, so their floor and furniture are rectangles
dict(name="inn1", area="snowtown", rect=(500, 740, 260, 220), title="Snowed Inn", open=True, margin=0,
floor_rects=[(520, 800, 222, 100), (600, 900, 80, 60), (536, 756, 44, 48)],
@@ -310,11 +335,68 @@ ROOMS = [
dict(name="shed", area="snowtown", rect=(2550, 710, 290, 245), title="Snowdin Town", open=True, margin=0,
floor_rects=[(2580, 770, 180, 120), (2560, 886, 80, 64)], fix=[("wall", 2580, 730, 56, 100)],
doors=[((2560, 945, 80, 8), "snowtown", (2400, 1096), "down")]),
+ # Waterfall, the west: from Snowdin to the bridge Undyne cuts
+ dict(name="wf1", area="waterfall", rect=(0, 1330, 1170, 310), title="Waterfall",
+ fix=[("walk", 1040, 1505, 20, 135), ("walk", 1150, 1452, 20, 56)],
+ doors=[((0, 1450, 4, 96), "fogroom", (3580, 1088), "left")]),
+ dict(name="wf_falls", area="waterfall", rect=(1170, 1140, 180, 500), title="Waterfall", floor_colors=WF_WATER,
+ floor_rects=[(1170, 1446, 180, 194), (1236, 1326, 48, 124), (1180, 1236, 160, 96)],
+ fix=[("walk", 1170, 1452, 14, 56), ("walk", 1336, 1500, 14, 36), ("walk", 1236, 1396, 48, 56)]),
+ dict(name="wf_falls_low", area="waterfall", rect=(1030, 1640, 450, 180), title="Waterfall", floor_colors=WF_WATER,
+ fix=[("walk", 1040, 1640, 20, 14), ("walk", 1160, 1676, 20, 80), ("walk", 1360, 1676, 20, 80),
+ ("wall", 1180, 1640, 160, 14)]),
+ dict(name="wf2", area="waterfall", rect=(1350, 1140, 750, 500), title="Waterfall",
+ fix=[("walk", 1350, 1500, 16, 36), ("walk", 1756, 1500, 172, 36)]), # (the tall grass)
+ dict(name="wf_seeds1", area="waterfall", rect=(2100, 1300, 520, 340), title="Waterfall"),
+ dict(name="wf_seeds2", area="waterfall", rect=(2620, 1120, 500, 520), title="Waterfall",
+ fix=[("walk", 2716, 1228, 46, 34), ("walk", 2810, 1494, 100, 28)], # (the doorway, the planks)
+ doors=[((2716, 1232, 46, 24), "wf_wish", (2727, 1080), "up")]),
+ # (reached by the secret bridge of seeds, then the planks)
+ dict(name="wf_quiche", area="waterfall", rect=(3120, 1340, 260, 300), title="Waterfall", floor_colors=WF_WATER,
+ floor_rects=[(3180, 1440, 180, 100)], fix=[("walk", 3120, 1540, 100, 20)]),
+ dict(name="wf_wish", area="waterfall", rect=(2640, 780, 740, 340), title="Waterfall", floor_colors=WF_WATER,
+ floor_rects=[(2660, 1040, 700, 62), (3098, 816, 64, 226), (2712, 1100, 50, 22)],
+ fix=[("walk", 3112, 812, 36, 50)], doors=[((2712, 1118, 50, 4), "wf_seeds2", (2729, 1250), "down")]),
+ dict(name="wf_hist", area="waterfall", rect=(2980, 400, 530, 380), title="Waterfall"),
+ dict(name="wf_chase1", area="waterfall", rect=(4000, 300, 2520, 400), title="Waterfall"),
+ dict(name="wf_grass1", area="waterfall", rect=(6520, 400, 1320, 300), title="Waterfall", floor_colors=WF_WATER,
+ floor_rects=[(6520, 540, 360, 72), (6880, 560, 960, 44)], fix=[("walk", 6520, 544, 360, 64)]),
+ dict(name="wf_sans2", area="waterfall", rect=(7840, 0, 360, 600), title="Waterfall", floor_colors=WF_WATER,
+ floor_rects=[(7860, 92, 300, 118), (7956, 206, 38, 360), (7840, 556, 360, 50)],
+ fix=[("walk", 7956, 420, 38, 140)]),
+ # the marsh: its shallow glowing water and its grassy black ground are walked on (plain black is nothing, the
+ # planks cross it); the boardwalk ends at a gap the bird carries Frisk over, a ladder goes down into the marsh
+ dict(name="wf_marsh_top", area="waterfall", rect=(8200, 400, 450, 200), title="Waterfall",
+ floor_colors=WF_WATER + [(23, 13, 43), (0, 0, 0)], tufts=44, floor_rects=[(8200, 556, 284, 64), (8536, 556, 114, 64)]),
+ dict(name="wf_marsh_mid", area="waterfall", rect=(7400, 600, 1250, 200), title="Waterfall",
+ floor_colors=[(0, 0, 0)] + WF_CYAN, tufts=44,
+ fix=[("walk", 8140, 600, 20, 84)]),
+ dict(name="wf_marsh", area="waterfall", rect=(7400, 800, 1650, 660), title="Waterfall",
+ floor_colors=[(0, 0, 0)] + WF_CYAN, tufts=44,
+ fix=[("walk", x, y - 2, w, h + 4) for x, y, w, h in [(7821, 825, 58, 55), (7921, 945, 58, 55), (8301, 1005, 58, 55),
+ (8741, 1005, 58, 55), (8561, 1145, 58, 55), (7941, 1220, 59, 60), (8501, 1360, 59, 57), (8741, 1440, 56, 17)]]),
+ dict(name="wf_onion", area="waterfall", rect=(8650, 500, 1250, 300), title="Waterfall", floor_colors=WF_WATER,
+ fix=[("walk", 8648, 560, 16, 40), ("walk", 9800, 600, 20, 58), ("walk", 9860, 640, 40, 58)]),
+ dict(name="wf_piano", area="waterfall", rect=(9900, 20, 600, 780), title="Waterfall", floor_colors=WF_WATER,
+ floor_rects=[(10060, 140, 200, 64), (10136, 200, 48, 104), (10118, 300, 64, 100), (10040, 398, 220, 64),
+ (10118, 460, 64, 140), (10040, 598, 220, 124), (9900, 638, 142, 46), (10258, 638, 242, 46)]),
+ dict(name="wf_statue", area="waterfall", rect=(10500, 520, 1000, 260), title="Waterfall", floor_colors=WF_WATER,
+ fix=[("walk", 10500, 640, 1000, 60)]),
+ # (the rain's puddles are black)
+ dict(name="wf_rain1", area="waterfall", rect=(11500, 520, 1360, 300), title="Waterfall",
+ floor_colors=WF_WATER + [(0, 0, 0)], floor_rects=[(11500, 636, 1360, 68), (12740, 700, 80, 120)]),
+ dict(name="wf_rain2", area="waterfall", rect=(12700, 820, 220, 980), title="Waterfall", floor_colors=WF_WATER),
+ dict(name="wf_castle", area="waterfall", rect=(12920, 1560, 1480, 260), title="Waterfall", floor_colors=WF_WATER,
+ fix=[("walk", 12920, 1676, 1480, 48)]),
+ dict(name="wf_aaron", area="waterfall", rect=(14400, 1560, 960, 260), title="Waterfall", floor_colors=WF_WATER),
+ dict(name="wf_bridge", area="waterfall", rect=(15360, 1540, 2300, 460), title="Waterfall"),
]
# rooms one above the other through a dark doorway (tools/pack.py: apply_links); ("h", left, right, y, h): side
# by side with a gap, a door each way along the rows y .. y + h
LINKS = [
+ ("h", "wf_hist", "wf_chase1", 540, 60),
+ ("v", "wf_wish", "wf_hist", 3112, 36, 818),
("h", "snowdin1", "snowdin2", 404, 52),
("h", "snowdin2", "snowdin3", 404, 52),
("h", "snowdin3", "snowdin4", 404, 52),
diff --git a/games/undertale/tools/sprites.py b/games/undertale/tools/sprites.py
index 79597cdc..d93bf791 100644
--- a/games/undertale/tools/sprites.py
+++ b/games/undertale/tools/sprites.py
@@ -106,9 +106,54 @@ def gen_heartbullet():
return [im]
+def gen_spear():
+ # Undyne's spear: a shaft, a head on top
+ im = _img(7, 40)
+ d = ImageDraw.Draw(im)
+ d.polygon([(3, 0), (6, 8), (4, 8), (4, 39), (2, 39), (2, 8), (0, 8)], fill=(255, 255, 255, 255))
+ return [im]
+
+
+def gen_note():
+ im = _img(9, 11)
+ d = ImageDraw.Draw(im)
+ d.ellipse([0, 6, 5, 10], fill=(255, 255, 255, 255))
+ d.rectangle([4, 0, 5, 8], fill=(255, 255, 255, 255))
+ d.line([(5, 0), (8, 3)], fill=(255, 255, 255, 255))
+ return [im]
+
+
+def gen_drop():
+ im = _img(7, 10)
+ d = ImageDraw.Draw(im)
+ d.polygon([(3, 0), (6, 6), (5, 9), (1, 9), (0, 6)], fill=(255, 255, 255, 255))
+ return [im]
+
+
+def gen_arm():
+ # a flexing arm: the upper arm along, the forearm up, a fist
+ im = _img(16, 14)
+ d = ImageDraw.Draw(im)
+ d.rectangle([0, 9, 9, 13], fill=(255, 255, 255, 255))
+ d.ellipse([3, 6, 9, 12], fill=(255, 255, 255, 255))
+ d.rectangle([9, 3, 13, 13], fill=(255, 255, 255, 255))
+ d.ellipse([9, 0, 15, 5], fill=(255, 255, 255, 255))
+ return [im]
+
+
+def gen_debris():
+ # a rock riding the stream
+ im = _img(16, 12)
+ d = ImageDraw.Draw(im)
+ d.ellipse([0, 1, 15, 11], fill=(90, 84, 128, 255), outline=(20, 16, 40, 255))
+ d.line([(4, 4), (8, 3)], fill=(150, 140, 190, 255))
+ return [im]
+
+
GEN = {"otile": gen_otile, "snowball": gen_snowball, "bone": gen_bone, "orb": gen_orb, "snowflake": gen_snowflake,
"iceshard": gen_iceshard, "present": gen_present, "knife": gen_knife, "dogpaw": gen_dogpaw,
- "heartbullet": gen_heartbullet}
+ "heartbullet": gen_heartbullet, "spear": gen_spear, "note": gen_note, "drop": gen_drop, "arm": gen_arm,
+ "debris": gen_debris}
SNOW_CLEAR = [(133, 163, 216), (114, 129, 177), (139, 163, 186), (180, 192, 201), (195, 207, 216)]
PAP_GIF = "move:Papyrus_screenshot_back_and_forth.gif:0,280,640,450:"
@@ -240,6 +285,36 @@ SPRITES = [
("papyrus_b", "wiki:Papyrus_battle.png", {"feet": True, "clear_bg": True}),
("papyrus_hurt", "wiki:Papyrus_battle_hurt.png", {"feet": True, "clear_bg": True}),
("papyrus_confused", "wiki:Papyrus_battle_confused.gif", {"feet": True, "clear_bg": True, "dedupe": True}),
+ # Waterfall: who walks about, the bridge seeds, the bullets
+ ("mk_ow", "wiki:Monster_Kid_overworld.png", {"feet": True}),
+ ("mk_ow_l", "wiki:Monster_Kid_overworld.png", {"feet": True, "mirror": True}),
+ ("undyne_ow", "wiki:Undyne_overworld_armor.png", {"feet": True}),
+ ("undyne_throw", "wiki:Undyne_overworld_spear.gif", {"feet": True, "dedupe": True}),
+ ("onionsan", "wiki:Onionsan_overworld.png", {"feet": True}),
+ ("onionsan_up", "wiki:Onionsan_overworld_surface.png", {"feet": True}),
+ ("shyren_ow", "wiki:Shyren_overworld.png", {"feet": True}),
+ ("aaron_ow", "wiki:Aaron_overworld.png", {"feet": True}),
+ ("woshua_ow", "wiki:Woshua_overworld.gif", {"feet": True}),
+ ("seed", "wiki:Bridge_Seed_overworld.png", {"keep": True}),
+ ("bloom", "wiki:Bridge_Seed_overworld_flower.png", {"keep": True}),
+ # what lies about Waterfall to be picked up (cut from the map, its floor made see-through): the tutu, the
+ # artifact on its pedestal
+ ("tutu", "map:Waterfall_map.png:1240,1240,22,10", {"keep": True, "clear": [(23, 13, 43), (27, 21, 72), (27, 33, 90)]}),
+ ("artifact", "map:Waterfall_map.png:10156,150,12,11",
+ {"keep": True, "clear": [(27, 21, 72), (27, 33, 90), (54, 47, 121), (99, 102, 135)]}),
+ ("spear", "gen:spear", {"center": True}),
+ ("note", "gen:note", {"center": True}),
+ ("drop", "gen:drop", {"center": True}),
+ ("arm", "gen:arm", {"center": True}),
+ ("debris", "gen:debris", {"center": True}),
+ # Waterfall's monsters
+ ("aaron_b", "wiki:Aaron_battle_static.png", {"feet": True, "clear_bg": True}),
+ ("aaron_hurt", "wiki:Aaron_battle_hurt.png", {"feet": True, "clear_bg": True}),
+ ("woshua_b", "wiki:Woshua_battle_idle.gif", {"feet": True, "clear_bg": True, "dedupe": True, "every": 30}),
+ ("woshua_hurt", "wiki:Woshua_battle_hurt.png", {"feet": True, "clear_bg": True}),
+ ("moldbygg_b", "wiki:Moldbygg_battle_idle.gif", {"feet": True, "clear_bg": True, "every": 6}),
+ ("shyren_b", "wiki:Shyren_battle.png", {"feet": True, "clear_bg": True}),
+ ("shyren_turned", "wiki:Shyren_battle_turned.png", {"feet": True, "clear_bg": True}),
] + [
# the intro's pictures, the title, GAME OVER
("introimage", "demo:spr_introimage", {"keep": True, "clear_black": True}),
diff --git a/tools/release.py b/tools/release.py
index b8b05e0b..6faf9e72 100644
--- a/tools/release.py
+++ b/tools/release.py
@@ -27,9 +27,9 @@ ALONE = {
"on its own"),
"hollowknight": ("Hollow Knight", "from King's Pass to Hornet in Greenpath. Too big to share the calculator with "
"NumPlay: install it on its own"),
- "undertale": ("Undertale", "the Ruins and Snowdin, from the bed of golden flowers to the edge of Waterfall: Flowey, "
- "Toriel, Sans, Papyrus and every puzzle, the rest of the Underground to come. Too big to share the "
- "calculator with NumPlay: install it on its own"),
+ "undertale": ("Undertale", "the Ruins, Snowdin and half of Waterfall, from the bed of golden flowers to the bridge "
+ "Undyne cuts: Flowey, Toriel, Sans, Papyrus, Monster Kid, Undyne's spears and every puzzle, the rest "
+ "of the Underground to come. Too big to share the calculator with NumPlay: install it on its own"),
"championisland": ("Champion Island", "the Doodle Champion Island Games. Too big to share the calculator with "
"NumPlay: install it on its own"),
"numpowder": ("NumPowder", "The Powder Toy on the calculator: sand, water, fire, acid, electricity and nearly 200 "