// SPDX-License-Identifier: MIT // The OBJ scene shared by objs1d.c and objs2d.c: every shape and size in both depths, flips, // priorities against two BGs, X and Y wrap-around, a disabled OBJ, the prohibited shape and // mode. Overlapping OBJs never have a lower OAM number with a worse priority (that case is // objorder.c), so the readings of OBJ-to-OBJ priority agree here. #include "scene.h" static int scene(int one_d) { DISPCNT = 0x0080; palette_fill(0, 256, 5); palette_fill(256, 256, 17); for (int t = 0; t < 32; t++) tile4(t * 32, t); map_text(16, 1, 32, 2); map_text(17, 1, 32, 3); BGCNT(0) = 16 << 8 | 1; BGCNT(1) = 17 << 8 | 2; BGHOFS(1) = 4; for (int t = 0; t < 1024; t++) tile4(0x10000 + t * 32, t * 3); obj_clear(); int n = 0; for (int shape = 0; shape < 3; shape++) for (int size = 0; size < 4; size++) { int x = (n % 6) * 40, y = (n / 6) * 34; int depth = n & 1 ? 0x2000 : 0; obj_set(n, y | depth | shape << 14, x | size << 14 | (n % 4) << 12, (n * 37) % 1024 | (n / 3) % 4 << 10 | (n % 16) << 12); n++; } obj_set(n++, 100 | 1 << 14, 500 | 2 << 14, 40 | 0 << 10); // X wraps (left edge) obj_set(n++, 230 | 2 << 14, 200 | 3 << 14, 80 | 0 << 10); // Y wraps (top edge) obj_set(n++, 120 | 0x0200, 30 | 1 << 14, 0); // disabled obj_set(n++, 120 | 3 << 14, 60 | 1 << 14, 0); // shape 3 obj_set(n++, 120 | 3 << 10, 90 | 1 << 14, 0); // mode 3 obj_set(n++, 100 | 0x2000, 170 | 3 << 14, 600 | 3 << 10); // 8 bpp 64x64 PAL16[0] = rgb(6, 6, 6); DISPCNT = 0x0000 | 0x0300 | 0x1000 | (one_d ? 0x0040 : 0); forever(); return 0; }