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 second floor, up to the elevator past the news

Mason Chenfeebf6baefa3
diff --git a/README.md b/README.md
index fe2d89d0..6197bb02 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, 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>
+ <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 two floors, from the golden flowers to Mettaton's news report</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, Waterfall and Hotland's first floor are out, the rest of Hotland, the CORE and New Home are next
+- [ ] Undertale: the Ruins, Snowdin, Waterfall and Hotland's first two floors 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 820d0a50..4e5f6393 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, 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.
+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. On the second floor, press the switches as the top conveyor belt carries you past them, and in Mettaton's news report, touch each bomb and defuse it while it's in the DEFUSE ZONE. For now the game ends at the elevator past the news report.
<br clear="right">
diff --git a/games/undertale/README.md b/games/undertale/README.md
index 761d703e..2194c430 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, 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.
+ The Ruins, Snowdin, Waterfall and Hotland's first two floors, from the bed of golden flowers to the elevator past Mettaton's news report. The rest of the Underground is on the way.
</p>
<p align="center">
@@ -27,7 +27,8 @@
* **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.
* **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.
+* **Hotland's second floor:** Sans's hot dog stand and Heats Flamesman, the invisible path to the Art Club's room, the Stained Apron, the conveyor belt puzzle and its three switches, the vent puzzle, the Bad Opinion Zone, the Royal Guards, and Mettaton's news report, where everything is a bomb and the clock is running.
+* **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, Pyrope and the Royal Guards in Hotland, and the news report's bombs, defused in the DEFUSE ZONE.
* **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.
@@ -112,6 +113,18 @@
<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>
+ <tr>
+ <td align="center"><img src="docs/hotdog.png" width="390" alt="Sans's hot dog stand"><br><sub>A hot dog from Sans</sub></td>
+ <td align="center"><img src="docs/ventpuzzle.png" width="390" alt="The vent puzzle"><br><sub>The vent puzzle</sub></td>
+ </tr>
+ <tr>
+ <td align="center"><img src="docs/guards.png" width="390" alt="The Royal Guards"><br><sub>The Royal Guards got a tip</sub></td>
+ <td align="center"><img src="docs/rguards.png" width="390" alt="The Royal Guards' team attack"><br><sub>Their team attack</sub></td>
+ </tr>
+ <tr>
+ <td align="center"><img src="docs/news.png" width="390" alt="Mettaton's news report"><br><sub>MTT News: two minutes to go</sub></td>
+ <td align="center"><img src="docs/defuse.png" width="390" alt="Defusing a bomb"><br><sub>Defuse it in the DEFUSE ZONE</sub></td>
+ </tr>
</table>
## How to play
@@ -124,7 +137,7 @@ 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.
+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. On the second floor, the top conveyor belt carries you past three switches: press them one after another as you go by. In the vent puzzle, every panel you land on turns all the vents around, and the one at the top turns them back. To spare the Royal Guards, clean 02's armor, catch its green stars, then whisper to 01. In the news report, touch a bomb to face it, and Defuse it (or FIGHT it) while it's in the DEFUSE ZONE.
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.
@@ -141,7 +154,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, 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.
+* **The Ruins, Snowdin, Waterfall and Hotland's first two floors, for now:** the elevator past Mettaton's news report 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/defuse.png b/games/undertale/docs/defuse.png
new file mode 100644
index 00000000..e6d6c305
Binary files /dev/null and b/games/undertale/docs/defuse.png differ
diff --git a/games/undertale/docs/guards.png b/games/undertale/docs/guards.png
new file mode 100644
index 00000000..e6f017a7
Binary files /dev/null and b/games/undertale/docs/guards.png differ
diff --git a/games/undertale/docs/hotdog.png b/games/undertale/docs/hotdog.png
new file mode 100644
index 00000000..33cbfd58
Binary files /dev/null and b/games/undertale/docs/hotdog.png differ
diff --git a/games/undertale/docs/news.png b/games/undertale/docs/news.png
new file mode 100644
index 00000000..9ebd5161
Binary files /dev/null and b/games/undertale/docs/news.png differ
diff --git a/games/undertale/docs/rguards.png b/games/undertale/docs/rguards.png
new file mode 100644
index 00000000..09d61535
Binary files /dev/null and b/games/undertale/docs/rguards.png differ
diff --git a/games/undertale/docs/ventpuzzle.png b/games/undertale/docs/ventpuzzle.png
new file mode 100644
index 00000000..7b4e8d2e
Binary files /dev/null and b/games/undertale/docs/ventpuzzle.png differ
diff --git a/games/undertale/src/battle.c b/games/undertale/src/battle.c
index 4ce2f1c1..bacd3aab 100644
--- a/games/undertale/src/battle.c
+++ b/games/undertale/src/battle.c
@@ -212,6 +212,8 @@ static void begin_menu(void) {
box_menu();
say(flavor_text());
bt.turn++;
+ /* the Stained Apron heals a little, every other turn */
+ if (sv.armor == ITEM_STAINED_APRON && bt.turn % 2 == 0 && sv.hp < sv.maxhp) sv.hp++;
}
static void begin_talk(void) {
diff --git a/games/undertale/src/data.bin b/games/undertale/src/data.bin
index b23083dc..3c55236c 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 a8b2be0f..cd95eb3e 100644
--- a/games/undertale/src/data.h
+++ b/games/undertale/src/data.h
@@ -222,66 +222,83 @@
#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 SPR_RG01_OW 211
+#define SPR_RG02_OW 212
+#define SPR_RG01_B 213
+#define SPR_RG02_B 214
+#define SPR_MTT_NEWS 215
+#define SPR_BOMB_BALL 216
+#define SPR_BOMB_DOG 217
+#define SPR_BOMB_PRESENT 218
+#define SPR_BOMB_WATER 219
+#define SPR_BOMB_SCRIPT 220
+#define SPR_BOMB_GAME 221
+#define SPR_NEWS_SCRIPT 222
+#define SPR_APRON 223
+#define SPR_BOMB_B 224
+#define SPR_DOGBOMB_B 225
+#define SPR_WATER_B 226
+#define SPR_UNDYNE_FALLEN 227
+#define SPR_SPEAR 228
+#define SPR_ARROW 229
+#define SPR_PLANE 230
+#define SPR_BOMB 231
+#define SPR_CLOUD 232
+#define SPR_BOLT 233
+#define SPR_UNDYNE_B 234
+#define SPR_NOTE 235
+#define SPR_DROP 236
+#define SPR_ARM 237
+#define SPR_DEBRIS 238
+#define SPR_STAR 239
+#define SPR_AARON_B 240
+#define SPR_AARON_HURT 241
+#define SPR_WOSHUA_B 242
+#define SPR_WOSHUA_HURT 243
+#define SPR_MOLDBYGG_B 244
+#define SPR_SHYREN_B 245
+#define SPR_SHYREN_TURNED 246
+#define SPR_INTROIMAGE 247
+#define SPR_INTROLAST 248
+#define SPR_UNDERTALETITLE 249
+#define SPR_GAMEOVERBG 250
+#define SPR_FACE_TORIELTALK 251
+#define SPR_FACE_TORIELTALKSIDE 252
+#define SPR_FACE_TORIELHAPPYTALK 253
+#define SPR_FACE_TORIELWHAT 254
+#define SPR_FACE_TORIELWHATSIDE 255
+#define SPR_FACE_TORIELMAD 256
+#define SPR_FACE_TORIELCOLD 257
+#define SPR_FACE_TORIELSURPRISED 258
+#define SPR_FACE_TORIELEMBARRASSED 259
+#define SPR_FACE_TORIELGLASSES 260
+#define SPR_FACE_TORIELREVENGETALK 261
+#define SPR_FACE_TORIELSCARED 262
+#define SPR_FACE_TORIELBLINK 263
+#define SPR_FACE_TORIELHAPPYBLINK 264
+#define SPR_FACE_TORIELBODY 265
+#define SPR_FACE_SANS 266
+#define SPR_FACE_SANSCHUCKLE 267
+#define SPR_FACE_SANSWINK 268
+#define SPR_FACE_PAPYRUS 269
+#define SPR_FACE_PAPYRUSEVIL 270
+#define SPR_FACE_PAPYRUSLAUGH 271
+#define SPR_FACE_PAPYRUSMAD 272
+#define SPR_FACE_PAPYRUSSIDE 273
+#define SPR_FACE_ALPHYS 274
+#define SPR_FLOWEYNICE 275
+#define SPR_FLOWEYNICESIDE 276
+#define SPR_FLOWEYSASSY 277
+#define SPR_FLOWEYEVIL 278
+#define SPR_FLOWEYGRIN 279
+#define SPR_FLOWEYPLAIN 280
+#define SPR_FLOWEYPISSED 281
+#define SPR_FLOWEYWINK 282
+#define SPR_FLOWEYLAUGH 283
+#define SPR_FLOWEYHURT 284
+#define SPR_FLOWEYTORIEL 285
+#define SPR_FLOWEYTORIEL2 286
+#define SPR_FLOWEYSIDESHOCK 287
#define AREA_RUINS 0
#define AREA_SNOWDIN 1
#define AREA_SNOWTOWN 2
@@ -427,10 +444,20 @@
#define ROOM_HT_VENTISLE 137
#define ROOM_HT_COOKING 138
#define ROOM_HT_COREVIEW 139
+#define ROOM_HT_HOTDOG 140
+#define ROOM_HT_CROSS2 141
+#define ROOM_HT_ARTCLUB 142
+#define ROOM_HT_APRON 143
+#define ROOM_HT_BELTPUZ 144
+#define ROOM_HT_VENTPUZ 145
+#define ROOM_HT_BOZ 146
+#define ROOM_HT_GUARDS 147
+#define ROOM_HT_NEWS 148
+#define ROOM_HT_COREVIEW2 149
#define FONT_MAIN 0
#define FONT_MENU 1
#define FONT_SMALL 2
-#define NUM_SPRITES 271
-#define NUM_ROOMS 140
+#define NUM_SPRITES 288
+#define NUM_ROOMS 150
#define NUM_FONTS 3
#endif
diff --git a/games/undertale/src/events.c b/games/undertale/src/events.c
index 8ab2f0ce..8a326c3f 100644
--- a/games/undertale/src/events.c
+++ b/games/undertale/src/events.c
@@ -120,5 +120,7 @@ int event_run(Ev *c) {
if (r >= 0) return r;
r = ht1_event(c);
if (r >= 0) return r;
+ r = ht2_event(c);
+ if (r >= 0) return r;
return 1;
}
diff --git a/games/undertale/src/events.h b/games/undertale/src/events.h
index 8484ef7b..e25ae925 100644
--- a/games/undertale/src/events.h
+++ b/games/undertale/src/events.h
@@ -13,7 +13,7 @@ enum {
ACTOR_MK, ACTOR_UNDYNE, ACTOR_SEED, ACTOR_BLOOM, ACTOR_SPEAR, ACTOR_ONION, ACTOR_DEBRIS, ACTOR_SHYREN,
ACTOR_MADDUMMY, ACTOR_BIRD, ACTOR_TEMMIE,
/* Hotland */
- ACTOR_ALPHYS, ACTOR_METTATON, ACTOR_GUARDS, ACTOR_VENT, ACTOR_LASER
+ ACTOR_ALPHYS, ACTOR_METTATON, ACTOR_GUARDS, ACTOR_VENT, ACTOR_LASER, ACTOR_RG01, ACTOR_RG02, ACTOR_BOMB, ACTOR_FIELD
};
enum {
@@ -47,6 +47,8 @@ enum {
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,
+ /* ht2.c */
+ EV_HOTDOG, EV_HEATS, EV_APRON, EV_BELT_SWITCH, EV_HT2_CALL, EV_VENTPUZ, EV_GUARDS, EV_NEWS, EV_BOMB, EV_HT2_ELEVATOR,
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 6fbc4ead..fc129954 100644
--- a/games/undertale/src/flags.h
+++ b/games/undertale/src/flags.h
@@ -136,7 +136,17 @@ enum {
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) */
+ F_HT_FLOOR1, /* the elevator up from Hotland's first floor taken */
+ F_HT_HEATS, /* Heats Flamesman's name heard */
+ F_HT_APRON, /* the Stained Apron taken */
+ F_HT_CALL_BELT, /* Alphys's calls: the belt puzzle, by the CORE again */
+ F_HT_CALL_CORE2,
+ F_HT_CALL_BOZ,
+ F_HT_BELT, /* the belt puzzle's force field off */
+ F_HT_VENTPUZ, /* the vent puzzle crossed */
+ F_HT_GUARDS, /* the Royal Guards: 1 spared, 2 killed */
+ F_HT_NEWS, /* Mettaton's news report: 1 every bomb defused, 2 out of time */
+ F_HT_FLOOR2, /* the elevator up from the second floor reached (where the game now ends) */
FLAG_COUNT = 256
};
#endif
diff --git a/games/undertale/src/hotland.h b/games/undertale/src/hotland.h
index 8b69b216..546d273a 100644
--- a/games/undertale/src/hotland.h
+++ b/games/undertale/src/hotland.h
@@ -1,4 +1,5 @@
-/* Undertale: Hotland (ht1.c: its first floor), its monsters (htmon.c), Mettaton's shows (htshows.c). */
+/* Undertale: Hotland (ht1.c, ht2.c: its first and second floors), its monsters (htmon.c), Mettaton's shows
+ * (htshows.c). */
#ifndef UT_HOTLAND_H
#define UT_HOTLAND_H
#include "event.h"
@@ -6,4 +7,9 @@ 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 */
+void ht2_setup(int room, int from);
+int ht2_event(Ev *c);
+void ht2_update(void); /* the belt puzzle's switches, the news report's bombs and clock */
+void ht2_draw(void); /* under everything: force fields, the switches, the vent puzzle's arrows */
+void ht2_draw_top(void); /* over everything: the news report's clock */
#endif
diff --git a/games/undertale/src/ht1.c b/games/undertale/src/ht1.c
index 2279de8f..3d322098 100644
--- a/games/undertale/src/ht1.c
+++ b/games/undertale/src/ht1.c
@@ -45,6 +45,13 @@ static const Belt belts[] = {
{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},
+ /* the second floor: the belt puzzle's (the top one runs left, the bottom right: as fast as Frisk walks, so
+ * walking against one stands still); round the vent puzzle (down, along, up: back to its start); the news
+ * room's, up to its vent */
+ {ROOM_HT_BELTPUZ, 5130, 2340, 300, 50, -3, 0}, {ROOM_HT_BELTPUZ, 5130, 2440, 300, 50, 3, 0},
+ {ROOM_HT_VENTPUZ, 4420, 2310, 60, 290, 0, 3}, {ROOM_HT_VENTPUZ, 4420, 2560, 360, 40, 3, 0},
+ {ROOM_HT_VENTPUZ, 4720, 2430, 60, 170, 0, -3},
+ {ROOM_HT_NEWS, 4300, 1790, 100, 160, 0, -2},
};
static void belts_update(void) {
if (event_running()) return;
@@ -81,6 +88,9 @@ static const Vent vents[] = {
{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}}},
+ /* the news room's: up to the top room's corner, and from there over to the rest of it */
+ {ROOM_HT_NEWS, 4350, 1722, DIR_UP, {[DIR_UP] = {4350, 1600}}},
+ {ROOM_HT_NEWS, 4320, 1600, DIR_LEFT, {[DIR_LEFT] = {4200, 1590}}},
};
#define NVENTS ((int)(sizeof vents / sizeof vents[0]))
/* the way a vent blows now */
@@ -110,6 +120,8 @@ 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},
+ /* the news room's bottom: blue, orange, blue */
+ {ROOM_HT_NEWS, 3965, 1946, 56, 16, 1}, {ROOM_HT_NEWS, 4025, 1946, 56, 16, 0}, {ROOM_HT_NEWS, 4085, 1946, 56, 16, 1},
};
static int laser_cool;
static int laser_x(int i) {
@@ -163,8 +175,8 @@ void ht1_update(void) {
/* ---------------------------------------------------------------- the rooms */
void ht1_setup(int room, int from) {
(void)from;
- if (room < ROOM_HT_LABFRONT || room > ROOM_HT_COREVIEW) return;
vents_setup();
+ if (room < ROOM_HT_LABFRONT || room > ROOM_HT_COREVIEW) return;
switch (room) {
case ROOM_HT_LABFRONT: {
obj_save(1045, 6243, "* (The heat of Hotland fills you with determination.)");
@@ -415,12 +427,10 @@ static int ev_cook(Ev *c) {
static int ev_elevator(Ev *c) {
EV_BEGIN;
- NARRATE("* (An elevator up to the next floor.)\n* (Get in?)@Yes@No");
+ NARRATE("* (The elevator up.)\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();
+ FADE_TO(ROOM_HT_HOTDOG, 6966, 2380, DIR_DOWN);
EV_END;
}
diff --git a/games/undertale/src/ht2.c b/games/undertale/src/ht2.c
new file mode 100644
index 00000000..a4744fe2
--- /dev/null
+++ b/games/undertale/src/ht2.c
@@ -0,0 +1,501 @@
+/* Hotland, its second floor: out of the elevator, Sans's hot dog stand and Heats Flamesman; the crossroads (the
+ * invisible path up to the Art Club's room, the Stained Apron down south); the conveyor belt puzzle and the vent
+ * puzzle; the Bad Opinion Zone; the Royal Guards at the bend; Mettaton's news report and its six bombs; the CORE
+ * again, and the elevator up. (As the Undertale Wiki describes them; what they say is ours, in short.) */
+#include <stddef.h>
+#include <stdio.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 "res.h"
+#include "save.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 *call_at(int x, int y, int w, int h, int arg) {
+ Obj *t = obj_trigger(x, y, w, h, EV_HT2_CALL, ACTOR_TRIGGER);
+ if (t) t->arg = (int16_t)arg;
+ return t;
+}
+/* a force field: a wall of light across the way */
+static void field(int x, int y, int w, int h) {
+ Obj *o = obj_trigger(x, y, w, h, EV_NONE, ACTOR_FIELD);
+ if (o) o->flags = OF_SOLID;
+}
+static void fields_down(void) {
+ for (Obj *o = obj_find(ACTOR_FIELD); o; o = obj_find(ACTOR_FIELD)) gone(o);
+}
+static void draw_fields(void) {
+ for (int i = 0; i < MAX_OBJS; i++) {
+ const Obj *o = &objs[i];
+ if (o->kind == OBJ_NONE || o->name != ACTOR_FIELD) continue;
+ uint16_t c = (g_frame / 3) % 2 ? rgb565(0x30FF60) : rgb565(0x10A040);
+ gfx_rect(o->x - cam_x, o->y - cam_y, o->bw, o->bh, c, 200);
+ }
+}
+
+/* ---------------------------------------------------------------- the conveyor belt puzzle */
+/* three switches over the top belt (it runs left): pressed right to left, each soon after the last */
+#define SW_Y 2322
+#define SW_WINDOW 45
+static const int16_t sw_x[3] = {5200, 5285, 5370};
+static int sw_lit, sw_t; /* lit: a bit each; t: frames since the last press */
+
+/* ---------------------------------------------------------------- the vent puzzle */
+/* eight platforms, each with its vents (the ways they blow, by DIR_*); landing on a panel turns every vent the other
+ * way, landing on the top one turns them back; blown off where there's no platform, Frisk lands on the belts
+ * below, or back at the start */
+typedef struct {
+ int16_t x, y;
+ uint8_t vents, panel; /* panel: 1 turns the vents, 2 turns them back */
+} Plat;
+#define VB(d) (1 << (d))
+static const Plat plats[] = {
+ {4620, 2160, VB(DIR_DOWN), 2}, /* the top one */
+ {4520, 2260, VB(DIR_RIGHT), 1}, /* turned, it blows left: the way out */
+ {4620, 2260, VB(DIR_UP) | VB(DIR_RIGHT), 1},
+ {4720, 2260, VB(DIR_LEFT), 1}, /* the start */
+ {4520, 2360, 15, 1},
+ {4620, 2360, VB(DIR_UP) | VB(DIR_DOWN), 1},
+ {4520, 2460, 15, 0},
+ {4620, 2460, 15, 0},
+};
+#define NPLATS ((int)(sizeof plats / sizeof plats[0]))
+#define VP_START_X 4740
+#define VP_START_Y 2340
+static const int8_t ddx[4] = {0, 0, -1, 1}, ddy[4] = {1, -1, 0, 0};
+static bool vp_turned;
+
+/* ---------------------------------------------------------------- Mettaton's news report */
+enum { NEWS_DARK, NEWS_PICK, NEWS_TIMER, NEWS_OVER };
+#define NEWS_TIME (120 * 30)
+static int news, news_t, news_why;
+static uint8_t defused;
+/* where each bomb's feet are, t frames into the show (the dog, the game and the present stay put: the map shows
+ * them) */
+static void bomb_at(int k, int t, int *x, int *y) {
+ switch (k) {
+ case BOMB_DOG: *x = 4015, *y = 1730; break;
+ case BOMB_GAME: *x = 3918, *y = 1978; break;
+ case BOMB_PRESENT: *x = 4366, *y = 1588; break;
+ case BOMB_SCRIPT: *x = 4332, *y = 1946 - t % 150; break; /* riding the belt up */
+ case BOMB_BALL: { /* bouncing along the top room */
+ int p = t % 300, b = gfx_sin(t * 256 / 30 % 256);
+ *x = 3950 + 250 * (p < 150 ? p : 300 - p) / 150, *y = 1604 - 18 * (b < 0 ? -b : b) / 1024;
+ break;
+ }
+ default: /* the glass of water darts every way */
+ *x = 4070 + 130 * gfx_sin(t * 3 % 256) / 1024, *y = 1626 + 24 * gfx_sin((t * 5 + 64) % 256) / 1024;
+ break;
+ }
+}
+static bool bomb_moves(int k) { return k == BOMB_SCRIPT || k == BOMB_BALL || k == BOMB_WATER; }
+static uint16_t bomb_spr(int k) {
+ if (k == BOMB_SCRIPT) return news >= NEWS_TIMER ? SPR_BOMB_SCRIPT : SPR_NEWS_SCRIPT;
+ return k == BOMB_BALL ? SPR_BOMB_BALL : SPR_BOMB_WATER;
+}
+static int news_frame;
+static void bombs_setup(void) {
+ for (int k = 0; k < BOMB_COUNT; k++) {
+ int x, y;
+ bomb_at(k, news_frame, &x, &y);
+ Obj *o;
+ if (bomb_moves(k)) {
+ o = obj_deco(bomb_spr(k), x, y, false);
+ if (o) o->name = ACTOR_BOMB, obj_set_box(o, -10, -16, 20, 16), o->event = EV_BOMB;
+ } else {
+ /* (the dog lies along the wall: its box reaches down to where Frisk can stand) */
+ o = obj_trigger(x - 12, y - 18, 24, k == BOMB_DOG ? 26 : 18, EV_BOMB, ACTOR_BOMB);
+ }
+ if (!o) continue;
+ o->arg = (int16_t)k;
+ /* before the show: things to report on; during it, bombs to touch; defused, nothing */
+ o->flags = (uint16_t)((o->flags & ~(OF_TOUCH | OF_TALK | OF_SOLID)) |
+ (defused & (1 << k) || news == NEWS_OVER || flag(F_HT_NEWS) ? 0
+ : news == NEWS_TIMER ? OF_TOUCH : OF_TALK | (bomb_moves(k) ? 0 : OF_SOLID)));
+ }
+}
+static void bombs_arm(void) {
+ for (int i = 0; i < MAX_OBJS; i++) {
+ Obj *o = &objs[i];
+ if (o->kind != OBJ_NONE && o->name == ACTOR_BOMB) o->flags = (uint16_t)((o->flags & ~(OF_TALK | OF_SOLID)) | OF_TOUCH);
+ }
+}
+static void bombs_move(void) {
+ if (news == NEWS_DARK) return;
+ news_frame++;
+ for (int i = 0; i < MAX_OBJS; i++) {
+ Obj *o = &objs[i];
+ if (o->kind == OBJ_NONE || o->name != ACTOR_BOMB || !bomb_moves(o->arg) || (defused & (1 << o->arg))) continue;
+ int x, y;
+ bomb_at(o->arg, news_frame, &x, &y);
+ o->x = (int16_t)x, o->y = (int16_t)y, o->spr[0] = bomb_spr(o->arg);
+ }
+}
+static void news_fields(void) {
+ field(3796, 1756, 6, 48); /* back west */
+ field(4580, 1700, 64, 6); /* on, up north */
+}
+
+/* ---------------------------------------------------------------- drawn, and watched */
+void ht2_draw(void) {
+ if (g_room < ROOM_HT_HOTDOG || g_room > ROOM_HT_COREVIEW2) return;
+ draw_fields();
+ if (g_room == ROOM_HT_BELTPUZ)
+ for (int i = 0; i < 3; i++) {
+ bool on = flag(F_HT_BELT) || (sw_lit >> i & 1);
+ gfx_rect(sw_x[i] - 4 - cam_x, SW_Y + 4 - cam_y, 8, 6, on ? rgb565(0x40FF40) : rgb565(0x802020), 255);
+ }
+ if (g_room == ROOM_HT_VENTPUZ) {
+ static const uint16_t arrow[4] = {SPR_VENT_D, SPR_VENT_U, SPR_VENT_L, SPR_VENT_R};
+ for (int p = 0; p < NPLATS; p++)
+ for (int g = 0; g < 4; g++)
+ if (plats[p].vents & VB(g))
+ gfx_sprite(arrow[g ^ vp_turned], 0, plats[p].x + 20 + ddx[g] * 20 - cam_x, plats[p].y + 20 + ddy[g] * 20 - cam_y, 0, 255);
+ }
+}
+
+/* over everything: the news report's clock */
+void ht2_draw_top(void) {
+ if (g_room != ROOM_HT_NEWS || news != NEWS_TIMER) return;
+ char s[16];
+ int secs = (news_t + 29) / 30;
+ snprintf(s, sizeof s, "%d:%02d", secs / 60, secs % 60);
+ gfx_rect(4, 4, 52, 18, C_BLACK, 200);
+ gfx_text(FONT_MAIN, 10, 6, s, secs <= 20 ? C_RED : C_WHITE, 255);
+}
+
+void ht2_update(void) {
+ if (g_room < ROOM_HT_HOTDOG || g_room > ROOM_HT_COREVIEW2) return;
+ if (sw_t < 1000) sw_t++;
+ if (sw_lit && sw_t > SW_WINDOW && !flag(F_HT_BELT)) sw_lit = 0;
+ if (g_room == ROOM_HT_NEWS) {
+ bombs_move();
+ if (news == NEWS_TIMER && !event_running()) {
+ if (defused == (1 << BOMB_COUNT) - 1) news_why = 1, event_start(EV_NEWS, NULL);
+ else if (--news_t <= 0) news_why = 2, event_start(EV_NEWS, NULL);
+ }
+ }
+}
+
+/* ---------------------------------------------------------------- the rooms */
+static Obj *obj_rg(int name, int x, int y) {
+ static const uint16_t s1[4] = {SPR_RG01_OW, SPR_RG01_OW, SPR_RG01_OW, SPR_RG01_OW};
+ static const uint16_t s2[4] = {SPR_RG02_OW, SPR_RG02_OW, SPR_RG02_OW, SPR_RG02_OW};
+ Obj *o = obj_npc(name, name == ACTOR_RG01 ? s1 : s2, x, y, DIR_RIGHT, 0);
+ if (o) o->flags &= (uint16_t)~OF_SOLID;
+ return o;
+}
+
+void ht2_setup(int room, int from) {
+ if (room < ROOM_HT_HOTDOG || room > ROOM_HT_COREVIEW2) return;
+ switch (room) {
+ case ROOM_HT_HOTDOG:
+ thing(6585, 2346, 58, 36, EV_HOTDOG, ACTOR_ITEM, 0);
+ thing(7056, 2420, 28, 30, EV_HEATS, ACTOR_ITEM, 0);
+ thing(6940, 2330, 80, 64, EV_HT2_ELEVATOR, ACTOR_DOOR, 0);
+ obj_sign(6696, 2364, 30, 30, "* Snow on a hot dog stand?\n* Here, in Hotland?|* Guess somebody's too lazy\n to clean it off.");
+ obj_sign(6618, 2436, 28, 30, "* TOASTY BUN!");
+ break;
+ case ROOM_HT_ARTCLUB:
+ obj_sign(5896, 2146, 30, 30, "* (ART CLUB ROOM.)\n* (It meets on one night a year,\n at one hour only.)");
+ break;
+ case ROOM_HT_APRON:
+ if (!flag(F_HT_APRON)) {
+ Obj *p = obj_deco(SPR_APRON, 5836, 2618, false);
+ if (p) p->name = ACTOR_ITEM;
+ Obj *t = obj_trigger(5832, 2614, 30, 26, EV_APRON, ACTOR_ITEM);
+ if (t) t->flags = OF_TALK;
+ }
+ break;
+ case ROOM_HT_BELTPUZ:
+ if (!flag(F_HT_CALL_BELT)) call_at(5640, 2370, 12, 70, 0);
+ if (!flag(F_HT_BELT)) field(5066, 2370, 6, 70);
+ for (int i = 0; i < 3; i++) {
+ Obj *s = obj_trigger(sw_x[i] - 12, SW_Y, 24, 22, EV_BELT_SWITCH, ACTOR_ITEM);
+ if (s) s->flags = OF_TALK, s->arg = (int16_t)i;
+ }
+ sw_lit = 0;
+ break;
+ case ROOM_HT_VENTPUZ:
+ for (int p = 0; p < NPLATS; p++)
+ for (int g = 0; g < 4; g++)
+ if (plats[p].vents & VB(g)) {
+ Obj *o = obj_trigger(plats[p].x + 24 + ddx[g] * 20, plats[p].y + 24 + ddy[g] * 20, 12, 12, EV_VENTPUZ, ACTOR_VENT);
+ if (o) o->arg = (int16_t)(p * 4 + g);
+ }
+ break;
+ case ROOM_HT_BOZ:
+ obj_save(4005, 2252, "* (The smell of melted cheese fills you with determination.)");
+ obj_sign(3918, 2240, 36, 32, "* (A safe on a little table.)\n* (The cheese inside has melted\n onto the table.)");
+ obj_sign(3958, 2246, 16, 20, "* (A mouse hole.)\n* (Someone wants that cheese.)");
+ if (!flag(F_HT_CALL_BOZ)) call_at(4300, 2250, 12, 80, 2);
+ break;
+ case ROOM_HT_GUARDS:
+ if (!flag(F_HT_GUARDS)) obj_trigger(3560, 2240, 10, 100, EV_GUARDS, ACTOR_TRIGGER);
+ break;
+ case ROOM_HT_NEWS:
+ if (!flag(F_HT_NEWS)) {
+ /* (come in from elsewhere mid-show: only a SAVE loaded, as its exits are shut; it starts over) */
+ if (from != ROOM_HT_NEWS) news = NEWS_DARK;
+ if (news == NEWS_DARK) {
+ defused = 0, news_frame = 0;
+ obj_trigger(3880, 1750, 10, 60, EV_NEWS, ACTOR_TRIGGER);
+ } else news_fields();
+ Obj *m = obj_deco(SPR_MTT_NEWS, 4186, 1781, true);
+ if (m) m->name = ACTOR_METTATON, m->flags |= OF_ANIM, m->anim_speed = 8, obj_set_box(m, -16, -10, 32, 10);
+ }
+ bombs_setup();
+ break;
+ case ROOM_HT_COREVIEW2:
+ if (!flag(F_HT_CALL_CORE2)) call_at(4596, 1420, 48, 10, 3);
+ thing(3740, 1300, 80, 60, EV_HT2_ELEVATOR, ACTOR_DOOR, 1);
+ break;
+ }
+}
+
+/* ---------------------------------------------------------------- the events */
+static int ev_hotdog(Ev *c) {
+ EV_BEGIN;
+ SAY(FACE_SANS, "* hey. hot dogs, 30G apiece.\n* want one?@Buy@No thanks");
+ if (CHOICE() == 0) {
+ if (sv.gold < 30) {
+ SAY(FACE_SANS, "* you're a little short, kid.");
+ } else if (!item_add(ITEM_HOT_DOG)) {
+ SAY(FACE_SANS, "* hands full, huh?\n* come back when they aren't.");
+ } else {
+ sv.gold = (uint16_t)(sv.gold - 30);
+ SAY(FACE_SANS, "* here you go. enjoy.");
+ }
+ }
+ EV_END;
+}
+
+static int ev_heats(Ev *c) {
+ EV_BEGIN;
+ if (!flag(F_HT_HEATS)) {
+ set_flag(F_HT_HEATS, 1);
+ NARRATE("* I'M HEATS FLAMESMAN!!!\n* REMEMBER MY NAME!!!");
+ } else {
+ NARRATE("* DON'T YOU FORGET IT!!!\n* HEATS FLAMESMAN!!!");
+ }
+ EV_END;
+}
+
+static int ev_apron(Ev *c) {
+ EV_BEGIN;
+ if (!item_add(ITEM_STAINED_APRON)) {
+ NARRATE("* (You're carrying too much.)");
+ return 1;
+ }
+ set_flag(F_HT_APRON, 1);
+ NARRATE("* (You got the Stained Apron.)");
+ gone(obj_get(ACTOR_ITEM));
+ if (c->self) gone(c->self);
+ EV_END;
+}
+
+static int ev_belt_switch(Ev *c) {
+ int next = !sw_lit ? 2 : sw_lit == 4 ? 1 : 0;
+ EV_BEGIN;
+ c->v[0] = c->self ? c->self->arg : 0;
+ if (flag(F_HT_BELT)) return 1;
+ /* right to left: the first restarts it, one out of turn spoils it */
+ if (c->v[0] == next) sw_lit |= 1 << c->v[0];
+ else sw_lit = c->v[0] == 2 ? 4 : 0;
+ sw_t = 0;
+ if (sw_lit != 6) return 1;
+ /* two of three: Alphys calls to cheer Frisk on, just as the last one goes by */
+ SAY(FACE_ALPHYS, "* Ring...|* Now! Hit the last one now!|* ...|* Oh no. I made you miss it.|* Um! Actually, only the\n first two mattered!\n* Really!|* I'll just turn off the\n field.");
+ set_flag(F_HT_BELT, 1);
+ fields_down();
+ NARRATE("* (The force field switches off.)");
+ EV_END;
+}
+
+static int ev_ventpuz(Ev *c) {
+ EV_BEGIN;
+ c->v[0] = c->self ? c->self->arg / 4 : 0;
+ c->v[1] = (c->self ? c->self->arg % 4 : 0) ^ vp_turned;
+ c->v[2] = -1;
+ for (int q = 0; q < NPLATS; q++)
+ if (plats[q].x == plats[c->v[0]].x + ddx[c->v[1]] * 100 && plats[q].y == plats[c->v[0]].y + ddy[c->v[1]] * 100) c->v[2] = q;
+ c->v[3] = plats[c->v[0]].x + 20 + ddx[c->v[1]] * 100, c->v[4] = plats[c->v[0]].y + 6 + ddy[c->v[1]] * 100;
+ pl.dir = (uint8_t)c->v[1];
+ if (c->v[2] < 0 && !world_walkable(c->v[3] + 3, c->v[4] + 20, 14, 9, -1)) {
+ /* nowhere to land: off into the haze, and back at the start */
+ PL_WALK(plats[c->v[0]].x + 20 + ddx[c->v[1]] * 40, plats[c->v[0]].y + 6 + ddy[c->v[1]] * 40, 7);
+ vp_turned = false;
+ FADE_TO(ROOM_HT_VENTPUZ, VP_START_X, VP_START_Y, DIR_UP);
+ return 1;
+ }
+ PL_WALK(c->v[3], c->v[4], 7);
+ if (c->v[2] >= 0) {
+ if (plats[c->v[2]].panel == 2) vp_turned = false;
+ else if (plats[c->v[2]].panel) vp_turned = !vp_turned;
+ } else if (c->v[3] < plats[1].x) {
+ set_flag(F_HT_VENTPUZ, 1); /* (out, west) */
+ }
+ EV_END;
+}
+
+/* Alphys's calls: 0 the belt puzzle ahead, 2 in the Bad Opinion Zone, 3 by the CORE again */
+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_BELT, 1);
+ SAY(FACE_ALPHYS, "* Ring...|* It's Alphys! There's a belt\n puzzle up ahead.|* Ride the top belt, and hit\n all three switches, one\n after another.|* Don't worry, I'll help you\n with the timing!");
+ break;
+ case 2:
+ set_flag(F_HT_CALL_BOZ, 1);
+ SAY(FACE_ALPHYS, "* Ring...|* Oh! H-hi. Sorry, I'm in\n a bad mood.|* The sequel to my favorite\n anime came out, and... ugh.|* They got EVERYTHING wrong.\n* Don't get me started.|* ...|* I already started, huh.\n* Sorry! Bye!");
+ break;
+ case 3:
+ set_flag(F_HT_CALL_CORE2, 1);
+ SAY(FACE_ALPHYS, "* Ring...|* Phew! You made it through\n the news.|* Mettaton's out of control.|* The elevator's just ahead.\n* Keep going!");
+ break;
+ }
+ EV_END;
+}
+
+static int ev_guards(Ev *c) {
+ Obj *a = obj_get(ACTOR_RG01), *b = obj_get(ACTOR_RG02);
+ EV_BEGIN;
+ if (c->self) gone(c->self);
+ /* two of the Royal Guard, from round the bend */
+ a = obj_rg(ACTOR_RG01, 3300, pl.y + 29);
+ b = obj_rg(ACTOR_RG02, 3250, pl.y + 29);
+ WALK_TO(b, pl.x - 70, pl.y + 29, 3);
+ WALK(a, pl.x - 30, pl.y + 29, 3);
+ NARRATE("* Hey! You! Hold up!|* So, like, we got a tip about a\n human in a striped shirt.\n* Around here, right now.|* Scary, huh? But stay chill.\n* We'll get you somewhere safe.");
+ NARRATE("* ...|* Huh? What is it, bro?|* Their shirt? What about it?|* ...|* Oh. OH.|* Dude, this is, like, SO\n awkward.|* We totally have to fight\n you now.");
+ BATTLE(FORM_RGUARDS);
+ a = obj_get(ACTOR_RG01), b = obj_get(ACTOR_RG02);
+ if (bt.mon[0].killed || bt.mon[1].killed) {
+ set_flag(F_HT_GUARDS, 2);
+ if (bt.mon[0].killed) gone(a);
+ if (bt.mon[1].killed) gone(b);
+ return 1;
+ }
+ set_flag(F_HT_GUARDS, 1);
+ NARRATE("* So, uh... we're gonna go get\n some ice cream now.|* Later, dude!");
+ WALK_TO(b, 3230, b->y, 3);
+ WALK(a, 3230, a->y, 3);
+ gone(obj_get(ACTOR_RG01));
+ gone(obj_get(ACTOR_RG02));
+ EV_END;
+}
+
+static int ev_news(Ev *c) {
+ Obj *m = obj_get(ACTOR_METTATON);
+ EV_BEGIN;
+ if (c->self) gone(c->self);
+ c->v[0] = news_why;
+ if (c->v[0] == 0) {
+ /* the lights, and the show */
+ NARRATE("* (It's pitch dark in here.)");
+ SAY(FACE_ALPHYS, "* Ring...|* It's dark in there, huh?\n* Hang on, I'll get the\n lights...");
+ NARRATE("* (The lights come on.)");
+ NARRATE("* OHHH YES! GOOD EVENING, AND\n WELCOME TO... MTT NEWS!|* I'M YOUR ANCHOR, METTATON.|* TONIGHT, OUR BRAVE REPORTER\n FINDS THE STORY OF THE YEAR!|* GO ON, DARLING! FIND SOMETHING\n NEWSWORTHY TO REPORT ON!");
+ news_fields();
+ news = NEWS_PICK;
+ return 1;
+ }
+ /* the end: every bomb defused, or out of time */
+ if (c->v[0] == 1) {
+ NARRATE("* WHAT?! YOU DEFUSED THEM ALL?!|* ...NO MATTER! THE BIG ONE GOES\n OFF IN TWO SECONDS!|* ONE... TWO...");
+ SAY(FACE_ALPHYS, "* Ring...|* Got it! I hacked into it!\n* It's off!");
+ } else {
+ NARRATE("* AND THAT'S TIME!!!|* ...|* ...HM? IT ISN'T GOING OFF.");
+ SAY(FACE_ALPHYS, "* Ring...|* Phew! I got into the big\n one. Just in time!");
+ }
+ NARRATE("* ALPHYS HACKED MY BOMB?!|* UGH! THAT'S ALL FOR TONIGHT,\n FOLKS!");
+ m = obj_get(ACTOR_METTATON);
+ WALK(m, m->x, m->y - 200, 6);
+ gone(obj_get(ACTOR_METTATON));
+ fields_down();
+ news = NEWS_OVER;
+ set_flag(F_HT_NEWS, c->v[0]);
+ for (int i = 0; i < MAX_OBJS; i++)
+ if (objs[i].kind != OBJ_NONE && objs[i].name == ACTOR_BOMB) objs[i].flags &= (uint16_t)~(OF_TOUCH | OF_TALK | OF_SOLID);
+ EV_END;
+}
+
+static const char *const reports[BOMB_COUNT] = {
+ [BOMB_DOG] = "* A DOG! HOW... ORDINARY.",
+ [BOMB_WATER] = "* A GLASS OF WATER!\n* IT'S... VERY QUICK.",
+ [BOMB_SCRIPT] = "* THE SCRIPT OF MY NEXT FILM!\n* A FINE CHOICE, DARLING.",
+ [BOMB_BALL] = "* A BASKETBALL! NO, WAIT, A\n FASHION STATEMENT!",
+ [BOMB_PRESENT] = "* A PRESENT! FOR ME?\n* YOU SHOULDN'T HAVE!",
+ [BOMB_GAME] = "* A VIDEO GAME! I'M IN IT, YOU\n KNOW. NEAR THE END.",
+};
+static int ev_bomb(Ev *c) {
+ EV_BEGIN;
+ c->v[0] = c->self ? c->self->arg : 0;
+ if (news == NEWS_PICK) {
+ /* the story: it's a bomb, and so is everything else */
+ NARRATE(reports[c->v[0]]);
+ NARRATE("* ...BUT WAIT!!!|* IT'S A BOMB!!!|* IN FACT, EVERYTHING IN HERE\n IS A BOMB! SURPRISE!|* AND THE BIG ONE UP NORTH GOES\n OFF IN TWO MINUTES!|* STAY TUNED, VIEWERS!\n* THIS IS GOING TO BE EXPLOSIVE!");
+ SAY(FACE_ALPHYS, "* Ring...|* D-don't panic! I put a bomb\n defuser in your phone!|* Touch a bomb, then defuse\n it while it's in the\n DEFUSE ZONE!");
+ news = NEWS_TIMER, news_t = NEWS_TIME;
+ bombs_arm();
+ return 1;
+ }
+ if (news != NEWS_TIMER || (defused >> c->v[0] & 1)) return 1;
+ g_bomb_kind = c->v[0];
+ BATTLE(FORM_BOMB);
+ if (battle_result() == BR_SPARED) {
+ defused = (uint8_t)(defused | 1 << c->v[0]);
+ for (int i = 0; i < MAX_OBJS; i++)
+ if (objs[i].kind != OBJ_NONE && objs[i].name == ACTOR_BOMB && objs[i].arg == c->v[0]) objs[i].flags &= (uint16_t)~OF_TOUCH;
+ }
+ EV_END;
+}
+
+static int ev_elevator(Ev *c) {
+ EV_BEGIN;
+ c->v[0] = c->self ? c->self->arg : 0;
+ if (c->v[0] == 0) {
+ NARRATE("* (The elevator back down.)\n* (Get in?)@Yes@No");
+ if (CHOICE() == 1) return 1;
+ FADE_TO(ROOM_HT_COREVIEW, 6930, 3110, DIR_DOWN);
+ return 1;
+ }
+ NARRATE("* (The elevator up.)\n* (Get in?)@Yes@No");
+ if (CHOICE() == 1) return 1;
+ set_flag(F_HT_FLOOR2, 1);
+ sv.room = (int16_t)g_room, sv.x = 3760, sv.y = 1340;
+ save_write_auto();
+ menu_end_open();
+ EV_END;
+}
+
+int ht2_event(Ev *c) {
+ switch (c->id) {
+ case EV_HOTDOG: return ev_hotdog(c);
+ case EV_HEATS: return ev_heats(c);
+ case EV_APRON: return ev_apron(c);
+ case EV_BELT_SWITCH: return ev_belt_switch(c);
+ case EV_VENTPUZ: return ev_ventpuz(c);
+ case EV_HT2_CALL: return ev_call(c);
+ case EV_GUARDS: return ev_guards(c);
+ case EV_NEWS: return ev_news(c);
+ case EV_BOMB: return ev_bomb(c);
+ case EV_HT2_ELEVATOR: return ev_elevator(c);
+ }
+ return -1;
+}
diff --git a/games/undertale/src/htmon.c b/games/undertale/src/htmon.c
index a29d5293..f2b1b060 100644
--- a/games/undertale/src/htmon.c
+++ b/games/undertale/src/htmon.c
@@ -91,6 +91,168 @@ static const char *talk_pyrope(Battle *b, Monster *m) {
}
static int attack_pyrope(Battle *b, Monster *m) { (void)b, (void)m; return rnd_n(2) ? ATK_PYROPE_BOMBS : ATK_PYROPE_ROPE; }
+/* ---------------------------------------------------------------- the Royal Guards: 01 and 02, always a team.
+ * Clean 02's armor, and its green stars caught five times, 02 can't stand the heat and takes the armor off; then a
+ * whisper to 01 to say what he feels, and the two can be spared */
+enum { RG_CLEANED, RG_ARMOR_OFF, RG_TOLD }; /* (b->state[]) */
+static Monster *rg_other(Battle *b, Monster *m) {
+ for (int i = 0; i < b->nmon; i++)
+ if (&b->mon[i] != m) return &b->mon[i];
+ return m;
+}
+static bool rg_alone(Battle *b, Monster *m) { return rg_other(b, m)->killed; }
+static void act_rg(Battle *b, Monster *m, int act, char *t, int cap) {
+ bool one = m->def == mon_def(MON_RG01);
+ Monster *o = rg_other(b, m);
+ if (act == 0) { /* Clean Armor */
+ if (one) snprintf(t, (size_t)cap, "* You try to polish 01's armor.\n* Your hands slide right off.");
+ else if (b->state[RG_ARMOR_OFF]) snprintf(t, (size_t)cap, "* You drum on 02's bare chest.\n* 01 can't look.");
+ else {
+ snprintf(t, (size_t)cap, "* You scrub 02's armor.\n* The grime starts to come off.\n* 01 looks bothered.");
+ b->state[RG_CLEANED] = 1;
+ }
+ } else { /* Whisper */
+ if (!one) snprintf(t, (size_t)cap, "* You whisper a secret to 02.\n* 02 won't tell.");
+ else if (!b->state[RG_ARMOR_OFF] || o->gone)
+ snprintf(t, (size_t)cap, "* You tell 01 to be honest about his feelings.\n* 01 doesn't get it.");
+ else {
+ snprintf(t, (size_t)cap, "* You tell 01 to be honest about his feelings.");
+ if (!b->state[RG_TOLD]) b->state[RG_TOLD] = 1;
+ m->spare = o->spare = true;
+ }
+ }
+}
+static const char *talk_rg(Battle *b, Monster *m) {
+ bool one = m->def == mon_def(MON_RG01);
+ if (rg_alone(b, m)) return one ? "02...!\nThis one's\nfor you!" : "01...!\n...!!!";
+ if (b->state[RG_TOLD] == 1) {
+ if (one) return "02... I...\nI like,\nLIKE you,\nbro.";
+ b->state[RG_TOLD] = 2;
+ return "... want ice\ncream... after\nthis?";
+ }
+ if (b->state[RG_TOLD]) return one ? "Ice cream?\nSure, dude!" : "... heh.";
+ if (b->state[RG_ARMOR_OFF]) return one ? "D-dude..." : "... much\nbetter.";
+ if (b->state[RG_CLEANED]) return one ? "Hey! Hands\noff the\narmor!" : "... getting\n... hot.";
+ static const char *const l01[] = {"Like, hand\nover the\nSOUL, bro.", "Like, you're\ntoast and\nstuff.", "Team\nattack!"};
+ static const char *const l02[] = {"... ... hm.", "... ... sigh.", "... team\nattack."};
+ return one ? l01[rnd_n(3)] : l02[rnd_n(3)];
+}
+static const char *flavor_rg(Battle *b, Monster *m) {
+ (void)m;
+ if (b->state[RG_CLEANED] && !b->state[RG_ARMOR_OFF] && b->greens >= 5) {
+ b->state[RG_ARMOR_OFF] = 1;
+ return "* 02 can't take the heat, and pulls the armor off!\n* 01 starts to sweat.";
+ }
+ if (b->state[RG_TOLD]) return "* 01 and 02 can't stop smiling at each other.";
+ if (b->state[RG_ARMOR_OFF]) return "* 01 is shaking. 02 looks a lot cooler.";
+ return NULL;
+}
+static int attack_rg(Battle *b, Monster *m) { (void)b, (void)m; return ATK_RG_TEAM; }
+
+/* ---------------------------------------------------------------- Mettaton's bombs: defuse each in the DEFUSE ZONE.
+ * Each moves its own way (the wiki's account of them), the zone in the middle; Defuse (or FIGHT) only works while
+ * the bomb is in it */
+int g_bomb_kind;
+#define ZONE_X0 128
+#define ZONE_X1 192
+#define ZONE_Y0 34
+#define ZONE_Y1 104
+static int bomb_tri(int t, int period, int lo, int hi) { /* a triangle wave, lo to hi and back */
+ int p = t % period, half = period / 2;
+ return lo + (hi - lo) * (p < half ? p : period - p) / half;
+}
+/* where the bomb's middle is, t frames into the battle */
+static void bomb_pos(int t, int *x, int *y) {
+ switch (g_bomb_kind) {
+ case BOMB_DOG: /* side to side, low, in waves */
+ *x = 160 + 110 * gfx_sin(t / 2 % 256) / 1024, *y = 92 + 6 * gfx_sin(t * 3 % 256) / 1024;
+ break;
+ case BOMB_WATER: /* fast, to the right, round again from the left */
+ *x = 20 + t * 3 % 280, *y = 70;
+ break;
+ case BOMB_SCRIPT: /* across and back, doubling back a little before each turn */
+ *x = 160 + (95 * gfx_sin(t * 256 / 300 % 256) + 22 * gfx_sin(t * 768 / 300 % 256)) / 1024, *y = 66;
+ break;
+ case BOMB_BALL: { /* bouncing from side to side */
+ int b = gfx_sin(t * 256 / 50 % 256);
+ *x = bomb_tri(t, 240, 50, 270), *y = 96 - 56 * (b < 0 ? -b : b) / 1024;
+ break;
+ }
+ case BOMB_PRESENT: /* up through the zone, round again from below */
+ *x = 160, *y = 150 - t * 3 / 2 % 170;
+ break;
+ default: { /* the game: side to side, keeping to the edges (across the middle in a rush) */
+ int v = 240 * gfx_sin(t * 256 / 400 % 256) / 1024;
+ *x = 160 + clamp_i(v, -115, 115), *y = 70;
+ break;
+ }
+ }
+}
+static bool bomb_in_zone(Battle *b) {
+ int x, y;
+ bomb_pos((uint16_t)b->state[0], &x, &y);
+ return x >= ZONE_X0 && x <= ZONE_X1 && y >= ZONE_Y0 && y <= ZONE_Y1;
+}
+static void bomb_defused(Monster *m) { m->gone = true, m->fade = 1, m->dmg_t = 0; }
+static void act_bomb(Battle *b, Monster *m, int act, char *t, int cap) {
+ (void)act;
+ if (bomb_in_zone(b)) {
+ bomb_defused(m);
+ snprintf(t, (size_t)cap, g_bomb_kind == BOMB_DOG ? "* Dog defused!" : "* Bomb defused!");
+ } else snprintf(t, (size_t)cap, "* Missed! Try while it's in\n the DEFUSE ZONE.");
+}
+static bool hit_bomb(Battle *b, Monster *m, int dmg) {
+ (void)dmg;
+ if (bomb_in_zone(b)) bomb_defused(m);
+ else m->dmg_shown = 0; /* (MISS) */
+ return true;
+}
+static const char *talk_bomb(Battle *b, Monster *m) {
+ (void)b, (void)m;
+ if (g_bomb_kind == BOMB_DOG) return "Zzz...";
+ if (g_bomb_kind == BOMB_WATER) return "Swish.";
+ return rnd_n(2) ? "Tick." : "Tock.";
+}
+static const char *flavor_bomb(Battle *b, Monster *m) {
+ (void)b, (void)m;
+ return g_bomb_kind == BOMB_DOG ? "* The dog is still active." : "* The bomb is still ticking.";
+}
+static int attack_bomb(Battle *b, Monster *m) { (void)b, (void)m; return -1; }
+static void draw_bomb(Battle *b, Monster *m, int x0, int y0) {
+ (void)y0;
+ if (!m->gone) b->state[0]++;
+ /* the zone */
+ uint16_t g = rgb565(0x00C000);
+ gfx_frame_rect(ZONE_X0 - 14, ZONE_Y0 - 14, ZONE_X1 - ZONE_X0 + 28, ZONE_Y1 - ZONE_Y0 + 28, 1, g);
+ gfx_text(FONT_SMALL, 160 - gfx_text_width(FONT_SMALL, "DEFUSE ZONE", -1) / 2, ZONE_Y0 - 11, "DEFUSE ZONE", g, 255);
+ int x, y;
+ bomb_pos((uint16_t)b->state[0], &x, &y);
+ x += x0 - m->x; /* (its shake, hit) */
+ uint16_t s = g_bomb_kind == BOMB_DOG ? SPR_DOGBOMB_B : g_bomb_kind == BOMB_WATER ? SPR_WATER_B : SPR_BOMB_B;
+ int half = g_bomb_kind == BOMB_DOG ? 6 : g_bomb_kind == BOMB_WATER ? 11 : 23;
+ uint8_t alpha = m->fade ? (uint8_t)max_i(0, 128 - m->fade * 4) : 255;
+ gfx_sprite(s, (int)(g_frame / 8), x, y + half, 0, alpha);
+}
+#define BOMB(nm, chk) {.name = nm, .hp = 1, .idle_speed = 8, .check = chk, .acts = {"Defuse"}, .nacts = 1, \
+ .flags = MF_BOSS | MF_NOT_KILLABLE, .act = act_bomb, .talk = talk_bomb, .attack = attack_bomb, \
+ .flavor = flavor_bomb, .on_hit = hit_bomb, .draw = draw_bomb}
+static const MonDef bomb_defs[BOMB_COUNT] = {
+ [BOMB_DOG] = BOMB("Dog", "It's fast asleep. It has no idea."),
+ [BOMB_WATER] = BOMB("Glass of Water", "A glass of water. A very, very fast one."),
+ [BOMB_SCRIPT] = BOMB("Script", "A movie script. Every page ends with a bang."),
+ [BOMB_BALL] = BOMB("Basketball", "Painted to look like a basketball. Stylish, at least."),
+ [BOMB_PRESENT] = BOMB("Present", "Wrapped up with a bow. It's ticking."),
+ [BOMB_GAME] = BOMB("Game", "A video game. The box is oddly heavy."),
+};
+static const Form bomb_forms[BOMB_COUNT] = {
+ [BOMB_DOG] = {{MON_BOMB}, 1, "* It's the dog!\n* Defuse it!"},
+ [BOMB_WATER] = {{MON_BOMB}, 1, "* The glass of water dashes about!\n* Defuse it!"},
+ [BOMB_SCRIPT] = {{MON_BOMB}, 1, "* Defuse the script!"},
+ [BOMB_BALL] = {{MON_BOMB}, 1, "* Defuse the basketball!"},
+ [BOMB_PRESENT] = {{MON_BOMB}, 1, "* Defuse the present!"},
+ [BOMB_GAME] = {{MON_BOMB}, 1, "* Defuse the game!"},
+};
+
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,
@@ -115,8 +277,22 @@ static const MonDef ht_defs[MON_COUNT - MON_WF_COUNT] = {
[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},
+ [MON_RG01 - MON_WF_COUNT] = {
+ .name = "RG 01", .spare_gold = 50, .hp = 150, .at = 8, .df = 4, .exp = 110, .gold = 60, .spr_idle = SPR_RG01_B,
+ .spr_hurt = SPR_RG01_B, .idle_speed = 6, .check = "A Royal Guard. Armor polished to a shine.",
+ .acts = {"Clean Armor", "Whisper"}, .nacts = 2,
+ .neutral = {"* 01 polishes his helmet.", "* 02 watches your every step.", "* Smells like a locker room.",
+ "* 01 stands guard."},
+ .flags = MF_BOSS, .act = act_rg, .talk = talk_rg, .attack = attack_rg, .flavor = flavor_rg},
+ [MON_RG02 - MON_WF_COUNT] = {
+ .name = "RG 02", .spare_gold = 50, .hp = 150, .at = 8, .df = 4, .exp = 110, .gold = 60, .spr_idle = SPR_RG02_B,
+ .spr_hurt = SPR_RG02_B, .idle_speed = 6, .check = "A Royal Guard. Armor looks stuffy and hot.",
+ .acts = {"Clean Armor", "Whisper"}, .nacts = 2,
+ .neutral = {"* Sweat drips from 02's armor.", "* 02 is clenching his fists.", "* Smells like a locker room."},
+ .flags = MF_BOSS, .act = act_rg, .talk = talk_rg, .attack = attack_rg, .flavor = flavor_rg},
+ [MON_BOMB - MON_WF_COUNT] = BOMB("Bomb", ""),
};
-const MonDef *ht_mon_def(int id) { return &ht_defs[id - MON_WF_COUNT]; }
+const MonDef *ht_mon_def(int id) { return id == MON_BOMB ? &bomb_defs[g_bomb_kind] : &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."},
@@ -128,16 +304,23 @@ static const Form ht_forms[FORM_COUNT - FORM_WF_COUNT] = {
[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, ""},
+ [FORM_RGUARDS - FORM_WF_COUNT] = {{MON_RG01, MON_RG02}, 2, "* The Royal Guards attack!"},
+ [FORM_BOMB - FORM_WF_COUNT] = {{MON_BOMB}, 1, ""},
};
-const Form *ht_form(int form) { return &ht_forms[form - FORM_WF_COUNT]; }
+const Form *ht_form(int form) { return form == FORM_BOMB ? &bomb_forms[g_bomb_kind] : &ht_forms[form - FORM_WF_COUNT]; }
-/* random encounters: past the Lab (the belts and the Magma Chamber) */
+/* random encounters: past the Lab (the belts and the Magma Chamber); on the second floor, the crossroads and the
+ * Bad Opinion Zone */
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)];
}
+ case ROOM_HT_CROSS2: case ROOM_HT_BOZ: {
+ static const uint8_t pool[] = {FORM_TSUNDERPLANE, FORM_TSUNDER_VULKIN, FORM_PYROPE, FORM_PYROPE2};
+ return pool[rnd_n(4)];
+ }
}
return -1;
}
@@ -269,6 +452,30 @@ static void atk_pyrope_rope(int t) {
}
}
+/* the Royal Guards' team attack: stars falling from the top, and others rising from the bottom. Once 02's armor's
+ * been cleaned, some of the falling ones are green (dropped right over the SOUL); once it's off, 01's aim goes shaky and they fly out at the
+ * sides. One guard fallen, the other attacks twice as hard */
+static void atk_rg_team(int t) {
+ bool angry = false, off = bt.state[RG_ARMOR_OFF], green = bt.state[RG_CLEANED] && !off;
+ for (int i = 0; i < bt.nmon; i++) angry |= bt.mon[i].killed;
+ int every = angry ? 10 : 20;
+ if (t < 130 && t % every == 0) {
+ /* (a green one falls right over the SOUL) */
+ bool g = green && t % 40 == 20;
+ int x = g ? bt.sx / FX : bx0() + 6 + rnd_n(bx1() - bx0() - 12);
+ Bullet *s = shot(SPR_STAR, x, by0() - 4, off ? (rnd_n(2) ? P(3) / 2 : -P(3) / 2) : 0, P(1) / 2);
+ if (s) {
+ s->kind = BK_GRAVITY, s->ay = 2, s->r = 3, s->flags |= BF_NOCLIP, s->life = 120;
+ if (g) s->color = BC_GREEN, s->dmg = 0;
+ }
+ }
+ if (t < 130 && t % (every * 3 / 2) == 15) {
+ int x = bx0() + 6 + rnd_n(bx1() - bx0() - 12);
+ Bullet *s = shot(SPR_STAR, x, by1() + 4, 0, -P(2));
+ if (s) s->r = 3, s->flags |= BF_NOCLIP, s->life = 90;
+ }
+}
+
int ht_attack_length(int atk) { (void)atk; return 160; }
void ht_attack_run(Battle *b, int atk, int t) {
@@ -285,5 +492,6 @@ void ht_attack_run(Battle *b, int atk, int t) {
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;
+ case ATK_RG_TEAM: atk_rg_team(t); break;
}
}
diff --git a/games/undertale/src/items.c b/games/undertale/src/items.c
index db8d48d6..cecf88c5 100644
--- a/games/undertale/src/items.c
+++ b/games/undertale/src/items.c
@@ -56,6 +56,10 @@ static const ItemInfo items[ITEM_COUNT] = {
"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},
+ [ITEM_HOT_DOG] = {"Hot Dog...?", "HotDog", IT_FOOD, 20, 0, 0, "A hot dog from Sans's stand.\n* Better not ask what's in it.",
+ "* You eat the Hot Dog.\n* (Bark!)", 10},
+ [ITEM_STAINED_APRON] = {"Stained Apron", "StainApro", IT_ARMOR, 0, 0, 11, "An apron with old stains.\n* Heals 1 HP every other turn.",
+ "", 50},
};
const ItemInfo *item_info(int id) { return &items[id >= 0 && id < ITEM_COUNT ? id : 0]; }
diff --git a/games/undertale/src/items.h b/games/undertale/src/items.h
index a9b5ec8c..9120436d 100644
--- a/games/undertale/src/items.h
+++ b/games/undertale/src/items.h
@@ -37,6 +37,8 @@ enum {
/* Hotland */
ITEM_BURNT_PAN,
ITEM_INSTANT_NOODLES,
+ ITEM_HOT_DOG,
+ ITEM_STAINED_APRON,
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 f02971c1..4d4507dd 100644
--- a/games/undertale/src/menu.c
+++ b/games/undertale/src/menu.c
@@ -383,7 +383,7 @@ void menu_gameover_open(void) {
void menu_end_open(void) {
g_mode = MODE_END;
t = 0;
- 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);
+ writer_start(&w, "Up the elevator, past the news\nand all its bombs...|The rest of the underground\nis still to come...", 40, 90, FONT_MAIN);
w.speed = 2;
}
diff --git a/games/undertale/src/monsters.c b/games/undertale/src/monsters.c
index 14241618..66c0dec1 100644
--- a/games/undertale/src/monsters.c
+++ b/games/undertale/src/monsters.c
@@ -319,7 +319,9 @@ int form_setup(int form, Battle *b) {
m->x = (int16_t)(xs[f->n - 1][i] + m->def->dx), m->y = (int16_t)(120 + m->def->dy);
}
/* Toriel and Flowey can't be fled from; Napstablook can */
- if (form == FORM_TORIEL || form == FORM_FLOWEY || form == FORM_PAPYRUS || form == FORM_MAD_DUMMY) b->no_flee = true;
+ if (form == FORM_TORIEL || form == FORM_FLOWEY || form == FORM_PAPYRUS || form == FORM_MAD_DUMMY ||
+ form == FORM_RGUARDS || form == FORM_BOMB)
+ b->no_flee = true;
b->captures = form == FORM_PAPYRUS;
return 0;
}
diff --git a/games/undertale/src/monsters.h b/games/undertale/src/monsters.h
index d45eb19e..ddec76ac 100644
--- a/games/undertale/src/monsters.h
+++ b/games/undertale/src/monsters.h
@@ -12,7 +12,7 @@ enum {
/* Waterfall (wfmon.c) */
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
+ MON_VULKIN = MON_WF_COUNT, MON_TSUNDERPLANE, MON_PYROPE, MON_METTATON, MON_RG01, MON_RG02, MON_BOMB, MON_COUNT
};
/* formations: who is fought */
@@ -29,7 +29,7 @@ enum {
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
+ FORM_MTT_COOK, FORM_LASERS, FORM_RGUARDS, FORM_BOMB, FORM_COUNT
};
enum {
@@ -47,7 +47,7 @@ enum {
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
+ ATK_PYROPE_ROPE, ATK_RG_TEAM, ATK_COUNT
};
/* a formation: up to three monsters, and what the first turn says */
@@ -73,4 +73,6 @@ 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);
+extern int g_bomb_kind; /* the bomb fought next (BOMB_*: htmon.c) */
+enum { BOMB_DOG, BOMB_WATER, BOMB_SCRIPT, BOMB_BALL, BOMB_PRESENT, BOMB_GAME, BOMB_COUNT };
#endif
diff --git a/games/undertale/src/rooms.c b/games/undertale/src/rooms.c
index 16c1498c..669b137c 100644
--- a/games/undertale/src/rooms.c
+++ b/games/undertale/src/rooms.c
@@ -22,6 +22,7 @@ void room_setup(int room, int from) {
wf2_setup(room, from);
wf3_setup(room, from);
ht1_setup(room, from);
+ ht2_setup(room, from);
}
/* each frame Frisk can walk: what a room watches (a rock on its switch, a cracked floor) */
@@ -32,6 +33,7 @@ void room_update(void) {
wf1_update();
wf3_update();
ht1_update();
+ ht2_update();
}
/* what a room draws on its floor, under everything (world.c) */
@@ -39,8 +41,12 @@ void room_draw_floor(void) {
snow1_draw();
snow2_draw();
ht1_draw();
+ ht2_draw();
}
+/* what a room draws over everything (a clock) */
+void room_draw_top(void) { ht2_draw_top(); }
+
/* a pushed rock that may go where Frisk can't (a bridge seed into the water), and what happens once it has */
bool room_rock_enters(Obj *o, int x, int y) { return wf_seed_enters(o, x, y); }
void room_rock_moved(Obj *o) { wf_seed_moved(o); }
diff --git a/games/undertale/src/world.c b/games/undertale/src/world.c
index 327288f2..6af7e448 100644
--- a/games/undertale/src/world.c
+++ b/games/undertale/src/world.c
@@ -496,6 +496,7 @@ bool cam_pan(int x, int y, int sp) {
void cam_free(void) { cam_locked = false; }
void room_draw_floor(void); /* rooms.c */
+void room_draw_top(void);
int g_shake; /* frames the view shakes */
@@ -537,5 +538,6 @@ void world_draw(void) {
else gfx_sprite(obj_sprite(o), o->frame, o->x - cam_x, o->y - cam_y, (o->flags & OF_FLIP) ? GFX_FLIPX : 0, o->alpha);
}
}
+ room_draw_top();
cam_x = keep_x, cam_y = keep_y;
}
diff --git a/games/undertale/tests/check.py b/games/undertale/tests/check.py
index 0aba194a..e72f39c3 100644
--- a/games/undertale/tests/check.py
+++ b/games/undertale/tests/check.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
"""Checks of Undertale on a computer (make test): the host build, with
AddressSanitizer and UBSan, through the menus, every battle, the saves, the
-whole Ruins, the whole of Snowdin and Waterfall as far as it goes.
+whole Ruins, the whole of Snowdin and Waterfall, and Hotland as far as it goes.
python3 tests/check.py build/play [--quick]
---quick skips playing the whole Ruins, Snowdin and Waterfall (the longest parts)."""
+--quick skips playing the whole Ruins, Snowdin, Waterfall and Hotland (the longest parts)."""
import os
import re
import shutil
@@ -34,9 +34,9 @@ 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)
+ FORM_LASERS, FORM_RGUARDS, FORM_BOMB) = range(43, 53)
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
+ITEM_BURNT_PAN, ITEM_INSTANT_NOODLES, ITEM_HOT_DOG, ITEM_STAINED_APRON = 28, 29, 30, 31
def run(args, frames, saves=None, what=""):
@@ -138,6 +138,16 @@ for form, seq, gold in ((FORM_VULKIN, "2", 40), (FORM_PYROPE, "1,1", 45), (FORM_
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 Royal Guards (no running from them): fought, or spared (02's armor cleaned twice, its green stars caught, a
+# whisper to 01); a bomb of the news report (the dog), defused by Defuse or by FIGHT, in the DEFUSE ZONE
+s = run(["--god", "--battle", str(FORM_RGUARDS), "--path", "fight"], 9000, what="the Royal Guards, fought")
+check(s and s["mode"] == MODE_WORLD and s["kills"] == 2, f"the Royal Guards: FIGHT did not win it: {s}")
+s = run(["--god", "--battle", str(FORM_RGUARDS), "--path", "seq:1@2,1@2,2@1"], 9000, what="the Royal Guards, spared")
+check(s and s["mode"] == MODE_WORLD and s["kills"] == 0 and s["gold"] == 100,
+ f"the Royal Guards: the friendly way did not spare them: {s}")
+for how in ("act:1", "fight"):
+ s = run(["--god", "--battle", str(FORM_BOMB), "--path", how], 9000, what=f"a bomb, {how}")
+ check(s and s["mode"] == MODE_WORLD and s["kills"] == 0, f"a bomb: {how} did not defuse it: {s}")
# the shop in Snowdin: a Cinnamon Bunny for 25G; Papyrus's date: his phone number
s = run(["--name", "Frisk", "--noenc", "--room", str(ROOMS["SNOWTOWN"]), "--at", "446,1092", "--gold", "100", "--keys",
@@ -213,11 +223,12 @@ if not QUICK:
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
+# cooking show, up the elevator to the second floor
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}")
+ check(s and s["mode"] == MODE_WORLD and s["room"] == ROOMS["HT_HOTDOG"],
+ f"Hotland did not end up the elevator, on the second floor: {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),
@@ -225,6 +236,22 @@ if not QUICK:
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']}")
+# Hotland's second floor: Heats Flamesman, Sans's hot dog, the apron, the Art Club's room, the belt and vent puzzles,
+# the Bad Opinion Zone, the Royal Guards spared, Mettaton's news report, up to the elevator
+if not QUICK:
+ s = run(["--name", "Frisk", "--noenc", "--god", "--gold", "100", "--room", str(ROOMS["HT_HOTDOG"]), "--at", "6966,2380",
+ "--path-file", os.path.join(HERE, "hotland2.path")], 13000, what="Hotland's second floor")
+ check(s and s["mode"] == MODE_END and s["room"] == ROOMS["HT_COREVIEW2"],
+ f"Hotland's second floor did not end at the elevator: {s}")
+ if s:
+ for name, v in (("HT_HEATS", 1), ("HT_APRON", 1), ("HT_CALL_BELT", 1), ("HT_BELT", 1), ("HT_VENTPUZ", 1),
+ ("HT_CALL_BOZ", 1), ("HT_GUARDS", 1), ("HT_NEWS", 2), ("HT_CALL_CORE2", 1), ("HT_FLOOR2", 1)):
+ check(flag(s, name) == v, f"Hotland's second floor: F_{name} is {flag(s, name)}, not {v}")
+ check(s["kills"] == 0, f"Hotland's second floor: {s['kills']} killed on the friendly way")
+ check(s["gold"] == 170, f"Hotland's second floor: the hot dog or the guards' gold went wrong: {s['gold']}")
+ for item in (ITEM_HOT_DOG, ITEM_STAINED_APRON):
+ check(item in s["items"], f"Hotland's second floor: item {item} not picked up: {s['items']}")
+
if failures:
print("\n".join("FAIL " + f for f in failures))
sys.exit(1)
diff --git a/games/undertale/tests/hotland2.path b/games/undertale/tests/hotland2.path
new file mode 100644
index 00000000..6ff35c60
--- /dev/null
+++ b/games/undertale/tests/hotland2.path
@@ -0,0 +1,114 @@
+# Hotland's second floor, out of the elevator (play it with --room 140 --at 6966,2380 --name Frisk --noenc --god
+# --gold 100): Heats Flamesman's name, a hot dog from Sans
+go:7030,2400
+r
+z
+talk
+go:6600,2364
+u
+z
+pick:0
+talk
+# the crossroads: the Stained Apron south, the invisible path north to the Art Club's room
+go:5900,2400
+go:5900,2548
+5900,2600
+go:5840,2628
+u
+z
+talk
+go:5900,2600
+5900,2560
+go:5900,2240
+5900,2180
+go:5900,2160
+u
+z
+talk
+go:5900,2190
+5900,2215
+w10
+# the conveyor belt puzzle: Alphys's call, then the top belt's switches pressed right to left as it carries Frisk by
+# (her call after the second, and the force field off)
+go:5760,2400
+5690,2400
+w10
+talk
+go:5460,2400
+5460,2330
+5421,2330
+l
+u
+w16
+z
+w26
+z
+talk
+w60
+go:5090,2400
+5040,2400
+w20
+# the vent puzzle: right to left in a U, a step back once (each panel landed on turns every vent; out by the top-left
+# platform's, turned)
+go:4750,2400
+go:4740,2300
+vent:4722,2264
+w20
+vent:4640,2250
+w20
+vent:4640,2382
+w20
+vent:4640,2450
+w20
+vent:4640,2350
+w20
+vent:4656,2466
+w20
+vent:4540,2482
+w20
+vent:4540,2350
+w20
+vent:4556,2266
+w20
+# the Bad Opinion Zone (Alphys's call), the Royal Guards at the bend: 02's armor cleaned, its green stars caught, a
+# whisper to 01, both spared
+go:4410,2255
+4380,2255
+w10
+go:4100,2275
+go:3760,2275
+3730,2275
+w10
+go:3540,2275
+seq:1@2,1@2,2@1
+talk
+go:3230,2275
+go:3230,2040
+go:3670,2030
+3695,2030
+w20
+# Mettaton's news report: the dog picked, every bomb revealed; the dog defused, then the clock runs out (Alphys
+# switches the big one off)
+go:3895,1748
+talk
+go:4008,1720
+u
+z
+talk
+4008,1714
+act:1
+talk
+w3700
+talk
+# up past the news to the CORE again (Alphys's call), and the elevator up, where the game now ends
+go:4590,1770
+go:4600,1560
+4600,1500
+w20
+go:4600,1440
+talk
+go:3770,1380
+go:3770,1348
+u
+z
+pick:0
diff --git a/games/undertale/tools/rooms.py b/games/undertale/tools/rooms.py
index c6be23f2..5bf6745e 100644
--- a/games/undertale/tools/rooms.py
+++ b/games/undertale/tools/rooms.py
@@ -152,6 +152,9 @@ HT_KITCHEN = []
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)]
+# the vent puzzle's platforms (their top-left)
+HT_VENTPUZ = [(4620, 2160), (4520, 2260), (4620, 2260), (4720, 2260), (4520, 2360), (4620, 2360), (4520, 2460),
+ (4620, 2460)]
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
@@ -159,6 +162,15 @@ AREAS.append(dict(name="hotland", map="Hotland_map.png", floor=HT_FLOOR, margin=
("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"),
+ # the second floor: the two by the invisible path, the Pyrope by the bend, the Royal Guards on it, Mettaton at
+ # his news desk, the apron
+ ("erase", 5822, 2343, 46, 44, "ring"), ("erase", 5946, 2343, 46, 52, "ring"),
+ ("erase", 3202, 1988, 48, 46, [(0, 0, 0)]), ("erase", 3202, 2034, 48, 16, "ring"),
+ ("copy", 3495, 2216, 68, 46, 3376, 2216), ("erase", 3376, 2262, 68, 38, "ring"),
+ ("erase", 4158, 1716, 56, 66, "ring"), ("erase", 5836, 2618, 22, 18, "ring"),
+ # the news report's bombs that move: the script on the belt (the belt repeats every 5 pixels), the basketball, the
+ # glass of water (in front of a rock: the same rock, a row up)
+ ("copy", 4318, 1850, 24, 26, 4318, 1875), ("erase", 3999, 1565, 21, 20, "ring"), ("copy", 4118, 1576, 26, 24, 4118, 1616),
# 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),
@@ -525,6 +537,23 @@ ROOMS = [
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),
+ # the second floor: out of the elevator, Sans's hot dog stand; the crossroads (the invisible path north to the Art
+ # Club's room, the apron south); the conveyor belt puzzle; the vent puzzle; the Bad Opinion Zone; the bend where
+ # the Royal Guards wait; Mettaton's news report; the CORE again, and the elevator up
+ dict(name="ht_hotdog", area="hotland", rect=(6040, 2260, 1060, 220), title="Hotland"),
+ dict(name="ht_cross2", area="hotland", rect=(5700, 2200, 340, 380), title="Hotland",
+ fix=[("walk", 5898, 2276, 22, 116)]),
+ dict(name="ht_artclub", area="hotland", rect=(5800, 1990, 240, 210), title="Hotland"),
+ dict(name="ht_apron", area="hotland", rect=(5780, 2580, 260, 160), title="Hotland"),
+ dict(name="ht_beltpuz", area="hotland", rect=(5060, 2280, 640, 240), title="Hotland", floor_colors=HT_BELT),
+ dict(name="ht_ventpuz", area="hotland", rect=(4400, 2100, 660, 560), title="Hotland", floor_colors=HT_STRIPE + HT_BELT,
+ fix=[("walk", x, y, 60, 60) for x, y in HT_VENTPUZ]),
+ dict(name="ht_boz", area="hotland", rect=(3740, 2100, 660, 280), title="Hotland", floor_colors=HT_BELT),
+ dict(name="ht_guards", area="hotland", rect=(3080, 1940, 660, 440), title="Hotland",
+ doors=[((3690, 2036, 10, 40), "ht_news", (3772, 1748), "right")]),
+ dict(name="ht_news", area="hotland", rect=(3760, 1540, 880, 500), title="Hotland", floor_colors=HT_STRIPE + HT_BELT,
+ doors=[((3760, 1760, 6, 40), "ht_guards", (3670, 2030), "left")]),
+ dict(name="ht_coreview2", area="hotland", rect=(3680, 1200, 960, 340), title="Hotland", floor_colors=HT_STRIPE),
]
# 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 c5a7e815..e936c35b 100644
--- a/games/undertale/tools/sprites.py
+++ b/games/undertale/tools/sprites.py
@@ -198,11 +198,19 @@ def gen_debris():
return [im]
+def gen_star():
+ # the Royal Guards' stars: four points
+ im = _img(9, 9)
+ d = ImageDraw.Draw(im)
+ d.polygon([(4, 0), (5, 3), (8, 4), (5, 5), (4, 8), (3, 5), (0, 4), (3, 3)], fill=(255, 255, 255, 255))
+ return [im]
+
+
GEN = {"otile": gen_otile, "snowball": gen_snowball, "bone": gen_bone, "orb": gen_orb, "snowflake": gen_snowflake,
"iceshard": gen_iceshard, "present": gen_present, "knife": gen_knife, "dogpaw": gen_dogpaw,
"heartbullet": gen_heartbullet, "spear": gen_spear, "note": gen_note, "drop": gen_drop, "arm": gen_arm,
"debris": gen_debris, "arrow": gen_arrow, "plane": gen_plane, "bomb": gen_bomb, "cloud": gen_cloud,
- "bolt": gen_bolt}
+ "bolt": gen_bolt, "star": gen_star}
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:"
@@ -380,6 +388,22 @@ SPRITES = [
("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}),
+ # the second floor: the Royal Guards, Mettaton reporting, the bombs (each a part of the wiki's sheet of them)
+ ("rg01_ow", "wiki:RG_01_overworld.png", {"feet": True}),
+ ("rg02_ow", "wiki:RG_02_overworld.png", {"feet": True}),
+ ("rg01_b", "wiki:RG_01_battle_idle.gif", {"feet": True, "dedupe": True, "every": 6}),
+ ("rg02_b", "wiki:RG_02_battle_idle.gif", {"feet": True, "dedupe": True, "every": 6}),
+ ("mtt_news", "wiki:Mettaton_overworld_news_reporter.gif", {"feet": True}),
+ *[("bomb_" + n, "wiki:Bombs_overworld.gif", {"feet": True, "box": b}) for n, b in (
+ ("ball", (0, 0, 33, 32)), ("dog", (33, 0, 33, 32)), ("present", (66, 0, 33, 32)), ("water", (0, 32, 33, 32)),
+ ("script", (33, 32, 33, 32)), ("game", (66, 32, 33, 32)))],
+ # the news report's script before it's shown to be a bomb, and the Stained Apron (cut from the map)
+ ("news_script", "map:Hotland_map.png:4322,1880,16,16", {"keep": True, "feet": True, "clear": [(112, 83, 71), (52, 50, 78), (107, 67, 78)]}),
+ ("apron", "map:Hotland_map.png:5836,2618,22,18", {"keep": True, "clear": [(181, 85, 21)]}),
+ # in battle, the bombs share one look (the dog and the glass of water keep their own)
+ ("bomb_b", "wiki:Bomb_battle_idle.gif", {"feet": True, "dedupe": True}),
+ ("dogbomb_b", "wiki:Annoying_Dog_battle_bomb.gif", {"feet": True, "dedupe": True}),
+ ("water_b", "wiki:Extremely_Agile_Glass_Of_Water_battle_idle.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),
@@ -395,6 +419,7 @@ SPRITES = [
("drop", "gen:drop", {"center": True}),
("arm", "gen:arm", {"center": True}),
("debris", "gen:debris", {"center": True}),
+ ("star", "gen:star", {"center": True}),
# Waterfall's monsters
("aaron_b", "wiki:Aaron_battle_static.png", {"feet": True, "clear_bg": True}),
("aaron_hurt", "wiki:Aaron_battle_hurt.png", {"feet": True, "clear_bg": True}),