31 lines
1.5 KiB
Python
31 lines
1.5 KiB
Python
"""Build GameObjectDisplayInfo rows (same IDs as Octo/server) for spawned-object displays the client lacks, where the model exists natively.
|
|
GeoBox = model bounding box (M2 MD21 header 0xA0, WMO root MOHD box)."""
|
|
import sys,struct,json
|
|
sys.path.insert(0,'/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/parity/recipes-20261122')
|
|
import client_read as R
|
|
from compare import load
|
|
def chunks(b):
|
|
i=0
|
|
while i+8<=len(b):
|
|
t,l=b[i:i+4],struct.unpack_from('<I',b,i+4)[0]; yield t,i+8,l; i+=8+l
|
|
def box(b):
|
|
if b[:4]==b'MD21': return struct.unpack_from('<6f',b,8+0xA0)
|
|
if b[:4]==b'MD20': return struct.unpack_from('<6f',b,0xA0)
|
|
for t,o,l in chunks(b):
|
|
if t==b'DHOM': return struct.unpack_from('<6f',b,o+36)
|
|
raise ValueError('no box')
|
|
if __name__=='__main__':
|
|
n=load('dump/GameObjectDisplayInfo.native.tsv')
|
|
# self-check against native rows
|
|
for i in (1,2,3):
|
|
nb=box(R.read_fdid(int(n[i]['FileDataID']))); print('check',i,[round(x,3) for x in nb],n[i]['GeoBox'])
|
|
rows=[];absent=[]
|
|
for x in json.load(open('go_gap.json')):
|
|
if not x['fdid']: continue
|
|
try: b=R.read_fdid(x['fdid'])
|
|
except ValueError: b=None
|
|
if not b: absent.append(x); continue
|
|
g=box(b)
|
|
rows.append({'ID':x['display'],'GeoBox':[round(v,6) for v in g],'FileDataID':x['fdid']})
|
|
json.dump(rows,open('go_rows.json','w'),indent=0); json.dump(absent,open('go_absent.json','w'),indent=0); print('rows',len(rows),'model not in client',len(absent))
|