chore: version Zelda 1 port and engineering records
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""Verified ROM metadata shared by generation and independent route checks."""
|
||||
from nes_object_graphics import P
|
||||
from extract_start_room import extract
|
||||
from extract_graphics import ROOT
|
||||
import json
|
||||
|
||||
def metadata(room):
|
||||
attrs=[P[99328+i*128+room] for i in range(6)];c=attrs[2];list_id=(c&63)+(64 if attrs[3]&128 else 0);count=P[103204+(c>>6)]
|
||||
if 0x32<=list_id<0x62:count=1
|
||||
code=P.index(bytes.fromhex('a50238e9620aa8b9'),81920,98304);directory=81920+int.from_bytes(P[code+8:code+10],'little')-0x8000
|
||||
offset=None
|
||||
if list_id>=0x62:
|
||||
ptr=int.from_bytes(P[directory+(list_id-0x62)*2:directory+(list_id-0x62)*2+2],'little');offset=81920+ptr-0x8000;foes=list(P[offset:offset+count])
|
||||
else:foes=[list_id]*count if list_id else []
|
||||
return {'attrs':attrs,'list_id':list_id,'list_directory_prg':directory,'object_list_prg':offset,'foes':foes,'edge_spawns':bool(attrs[5]&8),'zora':bool(attrs[0]&8)}
|
||||
|
||||
def manifest():return json.loads((ROOT/'tools/overworld_manifest.json').read_text())['rooms']
|
||||
|
||||
def step_edge(cell):
|
||||
if cell%16==0:cell=(cell+16)&255
|
||||
elif cell%16==15:cell=(cell-16)&255
|
||||
if cell&240==224:cell=(cell+1)&255
|
||||
elif cell&240==64:cell=(cell-1)&255
|
||||
return cell
|
||||
Reference in New Issue
Block a user