Implement 32x32 BFS visitor navigation and daily contracts system with companion .npc journals; add native assembly scenes for Clover slots, Pyramid cards, Blackjack Party and Russian Party; package animation and sprite packs; add comprehensive offline test suites and rebuild shipping binaries.
36 lines
1.5 KiB
Python
36 lines
1.5 KiB
Python
"""Offline sprite-sheet normalization; runtime rendering remains MASM."""
|
|
import json
|
|
import struct
|
|
from pathlib import Path
|
|
|
|
from PIL import Image
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def main():
|
|
source = ROOT / "assets/sprites/tables/blackjack-guests-v1.png"
|
|
image = Image.open(source).convert("RGBA")
|
|
assert image.size == (1536, 1024)
|
|
frames = []
|
|
for row in range(2):
|
|
for column in range(3):
|
|
frame = image.crop((column * 512, row * 512, (column + 1) * 512, (row + 1) * 512))
|
|
frame = frame.resize((160, 160), Image.Resampling.NEAREST)
|
|
assert frame.getpixel((0, 0))[3] == 0
|
|
assert sum(alpha >= 240 for alpha in frame.getchannel("A").get_flattened_data()) > 6000
|
|
frames.append(frame.tobytes("raw", "BGRA"))
|
|
data = b"".join(frames)
|
|
path = ROOT / "assets/animations/tables/blackjack-guests-v1.bin"
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_bytes(struct.pack("<4sIIII", b"ANM1", 160, 160, 6, len(data)) + data)
|
|
room = Image.open(ROOT / "assets/sprites/tables/blackjack-room-v1.png").convert("RGBA")
|
|
room = room.resize((640, 480), Image.Resampling.NEAREST)
|
|
data = room.tobytes("raw", "BGRA")
|
|
room_path = ROOT / "assets/animations/tables/blackjack-room-v1.bin"
|
|
room_path.write_bytes(struct.pack("<4sIIII", b"ANM1", 640, 480, 1, len(data)) + data)
|
|
print(json.dumps({"guest_frames": 6, "size": [160, 160], "path": str(path), "room": str(room_path)}))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|