// SPDX-License-Identifier: MIT // The colour-effect scene shared by blend*.c: BG0 (first target) over BG1 (second), an OBJ // as first target, a semi-transparent OBJ over BG1, one over nothing but the backdrop, and // the backdrop as a target (GBATEK §LCD I/O Color Special Effects). #include "scene.h" static int scene(u16 bldcnt, u16 alpha, u16 y) { DISPCNT = 0x0080; palette_fill(0, 256, 10); palette_fill(256, 256, 30); 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 | 0; BGCNT(1) = 17 << 8 | 1; BGVOFS(0) = 60; // BG0 only on part of the screen (its map is half holes) for (int t = 0; t < 256; t++) tile4(0x10000 + t * 32, t * 7); obj_clear(); obj_set(0, 10, 10 | 3 << 14, 0 | 1 << 10); // normal OBJ, priority 1 obj_set(1, 10 | 1 << 10, 90 | 3 << 14, 64 | 1 << 10); // semi-transparent obj_set(2, 90 | 1 << 10, 90 | 3 << 14, 128 | 3 << 10); // semi, priority 3 (under BGs) obj_set(3, 90, 170 | 3 << 14, 192 | 2 << 10); PAL16[0] = rgb(12, 20, 28); BLDCNT = bldcnt; BLDALPHA = alpha; BLDY = y; DISPCNT = 0x0300 | 0x1000 | 0x0040; forever(); return 0; }