#!/usr/bin/env python3 """Closed mutable rock cover must track camera in every connected direction.""" import json from PIL import Image from extract_graphics import ROOT from validate_octorok_graphics import difference from overworld_data import manifest rooms={e['stage']:e for e in manifest()} def room(stage):return Image.open(ROOT/f'extracted/overworld/{rooms[stage]["name"]}/room.png').convert('RGBA').crop((0,64,256,240)) def validate(): checks=[] for link in json.loads((ROOT/'extracted/overworld/expansion/catalog.json').read_text())['links']: if 2 not in (link['a'],link['b']):continue for a,b in [(link['a'],link['b']),(link['b'],link['a'])]: name=f'wall-scroll-{a}-{b}-mid';cap=Image.open(ROOT/f'extracted/overworld/expansion/validation/{name}.png').convert('RGBA');assert cap.getpixel((0,0))==(0,255,0,255) if link['direction']==1: expected=Image.new('RGBA',(512,176));expected.paste(room(link['a']),(0,0));expected.paste(room(link['b']),(256,0));expected=expected.crop((128,0,384,176)) else: expected=Image.new('RGBA',(256,352));expected.paste(room(link['a']),(0,0));expected.paste(room(link['b']),(0,176));expected=expected.crop((0,88,256,264)) diff=difference(cap.crop((112,79,368,255)),expected);assert diff==0,(name,diff);checks.append({'capture':name,'different_pixels':0}) (ROOT/'extracted/real_secret/scroll-report.json').write_text(json.dumps({'checks':checks},indent=2)+'\n');print('Mutable wall scroll pixel checks:',len(checks),'all exact') if __name__=='__main__':validate()