Files

3.6 KiB
Raw Permalink Blame History

Dark (power 0x29) — the victim's flashlight [C]

Capture: re/runs/anim/p29 (re/lua/anim_cap.lua, TBG_POWER=29; P1 Halloween casts, P2 = victim). Reference mask: re/tools/anim_dark.py ROM re/runs/anim/p29 OUT.png → re/runs/anim/dark/cone.png (48×80, grey = colour index), ROM data only except one OAM frame for the per-sprite tile/flip choice.

How the original draws it

From the cut-in's end (rel ≈104) until the power ends (4 victim pieces, rel ≈814 in the capture):

  • Window 1 = the victim's field rectangle (P2: x 144-223, y 23-198; P1: x 32-111). W12SEL = $22, TMW = $13: BG1 and BG2 are masked off on the main screen inside the field → the whole field shows the backdrop (black). Sprites are not windowed, so the falling piece (OBJ palettes 1/2) stays fully visible.
  • The light = one metasprite of 42 8×8 sprites (86:C48D; tiles 05-0E of name table 2 = the effect sheet 9A:C413+0800; palette 4 = CGRAM row 12 from 85:D447), dx/dy from word tables 86:C596 / 86:C5EA.
  • Colour math: $2131 = half-add on OBJ ($10), CGWSEL $02 (add the sub-screen); sub-screen = BG1 + BG2 (not windowed). OBJ colour math only affects palettes 4-7, so inside the light sprites the screen shows (light colour + board/stage pixel) / 2; the piece sprites are unaffected.

So the victim sees: a black field, its falling piece, and the board underneath only through the cone.

Position [C]

86:C48D is called with X = piece pixel X (DP+02) − 8 and Y = piece pixel Y (DP+05) + 16 at every spawn/move/rotate of the victim's piece (callers 81:AAD7 P1 spawn, 81:B239 P2 spawn, 81:ACF0/81:B44B, 81:CDB6 movement; all use the same −8 / +16). Sprites are placed at (X + dx, Y + dy) — not shifted by the piece's rotation or shape (it follows the 4×4 box). Between pieces it stays where it was.

In field terms (8 px cells; the piece's 4×4 box top-left at screen (bx, by_screen) where by_screen = DP+05 + 7 because BG rows show one scanline lower): the cone's bounding box is 48 × 80 px, left = box left − 8, top = box top + 9, i.e. it spans the box ±1 cell horizontally and about 10 rows downward.

Shape (relative to the cone box, 48 × 80) [C, from the composed sprites]

  • Row 0: empty. Rows 1-71: a triangle with its apex at the box centre: width = 2 + 2·⌊(y−1)/3⌋ px, centred on x = 24 (rows 1-3: 2 px, 4-6: 4 px, … 70-71: 48 px). Body colour index 13 = (5,5,5) (BGR555) → the board shows at ~half brightness.
  • Rows 67-78: a bright elliptical pool at the bottom, colour index 1 = (29,28,0) (yellow), widths 44, 46, 46, 46, 44, 42, 40, 34, 28, 16 (rows 69-78; rows 67-68 are the triangle's last dark rows with a yellow interior — see cone.png / the ASCII dump of anim_dark.py for the exact per-pixel mask: d = dark, Y = yellow).
  • Everything else in the field: black.

Implementation (C++)

Per frame while the victim is under Dark: fill the field with black; then for every pixel of the 48×80 mask placed at (box_left − 8, box_top + 9) and clipped to the field, draw (light + board)/2 where light = (5,5,5)·8 for the body and (29,28,0)·8 for the pool, board = what would normally be drawn there (stage + cells, but not the falling piece, which is drawn on top at full brightness). An exact approach: render the field normally to a texture, then draw black outside the mask and a 50% blend of the mask colour over it inside. The mask is small enough to embed as a 48×80 alpha/colour table generated from the ROM at load time (86:C596/86:C5EA + tiles 9A:C413+0800).