Files
siegeandClaude Opus 5.5 12ee5d17c6 re: big clear, danger, round-win mark, pause-screen moods, stock orbs/netting, preview minis
re/notes/anim_battle_extra.md + re/tools/anim_extra.py (ROM-only renders, flight path validated
frame-exact vs capture) + re/lua/anim_pause.lua. Corrects battle.md: stocks are netted at each
state 00 (81:D6AE), confirmed in Mesen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 17:03:39 -05:00

8.4 KiB
Raw Permalink Blame History

Battle extras: big clear, danger, round-win mark, pause screen moods, centre column [C unless noted]

Follow-up to anim_battle.md §4. Captures (re/runs/anim/, not committed): xbig (bottom 4 rows pre-filled, TBG_NOCAST=1), xtop/xdanger (tall boards), ko (round end), pause_top/pause_mid/pause_danger (re/lua/anim_pause.lua: Start at frame 90, boards of height 19/12/17), cancel (stocks poked to 3 vs 2). ROM-only reference render + validation: re/tools/anim_extra.py ROM OUT --captures re/runs/anim → winmark.png, minis.png, orbs.png, the win-mark flight table, and checks (flight vs ko: OK; palettes: OK; big-clear frames: 8 white frames).

1. Big clear (≥ 4 lines) — 81:92D9

Called from state 0A (81:AD17 P1 / 81:B476 P2) when 81:D06B found ≥ 4 full rows (so Doubles/Pentris counts too). The routine is blocking: the whole game (both players, all sprites, timers) is frozen while it runs; only the NMI (music) continues.

  1. Wait for pending DMAs (81:C0B8) and one frame; save CGRAM shadow colours 64-127 (7E:2C91, BG palettes 4-7 = the stage background BG2, incl. the board frame art) to 7E:30B1.
  2. 8 times: wait a frame, set colours 64-127 to $FFFF (white); wait a frame, restore them.
  3. Return; then SFX $05 (81:AD21, cmd $14 Y=5) and the normal line-clear flash (states 0B/0E, 14 f).

On screen (capture xbig, lock at rel 114): the stage/frame art (everything drawn by BG2) is pure white on 8 alternate frames (rel 121, 123, …, 135), normal in between: 16 frames total, starting ~6 frames after the lock. BG1 (cells, frame borders using palettes 0-2) and sprites keep their colours, so the cells and the falling pieces stand out on a white field/background. Then the usual break animation runs.

C++: on Clear with n ≥ 4 freeze the match update for 16 frames (or just overlay — the freeze is cosmetic but it does delay both players by 16 frames in the original); for k = 0..15 draw the stage background (and the frame/queue-box art that comes from BG2) as solid white on even k, normal on odd k; cells/pieces/sprites on top.

2. Danger / pinch — audio only

81:A869 at every spawn: if either board has any cell in its top 4 rendered rows ($296..$2BD / $4F6.., = our rows hidden..hidden+3) → cmd $06 Y=$20 (danger music), back to normal → Y=0. Already implemented (game_sound.cpp). No visual indication: capture xtop (row 3 occupied) shows no CGRAM/BG/OAM change beyond the always-running OBJ palette cycling (rows 8-10, every 4 frames) — there is nothing to draw.

3. Round-win mark — 81:FBF2 (called from 81:A795)

At round end (after the winner's INC DP+22 = wins $224/$484, then a 95-frame wait 81:A78F), blocking:

  • SFX $0A; sprite = 16×16 smiley ball made of four 8×8 OBJ entries (tiles t, t+1, t+16, t+17, OBJ sheet 9F:8000, name table 0), palette 1 (P1, blue) / 2 (P2, pink) = CGRAM rows 9/10 of 85:EC27 (uses colours 1, 2, 11-15 only), OAM slots 92 − 4·($224+$484) .. +3 (each mark keeps its own slots).
  • Start: x = $78 − player (P1 120, P2 119), y = $55 (OAM y = y − 1 = 84), priority 2.
  • Flight: wins + 12 steps, 4 frames each (first step 1 frame after the first draw), adding (dx, dy) from 81:FD75 (P1) / 81:FD91 (P2), 2 signed bytes per step:
    • P1: (−1,−11) (−1,−10) (0,−7) (−1,−5) (−1,−3) (0,−1) (−1,1) (−1,3) (0,5) (−1,7) (−1,10) (0,11) (0,12) (0,16)
    • P2: (1,−11) (2,−10) (0,−7) (1,−5) (1,−3) (0,−1) (1,1) (1,3) (0,5) (1,7) (1,10) (0,11) (0,12) (0,16)
    • from step 3 on, priority 3 (81:FC7B).
    • spin: frame index starts at 81:FC82[wins] = (–, 2, 1) and advances by 1 per step mod 6; frames = tiles 30 32 34 36 38 3A (81:FCC2 → metasprites 81:FCD8..).
  • Landing: 4 frames of 5 frames each: tiles 3E 50 3E 30 (81:FCD0: squash, flat, squash, rest).
  • Rest position (OAM): P1 x 112, P2 x 128; 1st win y 96, 2nd win y 112 (screen y + 1) — i.e. the centre column below the queue box, P1's marks on the left half, P2's on the right, stacking downward.
  • Total: 1 + 4·(wins+12) + 20 frames (73 for a first win). Validated frame-exact against ko (P2's first win, mark on screen from rel 853, lands 902, rests 921). The marks stay through READY/GO and the next round.
  • 81:FDAD also restores colours 7-10 of the winner's OBJ row from 81:FDE7 (P1 4 colours, P2 4 colours): undoing palette animation on the falling-piece colours. Not needed for the mark itself.

C++: after a round win: draw the mark following the table above in the centre column (scale orig px to the layout, x 112/128 orig = left/right half of the 32-px column, which spans orig x 112-143); rest marks per wins.

4. Pause screen and the "portrait moods" (82:A976)

82:A976 is not a battle-screen portrait: it is part of the original pause screen (82:9233 from the battle loop 81:A555 while $D0 ≠ 0; Start ($139/$13A edge) sets $D0 = 1/2 for the pausing player, SFX $08 (cmd $14 Y=8) on pause; pausing was only accepted while the piece was falling, state 05 [I: from the captures]). The pause screen (BG1 text at VRAM $7800, see pause_*/s0200.png): "PAUSE" in the middle, each player's portrait (82:97C2: P1 top-left, P2 bottom-right) with a label ("1PLAYER"/"COMPUTER" + name) and a text box:

  • 82:98A2: the highest power level the player can afford (crystals DP+1F vs costs DP+2B..2E) → 1-4, or $FF.
  • If affordable: the box shows "LEVEL n " + the power's description; Up/Down (82:A85C, pad bits $08/$04) browse levels 1-4 (index 7E:2630/2631, clamped 0..3).
  • If $FF and powers/crystals are on ($22D ≠ 0 and $170 ≠ 0 and ($CF & $30) ≠ $10): a per-character "how to use powers" text (82:AA9B header + text 82:9A95[$2C + char]).
  • Otherwise (powers off / no crystals): the mood comment 82:A976/82:A9DF: index = char·3 + mood from 82:AA4A (31 words: 10 characters × 3 + a blank entry), mood from the stack height 82:D159 (= 22 − first occupied rendered row, only columns 3-6 are scanned): height < 10 → 0 (confident), 10-17 → 1 (a bit worried), ≥ 18 → 2 (desperate). Text is half-width kana with control codes $23/$24 (katakana/hiragana) and $25 (newline). The ROM text is copyrighted: load it from the ROM (or write new lines) rather than copying it into the repo.

The pause screen is drawn by battle code (our own pause screen replaces it), so it isn't covered by src/screens. Implementing it natively: portraits (existing select portraits), the power texts (ROM tables above), the mood rule above.

5. Centre column: attack-stock orbs and preview minis

  • Orbs (81:D4F4 full redraw, 81:D52E one slot, 81:D593 after a P2 clear): one shared column of 10 OAM slots (71-80), slot k (1-10) at y = 81:D588[k] = 188, 180, … 116 (OAM y; bottom first). Each side draws it in its own place: P1 side x 118, palette 1 showing P2's stock $482 (garbage coming to P1), P2 side x 129, palette 2 showing P1's stock $222. Tile A0 = lit orb if stock ≥ k, A8 = empty (fully transparent tile). Whoever redrew last owns the column (both share the slots): in practice it shows the pending garbage of the player who was last updated — at most one player has stock after netting (below). (anim_battle.md §4 said "tile A8": A8 is the empty slot; the lit orbs are A0.)
  • Stock netting (cancellation!) 81:D6AE, called at the start of every state 00 (81:A9E6 P1, 81:B148 P2, also 81:B502): if $222 > $482: $222 -= $482, $482 = 0; elif less: $482 -= $222, $222 = 0; else both 0 — then the victim receives the remaining opponent stock. Confirmed (cancel: P1 3 vs P2 2 → at P1's next state 00 $222 = 1, $482 = 0; P2 then received 1 row). This contradicts battle.md §3 ("no cancellation") — the core's Classic garbage should net the two stocks the same way.
  • Preview minis: 16×8 = OBJ tiles (t, t+1), palette 0 (CGRAM row 8, colours 2-9), name table 0, x 120/128, 4 entries at y 31/47/63/79 (OAM) after a round reset; tile by piece: T 10, O 12, I 14, J 16, L 18, S 1A, Z 1C; crystal versions +$10 (20-2D). Scroll motion: anim_battle.md §4.
  • Side-meter arrows (tiles 07/08, x 8 / 240) bob by 1 px every 10 frames (cosmetic).

Open

  • The mini tile per ROM piece id is read off the graphics, not from the drawing code's table.
  • Win mark for 3-4 players (ROM has 2 colours only): reuse the hue-rotated player palettes.