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.

Among Us: usable consoles outlined in yellow, objects in front of players where they belong

Mason363100fe574778d
diff --git a/games/amongus/src/data.bin b/games/amongus/src/data.bin
index 7b3d6668..d26ea76e 100644
Binary files a/games/amongus/src/data.bin and b/games/amongus/src/data.bin differ
diff --git a/games/amongus/src/data.h b/games/amongus/src/data.h
index 54b07d68..967e4989 100644
--- a/games/amongus/src/data.h
+++ b/games/amongus/src/data.h
@@ -6,35 +6,36 @@
#define N_FONTS 4
#define BLOB_SHIP 284
#define BLOB_FRONT_MASKS 285
-#define BLOB_MEETING 286
-#define BLOB_KILLBG 287
-#define BLOB_KMIX 288
-#define BLOB_MG_CARD 289
-#define BLOB_MG_WIRES 290
-#define BLOB_MG_ASTEROIDS 291
-#define BLOB_MG_ALIGN 292
-#define BLOB_MG_SCAN 293
-#define BLOB_MG_SAMPLE 294
-#define BLOB_MG_FUEL1 295
-#define BLOB_MG_FUEL2 296
-#define BLOB_MG_SIMON 297
-#define BLOB_MG_GARBAGE 298
-#define BLOB_MG_UPLOAD 299
-#define BLOB_MG_CALIBRATE 300
-#define BLOB_MG_COURSE 301
-#define BLOB_MG_LEAVES 302
-#define BLOB_MG_MANIFOLDS 303
-#define BLOB_MG_STEERING 304
-#define BLOB_MG_SHIELDS 305
-#define BLOB_MG_DIVERT 306
-#define BLOB_MG_ACCEPT 307
-#define BLOB_MG_HANDS 308
-#define BLOB_MG_LIGHTS 309
-#define BLOB_MG_COMMS 310
-#define BLOB_MG_KEYPAD 311
-#define BLOB_MG_CAMS 312
-#define BLOB_MG_EMERGENCY 313
-#define BLOB_MIX 314
+#define BLOB_CONS_MASKS 286
+#define BLOB_MEETING 287
+#define BLOB_KILLBG 288
+#define BLOB_KMIX 289
+#define BLOB_MG_CARD 290
+#define BLOB_MG_WIRES 291
+#define BLOB_MG_ASTEROIDS 292
+#define BLOB_MG_ALIGN 293
+#define BLOB_MG_SCAN 294
+#define BLOB_MG_SAMPLE 295
+#define BLOB_MG_FUEL1 296
+#define BLOB_MG_FUEL2 297
+#define BLOB_MG_SIMON 298
+#define BLOB_MG_GARBAGE 299
+#define BLOB_MG_UPLOAD 300
+#define BLOB_MG_CALIBRATE 301
+#define BLOB_MG_COURSE 302
+#define BLOB_MG_LEAVES 303
+#define BLOB_MG_MANIFOLDS 304
+#define BLOB_MG_STEERING 305
+#define BLOB_MG_SHIELDS 306
+#define BLOB_MG_DIVERT 307
+#define BLOB_MG_ACCEPT 308
+#define BLOB_MG_HANDS 309
+#define BLOB_MG_LIGHTS 310
+#define BLOB_MG_COMMS 311
+#define BLOB_MG_KEYPAD 312
+#define BLOB_MG_CAMS 313
+#define BLOB_MG_EMERGENCY 314
+#define BLOB_MIX 315
#define N_MIX 256
#define MG_X 160
#define MG_Y 112
@@ -57,7 +58,10 @@ enum { FONT_SMALL, FONT_MID, FONT_BIG, FONT_HUGE };
/* where an object in front covers the floor: a bit a pixel, rows of whole bytes, lowest bit first */
typedef struct { uint32_t off; int16_t x, y; uint16_t w, h; float z; } FrontRec;
#define N_FRONT 58
-static const FrontRec FRONT[58] = {{0, 1946, 1403, 97, 144, 4.45048e-07f}, {1872, 1968, 1474, 67, 72, 4.45048e-07f}, {2520, 1950, 1423, 67, 72, 1.01725e-06f}, {3168, 1396, 763, 20, 12, 1.40841e-06f}, {3204, 1555, 763, 23, 12, 1.40841e-06f}, {3240, 1279, 828, 271, 189, -3.88f}, {9666, 1432, 946, 96, 52, -0.00820028f}, {10290, 1559, 948, 17, 34, -0.00832028f}, {10392, 1389, 947, 14, 34, -0.00832028f}, {10460, 1454, 946, 56, 29, -0.1282f}, {10663, 1153, 754, 16, 12, -1.6f}, {10687, 2599, 617, 34, 71, -0.00520021f}, {11042, 2543, 519, 38, 39, -0.00292054f}, {11237, 2410, 531, 163, 196, -3.88f}, {15353, 2523, 752, 27, 35, -0.0060402f}, {15493, 2545, 617, 33, 37, -0.00472013f}, {15678, 2512, 543, 32, 32, -0.00352021f}, {15806, 1868, 50, 39, 48, 0.00187957f}, {16046, 1716, 234, 72, 21, 0.00031986f}, {16235, 1959, 156, 59, 52, -0.28f}, {16651, 1665, 29, 264, 235, -3.64f}, {24406, 1746, 1138, 210, 229, -0.52f}, {30589, 1711, 1312, 74, 45, -0.0136004f}, {31039, 1960, 1127, 59, 19, -0.0107205f}, {31191, 1940, 1293, 21, 82, -0.52f}, {31437, 2170, 561, 16, 12, -1.6f}, {31461, 347, 986, 102, 79, -0.0100005f}, {32488, 317, 1051, 33, 30, -0.0101205f}, {32638, 398, 845, 202, 32, -1.6f}, {33470, -683, 509, 191, 333, -4.0012f}, {41462, -737, 571, 74, 81, -0.4012f}, {42272, 868, 1220, 156, 161, -0.0126404f}, {45492, 1037, 1190, 34, 16, -0.0246404f}, {45572, 1040, 1137, 28, 36, -0.0366404f}, {45716, 881, 1374, 17, 23, -0.0126524f}, {45785, -373, 1123, 149, 131, -0.0112006f}, {48274, -360, 1261, 23, 32, -0.0113206f}, {48370, -189, 1053, 10, 36, -4.012f}, {48442, -189, 1271, 10, 36, -4.012f}, {48514, -330, 1134, 33, 14, -4.012f}, {48584, -427, 1272, 24, 22, -0.0113206f}, {48650, -300, 1247, 104, 21, -0.0113206f}, {48923, -188, 1133, 30, 73, -0.0110806f}, {49215, 537, 95, 16, 12, -1.48f}, {49239, -313, 613, 16, 12, -1.6f}, {49263, -375, 147, 149, 131, 0.000799815f}, {51752, -362, 285, 23, 32, 0.000679815f}, {51848, -191, 78, 10, 36, -4.0f}, {51920, -191, 295, 10, 36, -4.0f}, {51992, -332, 158, 33, 14, -4.0f}, {52062, -429, 296, 24, 21, 0.000679815f}, {52125, -302, 271, 104, 21, 0.000679815f}, {52398, -190, 157, 30, 73, 0.000919815f}, {52690, 1398, 1596, 100, 52, -0.0172001f}, {53366, 1409, 1624, 87, 38, -0.0292001f}, {53784, 1332, 1428, 211, 172, -4.12f}, {58428, 1606, 1526, 25, 59, -0.0162406f}, {58664, 1248, 1526, 26, 59, -0.01624f}};
+static const FrontRec FRONT[58] = {{0, 1507, 802, 97, 144, 4.45048e-07f}, {1872, 1525, 856, 67, 72, 4.45048e-07f}, {2520, 1517, 830, 67, 72, 1.01725e-06f}, {3168, 1251, 515, 20, 12, 1.40841e-06f}, {3204, 1330, 516, 23, 12, 1.40841e-06f}, {3240, 1130, 504, 271, 189, -3.88f}, {9666, 1250, 597, 96, 52, -0.00820028f}, {10290, 1334, 602, 17, 34, -0.00832028f}, {10392, 1250, 602, 14, 34, -0.00832028f}, {10460, 1271, 603, 56, 29, -0.1282f}, {10663, 1131, 511, 16, 12, -1.6f}, {10687, 1850, 428, 34, 71, -0.00520021f}, {11042, 1820, 387, 38, 39, -0.00292054f}, {11237, 1723, 354, 163, 196, -3.88f}, {15353, 1813, 504, 27, 35, -0.0060402f}, {15493, 1823, 436, 33, 37, -0.00472013f}, {15678, 1806, 401, 32, 32, -0.00352021f}, {15806, 1482, 150, 39, 48, 0.00187957f}, {16046, 1398, 249, 72, 21, 0.00031986f}, {16235, 1523, 202, 59, 52, -0.28f}, {16651, 1325, 93, 264, 235, -3.64f}, {24406, 1379, 649, 210, 229, -0.52f}, {30589, 1396, 782, 74, 45, -0.0136004f}, {31039, 1524, 696, 59, 19, -0.0107205f}, {31191, 1523, 763, 21, 82, -0.52f}, {31437, 1639, 415, 16, 12, -1.6f}, {31461, 706, 610, 102, 79, -0.0100005f}, {32488, 708, 655, 33, 30, -0.0101205f}, {32638, 707, 551, 202, 32, -1.6f}, {33470, 169, 308, 191, 333, -4.0012f}, {41462, 171, 402, 74, 81, -0.4012f}, {42272, 953, 707, 156, 161, -0.0126404f}, {45492, 1069, 728, 34, 16, -0.0246404f}, {45572, 1072, 699, 28, 36, -0.0366404f}, {45716, 995, 818, 17, 23, -0.0126524f}, {45785, 335, 666, 149, 131, -0.0112006f}, {48274, 373, 759, 23, 32, -0.0113206f}, {48370, 462, 660, 10, 36, -4.012f}, {48442, 462, 759, 10, 36, -4.012f}, {48514, 385, 697, 33, 14, -4.012f}, {48584, 339, 767, 24, 22, -0.0113206f}, {48650, 383, 755, 104, 21, -0.0113206f}, {48923, 457, 685, 30, 73, -0.0110806f}, {49215, 823, 181, 16, 12, -1.48f}, {49239, 398, 441, 16, 12, -1.6f}, {49263, 334, 178, 149, 131, 0.000799815f}, {51752, 372, 271, 23, 32, 0.000679815f}, {51848, 461, 172, 10, 36, -4.0f}, {51920, 461, 270, 10, 36, -4.0f}, {51992, 384, 210, 33, 14, -4.0f}, {52062, 338, 280, 24, 21, 0.000679815f}, {52125, 382, 267, 104, 21, 0.000679815f}, {52398, 456, 197, 30, 73, 0.000919815f}, {52690, 1233, 922, 100, 52, -0.0172001f}, {53366, 1241, 939, 87, 38, -0.0292001f}, {53784, 1172, 808, 211, 172, -4.12f}, {58428, 1355, 885, 25, 59, -0.0162406f}, {58664, 1176, 885, 26, 59, -0.01624f}};
+/* each console's picture (world.h's order): where its mask starts, its top-left in ship pixels, its size */
+typedef struct { uint16_t off; int16_t x, y; uint8_t w, h; } ConsPic;
+static const ConsPic CONS_PIC[49] = {{0, 1209, 518, 16, 13}, {26, 1369, 524, 13, 13}, {52, 1165, 525, 16, 11}, {74, 1334, 602, 17, 34}, {176, 1250, 602, 14, 34}, {244, 1288, 104, 15, 25}, {294, 901, 55, 10, 19}, {332, 1251, 67, 11, 22}, {376, 1070, 220, 24, 22}, {442, 1850, 428, 34, 71}, {797, 1820, 387, 38, 39}, {992, 1789, 365, 16, 13}, {1018, 1749, 366, 17, 12}, {1054, 1461, 182, 38, 39}, {1249, 1569, 182, 11, 20}, {1289, 1455, 110, 16, 13}, {1315, 1305, 391, 17, 28}, {1399, 1443, 367, 17, 12}, {1435, 1336, 379, 21, 29}, {1522, 1379, 381, 13, 13}, {1548, 1537, 673, 17, 12}, {1584, 1407, 820, 22, 27}, {1665, 1690, 419, 16, 11}, {1687, 719, 559, 16, 13}, {1713, 873, 561, 19, 23}, {1782, 800, 575, 16, 11}, {1804, 708, 655, 33, 30}, {1954, 748, 559, 17, 12}, {1990, 208, 365, 14, 17}, {2024, 231, 483, 29, 28}, {2136, 259, 318, 14, 18}, {2172, 258, 632, 15, 6}, {2184, 1144, 930, 12, 22}, {2228, 1032, 617, 16, 11}, {2250, 995, 818, 17, 23}, {2319, 388, 638, 17, 12}, {2355, 373, 759, 23, 32}, {2451, 339, 767, 24, 22}, {2517, 487, 452, 16, 11}, {2539, 372, 271, 23, 32}, {2635, 338, 280, 24, 21}, {2698, 419, 142, 17, 11}, {2731, 1241, 939, 87, 38}, {3149, 1355, 831, 17, 12}, {3185, 1264, 826, 16, 13}, {3211, 559, 355, 72, 35}, {3526, 628, 387, 11, 20}, {3566, 850, 420, 42, 49}, {3860, 788, 460, 72, 47}};
#define PIC_DEADBODY_BIG 90
#define PIC_PLATE_PLAYER 88
#define PIC_VOTE_ICON 89
diff --git a/games/amongus/src/view.c b/games/amongus/src/view.c
index 91bcb50a..c24cd61a 100644
--- a/games/amongus/src/view.c
+++ b/games/amongus/src/view.c
@@ -9,6 +9,12 @@
View view;
int kill_target(int i);
+int console_use(int i, int c);
+int hud_action(int *what);
+
+/* the consoles the player can use from here (outlined), and the one OK would use (lit too) */
+static uint8_t usable[8];
+static int nusable, main_cons;
/* ---- the camera: the ship's pixels at the screen's top-left ---- */
@@ -137,6 +143,13 @@ void view_prepare(void) {
view.pts[2 * k + 1] = -pts[2 * k + 1] * PX_PER_UNIT + SHIP_OY - view.cy;
}
}
+ nusable = 0, main_cons = -1;
+ if (g.screen == S_PLAY && g.overlay == O_NONE && M->vent == NONE) {
+ int what = -1, act = hud_action(&what);
+ for (int c = 0; c < N_CONSOLES && nusable < 8; c++)
+ if (console_use(g.me, c) >= 0) usable[nusable++] = (uint8_t)c;
+ if (act == 1 || act >= 4) main_cons = what;
+ }
nitems = 0;
view.target = -1;
if (M->imp && M->alive && M->kill_cd <= 0 && g.screen == S_PLAY) view.target = kill_target(g.me);
@@ -217,6 +230,32 @@ static void draw_vents(void) {
}
}
+/* the usable consoles' yellow outline (Console.SetOutline), the one OK would use lit up */
+static void draw_outlines(void) {
+ const uint8_t *masks = (const uint8_t *)blob(BLOB_CONS_MASKS);
+ for (int k = 0; k < nusable; k++) {
+ const ConsPic *C = &CONS_PIC[usable[k]];
+ const uint8_t *m = masks + C->off;
+ int stride = (C->w + 7) >> 3, x0 = C->x - view.cx, y0 = C->y - view.cy;
+ bool lit = usable[k] == main_cons;
+#define IN(u, v) ((unsigned)(u) < C->w && (unsigned)(v) < C->h && (m[(v) * stride + ((u) >> 3)] >> ((u) & 7) & 1))
+ for (int y = y0 - 1; y <= y0 + C->h; y++) {
+ if (y < gfx_y0 || y >= gfx_y0 + BAND) continue;
+ uint16_t *row = gfx_band + (y - gfx_y0) * SCREEN_W;
+ int v = y - y0;
+ for (int x = x0 - 1; x <= x0 + C->w; x++) {
+ if ((unsigned)x >= SCREEN_W) continue;
+ int u = x - x0;
+ if (IN(u, v)) {
+ if (lit) row[x] = blend(row[x], 0xFFE0, 60);
+ } else if (IN(u - 1, v) || IN(u + 1, v) || IN(u, v - 1) || IN(u, v + 1))
+ row[x] = 0xFFE0;
+ }
+ }
+#undef IN
+ }
+}
+
/* outside the light: the ship darker (and nobody there) */
static void draw_dark(void) {
if (!view.dark) return;
@@ -270,6 +309,7 @@ static void draw_names(void) {
void view_draw(void) {
draw_tiles();
draw_vents();
+ draw_outlines();
draw_items();
draw_dark();
draw_names();
diff --git a/games/amongus/tools/pack.py b/games/amongus/tools/pack.py
index 551738ea..b52f5dab 100644
--- a/games/amongus/tools/pack.py
+++ b/games/amongus/tools/pack.py
@@ -419,7 +419,6 @@ def make_world(m, out):
return best
# consoles
- KIND = {"task": 0, "MapRoomConsole": 1, "EmergencyConsole": 2, "SurvConsole": 3}
cons = [c for c in m["consoles"] if c["kind"] in KIND]
rows = []
for c in cons:
@@ -453,6 +452,28 @@ def make_world(m, out):
open(out, "w").write("\n".join(lines) + "\n")
+KIND = {"task": 0, "MapRoomConsole": 1, "EmergencyConsole": 2, "SurvConsole": 3}
+
+
+def console_masks(sm, D):
+ """each console's own picture as a mask (a bit a pixel, rows of whole bytes), for its outline when usable:
+ consoles.json and consoles/ from extract_consoles.py, in the order of world.h's CONSOLES"""
+ pics = json.load(open(os.path.join(REF, "consoles.json")))
+ masks, recs = b"", []
+ for c in [c for c in sm["consoles"] if c["kind"] in KIND]:
+ e = [p for p in pics if abs(p["x"] - c["x"]) < 0.01 and abs(p["y"] - c["y"]) < 0.01][0]
+ im = Image.open(os.path.join(REF, "consoles", e["img"] + ".png")).convert("RGBA")
+ a = np.asarray(im)[:, :, 3] >= 100
+ w = (im.width + 7) // 8 * 8
+ a = np.pad(a, ((0, 0), (0, w - im.width)))
+ recs.append((len(masks), e["px"], e["py"], im.width, im.height))
+ masks += np.packbits(a, axis=1, bitorder="little").tobytes()
+ D("/* each console's picture (world.h's order): where its mask starts, its top-left in ship pixels, its size */")
+ D("typedef struct { uint16_t off; int16_t x, y; uint8_t w, h; } ConsPic;")
+ D("static const ConsPic CONS_PIC[%d] = {%s};" % (len(recs), ", ".join("{%d, %d, %d, %d, %d}" % r for r in recs)))
+ return masks + b"\0" * (-len(masks) % 4)
+
+
def cname(s):
return "".join(c if c.isalnum() else "_" for c in s).upper()
@@ -481,6 +502,7 @@ def main():
front.append((len(masks), f["x"], f["y"], im.width, im.height, f["z"]))
masks += np.packbits(a, axis=1, bitorder="little").tobytes()
tiles.append(("FRONT_MASKS", masks + b"\0" * (-len(masks) % 4)))
+ tiles.append(("CONS_MASKS", console_masks(sm, D)))
door_ids = {}
for kind in ("side", "front"):
dm = sm["door_" + kind]