chore: version Zelda 1 port and engineering records

This commit is contained in:
Nilton Constantino
2026-11-16 15:22:13 +00:00
commit 6f2fa420c2
4282 changed files with 822198 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
"""Compare saved Studio frames against extracted HUD and existing stage renders."""
import json
from PIL import Image, ImageChops
from extract_graphics import ROOT
def main():
output = ROOT / 'extracted/hud'
hud = Image.open(output / 'hud.png').convert('RGBA')
baseline = ROOT / 'extracted/overworld/start/collision-validation'
results = []
for name, original in [('initial', 'initial'), ('down_wall', 'down_wall'), ('up_edge', 'up_exit_closed')]:
expected = Image.open(baseline / f'{original}.png').convert('RGBA')
expected.paste(hud, (112, 15))
actual = Image.open(output / f'runtime_{name}.png').convert('RGBA')
differences = sum(p != (0, 0, 0, 0) for p in ImageChops.difference(actual, expected).getdata())
results.append({'case': name, 'different_pixels': differences})
assert differences == 0, results[-1]
expected = Image.open(baseline / 'initial.png').convert('RGBA')
expected.paste(Image.open(ROOT / 'extracted/overworld/start/room.png').convert('RGBA'), (112, 15))
expected.paste(hud, (112, 15))
# 200 up ticks reach (120,61). Five attack ticks: body phase 0, extended sword.
sword = Image.open(ROOT / 'assets/characters/link/sword_up.png').convert('RGBA')
body = Image.open(ROOT / 'assets/characters/link/attack_up_0.png').convert('RGBA')
expected.alpha_composite(sword, (112 + 119, 15 + 52))
expected.alpha_composite(body, (112 + 120, 15 + 64))
actual = Image.open(output / 'runtime_up_attack.png').convert('RGBA')
differences = sum(p != (0, 0, 0, 0) for p in ImageChops.difference(actual, expected).getdata())
results.append({'case': 'up_attack_over_hud', 'different_pixels': differences})
assert differences == 0, results[-1]
report = {'compared': len(results), 'results': results,
'scope': 'Full Prometeu frames versus ROM-derived HUD plus prior stage renders; includes sword above HUD background. Not a comparison with whole-game NES execution.'}
(output / 'runtime-validation.json').write_text(json.dumps(report, indent=2) + '\n')
print(json.dumps(report))
if __name__ == '__main__': main()