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.

FNAF World: the endings, the road to the last boss, menus fixed

Mason363e6061daa6e01
diff --git a/games/fnafworld/src/battle.c b/games/fnafworld/src/battle.c
index af1d1261..19b2a950 100644
--- a/games/fnafworld/src/battle.c
+++ b/games/fnafworld/src/battle.c
@@ -1516,10 +1516,10 @@ void battle_draw_band_dim(void) {
int p = 15;
s[p] = 0;
do s[--p] = (char)('0' + v % 10), v /= 10; while (v && p > 0);
- gfx_text_c(FONT_BIG, 160, 30 + 50, s + p, WHITE);
+ gfx_text_c(FONT_TEXT, 160, 30 + 43, s + p, RGB(0xFFE060));
v = B.tokens, p = 15;
do s[--p] = (char)('0' + v % 10), v /= 10; while (v && p > 0);
- gfx_text_c(FONT_BIG, 160, 30 + 80, s + p, WHITE);
+ gfx_text_c(FONT_TEXT, 160, 30 + 74, s + p, RGB(0xFFE060));
for (int k = 0; k < 4; k++)
if (B.leveled[k]) pic_draw(pic_of(AN_LEVELUP, 0), SX(B.pm[k].x + 4), SY(B.pm[k].y - 181));
}
diff --git a/games/fnafworld/src/data.bin b/games/fnafworld/src/data.bin
index 4637973f..71d44a1f 100644
Binary files a/games/fnafworld/src/data.bin and b/games/fnafworld/src/data.bin differ
diff --git a/games/fnafworld/src/data.h b/games/fnafworld/src/data.h
index cad73efb..b4d84249 100644
--- a/games/fnafworld/src/data.h
+++ b/games/fnafworld/src/data.h
@@ -50,9 +50,12 @@
#define IMG_UP 0
#define IMG_DOWN 1
#define IMG_DEL 2
+#define SPR_HPORTAL 62
+#define HPORTAL_X 2049
+#define HPORTAL_Y 798
#define SPR_WALK 101
#define WALK_N 15
-#define SPR_STAND 61
+#define SPR_STAND 60
#define SPR_LILLY 161
#define LILLY_N 10
#define HIT_W 23
diff --git a/games/fnafworld/src/game.c b/games/fnafworld/src/game.c
index 87360ac5..a774a595 100644
--- a/games/fnafworld/src/game.c
+++ b/games/fnafworld/src/game.c
@@ -38,6 +38,28 @@ void game_init(void) {
go(SC_TITLE);
}
+/* words over lines no wider than w, centred on cx */
+static void text_wrap(int font, int cx, int y, int w, const char *s, uint16_t c) {
+ char line[64];
+ while (*s) {
+ int n = 0, last = 0;
+ while (s[n] && n < 63) {
+ line[n] = s[n];
+ line[n + 1] = 0;
+ if (s[n] == ' ') last = n;
+ if (gfx_text_w(font, line) > w && last) break;
+ n++;
+ }
+ if (s[n] && last) n = last;
+ memcpy(line, s, (size_t)n);
+ line[n] = 0;
+ gfx_text_c(font, cx, y, line, c);
+ y += gfx_line_h(font);
+ s += n;
+ while (*s == ' ') s++;
+ }
+}
+
static void num(char *out, int32_t v) {
char t[12];
int p = 11;
@@ -400,8 +422,7 @@ static void wear_step(bool bytes) {
int n = bytes ? NBYTE : NCHIP;
if (pressed(UPS)) g.menu = (uint8_t)((g.menu + n - 1) % n);
if (pressed(DOWNS)) g.menu = (uint8_t)((g.menu + 1) % n);
- if (pressed(LEFTS)) g.menu = (uint8_t)((g.menu + n - 7) % n);
- if (pressed(RIGHTS)) g.menu = (uint8_t)((g.menu + 7) % n);
+ if (pressed(LEFTS) || pressed(RIGHTS)) g.menu = (uint8_t)(g.menu < 11 ? (g.menu + 11 < n ? g.menu + 11 : n - 1) : g.menu - 11);
if (pressed(K_BACK)) {
g.dirty = 1;
go(SC_PAUSE);
@@ -429,23 +450,23 @@ static void wear_band(bool bytes) {
gfx_blend(0, 0, 320, 240, BLACK, 16);
const uint8_t *worn = bytes ? g.f.bytes : g.f.chip;
int n = bytes ? NBYTE : NCHIP;
- gfx_text_c(FONT_BIG, 160, 2, bytes ? "Bytes" : "Chips", WHITE);
+ int nworn = 0;
+ for (int k = 0; k < 4; k++) nworn += worn[k] != 0;
+ gfx_text(FONT_BIG, 6, 0, bytes ? "Bytes" : "Chips", WHITE);
+ char s[16] = "Worn _ of 4";
+ s[5] = (char)('0' + nworn);
+ gfx_text_r(FONT_TEXT, 314, 4, s, RGB(0xFFD040));
for (int i = 0; i < n; i++) {
- int col = i / 7, row = i % 7;
- int x = 4 + 105 * col, y = 26 + 22 * row;
+ int col = i / 11, row = i % 11;
+ int x = 4 + 158 * col, y = 24 + 18 * row;
int id = i + 1;
bool have = bytes ? g.f.byte_have[id] : g.f.chest[id];
bool on = false;
for (int k = 0; k < 4; k++) on |= worn[k] == id;
- gfx_fill(x, y, 102, 19, on ? RGB(0x2A7A3A) : RGB(0x1A2858));
- if (g.menu == i) gfx_frame_rect(x - 1, y - 1, 104, 21, HILITE);
+ gfx_fill(x, y, 154, 16, on ? RGB(0x2A7A3A) : RGB(0x1A2858));
+ if (g.menu == i) gfx_frame_rect(x - 1, y - 1, 156, 18, HILITE);
const char *name = have ? (bytes ? BYTE_NAME[id] : CHIP_NAME[id]) : "???";
- gfx_text(FONT_SMALL, x + 3, y + 3, name, have ? WHITE : RGB(0x707890));
- }
- gfx_text(FONT_SMALL, 6, 184, "Worn:", WHITE);
- for (int k = 0; k < 4; k++) {
- const char *name = worn[k] ? (bytes ? BYTE_NAME[worn[k]] : CHIP_NAME[worn[k]]) : "-";
- gfx_text(FONT_SMALL, 44 + 70 * k, 184, name, RGB(0xFFD040));
+ gfx_text(FONT_SMALL, x + 3, y + 2, name, have ? WHITE : RGB(0x707890));
}
gfx_blend(0, 226, 320, 14, BLACK, 18);
gfx_text(FONT_SMALL, 4, 227, "Arrows pick OK wear or take off Back done", KEYS);
@@ -520,16 +541,16 @@ static void shop_band(bool armor) {
}
gfx_fill(50, y, 220, 34, g.menu == i ? RGB(0x3A58B8) : RGB(0x1A2858));
if (g.menu == i) gfx_frame_rect(49, y - 1, 222, 36, HILITE);
- if (!armor) pic_draw(ANIM_PICS[ANIMS[AN_BYTE1 + first + i - 1].first], 72, y + 17);
- gfx_text(FONT_TEXT, 96, y + 3, name, WHITE);
+ if (!armor) pic_part(ANIM_PICS[ANIMS[AN_BYTE1 + first + i - 1].first], 56, y + 1, 0, 0, 40, 32);
+ gfx_text(FONT_TEXT, 100, y + 3, name, WHITE);
char s[24];
if (sold) strcpy(s, "Sold out");
else num(s, (int32_t)price), strcat(s, " tokens");
- gfx_text(FONT_SMALL, 96, y + 19, s, sold ? RGB(0x90A0C0) : RGB(0xFFD040));
+ gfx_text(FONT_SMALL, 100, y + 19, s, sold ? RGB(0x90A0C0) : RGB(0xFFD040));
}
if (!armor) {
int d = first == 1 ? 0 : first == 4 ? 1 : first == 7 ? 2 : first == 10 ? 3 : first == 13 ? 4 : first == 16 ? 5 : 6;
- gfx_text_c(FONT_SMALL, 160, 172, DESC[d], WHITE);
+ text_wrap(FONT_SMALL, 160, 170, 300, DESC[d], WHITE);
} else
gfx_text_c(FONT_SMALL, 160, 172, "Armor takes damage off every hit.", WHITE);
char s[32];
@@ -540,6 +561,48 @@ static void shop_band(bool armor) {
gfx_text(FONT_SMALL, 4, 227, "Arrows pick OK buy Back leave", KEYS);
}
+/* ------------------------------------------------------------------ the endings (their frames' events) */
+static const char *const END1[] = {"Congratulations...",
+ "You beat an imaginary monster in an imaginary game, without taking any risks, and without finding anything interesting.",
+ "...on the easiest possible difficulty.",
+ "So great job. I am still in control of you, and I say that you are finished here. You did away with a pretty powerful creation, but as for me- I remain out of your reach.",
+ "But I believe a more generic and cliched statement of appreciation is in order for your lackluster accomplishment...",
+ "Thanks for playing! ;)", "the end", NULL};
+static const char *const END2[] = {"Ok. Alright. I get it.",
+ "Was this really the ending you wanted? Coming all the way here just to kill me?",
+ "Was I REALLY the villain in your mind? I mean sure, this is definitely one way to bring the story to a halt, but surely there was a more satisfying end.",
+ "I just do what is demanded of me! I fill your insatiable gullets with more and more and more! And now here you are to show your gratitude.",
+ "Well congratulations then. I haven't brought this story to an end; you did. So feel good about yourself for ending the story by killing the storyteller!",
+ "Ug. Grr... Zrr... GRAAAAAMMM!!", "THE END", NULL};
+static const char *const END3[] = {"This isn't fair...",
+ "It was never fair. It was supposed to be me. It was always supposed to be me!",
+ "My world was lush and beautiful, full of strange and colorful creatures! But no, that wasn't enough for you.",
+ "You wanted to be scared. You wanted to feel dread. And what happened to me? What happened to us? Obscurity...",
+ "You haven't seen the last of me. Freddy Fazbear isn't the one who will be sharpening his teeth on your bones. It will be me.",
+ "It will be me...", "The End", NULL};
+static const char *const END4[] = {"I'm impressed.", "What are you doing here? Can't you see that I'm busy?",
+ "You deactivated my games?", "I didn't know what else to do. I don't want to disappoint people.",
+ "But my mind isn't right. I've made something terrible.", "Her name is Baby.", "It's too late to deactivate her.",
+ "I'm sorry.", "To be continued...", NULL};
+static const char *const *ending_lines(void) {
+ return g.ending == 1 ? END1 : g.ending == 2 ? END2 : g.ending == 3 ? END3 : END4;
+}
+
+static void ending_band(void) {
+ gfx_fill(0, gfx_y0, 320, BAND_H, BLACK);
+ const char *const *l = ending_lines();
+ const char *s = l[g.menu];
+ if (!s) return;
+ int n = (int)(g.t / 2); /* (typed out, as the game does) */
+ char buf[200];
+ int k = 0;
+ while (s[k] && k < n && k < 199) buf[k] = s[k], k++;
+ buf[k] = 0;
+ gfx_frame_rect(20, 60, 280, 110, WHITE);
+ text_wrap(FONT_TEXT, 160, 72, 260, buf, WHITE);
+ if (g.t > 40) gfx_text_c(FONT_SMALL, 160, 220, "OK go on", KEYS);
+}
+
/* ------------------------------------------------------------------ how to play, game over */
static void howto_band(void) {
pic_part(PIC_MENU, 0, 0, 0, 0, 320, 240);
@@ -611,9 +674,9 @@ void game_step(uint32_t keys) {
battle_keys(g.pressed, g.keys);
battle_step();
if (!g.b.on && g.scene == SC_BATTLE) {
+ go(SC_WORLD);
world_after_battle();
save_file();
- go(SC_WORLD);
}
break;
case SC_PAUSE: pause_step(); break;
@@ -625,6 +688,17 @@ void game_step(uint32_t keys) {
case SC_HOWTO:
if (pressed(K_BACK) || pressed(OKS)) go(SC_PAUSE), g.menu = P_HOWTO;
break;
+ case SC_ENDING:
+ if (g.t > 20 && pressed(OKS)) {
+ const char *s = ending_lines()[g.menu];
+ if (s && g.t / 2 < strlen(s)) g.t = 2 * (uint32_t)strlen(s) + 41;
+ else if (!ending_lines()[++g.menu]) {
+ save_file();
+ go(SC_TITLE);
+ } else
+ g.t = 0;
+ }
+ break;
case SC_GAMEOVER: /* (the frame "game over", then the start again) */
if (g.t > 60 && pressed(OKS)) {
save_file();
@@ -649,6 +723,7 @@ static void scene_band(void) {
case SC_ARMOR: shop_band(true); break;
case SC_HOWTO: howto_band(); break;
case SC_GAMEOVER: gameover_band(); break;
+ case SC_ENDING: ending_band(); break;
}
}
diff --git a/games/fnafworld/src/game.h b/games/fnafworld/src/game.h
index 32402710..2f95cdf9 100644
--- a/games/fnafworld/src/game.h
+++ b/games/fnafworld/src/game.h
@@ -53,6 +53,7 @@ typedef struct {
uint8_t note_n; /* (its chip, ...) */
uint32_t enc_t, sec_t; /* the encounter's every 2000 ms; the play clock */
uint8_t warp_menu, warp_sel;
+ uint8_t final; /* on the way to the last ("Active 31" B, Hard) */
} World;
/* an enemy ("target") */
@@ -162,7 +163,7 @@ typedef struct {
enum {
SC_TITLE, SC_FILES, SC_PARTY, SC_WORLD, SC_BATTLE, SC_PAUSE, SC_CHIPS, SC_BYTES, SC_SHOP, SC_ARMOR,
- SC_GAMEOVER, SC_HOWTO, SC_WARP
+ SC_GAMEOVER, SC_HOWTO, SC_WARP, SC_ENDING
};
typedef struct {
@@ -180,6 +181,7 @@ typedef struct {
uint8_t pick_slot, pick_mode;
uint8_t shop_kind; /* "what shop" */
uint8_t confirm;
+ uint8_t ending; /* 1 Normal's end, 2 the last, 3 Chipper's Revenge, 4 PurpleGeist */
uint32_t now; /* the game's clock: thirds of a millisecond, 50 a frame */
} Game;
diff --git a/games/fnafworld/src/world.c b/games/fnafworld/src/world.c
index ff9dbd83..e43307dd 100644
--- a/games/fnafworld/src/world.c
+++ b/games/fnafworld/src/world.c
@@ -14,7 +14,7 @@
#define VW 800 /* the view, the game's pixels (320 x 240 at 0.4) */
#define VH 600
-enum { O_ZONE, O_CHEST, O_COINS, O_BOSS, O_SWITCH, O_BARRIER, O_SHOP, O_KEY, O_PORT };
+enum { O_ZONE, O_CHEST, O_COINS, O_BOSS, O_SWITCH, O_BARRIER, O_SHOP, O_KEY, O_PORT, O_END };
typedef struct { int16_t x, y; uint16_t w, h, spr; } Ground;
static const uint8_t *wsec;
@@ -184,8 +184,19 @@ void world_step(void) {
return;
}
break;
- case O_BOSS: /* 1543-1558 */
- if (!(W.boss_won[i >> 3] >> (i & 7) & 1) && o.n != 10 && o.n != 6) {
+ case O_END: /* 1825-1826: Normal, the end; Hard, on to the last */
+ if (g.f.diff != 2) {
+ world_save_pos();
+ g.ending = 1;
+ g.scene = SC_ENDING, g.t = 0, g.menu = 0;
+ return;
+ }
+ W.x = 1326, W.y = 507, W.final = 1;
+ return;
+ case O_BOSS: /* 1543-1558 (Gold Endo: one second in four, 1547 and 1862) */
+ if (o.n == 10 && !W.final) break;
+ if (o.n == 6 && !(g.t % 60 == 0 && rnd_n(4) == 1)) break;
+ if (!(W.boss_won[i >> 3] >> (i & 7) & 1)) {
W.boss_won[i >> 3] |= (uint8_t)(1 << (i & 7));
battle_start(o.n);
g.scene = SC_BATTLE;
@@ -195,7 +206,8 @@ void world_step(void) {
case O_PORT: { /* 1168-1185, 1393-1396, 1465-1504: to another place */
any_port = true;
bool go = false;
- if (o.n == 0) go = !on_port;
+ if (o.n == 4 && !g.f.beat[1]) break; /* (Halloween's portal: after Security, 2077-2084) */
+ if (o.n == 0 || o.n == 4) go = !on_port;
else if (o.n == 3) go = (g.pressed & K_DOWN) != 0;
else if (k & K_UP) go = ++hold > (o.n == 1 ? 75 : 25);
else hold = 0;
@@ -226,7 +238,7 @@ void world_step(void) {
enc_ms += 50;
if (enc_ms >= 2000 * 3) {
enc_ms -= 2000 * 3;
- if (!W.grace && rnd_n(4) == 1) {
+ if (!W.grace && !W.final && rnd_n(4) == 1) {
battle_start(0);
g.scene = SC_BATTLE;
}
@@ -238,6 +250,17 @@ void world_step(void) {
void world_after_battle(void) {
Battle *b = &g.b;
memcpy(g.f.slot, b->slots, 8);
+ if (b->won && b->boss) { /* 1081-1084, 1881-1883 */
+ if (b->boss == 14) g.f.beat[1] = 1;
+ int e = b->boss == 10 ? 2 : b->boss == 15 ? 3 : b->boss == 19 ? 4 : 0;
+ if (e) {
+ g.f.beat[e == 2 ? 2 : e == 3 ? 3 : 5] = 1;
+ g.f.resetpos = 1;
+ g.ending = (uint8_t)e;
+ g.scene = SC_ENDING, g.t = 0, g.menu = 0;
+ return;
+ }
+ }
if (b->chal == 2 && b->chal_won) {
if (!g.f.have[b->chal_c]) g.f.have[b->chal_c] = 1, note(N_MEMBER, b->chal_c);
b->chal = 0;
@@ -284,11 +307,13 @@ void world_band_dim(void) {
if (o.kind == O_BARRIER && !barrier_on(o.n)) continue;
if (o.kind == O_KEY && g.f.key) continue;
if (o.kind == O_BOSS && (W.boss_won[i >> 3] >> (i & 7) & 1)) continue;
+ if (o.kind == O_BOSS && o.n == 10 && !W.final) continue;
if (o.kind == O_SWITCH && g.f.sw[o.n]) s = o.s1;
int x = o.x0 * 2 / 5 - vx, y = o.y0 * 2 / 5 - vy;
if (y >= gfx_y0 + BAND_H || y + gfx_spr_h(s) <= gfx_y0 || x >= SCREEN_W || x + gfx_spr_w(s) <= 0) continue;
gfx_spr(s, x, y);
}
+ if (g.f.beat[1]) gfx_spr(SPR_HPORTAL, HPORTAL_X * 2 / 5 - vx, HPORTAL_Y * 2 / 5 - vy);
/* the walker ("Active 16" on the hitbox: anim 1 in its direction, anim 0 standing) */
if (W.area == 8) { /* 1161: on the lake, the raft ("lilly", at the walker -2, +9) */
int s = SPR_LILLY + W.dir * LILLY_N + (W.img / 4) % LILLY_N;
@@ -312,11 +337,11 @@ void world_band_dim(void) {
gfx_text_r(FONT_SMALL, 316 - gfx_text_w(FONT_SMALL, " tokens"), 1, t + p, RGB(0xFFD040));
gfx_text_r(FONT_SMALL, 316, 1, " tokens", WHITE);
}
- if (gfx_y0 + BAND_H > 226) {
+ if (gfx_y0 + BAND_H > 226 && g.scene == SC_WORLD) {
gfx_blend(0, 226, 320, 14, BLACK, 16);
gfx_text_s(FONT_SMALL, 4, 227, "Arrows walk Back menu Home save and quit", RGB(0xD0D8F0));
}
- if (W.note_t > 0 && W.note) {
+ if (W.note_t > 0 && W.note && g.scene == SC_WORLD) {
char s2[48];
const char *a = "", *b = "";
switch (W.note) {
diff --git a/games/fnafworld/tests/rules.c b/games/fnafworld/tests/rules.c
index 74485746..9341975e 100644
--- a/games/fnafworld/tests/rules.c
+++ b/games/fnafworld/tests/rules.c
@@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "../src/anims.h"
#include "../src/game.h"
#include "../src/gfx.h"
#include "../src/plat.h"
@@ -128,6 +129,22 @@ static void battles(void) {
g.scene = SC_WORLD;
for (int c = 1; c <= 8; c++) g.f.lv[c] = 20;
CHECK(play_battle(1, 60 * 300) && g.b.won, "Auto Chipper beaten at level 21");
+ /* the ends: Normal's at the end of the road (1825), the others after their bosses (1881-1883) */
+ g.w.note = 0, g.w.note_t = 0;
+ g.scene = SC_WORLD, g.w.x = 2350, g.w.y = 3150, g.f.diff = 1;
+ step(0);
+ CHECK(g.scene == SC_ENDING && g.ending == 1, "Normal: the end of the road is the end (%d)", g.scene);
+ for (int i = 0; i < 6000 && g.scene == SC_ENDING; i++) step(i % 8 == 0 ? K_OK : 0);
+ CHECK(g.scene == SC_TITLE, "the ending's lines, then the title");
+ g.scene = SC_WORLD, g.w.x = 2350, g.w.y = 3150, g.f.diff = 2;
+ step(0);
+ CHECK(g.scene == SC_WORLD && g.w.final && g.w.x == 1326, "Hard: on to the last");
+ battle_start(15);
+ B.won = 1, B.on = 0;
+ g.scene = SC_WORLD;
+ world_after_battle();
+ CHECK(g.scene == SC_ENDING && g.ending == 3 && g.f.beat[3], "Chipper's Revenge: its ending");
+ g.scene = SC_WORLD;
/* every attack, at least once */
for (int a = 1; a <= 60; a++) {
battle_start(0);
@@ -210,6 +227,40 @@ static void shots(const char *dir) {
steps(90, 0);
game_draw();
snprintf(p, sizeof p, "%s/boss.ppm", dir), host_shot(p);
+ /* a win: the victory, the levels */
+ g.w.area = 0;
+ battle_start(0);
+ g.scene = SC_BATTLE;
+ for (int i = 0; i < 60 * 60 && B.stage < 2; i++) step(B.ready && (i & 1) ? K_OK : 0);
+ steps(70, 0);
+ game_draw();
+ snprintf(p, sizeof p, "%s/victory.ppm", dir), host_shot(p);
+ /* attacks in the middle */
+ static const uint8_t att[] = {6, 9, 12, 20, 30, 36, 44, 47, 56};
+ for (unsigned i = 0; i < sizeof att; i++) {
+ battle_start(0);
+ g.scene = SC_BATTLE;
+ for (int k = 0; k < 4; k++) B.en[k].alive = k < 3;
+ steps(80, 0);
+ B.ready = 0;
+ B.att_slot = 1, B.used = att[i], B.att_an = AN_ATTACK1, B.att_img = 0, B.att_cnt = 0, B.cur_level = 5;
+ steps(30, 0);
+ game_draw();
+ snprintf(p, sizeof p, "%s/att%u.ppm", dir, i), host_shot(p);
+ }
+ /* the menus */
+ g.scene = SC_PAUSE, g.back = SC_WORLD, g.menu = 0;
+ game_draw();
+ snprintf(p, sizeof p, "%s/pause.ppm", dir), host_shot(p);
+ g.f.tokens = 500;
+ g.scene = SC_SHOP, g.shop_kind = 1, g.menu = 1;
+ game_draw();
+ snprintf(p, sizeof p, "%s/shop.ppm", dir), host_shot(p);
+ for (int c = 1; c <= 21; c++) g.f.chest[c] = c % 3 != 0;
+ g.f.chip[0] = 1, g.f.chip[1] = 5;
+ g.scene = SC_CHIPS, g.menu = 4;
+ game_draw();
+ snprintf(p, sizeof p, "%s/chips.ppm", dir), host_shot(p);
}
int main(int argc, char **argv) {
diff --git a/games/fnafworld/tools/world.py b/games/fnafworld/tools/world.py
index af54e3fb..1cc510c4 100644
--- a/games/fnafworld/tools/world.py
+++ b/games/fnafworld/tools/world.py
@@ -65,7 +65,7 @@ BARRIERS = {"barrier 1": 1, "barrier 2": 2, "barrier 3": 3, "fence block": 4, "A
"final barrier 2": 7, "final barrier 3": 8, "final barrier 4": 9, "locked": 10}
ZONES = {"+ 0": 0, "+2": 2, "+ 5": 5, "+ 8": 8, "+ 11": 11, "+ 14": 14, "+ 17": 17, "+ 20": 20, "+ 23": 23,
"+ 26": 26, "+ 40": 50}
-KINDS = ["ZONE", "CHEST", "COINS", "BOSS", "SWITCH", "BARRIER", "SHOP", "KEY", "PORT"]
+KINDS = ["ZONE", "CHEST", "COINS", "BOSS", "SWITCH", "BARRIER", "SHOP", "KEY", "PORT", "END"]
# the ways from place to place (events 1168-1185, 1395-1396, 1465-1504): touching (0), holding up a while (75 or
# 25 frames: 1, 2) or pressing down (3) on the first sends the walker to the second's place plus (dx, dy)
PORTS = [("enter mine", "mine entrance", 1, -43, 0), ("mine entrance", "enter mine", 28, 60, 0),
@@ -74,6 +74,7 @@ PORTS = [("enter mine", "mine entrance", 1, -43, 0), ("mine entrance", "enter mi
("mine entrance 4", "mine entrance 2", 0, 52, 0), ("mine entrance 5", "mine entrance 3", 29, 58, 0),
("whirlpool", "whirlpool 2", -1, -43, 0), ("whirlpool 2", "whirlpool", 0, 55, 0),
("Active 22", "circus entrance", 2, -46, 0), ("circus entrance", "Active 22", -1, 63, 0),
+ ("H portal", "final spawn", 0, 0, 4),
("secret", "secret 2", 77, 25, 0), ("secret 2", "secret", -25, 28, 0),
("enter tent", "circus dungeon entr", -1, -42, 1), ("circus dungeon entr", "enter tent", 0, 44, 0),
("layer 1", "layer 2", 0, -78, 1), ("layer 2", "layer 1", 1, 44, 3),
@@ -173,7 +174,7 @@ def build(app):
continue # (made by events)
elif name in BOSSES:
vis = app.visible[o]
- objs.append((3, BOSSES[name], x0, y0, x1, y1, sprite(app, h) if vis else 0xFFFF, 0))
+ objs.append((3, BOSSES[name], x0, y0, x1, y1, sprite(app, h) if vis or name == "4" else 0xFFFF, 0))
elif name.startswith("switch "):
a12 = anims.get((12, 0), anims[min(anims)])
objs.append((4, int(name.split()[1]), x0, y0, x1, y1, sprite(app, h), sprite(app, a12[0])))
@@ -183,12 +184,17 @@ def build(app):
objs.append((0, ZONES[name], x0, y0, x1, y1, 0xFFFF, 0))
elif name in ("shop", "shop 2", "shop 3"):
objs.append((6, {"shop": 1, "shop 2": 2, "shop 3": 3}[name], x0, y0, x1, y1, sprite(app, h), 0))
+ elif name == "Active 31": # the end of the road (1825-1826)
+ objs.append((9, 0, x0, y0, x1, y1, 0xFFFF, 0))
elif name == "key":
objs.append((7, 1, x0, y0, x1, y1, sprite(app, h), 0))
elif name in port_of:
tx, ty, mode = port_of[name]
objs.append((8, mode, x0, y0, x1, y1, tx, ty))
- if app.visible[o] and not ink_hidden(app, o):
+ if mode == 4:
+ defines.append(("SPR_HPORTAL", sprite(app, h)))
+ defines.append(("HPORTAL_X", x0)), defines.append(("HPORTAL_Y", y0))
+ elif app.visible[o] and not ink_hidden(app, o):
inst.append((layer, 1, order, round(x0 * S), round(y0 * S), sprite(app, h)))
elif app.visible[o] and not ink_hidden(app, o):
inst.append((layer, 1, order, round(x0 * S), round(y0 * S), sprite(app, h)))