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: Hotland's first floor, from the Lab to the elevator

Mason Chen32b07d6ff453
diff --git a/README.md b/README.md
index 36798a38..fe2d89d0 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, Snowdin and Waterfall, from the golden flowers to Hotland's edge</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, Waterfall and Hotland's first floor, from the golden flowers to the CORE's view</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, Snowdin and Waterfall are out, Hotland, the CORE and New Home are next
+- [ ] Undertale: the Ruins, Snowdin, Waterfall and Hotland's first floor are out, the rest of Hotland, the CORE and New Home are next
- [ ] The Binding of Isaac
- [ ] Plants vs. Zombies
- [ ] Doom
diff --git a/docs/play.md b/docs/play.md
index 7b94c10a..820d0a50 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, 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; when it turns green, it stays put, and the arrows turn its shield to block. 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. The Tem Shop in Temmie Village also buys what you carry. For now the game ends in Hotland's first room.
+Name the fallen human, then walk and talk your way through the Ruins, Snowdin, Waterfall and Hotland. 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; when it turns green, it stays put, and the arrows turn its shield to block. 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. The Tem Shop in Temmie Village also buys what you carry. In Hotland, steam vents throw you over the lava, orange lasers hit you if you stand still and blue ones if you move, and in a shooting puzzle the arrows push the dark blocks and Z shoots. For now the game ends at the elevator by the CORE's view.
<br clear="right">
diff --git a/games/undertale/README.md b/games/undertale/README.md
index c5d04f00..761d703e 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, Snowdin and Waterfall, from the bed of golden flowers to Hotland's edge. The rest of the Underground is on the way.
+ The Ruins, Snowdin, Waterfall and Hotland's first floor, from the bed of golden flowers to the elevator by the CORE. The rest of the Underground is on the way.
</p>
<p align="center">
@@ -26,7 +26,8 @@
* **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, library and Papyrus's house.
* **Waterfall:** 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 marsh where the land is black and the water glows, Onionsan, the piano's secret song, the statue in the rain and Monster Kid under your umbrella. Then the fall into the garbage dump, Mad Dummy, Napstablook's house and snail farm, the small bird back over the gap, Gerson's shop, the mushroom maze and Temmie Village with its Tem Shop. And at the end of Waterfall: the lantern maze, Undyne at the dead end (and Monster Kid in her way), the echo flowers' path, Monster Kid on the chasm's bridge, Undyne on her crag, her fight and her chase, and Hotland's edge, where the heat gets her and the water cooler helps.
-* **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, Shyren, Temmie, Mad Dummy, who can't be hurt, and Undyne, who turns your SOUL green, in Waterfall.
+* **Hotland's first floor:** Alphys's Lab, where Mettaton bursts in with his quiz show, the conveyor belts, the Magma Chamber's steam vents and the burnt pan, the laser walkway, the two shooting puzzles that open the door, the vents over the lava and Mettaton's cooking show, with your phone's jetpack, up to the elevator. Alphys calls you as you go.
+* **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, Shyren, Temmie, Mad Dummy, who can't be hurt, and Undyne, who turns your SOUL green, in Waterfall; Vulkin, Tsunderplane and Pyrope in Hotland.
* **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.
@@ -99,6 +100,18 @@
<td align="center"><img src="docs/neon.png" width="390" alt="The neon sign"><br><sub>Welcome to Hotland</sub></td>
<td align="center"><img src="docs/hotland.png" width="390" alt="Undyne in Hotland's heat"><br><sub>Water for Undyne, in Hotland's heat</sub></td>
</tr>
+ <tr>
+ <td align="center"><img src="docs/lab.png" width="390" alt="Alphys in her Lab"><br><sub>Alphys, in her Lab</sub></td>
+ <td align="center"><img src="docs/quiz.png" width="390" alt="Mettaton's quiz show"><br><sub>Mettaton's quiz show</sub></td>
+ </tr>
+ <tr>
+ <td align="center"><img src="docs/lasers.png" width="390" alt="The laser walkway"><br><sub>Orange lasers: keep moving</sub></td>
+ <td align="center"><img src="docs/shooting.png" width="390" alt="A shooting puzzle"><br><sub>A shooting puzzle</sub></td>
+ </tr>
+ <tr>
+ <td align="center"><img src="docs/cooking.png" width="390" alt="Mettaton's cooking show"><br><sub>Cooking with a killer robot</sub></td>
+ <td align="center"><img src="docs/jetpack.png" width="390" alt="The jetpack"><br><sub>Up the counter with the jetpack</sub></td>
+ </tr>
</table>
## How to play
@@ -111,6 +124,8 @@ Snowdin brings new things: when Papyrus turns your SOUL blue, it falls to the bo
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. The Tem Shop is the one shop that buys what you carry. When Undyne turns your SOUL green, it can't move: turn its shield with the arrows to block her spears. She can't be spared: run, and she'll chase you.
+In Hotland, conveyor belts carry you and steam vents throw you over the lava (the one in the middle of the puzzle hub turns each time). Keep moving through orange lasers and stand still for blue ones. In a shooting puzzle, the arrows push every dark block one cell and Z shoots: break your way to the target in two shots. In Mettaton's quiz, move your SOUL onto an answer and press OK; Alphys signals the right one. Alphys's upgrade puts the Dimensional Box in your phone's CELL.
+
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
@@ -126,7 +141,7 @@ 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, Snowdin and Waterfall, for now:** Hotland's first room ends the game, on a screen that says the rest of the Underground is still to come. Hotland, the CORE and New Home come next, one at a time.
+* **The Ruins, Snowdin, Waterfall and Hotland's first floor, for now:** the elevator by the CORE's view ends the game, on a screen that says the rest of the Underground is still to come. The rest of Hotland, the CORE and New Home come next, one at a time.
* **No music or sound:** the calculator has no speaker.
* **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.
diff --git a/games/undertale/docs/cooking.png b/games/undertale/docs/cooking.png
new file mode 100644
index 00000000..38d7c59f
Binary files /dev/null and b/games/undertale/docs/cooking.png differ
diff --git a/games/undertale/docs/jetpack.png b/games/undertale/docs/jetpack.png
new file mode 100644
index 00000000..3883b9e0
Binary files /dev/null and b/games/undertale/docs/jetpack.png differ
diff --git a/games/undertale/docs/lab.png b/games/undertale/docs/lab.png
new file mode 100644
index 00000000..1a02a3e5
Binary files /dev/null and b/games/undertale/docs/lab.png differ
diff --git a/games/undertale/docs/lasers.png b/games/undertale/docs/lasers.png
new file mode 100644
index 00000000..57283a90
Binary files /dev/null and b/games/undertale/docs/lasers.png differ
diff --git a/games/undertale/docs/quiz.png b/games/undertale/docs/quiz.png
new file mode 100644
index 00000000..0b7820c1
Binary files /dev/null and b/games/undertale/docs/quiz.png differ
diff --git a/games/undertale/docs/shooting.png b/games/undertale/docs/shooting.png
new file mode 100644
index 00000000..e094e6f0
Binary files /dev/null and b/games/undertale/docs/shooting.png differ
diff --git a/games/undertale/src/battle.c b/games/undertale/src/battle.c
index 0a2b4c3a..4ce2f1c1 100644
--- a/games/undertale/src/battle.c
+++ b/games/undertale/src/battle.c
@@ -12,9 +12,20 @@
#include "monsters.h"
#include "world.h"
-void flowey_battle_start(void); /* flowey.c */
-void flowey_battle_update(uint32_t keys, uint32_t pressed);
-void flowey_battle_draw(void);
+/* the battles that play their own way: Flowey's first (flowey.c), Mettaton's shows and a laser's alarm (htshows.c) */
+typedef struct {
+ int form;
+ void (*start)(void);
+ void (*update)(uint32_t keys, uint32_t pressed);
+ void (*draw)(void);
+} Script;
+static const Script scripts[] = {
+ {FORM_FLOWEY, flowey_battle_start, flowey_battle_update, flowey_battle_draw},
+ {FORM_MTT_QUIZ, quiz_start, quiz_update, quiz_draw},
+ {FORM_MTT_COOK, cook_start, cook_update, cook_draw},
+ {FORM_LASERS, lasers_start, lasers_update, lasers_draw},
+};
+static const Script *script;
Battle bt;
static bool over = true;
@@ -113,7 +124,9 @@ void battle_start(int form) {
bt.t = 0;
say(form_text(form));
bt.w.finished = true; /* (typed once the intro is over) */
- if (form == FORM_FLOWEY) flowey_battle_start();
+ script = NULL;
+ for (unsigned i = 0; i < sizeof scripts / sizeof scripts[0]; i++)
+ if (scripts[i].form == form) script = &scripts[i], script->start();
over = false;
bullets_clear();
}
@@ -425,7 +438,7 @@ void battle_update(uint32_t keys, uint32_t pressed) {
bt.t++;
box_step();
if (bt.scripted && bt.phase != P_INTRO) {
- flowey_battle_update(keys, pressed);
+ script->update(keys, pressed);
if (bt.result == BR_SCRIPTED) battle_end(BR_SCRIPTED);
return;
}
@@ -582,7 +595,7 @@ static void draw_monster(Monster *m, int i) {
(void)i;
}
-static void draw_hud(void) {
+void battle_draw_hud(void) {
char s[40];
gfx_text(FONT_SMALL, 15, 201, sv.name, C_WHITE, 255);
snprintf(s, sizeof s, "LV %d", sv.lv);
@@ -596,7 +609,7 @@ static void draw_hud(void) {
gfx_text(FONT_SMALL, 137 + w + 8, 201, s, C_WHITE, 255);
}
-static void draw_buttons(void) {
+void battle_draw_buttons(void) {
static const uint16_t spr[4] = {SPR_FIGHTBT, SPR_TALKBT, SPR_ITEMBT, SPR_SPAREBT};
bool menu = bt.phase >= P_MENU && bt.phase <= P_MERCY;
for (int i = 0; i < 4; i++) {
@@ -740,7 +753,7 @@ void battle_draw(void) {
return;
}
if (bt.scripted) {
- flowey_battle_draw();
+ script->draw();
return;
}
gfx_sprite(SPR_BATTLEBG, 0, 0, 0, 0, 255);
@@ -775,6 +788,6 @@ void battle_draw(void) {
}
draw_damage();
draw_bubble();
- draw_hud();
- draw_buttons();
+ battle_draw_hud();
+ battle_draw_buttons();
}
diff --git a/games/undertale/src/battle.h b/games/undertale/src/battle.h
index 97d1e857..006f93a9 100644
--- a/games/undertale/src/battle.h
+++ b/games/undertale/src/battle.h
@@ -132,6 +132,7 @@ typedef struct Battle {
int result;
int exp_won, gold_won;
int kr; /* (for later) */
+ int df_loss; /* DEFENSE lost this battle (Vulkin's hugs) */
int16_t state[8]; /* the formation's own */
int32_t as[16]; /* the attack's own */
int talk_i; /* whose bubble shows */
@@ -168,6 +169,23 @@ int board_cx(void), board_cy(void); /* its middle (pixels) */
int soul_x(void), soul_y(void); /* (pixels) */
int damage_to_player(int at);
int count_alive(void);
+/* for the battles that play their own way (their draw) */
+void battle_draw_hud(void);
+void battle_draw_buttons(void);
+/* those battles (flowey.c, htshows.c): set up, each frame (bt.result = BR_SCRIPTED ends it), drawn */
+void flowey_battle_start(void);
+void flowey_battle_update(uint32_t keys, uint32_t pressed);
+void flowey_battle_draw(void);
+void quiz_start(void);
+void quiz_update(uint32_t keys, uint32_t pressed);
+void quiz_draw(void);
+void cook_start(void);
+void cook_update(uint32_t keys, uint32_t pressed);
+void cook_draw(void);
+int cook_won(void); /* the substitute reached in time */
+void lasers_start(void);
+void lasers_update(uint32_t keys, uint32_t pressed);
+void lasers_draw(void);
/* the monsters and formations (monsters.c) */
const MonDef *mon_def(int id);
diff --git a/games/undertale/src/bullets.c b/games/undertale/src/bullets.c
index 9672fd3f..93af0b39 100644
--- a/games/undertale/src/bullets.c
+++ b/games/undertale/src/bullets.c
@@ -153,7 +153,7 @@ int damage_to_player(int at) {
int dmg = at;
for (int i = 0; i < 8; i++)
if (sv.maxhp >= steps[i]) dmg++;
- int df = sv.df - 10 + armor_df();
+ int df = sv.df - 10 + armor_df() - bt.df_loss;
dmg -= (df + 2) / 5;
return dmg < 1 ? 1 : dmg;
}
diff --git a/games/undertale/src/data.bin b/games/undertale/src/data.bin
index 814b33a8..b23083dc 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 3854ddbb..a8b2be0f 100644
--- a/games/undertale/src/data.h
+++ b/games/undertale/src/data.h
@@ -208,61 +208,80 @@
#define SPR_TUTU 194
#define SPR_ARTIFACT 195
#define SPR_ECHO_OW 196
-#define SPR_UNDYNE_FALLEN 197
-#define SPR_SPEAR 198
-#define SPR_ARROW 199
-#define SPR_UNDYNE_B 200
-#define SPR_NOTE 201
-#define SPR_DROP 202
-#define SPR_ARM 203
-#define SPR_DEBRIS 204
-#define SPR_AARON_B 205
-#define SPR_AARON_HURT 206
-#define SPR_WOSHUA_B 207
-#define SPR_WOSHUA_HURT 208
-#define SPR_MOLDBYGG_B 209
-#define SPR_SHYREN_B 210
-#define SPR_SHYREN_TURNED 211
-#define SPR_INTROIMAGE 212
-#define SPR_INTROLAST 213
-#define SPR_UNDERTALETITLE 214
-#define SPR_GAMEOVERBG 215
-#define SPR_FACE_TORIELTALK 216
-#define SPR_FACE_TORIELTALKSIDE 217
-#define SPR_FACE_TORIELHAPPYTALK 218
-#define SPR_FACE_TORIELWHAT 219
-#define SPR_FACE_TORIELWHATSIDE 220
-#define SPR_FACE_TORIELMAD 221
-#define SPR_FACE_TORIELCOLD 222
-#define SPR_FACE_TORIELSURPRISED 223
-#define SPR_FACE_TORIELEMBARRASSED 224
-#define SPR_FACE_TORIELGLASSES 225
-#define SPR_FACE_TORIELREVENGETALK 226
-#define SPR_FACE_TORIELSCARED 227
-#define SPR_FACE_TORIELBLINK 228
-#define SPR_FACE_TORIELHAPPYBLINK 229
-#define SPR_FACE_TORIELBODY 230
-#define SPR_FACE_SANS 231
-#define SPR_FACE_SANSCHUCKLE 232
-#define SPR_FACE_SANSWINK 233
-#define SPR_FACE_PAPYRUS 234
-#define SPR_FACE_PAPYRUSEVIL 235
-#define SPR_FACE_PAPYRUSLAUGH 236
-#define SPR_FACE_PAPYRUSMAD 237
-#define SPR_FACE_PAPYRUSSIDE 238
-#define SPR_FLOWEYNICE 239
-#define SPR_FLOWEYNICESIDE 240
-#define SPR_FLOWEYSASSY 241
-#define SPR_FLOWEYEVIL 242
-#define SPR_FLOWEYGRIN 243
-#define SPR_FLOWEYPLAIN 244
-#define SPR_FLOWEYPISSED 245
-#define SPR_FLOWEYWINK 246
-#define SPR_FLOWEYLAUGH 247
-#define SPR_FLOWEYHURT 248
-#define SPR_FLOWEYTORIEL 249
-#define SPR_FLOWEYTORIEL2 250
-#define SPR_FLOWEYSIDESHOCK 251
+#define SPR_ALPHYS_OW 197
+#define SPR_MTT_OW 198
+#define SPR_MTT_B 199
+#define SPR_RGUARDS_OW 200
+#define SPR_VENT_D 201
+#define SPR_VENT_U 202
+#define SPR_VENT_L 203
+#define SPR_VENT_R 204
+#define SPR_BURNTPAN 205
+#define SPR_VULKIN_B 206
+#define SPR_VULKIN_HURT 207
+#define SPR_TSUNDER_B 208
+#define SPR_PYROPE_B 209
+#define SPR_PYROPE_HURT 210
+#define SPR_UNDYNE_FALLEN 211
+#define SPR_SPEAR 212
+#define SPR_ARROW 213
+#define SPR_PLANE 214
+#define SPR_BOMB 215
+#define SPR_CLOUD 216
+#define SPR_BOLT 217
+#define SPR_UNDYNE_B 218
+#define SPR_NOTE 219
+#define SPR_DROP 220
+#define SPR_ARM 221
+#define SPR_DEBRIS 222
+#define SPR_AARON_B 223
+#define SPR_AARON_HURT 224
+#define SPR_WOSHUA_B 225
+#define SPR_WOSHUA_HURT 226
+#define SPR_MOLDBYGG_B 227
+#define SPR_SHYREN_B 228
+#define SPR_SHYREN_TURNED 229
+#define SPR_INTROIMAGE 230
+#define SPR_INTROLAST 231
+#define SPR_UNDERTALETITLE 232
+#define SPR_GAMEOVERBG 233
+#define SPR_FACE_TORIELTALK 234
+#define SPR_FACE_TORIELTALKSIDE 235
+#define SPR_FACE_TORIELHAPPYTALK 236
+#define SPR_FACE_TORIELWHAT 237
+#define SPR_FACE_TORIELWHATSIDE 238
+#define SPR_FACE_TORIELMAD 239
+#define SPR_FACE_TORIELCOLD 240
+#define SPR_FACE_TORIELSURPRISED 241
+#define SPR_FACE_TORIELEMBARRASSED 242
+#define SPR_FACE_TORIELGLASSES 243
+#define SPR_FACE_TORIELREVENGETALK 244
+#define SPR_FACE_TORIELSCARED 245
+#define SPR_FACE_TORIELBLINK 246
+#define SPR_FACE_TORIELHAPPYBLINK 247
+#define SPR_FACE_TORIELBODY 248
+#define SPR_FACE_SANS 249
+#define SPR_FACE_SANSCHUCKLE 250
+#define SPR_FACE_SANSWINK 251
+#define SPR_FACE_PAPYRUS 252
+#define SPR_FACE_PAPYRUSEVIL 253
+#define SPR_FACE_PAPYRUSLAUGH 254
+#define SPR_FACE_PAPYRUSMAD 255
+#define SPR_FACE_PAPYRUSSIDE 256
+#define SPR_FACE_ALPHYS 257
+#define SPR_FLOWEYNICE 258
+#define SPR_FLOWEYNICESIDE 259
+#define SPR_FLOWEYSASSY 260
+#define SPR_FLOWEYEVIL 261
+#define SPR_FLOWEYGRIN 262
+#define SPR_FLOWEYPLAIN 263
+#define SPR_FLOWEYPISSED 264
+#define SPR_FLOWEYWINK 265
+#define SPR_FLOWEYLAUGH 266
+#define SPR_FLOWEYHURT 267
+#define SPR_FLOWEYTORIEL 268
+#define SPR_FLOWEYTORIEL2 269
+#define SPR_FLOWEYSIDESHOCK 270
#define AREA_RUINS 0
#define AREA_SNOWDIN 1
#define AREA_SNOWTOWN 2
@@ -395,10 +414,23 @@
#define ROOM_WF_NORTH 124
#define ROOM_WF_HOTGATE 125
#define ROOM_HT_ENTRANCE 126
+#define ROOM_HT_LABFRONT 127
+#define ROOM_HT_RIVER 128
+#define ROOM_HT_LAB 129
+#define ROOM_HT_LABEXIT 130
+#define ROOM_HT_BELT1 131
+#define ROOM_HT_BELT2 132
+#define ROOM_HT_MAGMA 133
+#define ROOM_HT_PAN 134
+#define ROOM_HT_LASERS 135
+#define ROOM_HT_HUB 136
+#define ROOM_HT_VENTISLE 137
+#define ROOM_HT_COOKING 138
+#define ROOM_HT_COREVIEW 139
#define FONT_MAIN 0
#define FONT_MENU 1
#define FONT_SMALL 2
-#define NUM_SPRITES 252
-#define NUM_ROOMS 127
+#define NUM_SPRITES 271
+#define NUM_ROOMS 140
#define NUM_FONTS 3
#endif
diff --git a/games/undertale/src/events.c b/games/undertale/src/events.c
index 169d0945..8ab2f0ce 100644
--- a/games/undertale/src/events.c
+++ b/games/undertale/src/events.c
@@ -5,6 +5,7 @@
#include "events.h"
#include "battle.h"
#include "game.h"
+#include "hotland.h"
#include "menu.h"
#include "ruins.h"
#include "snowdin.h"
@@ -117,5 +118,7 @@ int event_run(Ev *c) {
if (r >= 0) return r;
r = wf3_event(c);
if (r >= 0) return r;
+ r = ht1_event(c);
+ if (r >= 0) return r;
return 1;
}
diff --git a/games/undertale/src/events.h b/games/undertale/src/events.h
index 6e1f82b0..8484ef7b 100644
--- a/games/undertale/src/events.h
+++ b/games/undertale/src/events.h
@@ -11,7 +11,9 @@ enum {
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,
- ACTOR_MADDUMMY, ACTOR_BIRD, ACTOR_TEMMIE
+ ACTOR_MADDUMMY, ACTOR_BIRD, ACTOR_TEMMIE,
+ /* Hotland */
+ ACTOR_ALPHYS, ACTOR_METTATON, ACTOR_GUARDS, ACTOR_VENT, ACTOR_LASER
};
enum {
@@ -42,8 +44,9 @@ enum {
/* wf2.c */
EV_DUMP_WAKE, EV_COOLER, EV_MAD_DUMMY, EV_NAPSTA_ROOM, EV_LOCKED_HOUSE, EV_SNAILS, EV_GERSON, EV_TEM_SHOP, EV_TEMMIE,
/* wf3.c */
- EV_LANTERN, EV_DEADEND, EV_MK_CHASM, EV_ARENA, EV_UNDYNE_CATCH, EV_PAP_NEON, EV_HOT_UNDYNE, EV_HOT_COOLER,
- EV_HOT_END,
+ EV_DEADEND, EV_MK_CHASM, EV_ARENA, EV_UNDYNE_CATCH, EV_PAP_NEON, EV_HOT_UNDYNE, EV_HOT_COOLER,
+ /* ht1.c */
+ EV_HT_LAB, EV_HT_FRIDGE, EV_VENT, EV_HT_CALL, EV_SHOOT, EV_HT_COOK, EV_HT_ELEVATOR, EV_LASER_HIT, EV_HT_ITEM,
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 ada941ab..6fbc4ead 100644
--- a/games/undertale/src/flags.h
+++ b/games/undertale/src/flags.h
@@ -123,7 +123,20 @@ enum {
F_UNDYNE, /* her fight: 1 fled (she chases), 2 killed, 3 fallen in the heat, 4 given water */
F_WATER_CUP, /* a cup of the cooler's water: 1 carried, 2 poured */
F_PAP_NEON, /* Papyrus's call by the neon sign */
- F_HOTLAND, /* Hotland reached (where the game now ends) */
+ F_HOTLAND, /* (unused: Hotland's first room once ended the game) */
+ /* Hotland */
+ F_HT_LAB, /* the Lab: 1 Alphys met (Mettaton's quiz), 2 the phone upgraded */
+ F_HT_NOODLES, /* the Instant Noodles from Alphys's fridge */
+ F_HT_PAN, /* the Burnt Pan taken */
+ F_HT_CALL_LASER, /* Alphys's calls: the lasers, the puzzle hub, the vents past the door, the CORE */
+ F_HT_CALL_HUB,
+ F_HT_CALL_ISLE,
+ F_HT_CALL_CORE,
+ F_HT_PUZ_R, /* the shooting puzzles solved: the right one, the left one */
+ F_HT_PUZ_L,
+ F_HT_BLUE_OFF, /* the blue laser before the left puzzle switched off */
+ F_HT_COOK, /* the cooking show: 1 the substitute reached, 2 out of time */
+ F_HT_FLOOR1, /* the elevator up from Hotland's first floor reached (where the game now ends) */
FLAG_COUNT = 256
};
#endif
diff --git a/games/undertale/src/game.c b/games/undertale/src/game.c
index 6133943c..cb0ac6a6 100644
--- a/games/undertale/src/game.c
+++ b/games/undertale/src/game.c
@@ -4,6 +4,7 @@
#include "battle.h"
#include "event.h"
#include "game.h"
+#include "shoot.h"
#include "shop.h"
#include "gfx.h"
#include "items.h"
@@ -97,11 +98,13 @@ void game_frame(uint32_t keys) {
prev_keys = keys;
g_frame++;
if (keys & K_HOME) {
- if (g_mode == MODE_WORLD || g_mode == MODE_MENU || g_mode == MODE_BATTLE || g_mode == MODE_SHOP) game_quit_save();
+ if (g_mode == MODE_WORLD || g_mode == MODE_MENU || g_mode == MODE_BATTLE || g_mode == MODE_SHOP || g_mode == MODE_SHOOT)
+ game_quit_save();
g_running = false;
return;
}
- if (g_mode == MODE_WORLD || g_mode == MODE_BATTLE || g_mode == MODE_MENU || g_mode == MODE_SHOP) sv.time++;
+ if (g_mode == MODE_WORLD || g_mode == MODE_BATTLE || g_mode == MODE_MENU || g_mode == MODE_SHOP || g_mode == MODE_SHOOT)
+ sv.time++;
switch (g_mode) {
case MODE_WORLD:
world_update(keys, pressed);
@@ -116,6 +119,10 @@ void game_frame(uint32_t keys) {
shop_update(keys, pressed);
if (g_mode == MODE_WORLD) event_update();
break;
+ case MODE_SHOOT:
+ shoot_update(keys, pressed);
+ if (g_mode == MODE_WORLD) event_update();
+ break;
default:
menu_update(keys, pressed);
if (g_mode == MODE_WORLD) event_update();
@@ -140,6 +147,9 @@ void game_draw(void) {
case MODE_SHOP:
shop_draw();
break;
+ case MODE_SHOOT:
+ shoot_draw();
+ break;
default:
menu_draw();
break;
diff --git a/games/undertale/src/game.h b/games/undertale/src/game.h
index cc9ec665..a9e180a4 100644
--- a/games/undertale/src/game.h
+++ b/games/undertale/src/game.h
@@ -14,7 +14,7 @@ static inline int min_i(int a, int b) { return a < b ? a : b; }
static inline int max_i(int a, int b) { return a > b ? a : b; }
enum { MODE_TITLE, MODE_NAME, MODE_WORLD, MODE_BATTLE, MODE_MENU, MODE_SAVE, MODE_GAMEOVER, MODE_INTRO, MODE_END,
- MODE_SHOP };
+ MODE_SHOP, MODE_SHOOT };
#define NUM_ITEMS 8
typedef struct {
diff --git a/games/undertale/src/hotland.h b/games/undertale/src/hotland.h
new file mode 100644
index 00000000..8b69b216
--- /dev/null
+++ b/games/undertale/src/hotland.h
@@ -0,0 +1,9 @@
+/* Undertale: Hotland (ht1.c: its first floor), its monsters (htmon.c), Mettaton's shows (htshows.c). */
+#ifndef UT_HOTLAND_H
+#define UT_HOTLAND_H
+#include "event.h"
+void ht1_setup(int room, int from);
+int ht1_event(Ev *c); /* -1: not one of its */
+void ht1_update(void); /* the belts, the lasers */
+void ht1_draw(void); /* under everything: the lasers, the turning vents' arrows */
+#endif
diff --git a/games/undertale/src/ht1.c b/games/undertale/src/ht1.c
new file mode 100644
index 00000000..2279de8f
--- /dev/null
+++ b/games/undertale/src/ht1.c
@@ -0,0 +1,440 @@
+/* Hotland, its first floor: the crossroads before the Lab, Alphys and Mettaton's quiz, the conveyor belts, the
+ * Magma Chamber's steam vents and the burnt pan, the laser walkway, the shooting puzzles that open the door, the
+ * vents over the lava, Mettaton's cooking show and the elevator by the CORE's view. (As the Undertale Wiki describes
+ * them; what they say is ours, in short.) */
+#include <stddef.h>
+#include "battle.h"
+#include "event.h"
+#include "events.h"
+#include "game.h"
+#include "gfx.h"
+#include "hotland.h"
+#include "items.h"
+#include "menu.h"
+#include "monsters.h"
+#include "save.h"
+#include "shoot.h"
+#include "snowdin.h"
+#include "world.h"
+
+static void gone(Obj *o) { o->kind = OBJ_NONE; }
+static Obj *thing(int x, int y, int w, int h, int event, int name, int arg) {
+ Obj *o = obj_trigger(x, y, w, h, event, name);
+ if (o) o->flags = OF_TALK | OF_SOLID, o->arg = (int16_t)arg;
+ return o;
+}
+static Obj *obj_alphys(int x, int y, int dir) {
+ static const uint16_t s[4] = {SPR_ALPHYS_OW, SPR_ALPHYS_OW, SPR_ALPHYS_OW, SPR_ALPHYS_OW};
+ return obj_npc(ACTOR_ALPHYS, s, x, y, dir, 0);
+}
+static Obj *obj_mtt(int x, int y) {
+ static const uint16_t s[4] = {SPR_MTT_OW, SPR_MTT_OW, SPR_MTT_OW, SPR_MTT_OW};
+ Obj *o = obj_npc(ACTOR_METTATON, s, x, y, DIR_DOWN, 0);
+ if (o) o->flags |= OF_ANIM, o->flags &= (uint16_t)~OF_SOLID, o->anim_speed = 5;
+ return o;
+}
+
+/* ---------------------------------------------------------------- the conveyor belts */
+/* each pushes Frisk along it while Frisk's feet are on it, where there's floor */
+typedef struct {
+ int16_t room, x, y, w, h;
+ int8_t dx, dy;
+} Belt;
+static const Belt belts[] = {
+ /* the first room: up the left belt, down the right one */
+ {ROOM_HT_BELT1, 2904, 5450, 36, 440, 0, -2}, {ROOM_HT_BELT1, 2980, 5450, 36, 440, 0, 2},
+ /* the second: up the left side, down the right */
+ {ROOM_HT_BELT2, 2840, 4730, 120, 450, 0, -1}, {ROOM_HT_BELT2, 2980, 4730, 120, 450, 0, 1},
+};
+static void belts_update(void) {
+ if (event_running()) return;
+ int fx = pl.x + 10, fy = pl.y + 24;
+ for (unsigned i = 0; i < sizeof belts / sizeof belts[0]; i++) {
+ const Belt *b = &belts[i];
+ if (b->room != g_room || fx < b->x || fx >= b->x + b->w || fy < b->y || fy >= b->y + b->h) continue;
+ if (world_walkable(pl.x + 3 + b->dx, pl.y + 20 + b->dy, 14, 9, -1)) pl.x = (int16_t)(pl.x + b->dx), pl.y = (int16_t)(pl.y + b->dy);
+ }
+}
+
+/* ---------------------------------------------------------------- the steam vents */
+/* stepping on a grate, Frisk is blown its way, over the lava, to (tx, ty) (Frisk's top-left: never on another
+ * vent's grate, but where a chain of them is meant); a vent that turns (dir -1: the hub's, a quarter clockwise each
+ * time it's used; -2: the pan's, left and right all the time) has a landing each way */
+typedef struct {
+ int16_t room, gx, gy;
+ int8_t dir;
+ int16_t t[4][2]; /* by DIR_*: down, up, left, right */
+} Vent;
+static const Vent vents[] = {
+ {ROOM_HT_MAGMA, 3120, 4000, DIR_DOWN, {{3120, 4110}}},
+ {ROOM_HT_MAGMA, 3362, 4000, DIR_LEFT, {[DIR_LEFT] = {3241, 3986}}},
+ {ROOM_HT_MAGMA, 3503, 4060, DIR_RIGHT, {[DIR_RIGHT] = {3580, 4060}}},
+ {ROOM_HT_MAGMA, 3420, 4180, DIR_UP, {[DIR_UP] = {3420, 4048}}},
+ {ROOM_HT_MAGMA, 3225, 4240, DIR_RIGHT, {[DIR_RIGHT] = {3302, 4226}}},
+ {ROOM_HT_MAGMA, 3325, 4240, DIR_LEFT, {[DIR_LEFT] = {3244, 4226}}},
+ {ROOM_HT_MAGMA, 3525, 4240, DIR_LEFT, {[DIR_LEFT] = {3421, 4226}}},
+ {ROOM_HT_PAN, 3620, 4480, -2, {[DIR_LEFT] = {3501, 4466}, [DIR_RIGHT] = {3739, 4466}}},
+ {ROOM_HT_HUB, 4820, 3620, -1, {{4820, 3680}, {4820, 3490}, {4700, 3610}, {4945, 3610}}},
+ {ROOM_HT_HUB, 4820, 3560, DIR_DOWN, {{4795, 3592}}},
+ {ROOM_HT_HUB, 4740, 3620, DIR_RIGHT, {[DIR_RIGHT] = {4785, 3610}}},
+ {ROOM_HT_HUB, 4900, 3620, DIR_LEFT, {[DIR_LEFT] = {4855, 3610}}},
+ {ROOM_HT_VENTISLE, 4940, 3120, DIR_RIGHT, {[DIR_RIGHT] = {5051, 3106}}},
+ {ROOM_HT_VENTISLE, 5060, 3120, DIR_RIGHT, {[DIR_RIGHT] = {5171, 3106}}},
+ {ROOM_HT_VENTISLE, 5180, 3120, DIR_RIGHT, {[DIR_RIGHT] = {5312, 3106}}},
+};
+#define NVENTS ((int)(sizeof vents / sizeof vents[0]))
+/* the way a vent blows now */
+static int hub_turns;
+static int vent_dir(const Vent *v) {
+ static const uint8_t round[4] = {DIR_UP, DIR_RIGHT, DIR_DOWN, DIR_LEFT};
+ if (v->dir == -1) return round[hub_turns % 4];
+ if (v->dir == -2) return (g_frame / 20) % 2 ? DIR_RIGHT : DIR_LEFT;
+ return v->dir;
+}
+static void vents_setup(void) {
+ for (int i = 0; i < NVENTS; i++) {
+ const Vent *v = &vents[i];
+ if (v->room != g_room) continue;
+ Obj *o = obj_trigger(v->gx + 4, v->gy + 4, 12, 12, EV_VENT, ACTOR_VENT);
+ if (o) o->arg = (int16_t)i;
+ }
+}
+
+/* ---------------------------------------------------------------- the lasers */
+/* the walkway's sweep to and fro across it: an orange one hurts if Frisk stands in it, a blue one if Frisk moves */
+typedef struct {
+ int16_t room, x, y, h, swing;
+ uint8_t blue;
+} Laser;
+static const Laser lasers[] = {
+ {ROOM_HT_LASERS, 3258, 3796, 62, 30, 0}, {ROOM_HT_LASERS, 3425, 3796, 62, 40, 1},
+ {ROOM_HT_LASERS, 3567, 3796, 62, 30, 0}, {ROOM_HT_LASERS, 3717, 3796, 62, 40, 1},
+ {ROOM_HT_LASERS, 3840, 3796, 62, 30, 0}, {ROOM_HT_LASERS, 3958, 3796, 62, 40, 1},
+};
+static int laser_cool;
+static int laser_x(int i) {
+ const Laser *l = &lasers[i];
+ int ph = (int)((g_frame * (l->blue ? 3 : 4) + (uint32_t)i * 40) % 256);
+ return l->x + l->swing * gfx_sin(ph) / 1024;
+}
+static void lasers_watch(void) {
+ if (laser_cool) laser_cool--;
+ if (event_running() || laser_cool) return;
+ for (int i = 0; i < (int)(sizeof lasers / sizeof lasers[0]); i++) {
+ const Laser *l = &lasers[i];
+ if (l->room != g_room) continue;
+ int x = laser_x(i);
+ if (pl.x + 3 > x + 1 || pl.x + 17 < x - 1 || pl.y + 29 < l->y || pl.y + 20 > l->y + l->h) continue;
+ if (l->blue ? pl.moving : !pl.moving) {
+ event_start(EV_LASER_HIT, NULL);
+ return;
+ }
+ }
+}
+/* the blue one in front of the left puzzle, that Alphys switches off */
+#define BLUE_X 4380
+#define BLUE_Y 3584
+#define BLUE_W 40
+
+void ht1_draw(void) {
+ if (world_room_info()->area != AREA_HOTLAND) return;
+ for (int i = 0; i < (int)(sizeof lasers / sizeof lasers[0]); i++) {
+ const Laser *l = &lasers[i];
+ if (l->room != g_room) continue;
+ uint16_t c = l->blue ? rgb565(0x14A9FF) : rgb565(0xFCA600);
+ gfx_rect(laser_x(i) - 1 - cam_x, l->y - cam_y, 3, l->h, c, (g_frame / 2) % 2 ? 255 : 200);
+ }
+ if (g_room == ROOM_HT_HUB && !flag(F_HT_BLUE_OFF))
+ gfx_rect(BLUE_X - cam_x, BLUE_Y - cam_y, BLUE_W, 3, rgb565(0x14A9FF), (g_frame / 2) % 2 ? 255 : 200);
+ /* the turning vents' arrows, over the map's */
+ static const uint16_t arrow[4] = {SPR_VENT_D, SPR_VENT_U, SPR_VENT_L, SPR_VENT_R};
+ for (int i = 0; i < NVENTS; i++) {
+ const Vent *v = &vents[i];
+ if (v->room == g_room && v->dir < 0) gfx_sprite(arrow[vent_dir(v)], 0, v->gx - cam_x, v->gy - cam_y, 0, 255);
+ }
+}
+
+void ht1_update(void) {
+ if (world_room_info()->area != AREA_HOTLAND) return;
+ belts_update();
+ lasers_watch();
+}
+
+/* ---------------------------------------------------------------- the rooms */
+void ht1_setup(int room, int from) {
+ (void)from;
+ if (room < ROOM_HT_LABFRONT || room > ROOM_HT_COREVIEW) return;
+ vents_setup();
+ switch (room) {
+ case ROOM_HT_LABFRONT: {
+ obj_save(1045, 6243, "* (The heat of Hotland fills you with determination.)");
+ Obj *g = obj_deco(SPR_RGUARDS_OW, 1012, 6146, true);
+ if (g) g->name = ACTOR_GUARDS, obj_set_box(g, 0, 30, 74, 24);
+ obj_sign(1010, 6176, 80, 30, "* (Two Royal Guards stand in front of the elevator.)|* Nobody goes up.\n* Not until the captain's back.");
+ obj_sign(1290, 6150, 60, 30, "* (The Lab. Its door is open.)");
+ break;
+ }
+ case ROOM_HT_RIVER:
+ obj_sign(1010, 6440, 50, 60, "* (Someone in a hood waits by a boat, humming.)\n* (Maybe they'll give you a ride some other time.)");
+ break;
+ case ROOM_HT_LAB:
+ if (!flag(F_HT_LAB)) obj_trigger(1450, 5860, 16, 460, EV_HT_LAB, ACTOR_TRIGGER);
+ thing(2025, 6175, 34, 64, EV_HT_FRIDGE, ACTOR_ITEM, 0);
+ obj_sign(1775, 6140, 108, 90, "* (A huge screen.)\n* (It shows you, standing right here.)");
+ obj_sign(2317, 6150, 50, 75, "* (The door is locked.)\n* (Someone inside is humming.)");
+ obj_sign(1880, 5920, 60, 40, "* (Shelves stuffed with comics.)\n* (Most of them are about magical girls.)");
+ obj_sign(2050, 5920, 90, 50, "* (A bed, half buried in figurines.)");
+ break;
+ case ROOM_HT_MAGMA:
+ obj_save(2968, 4226, "* (The bubbling magma fills you with determination.)");
+ break;
+ case ROOM_HT_PAN:
+ if (!flag(F_HT_PAN)) {
+ Obj *p = obj_deco(SPR_BURNTPAN, 3476, 4468, false);
+ if (p) p->name = ACTOR_ITEM;
+ Obj *t = obj_trigger(3472, 4462, 26, 26, EV_HT_ITEM, ACTOR_ITEM);
+ if (t) t->flags = OF_TALK;
+ }
+ break;
+ case ROOM_HT_LASERS:
+ if (!flag(F_HT_CALL_LASER)) {
+ Obj *t = obj_trigger(3180, 3780, 12, 90, EV_HT_CALL, ACTOR_TRIGGER);
+ if (t) t->arg = 0;
+ }
+ break;
+ case ROOM_HT_HUB:
+ if (!flag(F_HT_CALL_HUB)) {
+ Obj *t = obj_trigger(4770, 3700, 120, 12, EV_HT_CALL, ACTOR_TRIGGER);
+ if (t) t->arg = 1;
+ }
+ if (!flag(F_HT_BLUE_OFF)) {
+ Obj *b = obj_trigger(BLUE_X, BLUE_Y - 6, BLUE_W, 12, EV_NONE, ACTOR_LASER);
+ if (b) b->flags = OF_SOLID;
+ Obj *t = obj_trigger(4380, 3560, 60, 100, EV_HT_CALL, ACTOR_TRIGGER2);
+ if (t) t->arg = 2;
+ }
+ thing(4372, 3410, 34, 34, EV_SHOOT, ACTOR_ITEM, SHOOT_LEFT);
+ thing(5250, 3410, 34, 34, EV_SHOOT, ACTOR_ITEM, SHOOT_RIGHT);
+ if (!(flag(F_HT_PUZ_L) && flag(F_HT_PUZ_R))) {
+ Obj *d = obj_trigger(4796, 3398, 68, 16, EV_NONE, ACTOR_DOOR);
+ if (d) d->flags = OF_SOLID;
+ obj_sign(4796, 3412, 68, 20, "* (The door is locked.)\n* (Both puzzles have to be solved.)");
+ }
+ obj_sign(4278, 3570, 26, 110, "* Phew, the laser's off!\n* ...now what do I do?|* I guess I'll keep standing here.");
+ obj_sign(5236, 3666, 60, 40, "* Did you catch Mettaton's show?\n* That human looked so real!|* His fan club is HUGE, you know.");
+ obj_sign(5286, 3432, 24, 24, "* My co-workers won't help me\n with this puzzle.|* Do I even WANT to go to work?");
+ break;
+ case ROOM_HT_VENTISLE:
+ if (!flag(F_HT_CALL_ISLE)) {
+ Obj *t = obj_trigger(4800, 3150, 60, 12, EV_HT_CALL, ACTOR_TRIGGER);
+ if (t) t->arg = 3;
+ }
+ break;
+ case ROOM_HT_COOKING:
+ if (!flag(F_HT_COOK)) {
+ obj_mtt(5662, 3138);
+ obj_trigger(5330, 3000, 12, 260, EV_HT_COOK, ACTOR_TRIGGER);
+ }
+ obj_sign(5500, 3005, 110, 85, "* (The set's kitchen: a fridge, an oven, a counter.)");
+ break;
+ case ROOM_HT_COREVIEW:
+ if (!flag(F_HT_CALL_CORE)) {
+ Obj *t = obj_trigger(6300, 3080, 12, 120, EV_HT_CALL, ACTOR_TRIGGER);
+ if (t) t->arg = 4;
+ }
+ thing(6950, 3070, 76, 48, EV_HT_ELEVATOR, ACTOR_DOOR, 0);
+ break;
+ }
+}
+
+/* ---------------------------------------------------------------- the events */
+static int ev_lab(Ev *c) {
+ Obj *a = obj_get(ACTOR_ALPHYS), *m = obj_get(ACTOR_METTATON);
+ EV_BEGIN;
+ if (c->self) gone(c->self);
+ /* the Lab is dark; then the lights come on, and its big screen shows Frisk, right here */
+ NARRATE("* (It's dark in here.)");
+ g_shake = 2;
+ WAIT(20);
+ NARRATE("* (The lights come on.)\n* (A huge screen shows... you.)");
+ a = obj_alphys(2212, 6275, DIR_LEFT);
+ WALK(a, pl.x + 70, pl.y + 29, 2);
+ SAY(FACE_ALPHYS, "* Oh! Oh no, you're already here!|* Um. H-hi! I'm Dr. Alphys.\n* The Royal Scientist.|* I've been, um, watching you.\n* On my cameras.|* Ever since you left the Ruins.\n* Your fights, your friends...|* It's been kind of amazing?|* I was supposed to stop you.\n* But, um... I'd rather help.");
+ /* and through the wall comes Mettaton */
+ g_shake = 10;
+ m = obj_mtt(2215, 6232);
+ WAIT(20);
+ NARRATE("* GOOD EVENING, BEAUTIES!\n* WELCOME TO TODAY'S QUIZ SHOW!");
+ BATTLE(FORM_MTT_QUIZ);
+ m = obj_get(ACTOR_METTATON);
+ WALK(m, m->x, m->y - 200, 6);
+ gone(obj_get(ACTOR_METTATON));
+ set_flag(F_HT_LAB, 1);
+ a = obj_get(ACTOR_ALPHYS);
+ SAY(FACE_ALPHYS, "* S-sorry about him.\n* I built him, a long time ago.|* He was meant to be an\n entertainment robot...|* Oh! Your phone is SO old.\n* Let me fix it up!");
+ NARRATE("* (Alphys upgrades your phone.)\n* (Now it opens a Dimensional Box, too.)");
+ set_flag(F_HT_LAB, 2);
+ SAY(FACE_ALPHYS, "* There! It has a few new...\n features.|* I'll, um, call you if I can help.|* Now I have to go to the...\n bathroom. Good luck!");
+ a = obj_get(ACTOR_ALPHYS);
+ WALK(a, 2342, 6225, 3);
+ gone(obj_get(ACTOR_ALPHYS));
+ EV_END;
+}
+
+static int ev_fridge(Ev *c) {
+ EV_BEGIN;
+ if (!flag(F_HT_NOODLES)) {
+ NARRATE("* (The fridge is full of instant noodles.)\n* (Take a cup?)@Take@Leave");
+ if (CHOICE() == 0) {
+ if (!item_add(ITEM_INSTANT_NOODLES)) {
+ NARRATE("* (You're carrying too much.)");
+ } else {
+ set_flag(F_HT_NOODLES, 1);
+ NARRATE("* (You got the Instant Noodles.)");
+ }
+ }
+ } else {
+ NARRATE("* (Noodles, as far as the eye can see.)");
+ }
+ EV_END;
+}
+
+static int ev_item(Ev *c) {
+ EV_BEGIN;
+ if (!item_add(ITEM_BURNT_PAN)) {
+ NARRATE("* (You're carrying too much.)");
+ return 1;
+ }
+ set_flag(F_HT_PAN, 1);
+ NARRATE("* (You got the Burnt Pan.)");
+ gone(obj_get(ACTOR_ITEM));
+ if (c->self) gone(c->self);
+ EV_END;
+}
+
+static int ev_vent(Ev *c) {
+ EV_BEGIN;
+ c->v[0] = c->self ? c->self->arg : 0;
+ c->v[1] = vent_dir(&vents[c->v[0]]);
+ /* the steam blows Frisk over the lava */
+ pl.dir = (uint8_t)c->v[1];
+ if (vents[c->v[0]].dir == -1) hub_turns++;
+ PL_WALK(vents[c->v[0]].t[c->v[1]][0], vents[c->v[0]].t[c->v[1]][1], 7);
+ EV_END;
+}
+
+static int ev_laser_hit(Ev *c) {
+ EV_BEGIN;
+ g_exclaim = 20;
+ WAIT(15);
+ BATTLE(FORM_LASERS);
+ /* (out of the beam's way) */
+ pl.x = (int16_t)(pl.x - 26);
+ laser_cool = 60;
+ EV_END;
+}
+
+/* Alphys's calls: 0 the lasers, 1 the puzzle hub, 2 the blue laser off, 3 the door already open, 4 by the CORE */
+static int ev_call(Ev *c) {
+ EV_BEGIN;
+ c->v[0] = c->self ? c->self->arg : 0;
+ if (c->self) gone(c->self);
+ switch (c->v[0]) {
+ case 0:
+ set_flag(F_HT_CALL_LASER, 1);
+ SAY(FACE_ALPHYS, "* Ring...|* H-hi! It's Alphys!|* Lasers up ahead!\n* Orange ones: keep moving!|* Blue ones: stand still.\n* Like the attacks, see?|* Okay! Bye!");
+ break;
+ case 1:
+ set_flag(F_HT_CALL_HUB, 1);
+ SAY(FACE_ALPHYS, "* Ring...|* It's Alphys again!|* That door north stays shut until\n both puzzles are done.|* The one on the right is easier.\n* Try it first!");
+ break;
+ case 2:
+ set_flag(F_HT_BLUE_OFF, 1);
+ SAY(FACE_ALPHYS, "* Ring...|* Oh! A laser's blocking you?|* Hang on, hang on...");
+ gone(obj_get(ACTOR_LASER));
+ NARRATE("* (The blue laser switches off.)");
+ SAY(FACE_ALPHYS, "* There! Got it!");
+ break;
+ case 3:
+ set_flag(F_HT_CALL_ISLE, 1);
+ SAY(FACE_ALPHYS, "* Ring...|* Hi! So, those puzzles by the door:\n shoot the blocks out of the way,\n then...|* ...|* Oh. You already did them.|* Ha ha... never mind!\n* Bye!");
+ break;
+ case 4:
+ set_flag(F_HT_CALL_CORE, 1);
+ SAY(FACE_ALPHYS, "* Ring...|* See that, far off? The CORE.\n* It powers the whole underground.|* The king's castle is past it.\n* We're almost there!|* D-don't worry. I've got your back.");
+ break;
+ }
+ EV_END;
+}
+
+static int ev_shoot(Ev *c) {
+ EV_BEGIN;
+ c->v[0] = c->self ? c->self->arg : 0;
+ if (flag(c->v[0] == SHOOT_LEFT ? F_HT_PUZ_L : F_HT_PUZ_R)) {
+ NARRATE("* (This puzzle is solved.)");
+ return 1;
+ }
+ shoot_open(c->v[0]);
+ WAIT_UNTIL(g_mode == MODE_WORLD);
+ if (shoot_result()) {
+ set_flag(c->v[0] == SHOOT_LEFT ? F_HT_PUZ_L : F_HT_PUZ_R, 1);
+ if (flag(F_HT_PUZ_L) && flag(F_HT_PUZ_R)) {
+ gone(obj_get(ACTOR_DOOR));
+ NARRATE("* (Somewhere, a door unlocks.)");
+ } else {
+ NARRATE("* (One down.)");
+ }
+ }
+ EV_END;
+}
+
+static int ev_cook(Ev *c) {
+ Obj *m = obj_get(ACTOR_METTATON);
+ EV_BEGIN;
+ if (c->self) gone(c->self);
+ /* the lights: Mettaton's cooking show */
+ NARRATE("* (The lights come on.)");
+ NARRATE("* GREETINGS, BEAUTIES!\n* WELCOME TO COOKING WITH A KILLER ROBOT!|* TODAY'S RECIPE: A CAKE!\n* MY LOVELY ASSISTANT WILL FETCH\n THE SUGAR, MILK AND EGGS!");
+ PL_WALK(5600, 3114, 3);
+ NARRATE("* (You bring the sugar, the milk\n and the eggs.)");
+ NARRATE("* PERFECT! AND THE LAST INGREDIENT...\n* A HUMAN SOUL!");
+ g_shake = 6;
+ SAY(FACE_ALPHYS, "* Ring...|* W-wait! Mettaton!\n* What about a vegan option?\n* For the viewers at home?");
+ NARRATE("* ...OH, VERY WELL.\n* THE SUBSTITUTE IS ON THE COUNTER,\n OVER THERE. GO GET IT!");
+ PL_WALK(5900, 3114, 3);
+ NARRATE("* (The counter starts to grow, taller and taller...)");
+ SAY(FACE_ALPHYS, "* Your phone has a JETPACK button!\n* I'm turning it on... now!");
+ BATTLE(FORM_MTT_COOK);
+ set_flag(F_HT_COOK, cook_won() ? 1 : 2);
+ m = obj_get(ACTOR_METTATON);
+ WALK(m, m->x, m->y - 200, 6);
+ gone(obj_get(ACTOR_METTATON));
+ SAY(FACE_ALPHYS, "* Ring...|* Phew... are you okay?\n* Keep going! Right, and up!");
+ EV_END;
+}
+
+static int ev_elevator(Ev *c) {
+ EV_BEGIN;
+ NARRATE("* (An elevator up to the next floor.)\n* (Get in?)@Yes@No");
+ if (CHOICE() == 1) return 1;
+ set_flag(F_HT_FLOOR1, 1);
+ sv.room = (int16_t)g_room, sv.x = 6910, sv.y = 3110;
+ save_write_auto();
+ menu_end_open();
+ EV_END;
+}
+
+int ht1_event(Ev *c) {
+ switch (c->id) {
+ case EV_HT_LAB: return ev_lab(c);
+ case EV_HT_FRIDGE: return ev_fridge(c);
+ case EV_HT_ITEM: return ev_item(c);
+ case EV_VENT: return ev_vent(c);
+ case EV_LASER_HIT: return ev_laser_hit(c);
+ case EV_HT_CALL: return ev_call(c);
+ case EV_SHOOT: return ev_shoot(c);
+ case EV_HT_COOK: return ev_cook(c);
+ case EV_HT_ELEVATOR: return ev_elevator(c);
+ }
+ return -1;
+}
diff --git a/games/undertale/src/htmon.c b/games/undertale/src/htmon.c
new file mode 100644
index 00000000..a29d5293
--- /dev/null
+++ b/games/undertale/src/htmon.c
@@ -0,0 +1,289 @@
+/* Hotland'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 "battle.h"
+#include "game.h"
+#include "gfx.h"
+#include "monsters.h"
+#include "res.h"
+#include "world.h"
+
+/* ---------------------------------------------------------------- Vulkin: it means well (its lava doesn't heal) */
+static void act_vulkin(Battle *b, Monster *m, int act, char *t, int cap) {
+ (void)b;
+ if (act == 0) { /* Criticize */
+ snprintf(t, (size_t)cap, "* You tell Vulkin its lava isn't helping.\n* Vulkin looks crushed. It stops attacking.");
+ m->state = 2;
+ } else if (act == 1) { /* Encourage */
+ snprintf(t, (size_t)cap, "* You tell Vulkin it's doing great.\n* Vulkin glows with pride... and heat.");
+ m->at = (int16_t)(m->at + 2), m->spare = true;
+ if (m->state != 2) m->state = 1;
+ } else { /* Hug */
+ snprintf(t, (size_t)cap, "* You hug Vulkin.\n* It's very, very warm.\n* Your DEFENSE dropped.");
+ m->spare = true;
+ if (m->state != 2) m->state = 1;
+ b->df_loss += 5;
+ }
+}
+static const char *talk_vulkin(Battle *b, Monster *m) {
+ (void)b;
+ if (m->state == 2) return "(sniff)";
+ if (m->state == 1) return "Feeling\nbetter?";
+ static const char *const lines[] = {"I'll heal\nyou!", "Lava\nhelps!", "Warm\nhugs!", "Here, take\nsome lava!"};
+ return lines[rnd_n(4)];
+}
+static int attack_vulkin(Battle *b, Monster *m) {
+ (void)b;
+ if (m->state == 2) return ATK_NONE;
+ return rnd_n(2) ? ATK_VULKIN_THUNDER : ATK_VULKIN_FIRE;
+}
+
+/* ---------------------------------------------------------------- Tsunderplane: come closer, through its green */
+static void act_tsunder(Battle *b, Monster *m, int act, char *t, int cap) {
+ (void)b;
+ if (act == 0) { /* Flirt */
+ snprintf(t, (size_t)cap, "* You flirt with Tsunderplane.\n* It turns away, blushing.");
+ } else { /* Approach */
+ snprintf(t, (size_t)cap, "* You move a little closer.\n* Tsunderplane pretends not to notice.");
+ m->state = 1;
+ }
+}
+static const char *talk_tsunder(Battle *b, Monster *m) {
+ (void)b;
+ if (m->spare) return "I-it's not\nlike I like\nyou!!";
+ if (m->state) return "Don't get\nthe wrong\nidea!";
+ static const char *const lines[] = {"Hmph!", "Baka!", "Wh-what are\nyou looking\nat?", "As if!"};
+ return lines[rnd_n(4)];
+}
+static const char *flavor_tsunder(Battle *b, Monster *m) {
+ /* its green zones touched enough (four times, three with Vulkin by it): it can be spared */
+ int need = 4;
+ for (int i = 0; i < b->nmon; i++)
+ if (b->mon[i].def == mon_def(MON_VULKIN) && !b->mon[i].gone) need = 3;
+ if (m->state && b->greens >= need) m->spare = true;
+ if (m->spare) return "* Tsunderplane is pretending it doesn't want to be spared.";
+ return NULL;
+}
+static int attack_tsunder(Battle *b, Monster *m) {
+ (void)b, (void)m;
+ return rnd_n(2) ? ATK_TSUNDER_BOMBS : ATK_TSUNDER_DIVE;
+}
+
+/* ---------------------------------------------------------------- Pyrope: turn up the heat */
+static void act_pyrope(Battle *b, Monster *m, int act, char *t, int cap) {
+ (void)b;
+ if (act == 0) { /* Heat Up */
+ m->state++;
+ if (m->state >= 2) snprintf(t, (size_t)cap, "* You rub your hands together.\n* The room is sweltering!"), m->spare = true;
+ else snprintf(t, (size_t)cap, "* You rub your hands together.\n* It's getting warmer...");
+ } else if (act == 1) { /* Cool Down */
+ snprintf(t, (size_t)cap, "* You blow on Pyrope.\n* Its flame shrinks. Its ATTACK dropped!");
+ m->at = (int16_t)max_i(1, m->at - 2);
+ } else { /* Invite */
+ snprintf(t, (size_t)cap, "* You invite Pyrope to hang out.\n* It just wants to be warmer.");
+ }
+}
+static const char *talk_pyrope(Battle *b, Monster *m) {
+ (void)b;
+ if (m->spare) return "Toasty!";
+ static const char *const lines[] = {"Brr...", "Hotter!", "I'm all\nfired up!", "Got a\nlight?"};
+ return lines[rnd_n(4)];
+}
+static int attack_pyrope(Battle *b, Monster *m) { (void)b, (void)m; return rnd_n(2) ? ATK_PYROPE_BOMBS : ATK_PYROPE_ROPE; }
+
+static const MonDef ht_defs[MON_COUNT - MON_WF_COUNT] = {
+ [MON_VULKIN - MON_WF_COUNT] = {
+ .name = "Vulkin", .spare_gold = 40, .hp = 20, .at = 8, .df = 0, .exp = 70, .gold = 40, .spr_idle = SPR_VULKIN_B,
+ .spr_hurt = SPR_VULKIN_HURT, .idle_speed = 6, .check = "Thinks its lava makes people feel better.",
+ .acts = {"Criticize", "Encourage", "Hug"}, .nacts = 3,
+ .neutral = {"* Vulkin is making coffee in its crater.", "* Vulkin hums a warm little song.", "* Smells like a campfire."},
+ .low_hp = "* Vulkin's lava is cooling.", .act = act_vulkin, .talk = talk_vulkin, .attack = attack_vulkin},
+ [MON_TSUNDERPLANE - MON_WF_COUNT] = {
+ .name = "Tsunderplane", .spare_gold = 60, .hp = 80, .at = 8, .df = 6, .exp = 95, .gold = 60, .spr_idle = SPR_TSUNDER_B,
+ .spr_hurt = SPR_TSUNDER_B, .idle_speed = 6, .check = "Acts mean, but maybe it secretly likes you?",
+ .acts = {"Flirt", "Approach"}, .nacts = 2,
+ .neutral = {"* Tsunderplane shakes its nose at you.", "* Tsunderplane is looking the other way.",
+ "* Smells like jet fuel and perfume."},
+ .low_hp = "* Tsunderplane's engine is smoking.", .act = act_tsunder, .talk = talk_tsunder, .attack = attack_tsunder,
+ .flavor = flavor_tsunder},
+ [MON_PYROPE - MON_WF_COUNT] = {
+ .name = "Pyrope", .spare_gold = 45, .hp = 110, .at = 8, .df = 1, .exp = 80, .gold = 30, .spr_idle = SPR_PYROPE_B,
+ .spr_hurt = SPR_PYROPE_HURT, .idle_speed = 5, .dy = 18, .check = "A troublemaker who's never warm enough.",
+ .acts = {"Heat Up", "Cool Down", "Invite"}, .nacts = 3,
+ .neutral = {"* Pyrope is protected by its winning smile.", "* Pyrope crackles.", "* Smells like a burnt rope."},
+ .act = act_pyrope, .talk = talk_pyrope, .attack = attack_pyrope},
+ [MON_METTATON - MON_WF_COUNT] = {
+ .name = "Mettaton", .hp = 9999, .at = 0, .df = 0, .spr_idle = SPR_MTT_B, .spr_hurt = SPR_MTT_B, .idle_speed = 6,
+ .check = "A robot with a TV show.", .flags = MF_BOSS | MF_NOT_KILLABLE},
+};
+const MonDef *ht_mon_def(int id) { return &ht_defs[id - MON_WF_COUNT]; }
+
+static const Form ht_forms[FORM_COUNT - FORM_WF_COUNT] = {
+ [FORM_VULKIN - FORM_WF_COUNT] = {{MON_VULKIN}, 1, "* Vulkin strolls in, happy as can be."},
+ [FORM_TSUNDERPLANE - FORM_WF_COUNT] = {{MON_TSUNDERPLANE}, 1, "* Tsunderplane gets in the way!\n* Not on purpose or anything."},
+ [FORM_TSUNDER_VULKIN - FORM_WF_COUNT] = {{MON_VULKIN, MON_TSUNDERPLANE}, 2,
+ "* Tsunderplane and Vulkin show up.\n* (Not that Tsunderplane cares.)"},
+ [FORM_PYROPE - FORM_WF_COUNT] = {{MON_PYROPE}, 1, "* Pyrope bounces in, burning bright!"},
+ [FORM_PYROPE2 - FORM_WF_COUNT] = {{MON_PYROPE, MON_PYROPE}, 2, "* Two Pyropes hop in.\n* They're up to something."},
+ [FORM_MTT_QUIZ - FORM_WF_COUNT] = {{MON_METTATON}, 1, ""},
+ [FORM_MTT_COOK - FORM_WF_COUNT] = {{MON_METTATON}, 1, ""},
+ [FORM_LASERS - FORM_WF_COUNT] = {{MON_METTATON}, 1, ""},
+};
+const Form *ht_form(int form) { return &ht_forms[form - FORM_WF_COUNT]; }
+
+/* random encounters: past the Lab (the belts and the Magma Chamber) */
+int ht_encounter(int room) {
+ switch (room) {
+ case ROOM_HT_BELT1: case ROOM_HT_BELT2: case ROOM_HT_MAGMA: {
+ static const uint8_t pool[] = {FORM_VULKIN, FORM_TSUNDERPLANE, FORM_TSUNDER_VULKIN, FORM_PYROPE, FORM_PYROPE2};
+ 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); }
+
+/* Vulkin: a thundercloud over the board drops bolts that spread as they fall (it drifts, sometimes) */
+static void atk_vulkin_thunder(int t) {
+ static Bullet *cloud;
+ if (t == 0) {
+ cloud = shot(SPR_CLOUD, board_cx(), by0() + 8, rnd_n(2) ? P(1) / 2 : 0, 0);
+ if (cloud) cloud->flags |= BF_HARMLESS | BF_NOCLIP, cloud->life = 150;
+ }
+ if (cloud && cloud->kind != BK_NONE && (cloud->x < P(bx0() + 14) || cloud->x > P(bx1() - 14))) cloud->vx = -cloud->vx;
+ if (cloud && cloud->kind != BK_NONE && t < 130 && t % 20 == 10) {
+ for (int k = -1; k <= 1; k++) {
+ Bullet *b = bullet_new(SPR_BOLT, cloud->x, cloud->y + P(6), k * P(1) / 2, P(2));
+ if (b) b->r = 2, b->flags |= BF_NOCLIP;
+ }
+ }
+}
+/* and fire: two columns at the sides throw fireballs at the middle, and they fall back */
+static void atk_vulkin_fire(int t) {
+ if (t < 130 && t % 16 == 0) {
+ bool left = (t / 16) % 2;
+ int y = by0() + 8 + rnd_n(by1() - by0() - 16);
+ Bullet *b = shot(SPR_FIREBULLET, left ? bx0() + 2 : bx1() - 2, y, (left ? 1 : -1) * P(3), 0);
+ if (b) b->r = 4, b->ax = (left ? -1 : 1) * 3, b->anim = 3, b->flags |= BF_NOCLIP, b->life = 120;
+ }
+}
+
+/* Tsunderplane: little planes cross the board dropping bombs (a bomb at the bottom sends smoke all the way up);
+ * approached, its planes come wrapped in green: touch it */
+static int tsunder_approached(void) {
+ for (int i = 0; i < bt.nmon; i++)
+ if (bt.mon[i].def == mon_def(MON_TSUNDERPLANE) && bt.mon[i].state && !bt.mon[i].gone) return 1;
+ return 0;
+}
+static void green_wrap(Bullet *p) {
+ Bullet *g = bullet_new(SPR_ORB, p->x, p->y - P(9), p->vx, p->vy);
+ if (g) g->color = BC_GREEN, g->dmg = 0, g->r = 4, g->flags |= BF_NOCLIP, g->life = p->life;
+}
+static void atk_tsunder_bombs(int t) {
+ if (t < 120 && t % 30 == 0) {
+ bool left = (t / 30) % 2;
+ int y = by0() + 6;
+ Bullet *p = shot(SPR_PLANE, left ? bx0() - 10 : bx1() + 10, y, (left ? 1 : -1) * P(2), 0);
+ if (p) p->r = 4, p->flags |= BF_NOCLIP, p->life = 110, p->angle = left ? 0 : 128;
+ if (p && tsunder_approached()) green_wrap(p);
+ }
+ for (int i = 0; i < MAX_BULLETS; i++) {
+ Bullet *b = &bullets[i];
+ if (b->kind == BK_NONE) continue;
+ if (b->spr == SPR_PLANE && b->t % 24 == 12 && b->x > P(bx0()) && b->x < P(bx1())) {
+ Bullet *d = bullet_new(SPR_BOMB, b->x, b->y + P(6), 0, P(1));
+ if (d) d->kind = BK_GRAVITY, d->ay = 2, d->r = 3, d->a = 1;
+ }
+ if (b->spr == SPR_BOMB && b->a == 1 && b->y > P(by1() - 4)) {
+ /* the smoke: a column up through the whole board, a moment */
+ int x = b->x / FX;
+ b->kind = BK_NONE;
+ for (int y = by1() - 4; y > by0(); y -= 9) {
+ Bullet *s = shot(SPR_ORB, x, y, 0, 0);
+ if (s) s->r = 3, s->life = 18, s->alpha = 170;
+ }
+ }
+ }
+}
+/* or big planes dive from the top, a trail of smoke behind (it moves across, unless approached) */
+static void atk_tsunder_dive(int t) {
+ if (t < 120 && t % 40 == 0) {
+ int x = bx0() + 10 + rnd_n(bx1() - bx0() - 20);
+ Bullet *p = shot(SPR_PLANE, x, by0() - 10, 0, P(2));
+ if (p) p->r = 5, p->flags |= BF_NOCLIP, p->life = 80, p->angle = 64;
+ if (p && tsunder_approached()) green_wrap(p);
+ }
+ bool still = tsunder_approached();
+ for (int i = 0; i < MAX_BULLETS; i++) {
+ Bullet *b = &bullets[i];
+ if (b->kind == BK_NONE || b->spr != SPR_PLANE || b->angle != 64 || b->t % 8) continue;
+ Bullet *s = bullet_new(SPR_ORB, b->x, b->y - P(8), still ? 0 : (b->t % 16 ? P(1) : -P(1)), 0);
+ if (s) s->r = 2, s->life = 50, s->alpha = 150;
+ }
+}
+
+/* Pyrope: bombs come from every side, bounce about and burst at the board's edges; or its rope of fire runs across
+ * (orange: run through it) */
+static void atk_pyrope_bombs(int t) {
+ if (t < 110 && t % 22 == 0) {
+ int side = rnd_n(4);
+ int x = side < 2 ? bx0() + 8 + rnd_n(bx1() - bx0() - 16) : side == 2 ? bx0() : bx1();
+ int y = side >= 2 ? by0() + 8 + rnd_n(by1() - by0() - 16) : side == 0 ? by0() : by1();
+ int vx = side == 2 ? P(2) : side == 3 ? -P(2) : (rnd_n(2) ? P(1) : -P(1));
+ int vy = side == 0 ? P(2) : side == 1 ? -P(2) : (rnd_n(2) ? P(1) : -P(1));
+ Bullet *b = shot(SPR_BOMB, x, y, vx, vy);
+ if (b) b->kind = BK_SCRIPT, b->r = 3, b->a = 3, b->flags |= BF_NOCLIP;
+ }
+ for (int i = 0; i < MAX_BULLETS; i++) {
+ Bullet *b = &bullets[i];
+ if (b->kind != BK_SCRIPT || b->spr != SPR_BOMB) continue;
+ b->x += b->vx, b->y += b->vy, b->t++;
+ bool hit_x = b->x < P(bx0() + 2) || b->x > P(bx1() - 2), hit_y = b->y < P(by0() + 2) || b->y > P(by1() - 2);
+ if (b->t > 8 && (hit_x || hit_y)) {
+ if (--b->a > 0) {
+ if (hit_x) b->vx = -b->vx;
+ if (hit_y) b->vy = -b->vy;
+ continue;
+ }
+ /* it bursts: sparks */
+ b->kind = BK_NONE;
+ for (int k = 0; k < 4; k++) {
+ static const int8_t sx[4] = {1, -1, 1, -1}, sy[4] = {1, 1, -1, -1};
+ Bullet *s = bullet_new(SPR_ORB, b->x, b->y, sx[k] * P(1), sy[k] * P(1));
+ if (s) s->r = 2, s->life = 30;
+ }
+ }
+ }
+}
+static void atk_pyrope_rope(int t) {
+ if (t < 120 && t % 40 == 0) {
+ Bullet *f = shot(SPR_FIREBULLET, bx1() + 6, board_cy(), -P(2) - P(t / 40) / 2, 0);
+ if (f) f->color = BC_ORANGE, f->flags |= BF_BOX | BF_NOCLIP, f->w = 8, f->h = (int16_t)(by1() - by0()), f->life = 120, f->anim = 3;
+ }
+}
+
+int ht_attack_length(int atk) { (void)atk; return 160; }
+
+void ht_attack_run(Battle *b, int atk, int t) {
+ (void)b;
+ if (t < 0) {
+ board_set(atk == ATK_TSUNDER_BOMBS || atk == ATK_PYROPE_ROPE ? 150 : 120, 100);
+ soul_set_mode(SOUL_RED);
+ return;
+ }
+ switch (atk) {
+ case ATK_VULKIN_THUNDER: atk_vulkin_thunder(t); break;
+ case ATK_VULKIN_FIRE: atk_vulkin_fire(t); break;
+ case ATK_TSUNDER_BOMBS: atk_tsunder_bombs(t); break;
+ case ATK_TSUNDER_DIVE: atk_tsunder_dive(t); break;
+ case ATK_PYROPE_BOMBS: atk_pyrope_bombs(t); break;
+ case ATK_PYROPE_ROPE: atk_pyrope_rope(t); break;
+ }
+}
diff --git a/games/undertale/src/htshows.c b/games/undertale/src/htshows.c
new file mode 100644
index 00000000..bee69ab7
--- /dev/null
+++ b/games/undertale/src/htshows.c
@@ -0,0 +1,256 @@
+/* Mettaton's shows, and a laser's alarm: battles that play their own way (battle.c's scripts).
+ *
+ * The quiz: Mettaton asks, four answers wait in the box, and the SOUL picks one (Z over it) before the time runs
+ * out; Alphys, beside the stage, signals the right one. A wrong answer halves Frisk's HP (never below 1).
+ * The cooking show's jetpack: Frisk flies up the counter as it grows, dodging what Mettaton throws, before a minute
+ * is up. The alarm: three lasers, orange or blue, sweep through the SOUL. (As the Undertale Wiki describes them;
+ * the questions and what's said are ours.) */
+#include <stdio.h>
+#include <string.h>
+#include "battle.h"
+#include "game.h"
+#include "gfx.h"
+#include "monsters.h"
+#include "res.h"
+#include "text.h"
+
+#define P(v) ((v) * FX)
+
+static void bubble(const char *s) {
+ writer_start(&bt.bw, s, 0, 0, FONT_SMALL);
+ bt.bw.line_h = 9;
+}
+static void draw_bubble_at(int bx, int by, int w, int h) {
+ gfx_rect(bx, by, w, h, C_WHITE, 255);
+ gfx_rect(bx - 6, by + 16, 6, 5, C_WHITE, 255);
+ bt.bw.x = bx + 5, bt.bw.y = by + 5;
+ writer_draw(&bt.bw, C_BLACK);
+}
+static void draw_box(void) {
+ gfx_rect(bt.x0, bt.y0, bt.x1 - bt.x0, bt.y1 - bt.y0, C_WHITE, 255);
+ gfx_rect(bt.x0 + 2, bt.y0 + 2, bt.x1 - bt.x0 - 4, bt.y1 - bt.y0 - 4, C_BLACK, 255);
+}
+static void draw_soul(void) {
+ if (!bt.inv || (bt.inv / 2) % 2) gfx_sprite(SPR_HEART, 0, soul_x(), soul_y(), 0, 255);
+}
+static void draw_mettaton(int x, int y) {
+ gfx_sprite(SPR_MTT_B, (int)(g_frame / 6), x, y, 0, 255);
+}
+static void tick(uint32_t keys) {
+ if (bt.inv) bt.inv--;
+ soul_update(keys);
+ bullets_update();
+ soul_hit_test();
+ if (sv.hp < 1) sv.hp = 1; /* (these never kill) */
+}
+
+/* ---------------------------------------------------------------- the quiz */
+typedef struct {
+ const char *q;
+ const char *a[4];
+ int right;
+} Question;
+static const Question quiz[] = {
+ {"First, an\neasy one!\nWhat color\nis a human\nSOUL?", {"Blue", "Red", "Green", "Plaid"}, 1},
+ {"Who leads\nthe Royal\nGuard?", {"Papyrus", "Sans", "Undyne", "A dog"}, 2},
+ {"How many\nhuman SOULs\ndoes the king\nneed?", {"Five", "Six", "Seven", "A dozen"}, 2},
+ {"Quick math!\n7 x 6 - 24.5\nis...?", {"17.5", "16.5", "18", "42"}, 0},
+ {"Which did\nyou NOT see\nin Waterfall?", {"Echo flowers", "Temmies", "Snowmen", "Bridge seeds"}, 2},
+ {"And who's\nthe star of\nthis show?", {"You", "Alphys", "The crowd", "Mettaton"}, 3},
+};
+#define NQ ((int)(sizeof quiz / sizeof quiz[0]))
+enum { QZ_HELLO, QZ_ASK, QZ_SAY, QZ_BYE };
+/* bt.state: [0] step, [1] the question, [2] frames left to answer, [3] wrong answers */
+#define QZ_TIME 450
+
+static void quiz_ask(void) {
+ bt.state[0] = QZ_ASK, bt.state[2] = QZ_TIME;
+ bubble(quiz[bt.state[1]].q);
+ bt.sx = P(board_cx()), bt.sy = P(board_cy());
+}
+static int zone_at(int x, int y) {
+ /* the four answers, two by two in the box */
+ int col = x >= board_cx(), row = y >= board_cy();
+ return row * 2 + col;
+}
+void quiz_start(void) {
+ bt.scripted = true;
+ bt.state[0] = QZ_HELLO, bt.state[1] = 0, bt.state[3] = 0;
+ board_set_rect(40, 128, 280, 194);
+ bt.x0 = bt.tx0, bt.y0 = bt.ty0, bt.x1 = bt.tx1, bt.y1 = bt.ty1;
+ bt.sx = P(board_cx()), bt.sy = P(board_cy());
+ bubble("Welcome,\nbeauties, to\nthe quiz show\nof the\nunderground!|Answer right,\nand you win!\nAnswer wrong,\nand...|Well! Let's\nnot spoil the\nsurprise!");
+}
+void quiz_update(uint32_t keys, uint32_t pressed) {
+ switch (bt.state[0]) {
+ case QZ_HELLO:
+ case QZ_SAY:
+ if (!writer_update(&bt.bw, pressed)) {
+ if (bt.state[0] == QZ_SAY && bt.state[1] >= NQ) {
+ bt.state[0] = QZ_BYE;
+ bubble("Hmph! Too\neasy, with a\ncertain doctor\nwaving the\nanswers!|Oh well. That\nwas only our\nfirst episode!|Until next\ntime, darlings!");
+ } else {
+ quiz_ask();
+ }
+ }
+ break;
+ case QZ_ASK: {
+ writer_update(&bt.bw, 0);
+ tick(keys);
+ /* (a Z left over from the talk doesn't answer: the question first) */
+ bool chose = ((pressed & K_Z) && bt.state[2] < QZ_TIME - 20) || --bt.state[2] <= 0;
+ if (!chose) break;
+ int z = bt.state[2] <= 0 ? -1 : zone_at(soul_x(), soul_y());
+ const Question *q = &quiz[bt.state[1]];
+ if (z == q->right) {
+ static const char *const yes[] = {"Correct!\nHow\nthrilling!", "Right\nagain!", "Ooh, you're\ngood!"};
+ bubble(yes[bt.state[1] % 3]);
+ } else {
+ sv.hp = (int16_t)max_i(1, sv.hp / 2);
+ bt.inv = 30, bt.state[3]++;
+ bubble(z < 0 ? "Time's up!\nThat's a\nshock for\nyou!" : "Wrong!\nThat's a\nshock for\nyou!");
+ /* (worn out: straight to the end) */
+ if (sv.hp <= 1) bt.state[1] = NQ - 1;
+ }
+ bt.state[1]++;
+ bt.state[0] = QZ_SAY;
+ break;
+ }
+ case QZ_BYE:
+ if (!writer_update(&bt.bw, pressed)) bt.result = BR_SCRIPTED;
+ break;
+ }
+}
+void quiz_draw(void) {
+ gfx_sprite(SPR_BATTLEBG, 0, 0, 0, 0, 255);
+ draw_mettaton(120, 118);
+ draw_bubble_at(182, 18, 104, 76);
+ draw_box();
+ if (bt.state[0] == QZ_ASK) {
+ const Question *q = &quiz[bt.state[1]];
+ static const char *const letter[4] = {"A", "B", "C", "D"};
+ for (int i = 0; i < 4; i++) {
+ int x = (i % 2 ? board_cx() + 6 : bt.x0 + 8), y = (i / 2 ? board_cy() + 6 : bt.y0 + 8);
+ char s[32];
+ snprintf(s, sizeof s, "%s %s", letter[i], q->a[i]);
+ bool on = zone_at(soul_x(), soul_y()) == i;
+ gfx_text(FONT_SMALL, x, y, s, on ? C_YELLOW : C_WHITE, 255);
+ }
+ gfx_rect(board_cx(), bt.y0 + 2, 1, bt.y1 - bt.y0 - 4, rgb565(0x404040), 255);
+ gfx_rect(bt.x0 + 2, board_cy(), bt.x1 - bt.x0 - 4, 1, rgb565(0x404040), 255);
+ char s[8];
+ snprintf(s, sizeof s, "%d", (bt.state[2] + 14) / 15);
+ gfx_text(FONT_SMALL, bt.x0 - 22, bt.y0 + 2, s, C_WHITE, 255);
+ /* Alphys, off to the side, signals the answer */
+ if (bt.state[2] < QZ_TIME - 60) {
+ gfx_sprite(SPR_FACE_ALPHYS, 0, 282, 104, 0, 255);
+ gfx_text(FONT_MAIN, 300, 92, letter[q->right], C_YELLOW, 255);
+ }
+ draw_soul();
+ }
+ battle_draw_hud();
+}
+
+/* ---------------------------------------------------------------- the cooking show: the jetpack */
+/* bt.state: [0] step, [1] how high (0..CK_TOP), [2] frames left */
+enum { CK_HELLO, CK_FLY, CK_BYE };
+#define CK_TOP 600
+#define CK_TIME 1800
+void cook_start(void) {
+ bt.scripted = true;
+ bt.state[0] = CK_HELLO, bt.state[1] = 0, bt.state[2] = CK_TIME;
+ board_set_rect(100, 40, 220, 194);
+ bt.x0 = bt.tx0, bt.y0 = bt.ty0, bt.x1 = bt.tx1, bt.y1 = bt.ty1;
+ bt.sx = P(board_cx()), bt.sy = P(bt.y1 - 14);
+ bubble("The counter's\ngrowing! Get\nthe substitute\nin under a\nminute!|Use your\nphone's\nJETPACK!\nUp, up and\naway!");
+}
+void cook_update(uint32_t keys, uint32_t pressed) {
+ switch (bt.state[0]) {
+ case CK_HELLO:
+ if (!writer_update(&bt.bw, pressed)) bt.state[0] = CK_FLY, bt.t = 0;
+ break;
+ case CK_FLY: {
+ int hp = sv.hp;
+ tick(keys);
+ /* what Mettaton throws down (faster as the counter goes up) */
+ if (bt.t % max_i(8, 22 - bt.state[1] / 50) == 0) {
+ Bullet *b = bullet_new(rnd_n(3) ? SPR_ORB : SPR_BOMB, P(bt.x0 + 8 + rnd_n(bt.x1 - bt.x0 - 16)), P(bt.y0 + 2), 0,
+ P(2) + P(bt.state[1]) / 300);
+ if (b) b->r = 4, b->dmg = 3, b->flags |= BF_NOCLIP;
+ }
+ /* up the jetpack goes, set back by every hit */
+ bt.state[1] = (int16_t)min_i(CK_TOP, bt.state[1] + 1 - (sv.hp < hp ? 60 : 0));
+ if (bt.state[1] < 0) bt.state[1] = 0;
+ if (bt.state[1] >= CK_TOP) {
+ bt.state[0] = CK_BYE, bt.state[3] = 1;
+ bullets_clear();
+ bubble("You made it!\nThe vegan\nsubstitute!|...and I'd\nalready baked\nthe cake.\nTa-da!|That's our\nshow! Ciao!");
+ } else if (--bt.state[2] <= 0) {
+ bt.state[0] = CK_BYE, bt.state[3] = 0;
+ bullets_clear();
+ bubble("Oh dear,\nout of time!|...but we're\nat the break.\nNo killing\nwithout an\naudience!|Ciao for now!");
+ }
+ break;
+ }
+ case CK_BYE:
+ if (!writer_update(&bt.bw, pressed)) bt.result = BR_SCRIPTED;
+ break;
+ }
+}
+int cook_won(void) { return bt.state[3]; }
+void cook_draw(void) {
+ gfx_sprite(SPR_BATTLEBG, 0, 0, 0, 0, 255);
+ draw_mettaton(272, 118);
+ draw_box();
+ gfx_clip(bt.x0 + 2, bt.y0 + 2, bt.x1 - bt.x0 - 4, bt.y1 - bt.y0 - 4);
+ /* the counter's side scrolling past: lines going down as Frisk goes up */
+ for (int k = 0; k < 8; k++) {
+ int y = bt.y0 + ((k * 20 + bt.state[1]) % 160);
+ gfx_rect(bt.x0 + 2, y, bt.x1 - bt.x0 - 4, 1, rgb565(0x303030), 255);
+ }
+ bullets_draw();
+ if (bt.state[0] == CK_FLY) draw_soul();
+ gfx_clip_all();
+ /* how far up, and the time */
+ int h = (bt.y1 - bt.y0) * bt.state[1] / CK_TOP;
+ gfx_rect(bt.x0 - 14, bt.y0, 6, bt.y1 - bt.y0, rgb565(0x404040), 255);
+ gfx_rect(bt.x0 - 14, bt.y1 - h, 6, h, C_YELLOW, 255);
+ char s[8];
+ snprintf(s, sizeof s, "%d", (bt.state[2] + 29) / 30);
+ gfx_text(FONT_MAIN, bt.x0 - 34, bt.y0 - 2, s, C_WHITE, 255);
+ if (bt.state[0] != CK_FLY) draw_bubble_at(182, 18, 104, 76);
+ battle_draw_hud();
+}
+
+/* ---------------------------------------------------------------- the lasers' alarm */
+void lasers_start(void) {
+ bt.scripted = true;
+ bt.state[0] = 0;
+ board_set(120, 60);
+ bt.x0 = bt.tx0, bt.y0 = bt.ty0, bt.x1 = bt.tx1, bt.y1 = bt.ty1;
+ bt.sx = P(board_cx()), bt.sy = P(board_cy());
+ bt.t = 0;
+}
+void lasers_update(uint32_t keys, uint32_t pressed) {
+ (void)pressed;
+ tick(keys);
+ if (bt.t % 40 == 10 && bt.t < 100) {
+ Bullet *b = bullet_new(SPR_ORB, P(bt.x1 + 4), P(board_cy()), -P(4), 0);
+ if (b) b->color = rnd_n(2) ? BC_ORANGE : BC_BLUE, b->flags |= BF_BOX | BF_NOCLIP, b->w = 3,
+ b->h = (int16_t)(bt.y1 - bt.y0), b->dmg = 3, b->life = 60;
+ }
+ if (bt.t > 170) bt.result = BR_SCRIPTED;
+}
+void lasers_draw(void) {
+ gfx_rect(0, 0, SCREEN_W, SCREEN_H, C_BLACK, 255);
+ draw_box();
+ for (int i = 0; i < MAX_BULLETS; i++) {
+ const Bullet *b = &bullets[i];
+ if (b->kind == BK_NONE || !(b->flags & BF_BOX)) continue;
+ int x = b->x / FX;
+ if (x < bt.x0 + 2 || x > bt.x1 - 2) continue;
+ gfx_rect(x - 1, bt.y0 + 2, 3, bt.y1 - bt.y0 - 4, b->color == BC_ORANGE ? rgb565(0xFCA600) : rgb565(0x14A9FF), 255);
+ }
+ draw_soul();
+ battle_draw_hud();
+}
diff --git a/games/undertale/src/items.c b/games/undertale/src/items.c
index 2da369ea..db8d48d6 100644
--- a/games/undertale/src/items.c
+++ b/games/undertale/src/items.c
@@ -52,6 +52,10 @@ static const ItemInfo items[ITEM_COUNT] = {
[ITEM_TORN_NOTEBOOK] = {"Torn Notebook", "TornNotbo", IT_WEAPON, 0, 2, 0, "An old notebook, torn up.\n* It doesn't hit very hard.", "", 50},
[ITEM_TEMMIE_FLAKES] = {"Temmie Flakes", "TemFlakes", IT_FOOD, 2, 0, 0, "Bits of paper, sold as\n food.",
"* You eat the Temmie Flakes.", 2},
+ [ITEM_BURNT_PAN] = {"Burnt Pan", "BurntPan", IT_WEAPON, 0, 10, 0,
+ "A pan, burnt black. Hits\n hard, every time.\n* Food heals 4 HP more with it.", "", 50},
+ [ITEM_INSTANT_NOODLES] = {"Instant Noodles", "InstaNood", IT_FOOD, 15, 0, 0, "A cup of noodles, quick to\n make.",
+ "* You eat the Instant Noodles.\n* They're a little crunchy.", 2},
};
const ItemInfo *item_info(int id) { return &items[id >= 0 && id < ITEM_COUNT ? id : 0]; }
@@ -130,7 +134,7 @@ void item_use(int slot, char *out, int cap, int in_battle) {
} else if (it->heal == 998) {
if (sv.hp < sv.maxhp - 1) sv.hp = (int16_t)(sv.maxhp - 1);
} else {
- heal(it->heal, out + n, cap - n);
+ heal(it->heal + (sv.weapon == ITEM_BURNT_PAN ? 4 : 0), out + n, cap - n);
}
(void)in_battle;
return;
diff --git a/games/undertale/src/items.h b/games/undertale/src/items.h
index d2851666..a9b5ec8c 100644
--- a/games/undertale/src/items.h
+++ b/games/undertale/src/items.h
@@ -34,6 +34,9 @@ enum {
ITEM_CLOUDY_GLASSES,
ITEM_TORN_NOTEBOOK,
ITEM_TEMMIE_FLAKES,
+ /* Hotland */
+ ITEM_BURNT_PAN,
+ ITEM_INSTANT_NOODLES,
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 67855c4e..f02971c1 100644
--- a/games/undertale/src/menu.c
+++ b/games/undertale/src/menu.c
@@ -11,6 +11,7 @@
#include "menu.h"
#include "res.h"
#include "save.h"
+#include "shop.h"
#include "text.h"
#include "world.h"
@@ -146,6 +147,15 @@ static void name_input(uint32_t pressed) {
/* ---------------------------------------------------------------- the C menu */
enum { M_MAIN, M_ITEMS, M_ITEM_ACT, M_STAT, M_CELL };
+/* the CELL's list: Toriel's phone (0); Papyrus's (1) once he gave his number; the Dimensional Box (2) once Alphys
+ * upgraded the phone */
+static int cell_entries(int *calls) {
+ int n = 0;
+ calls[n++] = 0;
+ if (flag(F_PAP_DATE) == 2) calls[n++] = 1;
+ if (flag(F_HT_LAB) >= 2) calls[n++] = 2;
+ return n;
+}
void menu_open(void) {
g_mode = MODE_MENU;
@@ -219,14 +229,18 @@ static void c_menu_input(uint32_t pressed) {
if (pressed & (K_X | K_Z)) st = M_MAIN;
break;
case M_CELL: {
- int n = flag(F_PAP_DATE) == 2 ? 2 : 1; /* Toriel's phone; Papyrus's once he gave it */
+ int calls[3], n = cell_entries(calls);
if (pressed & K_UP) sub = (sub + n - 1) % n;
if (pressed & K_DOWN) sub = (sub + 1) % n;
if (pressed & K_X) st = M_MAIN;
if (pressed & K_Z) {
menu_close();
- event_start(EV_PHONE_MENU, NULL);
- event_cur_arg(sub);
+ if (calls[sub] == 2) {
+ box_open();
+ } else {
+ event_start(EV_PHONE_MENU, NULL);
+ event_cur_arg(calls[sub]);
+ }
}
break;
}
@@ -301,9 +315,10 @@ static void draw_c_menu(void) {
}
}
if (st == M_CELL) {
- panel(94, 26, 173, 60);
- gfx_text(FONT_MENU, 116, 38, "Toriel's Phone", C_WHITE, 255);
- if (flag(F_PAP_DATE) == 2) gfx_text(FONT_MENU, 116, 56, "Papyrus's Phone", C_WHITE, 255);
+ static const char *const names[3] = {"Toriel's Phone", "Papyrus's Phone", "Dimensional Box"};
+ int calls[3], n = cell_entries(calls);
+ panel(94, 26, 173, 24 + 18 * n);
+ for (int i = 0; i < n; i++) gfx_text(FONT_MENU, 116, 38 + 18 * i, names[calls[i]], C_WHITE, 255);
gfx_sprite(SPR_HEART, 0, 107, 44 + sub * 18, 0, 255);
}
}
@@ -368,7 +383,7 @@ void menu_gameover_open(void) {
void menu_end_open(void) {
g_mode = MODE_END;
t = 0;
- writer_start(&w, "Out of Waterfall at last,\ninto the heat of Hotland...|The rest of the underground\nis still to come...", 40, 90, FONT_MAIN);
+ writer_start(&w, "Up the elevator, on through\nthe heat of Hotland...|The rest of the underground\nis still to come...", 40, 90, FONT_MAIN);
w.speed = 2;
}
diff --git a/games/undertale/src/monsters.h b/games/undertale/src/monsters.h
index 8fd40598..d45eb19e 100644
--- a/games/undertale/src/monsters.h
+++ b/games/undertale/src/monsters.h
@@ -10,7 +10,9 @@ enum {
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_SNOW_COUNT,
/* Waterfall (wfmon.c) */
- MON_AARON = MON_SNOW_COUNT, MON_WOSHUA, MON_MOLDBYGG, MON_SHYREN, MON_MAD_DUMMY, MON_TEMMIE, MON_UNDYNE, MON_COUNT
+ MON_AARON = MON_SNOW_COUNT, MON_WOSHUA, MON_MOLDBYGG, MON_SHYREN, MON_MAD_DUMMY, MON_TEMMIE, MON_UNDYNE, MON_WF_COUNT,
+ /* Hotland (htmon.c) */
+ MON_VULKIN = MON_WF_COUNT, MON_TSUNDERPLANE, MON_PYROPE, MON_METTATON, MON_COUNT
};
/* formations: who is fought */
@@ -24,7 +26,10 @@ enum {
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_MAD_DUMMY, FORM_TEMMIE, FORM_TEMMIE_MOLDBYGG, FORM_UNDYNE, FORM_COUNT
+ FORM_MOLDBYGG_WOSHUA, FORM_SHYREN, FORM_MAD_DUMMY, FORM_TEMMIE, FORM_TEMMIE_MOLDBYGG, FORM_UNDYNE, FORM_WF_COUNT,
+ /* Hotland (Mettaton's shows and a laser's alarm play their own way: htshows.c) */
+ FORM_VULKIN = FORM_WF_COUNT, FORM_TSUNDERPLANE, FORM_TSUNDER_VULKIN, FORM_PYROPE, FORM_PYROPE2, FORM_MTT_QUIZ,
+ FORM_MTT_COOK, FORM_LASERS, FORM_COUNT
};
enum {
@@ -39,7 +44,10 @@ enum {
/* 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_DUMMY_MINIONS, ATK_DUMMY_MISSILES, ATK_TEMMIE_HOPS,
- ATK_UNDYNE_ARROWS, ATK_UNDYNE_SPEARS, ATK_COUNT
+ ATK_UNDYNE_ARROWS, ATK_UNDYNE_SPEARS, ATK_WF_COUNT,
+ /* Hotland */
+ ATK_VULKIN_THUNDER = ATK_WF_COUNT, ATK_VULKIN_FIRE, ATK_TSUNDER_BOMBS, ATK_TSUNDER_DIVE, ATK_PYROPE_BOMBS,
+ ATK_PYROPE_ROPE, ATK_COUNT
};
/* a formation: up to three monsters, and what the first turn says */
@@ -60,4 +68,9 @@ 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);
+const Form *ht_form(int form); /* htmon.c */
+const struct MonDef *ht_mon_def(int id);
+void ht_attack_run(struct Battle *b, int atk, int t);
+int ht_attack_length(int atk);
+int ht_encounter(int room);
#endif
diff --git a/games/undertale/src/rooms.c b/games/undertale/src/rooms.c
index 4f6c279e..16c1498c 100644
--- a/games/undertale/src/rooms.c
+++ b/games/undertale/src/rooms.c
@@ -4,6 +4,7 @@
#include "event.h"
#include "events.h"
#include "game.h"
+#include "hotland.h"
#include "monsters.h"
#include "ruins.h"
#include "snowdin.h"
@@ -20,6 +21,7 @@ void room_setup(int room, int from) {
wf1_setup(room, from);
wf2_setup(room, from);
wf3_setup(room, from);
+ ht1_setup(room, from);
}
/* each frame Frisk can walk: what a room watches (a rock on its switch, a cracked floor) */
@@ -29,12 +31,14 @@ void room_update(void) {
snow2_update();
wf1_update();
wf3_update();
+ ht1_update();
}
/* what a room draws on its floor, under everything (world.c) */
void room_draw_floor(void) {
snow1_draw();
snow2_draw();
+ ht1_draw();
}
/* a pushed rock that may go where Frisk can't (a bridge seed into the water), and what happens once it has */
diff --git a/games/undertale/src/shoot.c b/games/undertale/src/shoot.c
new file mode 100644
index 00000000..1a336f0b
--- /dev/null
+++ b/games/undertale/src/shoot.c
@@ -0,0 +1,134 @@
+/* Hotland's shooting puzzles (the Reactivated Door Puzzles), on their own screen (MODE_SHOOT).
+ *
+ * A grid of blocks stands between Frisk's ship, below, and the target, above. Each arrow pushes every dark block one
+ * cell that way, where there's room inside the grid; the light blocks never move. Z shoots straight up: a shot
+ * breaks the first dark block it meets, a light one stops it, and a clear way hits the target. Two shots a try:
+ * out of them, it starts over. (The rules are worked out from the solutions the Undertale Wiki gives for them; the
+ * grids are the game's, as its screenshots show them.) */
+#include <string.h>
+#include "game.h"
+#include "gfx.h"
+#include "plat.h"
+#include "res.h"
+#include "shoot.h"
+
+typedef struct {
+ uint8_t w, h, ship;
+ const char *rows[6]; /* '#' a light block, 'o' a dark one, ' ' nothing */
+} Puzzle;
+static const Puzzle puzzles[SHOOT_COUNT] = {
+ [SHOOT_RIGHT] = {3, 3, 1, {"#o#", " ", "#o#"}},
+ [SHOOT_LEFT] = {4, 4, 2, {"# #", "ooo ", " #o#", "#oo "}},
+};
+#define CELL 24
+#define SHOTS 2
+
+static int id, shots, result, t, shot_y, fail_t;
+static char grid[6][6];
+static bool won;
+
+static void reset(void) {
+ const Puzzle *p = &puzzles[id];
+ for (int y = 0; y < p->h; y++)
+ for (int x = 0; x < p->w; x++) grid[y][x] = p->rows[y][x];
+ shots = SHOTS, shot_y = -1, fail_t = 0, won = false;
+}
+
+void shoot_open(int which) {
+ id = which, result = 0, t = 0;
+ reset();
+ g_mode = MODE_SHOOT;
+}
+int shoot_result(void) { return result; }
+
+static void push(int dx, int dy) {
+ const Puzzle *p = &puzzles[id];
+ /* one cell a press; the dark blocks nearest the way they go move first, so a line of them moves together */
+ for (int y = 0; y < p->h; y++)
+ for (int x = 0; x < p->w; x++) {
+ int sx = dx > 0 ? p->w - 1 - x : x, sy = dy > 0 ? p->h - 1 - y : y;
+ if (grid[sy][sx] != 'o') continue;
+ int nx = sx + dx, ny = sy + dy;
+ if (nx < 0 || ny < 0 || nx >= p->w || ny >= p->h || grid[ny][nx] != ' ') continue;
+ grid[ny][nx] = 'm', grid[sy][sx] = ' '; /* (marked: moved once) */
+ }
+ for (int y = 0; y < p->h; y++)
+ for (int x = 0; x < p->w; x++)
+ if (grid[y][x] == 'm') grid[y][x] = 'o';
+}
+
+void shoot_update(uint32_t keys, uint32_t pressed) {
+ (void)keys;
+ const Puzzle *p = &puzzles[id];
+ t++;
+ if (won) {
+ if (++fail_t > 40) result = 1, g_mode = MODE_WORLD;
+ return;
+ }
+ if (fail_t) {
+ if (++fail_t > 45) reset();
+ return;
+ }
+ if (shot_y >= 0) {
+ /* the shot flies up its column, a cell every few frames */
+ if (t % 3) return;
+ shot_y--;
+ if (shot_y < 0) {
+ won = true, fail_t = 1;
+ return;
+ }
+ char *c = &grid[shot_y][p->ship];
+ if (*c == ' ') return;
+ if (*c == 'o') *c = ' ';
+ shot_y = -1;
+ if (!shots) fail_t = 1;
+ return;
+ }
+ if (pressed & K_X) {
+ result = 0, g_mode = MODE_WORLD;
+ return;
+ }
+ if (pressed & K_UP) push(0, -1);
+ else if (pressed & K_DOWN) push(0, 1);
+ else if (pressed & K_LEFT) push(-1, 0);
+ else if (pressed & K_RIGHT) push(1, 0);
+ else if ((pressed & K_Z) && shots) shots--, shot_y = p->h, t = 0;
+}
+
+void shoot_draw(void) {
+ const Puzzle *p = &puzzles[id];
+ gfx_rect(0, 0, SCREEN_W, SCREEN_H, C_BLACK, 255);
+ int gw = p->w * CELL, gh = p->h * CELL;
+ int gx = (SCREEN_W - gw) / 2, gy = 104 - gh / 2;
+ uint16_t grey = rgb565(0x909090), dim = rgb565(0x606060);
+ /* the frame, the target, the ship */
+ gfx_rect(gx - 40, 16, gw + 80, 1, grey, 255);
+ gfx_rect(gx - 40, 190, gw + 80, 1, grey, 255);
+ gfx_rect(gx - 40, 16, 1, 175, grey, 255);
+ gfx_rect(gx + gw + 39, 16, 1, 175, grey, 255);
+ int cx = gx + p->ship * CELL + CELL / 2;
+ if (!won || (t / 3) % 2)
+ for (int k = 0; k < 8; k++) gfx_rect(cx - 8 + k, 22 + k, 16 - 2 * k, 1, grey, 255);
+ for (int k = 0; k < 9; k++) gfx_rect(cx - k, 172 + k, 2 * k + 1, 1, rgb565(0xA0A030), 255);
+ /* the grid */
+ gfx_rect(gx - 2, gy - 2, gw + 4, 1, dim, 255);
+ gfx_rect(gx - 2, gy + gh + 1, gw + 4, 1, dim, 255);
+ gfx_rect(gx - 2, gy - 2, 1, gh + 4, dim, 255);
+ gfx_rect(gx + gw + 1, gy - 2, 1, gh + 4, dim, 255);
+ for (int y = 0; y < p->h; y++)
+ for (int x = 0; x < p->w; x++) {
+ int bx = gx + x * CELL + 2, by = gy + y * CELL + 2;
+ if (grid[y][x] == '#') {
+ gfx_rect(bx, by, CELL - 4, CELL - 4, grey, 255);
+ } else if (grid[y][x] == 'o') {
+ gfx_rect(bx, by, CELL - 4, CELL - 4, grey, 255);
+ gfx_rect(bx + 2, by + 2, CELL - 8, CELL - 8, C_BLACK, 255);
+ }
+ }
+ if (shot_y >= 0) gfx_rect(cx - 1, gy + shot_y * CELL + CELL / 2 - 4, 3, 8, C_YELLOW, 255);
+ /* the shots left, and how it plays */
+ for (int k = 0; k < shots; k++) gfx_rect(gx + gw + 50 + k * 8, 176, 4, 8, C_YELLOW, 255);
+ if (fail_t && !won) gfx_text(FONT_MAIN, 120, 200, "RESTART...", C_WHITE, 255);
+ else if (won) gfx_text(FONT_MAIN, 128, 200, "SUCCESS!", C_YELLOW, 255);
+ else gfx_text(FONT_SMALL, 40, 204, "ARROWS: MOVE BLOCKS Z: SHOOT X: LEAVE", dim, 255);
+}
diff --git a/games/undertale/src/shoot.h b/games/undertale/src/shoot.h
new file mode 100644
index 00000000..87256481
--- /dev/null
+++ b/games/undertale/src/shoot.h
@@ -0,0 +1,10 @@
+/* Undertale: Hotland's shooting puzzles (shoot.c), on their own screen. */
+#ifndef UT_SHOOT_H
+#define UT_SHOOT_H
+#include <stdint.h>
+enum { SHOOT_RIGHT, SHOOT_LEFT, SHOOT_COUNT };
+void shoot_open(int id); /* MODE_SHOOT until solved or left */
+int shoot_result(void); /* 1 solved, 0 left */
+void shoot_update(uint32_t keys, uint32_t pressed);
+void shoot_draw(void);
+#endif
diff --git a/games/undertale/src/text.c b/games/undertale/src/text.c
index 7d5f91b0..983664d8 100644
--- a/games/undertale/src/text.c
+++ b/games/undertale/src/text.c
@@ -30,6 +30,7 @@ static const Expr flowey_faces[] = {
{SPR_FLOWEYSIDESHOCK, 4, -2},
};
static const Expr sans_faces[] = {{SPR_FACE_SANS, 4, 0}, {SPR_FACE_SANSCHUCKLE, 4, 0}, {SPR_FACE_SANSWINK, 4, 0}};
+static const Expr alphys_faces[] = {{SPR_FACE_ALPHYS, 4, 0}};
static const Expr papyrus_faces[] = {
{SPR_FACE_PAPYRUS, 4, -4}, {SPR_FACE_PAPYRUSEVIL, 4, -4}, {SPR_FACE_PAPYRUSLAUGH, 4, -4},
{SPR_FACE_PAPYRUSMAD, 4, -4}, {SPR_FACE_PAPYRUSSIDE, 4, -4},
@@ -42,6 +43,7 @@ static const struct {
[FACE_FLOWEY] = {flowey_faces, sizeof flowey_faces / sizeof flowey_faces[0]},
[FACE_SANS] = {sans_faces, sizeof sans_faces / sizeof sans_faces[0]},
[FACE_PAPYRUS] = {papyrus_faces, sizeof papyrus_faces / sizeof papyrus_faces[0]},
+ [FACE_ALPHYS] = {alphys_faces, 1},
};
/* ---------------------------------------------------------------- the writer */
diff --git a/games/undertale/src/wf3.c b/games/undertale/src/wf3.c
index bc291534..d6cce480 100644
--- a/games/undertale/src/wf3.c
+++ b/games/undertale/src/wf3.c
@@ -132,7 +132,6 @@ void wf3_setup(int room, int from) {
Obj *f = obj_deco(SPR_UNDYNE_FALLEN, 534, 6213, false);
if (f) f->name = ACTOR_UNDYNE, f->event = EV_HOT_UNDYNE, f->flags |= OF_TALK, obj_set_box(f, 0, 6, 50, 20);
}
- if (!flag(F_HOTLAND)) obj_trigger(1000, 6100, 16, 300, EV_HOT_END, ACTOR_TRIGGER2);
break;
}
}
@@ -356,15 +355,6 @@ static int ev_hot_cooler(Ev *c) {
EV_END;
}
-static int ev_hot_end(Ev *c) {
- EV_BEGIN;
- set_flag(F_HOTLAND, 1);
- sv.room = (int16_t)g_room, sv.x = (int16_t)(pl.x - 30), sv.y = pl.y;
- save_write_auto();
- menu_end_open();
- EV_END;
-}
-
int wf3_event(Ev *c) {
switch (c->id) {
case EV_DEADEND: return ev_deadend(c);
@@ -374,7 +364,6 @@ int wf3_event(Ev *c) {
case EV_PAP_NEON: return ev_pap_neon(c);
case EV_HOT_UNDYNE: return ev_hot_undyne(c);
case EV_HOT_COOLER: return ev_hot_cooler(c);
- case EV_HOT_END: return ev_hot_end(c);
}
return -1;
}
diff --git a/games/undertale/src/wfmon.c b/games/undertale/src/wfmon.c
index ec500afd..507f2bb1 100644
--- a/games/undertale/src/wfmon.c
+++ b/games/undertale/src/wfmon.c
@@ -197,7 +197,7 @@ static const char *flavor_undyne(Battle *b, Monster *m) {
}
static int attack_undyne(Battle *b, Monster *m) { (void)m; return b->turn % 2 ? ATK_UNDYNE_ARROWS : ATK_UNDYNE_SPEARS; }
-static const MonDef wf_defs[MON_COUNT - MON_SNOW_COUNT] = {
+static const MonDef wf_defs[MON_WF_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,
@@ -240,7 +240,7 @@ static const MonDef wf_defs[MON_COUNT - MON_SNOW_COUNT] = {
.acts = {"Plead", "Challenge"}, .nacts = 2, .act = act_undyne, .talk = talk_undyne, .attack = attack_undyne,
.flavor = flavor_undyne},
};
-const MonDef *wf_mon_def(int id) { return &wf_defs[id - MON_SNOW_COUNT]; }
+const MonDef *wf_mon_def(int id) { return id >= MON_WF_COUNT ? ht_mon_def(id) : &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) {
@@ -250,7 +250,7 @@ static void woshua_check(Battle *b) {
}
}
-static const Form wf_forms[FORM_COUNT - FORM_SNOW_COUNT] = {
+static const Form wf_forms[FORM_WF_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."},
@@ -263,7 +263,7 @@ static const Form wf_forms[FORM_COUNT - FORM_SNOW_COUNT] = {
[FORM_TEMMIE_MOLDBYGG - FORM_SNOW_COUNT] = {{MON_TEMMIE, MON_MOLDBYGG}, 2, "* Temmie and Moldbygg come along."},
[FORM_UNDYNE - FORM_SNOW_COUNT] = {{MON_UNDYNE}, 1, "* Undyne attacks!"},
};
-const Form *wf_form(int form) { return &wf_forms[form - FORM_SNOW_COUNT]; }
+const Form *wf_form(int form) { return form >= FORM_WF_COUNT ? ht_form(form) : &wf_forms[form - FORM_SNOW_COUNT]; }
/* random encounters: the wiki's pools, room by room */
int wf_encounter(int room) {
@@ -279,7 +279,7 @@ int wf_encounter(int room) {
return pool[rnd_n(5)];
}
}
- return -1;
+ return ht_encounter(room);
}
/* ---------------------------------------------------------------- the attacks */
@@ -374,7 +374,7 @@ static void atk_shyren_notes(int t) {
}
}
-int wf_attack_length(int atk) { (void)atk; return 160; }
+int wf_attack_length(int atk) { return atk >= ATK_WF_COUNT ? ht_attack_length(atk) : 160; }
/* Mad Dummy: its dummies fly in from the sides and fire; later its magic missiles home in on the SOUL, and one that
* flies into Mad Dummy (up at the board's top middle, where it shows) hurts it */
@@ -458,7 +458,10 @@ static void atk_undyne_spears(int t) {
}
void wf_attack_run(Battle *b, int atk, int t) {
- (void)b;
+ if (atk >= ATK_WF_COUNT) {
+ ht_attack_run(b, atk, t);
+ return;
+ }
if (t < 0) {
if (atk == ATK_UNDYNE_ARROWS) {
board_set(80, 80);
diff --git a/games/undertale/tests/check.py b/games/undertale/tests/check.py
index 4a504611..0aba194a 100644
--- a/games/undertale/tests/check.py
+++ b/games/undertale/tests/check.py
@@ -33,7 +33,10 @@ ROOMS = {m.group(1): int(m.group(2)) for m in
FORM_SNOWDRAKE, FORM_PAPYRUS = 19, 31
(FORM_AARON, FORM_WOSHUA, FORM_WOSHUA_AARON, FORM_MOLDBYGG, FORM_MOLDBYGG_MOLDSMAL, FORM_MOLDBYGG_WOSHUA, FORM_SHYREN,
FORM_MAD_DUMMY, FORM_TEMMIE, FORM_TEMMIE_MOLDBYGG, FORM_UNDYNE) = range(32, 43)
+(FORM_VULKIN, FORM_TSUNDERPLANE, FORM_TSUNDER_VULKIN, FORM_PYROPE, FORM_PYROPE2, FORM_MTT_QUIZ, FORM_MTT_COOK,
+ FORM_LASERS) = range(43, 51)
ITEM_OLD_TUTU, ITEM_BALLET_SHOES, ITEM_QUICHE, ITEM_PUNCH_CARD, ITEM_ARTIFACT, ITEM_ASTRONAUT_FOOD = range(17, 23)
+ITEM_BURNT_PAN, ITEM_INSTANT_NOODLES = 28, 29
def run(args, frames, saves=None, what=""):
@@ -120,6 +123,22 @@ for form, seq, gold in ((FORM_AARON, "1,1,1", 30), (FORM_WOSHUA, "1,1,1", 25), (
s = run(["--god", "--battle", str(FORM_MAD_DUMMY), "--path", "act:1"], 9000, what="Mad Dummy")
check(s and s["mode"] == MODE_WORLD and s["kills"] == 0, f"Mad Dummy's fight did not end: {s}")
+# Hotland's battles: fled from, fought, spared (Vulkin encouraged, Pyrope heated up twice); Mettaton's quiz, his
+# cooking show's jetpack and a laser's alarm play their own way to their end
+for form in range(FORM_VULKIN, FORM_PYROPE2 + 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_VULKIN, FORM_TSUNDERPLANE, FORM_PYROPE):
+ 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_VULKIN, "2", 40), (FORM_PYROPE, "1,1", 45), (FORM_PYROPE2, "1,1,1@2,1@2", 90)):
+ 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}")
+for form in (FORM_MTT_QUIZ, FORM_MTT_COOK, FORM_LASERS):
+ s = run(["--god", "--battle", str(form), "--path", "talk"], 3000, what=f"show {form}")
+ check(s and s["mode"] == MODE_WORLD, f"show {form} did not end: {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")
@@ -180,19 +199,32 @@ if not QUICK:
if not QUICK:
s = run(["--name", "Frisk", "--noenc", "--god", "--room", str(ROOMS["WF1"]), "--at", "30,1480", "--path-file",
os.path.join(HERE, "waterfall.path")], 60000, what="Waterfall")
- check(s and s["mode"] == MODE_END and s["room"] == ROOMS["HT_ENTRANCE"], f"Waterfall did not end in Hotland: {s}")
+ check(s and s["mode"] == MODE_WORLD and s["room"] == ROOMS["HT_LABFRONT"], f"Waterfall did not end in Hotland: {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_ONION", 2), ("PIANO", 1), ("WF_ARTIFACT", 1), ("SHYREN", 1),
("UMBRELLA", 3), ("MK_RAIN", 2), ("WF_BRIDGE", 1), ("WF_DUMP", 1), ("WF_COOLER", 2),
("MAD_DUMMY", 1), ("NAPSTA_HOME", 2), ("TEM_VILLAGE", 1), ("DEADEND", 1), ("MK_CHASM", 2),
- ("UNDYNE", 4), ("WATER_CUP", 2), ("PAP_NEON", 1), ("HOTLAND", 1)):
+ ("UNDYNE", 4), ("WATER_CUP", 2), ("PAP_NEON", 1)):
check(flag(s, name) == v, f"Waterfall: F_{name} is {flag(s, name)}, not {v}")
check(s["kills"] == 0, f"Waterfall: {s['kills']} killed on the friendly way")
for item in (ITEM_OLD_TUTU, ITEM_BALLET_SHOES, ITEM_QUICHE, ITEM_PUNCH_CARD, ITEM_ARTIFACT, ITEM_ASTRONAUT_FOOD):
check(item in s["items"], f"Waterfall: item {item} not picked up: {s['items']}")
+# Hotland's first floor: Alphys and the quiz, the noodles, the belts, the vents, the lasers, both shooting puzzles, the
+# cooking show, up to the elevator
+if not QUICK:
+ s = run(["--name", "Frisk", "--noenc", "--god", "--room", str(ROOMS["HT_LABFRONT"]), "--at", "1000,6230",
+ "--path-file", os.path.join(HERE, "hotland.path")], 16000, what="Hotland")
+ check(s and s["mode"] == MODE_END and s["room"] == ROOMS["HT_COREVIEW"], f"Hotland did not end at the elevator: {s}")
+ if s:
+ for name, v in (("HT_LAB", 2), ("HT_NOODLES", 1), ("HT_CALL_LASER", 1), ("HT_CALL_HUB", 1), ("HT_CALL_ISLE", 1),
+ ("HT_CALL_CORE", 1), ("HT_PUZ_R", 1), ("HT_PUZ_L", 1), ("HT_BLUE_OFF", 1), ("HT_COOK", 1),
+ ("HT_FLOOR1", 1)):
+ check(flag(s, name) == v, f"Hotland: F_{name} is {flag(s, name)}, not {v}")
+ check(ITEM_INSTANT_NOODLES in s["items"], f"Hotland: the noodles not taken: {s['items']}")
+
if failures:
print("\n".join("FAIL " + f for f in failures))
sys.exit(1)
diff --git a/games/undertale/tests/hotland.path b/games/undertale/tests/hotland.path
new file mode 100644
index 00000000..cdea25e9
--- /dev/null
+++ b/games/undertale/tests/hotland.path
@@ -0,0 +1,145 @@
+# Hotland's first floor, from the crossroads before the Lab (play it with --room 127 --at 1000,6230 --name Frisk
+# --noenc --god): Alphys and Mettaton's quiz, the phone's upgrade and the noodles in the fridge
+go:1300,6262
+1350,6250
+w30
+talk
+w30
+talk
+go:2050,6232
+u
+z
+pick:0
+talk
+# out the Lab's east door, up the conveyor belts
+go:2500,6255
+2545,6255
+w20
+go:2958,6250
+go:2958,6010
+2958,5960
+w20
+go:2915,5880
+go:2915,5470
+go:2958,5420
+go:2958,5260
+2958,5200
+w20
+go:2860,5150
+go:2860,4740
+go:2958,4700
+go:2958,4400
+2958,4340
+w20
+# the Magma Chamber: the vents east, up and west, to the way north (the burnt pan's room left aside)
+go:2968,4250
+go:3190,4226
+vent:3240,4226
+w20
+3302,4198
+3380,4198
+go:3405,4170
+vent:3422,4168
+w20
+go:3340,4048
+vent:3366,3990
+w20
+go:3185,3960
+3185,3900
+w20
+# the laser walkway (its alarm, when a laser catches Frisk), Alphys's call
+go:3185,3830
+talk
+go:3400,3820
+go:4150,3820
+4215,3820
+w20
+# the puzzle hub: its vent turns a quarter each time (north: the locked door, east: the right puzzle, south, west: the
+# left one, its blue laser switched off by Alphys), both puzzles solved, then north through the door
+go:4820,3800
+go:4820,3690
+talk
+vent:4820,3600
+w20
+u
+z
+talk
+vent:4820,3600
+w20
+vent:4826,3612
+w20
+go:5262,3610
+5262,3560
+w20
+go:5258,3424
+u
+z
+w10
+u
+w4
+l
+w4
+z
+w30
+z
+w80
+talk
+go:5260,3480
+5260,3520
+w20
+go:4960,3610
+vent:4890,3610
+w20
+vent:4810,3610
+w20
+vent:4820,3600
+w20
+go:4500,3610
+go:4392,3610
+talk
+4392,3560
+w20
+go:4389,3424
+u
+z
+w10
+u
+w4
+l
+w4
+d
+w4
+l
+w4
+z
+w30
+z
+w80
+talk
+go:4390,3480
+4390,3520
+w20
+go:4700,3610
+vent:4770,3610
+w20
+vent:4840,3610
+w20
+4820,3420
+w30
+# over the vents to Mettaton's cooking show (the jetpack), the CORE far off, and the elevator up, where the game
+# now ends
+go:4818,3150
+go:4900,3110
+vent:4960,3110
+w60
+w60
+go:5330,3110
+talk
+w30
+talk
+go:6300,3120
+talk
+go:6960,3110
+u
+z
+pick:0
diff --git a/games/undertale/tests/play.c b/games/undertale/tests/play.c
index 6a7cbe45..ac74cd90 100644
--- a/games/undertale/tests/play.c
+++ b/games/undertale/tests/play.c
@@ -230,6 +230,23 @@ static uint32_t path_keys(int f) {
}
return (f & 1) ? K_Z : 0;
}
+ /* "vent:x,y": toward (x, y), straight, until something starts on the way (a steam vent blows Frisk off) */
+ if (!strncmp(tok, "vent:", 5)) {
+ if (event_running()) {
+ path_at = next;
+ return 0;
+ }
+ if (g_mode != MODE_WORLD || text_active() || world_fading()) return 0;
+ int vx, vy;
+ sscanf(tok + 5, "%d,%d", &vx, &vy);
+ int dx = vx - pl.x, dy = vy - pl.y;
+ if (abs(dx) <= 1 && abs(dy) <= 1) {
+ path_at = next;
+ return 0;
+ }
+ if (abs(dx) > 1) return dx > 0 ? K_RIGHT : K_LEFT;
+ return dy > 0 ? K_DOWN : K_UP;
+ }
if (!strncmp(tok, "go:", 3)) {
static char *planned;
if (g_mode != MODE_WORLD || text_active() || event_blocking() || world_fading()) return 0;
@@ -286,6 +303,12 @@ static uint32_t path_keys(int f) {
return 0;
}
path_room = g_room;
+ /* or a door inside the room did (he's far from where he just was) */
+ if (abs(pl.x - path_last_x) > 40 || abs(pl.y - path_last_y) > 40) {
+ path_last_x = pl.x, path_last_y = pl.y;
+ path_at = next;
+ return 0;
+ }
int dx = x - pl.x, dy = y - pl.y;
if (abs(dx) <= 1 && abs(dy) <= 1) {
path_at = next;
diff --git a/games/undertale/tests/waterfall.path b/games/undertale/tests/waterfall.path
index 69d69bd2..a601d5cf 100644
--- a/games/undertale/tests/waterfall.path
+++ b/games/undertale/tests/waterfall.path
@@ -321,7 +321,7 @@ go:22190,2110
22190,2030
# the chasm: Monster Kid on the bridge, then hanging off it, helped up; Undyne on her crag, her fight (fled), her
# chase by the river and the neon sign (Papyrus calls); Hotland: she falls in the heat, the cooler's water for her,
-# and on, where the game now ends
+# and on to the crossroads before the Lab (hotland.path goes on from there)
go:22390,2030
talk
go:22626,2022
@@ -355,4 +355,4 @@ z
pick:0
talk
w20
-go:1010,6220
+go:1000,6230
diff --git a/games/undertale/tools/fetch.py b/games/undertale/tools/fetch.py
index c5f52ffd..a865132b 100644
--- a/games/undertale/tools/fetch.py
+++ b/games/undertale/tools/fetch.py
@@ -56,7 +56,14 @@ PAGES = ["Ruins", "Ruins/Puzzles", "Toriel", "Toriel/In_battle", "Toriel's_Home"
"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",
"Junk_Food", "Annoying_Dog/In_battle", "Lesser_Dog/In_battle", "Greater_Dog/In_battle", "Doggo/In_battle",
- "Dogamy_and_Dogaressa/In_battle"]
+ "Dogamy_and_Dogaressa/In_battle",
+ # Hotland and the CORE
+ "Hotland", "Hotland/Puzzles", "Alphys", "Alphys's_Lab", "Mettaton", "Mettaton/In_battle", "Mettaton_EX",
+ "Muffet", "Muffet/In_battle", "Royal_Guard/In_battle", "Vulkin", "Tsunderplane", "Pyrope", "So_Sorry",
+ "Madjick", "Knight_Knight", "Final_Froggit", "Whimsalot", "Astigmatism", "CORE", "MTT_Resort", "Burgerpants",
+ "Heats_Flamesman", "Bratty_and_Catty", "Spider_Bake_Sale", "Elevator", "Sans/Hotland", "Hot_Dog...?",
+ "Cell_Phone/Alphys", "Steam_Vent", "Conveyor_belt", "Mettaton_quiz_show", "Laser", "Royal_Guards", "Bomb",
+ "Stained_Apron", "Hot_Dog_Harpy", "Art_Club_room", "Spider_Entrance", "Multicolor_Tile_Puzzle", "Lab"]
# files the categories leave out, as their wiki names
FILES = ["QC sprite.png", "QC screenshot shop.png", "Gerson screenshot shop.png", "Tem Shop screenshot Temmie Armor.png"]
DEMO = {
diff --git a/games/undertale/tools/pack.py b/games/undertale/tools/pack.py
index d44839a8..2bcc6572 100644
--- a/games/undertale/tools/pack.py
+++ b/games/undertale/tools/pack.py
@@ -665,6 +665,16 @@ def main():
a[(a[:, :, 0] == c[0]) & (a[:, :, 1] == c[1]) & (a[:, :, 2] == c[2])] = 0
out.append(Image.fromarray(a, "RGBA"))
imgs = out
+ if "only" in opts: # only these colours kept (a thing cut from a map that shares the map's colours)
+ out = []
+ for im in imgs:
+ a = np.array(im)
+ keep = np.zeros(a.shape[:2], bool)
+ for c in opts["only"]:
+ keep |= (a[:, :, 0] == c[0]) & (a[:, :, 1] == c[1]) & (a[:, :, 2] == c[2])
+ a[~keep] = 0
+ out.append(Image.fromarray(a, "RGBA"))
+ imgs = out
if opts.get("mirror"):
imgs = [im.transpose(Image.FLIP_LEFT_RIGHT) for im in imgs]
if "tints" in opts: # the first frame, then it again in each colour (the SOUL's modes)
diff --git a/games/undertale/tools/rooms.py b/games/undertale/tools/rooms.py
index 2dde8162..c6be23f2 100644
--- a/games/undertale/tools/rooms.py
+++ b/games/undertale/tools/rooms.py
@@ -140,9 +140,25 @@ AREAS.append(dict(name="waterfall", map="Waterfall_map.png", floor=WF_FLOOR, mar
("erase", 2380, 1500, 80, 20, "ring"), ("erase", 2850, 1240, 30, 80, "ring"), ("erase", 3040, 1540, 80, 20, "ring"),
]))
-# Hotland: its orange rock floors (its black is nothing)
+# Hotland: its orange rock floors (its black is nothing); the striped bridges, the conveyor belts, the Lab's tiles
HT_FLOOR = [(181, 85, 21), (169, 124, 41), (178, 83, 19), (91, 65, 0)]
+HT_STRIPE = [(239, 153, 104), (81, 34, 33), (198, 104, 80), (156, 62, 61), (114, 39, 38)]
+HT_BELT = [(112, 83, 71), (52, 50, 78), (107, 67, 78)]
+LAB_FLOOR = [(186, 233, 233), (220, 255, 186), (198, 232, 234), (52, 50, 78), (128, 169, 202)]
+HT_DOCK = [(54, 47, 121), (27, 33, 90), (27, 21, 72), (23, 13, 43), (45, 49, 96)]
+HT_HUB = [(131, 44, 66), (70, 32, 58)]
+HT_KITCHEN = []
+# the steam vents' grates (their platforms 60 pixels square around them)
+HT_VENTS_MAGMA = [(3120, 4000), (3362, 4000), (3503, 4060), (3420, 4180), (3225, 4240), (3325, 4240), (3525, 4240)]
+HT_VENTS_HUB = [(4820, 3620), (4820, 3560), (4740, 3620), (4900, 3620)]
+HT_VENTS_ISLE = [(4940, 3120), (5060, 3120), (5180, 3120)]
AREAS.append(dict(name="hotland", map="Hotland_map.png", floor=HT_FLOOR, margin=0, close=True, patches=[
+ # who the game moves about: the Royal Guards at the elevator (and by the vents, later), the clam by the cooler,
+ # Alphys and Mettaton (through the wall) in the Lab, the Vulkin on the belts, the Pyrope by the pan, the pan
+ *[("copy", 1006, 6120, 88, 20, 1006, y) for y in (6140, 6160, 6180)], ("erase", 726, 6216, 52, 56, "ring"),
+ ("copy", 2100, 6152, 82, 82, 2181, 6152), ("erase", 2198, 6241, 30, 36, "ring"),
+ ("erase", 2993, 5170, 30, 32, "ring"), ("erase", 3762, 4424, 34, 42, "ring"), ("erase", 3476, 4468, 18, 18, "ring"),
+ ("erase", 4805, 3098, 70, 56, "ring"),
# Undyne, fallen on the bridge in the heat (an object here, there only if she chased Frisk): the planks repeat
# every 40 pixels
("copy", 454, 6219, 50, 21, 534, 6219),
@@ -471,8 +487,44 @@ ROOMS = [
doors=[((23498, 775, 8, 47), "wf_north", (23449, 910), "down"),
((24210, 775, 10, 47), "ht_entrance", (24, 6206), "right")]),
# Hotland's first room: Sans's station, the bridge over the lava, the water cooler
- dict(name="ht_entrance", area="hotland", rect=(0, 6080, 1460, 320), title="Hotland",
+ dict(name="ht_entrance", area="hotland", rect=(0, 6080, 800, 320), title="Hotland",
doors=[((0, 6215, 6, 45), "wf_hotgate", (24180, 776), "left")]),
+ # the crossroads before the Lab: the elevator up north (the Royal Guards in the way), the River Person's dock
+ # south, the Lab east
+ dict(name="ht_labfront", area="hotland", rect=(800, 5880, 640, 480), title="Hotland",
+ doors=[((1322, 6240, 40, 44), "ht_lab", (1462, 6250), "right")]),
+ dict(name="ht_river", area="hotland", rect=(900, 6360, 320, 240), title="Hotland", floor_colors=HT_DOCK),
+ # Alphys's Lab, both its floors (the escalators between them)
+ dict(name="ht_lab", area="hotland", rect=(1440, 5860, 1100, 460), title="Lab", floor_colors=LAB_FLOOR,
+ doors=[((1440, 6200, 6, 100), "ht_labfront", (1300, 6262), "left"),
+ ((2534, 6220, 6, 80), "ht_labexit", (2615, 6250), "right")]),
+ # out of the Lab: the conveyor belts north, two rooms of them, then the striped bridge up
+ dict(name="ht_labexit", area="hotland", rect=(2540, 5990, 440, 350), title="Hotland",
+ doors=[((2580, 6236, 34, 44), "ht_lab", (2500, 6255), "left")]),
+ dict(name="ht_belt1", area="hotland", rect=(2800, 5240, 320, 800), title="Hotland", floor_colors=HT_STRIPE + HT_BELT),
+ dict(name="ht_belt2", area="hotland", rect=(2800, 4380, 320, 860), title="Hotland", floor_colors=HT_STRIPE + HT_BELT,
+ fix=[("walk", 2944, 4674, 52, 14)]),
+ # the Magma Chamber's islands and steam vents; the burnt pan's room below it; the laser walkway north
+ dict(name="ht_magma", area="hotland", rect=(2860, 3940, 860, 440), title="Hotland", floor_colors=HT_STRIPE,
+ fix=[("walk", x - 24, y - 24, 68, 68) for x, y in HT_VENTS_MAGMA]),
+ dict(name="ht_pan", area="hotland", rect=(3340, 4380, 640, 260), title="Hotland", floor_colors=HT_STRIPE + HT_BELT,
+ fix=[("walk", 3600, 4460, 60, 60)]),
+ dict(name="ht_lasers", area="hotland", rect=(3040, 3700, 1180, 240), title="Hotland", floor_colors=HT_STRIPE,
+ doors=[((4206, 3800, 14, 54), "ht_hub", (4600, 3792), "right")]),
+ # the puzzle hub: its turning vent, the shooting puzzles left and right, the door north they open
+ dict(name="ht_hub", area="hotland", rect=(4220, 3250, 1220, 690), title="Hotland", floor_colors=HT_STRIPE + HT_HUB,
+ fix=[("walk", x - 2, y - 2, 24, 24) for x, y in HT_VENTS_HUB] + [("walk", 4798, 3616, 72, 48), ("walk", 4804, 3396, 52, 86)],
+ doors=[((4583, 3795, 8, 50), "ht_lasers", (4176, 3800), "left"),
+ ((4800, 3400, 60, 8), "ht_ventisle", (4818, 3236), "up"),
+ # (the puzzles' doorways, and back out of them)
+ ((5257, 3596, 25, 12), "ht_hub", (5258, 3462), "up"), ((5250, 3500, 40, 4), "ht_hub", (5259, 3608), "down"),
+ ((4387, 3596, 25, 12), "ht_hub", (4389, 3462), "up"), ((4380, 3500, 40, 4), "ht_hub", (4389, 3608), "down")]),
+ # past the door: the vents over the lava, Mettaton's cooking show, the CORE far off and the elevator
+ dict(name="ht_ventisle", area="hotland", rect=(4660, 3000, 640, 300), title="Hotland", floor_colors=HT_STRIPE,
+ fix=[("walk", x - 24, y - 24, 68, 68) for x, y in HT_VENTS_ISLE],
+ doors=[((4800, 3292, 60, 8), "ht_hub", (4818, 3488), "down")]),
+ dict(name="ht_cooking", area="hotland", rect=(5300, 3000, 680, 260), title="Hotland", floor_colors=LAB_FLOOR + HT_KITCHEN),
+ dict(name="ht_coreview", area="hotland", rect=(5980, 2900, 1080, 340), title="Hotland", floor_colors=LAB_FLOOR),
]
# rooms one above the other through a dark doorway (tools/pack.py: apply_links); ("h", left, right, y, h): side
diff --git a/games/undertale/tools/sprites.py b/games/undertale/tools/sprites.py
index e3bea48c..c5a7e815 100644
--- a/games/undertale/tools/sprites.py
+++ b/games/undertale/tools/sprites.py
@@ -7,7 +7,8 @@ A sprite: (name, source or [sources], options). Sources (tools/pack.py load_fram
halved here (wiki1: as it is)
Options: origin (x, y) in the source's pixels, center (its middle), feet (the middle of its bottom),
frames (which of them), keep (no crop to the opaque pixels), every (one frame in n), clear (colours made
-see-through), mirror (flipped left to right), box (x, y, w, h: a part of the source, after halving).
+see-through), only (all colours but these made see-through), mirror (flipped left to right), box (x, y, w, h: a
+part of the source, after halving).
More sources: move:File.gif:x0,y0,x1,y1:frames (what moves in a wiki screenshot GIF), map:Map.png:x,y,w,h (a piece
of an area's map), gen:name (drawn here, GEN)."""
from PIL import Image, ImageDraw
@@ -122,6 +123,45 @@ def gen_arrow():
return [im]
+def gen_plane():
+ # Tsunderplane's little planes, pointing right
+ im = _img(16, 9)
+ d = ImageDraw.Draw(im)
+ w = (255, 255, 255, 255)
+ d.polygon([(15, 4), (12, 2), (1, 2), (0, 4), (1, 6), (12, 6)], fill=w)
+ d.polygon([(6, 2), (9, 2), (5, 0), (3, 0)], fill=w)
+ d.polygon([(6, 6), (9, 6), (5, 8), (3, 8)], fill=w)
+ d.polygon([(1, 2), (3, 2), (1, 0), (0, 0)], fill=w)
+ return [im]
+
+
+def gen_bomb():
+ # a round bomb with its fuse (Tsunderplane's, Pyrope's)
+ im = _img(9, 10)
+ d = ImageDraw.Draw(im)
+ d.ellipse([0, 1, 8, 9], fill=(255, 255, 255, 255))
+ d.line([(6, 1), (8, 0)], fill=(255, 255, 255, 255))
+ return [im]
+
+
+def gen_cloud():
+ # Vulkin's thundercloud
+ im = _img(26, 13)
+ d = ImageDraw.Draw(im)
+ w = (255, 255, 255, 255)
+ for box in ([0, 4, 10, 12], [6, 0, 17, 10], [14, 3, 25, 12], [4, 6, 22, 12]):
+ d.ellipse(box, fill=w)
+ return [im]
+
+
+def gen_bolt():
+ # a bolt of Vulkin's thunder, falling
+ im = _img(5, 9)
+ d = ImageDraw.Draw(im)
+ d.line([(3, 0), (1, 4), (3, 4), (1, 8)], fill=(255, 255, 255, 255), width=1)
+ return [im]
+
+
def gen_note():
im = _img(9, 11)
d = ImageDraw.Draw(im)
@@ -161,7 +201,8 @@ def gen_debris():
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, "spear": gen_spear, "note": gen_note, "drop": gen_drop, "arm": gen_arm,
- "debris": gen_debris, "arrow": gen_arrow}
+ "debris": gen_debris, "arrow": gen_arrow, "plane": gen_plane, "bomb": gen_bomb, "cloud": gen_cloud,
+ "bolt": gen_bolt}
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:"
@@ -322,12 +363,33 @@ SPRITES = [
("artifact", "map:Waterfall_map.png:10156,150,12,11",
{"keep": True, "clear": [(27, 21, 72), (27, 33, 90), (54, 47, 121), (99, 102, 135)]}),
("echo_ow", "wiki:Echo_Flower_overworld.png", {"feet": True}),
+ # Hotland: Alphys, Mettaton (his box), the Royal Guards at the elevator (cut from the map), the steam vents'
+ # grates each way (cut from the map: the turning ones are drawn over theirs), the burnt pan; its monsters
+ ("alphys_ow", "wiki:Alphys_overworld.png", {"feet": True}),
+ ("mtt_ow", "wiki:Mettaton_overworld_talking.gif", {"feet": True, "dedupe": True, "every": 4}),
+ ("mtt_b", "wiki:Mettaton_battle_box.gif", {"feet": True, "dedupe": True, "every": 10}),
+ ("rguards_ow", "map:Hotland_map.png:1012,6146,74,54",
+ {"keep": True, "only": [(0, 0, 0), (14, 31, 36), (22, 40, 50), (23, 40, 51), (74, 79, 108), (128, 129, 170)]}),
+ ("vent_d", "map:Hotland_map.png:3120,4000,20,20", {"keep": True}),
+ ("vent_u", "map:Hotland_map.png:3420,4180,20,20", {"keep": True}),
+ ("vent_l", "map:Hotland_map.png:3362,4000,20,20", {"keep": True}),
+ ("vent_r", "map:Hotland_map.png:3225,4240,20,20", {"keep": True}),
+ ("burntpan", "map:Hotland_map.png:3476,4468,18,18", {"keep": True, "clear": [(181, 85, 21), (178, 83, 19)]}),
+ ("vulkin_b", "wiki:Vulkin_battle_idle.gif", {"feet": True, "dedupe": True, "every": 10}),
+ ("vulkin_hurt", "wiki:Vulkin_battle_hurt.png", {"feet": True}),
+ ("tsunder_b", "wiki:Tsunderplane_battle_idle.gif", {"feet": True, "dedupe": True, "every": 14}),
+ ("pyrope_b", "wiki:Pyrope_battle_idle.gif", {"feet": True, "dedupe": True, "every": 6}),
+ ("pyrope_hurt", "wiki:Pyrope_battle_hurt.png", {"feet": True}),
# Undyne fallen in Hotland's heat, on its bridge (cut from the map, the bridge and the rock behind see-through)
("undyne_fallen", "map:Hotland_map.png:534,6213,50,27",
{"keep": True, "clear": [(169, 124, 41), (91, 65, 0), (62, 35, 0), (19, 35, 45), (18, 34, 44), (19, 35, 44),
(23, 37, 53), (20, 37, 47), (20, 36, 46), (12, 29, 33), (19, 36, 46), (23, 36, 52)]}),
("spear", "gen:spear", {"center": True}),
("arrow", "gen:arrow", {"center": True}),
+ ("plane", "gen:plane", {"center": True}),
+ ("bomb", "gen:bomb", {"center": True}),
+ ("cloud", "gen:cloud", {"center": True}),
+ ("bolt", "gen:bolt", {"center": True}),
("undyne_b", "wiki:Undyne_battle_armor.gif", {"feet": True, "every": 6}),
("note", "gen:note", {"center": True}),
("drop", "gen:drop", {"center": True}),
@@ -354,6 +416,9 @@ SPRITES = [
"torielsurprised", "torielembarrassed", "torielglasses", "torielrevengetalk", "torielscared", "torielblink",
"torielhappyblink", "torielbody", "sans", "sanschuckle", "sanswink", "papyrus", "papyrusevil",
"papyruslaugh", "papyrusmad", "papyrusside"]
+] + [
+ # Alphys's face (the wiki's), for her calls and talks
+ ("face_alphys", "wiki:Alphys_face.png", {"keep": True}),
] + [
# Flowey's faces (his talks and his battle)
(n, "demo:spr_" + n, {"keep": True}) for n in [