Port stadium blocks and facilities without periphery construction (by Codex)
This commit is contained in:
1 parent
0f36b507d4
commit
349c416f3a
21 files changed
+1185
-12
No files matched your search
@@ -14,6 +14,7 @@ from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import struct
|
||||
|
||||
|
||||
def silver_highscore_svg(source):
|
||||
@@ -103,6 +104,35 @@ def main():
|
||||
for path in sorted((source / folder).rglob('*')):
|
||||
if path.is_file() and path.suffix.lower() in ('.png', '.svg', '.jpg', '.webp'):
|
||||
add('art.' + path.relative_to(source / folder).as_posix(), path.relative_to(source).as_posix())
|
||||
# Exact approved panel bounds exclude tier-atlas seams. These are GUI
|
||||
# references only; they never become world assets or periphery actions.
|
||||
stadium_source = (source / 'desktop/stadium-menus.js').read_text()
|
||||
tier_match = re.search(r'const tierArtwork=(\{.*?\});', stadium_source, re.S)
|
||||
if not tier_match:
|
||||
raise ValueError('Missing measured stadium tier artwork')
|
||||
tiers = json.loads(tier_match[1])
|
||||
tier_kinds = {0: 'floodlights', 1: 'scoreboards', 4: 'pitch',
|
||||
6: 'condition', 7: 'safety'}
|
||||
for index in range(8):
|
||||
cap = 2 if index in (2, 3) else 4
|
||||
for level in range(1, cap + 1):
|
||||
key = f'stadium.facility.{index}.level.{level}'
|
||||
if index in tier_kinds:
|
||||
sheet = tiers[tier_kinds[index]]
|
||||
sw, sh = sheet['size']
|
||||
header = (source / sheet['file']).read_bytes()[:24]
|
||||
if header[:8] != b'\x89PNG\r\n\x1a\n' or struct.unpack('>II', header[16:24]) != (sw, sh):
|
||||
raise ValueError('Stadium tier dimensions differ from measured reference')
|
||||
x, y, width, height = sheet['rects'][level - 1]
|
||||
if min(x, y) < 0 or min(width, height) <= 0 or x + width > sw or y + height > sh:
|
||||
raise ValueError('Invalid measured stadium tier rectangle')
|
||||
add(key, sheet['file'], [x / sw, y / sh, width / sw, height / sh])
|
||||
items[key]['source_rect'] = [x, y, width, height]
|
||||
else:
|
||||
atlas = 'a' if index < 4 else 'b'
|
||||
cell = index % 4
|
||||
add(key, f'assets/studies/submenus/stadium-facilities-{atlas}-v1.png',
|
||||
[(cell % 2) / 2, (cell // 2) / 2, .5, .5])
|
||||
# The native compatibility renderer has no CSS image-filter implementation.
|
||||
# Keep the approved original untouched; supply its exact colour-only variant.
|
||||
logo_source = source / 'assets/vector/highscore-mark-v1.svg'
|
||||
|
||||
Reference in new issue
Block a user